Guides
Tokens
Every chain has base tokens, on for every account: its native coin and the tokens Portuna lists, USDT and USDC (on the testnets, the test USDT). You can turn any of them off, the native coin included. Any other ERC-20 you add yourself by its contract address, on the testnets and on mainnet: Portuna Sweep checks it on the chain and shows you its card, you compare the card with the issuer’s site or a block explorer, and you add the token with your confirmation.
Base tokens and your tokens
Section titled “Base tokens and your tokens”| Base tokens | Your tokens | |
|---|---|---|
source | preset | custom |
| What | the chain’s native coin, and USDT and USDC as Portuna lists them | any ERC-20 you add by its contract address |
| On | for every account, until you turn one off | once you add it, after its check and with confirm: true |
| A sweep identifies it by | native, the ticker or the contract address | its contract address only |
| The rate | your rate of the chain, 70% on Ethereum and 0 on BSC as standard; the native coin a markup on gas | 80% on every chain, or a rate agreed with Portuna |
| The conventional cost | measured by Portuna on each chain | measured when you add it, see below |
| After 5 failed sweeps in a row | stays on | turned off; only support turns it on again |
GET /v1/tokens lists them all: on each chain the native coin first, then the listed tokens by ticker, then yours,
oldest first. A sweep is accepted only for a token that is active there. Each token shows what you pay for it,
tariff, and its conventional cost, baseline; a token of your own also what its check found: provider, check and
warnings. token is how a sweep identifies it.
In the console, the Tokens page of each environment shows the same list, with the card of each of your tokens, and checks, adds and turns off tokens. Every member of the organization sees it; adding and turning off tokens take a developer role or above.
curl "https://api-testnet.portuna.io/v1/tokens?chain_id=11155111" -H "Authorization: Bearer $PORTUNA_API_KEY"{ "tokens": [ { "chain_id": 11155111, "token": "native", "symbol": "ETH", "decimals": 18, "source": "preset", "status": "active", "tariff": { "kind": "base", "rule": "gas_markup", "rate_bps": 1000, "since": null, "valid_until": null }, "baseline": { "transfer_gas": null, "conventional_gas": { "new": 21000, "existing": 21000 }, "version": null, "method": "fork", "measured_at": null, "block": null, "status": "measured", "next": null } }, { "chain_id": 11155111, "token": "USDT", "address": "0x3809a97a7a25C8bA577027c0AE2D81a09cdA1a2f", "symbol": "USDT", "decimals": 6, "source": "preset", "status": "active", "tariff": { "kind": "base", "rule": "conventional_share", "rate_bps": 7000, "since": null, "valid_until": null }, "baseline": { "transfer_gas": 32633, "conventional_gas": { "new": 237233, "existing": 53633 }, "version": null, "method": "fork", "measured_at": null, "block": null, "status": "measured", "next": null } }, { "chain_id": 11155111, "token": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "address": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "symbol": "EURX", "name": "Example Euro", "decimals": 18, "source": "custom", "status": "active", "provider": { "status": "testnet" }, "check": { "result": "ok", "method": "simulate", "checked_at": "2026-10-11T09:12:28Z" }, "warnings": [{ "code": "testnet", "message": "testnet: providers know no contracts here; compare the address with the issuer's source" }], "tariff": { "kind": "custom_default", "rule": "conventional_share", "rate_bps": 8000, "since": null, "valid_until": null }, "baseline": { "transfer_gas": 34512, "conventional_gas": { "new": 239112, "existing": 55512 }, "version": 1, "method": "simulate", "measured_at": "2026-10-11T09:12:28Z", "block": 9412345, "status": "measured", "next": null }, "created_at": "2026-10-11T09:12:30Z" } ]}tokens, err := client.Tokens(ctx, sepolia)if err != nil { log.Fatal(err)}for _, t := range tokens { // Token is what a sweep names it by: "native", a ticker, or the address of a token of your own. // Only an active token can be swept; a refused one says why in Reason. fmt.Printf("%s %s (%s): %s %s\n", t.Token, t.Symbol, t.Source, t.Status, t.Reason) if t.Tariff != nil && t.Baseline != nil { fmt.Printf(" rate %d bps (%s), conventional cost %d gas\n", t.Tariff.RateBps, t.Tariff.Kind, t.Baseline.ConventionalGas.Existing) }}const tokens = await client.tokens({ chain_id: chainId })for (const t of tokens) { // token is what a sweep names it by: native, a ticker, or the address of a token of your own. // Only an active token can be swept; a refused one says why in reason. console.log(`${t.token} ${t.symbol ?? ''} (${t.source}): ${t.status} ${t.reason ?? ''}`) if (t.tariff && t.baseline) { console.log(` rate ${t.tariff.rate_bps} bps (${t.tariff.kind}), conventional cost ${t.baseline.conventional_gas.existing} gas`) }}Turn a base token off and on
Section titled “Turn a base token off and on”A base token you do not accept can be turned off, the native coin too: its path segment is native.
curl -X DELETE "https://api-testnet.portuna.io/v1/tokens/11155111/native" -H "Authorization: Bearer $PORTUNA_API_KEY"
curl -X POST "https://api-testnet.portuna.io/v1/tokens" \ -H "Authorization: Bearer $PORTUNA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"chain_id": 11155111, "address": "native"}'DELETE responds with 204. The token stays in GET /v1/tokens as disabled, new sweeps of it get
422 token_disabled, and its queued sweeps end rejected with token_disabled; those already sent end as they will.
POST /v1/tokens with the same address, or native, turns it on again and responds with 200 and the token. A base
token needs no confirmation and no check.
In the Go SDK the zero address stands for the native coin.
// The zero address is the native coin. Its queued sweeps are rejected with token_disabled.if err := client.DisableToken(ctx, sepolia, common.Address{}); err != nil { log.Fatal(err)}// A base token is turned on again without a confirmation.if _, _, err := client.EnableToken(ctx, sepolia, common.Address{}); err != nil { log.Fatal(err)}// Its queued sweeps are rejected with token_disabled.await client.disableToken(chainId, 'native')// A base token is turned on again without a confirmation.await client.enableToken({ chain_id: chainId, address: 'native' })Add a token of your own
Section titled “Add a token of your own”Three steps, on a testnet or on mainnet:
- Check it.
POST /v1/tokens/checkchecks the token and returns its card. It adds nothing. - Compare the card with the issuer’s site or a block explorer: the address, the symbol, the decimals, and what the providers know of it.
- Add it with
POST /v1/tokensand"confirm": true, which says you compared the card.
The card
Section titled “The card”curl -X POST "https://api-testnet.portuna.io/v1/tokens/check" \ -H "Authorization: Bearer $PORTUNA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"chain_id": 11155111, "address": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9"}'{ "chain_id": 11155111, "address": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "testnet": true, "explorer_url": "https://sepolia.etherscan.io/token/0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "source": "custom", "status": "new", "contract": { "symbol": "EURX", "name": "Example Euro", "decimals": 18, "total_supply": "1000000000000000000000000", "proxy": "", "implementation": null, "hints": [] }, "provider": { "status": "testnet" }, "check": { "result": "ok", "method": "simulate", "transfer_gas": 34512, "sweep_gas": 19804, "fee_bps": 0, "dust": false, "block": 9412345, "checked_at": "2026-10-11T09:12:28Z" }, "warnings": [{ "code": "testnet", "message": "testnet: providers know no contracts here; compare the address with the issuer's source" }], "tariff": { "kind": "custom_default", "rule": "conventional_share", "rate_bps": 8000, "since": null, "valid_until": null }, "baseline": { "transfer_gas": 34512, "conventional_gas": { "new": 239112, "existing": 55512 }, "version": 1, "method": "simulate", "measured_at": "2026-10-11T09:12:28Z", "block": 9412345, "status": "measured", "next": null }}| Field | What it says |
|---|---|
contract | What the contract says of itself: symbol, name and decimals, cleaned for display, total_supply, whether it is a proxy (proxy, implementation), and hints, what its code lets the issuer do: pause, blacklist, tax, max_tx, cooldown, fee, rebasing, erc777, upgrade. |
provider | What market data providers know of the address on mainnet: name, symbol, decimals on this chain, logo, site, rank and the provider’s page. attribution carries the credit the provider asks for: show it with its data. not_found on mainnet is an unknown token: you may add it, with a warning. On the testnets the providers are not asked, testnet: they know no testnet contracts. |
check | How the test sweep went: ok, or not_simulated if it could not run; the transfer (transfer_gas) and your sweep of one address (sweep_gas) in gas; fee_bps, the fee a transfer keeps; dust, a transfer of the whole balance leaves some behind. |
warnings | What to weigh, below. |
tariff, baseline | The rate and the conventional cost the token would get, see below. |
explorer_url | The token’s page in the chain’s block explorer, to compare with. |
status | Your state of the token now: new if you do not have it, or its status if you do. source is preset when the address is a base token of the chain: turn it on instead. |
symbol and name are read with a bounded call and cleaned: control characters removed, cut to 32 and 64
characters. They are there for people to read; nothing in Portuna Sweep relies on them, and neither should you.
The checks
Section titled “The checks”The check runs on the chain as it is, in a simulation, and sends nothing. First the contract:
| Check | code if it fails | Blocked for every account |
|---|---|---|
| The address holds contract code. | not_a_contract | no |
It is not an account delegated with EIP-7702, whose code starts with 0xef0100. A deposit address is one: its code returns success to every call and moves nothing. | delegated_account | no |
| It is not a contract of Portuna Sweep: the factory, a batcher or a delegate. | own_contract | no |
decimals() returns a number from 0 to 36. | invalid_decimals | yes |
balanceOf reads a stored balance. A token whose balances are not stored is a fake. | balance_not_stored | yes |
A transfer emits a Transfer event. Without one, nothing would confirm a sweep. | no_transfer_event | yes |
A transfer works now. details.cause is the token’s own reason, such as a pause. | transfer_fails | no: check it again later |
Portuna has not blocked it. details.category and details.public_note say why it did. | token_blocked | already |
Then the check runs your sweep’s own path: your gas wallet calls your batcher, and a deposit address delegated to your
delegate moves the token to a hot wallet, for one address and for three in one batch. It measures the token’s transfer
for its conventional cost on the way. A token that transfers but that your sweep cannot move
gets 422 sweep_incompatible, with details.cause:
details.cause | Why the sweep cannot move it |
|---|---|
item_gas | A sweep of one address needs more than the 300,000 gas a batch gives it. |
balance_hidden | The token shows a delegated address no balance. |
tx_origin | Plain transfers work and your sweep does not, for no other cause found: most likely the token wants the sender to be the transaction’s origin. Portuna looks into it; the token is not blocked for it. |
sender_code | The token refuses a sender with code. |
batch_limit | It moves one address of a batch, but not several. |
The automatic blocklist. invalid_decimals, balance_not_stored, no_transfer_event and sweep_incompatible
(except tx_origin) come from the token’s code, and no retry changes them: once a check on a later block gives the
same result, usually within minutes, the token goes on the blocklist for every account, with the category
unsweepable. From then on everyone gets token_blocked for it. Every check also runs a base token of the chain
through the same path: if that fails too, the node is at fault, and you get 503 chain_unavailable, not a verdict on
your token.
A chain the environment does not serve gets 422 unknown_chain, an address that is not a non-zero 0x-address
422 invalid_address. If the chain’s node does not respond to the check, the response is 503 chain_unavailable: try
again later. 503 token_check_unavailable means tokens cannot be added on that chain for now. Checks run your sweep
on the chain’s node, so they are bounded: 20 in a row, then one every 6 seconds; more get 429 rate_limited, with
the seconds to wait in Retry-After.
address := common.HexToAddress(os.Getenv("TOKEN"))card, err := client.CheckToken(ctx, sepolia, address)var refusal *portuna.Errorif errors.As(err, &refusal) { switch refusal.Code { case portuna.CodeTransferFails: log.Fatalf("the token refuses transfers now (%s): check it again later", refusal.Cause()) case portuna.CodeChainUnavailable, portuna.CodeTokenCheckUnavailable: log.Fatalf("the token could not be checked now, try again later: %v", err) default: // not_a_contract, sweep_incompatible (see Cause), token_blocked and the other refusals. log.Fatalf("this token cannot be swept: %v %s", err, refusal.Cause()) }}if err != nil { log.Fatal(err) // a network error or a timeout: try again}// Compare the card with the issuer's site or a block explorer: the address, the symbol, the decimals.fmt.Printf("%s %q (%q), explorer %s\n", card.Address, card.Contract.Symbol, card.Contract.Name, card.ExplorerURL)if card.Provider.Status == portuna.ProviderFound { fmt.Printf("%s knows it as %s (%s). %s\n", card.Provider.Source, card.Provider.Name, card.Provider.Symbol, card.Provider.Attribution)}for _, w := range card.Warnings { fmt.Printf("warning %s: %s\n", w.Code, w.Message)}if card.Baseline != nil { fmt.Printf("rate %d bps of a conventional cost of %d gas (%s)\n", card.Tariff.RateBps, card.Baseline.ConventionalGas.Existing, card.Baseline.Status)}if card.Contract.Decimals == nil || *card.Contract.Decimals != wantDecimals { log.Fatalf("the token does not have the %d decimals your books expect", wantDecimals)}const address = env('TOKEN') as Addressconst card = await client.checkToken({ chain_id: chainId, address }).catch((err: unknown) => { if (!(err instanceof ApiError) || err.status >= 500) throw err // chain_unavailable, a network error: try again later if (err.code === 'transfer_fails') throw new Error(`the token refuses transfers now (${String(err.details?.cause)}): check it again later`) // not_a_contract, sweep_incompatible (see details.cause), token_blocked and the other refusals. throw new Error(`this token cannot be swept: ${err.message} ${String(err.details?.cause ?? '')}`)})// Compare the card with the issuer's site or a block explorer: the address, the symbol, the decimals.console.log(`${card.address} ${JSON.stringify(card.contract.symbol)} (${JSON.stringify(card.contract.name)}), explorer ${card.explorer_url}`)if (card.provider.status === 'found') { console.log(`${card.provider.source} knows it as ${card.provider.name} (${card.provider.symbol}). ${card.provider.attribution ?? ''}`)}for (const w of card.warnings) console.log(`warning ${w.code}: ${w.message}`)console.log(`rate ${card.tariff.rate_bps} bps of a conventional cost of ${card.baseline.conventional_gas.existing} gas (${card.baseline.status})`)if (card.contract.decimals !== wantDecimals) throw new Error(`the token does not have the ${wantDecimals} decimals your books expect`)Warnings
Section titled “Warnings”Warnings do not stop you from adding a token. They are what to look at before you do, and they stay on the token in
GET /v1/tokens.
code | What it means |
|---|---|
unknown_to_providers | Mainnet: no market data provider knows the contract, an unknown token. |
provider_unavailable | The providers did not respond; they are asked again later. |
testnet | A testnet: the providers know no contracts here. Compare the address with the issuer’s source. |
lookalike | The symbol looks like a base token’s, such as USDT, but this is not that token; base identifies it. |
other_chain | The address is a base token of another chain; base identifies it. |
decimals_mismatch, symbol_mismatch | The contract and the provider disagree. |
fee_on_transfer | The token keeps fee_bps of each transfer: less reaches the hot wallet, and sweeps count what arrives. |
rebasing | A transfer of the whole balance leaves a little on the deposit address. |
near_item_limit | Your sweep of the token, sweep_gas, comes close to the 300,000 gas a batch gives one address. |
proxy | The issuer can replace the token’s code; implementation is the current one. |
not_simulated | The test sweep could not run. The token is run on your first deposit and priced at the network’s floor until then. |
baseline_review | A transfer costs more than 80,000 gas: the token is priced at 80,000 until Portuna has reviewed its conventional cost. |
Add the token
Section titled “Add the token”curl -X POST "https://api-testnet.portuna.io/v1/tokens" \ -H "Authorization: Bearer $PORTUNA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"chain_id": 11155111, "address": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "confirm": true}'The token is checked again, with the same refusals as POST /v1/tokens/check, and added: 201 with the token as in
GET /v1/tokens. Without "confirm": true, a token of your own gets 422 confirmation_required.
200is the response for a token you have already, or a refused token added again: that checks it anew and starts its count of failed sweeps anew.- A token whose transfer costs more than 80,000 gas is added and swept at once, priced at 80,000 until Portuna has
reviewed its conventional cost:
baseline.statusisreviewuntil then. - A token turned off after 5 failed sweeps in a row gets
409 token_needs_support: only support turns it on again. - You can have up to 100 tokens of your own on a chain, refused ones included; the next one gets
409 too_many_tokensuntil you remove one.
// Confirmed says you compared the card. Without it, a token of your own gets confirmation_required.token, created, err := client.EnableToken(ctx, sepolia, address, portuna.Confirmed())switch portuna.ErrorCode(err) {case "": if err != nil { log.Fatal(err) // a network error or a timeout: try again }case portuna.CodeTokenNeedsSupport: log.Fatal("the token was turned off after 5 failed sweeps: contact support")case portuna.CodeTooManyTokens: log.Fatal("remove a token first: 100 tokens of your own per chain at most")default: log.Fatal(err) // the refusals of the check, as above}fmt.Printf("added %s, new: %t, status %s\n", token.Token, created, token.Status)if token.Baseline != nil && token.Baseline.Status == portuna.BaselineReview { // Its transfer costs more than 80,000 gas: it is priced at 80,000 until Portuna has reviewed its conventional cost. fmt.Println("the token's conventional cost waits for review")}// confirm: true says you compared the card. Without it, a token of your own gets confirmation_required.const { token, created } = await client.enableToken({ chain_id: chainId, address, confirm: true }).catch((err: unknown) => { if (err instanceof ApiError && err.code === 'token_needs_support') throw new Error('turned off after 5 failed sweeps: contact support') if (err instanceof ApiError && err.code === 'too_many_tokens') throw new Error('remove a token first: 100 per chain at most') throw err // the refusals of the check, as above})console.log(`added ${token.token}, new: ${created}, status ${token.status}`)// Its transfer costs more than 80,000 gas: it is priced at 80,000 until Portuna has reviewed its conventional cost.if (token.baseline?.status === 'review') console.log("the token's conventional cost waits for review")Remove a token
Section titled “Remove a token”curl -X DELETE "https://api-testnet.portuna.io/v1/tokens/11155111/0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9" \ -H "Authorization: Bearer $PORTUNA_API_KEY"The response is 204. A token of your own is removed from the list, and new sweeps of it get 422 unknown_token;
sweeps of it that are still queued end rejected with token_disabled. A base token is turned off instead, as
above. An address that is neither a base token nor added by you gets
404 not_found. A token turned off after 5 failed sweeps stays in your list, 409 token_needs_support, until
support has looked at it.
// A token of your own is removed; its queued sweeps are rejected with token_disabled.if err := client.DisableToken(ctx, sepolia, address); err != nil { log.Fatal(err)}// A token of your own is removed; its queued sweeps are rejected with token_disabled.await client.disableToken(chainId, address)Sweep your token
Section titled “Sweep your token”A sweep identifies a token of your own by its contract address, never by its symbol:
{ "chain_id": 11155111, "hot_wallet": "0x2Cd50979a8A33e8CA37DA85F8517fb148a67b769", "account": "0x2c7536E3605D9C16a7a3D7b1898e529396a65c23", "token": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9" }In the sweep, token is that address too, while token_symbol and token_decimals hold what the token said of
itself when the sweep was requested. Everything else works as for a base token:
first and repeat sweeps, batches, keep_one_unit and the
statuses.
sweep, _, err := client.CreateSweep(ctx, portuna.SweepRequest{ ExternalID: "tokens-1", ChainID: sepolia, HotWallet: common.HexToAddress(os.Getenv("HOT_WALLET")), Account: common.HexToAddress(os.Getenv("DEPOSIT")), Token: token.Token, // a token of your own is named by its address, never by its symbol})if err != nil { log.Fatal(err)}// Webhooks tell the outcome too: transaction.mined, or sweep.rejected or sweep.failed if no transaction// carried it.for sweep.Status == portuna.SweepQueued || sweep.Status == portuna.SweepProcessing { time.Sleep(10 * time.Second) if sweep, err = client.Sweep(ctx, sweep.ID); err != nil { log.Fatal(err) }}if sweep.Status == portuna.SweepSwept { // SweptAmount is what the token's Transfer events say reached the hot wallet: credit that. fmt.Println("swept:", sweep.SweptAmount) if sweep.ReportedAmount != "" { // A token that keeps a fee on transfers: this is what the transfer claimed. fmt.Println("the transfer reported:", sweep.ReportedAmount) }} else { // transfer_not_confirmed: the token reported success and moved nothing. Credit nothing. fmt.Printf("sweep %s: %s\n", sweep.Status, sweep.Reason)}let sweep: Sweep = ( await client.createSweep({ external_id: 'tokens-1', chain_id: chainId, hot_wallet: env('HOT_WALLET') as Address, account: env('DEPOSIT') as Address, token: token.token, // a token of your own is named by its address, never by its symbol })).sweep// Webhooks tell the outcome too: transaction.mined, or sweep.rejected or sweep.failed if no transaction carried it.while (sweep.status === 'queued' || sweep.status === 'processing') { await sleep(10_000) sweep = await client.sweep(sweep.id)}if (sweep.status === 'swept') { // swept_amount is what the token's Transfer events say reached the hot wallet: credit that. console.log('swept:', sweep.swept_amount) // A token that keeps a fee on transfers: reported_amount is what the transfer claimed. if (sweep.reported_amount) console.log('the transfer reported:', sweep.reported_amount)} else { // transfer_not_confirmed: the token reported success and moved nothing. Credit nothing. console.log(`sweep ${sweep.status}: ${sweep.reason}`)}How amounts are confirmed
Section titled “How amounts are confirmed”A token’s contract can return whatever its author wrote: report a transfer it did not make, or move less than it
says. So Portuna Sweep does not take a token’s word for an amount. For every token sweep, swept_amount is the value of
the token’s own Transfer events from the deposit address to the hot wallet in that sweep’s part of the batch
receipt: what the chain recorded as arriving.
- A token that keeps a fee on transfers.
swept_amountis what arrived;reported_amountis what the transfer reported moving.reported_amountis present only when the two differ. - Events that say more arrived than was sent. A token moves at most what it is asked to, so
swept_amountnever exceeds what the transfer reported moving: events that claim more count as that. - A token that reports success and moves nothing. With no
Transferevent from the deposit address to the hot wallet, the sweep endsfailedwithtransfer_not_confirmed. Nothing counts as moved and there is no fee. - Events of other contracts in the same transaction do not count: only the swept token’s own.
Statuses and refusals
Section titled “Statuses and refusals”status | Meaning |
|---|---|
active | Sweeps of the token are accepted. |
disabled | You turned the base token off. In a token.refused event: you removed your token since. |
refused | Portuna refuses the token; reason says why. |
A sweep of a token you may not sweep is refused at once with 422 and one of these codes; sweeps of it that were
queued before end rejected with token_disabled:
code | Why |
|---|---|
unknown_token | Neither a base token of the chain nor one you added: a token you removed, one another account added, or a token of your own named by its symbol. |
token_disabled | You turned the base token off. |
token_refused | Portuna refuses the token: see its reason in GET /v1/tokens. |
token_needs_support | The token was turned off after 5 sweeps in a row failed because of it: contact support. |
token_blocked | Portuna blocked the token for every account. |
reason | What happened | What to do |
|---|---|---|
blocked | Portuna blocked the token on this chain, for every account; blocked says why. | Nothing: it cannot be added while it is blocked. |
failing | 5 sweeps of your token in a row failed on chain for the token’s fault: TokenTransferFailed, reverted or transfer_not_confirmed. | Find out why the token fails transfers, then contact support: only support turns it on again. |
not_a_contract | The token’s code is gone. | Remove it. |
delegated_account | The address is an account delegated with EIP-7702 now. | Remove it. |
invalid_decimals | decimals() fails now, or returns more than 36. | Remove it, or add it again once the token is fixed. |
decimals_changed | decimals() returns a different value than when you added the token. | Check your books, then add it again: it takes the new decimals. |
- Failing sweeps. Only failures for the token’s fault count, and only for your own tokens; an empty balance or a
gas wallet without gas does not count. A swept sweep starts the count anew. After 5 in a row the token is turned
off:
POST /v1/tokensresponds with409 token_needs_support, and only support turns it on again. - Checks at start. Whenever the service starts, it checks your active tokens again as when you added them. A token whose node does not respond stays as it is.
- The blocklist. Portuna can block a token on a chain, such as a scam or a token that breaks sweeps, and the
check blocks a token it finds unsweepable by itself. The block overrides everything: a blocked token, base or your
own, is
refusedwithblockedfor every account, andPOST /v1/tokens/checkandPOST /v1/tokensrefuse it withtoken_blocked. If the block is lifted, the token is what you had made it again.
Whenever a token you could sweep is refused, you get a token.refused webhook event with the token in data, as in
GET /v1/tokens. A change of what you pay for a token comes as tariff.changed,
below:
// onTokenEvent handles token.refused and tariff.changed events, once ParseWebhook has verified the delivery.func onTokenEvent(event portuna.Event) error { switch event.Type { case portuna.EventTokenRefused: token, err := event.Token() if err != nil { return err } // Its queued sweeps end rejected with token_disabled. Stop requesting new ones until you know why. log.Printf("token %s on chain %d is refused: %s", token.Token, token.ChainID, token.Reason) case portuna.EventTariffChanged: change, err := event.TariffChange() if err != nil { return err } // Token is nil for all of your own tokens on the chain. The change applies to batches prepared from // EffectiveAt on. log.Printf("tariff on chain %d changes at %s: %s", change.ChainID, change.EffectiveAt.Format(time.RFC3339), change.Reason) if change.Reason == portuna.TariffChangeExpiring && change.NewRateBps != nil { // An agreed rate runs out within 7 days; NewRateBps applies from EffectiveAt. log.Printf("agreed rate ends at %s, then %d bps", change.EffectiveAt.Format(time.RFC3339), *change.NewRateBps) } } return nil}/** Handles token.refused and tariff.changed events, once parseWebhook has verified the delivery. */export function onTokenEvent(event: Event): void { if (event.type === 'token.refused') { // Its queued sweeps end rejected with token_disabled. Stop requesting new ones until you know why. console.log(`token ${event.data.token} on chain ${event.data.chain_id} is refused: ${event.data.reason}`) } else if (event.type === 'tariff.changed') { // token is null for all of your own tokens on the chain. The change applies to batches prepared from // effective_at on. console.log(`tariff on chain ${event.data.chain_id} changes at ${event.data.effective_at}: ${event.data.reason}`) if (event.data.reason === 'expiring') { // An agreed rate runs out within 7 days; new_rate_bps applies from effective_at. console.log(`agreed rate ends at ${event.data.effective_at}, then ${event.data.new_rate_bps} bps`) } }}What your tokens cost
Section titled “What your tokens cost”The fee is computed as for any token, see Fees and tariffs:
fee = max(0, X × conventional cost of the token − gas of the sweep)
- X for a token of your own is 80% by default on every chain, BSC included:
custom_tokensinGET /v1/tariff. Portuna may agree another rate with you, for all your tokens on a chain or for one of them, and possibly until a date;tariffof each token shows the rate in force and where it comes from:custom_defaultornegotiated. - The conventional cost is what a conventional sweep would spend on the token: the top-up of the deposit address
(21,000 gas) plus a plain transfer of the token’s whole balance from it,
transfer_gas, plus creating the address’s account for an address that has none. The transfer is measured when you add the token,simulateorholdersinbaseline.method. - Not measured yet, such as a token whose test sweep could not run, the token is priced at the network’s floor,
floorinGET /v1/tariff, with the statusprovisional: on Ethereum a transfer of 27,900 gas, a conventional cost of 48,900. It is measured on the first deposit swept at the latest, yours or another account’s: the conventional cost is the contract’s, the same for everyone (deposit). The floor is below any real ERC-20, so you never pay more for a token that could not be measured. - A transfer above 80,000 gas, measured when you add the token or later, is priced at 80,000 until Portuna has
reviewed the conventional cost (
baseline.status:review); the token is swept meanwhile. A review that settles on more than 80,000 is a rise like any other: it applies after 7 days’ notice.
Each sweep records what it was priced with: conventional_gas, rate_bps, tariff_source and, for your own token,
baseline_version.
Rates and conventional costs change
Section titled “Rates and conventional costs change”- A new rate applies to the batches prepared after the change; a sweep keeps the rate of its batch.
- Conventional costs are frozen and versioned. A new version that is lower applies at once; one higher by more than 5%
applies 7 days after you are notified, and
baseline.nextshows it with itseffective_atuntil then. - You are notified with a
tariff.changedwebhook event: an agreed rate set, withdrawn or expired (reasonnegotiated,expired), a conventional cost changed (baseline), or the default rate of your own tokens on the chain changed (default).tokenisnullfor a rate of all your own tokens on the chain. - For an agreed rate with an end, you are notified twice. 7 days before it runs out,
tariff.changedcomes with the reasonexpiring,effective_atat its end and, innew_rate_bps, the rate that applies then: your agreed rate for all your tokens on the chain if it still applies, else the default. The console shows a banner on every page in those 7 days, andtariff.next_rate_bpsof the token shows the rate after the end all along. When the rate runs out,tariff.changedcomes again, with the reasonexpired. No event comes when the end of a rate changes nothing, the level above being the same.
Failed sweeps
Section titled “Failed sweeps”A sweep of your token that fails on chain pays no fee, only gas. The batch gas is split by what each address is expected to take, by its token’s weight, so a light token’s sweep does not pay for a heavy one’s; and gas that a failing sweep of your own token burned beyond that is its own, up to the 300,000 gas an address may take. A token that keeps failing is turned off after 5 failures in a row.
Stay safe
Section titled “Stay safe”- Compare the card before you add a token. The address, symbol and decimals with the issuer’s site or a block
explorer; mind
lookalikeandother_chain, and on mainnetunknown_to_providers. - Name tokens by address. Keep the contract address of each token you accept in your own records, and send
that address in sweeps. In sweeps of your tokens,
tokenis the address, never the symbol. - Treat
symbolandnameas untrusted text. Show them escaped, never match on them, never let them decide what a deposit is worth. - Check the decimals before you credit users. Compare
token_decimalsof the sweep with the decimals your books keep for that address, and hold the credit if they differ. - Credit
swept_amount. Not theamountyou asked for, norreported_amount:swept_amountis what the chain confirmed reached your hot wallet. - Keep only what you accept, turn off the base tokens you do not, and handle
token.refused: stop requesting sweeps of a refused token until you know why.