Skip to content

Dispenser of an ERC20 using different amounts per period

Notifications You must be signed in to change notification settings

hanzel98/erc20-token-dispenser

Repository files navigation

ERC20 Token Dispenser

Instructions

Design and code a smart contract (or set of smart contracts) that will distribute ERC20 tokens over time, on a predetermined schedule.

The system must provide a mechanism to distribute the tokens monthly. This could be in one or many payments.

"It is important is that under no circumstances we distribute more than the specified amount in any month". Due to this restriction, if the receiver forgets to claim in some months, the system will only be able to pay what is available only in the current month.

Diagram

Deployed contract information

Guide

  • Clone the repository, go to the .envExample file copy it and name it .env, please fill all variables.
  • Make sure that after cloning the repository you run npm run install.
  • The tests can be run with npm run test.
  • The code has been tested with solidity coverage npm run coverage.

High-level system architecture

Design

Math validation

These mathematical validations represent what the claimed amounts would look like if the user claimed every month. But the logic of the contract considers that the user could forget to claim some months. MathValidation

Formula validation for years greater than 4

Formula

Coverage

Coverage

Gas reporter

Gas

Security analysis

This project was tested with static security analysis tool called Slither with an extension for vscode. The results show some low and informative bullet points, they were analyzed but they do not affect the desired behavior of the contract. Slither - Static analysis framework with detectors for many common Solidity issues. Slither

Notes

The contract layout was sorted according to the solidity docs Functions Order and Layout Order. And following the Naming convention.

The code implements Natspec documentation

About

Dispenser of an ERC20 using different amounts per period

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published