Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.38 KB

README.md

File metadata and controls

29 lines (22 loc) · 1.38 KB

Airdrop contract


Contract workflow:

  1. Prepare a CSV bonus list with users address, bonus amount
  2. Deploy Airdrop contract (pointing to RNDR token ERC20 contract address in a constuctor)
  3. Call addManyUsers(userAddresses[], bonusAmounts[]) with corresponding arrays. Can be done several batches (adding each user costs around 80k gas)
  4. Call finalizeList() to lock the modification of user bonus list
  5. Perform safety checks on the blockchain list:
    • Check that bonusAddresses[] array contain only allowed users
    • Check that corresponding bonusAmounts mappings have relevant amount of bonus
    • Check totalBonus
    • Check userCount
  6. If all checks correspond to your local bonus list, send a number of RNDR tokens equal to the totalBonus variable to the Airdrop contract's address before calling the payment function.
  7. Call payManyUsers(batchSize) with a chosen batchSize several times (paying each user costs around 40-50k gas)
  8. If any excess tokens are left on the contract - it can be withdrawn by calling returnTokens()

Testing:

There are a couple of truffle tests which run through the above basic workflow and some safety-checks.

To run, do the following:

  1. npm install
  2. Get latest ganache or any other blockchain that supports require messages running on port 8545
  3. truffle compile
  4. truffle test