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
uint16
public
Performance fees are applied on the absolute returns of the underlying strategy.
vaultIsOpen
bool
public
The locking status of the vault.
lastSavedBalance
uint16
public
Performance fees are applied on the absolute returns of the underlying strategy.
Events
EpochStart
Emitted when an epoch starts.
timestamp
uint256 indexed
The block timestamp of the epoch starts.
lastSavedBalance
uint256
The lastSavedBalance
when the vault starts.
totalShares
uint256
The total number of shares when the vault starts.
EpochEnd
Emitted when an epoch ends.
timestamp
uint256 indexed
The block timestamp of the epoch terminates.
lastSavedBalance
uint256
The lastSavedBalance
from the current epoch starts.
returnedAssets
uint256
The total amount of underlying assets returned to the vault before collecting fees.
fees
uint256
The amount of fees collected.
totalShares
uint256
The total amount of shares when the vault terminates.
FeesChanged
Emitted when fees are changed.
oldFees
uint16
The previous performance fees (in bps).
newFees
uint16
The newly applied performance fees (in bps).
returnedAssets
uint256
The total amount of underlying assets returned to the vault before collecting fees.
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
.
receiver
address
The address
of the receiver
.
assets
uint256
The amount of underlying assets asked for deposit.
max
uint256
Number of shares (LP tokens) received in exchange for the specified amount of underlying assets.
ERC4626ExceededMaxMint
Attempt to mint more shares (LP tokens) than the maximum allowed amount for receiver
.
owner
address
The address
of the owner
.
shares
uint256
The amount of underlying assets asked to mint shares (LP tokens).
max
uint256
The maximum number of withdrawable shares (LP tokens).
ERC4626ExceededMaxWithdraw
Attempt to withdraw more underlying assets than the maximum allowed amount for receiver
.
owner
address
The address
of the owner
.
assets
uint256
The number of underlying assets asked for withdrawal.
max
uint256
The maximum amount of withdrawable underlying assets.
ERC4626ExceededMaxRedeem
Attempt to redeem more shares(LP tokens) than the maximum allowed amount for receiver
.
owner
address
The address
of the owner
.
shares
uint256
The number of shares (LP tokens) asked to be redeemed.
max
uint256
The maximum number of redeemable shares (LP tokens).
Functions
asset
The asset
function is used to return the address
of the underlying asset.
address
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.
uint8
Amount of decimals of the share (LP) token.
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.
uint256
Amount of the total underlying assets in the vault.
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.
assets
uint256
The amount of underlying assets to be converted into shares .
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).
shares
uint256
The number of shares (LP tokens) to be converted into underlying assets.
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
.
_
address
The address
of the shares (LP tokens) receiver
.
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
.
_
address
The address
of the receiver
.
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
.
owner
address
The address
of the owner
.
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
.
owner
address
The address
of the owner
.
previewDeposit
The previewDeposit
function is used to calculate the number of shares (LP tokens) received in exchange for the specified underlying asset.
assets
uint256
The amount of underlying assets to be converted into shares (LP tokens).
previewMint
The previewMint
function is used to calculate the amount of underlying assets received in exchange for the specified number of shares (LP tokens).
shares
uint256
The number of shares (LP tokens) to be converted into underlying assets.
previewWithdraw
The previewWithdraw
function is used to calculate the number of shares (LP tokens) received in exchange for the specified underlying asset.
assets
uint256
The amount of underlying assets to be converted into shares (LP tokens).
previewRedeem
The previewRedeem
function is used to calculate the amount of underlying assets received in exchange for the specified number of shares (LP token).
shares
uint256
The number of shares (LP tokens) to be converted into underlying assets.
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).
owner
address
The owner address
.
deposit
The deposit
function is used to deposit underlying assets into the vault.
assets
uint256
The amount of underlying assets to be converted into shares (LP tokens).
receiver
address
The address
of the shares (LP tokens) receiver
.
depositWithPermit
The depositWithPermit
function is used to deposit underlying assets into the vault by using permit feature if the underlying asset support it.
assets
uint256
The amount of underlying assets to be converted into shares (LP tokens).
receiver
address
The address
of the shares (LP tokens) receiver
.
permitParams
PermitParams
Permit functionality parameters.
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
.
shares
uint256
The number of shares (LP tokens) to be converted into underlying assets.
receiver
address
The address
of the shares (LP tokens) receiver
.
withdraw
The withdraw
function is used to withdraw the specified amount of underlying assets in exchange for a proportional number of shares (LP tokens).
assets
uint256
The amount of underlying assets to be withdrawn.
receiver
address
The address
of the shares (LP tokens) receiver
.
owner
address
The address
of the owner
.
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
.
shares
uint256
The amount of shares to be redeemed.
receiver
address
The address
of the shares (LP tokens) receiver
.
owner
address
The address
of the owner
.
Last updated