Skip to content

noosuture/disperse

 
 

Repository files navigation

disperse

verb distribute erc-20 tokens to many addresses in just two transactions

what's in this repo

interface

disperseEther(address[] recipients, uint256[] values)
disperseToken(IERC20 token, address[] recipients, uint256[] values)
disperseTokenSimple(IERC20 token, address[] recipients, uint256[] values)

optimizations

disperseToken first transfers the tokens to the contract addresses using transferFrom and then uses transfer to distribute them. this reduces gas costs by 1/3 as transfer updates state only twice (balances) without updating allowance as transferFrom does.

disperseTokenSimple uses transferFrom only, use it if you prefer the transfers to come from your address.

gas usage also depends on each recipient's balance, previous zero balance being the worst case.

caveats

tokens with missing return values are not supported for simplicity's sake. read more about this problem here.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 77.4%
  • CSS 13.3%
  • JavaScript 4.8%
  • Python 1.9%
  • Dockerfile 0.9%
  • Sass 0.7%
  • Other 1.0%