💿CompWithdraw

Description

Action ID: 0x2e897428

Withdraw a token from Compound, burns cTokens and returns underlying tokens.

SDK Action

    const compWithdrawAction = new dfs.actions.compound.CompoundWithdrawAction(
        cTokenAddr,
        amount,
        to,
    );

Contract

This is a DFS STANDARD_ACTION.

Send type(uint).max to withdraw whole balance

Input:

    /// @param cTokenAddr Address of the cToken we're burning for underlying
    /// @param amount Amount of underlying tokens to withdraw
    /// @param to Address where to send the tokens to (can be left on proxy)
    struct Params {
        address cTokenAddr;
        uint256 amount;
        address to;
    }

Return value:

return bytes32(withdrawAmount);

Events:

emit ActionEvent("CompWithdraw", logData);

logger.logActionDirectEvent("CompWithdraw", logData);

bytes memory logData = abi.encode(tokenAddr, _amount, _to)

Last updated