🐔CBCreate

Creates a Chicken Bond from a proxy

Description

Action creates a chicken bond which returns a NFT which is stored on the DSProxy. Action calls ChickenBondManager.createBond(uint256 _lusdAmount)

SDK Action


// make proxy has approval before call
await approve(LUSD_ADDR, proxy.address);

const createCBAction = new dfs.actions.chickenBonds.CBCreateAction(
  lusdAmount, // lusd amount in wei
  from, // account where to pull lusd from
);

Contract

This is a standard dfs action.

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

If amount == max.uint it will pull whole balance of _params.from

Input:

/// @param amount LUSD token amount to pull
/// @param from Account from where to pull LUSD amount
struct Params {
    uint256 amount;
    address from;
}

Return value:

return bytes32(bondId); // nft id of the newly created bond

Events:

bytes memory logData = abi.encode(bondId, _params.amount, _params.from);

// event for direct call
logger.logActionDirectEvent("CBCreate", logData);

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

Last updated