Skip to content

IController

Git Source

Interface for the Controller contract that handles conversion logic and share token operations

This interface defines the core functionality for asset-to-share conversion calculations and share token minting/burning. The Controller is called by vaults to perform conversion logic while the vaults themselves handle asset transfers

Functions

vaultFor

Returns the address of the Vault for the given asset

function vaultFor(address asset) external view returns (address);
Parameters
NameTypeDescription
assetaddressThe address of the asset
Returns
NameTypeDescription
<none>addressThe address of the associated Vault

share

Returns the address of the share token contract

function share() external view returns (address);
Returns
NameTypeDescription
<none>addressThe address of the share token

deposit

Calculates shares to mint and mints share tokens based on deposited assets

Called by vaults after they receive asset transfers. Handles conversion logic and share minting

function deposit(uint256 assets, address receiver) external returns (uint256 shares);
Parameters
NameTypeDescription
assetsuint256The amount of assets that were deposited into the vault
receiveraddressThe address that will receive the minted shares
Returns
NameTypeDescription
sharesuint256The amount of shares minted to the receiver

mint

Calculates required assets and mints specified shares to receiver

Called by vaults to determine asset requirements and mint share tokens

function mint(uint256 shares, address receiver) external returns (uint256 assets);
Parameters
NameTypeDescription
sharesuint256The amount of shares to mint
receiveraddressThe address that will receive the minted shares
Returns
NameTypeDescription
assetsuint256The amount of assets required from the vault for the minted shares

withdraw

Calculates shares to burn and burns them for asset withdrawal

Called by vaults before they transfer assets. Handles conversion logic and share burning

function withdraw(uint256 assets, address spender, address owner) external returns (uint256 shares);
Parameters
NameTypeDescription
assetsuint256The amount of assets to be withdrawn by the vault
spenderaddressThe address that is burning the shares
owneraddressThe address that owns the shares being burned
Returns
NameTypeDescription
sharesuint256The amount of shares burned from the owner

redeem

Burns specified shares and calculates equivalent asset amount

Called by vaults to burn share tokens and determine asset transfer amounts

function redeem(uint256 shares, address spender, address owner) external returns (uint256 assets);
Parameters
NameTypeDescription
sharesuint256The amount of shares to burn
spenderaddressThe address that is burning the shares
owneraddressThe address that owns the shares being burned
Returns
NameTypeDescription
assetsuint256The amount of assets the vault should transfer to the receiver

previewDeposit

Calculates the amount of shares that would be minted for a given asset amount

function previewDeposit(uint256 assets) external view returns (uint256 shares);
Parameters
NameTypeDescription
assetsuint256The amount of assets to calculate shares for
Returns
NameTypeDescription
sharesuint256The amount of shares that would be minted

previewMint

Calculates the amount of assets required to mint a specified amount of shares

function previewMint(uint256 shares) external view returns (uint256 assets);
Parameters
NameTypeDescription
sharesuint256The amount of shares to calculate asset requirements for
Returns
NameTypeDescription
assetsuint256The amount of assets required to mint the specified shares

previewWithdraw

Calculates the amount of shares that would be burned for a given asset withdrawal

function previewWithdraw(uint256 assets) external view returns (uint256 shares);
Parameters
NameTypeDescription
assetsuint256The amount of assets to calculate share burn for
Returns
NameTypeDescription
sharesuint256The amount of shares that would be burned

previewRedeem

Calculates the amount of assets equivalent to burning specified shares

function previewRedeem(uint256 shares) external view returns (uint256 assets);
Parameters
NameTypeDescription
sharesuint256The amount of shares to calculate asset equivalent for
Returns
NameTypeDescription
assetsuint256The amount of assets equivalent to the specified shares

maxDeposit

Returns the maximum amount of assets that can be processed for share minting

function maxDeposit(address receiver) external view returns (uint256);
Parameters
NameTypeDescription
receiveraddressThe address that would receive the minted shares
Returns
NameTypeDescription
<none>uint256The maximum amount of assets that can be converted to shares

maxMint

Returns the maximum amount of shares that can be minted to the receiver

function maxMint(address receiver) external view returns (uint256);
Parameters
NameTypeDescription
receiveraddressThe address that would receive the minted shares
Returns
NameTypeDescription
<none>uint256The maximum amount of shares that can be minted

maxWithdraw

Returns the maximum amount of assets that can be processed for share burning

function maxWithdraw(address owner, uint256 availableAssets) external view returns (uint256);
Parameters
NameTypeDescription
owneraddressThe address that owns the shares
availableAssetsuint256The amount of assets currently available in the vault
Returns
NameTypeDescription
<none>uint256The maximum amount of assets that can be withdrawn through share burning

maxRedeem

Returns the maximum amount of shares that can be burned by the owner

function maxRedeem(address owner, uint256 availableAssets) external view returns (uint256);
Parameters
NameTypeDescription
owneraddressThe address that owns the shares
availableAssetsuint256The amount of assets currently available in the vault
Returns
NameTypeDescription
<none>uint256The maximum amount of shares that can be redeemed