BaseVault
Last updated
Last updated
Base contract responsible for the main logic of our vault. It inherits ERC4626 and ERC20 contracts, so, some functions are not shown below. We only document the functions that we did any modification or overridden on it. You can check ERC4626 specification here, and ERC20 here.
src: https://github.com/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L35
DENOMINATOR represents the precision for the following system variables: - MAX_WITHDRAW_FEE - INVESTOR_RATIO
Returns
Name | Type | Description |
---|---|---|
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L41
MAX_WITHDRAW_FEE is a safe check in case the ConfigurationManager sets a fee high enough that can be used as a way to drain funds. The precision of this number is set by constant DENOMINATOR.
Returns
Name | Type | Description |
---|---|---|
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L47
Minimum asset amount for the first deposit
This amount prevents the first depositor to steal funds from subsequent depositors. See https://code4rena.com/reports/2022-01-sherlock/#h-01-first-user-can-steal-everyone-elses-tokens
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L49
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L97
Returns the current round ID.
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L104
Determines whether the Vault is in the processing deposits state.
While it's processing deposits, processDeposits
can be called and new shares can be created. During this period deposits, mints, withdraws and redeems are blocked.
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L111
Returns the amount of processed deposits entering the next round.
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L313
Outputs addresses in the deposit queue
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L325
Returns the vault controller
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L284
Outputs the amount of asset tokens of an owner
is idle, waiting for the next round.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L275
Returns the fee charged on withdraws.
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L306
Outputs current size of the deposit queue.
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L226
Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, through a deposit call. - MUST return a limited value if receiver is subject to some deposit limit. - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. - MUST NOT revert.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L242
Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. - MUST return a limited value if receiver is subject to some mint limit. - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. - MUST NOT revert.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L264
Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, through a redeem call. - MUST return a limited value if owner is subject to some withdrawal limit or timelock. - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. - MUST NOT revert.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L253
Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault, through a withdraw call. - MUST return a limited value if owner is subject to some withdrawal limit or timelock. - MUST NOT revert.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L292
Returns the total amount of the underlying asset that is “managed” by Vault. - SHOULD include any compounding that occurs from yield. - MUST be inclusive of any fees that are charged against assets in the Vault. - MUST NOT revert.
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L299
Outputs the amount of asset tokens is idle, waiting for the next round.
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L218
Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, given current on-chain conditions. - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the same transaction. - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the redemption would be accepted, regardless if the user has enough shares, etc. - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. - MUST NOT revert. NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by redeeming.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L211
Because of rounding issues, we did not find a way to return exact shares when including the fees. This is not 100% compliant to ERC4626 specification. You can follow the discussion here: https://ethereum-magicians.org/t/eip-4626-yield-bearing-vault-standard/7900/104 This function will return the number of shares necessary to withdraw assets not including fees. This means that you will need to redeem MORE shares to achieve the net assets.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L118
Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. - MUST emit the Deposit event. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L131
Deposit ERC20 tokens with permit, a gasless token approval.
Mints shares to receiver by depositing exactly amount of underlying tokens. For more information on the signature format, see the EIP2612 specification: https://eips.ethereum.org/EIPS/eip-2612#specification
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L347
Closes the round, allowing deposits to the next round be processed. and opens the window for withdraws.
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L399
Handle migrated assets.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L378
Migrate assets from this vault to the next vault.
The newVault
will be assigned by the ConfigurationManager
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L412
Distribute shares to depositors queued in the deposit queue, effectively including their assets in the next round.
Parameters
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L175
Burns exactly shares from owner and sends assets of underlying tokens to receiver. - MUST emit the Withdraw event. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the redeem execution, and are accounted for during redeem. - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L362
Withdraw all user assets in unprocessed deposits.
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L332
Starts the next round, sending the idle funds to the strategy where it should start accruing yield.
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L194
Because of rounding issues, we did not find a way to return assets including the fees. This is not 100% compliant to ERC4626 specification. You can follow the discussion here: https://ethereum-magicians.org/t/eip-4626-yield-bearing-vault-standard/7900/104 This function will withdraw the number of assets asked, minus the fee. Example: If the fee is 10% and 100 assets was the input, this function will withdraw 90 assets.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L146
Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. - MUST emit the Deposit event. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint execution, and are accounted for during mint. - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
Parameters
Returns
https://github.dev/pods-finance/yield-contracts/blob/main/contracts/vaults/BaseVault.sol#L159
Mint shares with permit, a gasless token approval.
Mints exactly shares to receiver by depositing amount of underlying tokens. For more information on the signature format, see the EIP2612 specification: https://eips.ethereum.org/EIPS/eip-2612#specification
Parameters
Returns
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
_0
uint256
Precision number used when calculating the fee
_0
uint256
Max Fee boundary
_0
uint256
Initial deposit amount
_0
address
ConfigurationManager address
_0
uint32
current round Id
_0
bool
Is processing deposits boolean
_0
uint256
Amount of processed deposits entering the next round.
_0
address[]
addresses in deposit queue
_0
address
Controller address
owner
address
Owner address
_0
uint256
Amount of Idle Assets
_0
uint256
Withdraw Fee Ratio
_0
uint256
Queue Size
_0
address
Owner address
_0
uint256
Max amount of underlying to deposit
_0
address
Owner Address
_0
uint256
Max amount of shares that can be minted
owner
address
Owner Address
_0
uint256
Max amount of shares that can be redeemed
owner
address
Owner Address
_0
uint256
Max amount of underlying asset that can be withdrawn
_0
uint256
undefined
_0
uint256
undefined
shares
uint256
Shares amount
_0
uint256
Assets amount
assets
uint256
Assets amount
_0
uint256
Shares Amount
assets
uint256
assets
receiver
address
receiver
_0
uint256
shares
assets
uint256
assets
receiver
address
receiver address
deadline
uint256
timestamp deadline
v
uint8
signature parameter v
r
bytes32
signature parameter r
s
bytes32
signature parameter s
_0
uint256
shares amount
assets
uint256
undefined
receiver
address
undefined
_0
uint256
Estimation of shares created.
depositors
address[]
Array of owner addresses to process
shares
uint256
shares amount
receiver
address
receiver address
owner
address
owner address
assets
uint256
assets amount
assets
uint256
assets amount
_0
uint32
The new round id
assets
uint256
assets amount
receiver
address
receiver address
owner
address
owner address
shares
uint256
shares amount
shares
uint256
undefined
receiver
address
undefined
_0
uint256
undefined
shares
uint256
undefined
receiver
address
undefined
deadline
uint256
undefined
v
uint8
undefined
r
bytes32
undefined
s
bytes32
undefined
_0
uint256
undefined