Skip to content
LogoLogo

PreDepositVault

Git Source

Inherits: AccessManagedUpgradeable, ReentrancyGuard, MakinaContext, IPreDepositVault

Constants

PreDepositVaultStorageLocation

bytes32 private constant PreDepositVaultStorageLocation =
        0x88ccda4670a9221204e56c6b7ced9d52994799751a70ced770588fb180e5dd00;

Functions

_getPreDepositVaultStorage

function _getPreDepositVaultStorage() private pure returns (PreDepositVaultStorage storage $);

Returns

NameTypeDescription
$PreDepositVaultStorage

constructor

constructor(address _registry) MakinaContext(_registry);

Parameters

NameTypeDescription
_registryaddress

initialize

Initializer of the contract.

function initialize(
        PreDepositVaultInitParams calldata params,
        address _shareToken,
        address _depositToken,
        address _accountingToken
    ) external override initializer;

Parameters

NameTypeDescription
paramsPreDepositVaultInitParamsThe initialization parameters.
_shareTokenaddressThe address of the share token.
_depositTokenaddressThe address of the deposit token.
_accountingTokenaddressThe address of the accounting token.

onlyRiskManager

modifier onlyRiskManager();

notMigrated

modifier notMigrated();

migrated

True if the vault has migrated to a machine instance, false otherwise.

function migrated() external view override returns (bool);

Returns

NameTypeDescription
<none>bool

machine

Address of the machine, set during migration.

function machine() external view override returns (address);

Returns

NameTypeDescription
<none>address

riskManager

Address of the risk manager.

function riskManager() external view override returns (address);

Returns

NameTypeDescription
<none>address

whitelistMode

True if the vault is in whitelist mode, false otherwise.

function whitelistMode() external view override returns (bool);

Returns

NameTypeDescription
<none>bool

isWhitelistedUser

User => Whitelisting status.

function isWhitelistedUser(address user) external view override returns (bool);

Parameters

NameTypeDescription
useraddress

Returns

NameTypeDescription
<none>bool

depositToken

Address of the deposit token.

function depositToken() external view override returns (address);

Returns

NameTypeDescription
<none>address

accountingToken

Address of the accounting token.

function accountingToken() external view override returns (address);

Returns

NameTypeDescription
<none>address

shareToken

Address of the share token.

function shareToken() external view override returns (address);

Returns

NameTypeDescription
<none>address

shareLimit

Share token supply limit that cannot be exceeded by new deposits.

function shareLimit() external view override returns (uint256);

Returns

NameTypeDescription
<none>uint256

maxDeposit

Maximum amount of deposit tokens that can currently be deposited in the vault.

function maxDeposit() public view override returns (uint256);

Returns

NameTypeDescription
<none>uint256

totalAssets

Total amount of deposit tokens managed by the vault.

function totalAssets() external view override returns (uint256);

Returns

NameTypeDescription
<none>uint256

previewDeposit

Amount of shares minted against a given amount of deposit tokens.

function previewDeposit(uint256 assets) public view override notMigrated returns (uint256);

Parameters

NameTypeDescription
assetsuint256The amount of deposit tokens to be deposited.

Returns

NameTypeDescription
<none>uint256

previewRedeem

Amount of deposit tokens that can be withdrawn against a given amount of shares.

function previewRedeem(uint256 shares) public view override notMigrated returns (uint256);

Parameters

NameTypeDescription
sharesuint256The amount of shares to be redeemed.

Returns

NameTypeDescription
<none>uint256

deposit

Deposits a given amount of deposit tokens and mints shares to the receiver.

function deposit(uint256 assets, address receiver, uint256 minShares, bytes32 referralKey)
        external
        override
        nonReentrant
        notMigrated
        returns (uint256);

Parameters

NameTypeDescription
assetsuint256The amount of deposit tokens to be deposited.
receiveraddressThe receiver of the shares.
minSharesuint256The minimum amount of shares to be minted.
referralKeybytes32The optional identifier used to track a referral source.

Returns

NameTypeDescription
<none>uint256shares The amount of shares minted.

redeem

Burns exactly shares from caller and transfers the corresponding amount of deposit tokens to the receiver.

function redeem(uint256 shares, address receiver, uint256 minAssets)
        external
        override
        nonReentrant
        notMigrated
        returns (uint256);

Parameters

NameTypeDescription
sharesuint256The amount of shares to be redeemed.
receiveraddressThe receiver of withdrawn deposit tokens.
minAssetsuint256The minimum amount of deposit tokens to be transferred.

Returns

NameTypeDescription
<none>uint256assets The amount of deposit tokens transferred.

migrateToMachine

Migrates the pre-deposit vault to the machine.

function migrateToMachine() external override notMigrated;

setPendingMachine

Sets the machine address to migrate to.

function setPendingMachine(address _machine) external override notMigrated;

Parameters

NameTypeDescription
_machineaddressThe address of the machine.

setShareLimit

Sets the new share token supply limit that cannot be exceeded by new deposits.

function setShareLimit(uint256 newShareLimit) external override onlyRiskManager notMigrated;

Parameters

NameTypeDescription
newShareLimituint256The new share limit.

setRiskManager

Sets the risk manager address.

function setRiskManager(address newRiskManager) external override restricted notMigrated;

Parameters

NameTypeDescription
newRiskManageraddressThe address of the new risk manager.

setWhitelistedUsers

Whitelist or unwhitelist a list of users.

function setWhitelistedUsers(address[] calldata users, bool whitelisted)
        external
        override
        onlyRiskManager
        notMigrated;

Parameters

NameTypeDescription
usersaddress[]The addresses of the users to update.
whitelistedboolTrue to whitelist the users, false to unwhitelist.

setWhitelistMode

Sets the whitelist mode for the vault.

In whitelist mode, only whitelisted users can deposit.

function setWhitelistMode(bool enabled) external override onlyRiskManager notMigrated;

Parameters

NameTypeDescription
enabledboolTrue to enable whitelist mode, false to disable.

Structs

PreDepositVaultStorage

Note:

  • storage-location: erc7201:makina.storage.PreDepositVault
struct PreDepositVaultStorage {
        address _depositToken;
        address _accountingToken;
        address _shareToken;
        uint256 _shareTokenDecimalsOffset;
        uint256 _shareLimit;
        address _riskManager;
        address _machine;
        bool _migrated;
        bool _whitelistMode;
        mapping(address => bool) _isWhitelistedUser;
    }

Properties

NameTypeDescription
_depositTokenaddress
_accountingTokenaddress
_shareTokenaddress
_shareTokenDecimalsOffsetuint256
_shareLimituint256
_riskManageraddress
_machineaddress
_migratedbool
_whitelistModebool
_isWhitelistedUsermapping(address => bool)