Skip to main content

Constructor

constructor(address _usdc, address _treasury)
ParameterDescription
_usdcUSDC token address
_treasuryTreasury wallet for fee collection
Sets owner to msg.sender. Fee starts at 0%.

Functions

split

function split(address collector, uint256 amount) external
Split a USDC payment between the publisher (collector) and treasury.
ParameterTypeDescription
collectoraddressPublisher’s wallet address
amountuint256USDC amount in satoshis (6 decimals)
Requirements:
  • Not paused
  • amount between 1 and 1,000,000 (inclusive)
  • Caller has approved sufficient USDC on the splitter
Behavior:
  • Transfers amount - fee to collector
  • Transfers fee to treasury (if fee > 0)
  • Emits Split event

setFee

function setFee(uint256 _newFeeBps) external
Update the fee in basis points. Owner only.
ParameterTypeDescription
_newFeeBpsuint256New fee in basis points (max 99)

setTreasury

function setTreasury(address _newTreasury) external
Update the treasury address. Owner only.

setPaused

function setPaused(bool _paused) external
Pause or unpause the contract. Owner only.

Events

Split

event Split(
    address indexed payer,
    address indexed collector,
    uint256 amount,
    uint256 fee
)
Emitted on every successful split() call.
FieldDescription
payerAgent wallet that sent the payment
collectorPublisher wallet that received the payment
amountGross USDC amount (satoshis)
feeFee deducted (satoshis)

Constants

uint256 public constant MAX_FEE_BPS = 99;  // 0.99% — immutable

State variables

VariableTypeDescription
owneraddressContract owner
treasuryaddressFee collection wallet
usdcIERC20 (immutable)USDC token
pausedboolPause flag
feeBpsuint256Current fee in basis points

ABI (human-readable)

const SPLITTER_ABI = [
  "function split(address collector, uint256 amount) external",
  "function setFee(uint256 _newFeeBps) external",
  "function setTreasury(address _newTreasury) external",
  "function setPaused(bool _paused) external",
  "function owner() view returns (address)",
  "function treasury() view returns (address)",
  "function feeBps() view returns (uint256)",
  "function paused() view returns (bool)",
  "function MAX_FEE_BPS() view returns (uint256)",
  "event Split(address indexed payer, address indexed collector, uint256 amount, uint256 fee)",
];

Fee calculation

fee = (amount * feeBps) / 10_000
net = amount - fee
Examples (at 99 bps / 0.99%):
Amount (USD)USDC unitsFeeNet
$0.0033,000292,971
$0.0110,000999,901
$0.10100,00099099,010
$1.001,000,0009,900990,100
At the current fee of 0%, all amounts go directly to the publisher.