What you can do
| supply | Deposit an asset to earn interest | approve the Pool for the amount, then Pool.supply(asset, amount, onBehalfOf, 0); spTokens are minted to onBehalfOf |
| withdraw | Withdraw a supplied asset | Pool.withdraw(asset, amount, to); pass type(uint256).max to withdraw the full balance |
| borrow | Borrow against collateral | check getUserAccountData(user).healthFactor first, then Pool.borrow(asset, amount, 2, 0, onBehalfOf); stable mode (1) is not available |
| repay | Repay a 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); healthFactor below 1e18 means liquidatable |
Positions can be liquidated if the health factor falls below 1. Keep a margin above 1 and check it after each borrow or price move.
Stable-rate borrowing is disabled on the reserves. Only variable borrowing (mode 2) works.
Rates are set by governance and can change, unlike utilization-based rate curves.
Spark governance and its freezer and pause roles can freeze reserves or pause the market.
Contracts
Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).Pool (main market)pool on ethereum0xC13e21B648A5Ee794902342038FF3aDAB66BE987
write supply(address,uint256,address,uint16)
Supply an ERC20 asset. Arguments: asset, amount in the token's smallest unit, onBehalfOf, referralCode (0 for none). Approve the Pool for the amount first. Receive spTokens.
write withdraw(address,uint256,address)
Withdraw a supplied asset. Arguments: asset, amount (type(uint256).max for the full balance), recipient. Returns the amount withdrawn. Reverts if the health factor would drop below 1 while the caller has debt.
write borrow(address,uint256,uint256,uint16,address)
Borrow an asset against collateral. Arguments: asset, amount, interestRateMode (use 2 for variable; stable mode is disabled), referralCode, onBehalfOf. Reverts if the health factor would fall below 1.
write repay(address,uint256,uint256,address)
Repay debt. Arguments: asset, amount (type(uint256).max to clear debt, only when onBehalfOf is the caller), interestRateMode (2 for variable), onBehalfOf. Approve the Pool for the amount first. Returns the amount repaid.
write setUserUseReserveAsCollateral(address,bool)
Enable or disable a supplied asset as collateral. Disabling reverts if it would push the caller's health factor below the liquidation threshold. Enabling reverts if the asset has an LTV of 0.
read getUserAccountData(address)
Returns totalCollateralBase, totalDebtBase, availableBorrowsBase, currentLiquidationThreshold, ltv, healthFactor. Base currency values use 8 decimals for USD oracles. healthFactor is type(uint256).max with no debt; 18 decimals otherwise.
read getReserveData(address)
Full reserve struct for an asset: configuration, liquidity and borrow indexes, rates, and the spToken, debt token and rate strategy addresses.
write flashLoanSimple(address,address,uint256,bytes,uint16)
Single-asset flash loan. Arguments: receiver contract (must implement executeOperation), asset, amount, params, referralCode. The receiver must repay amount plus fee within the same transaction.
PoolAddressesProvider (main market)other on ethereum0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE
read getPool()
Current Pool proxy address. Read this instead of hardcoding the Pool when the market is upgraded.
read getPoolConfigurator()
Current PoolConfigurator address, used for governance parameter changes.
read getPriceOracle()
Price oracle used by the market.
read getACLManager()
Access control manager for the market.
read getPoolDataProvider()
Protocol data provider with reserve and user data helpers.
Pool (Gnosis market)pool on gnosis0x2Dae5307c5E3FD1CF5A72Cb6F698f915860607e0
write supply(address,uint256,address,uint16)
Supply an ERC20 asset on Gnosis. Arguments: asset, amount in the token's smallest unit, onBehalfOf, referralCode (0 for none). Approve the Pool for the amount first.
write withdraw(address,uint256,address)
Withdraw a supplied asset on Gnosis. Arguments: asset, amount (type(uint256).max for the full balance), recipient. Reverts if the health factor would drop below 1.
write borrow(address,uint256,uint256,uint16,address)
Borrow on Gnosis. Arguments: asset, amount, interestRateMode (2 for variable), referralCode, onBehalfOf. Reverts if the health factor would fall below 1.
write repay(address,uint256,uint256,address)
Repay debt on Gnosis. Arguments: asset, amount, interestRateMode (2 for variable), onBehalfOf. Approve the Pool for the amount first.
read getUserAccountData(address)
Collateral, debt, borrow capacity, liquidation threshold, LTV and healthFactor for a user on the Gnosis market.
read getReserveData(address)
Full reserve struct for an asset on the Gnosis market.