Public ABI Description
EIP-4626 (Vault Standard)
4626 Read Methods
asset() → address
- Returns the vault's underlying asset.totalAssets() → uint256
— Returns the total amount of assets managed by the vault.convertToShares(uint256 assets) → uint256
— Calculates how manyshares
correspond toassets
.convertToAssets(uint256 shares) → uint256
— Calculates how manyassets
correspond toshares
.maxDeposit(address receiver) → uint256
— Returns the maximum deposit amount allowed forreceiver
.maxMint(address receiver) → uint256
— Returns the maximum number ofshares
that can be minted forreceiver
.maxWithdraw(address owner) → uint256
— Returns the maximum amount of assets that can be withdrawn byowner
.maxRedeem(address owner) → uint256
— Returns the maximum number ofshares
that can be redeemed byowner
.previewDeposit(uint256 assets) → uint256
— Estimates how manyshares
will be received forassets
.previewMint(uint256 shares) → uint256
— Estimates how manyassets
are needed to mintshares
.previewWithdraw(uint256 assets) → uint256
— Estimates how manyshares
must be burned to withdrawassets
.previewRedeem(uint256 shares) → uint256
— Estimates how manyassets
will be received forshares
.
4626 Write Methods
deposit(uint256 assets, address receiver) → uint256
— Depositsassets
and mintsshares
toreceiver
.mint(uint256 shares, address receiver) → uint256
— Mintsshares
in exchange forassets
.withdraw(uint256 assets, address receiver, address owner) → uint256
— Withdrawsassets
, burningshares
fromowner
.redeem(uint256 shares, address receiver, address owner) → uint256
— Redeemsshares
and transfersassets
toreceiver
.
4626 Events
Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares)
Withdraw(address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares)
EIP-4626 Collateral (Collateralized Vault Extension)
Collateral Read Methods
maxDepositCollateral(address receiver) → uint256
— Returns the max collateral deposit allowed forreceiver
.maxMintCollateral(address receiver) → uint256
— Returns the max number of collateralshares
that can be minted.maxRedeemCollateral(address owner) → uint256
— Returns the max number of collateralshares
that can be redeemed.maxWithdrawCollateral(address owner) → uint256
— Returns the max amount of collateral that can be withdrawn.previewDepositCollateral(uint256 collateralAssets) → uint256
— Estimatesshares
received for collateral deposit.previewMintCollateral(uint256 shares) → uint256
— Estimates collateral assets needed to mintshares
.previewRedeemCollateral(uint256 shares) → uint256
— Estimates assets received for redeemingshares
.previewWithdrawCollateral(uint256 collateralAssets) → uint256
— Estimatesshares
burned for collateral withdrawal.
Collateral Write Methods
depositCollateral(uint256 collateralAssets, address receiver) → uint256
— Deposits collateral and mintsshares
toreceiver
.mintCollateral(uint256 shares, address receiver) → uint256
— Mintsshares
in exchange for collateral assets.withdrawCollateral(uint256 collateralAssets, address receiver, address owner) → uint256
— Withdraws collateral assets, burningshares
fromowner
.redeemCollateral(uint256 shares, address receiver, address owner) → uint256
— Redeemsshares
for collateral assets.
Collateral Events
DepositCollateral(address indexed sender, address indexed owner, uint256 collateralAssets, uint256 shares)
WithdrawCollateral(address indexed sender, address indexed receiver, address indexed owner, uint256 collateralAssets, uint256 shares)
ERC-20 Standard
ERC-20 Read Methods
balanceOf(address owner) → uint256
— Returns the token balance ofowner
.totalSupply() → uint256
— Returns the total supply of tokens.decimals() → uint8
— Returns the number of decimal places for the token.name() → string
— Returns the token name.symbol() → string
— Returns the token symbol.allowance(address owner, address spender) → uint256
— Returns the remaining number of tokens thatspender
can use on behalf ofowner
.
ERC-20 Write Methods
approve(address spender, uint256 amount) → bool
— Approvesspender
to useamount
tokens.transfer(address recipient, uint256 amount) → bool
— Transfersamount
tokens torecipient
.transferFrom(address sender, address recipient, uint256 amount) → bool
— Transfersamount
tokens fromsender
torecipient
.
ERC-20 Events
Approval(address indexed owner, address indexed spender, uint256 value)
Transfer(address indexed from, address indexed to, uint256 value)
Auction System
Auction Read Methods
startAuction() → uint256
— Returns the timestamp when the auction started.previewExecuteAuctionBorrow(int256 deltaUserBorrowAssets) → int256
- estimates amount of borrow assets user needs to give/receive to receive/givedeltaUserBorrowAssets
amount of borrow assetspreviewExecuteAuctionCollateral(int256 deltaUserCollateralAssets) → int256
- estimates amount of collateral assets user needs to give/receive to receive/givedeltaUserCollateralAssets
amount of collateral assets.
Auction Write Methods
executeAuctionBorrow(int256 deltaUserBorrowAssets) → int256
— Executes an auction for borrow assets.executeAuctionCollateral(int256 deltaUserCollateralAssets) → int256
— Executes an auction for collateral assets.
Auction Events
AuctionExecuted(address indexed executor, int256 deltaRealCollateralAssets, int256 deltaRealBorrowAssets)
Low Level Rebalance
Low Level Rebalance Read
-
previewLowLevelBorrow(int256 deltaBorrow) → (int256 deltaCollateral, int256 deltaShares)
- Preview low level rebalance function execution with input in borrow assets.Input:
deltaBorrow - amount of assets user wants to withdraw or deposit to the protocol in borrow assets(deltaBorrow < 0 to send borrow assets).
Output:
deltaCollateral - amount of assets user will receive or should provide for LTV protocol in collateral assets. If deltaCollateral < 0 - protocol will send -deltaCollateral collateral assets to the user. Otherwise, user will have deltaCollateral assets subtracted from his account after execution
deltaShares - amount of shares user will receive or burn after execution. If deltaShares > 0 - user will receive deltaShares shares. Otherwise, -deltaShares shares will be burned.
-
previewLowLevelCollateral(int256 deltaCollateral) → (int256 deltaBorrow, int256 deltaShares)
- Preview low level rebalance function execution with input in collateral assets.Input:
deltaCollateral - amount of assets user wants to withdraw or deposit to the protocol in collateral assets(deltaCollateral > 0 to send collateral assets).
Output:
deltaBorrow - amount of assets user will receive or should provide for LTV protocol in borrow assets. If deltaBorrow > 0 - protocol will send deltaBorrow borrow assets to the user. Otherwise, user will have -deltaBorrow assets subtracted from his account after execution
deltaShares - amount of shares user will receive or burn after execution. If deltaShares > 0 - user will receive deltaShares shares. Otherwise, -deltaShares shares will be burned.
-
previewLowLevelShares(int256 deltaShares) → (int256 deltaCollateral, int256 deltaBorrow)
- Preview low level rebalance function execution with input in shares.Input:
deltaShares - amount of shares user wants to mint or burn in the protocol (deltaShares > 0 for mint).
Output:
deltaCollateral - amount of assets user will receive or should provide for LTV protocol in collateral assets. If deltaCollateral < 0 - protocol will send -deltaCollateral collateral assets to the user. Otherwise, user will have deltaCollateral assets subtracted from his account after execution
deltaBorrow - amount of assets user will receive or should provide for LTV protocol in borrow assets. If deltaBorrow > 0 - protocol will send deltaBorrow borrow assets to the user. Otherwise, user will have -deltaBorrow assets subtracted from his account after execution
-
previewLowLevelBorrowHint(int256 deltaBorrow, bool isSharesPositiveHint) → (int256 deltaCollateral, int256 deltaShares)
- Preview low level rebalance function execution with input in borrow assets with hint to avoid extra gas usage.Input:
deltaBorrow - amount of assets user wants to withdraw or deposit to the protocol in borrow assets(deltaBorrow < 0 to send borrow assets).
isSharesPositiveHint - should be true if user expects to mint shares. Can save gas spent on calculations.
Output:
deltaCollateral - amount of assets user will receive or should provide for LTV protocol in collateral assets. If deltaCollateral < 0 - protocol will send -deltaCollateral collateral assets to the user. Otherwise, user will have deltaCollateral assets subtracted from his account after execution
deltaShares - amount of shares user will receive or burn after execution. If deltaShares > 0 - user will receive deltaShares shares. Otherwise, -deltaShares shares will be burned.
-
previewLowLevelCollateralHint(int256 deltaCollateral, bool isSharesPositiveHint) → (int256 deltaBorrow, int256 deltaShares)
- Preview low level rebalance function execution with input in collateral assets with hint to avoid extra gas usage.Input:
deltaCollateral - amount of assets user wants to withdraw or deposit to the protocol in collateral assets(deltaCollateral > 0 to send collateral assets).
isSharesPositiveHint - should be true if user expects to mint shares. Can save gas spent on calculations.
Output:
deltaBorrow - amount of assets user will receive or should provide for LTV protocol in borrow assets. If deltaBorrow > 0 - protocol will send deltaBorrow borrow assets to the user. Otherwise, user will have -deltaBorrow assets subtracted from his account after execution
deltaShares - amount of shares user will receive or burn after execution. If deltaShares > 0 - user will receive deltaShares shares. Otherwise, -deltaShares shares will be burned.
Low Level Rebalance Write
-
executeLowLevelBorrow(int256 deltaBorrow) → (int256 deltaCollateral, int256 deltaShares)
- Execute low level rebalance with input in borrow assets.Input:
deltaBorrow - amount of assets user wants to withdraw or deposit to the protocol in borrow assets(deltaBorrow < 0 to send borrow assets).
Output:
deltaCollateral - amount of assets user will receive or should provide for LTV protocol in collateral assets. If deltaCollateral < 0 - protocol will send -deltaCollateral collateral assets to the user. Otherwise, user will have deltaCollateral assets subtracted from his account after execution
deltaShares - amount of shares user will receive or burn after execution. If deltaShares > 0 - user will receive deltaShares shares. Otherwise, -deltaShares shares will be burned.
-
executeLowLevelCollateral(int256 deltaCollateral) → (int256 deltaBorrow, int256 deltaShares)
- Execute low level rebalance with input in collateral assets.Input:
deltaCollateral - amount of assets user wants to withdraw or deposit to the protocol in collateral assets(deltaCollateral > 0 to send collateral assets).
Output:
deltaBorrow - amount of assets user will receive or should provide for LTV protocol in borrow assets. If deltaBorrow > 0 - protocol will send deltaBorrow borrow assets to the user. Otherwise, user will have -deltaBorrow assets subtracted from his account after execution
deltaShares - amount of shares user will receive or burn after execution. If deltaShares > 0 - user will receive deltaShares shares. Otherwise, -deltaShares shares will be burned.
-
executeLowLevelShares(int256 deltaShares) → (int256 deltaCollateral, int256 deltaBorrow)
- Execute low level rebalance with input in shares.Input:
deltaShares - amount of shares user wants to mint or burn in the protocol (deltaShares > 0 for mint).
Output:
deltaCollateral - amount of assets user will receive or should provide for LTV protocol in collateral assets. If deltaCollateral < 0 - protocol will send -deltaCollateral collateral assets to the user. Otherwise, user will have deltaCollateral assets subtracted from his account after execution
deltaBorrow - amount of assets user will receive or should provide for LTV protocol in borrow assets. If deltaBorrow > 0 - protocol will send deltaBorrow borrow assets to the user. Otherwise, user will have -deltaBorrow assets subtracted from his account after execution
-
executeLowLevelBorrowHint(int256 deltaBorrow, bool isSharesPositiveHint) → (int256 deltaCollateral, int256 deltaShares)
- Execute low level rebalance with input in borrow assets with hint to avoid extra gas usage.Input:
deltaBorrow - amount of assets user wants to withdraw or deposit to the protocol in borrow assets(deltaBorrow < 0 to send borrow assets).
isSharesPositiveHint - should be true if user expects to mint shares. Can save gas spent on calculations.
Output:
deltaCollateral - amount of assets user will receive or should provide for LTV protocol in collateral assets. If deltaCollateral < 0 - protocol will send -deltaCollateral collateral assets to the user. Otherwise, user will have deltaCollateral assets subtracted from his account after execution
deltaShares - amount of shares user will receive or burn after execution. If deltaShares > 0 - user will receive deltaShares shares. Otherwise, -deltaShares shares will be burned.
-
executeLowLevelCollateralHint(int256 deltaCollateral, bool isSharesPositiveHint) → (int256 deltaBorrow, int256 deltaShares)
- Execute low level rebalance with input in collateral assets with hint to avoid extra gas usage.Input:
deltaCollateral - amount of assets user wants to withdraw or deposit to the protocol in collateral assets(deltaCollateral > 0 to send collateral assets).
isSharesPositiveHint - should be true if user expects to mint shares. Can save gas spent on calculations.
Output:
deltaBorrow - amount of assets user will receive or should provide for LTV protocol in borrow assets. If deltaBorrow > 0 - protocol will send deltaBorrow borrow assets to the user. Otherwise, user will have -deltaBorrow assets subtracted from his account after execution
deltaShares - amount of shares user will receive or burn after execution. If deltaShares > 0 - user will receive deltaShares shares. Otherwise, -deltaShares shares will be burned.
State Representation
State Read Methods
borrowToken() → address
— Returns the borrow token contract address.collateralToken() → address
— Returns the collateral token contract address.futureBorrowAssets() → int256
— Returns current auction borrow assets.futureCollateralAssets() → int256
— Returns current auction collateral assets.futureRewardBorrowAssets() → int256
— Returns current auction reward in borrow assets.futureRewardCollateralAssets() → int256
— Returns current auction reward in collateral assets.getRealBorrowAssets() → uint256
— Returns protocol's current debt in lending protocol in borrow assets.getRealCollateralAssets() → uint256
— Returns protocol's current collateral in lending protocol in collateral assets.maxSafeLTV() → uint128
— Returns the maximum safe loan-to-value ratio.maxTotalAssetsInUnderlying() → uint256
- protocol top border in underlying oracle assets.minProfitLTV() → uint128
— Returns the minimum profitable LTV.targetLTV() → uint128
— Returns the target loan-to-value ratio.oracleConnector() → address
- Returns oracle connector address.lendingConnector() → address
- Returns lending protocol connector address.feeCollector() → address
- Returns fee collector address.
State Events
StateUpdated(int256 oldFutureBorrowAssets, int256 oldFutureCollateralAssets, int256 oldFutureRewardBorrowAssets, int256 oldFutureRewardCollateralAssets, uint256 oldStartAuction, int256 newFutureBorrowAssets, int256 newFutureCollateralAssets, int256 newFutureRewardBorrowAssets, int256 newFutureRewardCollateralAssets, uint256 newStartAuction)
Ownership
Ownership Read Methods
owner() → address
— Returns the address of the current owner.
Ownership Write Methods
transferOwnership(address newOwner)
— Transfers contract ownership tonewOwner
.renounceOwnership()
— Renounces ownership of the contract.
Administration
Administration Write Methods
setTargetLTV(uint128 value)
- Set protocol new target LTV.setMaxSafeLTV(uint128 value)
- Set protocol new max safe LTV.setMainProfitLTV(uint128 value)
- Set protocol new min profit LTV.setFeeCollector(address _feeCollector)
- Set protocol new fee collector.setLendingConnector(address _oracleConnector)
- Set lending protocol connector address.setMaxGrowthFee(uint256 fee)
- Set protocol max growth fee.setMaxTotalAssetsInUnderlying(uint256 _maxTotalAssetsInUnderlying)
- Set protocol top border in underlying oracle assets.
Administration Events
MaxSafeLTVChanged(uint128 oldValue, uint128 newValue)
MinProfitLTVChanged(uint128 oldValue, uint128 newValue)
TargetLTVChanged(uint128 oldValue, uint128 newValue)
Ownership Events
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Connectors
Read Connector Address
oracleConnector() → address
- Returns oracle connector address.lendingConnector() → address
- Returns lending protocol connector address.