🐔CBRedeem

Redeem LUSD (sometimes yTokens) for bLUSD

Description

Action redeems bLUSD tokens for LUSD tokens, from the chickend bond manager contract. The user gets back LUSD tokens based on the redemption rate of the contract. Yearn yTokens can also be returned back to the user in case of the vault is deprecated and makes it redeemable.

Action calls ChickenBondManager.redeem(uint256 _bLUSDToRedeem, uint256 _minLUSDFromBAMMSPVault);

SDK Action


// proxy must have bLUSD approval if from addr is not proxy
await approve(BLUSD_ADDR, proxy.address);

const cbRedeemAction = new dfs.actions.chickenBonds.CBRedeemAction(
    bLUSDAmount,
    minLUSDFromSP,
    from,
    to,
);

Contract

This is a standard dfs action.

DSProxy has to have approval to pull the bLUSD from the specified account

to parameter can't be address(0) the action will revert

Input:

/// @param bLUSDAmount Amount of bLusd tokens to pull
/// @param minLUSDFromSP Min. amount of LUSD to receive
/// @param from Address from where to pull bLusd tokens
/// @param to Address where to send LUSD tokens (possibly yTokens as well)
struct Params {
    uint256 bLUSDAmount;
    uint256 minLUSDFromSP;
    address from;
    address to;
}

Return value:

return bytes32(lusdAmount); // amount of LUSD returned

Events:


bytes memory logData = abi.encode(
        lusdFromBAMMSPVault,
        yTokensFromCurveVault,
        _params.bLUSDAmount,
        _params.minLUSDFromSP,
        _params.to
);
        
// event for direct call
logger.logActionDirectEvent("CBRedeem", logData);

// event in recipe
emit ActionEvent("CBRedeem", logData);

Last updated