🐔CBChickenOut

Withdraws backing lusd from a pending bond

Description

When the bond is in the pending stage, user can chicken out and withdraw the whole LUSD amount in the bond, forfeiting the interest earned on the LUSD. In some specific cases (bad liquidations, hacks...) the whole amount of LUSD might not be able to be returned so there is a minLUSD parameter as well.

Action calls chickenBondManager.chickenOut(uint256 _bondID, uint256 _minLUSD);

SDK Action


const chickenOutAction = new dfs.actions.chickenBonds.CBChickenOutAction(
    bondID,
    minAmount,
    to,
);

Contract

This is a standard dfs action.

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

Proxy must have a non 0 balance of LUSD to withdraw or the action reverts

Input:

/// @param bondID NFT token id of the bond
/// @param minLUSD Minimum amount of LUSD to be returned if the full amount is not avail.
/// @param to Address where to send LUSD returned
struct Params {
    uint256 bondID;
    uint256 minLUSD;
    address to;
}

Return value:

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

Events:


bytes memory logData = abi.encode(lusdAmountToSend, _params.bondID, _params.to);
        
// event for direct call
logger.logActionDirectEvent("CBChickenOut", logData);

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

Last updated