Package Exports
- @emag3m/celogive
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@emag3m/celogive) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@uniswap/merkle-distributor
Local Development
The following assumes the use of node@>=10.
Install Dependencies
yarn
Compile Contracts
yarn compile
Run Tests
yarn test
Use CLI to calculate CELO rewards and distribute rewards
To get complete documentation for each command and its parameters use the --help flag.
./bin/run rewards:generatemerkle --help1) Temporarily allocate more memory to node since aggregating events can take up a lot of space
export NODE_OPTIONS="--max-old-space-size=8192"2) Fetch transfer and attestation events for rewards calculation
./bin/run rewards:fetchevents --toBlock 3000000 --env mainnet- Outputs two files:
- Transfer Events:
transfer-cusd-events-<fromBlock>-<toBlock>.json - Attestation Events:
attestation-events-<fromBlock<-<toBlock>.json
- Transfer Events:
3) Use json files from previous command to calculate rewards
./bin/run rewards:generatemerkle \
--attestationEvents <attestation-events1.json> <attestation-events2.json>\
--transferEvents <transfer-events1.json> <transfer-events2.json>\
--balanceFromBlock 2000000 \
--balanceToBlock 3000000 \
--reward 0.06 \
--env mainnet- Outputs three files:
- Merkle Tree representing rewards:
merkleTree.json - Mapping of account to reward amount:
rewardsByAddress.json - JSON with intermediate state to reach these reward amounts:
rewardsCalculationState.json
- Merkle Tree representing rewards:
4) Deploy contract with merkle root from previous step
./bin/run rewards:deploydistributor --merkleTree merkleTree.json --env local --from <address>- Console logs important distributor information:
Distibutor address: 0xEdCF1a0003f84A97E4a28c904d888C6a2811fe
Merkle root: 0xb0071a0dc946557f936a848dfcdf7d8d06a01edbbadfca5fd034eb48110535af
Token address: 0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9
Total rewards: 8494879960682226105) Distribute rewards
./bin/run rewards:distribute --merkleTree merkleTree.json --address <distributor address> --env local --from <address> - Outputs a file
distribution-<distributor address>.jsonwith a mapping of each account to the transactionHash of their distribution tx. - This is an asynchronous script that distibutes all unclaimed rewards.
- If any of the transactions failed to complete, or returned an error, simply run the script again to retry all incomplete distributions.
- Rewards are distributed fully when the output json
distribution-<distributor-address>.jsonandrewardsByAddress.jsonmapping accounts keys match (same number of lines in each json file).