GM Vaults
If properly configured in the GM Lending/Looping Pool contract, each asset is associated with an ERC-4626 Vault. The Tokenized Vault standard assigns shares to depositors, which represent a claim to ownership on a fraction of the Vault's underlying assets. Shares can be converted to deposited asset tokens at any time. The following list of functions only include those that differ from the base ERC-4626 specification:
constructor
At deployment, the constructor takes in token variables (underlying
, name
, and symbol
) and passes them to the ERC-4626 constructor. It also stores the manager
and lendingPool
addresses and the GM Token's ERC20 instance. Lastly, the contract approves the owner
(the Lending Pool) to be able to spend the maximum allowed tokens (type(uint256).max
) on its behalf.
Parameters:
pause
Pauses functions with the whenNotPaused
modifier. Only the Vault manager can call.
unpause
Unpauses functions with the whenNotPaused
modifier. Only the Vault manager can call.
totalAssets
Returns the total token balance of the vault.
Returns:
migrate
Transfers tokens of the existing Vault contract to a new Vault contract. This function can only be called by the manager
while the contract is paused. If amount
is greater than the Vault balance, then the call with revert. The amount
argument allows for a migration "test" transfer before transferring the entire balance.
Parameters:
Other Functions
The above functions are all overridden so that only the lendingPool
address can call these functions. This is to ensure that the depositing and withdrawing of assets only happens via the Lending Pool contract, so that internal variables (balances, debt, and exchange rates) are properly tracked and collateral is properly enabled.
Last updated