Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

disperse

Batch-send the native coin and ERC-20 tokens to many recipients in one transaction — a payroll, an airdrop, a splits payout. Stateless and non-custodial: it never holds funds across calls. The disperse.app pattern, hardened. ~55 lines, MIT.

Functions

  • disperseEther(recipients, values) payable — sends values[i] native coin to each recipient; msg.value must cover the sum and any excess is refunded to the caller.
  • disperseToken(token, recipients, values) — pulls the summed amount in one transferFrom, then pushes to each recipient (gas-efficient for long lists; assumes a standard, non-fee-on-transfer token).
  • disperseTokenSimple(token, recipients, values) — direct transferFrom(caller → recipient) per entry; correct for fee-on-transfer / rebasing tokens (each recipient gets whatever that token delivers).

All revert on length mismatch or an empty list; the ether path reverts if a recipient rejects the transfer (nothing is half-sent) or if msg.value doesn't cover the sum.

Invariant (fuzzed, fail_on_revert=true, non-hollow)

  • Holds no value — after any disperse (ether / token / token-simple, any amounts), the contract's native balance and token balance are both zero (12,800 calls, 0 reverts). It is a pass-through, not a vault. Mutation-checked: skipping a distribution (retaining tokens) fails the invariant and a unit test.

Notes (honest)

  • Stateless singleton — deploy once, anyone uses it. No owner, no fee.
  • Use disperseTokenSimple for fee-on-transfer tokens; disperseToken pools and assumes exact transfers.
  • Very long lists are bounded by the block gas limit (chunk if needed). Unaudited reference.
forge test   # 11 tests: ether distribute+refund, token pooled, token-simple (FoT), reverts, no-value invariant

About

Batch-send native coin + ERC-20 to many recipients in one tx (payroll/airdrop): exact-sum + refund, pooled or FoT-correct direct transfers, stateless holds-no-value invariant

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages