SyncSynthVault
Solidity version
Inheritance
Ownable2StepUpgradeable
of OpenZeppelin.ERC20PermitUpgradeable
of OpenZeppelin.ERC20PausableUpgradeable
of OpenZeppelin.IERC4626
of OpenZeppelin.
Global Variables
PermitParams
BPS_DIVIDER
MAX_FEES
State Variables
feesInBps
vaultIsOpen
lastSavedBalance
Events
EpochStart
Emitted when an epoch starts.
EpochEnd
Emitted when an epoch ends.
FeesChanged
Emitted when fees are changed.
Errors
VaultIsClosed
The vault is in a locked state. Emitted if the transaction cannot happen in this state.
VaultIsOpen
The vault is in an open state. Emitted if the transaction cannot happen in this state.
CannotClaimAsset
Claiming the underlying assets is not allowed.
ERC4626ExceededMaxDeposit
Attempt to deposit more underlying assets than the maximum allowed amount for receiver
.
ERC4626ExceededMaxMint
Attempt to mint more shares (LP tokens) than the maximum allowed amount for receiver
.
ERC4626ExceededMaxWithdraw
Attempt to withdraw more underlying assets than the maximum allowed amount for receiver
.
ERC4626ExceededMaxRedeem
Attempt to redeem more shares(LP tokens) than the maximum allowed amount for receiver
.
Functions
asset
The asset
function is used to return the address
of the underlying asset.
decimals
See {IERC20-decimals}
. The _decimalShares
is equal to underlying asset decimals + decimalsOffset
. See Constructor for more details about this.
totalAssets
The totalAssets
function is used to calculate the theoretical total underlying assets owned by the vault. If the vault is locked, the last saved balance is added to the current balance.
convertToShares
See {IERC4626-convertToShares}.
The convertToShares
function is used to calculate the number of shares (LP tokens) received in exchange for the specified amount of underlying assets.
convertToAssets
See {IERC4626-convertToAssets}.
The convertToAssets
function is used to calculate the amount of underlying assets received in exchange for the specified number of shares (LP tokens).
maxDeposit
The maxDeposit
function is used to calculate the maximum deposit.
If the vault is locked or paused, users are not allowed to mint, the maxMint
is 0
.
maxMint
The maxMint
function is used to calculate the maximum number of shares (LP tokens) you can mint. If the vault is locked or paused, the maxMint
is 0
.
maxWithdraw
The maxWithdraw
function is used to calculate the maximum amount of withdrawable underlying assets. If the function is called during the lock period the maxWithdraw
is 0
.
maxRedeem
The maxRedemm
function is used to calculate the maximum number of redeemable shares (LP tokens). If the function is called during the lock period, the maxRedeem
is 0
.
previewDeposit
The previewDeposit
function is used to calculate the number of shares (LP tokens) received in exchange for the specified underlying asset.
previewMint
The previewMint
function is used to calculate the amount of underlying assets received in exchange for the specified number of shares (LP tokens).
previewWithdraw
The previewWithdraw
function is used to calculate the number of shares (LP tokens) received in exchange for the specified underlying asset.
previewRedeem
The previewRedeem
function is used to calculate the amount of underlying assets received in exchange for the specified number of shares (LP token).
sharesBalanceInAsset
Given the address of an owner, returns the amount of shares of an user, converted in assets.
The previewRedeem
function is used to calculate the amount of underlying assets received in exchange for the specified number of shares (LP token).
deposit
The deposit
function is used to deposit underlying assets into the vault.
depositWithPermit
The depositWithPermit
function is used to deposit underlying assets into the vault by using permit feature if the underlying asset support it.
depositWithPermit
mint
The mint
function is used to mint the specified number of shares (LP tokens) in exchange for the corresponding amount of underlying assets from owner
.
withdraw
The withdraw
function is used to withdraw the specified amount of underlying assets in exchange for a proportional number of shares (LP tokens).
redeem
The redeem
function is used to redeem the specified number of shares (LP tokens) in exchange for the corresponding amount of underlying assets from owner
.
Last updated