Skip to main content

Yearn4626RouterBase.sol

Functions

mint

mint shares from an ERC4626 vault.

throws "!maxAmount" Error

function mint(IYearn4626 vault, uint256 shares, address to, uint256 maxAmountIn)
public
payable
virtual
override
returns (uint256 amountIn);

Parameters

NameTypeDescription
vaultIYearn4626The ERC4626 vault to mint shares from.
sharesuint256The amount of shares to mint from vault.
toaddressThe destination of ownership shares.
maxAmountInuint256The max amount of assets used to mint.

Returns

NameTypeDescription
amountInuint256the amount of assets used to mint by to.

deposit

deposit amount to an ERC4626 vault.

throws "!minShares" Error

function deposit(IYearn4626 vault, uint256 amount, address to, uint256 minSharesOut)
public
payable
virtual
override
returns (uint256 sharesOut);

Parameters

NameTypeDescription
vaultIYearn4626The ERC4626 vault to deposit assets to.
amountuint256The amount of assets to deposit to vault.
toaddressThe destination of ownership shares.
minSharesOutuint256The min amount of vault shares received by to.

Returns

NameTypeDescription
sharesOutuint256the amount of shares received by to.

withdraw

withdraw amount from an ERC4626 vault.

Uses the Yearn specific 'maxLoss' accounting.

function withdraw(IYearn4626 vault, uint256 amount, address to, uint256 maxLoss)
public
payable
virtual
override
returns (uint256);

Parameters

NameTypeDescription
vaultIYearn4626The ERC4626 vault to redeem shares from.
amountuint256The amount of assets to withdraw from vault.
toaddressThe destination of assets.
maxLossuint256The acceptable loss in Basis Points.

Returns

NameTypeDescription
<none>uint256sharesOut the amount of shares received by to.

withdrawDefault

withdraw amount from an ERC4626 vault.

Uses the default 4626 syntax, throws !maxShares" Error.

function withdrawDefault(IYearn4626 vault, uint256 amount, address to, uint256 maxSharesOut)
public
payable
virtual
override
returns (uint256 sharesOut);

Parameters

NameTypeDescription
vaultIYearn4626The ERC4626 vault to withdraw assets from.
amountuint256The amount of assets to withdraw from vault.
toaddressThe destination of assets.
maxSharesOutuint256

Returns

NameTypeDescription
sharesOutuint256the amount of shares received by to.

redeem

redeem shares shares from an ERC4626 vault.

Uses the Yearn specific 'maxLoss' accounting.

function redeem(IYearn4626 vault, uint256 shares, address to, uint256 maxLoss)
public
payable
virtual
override
returns (uint256);

Parameters

NameTypeDescription
vaultIYearn4626The ERC4626 vault to redeem shares from.
sharesuint256The amount of shares to redeem from vault.
toaddressThe destination of assets.
maxLossuint256The acceptable loss in Basis Points.

Returns

NameTypeDescription
<none>uint256amountOut the amount of assets received by to.

redeemDefault

redeem shares shares from an ERC4626 vault.

Uses the default 4626 syntax, throws "!minAmount" Error.

function redeemDefault(IYearn4626 vault, uint256 shares, address to, uint256 minAmountOut)
public
payable
virtual
override
returns (uint256 amountOut);

Parameters

NameTypeDescription
vaultIYearn4626The ERC4626 vault to redeem shares from.
sharesuint256The amount of shares to redeem from vault.
toaddressThe destination of assets.
minAmountOutuint256The min amount of assets received by to.

Returns

NameTypeDescription
amountOutuint256the amount of assets received by to.