What you can do
| supply | Deposit an asset to earn interest | approve the Pool for the amount, then Pool.supply(asset, amount, onBehalfOf, 0) |
| withdraw | Withdraw a supplied asset | Pool.withdraw(asset, amount, to); pass type(uint256).max to withdraw everything |
| borrow | Borrow against collateral | check getUserAccountData(user).healthFactor, then Pool.borrow(asset, amount, 2, 0, onBehalfOf) |
| repay | Repay variable debt | approve the Pool for the amount, then Pool.repay(asset, amount, 2, onBehalfOf) |
| toggle-collateral | Enable or disable a supplied asset as collateral | Pool.setUserUseReserveAsCollateral(asset, true or false) |
| check-position | Read collateral, debt and health factor | Pool.getUserAccountData(user); a healthFactor below 1e18 means liquidatable |
Positions can be liquidated when the health factor falls below 1. Keep a margin and check it after each borrow or price move.
Only variable rate borrowing (mode 2) is available through the Pool.
Tydro markets are governed. Governance and its roles can change reserve settings, freeze reserves, or pause the Pool.
The Pool is an upgradeable proxy, so its logic can change.
Contracts
Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).Pool (main market)pool on ink0x2816cf15F6d2A220E789aA011D5EE4eB6c47FEbA
write supply(address,uint256,address,uint16)
Supply an asset and receive aTokens. Arguments: asset, amount in the token's smallest unit, onBehalfOf, referralCode (use 0). Approve the Pool for the amount first.
write withdraw(address,uint256,address)
Withdraw a supplied asset. Arguments: asset, amount (type(uint256).max for the full balance), to. Reverts if the health factor would drop below 1 while there is debt.
write borrow(address,uint256,uint256,uint16,address)
Borrow an asset against collateral. Arguments: asset, amount, interestRateMode (must be 2, variable rate, the only option), referralCode (use 0), onBehalfOf. Check getUserAccountData first.
write repay(address,uint256,uint256,address)
Repay variable debt. Arguments: asset, amount (type(uint256).max to repay the full debt), interestRateMode (2), onBehalfOf. Approve the Pool for the amount first.
write setUserUseReserveAsCollateral(address,bool)
Enable or disable a supplied asset as collateral. Disabling reverts if it would push the health factor below the liquidation threshold.
write setUserEMode(uint8)
Switch to an efficiency mode category (higher borrowing power for correlated assets). Argument: category id, 0 for none.
read getUserAccountData(address)
Returns totalCollateralBase, totalDebtBase, availableBorrowsBase, currentLiquidationThreshold, ltv, healthFactor. Base values use the oracle base currency, usually USD with 8 decimals. healthFactor has 18 decimals.
read getReserveData(address)
Full reserve data for an asset, including the aToken and debt token addresses and the current rates.
read getReservesList()
List of assets that have reserves in the Pool.