AsyncSynthVault
Last updated
Last updated
This structure contains all the informations needed to let user claim their request after we processed those. To avoid rounding errors we store the totalSupply and totalAssets at the time of the deposit/redeem for the deposit and the redeem. We also store the amount of assets and shares given by the user.
Hold the required values to settle the vault deposit and redeem requests.
Inherits: IERC7540, SyncSynthVault
The epochId is used to keep track of the deposit and redeem requests. It is incremented every time the owner calls the settle
function.
The lastSavedBalance is used to keep track of the assets in the vault at the time of the last settle
call.
The claimableSilo is used to hold the assets/shares of the users that requested a deposit/redeem.
The epochs mapping is used to store the informations needed to let user claim their request after we processed those. To avoid rounding errors we store the totalSupply and totalAssets at the time of the deposit/redeem for the deposit and the redeem. We also store the amount of assets and shares given by the user.
The lastDepositRequestId is used to keep track of the last deposit request made by the user. It is used to let the user claim their request after we processed those.
The lastRedeemRequestId is used to keep track of the last redeem request made by the user. It is used to let the user claim their request after we processed those.
Since we only allow one claimable request at a time, users must claim their request before making a new one. This function let users claim and request a deposit in one transaction.
This function is used to claim the pending deposit and request a new one in one transaction.
Parameters
assets
uint256
The amount of assets requested by the user.
receiver
address
The address of the user that requested the deposit.
data
bytes
The data to be sent to the receiver.
Since we only allow one claimable request at a time, users must claim their request before making a new one. This function let users claim and request a redeem in one transaction.
This function is used to claim the pending redeem and request a new one in one transaction.
Parameters
shares
uint256
The amount of shares requested by the user.
data
bytes
The data to be sent to the receiver.
This function is used to decrease the amount of assets requested to deposit by the user. It can only be called by the user who made the request.
Parameters
assets
uint256
The amount of assets requested by the user.
This function is used to decrease the amount of shares requested to redeem by the user. It can only be called by the user who made the request.
Parameters
shares
uint256
The amount of shares requested by the user.
The close
function is used to close the vault. It can only be called by the owner of the contract (onlyOwner
modifier).
The open
function is used to end the lock period of the vault. It can only be called by the owner of the contract (onlyOwner
modifier) and only when the vault is locked. If there are profits, the performance fees are taken and sent to the owner of the contract.
The open
function is used to open the vault.
Parameters
assetReturned
uint256
The underlying assets amount to be deposited into the vault.
claimAndRequestDepositWithPermit is used to claim the pending deposit and request a new one in one transaction using permit signatures.
Parameters
assets
uint256
The amount of assets requested by the user.
data
bytes
The data to be sent to the receiver.
permitParams
PermitParams
The permit signature.
The settle
function is used to settle the vault. It can only be called by the owner of the contract (onlyOwner
modifier). If there are profits, the performance fees are taken and sent to the owner of the contract. Since amphor strategies can be time sensitive, we must be able to switch epoch without needing to put all the funds back. Using _settle we can virtually put back the funds, check how much we owe to users that want to redeem and maybe take the extra funds from the deposit requests.
The settle
function is used to settle the vault.
Parameters
newSavedBalance
uint256
The underlying assets amount to be deposited into the vault.
pendingRedeemRequest is used to know how many shares are currently waiting to be redeemed for the user.
Parameters
owner
address
The address of the user that requested the redeem.
How many shares are virtually waiting for the user to be redeemed via the claimRedeem
function.
Parameters
owner
address
The address of the user that requested the redeem.
How many assets are currently waiting to be deposited for the user.
Parameters
owner
address
The address of the user that requested the deposit.
How many assets are virtually waiting for the user to be deposit via the claimDeposit
function.
Parameters
owner
address
The address of the user that requested the deposit.
How many assets are currently waiting to be deposited for all users.
Returns
<none>
uint256
The amount of assets waiting to be deposited.
How many shares are waiting to be redeemed for all users.
Returns
<none>
uint256
The amount of shares waiting to be redeemed.
How many shares are virtually waiting for the user to be redeemed via the claimRedeem
function.
Returns
<none>
uint256
The amount of shares waiting to be redeemed.
How many assets are virtually waiting for the user to be deposit via the claimDeposit
function.
Returns
<none>
uint256
The amount of assets waiting to be deposited.
when the vault is closed, users can only request to deposit. By doing this funds will be sent and wait in the pendingSilo. When the owner will call the open
or settle
function, the funds will be deposited and the minted shares will be sent to the claimableSilo. Waiting for the users to claim them.
Parameters
assets
uint256
The amount of assets requested by the user.
receiver
address
The address of the user that requested the deposit.
owner
address
The address of the user that requested the deposit.
data
bytes
The data to be sent to the receiver.
when the vault is closed, users can only request to redeem. By doing this shares will be sent and wait in the pendingSilo. When the owner will call the open
or settle
function, the shares will be redeemed and the assets will be sent to the claimableSilo. Waiting for the users to claim them.
Parameters
shares
uint256
The amount of shares requested by the user.
receiver
address
The address of the user that requested the redeem.
owner
address
The address of the user that requested the redeem.
data
bytes
The data to be sent to the receiver.
This function let users claim the shares we owe them after we processed their deposit request, in the _settle function.
Parameters
receiver
address
The address of the user that requested the deposit.
This function let users claim the assets we owe them after we processed their redeem request, in the _settle function.
Parameters
receiver
address
The address of the user that requested the redeem.
This funciton let user request a deposit using permit signatures.
Parameters
assets
uint256
The amount of assets requested by the user.
receiver
address
The address of the user that requested the deposit.
data
bytes
The data to be sent to the receiver.
permitParams
PermitParams
The permit signature.
users can request deposit only when the vault is closed and not paused.
Returns
<none>
uint256
The maximum amount of assets the user can request.
users can request redeem only when the vault is closed and not paused.
Parameters
owner
address
The address of the user that requested the redeem.
Returns
<none>
uint256
The maximum amount of shares the user can request.
This function let users preview how many shares they will get if they claim their deposit request.
This function let users preview how many shares they will get if they claim their deposit request.
Parameters
owner
address
The address of the user that requested the deposit.
Returns
<none>
uint256
The amount of shares the user will get if they claim their deposit request.
This function let users preview how many assets they will get if they claim their redeem request.
This function let users preview how many assets they will get if they claim their redeem request.
Parameters
owner
address
The address of the user that requested the redeem.
Returns
<none>
uint256
The amount of assets the user will get if they claim their redeem request.
This function convertToShares is used to convert the assets into shares.
Parameters
assets
uint256
The amount of assets to convert.
_epochId
uint256
The epoch id.
Returns
<none>
uint256
The amount of shares.
This function convertToAssets is used to convert the shares into assets.
Parameters
shares
uint256
The amount of shares to convert.
_epochId
uint256
The epoch id.
Returns
<none>
uint256
The amount of assets.
Utils function to convert the shares claimable into assets. It can be used in the front end to save an rpc call.
Using this the owner can know if he will have to send money to the claimableSilo (for users who want to leave the vault) or if he will receive money from it.
This function claimableDepositBalanceInAsset is used to know if the owner will have to send money to the claimableSilo (for users who want to leave the vault) or if he will receive money from it.
Parameters
owner
address
The address of the user that requested the deposit.
Returns
<none>
uint256
The amount of assets the user will get if they claim their deposit request.
Using this the owner can know if he will have to send money to the claimableSilo (for users who want to leave the vault) or if he will receive money from it.
This function claimableRedeemBalanceInShares is used to know if the owner will have to send money to the claimableSilo (for users who want to leave the vault) or if he will receive money from it.
Parameters
newSavedBalance
uint256
The amount of assets to be deposited into the vault.
Returns
assetsToOwner
uint256
The amount of assets the user will get if they claim their redeem request.
assetsToVault
uint256
settleValues
SettleValues
see EIP
Parameters
interfaceId
bytes4
The interface id to check for.
Returns
<none>
bool
True if the contract implements the interface.
This function is used to update the balance of the user.
This function is used to update the balance of the user.
Parameters
assets
uint256
receiver
address
owner
address
data
bytes
This function is used to update the balance of the user.
_createRedeemRequest is used to update the balance of the user in order to create the redeem request.
Parameters
shares
uint256
The amount of shares requested by the user.
receiver
address
The address of the user that requested the redeem.
owner
address
The address of the user that requested the redeem.
data
bytes
The data to be sent to the receiver.
_claimDeposit is used to claim the pending deposit and request a new one in one transaction.
Parameters
owner
address
The address of the user that requested the deposit.
receiver
address
The address of the user that requested the deposit.
Returns
shares
uint256
The amount of shares requested by the user.
_claimRedeem is used to claim the pending redeem and request a new one in one transaction.
Parameters
owner
address
The address of the user that requested the redeem.
receiver
address
The address of the user that requested the redeem.
Returns
assets
uint256
The amount of shares requested by the user.
_settle is used to settle the vault.
Parameters
newSavedBalance
uint256
The underlying assets amount to be deposited into the vault.
Returns
<none>
uint256
lastSavedBalance The last saved balance.
<none>
uint256
totalSupply The total supply.
isCurrentEpoch is used to check if the request is the current epoch.
Parameters
requestId
uint256
The id of the request.
_convertToShares is used to convert the assets into shares for a specific epoch/request.
Parameters
assets
uint256
The amount of assets to convert.
requestId
uint256
The id of the request.
rounding
Math.Rounding
The rounding type.
_convertToAssets is used to convert the shares into assets for a specific epoch/request.
Parameters
shares
uint256
The amount of shares to convert.
requestId
uint256
The id of the request.
rounding
Math.Rounding
The rounding type.
_checkMaxDrawdown is used to check if the max drawdown is reached.
Parameters
_lastSavedBalance
uint256
The last saved balance.
newSavedBalance
uint256
The new saved balance.
This event is emitted when a user request a deposit.
Parameters
requestId
uint256
The id of the request.
owner
address
The address of the user that requested the deposit.
previousRequestedAssets
uint256
The amount of assets requested by the user before the new request.
newRequestedAssets
uint256
The amount of assets requested by the user.
This event is emitted when a user request a redeem.
Parameters
requestId
uint256
The id of the request.
owner
address
The address of the user that requested the redeem.
previousRequestedShares
uint256
The amount of shares requested by the user before the new request.
newRequestedShares
uint256
The amount of shares requested by the user.
This event is emitted when a user request a redeem.
Parameters
requestId
uint256
The id of the request.
owner
address
The address of the user that requested the redeem.
receiver
address
The amount of shares requested by the user before the new request.
assets
uint256
The amount of shares requested by the user.
shares
uint256
The amount of shares requested by the user.
This event is emitted when a user request a redeem.
Parameters
requestId
uint256
The id of the request.
owner
address
The address of the user that requested the redeem.
receiver
address
The amount of shares requested by the user before the new request.
assets
uint256
The amount of shares requested by the user.
shares
uint256
The amount of shares requested by the user.
This error is emitted when the user request more shares than the maximum allowed.
Parameters
receiver
address
The address of the user that requested the redeem.
shares
uint256
The amount of shares requested by the user.
maxShares
uint256
This error is emitted when the user request more assets than the maximum allowed.
Parameters
receiver
address
The address of the user that requested the deposit.
assets
uint256
The amount of assets requested by the user.
maxDeposit
uint256
The maximum amount of assets the user can request.
This error is emitted when the user try to make a new request without claiming the previous one.
Parameters
owner
address
The address of the user that requested the deposit.
This error is emitted when the user try to make a new request without claiming the previous one.
This error is emitted when the user try to make a new request without claiming the previous one.
This error is emitted when the user try to make a new request without claiming the previous one.
This error is emitted when the user try to make a new request without claiming the previous one.