Withdraw

Getting collateral assets back to your wallet

This documentation is a work in progress!

Withdrawing collateral will decrease your health factor.

At some point you might want the deposited collateral back to your wallet. This is done by performing a withdraw from the protocol.

On withdrawals, the protocol performs checks on the user debt. This prevents withdrawals that would cause the CDP's collateral ratio to get under the MCR. If the checks pass, protocol reduces the recorded collateral deposit amount for the user and transfer the amount of tokens requested to the user.

Each withdrawal will emit an event with relevant information.

/**
* @notice Emitted when an account withdraws collateral.
* @param account The address of the account withdrawing collateral.
* @param collateralAsset The address of the collateral asset.
* @param amount The amount of the collateral asset that was withdrawn.
*/
event CollateralWithdrawn(address indexed account, address indexed collateralAsset, uint256 indexed amount);

Conditions Preventing Withdrawals

Insufficient Collateral

If an account has existing debt, there is a minimum collateral value required to back it up.

If accounts collateral value is smaller than the minimum collateral value, the withdrawal is not permitted.

Safety State: Pause

In an emergency situation the Safety Council multisig can pause the withdrawals of a Collateral Asset to prevent possible negative impact it would have.

Kresko Asset Minimum Collateral Amount

For Kresko Asset collaterals the minimum amount of collateral is 1e12 or 0.000001. So if you withdrawal ends up leaving dust lower than this amount, the transaction will revert.

Last updated