redeem
params of yAssetParams -> (list(op), storage upd)
Redeem user collateral locked under yToken token of tokenId
, burning amount
of users yTokens.
The yToken
contract expects that underlying token info of tokenId
and all borrowed by user before tokenId
s are updated by calling PriceFeed.getPrice and updateInterest in the same block before this contract method
If amount
passed 0n
than amount
calculated as
amount = userBalance * token.liquidity / token.totalSupply
Types
tokenId
nat
yToken identifier
amount
nat
amount of yTokens to burn
Usage
Errors
burnAmount = amount * token.totalSupply / token.liquidity
yToken/not-enough-tokens-to-burn
- not enough balance of tokens to burnburnAmount
wanted by user.underflow/totalSupplyF
- total supply less thanburnAmount
.underflow/totalLiquidF
- total liquidity less thanamount
.token/cant-get-contract-token
- FA12 token contract address does not containtransfer
entrypoint from FA12 interface.token/cant-get-contract-fa2-token
- FA2 token contract address does not containtransfer
entrypoint from FA2 interface.yToken/exceeds-allowable-redeem
- raised when outstanding borrow value greater than max collateral value.underflow/liquidity - reserves
- liquidity more than reserves.ceil-div-error
- division of two numbers fails.yToken/need-update
- token price and interest not updated (see warning above)yToken/yToken-undefined
- token identifier is not assigned to any known yTokens.
Last updated