Skip to content

Factory to produce Vaults used by LockDealNFT and PoolzBack to store Tokens and MainCoins.

Notifications You must be signed in to change notification settings

The-Poolz/VaultManager

Repository files navigation

Vault Manager

Description

Vault Manager is a smart contract project that helps other contracts manage ERC20 tokens and maintain whitelists for each token.

Features

  • Management of ERC20 tokens
  • Whitelisting functionalities
  • Owner-based actions

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/The-Poolz/VaultManager.git
  1. Install the dependencies:
npm install
  1. Run the Hardhat test:
npx hardhat test

Usage

After deploying the contracts, the owner (the deployer) can perform various operations.

From an External Contract

Deposit

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.

Withdraw

To withdraw tokens, the external contract calls thewithdraw` function.

Owner Functionalities

If you are the owner of the deployed contracts, you have the following additional functionalities:

In VaultManager.sol

  1. Set Trustee: Must be called to finish the setup and can only be called once. After that, use updateTrustee to change the trustee.
  2. Set Trade Start Time: Can be used to change the trade start time initially set during vault creation with createNewVault.
  3. Set Vault Royalty: Can be used to change the royalty details initially set during vault creation with createNewVault.
  4. Create New Vault: This function has multiple overloads, allowing you to create new vaults with different configurations.
  5. Update Trustee: You can update the trustee address using updateTrustee.

In Vault.sol

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.

  1. 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.

Role of the Trustee

Only the trustee can use the tokens stored in the vaults, not the owner.

Code Overview

Solidity Contracts

Tests

Audit report

The audit report is available here: Audit Report

Contributing

Feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

Factory to produce Vaults used by LockDealNFT and PoolzBack to store Tokens and MainCoins.

Resources

Stars

Watchers

Forks

Packages

No packages published