CDS
The CDS is another main user facing contract in Autonomint protocol, where users can deposit stablecoins like USDa, USDT to get yields.
During withdraw the user can get the deposited amount based on collateral price change between deposit and withdraw, Options fees and liquidation gains if opted.
There is a redeemUSDT option also available to get the USDT, for that equal amount of USDa needs to be burn from the user.
Write Functions
deposit
usdtAmount
uint128
Amount USDT token user is depositing.
usdaAmount
uint128
Amount USDa token user is depositing.
liquidate
bool
Whether the user is opted for liquidation gains.
liquidationAmount
uint128
Opted liquidation amount.
lockingPeriod
uint128
How long the user is willing to stay deposited in protocol.
msg.value
uint256
Lz transaction fee.
The user can able to deposit up to USDT $20K, for that the same amount of USDa is minted. After it reaches the 20K limit, the user must deposit minimum USDa amount of 80% of total depositing amount. There is an locking period option is also available to lock the deposited amount by user itself. User can also opt for liquidation gains i.e. the user can use this deposited amount to be used for liquidating collaterals.
withdraw
index
uint64
Index of the user's position, tries to withdraw.
excessProfitCumulativeValue
uint256
The cumulative value of the excess profit, needs to remove from the upside.
nonce
uint256
Nonce of the signer who signed the signsture.
signature
bytes
Excess profit cumulative value signed by admin 2.
msg.value
uint256
Lz transaction fee.
The withdraw amount is calculated by
price change of collateral between deposit and withdraw.
option fees earned by the user by protecting the borrower's collateral.
If opted for liquidation, then the user will get protected liquidated position value and collateral.
Option fees earned by user is calculated by using cumulative rate.
redeemUSDT
usdaAmount
uint128
USDa amount the user is willing to exchange.
usdaPrice
uint64
USDa price.
usdtPrice
uint64
USDT price.
msg.value
uint256
Lz transaction fee.
After user transferred USDa to the protocol through redeemUSDT() method, the same value of USDT is transferred to the user. Then the acquired USDa is burned to maintain the USDa always pegged to $1.
calculateCumulativeRate
fees
uint128
Option fees to give to CDS users.
msg.value
uint256
Lz transaction fee.
The option fees is distributed to the CDS users by using cumulative rate. During deposit the normalized amount of the deposited amount of the user is stored. When the user withdraws, the normalized amount is multiplied with current cumulative rate to get the deposited amount with option fees.
This function is only called by Borrowing contract.
calculateCumulativeValue
vaultBal
uint256
Total collateral deposited by borrowers in ETH value in all chains.
globalTotalCdsDepositedAmount
uint256
Total CDS deposited amount in all chains
_price
uint128
Current ETH price.
Calculates the cumulative value based on comparing last stored ETH price and current ETH price multiplied with Vault to CDS ratio.
This function is only called by Borrowing contract.
cdsAmountToReturn
Calculates the USDa amount to return to the user during withdraw, based on price fluctuations and collateral amount in borrow since deposit.
Setter Functions
Update Functions
ReadFunctions
Last updated