Skip to content

wiledw/ERC20-Dividend-Tokens-Problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tech interview smart contracts coding problem

ERC20-Dividend-Tokens-Problem

I have attached two Loom videos that explain the problem, approach, insights, and provide a quick demo visualization.

https://www.loom.com/share/d11acf553dc74a288bc24dbbad7e5555

https://www.loom.com/share/5ffc08b597564446808a313b348ab6d1

Getting setup

Ensure you have installed:

Instructions

1. Setup

Clone the repo locally and install the NPM dependencies using npm:

2. Task

You only need to write code in the Token.sol file. Please ensure all the unit tests pass to successfully complete this part.

The contracts consist of a mintable ERC-20 Token (which is similar to a Wrapped ETH token). Callers mint tokens by depositing ETH. They can then burn their token balance to get the equivalent amount of deposited ETH back.

In addition, token holders can receive dividend payments in ETH in proportion to their token balance relative to the total supply. Dividends are assigned by looping through the list of holders.

Dividend payments are assigned to token holders' addresses. This means that even if a token holder were to send their tokens to somebody else later on or burn their tokens, they would still be entitled to the dividends they accrued whilst they were holding the tokens.

You will thus need to efficiently keep track of individual token holder addresses in order to assign dividend payouts to holders with minimal gas cost.

For a clearer understanding of how the code is supposed to work please refer to the tests in the test folder.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors