Convert Facet

The Convert Facet handles Conversions between assets in the Silo and Enrooting Unripe Deposits.

Call Functions

function convert(
    bytes calldata convertData,
    int96[] memory stems,
    uint256[] memory amounts
)
    external
    payable
    nonReentrant
    returns (int96 toStem, uint256 fromAmount, uint256 toAmount, uint256 fromBdv, uint256 toBdv);

Convert allows a user to Convert from one Deposited asset to another, given that the Conversion is on the Convert Whitelist. For example, a Farmer can Convert LP into Bean only when the Bean price is below peg, and vice versa. Read more about Convert in the Farmers' Almanac.

ParameterTypeDescription

convertData

bytes

Input parameters to determine the Conversion type.

stems

int98[]

The Stems of the Deposits to Convert.

amounts

uint256[]

The amounts within each Deposit to Convert.

Return ValueTypeDescription

toStem

int96

The new Stems of the Converted Deposit.

fromAmount

uint256

The amount of tokens Converted from.

toAmount

uint256

The amount of tokens Converted to.

fromBdv

uint256

The BDV of the Deposits Converted from.

toBdv

uint256

The BDV of the Deposits Converted to.

View Functions

None.

Events

event Convert(
    address indexed account,
    address fromToken,
    address toToken,
    uint256 fromAmount,
    uint256 toAmount
);

Emitted upon each Conversion.

ParameterTypeDescription

account

address

Address of Farmer that Converted.

fromToken

address

Whitelisted token that was Converted from.

toToken

address

Whitelisted token that was Converted to.

fromAmount

uint256

Amount of fromToken Converted.

toAmount

uint256

Amount of toAmount Converted to.

event RemoveDeposit(
    address indexed account,
    address indexed token,
    int96 stem,
    uint256 amount,
    uint256 bdv
);

Emitted when account removes a single Deposit from the Silo. Occurs during Withdraw and Convert.

ParameterTypeDescription

account

address

The Farmer whose Deposit was removed.

token

address

Whitelisted token address.

stem

int96

The Stem of the Deposit.

amount

uint256

The token amount of the Deposit.

bdv

uint256

The BDV associated with the Deposit.

event RemoveDeposits(
    address indexed account,
    address indexed token,
    int96[] stems,
    uint256[] amounts,
    uint256 amount,
    uint256[] bdvs
);

Emitted when account removes multiple Deposits from the Silo. Occurs during Withdraw and Convert.

ParameterTypeDescription

account

address

The Farmer whose Deposits were removed.

token

address

Whitelisted token address.

stems

int96[]

Stems of the Deposits.

amounts

uint256[]

The token amounts of the Deposits, corresponding to stems.

amount

uint256

Sum of amounts.

bdvs

uint256[]

The BDVs associated with the Deposits, corresponding to stems.

Last updated