Treasury
The Treasury / Vault is the main core contract in Autonomint. All the funds are transferred here, from Borrowing and CDS. External protocol deposits and yields are generated in treasury contract.
Write Functions
deposit
user
address
Address of the borrower.
ethPrice
uint128
Current ETH price.
depositTime
uint64
Depositing time.
depositingAmount
uint256
Depositing amount by borrower.
In this function, the borrower's position data are stored and half of the deposited collateral is deposited in External protocol.
withdraw
borrower
address
Borrower's address.
toAddress
address
Receiver's address.
amount
uint256
Withdraw amount.
index
uint64
Index pf the withdrew position.
Transfers 50% of the deposited amount with call option gains.
withdrawFromExternalProtocol
user
address
User's address who is redeeming ABOND.
index
uint64
Index of the user.
Withdraws the ETH backed with interest gained for the redeemable ABOND amount. Then the ABOND is burned from user.
withdrawFromExternalProtocolDuringLiq
user
address
User's address who is redeeming ABOND.
aBondAmount
uint128
ABOND amount to redeem.
Withdraws the ETH from External protocol i.e, the 50% of the deposited amount.
approveTokens
spender
address
Address of the spender.
amount
uint256
Amount of tokens to approve.
Approves the asset to be spend by spender (mostly core contracts).
_calculateCumulativeRate
_currentExchangeRate
uint256
Current ionWETH to WETH exchange rate.
_protocol
Protocol
External protocol name.
Calculates the cumulative rate for that protocol and store that.
depositToIonicByUser
depositAmount
uint256
Collateral amount to deposit in Ionic.
Deposits the collateral amount to Ionicprotocol. Updates the cumulative rate(to calculate interest) for Ionic protocol.
depositToAaveByUser
depositAmount
uint256
Collateral amount to deposit in Aave.
Deposits the collateral amount to Aave protocol. Updates the cumulative rate(to calculate interest) for Aave protocol.
depositToCompoundByUser
depositAmount
uint256
Collateral amount to deposit in Compound.
Deposits the collateral amount to Compound protocol. Updates the cumulative rate(to calculate interest) for Compound protocol.
withdrawFromIonicByuser
user
address
Address of the user.
aBondAmount
uint128
ABOND amount the user is redeeming.
Withdraws the collateral with interest from Ionic and transfer it to user. The initial deposited amount and interest gained is calculated by ABOND amount, collateral backed, cumulative rate for that ABOND and current cumulative rate.
withdrawFromAaveByuser
user
address
Address of the user.
aBondAmount
uint128
ABOND amount the user is redeeming.
Withdraws the collateral with interest from Aave and transfer it to user. The initial deposited amount and interest gained is calculated by ABOND amount, collateral backed, cumulative rate for that ABOND and current cumulative rate.
withdrawFromCompoundByuser
user
address
Address of the user.
aBondAmount
uint128
ABOND amount the user is redeeming.
Withdraws the collateral with interest from Compound and transfer it to user. The initial deposited amount and interest gained is calculated by ABOND amount, collateral backed, cumulative rate for that ABOND and current cumulative rate.
withdrawFromIonicDuringLiq
user
address
Address of the user.
index
uint64
Index of the borrower position which is going to be liquidated.
Withdraws the collateral with interest from Ionic and kept it in treasury. The initial deposited amount and interest gained is calculated by cumulative rate during deposit and current cumulative rate.
withdrawInterest
toAddress
address
Receiver's address to get interest.
amount
uint256
Interest amount to withdraw.
Withdraws the interest gained in protocol by owner.
transferEthToCdsLiquidators
borrower
address
Address of the CDS user who opted for liquidation to transfer ETH.
amount
uint128
Amount of ETH to transfer.
Gets USDa and Native token from destination chain to this chain treasury.This function can only be called by Borrowing or CDS contracts.
transferFundsToGlobal
transferAmount
uint256[4]
Array of amounts needs to transfer to global contract in the order of AssetName enum.
Transfers the respective amounts to the global contract.
swapCollateralForUSDT
swapAmount
uint256
Amount of collateral to swap.
odosAssembledData
bytes
Odos assembled data got from Odos API for swapping.
Swaps the collateral to USDT.
Setter Functions
setExternalProtocolAddresses
ionicWETHAddress
address
ionic WETH contract address.
wethAddress
address
WETH address.
odosRouterV2Address
address
Odos router v2 address.
Sets the respective addresses, only called by owner.
Read Functions
calculateYieldsForExternalProtocol
user
address
Address of the user who is redeeming ABOND.
aBondAmount
uint128
Amount of ABOND the user is redeeming.
Returns the yields acquired for that ABOND tokens to the user.
getBorrowing
depositor
address
Borrower's address.
index
uint64
Index of the borrower.
Returns the borrower's total index and details of that particular index.
getTotalDeposited
depositor
address
Borrower's address.
Returns the borrower's total deposited amount in ETH value.
getCumulativeRate
Returns the last stored cumulative rate of the protocol.
getCurrentCumulativeRate
Returns the current cumulative rate of the protocol.
getExternalProtocolCumulativeRate
Returns the external protocol cumulative rate. If the param is true, returns the maximum cumulative rate, else vice versa.
Last updated