Deposits
MORE Vaults use a Diamond Proxy architecture alongside an ERC-4626 “Vault Facet” to provide a secure and flexible environment for token storage. Although the vault appears as a single contract to external users, it is actually a diamond composed of multiple facets—each handling its own piece of logic. Below is an in-depth look at how depositing and withdrawing works, and how the vault token (i.e., the vault’s ERC-4626 share token) maintains its value within the diamond structure.
Depositing Assets
Depositing into a MORE Vault involves sending tokens into the Diamond Proxy via the Vault Facet’s ERC-4626 interface. Once deposited, you receive vault share tokens (also recorded under the diamond’s address), representing your pro-rata claim on any underlying assets.
Approve Tokens
Before you can deposit, the vault (diamond) must have permission to transfer your tokens.
Example:
IERC20(token).approve(address(moreVault), depositAmount);
Call
deposit(amount, recipient)
This function moves your tokens into the vault.
The vault facet, operating under the diamond, calculates how many shares to mint based on the current exchange rate (i.e.,
shares = depositAmount / pricePerShare
).
Receive Share Tokens
The vault facet mints share tokens that adhere to ERC-4626.
These share tokens are still “controlled” by the diamond address, but they represent your ownership. You can see them in your wallet or via on-chain explorers if they support ERC-4626 share balances.
While you interact with a single contract address (the diamond), which makes the deposit appear straightforward, multiple facets (deposit logic, share token logic, etc.) are in play behind the scenes.
If the diamond ever upgrades to a new deposit method or share token interface, your balance remains protected since the state is stored in the diamond’s core storage and not tied to a specific facet implementation.
Withdrawing Assets
Withdrawing assets reverses the deposit process: you redeem your share tokens and receive the underlying tokens back. The diamond’s Vault Facet burns your shares and releases the appropriate amount of the underlying asset, computed based on the vault’s current share price.
Check Your Share Balance
Example:
uint256 myShares = moreVault.balanceOf(msg.sender);
This is how many shares you can redeem for the underlying assets.
Call
withdraw(shares, recipient, owner)
Specify how many shares you want to burn.
The vault facet calculates the corresponding amount of underlying tokens (e.g.,
amount = shares * pricePerShare
), then transfers them to the recipient.
Burn of Share Tokens
The diamond’s Vault Facet removes the share tokens from your balance, destroying them as part of the ERC-4626 redemption flow.
Because the share price is continuously updated (based on deposits, withdrawals, and any off-chain strategy changes), the vault ensures withdrawals are always made at the correct rate.
No matter how many times the diamond is upgraded, your share token balances and the vault’s accounting remain unaffected, preserving a consistent ledger of ownership.
Last updated