Request form
On-Chain income splitter and distributor
  • Token
  • ERC20
  • Finance
  • Payments
  • Fees
  • ETH
  • Audited
Docs
Source
ChefGPT

On-Chain income splitter and distributor

Set and perform payment splits in either ETH or Tokens. Can be used for royalty splits or automated payment splits. Accepts both ETH and ERC20 tokens. Splits can be updated and transferred. Whenever a Split receives income, each recipient gets their share.

SplitMain :
Split recipients, ownerships, and keeper fees are stored onchain as calldata & re-passed as args / validated via hashing when needed. Each split gets its own address & proxy for maximum composability with other contracts onchain. For these proxies, we extended EIP-1167 Minimal Proxy Contract to avoid `DELEGATECALL` inside `receive()` to accept hard gas-capped `sends` & `transfers`.
distributeERC20(address,address,address[],uint32[],uint32,address) :
`accounts`, `percentAllocations`, and `distributorFee` are verified by hashing & comparing to the hash in storage associated with split `split`pernicious ERC20s may cause overflow in this function inside _scaleAmountByPercentage, but results do not affect ETH & other ERC20 balances
distributeETH(address,address[],uint32[],uint32,address) :
`accounts`, `percentAllocations`, and `distributorFee` are verified by hashing & comparing to the hash in storage associated with split `split`
transferControl(address,address) :
Two-step control transfer inspired by [dharma](https://github.com/dharma-eng/dharma-smart-wallet/blob/master/contracts/helpers/TwoStepOwnable.sol)
updateAndDistributeERC20(address,address,address[],uint32[],uint32,address) :
only callable by SplitControllerpernicious ERC20s may cause overflow in this function inside _scaleAmountByPercentage, but results do not affect ETH & other ERC20 balances
updateAndDistributeETH(address,address[],uint32[],uint32,address) :
only callable by SplitController
ISplitMain :
SplitWallet :
`SplitProxy` handles `receive()` itself to avoid the gas cost with `DELEGATECALL`.
sendERC20ToMain(address,uint256) :
payable reduces gas cost; no vulnerability to accidentally lock ETH introduced since fn call is restricted to SplitMain
sendETHToMain(uint256) :
payable reduces gas cost; no vulnerability to accidentally lock ETH introduced since fn call is restricted to SplitMain
Clones :
ERC20 :
Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
SafeTransferLib :
Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
SplitMain.sol
ISplitMain.sol
SplitWallet.sol
Clones.sol
ERC20.sol
SafeTransferLib.sol

420 downloads

Creator

0xSplits
0xSplits / On-Chain income splitter and distributor
  • Token
  • ERC20
  • Finance
  • Payments
  • Fees
  • ETH
  • Audited
Docs
Source
ChefGPT
Expand
Share

Get Cookin'
star icon420

420 downloads

Creator

0xSplits

On-Chain income splitter and distributor

Set and perform payment splits in either ETH or Tokens. Can be used for royalty splits or automated payment splits. Accepts both ETH and ERC20 tokens. Splits can be updated and transferred. Whenever a Split receives income, each recipient gets their share.

SplitMain :
Split recipients, ownerships, and keeper fees are stored onchain as calldata & re-passed as args / validated via hashing when needed. Each split gets its own address & proxy for maximum composability with other contracts onchain. For these proxies, we extended EIP-1167 Minimal Proxy Contract to avoid `DELEGATECALL` inside `receive()` to accept hard gas-capped `sends` & `transfers`.
distributeERC20(address,address,address[],uint32[],uint32,address) :
`accounts`, `percentAllocations`, and `distributorFee` are verified by hashing & comparing to the hash in storage associated with split `split`pernicious ERC20s may cause overflow in this function inside _scaleAmountByPercentage, but results do not affect ETH & other ERC20 balances
distributeETH(address,address[],uint32[],uint32,address) :
`accounts`, `percentAllocations`, and `distributorFee` are verified by hashing & comparing to the hash in storage associated with split `split`
transferControl(address,address) :
Two-step control transfer inspired by [dharma](https://github.com/dharma-eng/dharma-smart-wallet/blob/master/contracts/helpers/TwoStepOwnable.sol)
updateAndDistributeERC20(address,address,address[],uint32[],uint32,address) :
only callable by SplitControllerpernicious ERC20s may cause overflow in this function inside _scaleAmountByPercentage, but results do not affect ETH & other ERC20 balances
updateAndDistributeETH(address,address[],uint32[],uint32,address) :
only callable by SplitController
ISplitMain :
SplitWallet :
`SplitProxy` handles `receive()` itself to avoid the gas cost with `DELEGATECALL`.
sendERC20ToMain(address,uint256) :
payable reduces gas cost; no vulnerability to accidentally lock ETH introduced since fn call is restricted to SplitMain
sendETHToMain(uint256) :
payable reduces gas cost; no vulnerability to accidentally lock ETH introduced since fn call is restricted to SplitMain
Clones :
ERC20 :
Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
SafeTransferLib :
Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
SplitMain.sol
ISplitMain.sol
SplitWallet.sol
Clones.sol
ERC20.sol
SafeTransferLib.sol