The Token
contract holds a standard ERC20 token contract. The Transfer
contract is then able to transfer a user's ERC20 tokens to and from the contract.
To receive ERC20 tokens, a user must fist approve the Transfer
contract to spend x
amount of tokens. That condition met, a user can then transfer up to x
amount of tokens to the Transfer
contract using the requestTokens()
function. The Transfer
contract records how much tokens the user has deposited into the contract.
To retrieve tokens, a user can execute the sendTokens()
function to transfer tokens from the Transfer
contract back to the user's account. A user can only retrieve the amount of tokens that they have deposited.
Note: The Transfer
contract can only accept Token
tokens, and only through the use of the requestTokens()
function. The contract does not have access to tokens sent to the contract's address directly.
yarn install
contracts/
- Directory for the Solidiy smart contractsdeploy/
- Directory for the deployment scriptstest/
- Directory for unit tests
clean
- To clear the cache and delete artifactscompile
- To compile your smart contractsnode
- Launches a local hardhat nodetest
- Runs smart contract testsdeploy
- Runs your deployment scripts
recompile
- Watches for file changes in thecontracts/
directory and runshardhat compile
as neededretest
- Watches for*.test.js
file chanes in thetest/
directory and runshardhat test
as neededredeploy
- Watches for file changes in thedeploy/
directory and runshardhat deploy
as needed