VaultAdmin
Inherits: IVaultAdmin, Initializable, AccessControl, ReentrancyGuardUpgradeable, VaultAssetRegistryAdmin, VaultFundraiseAdmin, VaultWhitelistAdmin, Pausable
Contains the admin functions, constructor, initializer, immutable variables and state checking for AriaIPRWAVault.
Functions
initFundraise
Initializes the vault for fundraise.
Can not initialize both a fundraise and a whitelist vault.
function initFundraise(
address admin,
StoryAddrs memory storyAddrs,
AriaIPRWAVaultStorage.FractionalTokenDetails memory tokenDetails,
VaultFundraiseStorage.Setup memory fundraiseSetup,
uint48 mintTimelockDuration,
uint256 claimDeadline,
address legal
) public override initializer;
Parameters
admin
address
The address of the admin of the vault
storyAddrs
StoryAddrs
The addresses of the Story Protocol's contracts - zero addr check is done in the factory contract.
tokenDetails
AriaIPRWAVaultStorage.FractionalTokenDetails
The details of the fractional token to be deployed
fundraiseSetup
VaultFundraiseStorage.Setup
The setup of the fundraise
mintTimelockDuration
uint48
The timelock duration (in seconds) for admin fractional token mints.
claimDeadline
uint256
The deadline for the users to claim the fractional token.
legal
address
The address of the legal contract that checks blacklist and license.
initWhitelist
Initializes the vault for whitelist.
Can not initialize both a fundraise and a whitelist vault.
function initWhitelist(
address admin,
StoryAddrs memory storyAddrs,
AriaIPRWAVaultStorage.FractionalTokenDetails memory tokenDetails,
bytes32 merkleRoot,
uint48 mintTimelockDuration,
uint256 claimDeadline,
address legal
) public override initializer;
Parameters
admin
address
The address of the admin of the vault
storyAddrs
StoryAddrs
The addresses of the Story Protocol's contracts - zero addr check is done in the factory contract.
tokenDetails
AriaIPRWAVaultStorage.FractionalTokenDetails
The details of the fractional token to be deployed
merkleRoot
bytes32
The merkle root of the whitelist
mintTimelockDuration
uint48
The timelock duration (in seconds) for admin fractional token mints.
claimDeadline
uint256
The deadline for the users to claim the fractional token.
legal
address
The address of the legal contract that checks blacklist and license.
amIAdmin
Simplest self admin check
function amIAdmin() external view returns (bool);
execFractionalTokenMint
Executes a previously initiated fractional token mint after the timelock duration.
Can be triggered by anyone. Checks if the timelock has passed and transfers the tokens. Resets the pending mint state. Reverts if no mint is pending or the timelock has not been reached.
function execFractionalTokenMint() external override nonReentrant;
execTimelockUpdate
Executes a previously initiated update to the admin fractional token mint duration.
Can only be called by anyone. Checks if the timelock has passed and updates the duration. Resets the pending duration update state. Reverts if no duration update is pending or the timelock has not been reached.
function execTimelockUpdate() external nonReentrant;
initFractionalTokenMint
Initiates a timelocked mint of the vault's fractional tokens by the admin.
Can only be called by the owner. Records the mint details and sets the unlock timestamp. A mint must be executed via execFractionalTokenMint
at/after the timelock passes. Reverts if there is already a pending mint.
function initFractionalTokenMint(address recipient, uint256 amount)
external
override
onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE)
nonReentrant;
Parameters
recipient
address
The address to receive the minted tokens.
amount
uint256
The amount of fractional tokens to mint.
initTimelockUpdate
Initiates a timelocked update for the admin fractional token mint duration.
Can only be called by the owner. Uses the current timelock duration for the delay. A duration update must be executed via execTimelockUpdate
after the timelock passes. Reverts if there is already a duration update pending.
function initTimelockUpdate(uint48 newDuration)
external
onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE)
nonReentrant;
Parameters
newDuration
uint48
The proposed new duration in seconds.
recoverLostTokens
Recovers lost tokens
Only the admin can recover lost tokens, including fractional tokens as they are minted not sent to the vault.
function recoverLostTokens(address token, address to)
external
override
onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE);
Parameters
token
address
The address of the token to be recovered
to
address
The address of the recipient
setClaimDeadline
function setClaimDeadline(uint256 newClaimDeadline) external onlyRole(AccessControlStorage.DEFAULT_ADMIN_ROLE);
setPauseState
function setPauseState(bool paused_) external;
_initVault
function _initVault(
address admin,
StoryAddrs memory storyAddrs,
AriaIPRWAVaultStorage.FractionalTokenDetails memory tokenDetails,
VaultType vaultType,
uint48 mintTimelockDuration,
uint256 claimDeadline,
address legal
) internal;
_execTimelockUpdate
Internal function to execute a pending timelock duration update if the timelock has passed.
function _execTimelockUpdate() internal;
_isTimelockUpdateReady
function _isTimelockUpdateReady(uint48 updatemintExec) internal view returns (bool);
_getAdjustedMintAmount
Calculates the mint amount adjusted to token's cap.
function _getAdjustedMintAmount(address fractionalTokenAddress, uint256 requestedAmount)
internal
view
returns (uint256);
Parameters
fractionalTokenAddress
address
The address of the ERC20Capped fractional token.
requestedAmount
uint256
The amount of tokens requested to be minted.
Returns
<none>
uint256
The actual amount that can be minted, respecting the cap. Returns 0 if the cap is already met or if requestedAmount is 0.