Documentation Index
Fetch the complete documentation index at: https://docs.xenarch.com/llms.txt
Use this file to discover all available pages before exploring further.
Constructor
constructor(address _usdc, address _treasury)
| Parameter | Description |
|---|
_usdc | USDC token address |
_treasury | Treasury 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.
| Parameter | Type | Description |
|---|
collector | address | Publisher’s wallet address |
amount | uint256 | USDC 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.
| Parameter | Type | Description |
|---|
_newFeeBps | uint256 | New 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.
| Field | Description |
|---|
payer | Agent wallet that sent the payment |
collector | Publisher wallet that received the payment |
amount | Gross USDC amount (satoshis) |
fee | Fee deducted (satoshis) |
Constants
uint256 public constant MAX_FEE_BPS = 99; // 0.99% — immutable
State variables
| Variable | Type | Description |
|---|
owner | address | Contract owner |
treasury | address | Fee collection wallet |
usdc | IERC20 (immutable) | USDC token |
paused | bool | Pause flag |
feeBps | uint256 | Current 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 units | Fee | Net |
|---|
| $0.003 | 3,000 | 29 | 2,971 |
| $0.01 | 10,000 | 99 | 9,901 |
| $0.10 | 100,000 | 990 | 99,010 |
| $1.00 | 1,000,000 | 9,900 | 990,100 |
At the current fee of 0%, all amounts go directly to the publisher.