Vault Manager is a smart contract project that helps other contracts manage ERC20 tokens and maintain whitelists for each token.
- Management of ERC20 tokens
- Whitelisting functionalities
- Owner-based actions
- Clone the repository:
git clone https://github.com/The-Poolz/VaultManager.git
- Install the dependencies:
npm install
- Run the Hardhat test:
npx hardhat test
After deploying the contracts, the owner (the deployer) can perform various operations.
To deposit tokens into a vault, the external contract should call depositByToken
from VaultManager.sol
. Make sure that msg.sender
is set to the _from
address.
To withdraw tokens, the external contract calls the
withdraw` function.
If you are the owner of the deployed contracts, you have the following additional functionalities:
- Set Trustee: Must be called to finish the setup and can only be called once. After that, use
updateTrustee
to change the trustee. - Set Trade Start Time: Can be used to change the trade start time initially set during vault creation with
createNewVault
. - Set Vault Royalty: Can be used to change the royalty details initially set during vault creation with
createNewVault
. - Create New Vault: This function has multiple overloads, allowing you to create new vaults with different configurations.
- Update Trustee: You can update the trustee address using
updateTrustee
.
The Vault is an internal contract that is managed solely by its creator, the VaultManager contract. No one else can interact with it directly. It serves as a small internal part responsible for specific functionalities like withdraw
.
- Withdraw: The Vault Manager, which is the entity that creates the vault, has the ability to withdraw tokens to a specified address using the
withdraw
function.
Only the trustee can use the tokens stored in the vaults, not the owner.
- IVault.sol: Defines the interface for Vault contract.
- Vault.sol: Implements the Vault functionalities.
- IVaultManager.sol: Defines the interface for Vault Manager.
- VaultManager.sol: Implements the Vault Manager functionalities.
- VaultManagerEvents.sol: Contains events for Vault Manager.
- 1_Vault.ts: Test cases for Vault.
- 2_VaultManager.ts: Test cases for Vault Manager.
- 3_VaultManagerFail.ts: Negative test cases for Vault Manager.
The audit report is available here: Audit Report
Feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.