ATM Contracts
Integrate the Teller protocol liquidity pool into your application
deposit()
/* Interfaces */
import "@teller-protocol-v1/contracts/interfaces/LendingPoolInterface.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/* Retrieve contract */
LendingPoolInterface public lendingPool;
lendingPool = LendingPoolInterface(address("0x36633E18592e30eDfC7ffe1FD4B5EA7BA21ac20E")); // Ropsten address
/* Approve LendingPool to move user's funds */
address usdc = address("0x20572e4c090f15667cf7378e16fad2ea0e2f3eff"); // Ropsten address
uint256 amount = 1000;
IERC20(usdc).approve(lendingPool.address, amount, { from: user });
/* Deposit user funds into lending pool */
lendingPool.deposit(amount, { from:user });/* Import contract artifact */
import LendingPool from "./LendingPool.json";
import TUSDC from "./TUSDC.json";
/* Initialize contract instance */
const lendingPoolAddress = "0x36633E18592e30eDfC7ffe1FD4B5EA7BA21ac20E"; // Ropsten address
const lendingPoolInstance = new web3.eth.Contract(LendingPool.abi, lendingPoolAddress);
/* Approve ERC20 transfer from user */
const usdcAddress = "0x20572e4c090f15667cf7378e16fad2ea0e2f3eff";
const usdcInstance = new web3.eth.Contract(ZUSDC.abi, usdcAddress);
const depositAmount = 1000;
await usdcInstance.methods.approve(lendingPoolAddress, depositAmount).send( {from: user});
/* Deposit assets into LendingPool */
await lendingPoolInstance.methods.deposit(depositAmount, { from: user });withdraw()
Last updated
Was this helpful?

