Resources
Contracts
Three small contracts, with no owner, no admin functions and no upgrade path. Their code is the same for everyone; what makes a batcher or a delegate yours is the addresses built into it.
The factory
Section titled “The factory”SweepFactory is shared: one per chain, at the same address on every chain, deployed through the standard CREATE2
deployer with a zero salt.
| Chain | Factory | Deployed |
|---|---|---|
BSC testnet 97 Testnet | 0xF476A8Fa47629C43704F9399B1De83709f315BC1 | block 137868927 |
Sepolia 11155111 Testnet | 0xF476A8Fa47629C43704F9399B1De83709f315BC1 | block 11954084 |
| Compiler | solc 0.8.33+commit.64118f21, EVM prague, optimizer 200 runs, metadata hash none |
|---|---|
| CREATE2 | deployer 0x4e59b44847b379578588920cA78FbF26c0B4956C, salt 0x0000000000000000000000000000000000000000000000000000000000000000 |
| Code hashes | init code 0x087b28e151fe46b2508b24279a3f493b01a0f79c9770970bf748dcb82a5d8d03runtime code 0xaec0bbd85d8b8c88b2e58cbc285fca89f789a1e5b181beb955448746becf7929 |
| Version | testnet-3 |
The factory deploys your contracts when you register a hot wallet or create a delegate of a set, from your gas wallet: whoever calls it becomes the gas wallet of what it deploys, so nobody can deploy contracts in your name. Its functions are idempotent.
| Function | What it does |
|---|---|
deployBatcher() | Deploys the caller’s batcher, or returns it. |
deployDelegate(hotWallets) | Deploys the delegate of the set hotWallets for the caller’s batcher, or returns it. |
onboard(hotWallets) | Both at once. |
predictBatcher(gasWallet) | The address of a gas wallet’s batcher, deployed or not. |
predictDelegate(hotWallets, gasWallet) | The address of the delegate of a set, deployed or not. |
A set is 1 to 8 hot wallets in ascending order of address, none repeated: the API puts it in that order for you. Any other order or a repeat is refused, so a set has exactly one delegate.
Your batcher
Section titled “Your batcher”SweepBatcher(gasWallet): one per gas wallet, and only that gas wallet may call it. sweepMany takes a list of hot
wallets, each with the deposit addresses to sweep to it, and sweeps them all in one transaction, giving each address at
most 300,000 gas, so that one failing address cannot stop the rest. It emits Swept(account, token, amount, to) for
each success and SweepFailed(account, token, reason, to) with the error selector for each failure, to being the
hot wallet.
Your delegates
Section titled “Your delegates”SweepDelegate(hotWallets, batcher): one per set of hot wallets, the code your deposit addresses run. Each hot wallet
has its own, the set of one, and you can create more for sets of up to 8. Its function sweep(token, amount, to)
sends the address’s token, or its native coin for the zero address, to to, only if to is in its set, and only when
your batcher calls; amount 0 means the whole balance. hotWallets() shows the set. It supports tokens that return
nothing from transfer, such as USDT on Ethereum, and reads at most 32 bytes of a token’s return data. It keeps the
address receiving native coin and calls like a plain address. Nothing in it depends on the chain: a set has the same
delegate on every chain where the factory is.
| Error | Meaning |
|---|---|
Unauthorized() | The caller is not your batcher, or not your gas wallet. |
NothingToSweep() | The balance to sweep is 0. |
TokenTransferFailed() | The token refused the transfer. |
NativeTransferFailed() | The hot wallet refused the native coin. |
NotAHotWallet() | to is not in the delegate’s set. |
ZeroAddress() | A delegate cannot be built for the zero address. |
InvalidHotWalletCount() | A set must have 1 to 8 hot wallets. |
HotWalletsNotAscending() | A set must be in ascending order, with no repeats. |
Verify what is on chain
Section titled “Verify what is on chain”Every address above follows from the contract code: compute them from the code and compare. The SDK’s
verify-delegate does it in one command; Verifying the delegate shows it and the
manual way with Foundry. The compiler settings and code hashes above are those of the deployed factory.
On mainnet, the source of the factory and of each batcher and delegate is also verified on Etherscan and Sourcify. Testnet deployments are not verified in explorers: check them by their addresses. For the contract source, ask [email protected].