Withdraw pTokens
Last updated
Last updated
When withdrawing from pTokens, you have a few choices of functions to call depending on the needs of your platform.
withdraw()
- If you would like to input the amount of underlying shares to withdraw, burning pTokens that are not being used as collateral.
redeem()
- If you would like to redeem pTokens, that are currently being yield optimized but also not being used as collateral.
redeemCollateral()
- If you would like to redeem pTokens that are currently being used as collateral.
redeemFor()
- If you would like to redeem pTokens that are not being used as collateral, on behalf of a user. Requires the user to delegate your platform.
redeemCollateralFor()
- If you would like to redeem pTokens that are currently being used as collateral, on behalf of a user. Requires the user to delegate your platform.
Removing collateral should be done with extreme caution. Removing collateral can increase the user's loan to value ratio, which increases the risk of liquidation.
When calling withdraw, you may call it with the following arguments:
uint256
assets
The amount of underlying assets to withdraw.
address
receiver
The account that should receive the assets.
address
owner
The account that will burn their shares to withdraw assets.
Code snippets:
When calling redeem, you may use the following arguments:
uint256
shares
The amount of shares to redeem.
address
receiver
The account that should receive the assets.
address
owner
The account that will burn their shares to receive assets.
Code snippet:
when calling redeemCollateral, you may use the following arguments:
uint256
shares
The amount of collateralized shares to redeem.
address
receiver
The account that should receive the assets.
address
owner
The account that owns the shares being redeemed.
Code snippet:
To significantly reduce the number of transactions required, consider using our delegation system. Utilize redeemFor()
and redeemCollateralFor()
. You can follow our detailed .