合约集成指南
找到如何开始在Euler智能合约上工作
模块
Deposit and withdraw
// Approve the main euler contract to pull your tokens:
IERC20(underlying).approve(EULER_MAINNET, type(uint).max);
// Use the markets module:
IEulerMarkets markets = IEulerMarkets(EULER_MAINNET_MARKETS);
// Get the eToken address using the markets module:
IEulerEToken eToken = IEulerEToken(markets.underlyingToEToken(underlying));
// Deposit 5.25 underlying tokens (assuming 18 decimal places)
// The "0" argument refers to the sub-account you are depositing to.
eToken.deposit(0, 5.25e18);
eToken.balanceOf(address(this));
// -> internal book-keeping value that doesn't increase over time
eToken.balanceOfUnderlying(address(this));
// -> 5.25e18
// ... but check back next block to see it go up (assuming there are borrowers)
// Later on, withdraw your initial deposit and all earned interest:
eToken.withdraw(0, type(uint).max);借入和赎回
闪电贷
低级闪电贷
EIP-3156 闪电贷
Last updated