ATM Contracts
Integrate the Teller protocol liquidity pool into your application
As part of the Teller protocol, depositors provide liquidity to decentralized, non-custodial markets within the Teller ATM to earn passive income or interest. Teller's non-custodial markets are, in essence, liquidity pools designated to an underlying asset. Assets within the ATM's liquidity pools can be borrowed through unsecured loans by connecting a bank account, or secured loans, by providing 20% collateral or more.‌
Developers can build applications that integrate with these liquidity pools. In order to allow users to deposit or withdraw their assets into a pool, the developer's application must call the functions located in the lending pool smart contract.‌

deposit()

function deposit( uint256 amount )
amount represents the amount of an asset that a user wishes to deposit into the liquidity pool.
Please note, the contract call should be made from the depositors' wallet address, as the minted tokens will be transferred tomsg.sender
Parameter Name
Type
Description
amount
uint256
The amount to be deposited
Upon depositing assets to the protocol, tTokens representing proof of deposit are minted and given to the depositor in exchange.
Deposit process flow
Solidity
Web3.js
1
/* Interfaces */
2
import "@teller-protocol-v1/contracts/interfaces/LendingPoolInterface.sol";
3
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
4
5
/* Retrieve contract */
6
LendingPoolInterface public lendingPool;
7
lendingPool = LendingPoolInterface(address("0x36633E18592e30eDfC7ffe1FD4B5EA7BA21ac20E")); // Ropsten address
8
9
/* Approve LendingPool to move user's funds */
10
address usdc = address("0x20572e4c090f15667cf7378e16fad2ea0e2f3eff"); // Ropsten address
11
uint256 amount = 1000;
12
IERC20(usdc).approve(lendingPool.address, amount, { from: user });
13
14
/* Deposit user funds into lending pool */
15
lendingPool.deposit(amount, { from:user });
Copied!
1
/* Import contract artifact */
2
import LendingPool from "./LendingPool.json";
3
import TUSDC from "./TUSDC.json";
4
5
/* Initialize contract instance */
6
const lendingPoolAddress = "0x36633E18592e30eDfC7ffe1FD4B5EA7BA21ac20E"; // Ropsten address
7
const lendingPoolInstance = new web3.eth.Contract(LendingPool.abi, lendingPoolAddress);
8
9
/* Approve ERC20 transfer from user */
10
const usdcAddress = "0x20572e4c090f15667cf7378e16fad2ea0e2f3eff";
11
const usdcInstance = new web3.eth.Contract(ZUSDC.abi, usdcAddress);
12
const depositAmount = 1000;
13
await usdcInstance.methods.approve(lendingPoolAddress, depositAmount).send( {from: user});
14
15
/* Deposit assets into LendingPool */
16
await lendingPoolInstance.methods.deposit(depositAmount, { from: user });
Copied!

withdraw()

function withdraw( uint256 amount )
Contrary to the deposit() method, and as the function's name suggests, amount here represents the amount of an asset that a user wishes to withdraw from the liquidity pool.
Parameter Name
Type
Description
amount
uint256
The amount to be withdrawn
Similar to the deposit() method, the contract call needs to be made from the depositors' address as the assets will be sent tomsg.sender
When a user initiates a withdrawal of their asset, their tTokens will be burned and their assets subsequently sent to their wallet address.
Withdrawal process flow
Solidity
Web3.js
1
/* Interfaces */
2
import "@teller-protocol-v1/contracts/interfaces/LendingPoolInterface.sol";
3
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
4
5
/* Retrieve contract */
6
LendingPoolInterface public lendingPool;
7
lendingPool = LendingPoolInterface(address("0x36633E18592e30eDfC7ffe1FD4B5EA7BA21ac20E)); // Ropsten address
8
9
/* Deposit user funds into lending pool */
10
lendingPool.withdraw(amount, { from:user });
Copied!
1
/* Import contract artifact */
2
import LendingPool from "./LendingPool.json";
3
4
/* Initialize contract instance */
5
const lendingPoolAddress = "0x36633E18592e30eDfC7ffe1FD4B5EA7BA21ac20E"; // Ropsten address
6
const lendingPoolInstance = new web3.eth.Contract(LendingPool.abi, lendingPoolAddress);
7
8
/* Deposit assets into LendingPool */
9
const withdrawalAmount = 1000;
10
await lendingPoolInstance.methods.withdraw(withdrawalAmount, { from: user });
Copied!
Copy link