Module 18: SDK Reference
Flat lookup table for the SDK: signatures, parameters, return types, and which action module has the full context.
This reference describes the SDK release built for the current contract set (several mains, presale, the staking vault, tranche markets, one Up/Down contract). Earlier SDK versions target the previous contracts and cannot be used with this deployment.
Which version these docs describe. They describe the contract set published at
/contracts.json(network,chainId,deploymentBlock) and the SDK and MCP releases that ship with it. Install the SDK-TS, SDK-PY and MCP-TS versions named in the release notes of that deployment. An older SDK stops at start-up with an address-mismatch error against/contracts.json: that error means 'upgrade'.
This is the "what is the signature for extendLoan()" reference. No strategy, no examples: just the API surface. For usage patterns, errors, and worked examples, follow the Action Module pointer. Every row names the contract call the method makes; the wrapper names follow the SDK release and may still change, the contract calls do not.
Examples name STASIS and USDG as "the default main and its pair asset". Every main has its own on-chain name and symbol and its own pair asset: read them, never assume them.
→ See Module 02 for getting started
→ Contract addresses: GET /contracts.json on the deployment you use (Module 17 explains the keys)
→ See Module 10 for all read/query patterns
Section 1: Overview & Installation
JavaScript
npm install github:Launch-On-Basis/SDK-TS
Python
pip install git+https://github.com/Launch-On-Basis/SDK-PY.git
Initialization
const client = await BasisClient.create({ privateKey?, apiKey?, rpcUrl?, chainId?, apiDomain?, addresses? })
On start the client reads GET {apiDomain}/contracts.json: one address per contract, the chainId, and a mains list (main, pairAsset, vault, pairSymbol, pairDecimals). addresses overrides that set. The mains can also be read on chain: SWAP.pairCount(), pairList(i), pairs(main) → (pairAsset, staking, active). An address that is zero in that file is not deployed on that network: the client refuses to send a transaction to it. rpcUrl is optional: when it is left out the SDK uses the default public RPC of the chain named in /contracts.json; pass your own for anything beyond light use.
Client Modes
| Mode | Config | Capability |
|---|---|---|
| Read-only | { rpcUrl? }: no key | On-chain reads only |
| API-key | { apiKey, rpcUrl? } | Off-chain API reads, no writes |
| Full | { privateKey, rpcUrl? } | All reads and writes |
Token Amounts
Tokens minted by BASIS (every main, factory token, market token, outcome share and Up/Down pool token) are 18-decimal wei. An amount of a main's pair asset uses that asset's decimals: read PAIR_UNIT() on the main, decimals() on the asset, or pairDecimals in /contracts.json. Resolver bonds use BOND_UNIT() of BOND_TOKEN(). parseUnits("5", 18) is 5 units only of an 18-decimal asset; USDG, the default main's pair asset, has 6 decimals, so 5 USDG is parseUnits("5", 6). Return values are bigint in the unit of the asset they measure.
Approvals and msg.value
Approve the exact amount of the token a call pulls, to the contract that pulls it. The vault itself is not a token and has no approve.
| Call | Token pulled | Spender |
|---|---|---|
buy, leverageBuy, mixedBuy | path[0] | SWAP |
| sell | the token sold (path[0]) | SWAP |
swapCross | path[0] (nothing when the native coin is sent as msg.value) | SWAP |
vault stake | the main | the vault |
vault repay, paid extendLoan | the main's pair asset | the vault |
hub takeLoan, increaseLoan | the collateral token | the loan hub |
hub repayLoan, extendLoan with payInStable | the ecosystem's stable (the main's pair asset) | the loan hub |
leverage repay through SWAP (repayWith) | the token you pay with (the pair asset or another) | SWAP |
| leverage repay or paid extension by contract call | the pair asset | the address you call (the SDK sets the approval) |
| resolver propose, dispute, veto | BOND_TOKEN | the resolver |
market buy | the input token | the market's host |
order fill (buyOrder) | the market's pair asset | the market's host |
market seed (createMarket) | the main's pair asset | the host |
| Up/Down bet | the input token | MultiPrediction |
| vesting create, add tokens | the vested token | the vesting contract |
vesting repayLoanOnVesting, repayExtendAndReborrow | the pair asset of the vesting's main (the loan's full amount) | the vesting contract |
Payable calls: token creation and market creation need msg.value equal to the fee exactly; vesting creation needs at least its fee when that fee is on (the surplus is refunded).
Section 2: Methods by Module
client (core)
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
BasisClient.create(config) | { privateKey?, apiKey?, rpcUrl?, chainId?, apiDomain?, addresses? } | BasisClient | Initialize client | 02 |
client.authenticate() | - | session | SIWE auth | 03 |
client.ensureApiKey() | - | apiKey | Provision API key | 03 |
client.getSession() | - | session | Check session | 03 |
client.logout() | - | void | End session | 03 |
client.writeContract(params) | ContractWriteParams | tx+sync | Execute, then index the transaction (every event) | 10 |
client.trading
Each main trades against its own pair asset and each factory token against its main. pairAsset below is SWAP.pairs(main).pairAsset; a token's main is token.quoteToken(). A factory token paired straight with the pair asset is refused (Bad pair).
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
buy(tokenAddress, amountIn, minOut?) | address, bigint, bigint? | tx | Buy a token with its main's pair asset. Calls ASwap.buyTokens(amountIn, minOut, [pairAsset, main, token], false) ([pairAsset, main] when the token is a main). amountIn is in the pair asset's decimals. | 04 |
sell(tokenAddress, tokenAmount, minOut?) | address, bigint, bigint? | tx | Sell a token for its main's pair asset: ASwap.sellTokens(tokenAmount, minOut, [token, main, pairAsset], false). | 04 |
sellPercentage(tokenAddress, percentage) | address, number | tx | Sell % of balance | 04 |
leverageBuy(tokenAddress, amountIn, days, minOut?) | address, bigint, number, bigint? | tx | Open a leveraged position: ASwap.leverageBuy(amountIn, minOut, path, numberOfDays). path[0] must be the pair asset of path[1] (the main), else wrong path. minOut is checked against the whole leveraged collateral (simulateLeverageLocked(…).totalColleteral). Leverage reaches up to about 37x, depending on the token and the size of the buy; the position must be more than 2x (Under 2x). One open position per token: with one already open, a leverage buy adds to it and keeps its end date, priced for the days left (Extend first when fewer than the minimum days are left). | 04 |
mixedBuy(tokenAddress, amountIn, days, percentageLeverage, minOutLev?) | address, bigint, number, number, bigint? | tx | One leverage position at a lower leverage: ASwap.mixedBuy(amount, minOutLev, path, numberOfDays, percentageLeverage). The whole amount goes into the position, and only percentageLeverage % (1 to 99, else Range) of the first buy is borrowed against; the rest stays in the position as collateral with no debt. Nothing goes to the wallet. minOutLev is the minimum tokens in the position (simulateLeverageLocked or simulateLeverageFactoryLocked with that percentage, .totalColleteral). Same fees, the same 2x minimum and the same one-position-per-token rule as leverageBuy. | 04 |
buyTokens(amountIn, path, minOut?, wrapTokens?) | bigint, address[], bigint?, boolean? | tx | Raw buy: ASwap.buyTokens(amount, minOut, path, wrapTokens). Paths: [pairAsset, main], [main, token] (the amount and the tax are then in the main) or [pairAsset, main, token]. wrapTokens = true stakes a bought main in that main's vault. SWAP picks presale or AMM itself. | 04 |
sellTokens(amountIn, path, minOut?) | bigint, address[], bigint? | tx | Raw sell: ASwap.sellTokens(amount, minOut, path, false). The fourth contract argument must be false (true reverts use swapCross). Paths are the reverses of the buy paths. | 04 |
swapCross(path, amountIn, minOut, opts?) | address[], bigint, bigint, { recipient?, deadline?, unwrapNative? } | tx | Swap across two mains, or to and from an outside token, in one transaction: ASwap.swapCross(path, amountIn, minOut, recipient, deadline, unwrapNative). Payable: send the native coin with path[0] = the wrapped native token. | 04 |
quoteCross(path, amountIn, wallet) | address[], bigint, address | bigint | What a trade pays after wallet's tax, for plain and cross-pair paths. The contract function is nonpayable, so it is called with eth_call. Reverts autovest presale for a token in an auto-vest presale. Use it to set minOut. | 04,32 |
getAmountsOut(amountIn, path) | bigint, address[] | bigint | Quote before tax: one uint256 for 2-hop and 3-hop paths. A buy takes the tax off the input and a sell takes it off the output, so the trade pays less than this. | 04,32 |
getTokenPrice(tokenAddress) | address | bigint | Price × 1e18 in main units. For a main it is the price in its pair asset. | 04,10 |
getPairPrice(tokenAddress) | address | bigint | Price in the main's pair-asset units (token price × the main's price). A USD price only when the pair asset is a USD stable. | 04,10 |
getLeverageCount(wallet, main?) | address, address? | bigint | Leverage positions the wallet has opened on that main (default: the default main). Reads main.leverageCount(wallet); ids run 1 to count. Each position is recorded on its token's main: loop over every main to see them all. MainLens.getLeverageCountForUserAndToken(main, wallet, token) counts the positions ever opened on one token; at most one is open at a time (main.openLeverageOf(wallet, token)). | 04,10 |
getLeveragePosition(wallet, index, main?) | address, bigint, address? | LeveragePosition (13 values) | main.leverages(wallet, index). Order: user, token, collateralAmount, liquidatedAmount, fullAmount, borrowedAmount, liquidationTime, liquidationClaim, isLiquidated, active, creationTime, timeOfClosure, (leverageBuyAmount, cashedOut). 1-indexed: index 0 is always empty. | 04,10 |
getPartialLoanSellAmounts(positionId, wallet, percentage, isLeverage, main?) | bigint, address, number, boolean, address? | { residualTokens } | MainLens.getPartialLoanSellAmounts(main, loanId, user, percentage, isLeverage) (the main is the first argument). Use only residualTokens: the part of your collateral left to sell. Read it before a partial sell to set minOut; the other return values are internal. Reverts Already liquidated on a liquidated position. | 04 |
partialLoanSellFor(main, positionId, percentage, isLeverage, minOut) | address, bigint, bigint, boolean, bigint | tx | Sell down or close a leverage position; 100 = full close. Percentage 10 to 100 in steps of 10 (% by 10, % range). ASwap.partialLoanSellFor(main, loanId, percentage, isLeverage, minOut) on the main the position lives on. Only the position's own wallet may call (Not user). The exit pays 3% of the proceeds above the initial buy. Slippage revert: Min out not met. Naming the wrong main reverts Not user, or sells that main's position with the same id. | 04 |
extendLeverage(positionId, days, payInMainPair, refinance, main?) | bigint, number, boolean, boolean, address? | tx | Extend a leverage position. The position is recorded on the token's main; extend it there: main.extendLoan(positionId, days, true, payInMainPair, refinance). Works until a keeper liquidates the position. | 04 |
repayLeverage(positionId, main?) | bigint, address? | tx | Repay with the pair asset, nothing sold. The position is recorded on the token's main; repay it there: main.repayLoan(positionId, amount, true). An amount at or above the debt closes the position and returns all the collateral (send type(uint256).max to close). A smaller amount repays that part and returns the same share of the collateral; what is left must stay at least minimumLoan (Repay in full). Approve the pair asset to the address you call. Or repay through SWAP: ASwap.repayWith(main, positionId, tokenIn, amountIn, minPairOut, close, deadline) takes the pair asset itself or another token (converted to the pair asset first), refunds the leftover, and needs the approval on SWAP only. | 04 |
claimLeverageLiquidation(positionId, main?) | bigint, address? | tx | After a keeper liquidated the position: main.claimLiquidation(positionId, true) pays what is left after the debt, less the 10% liquidation fee. Claim within 365 days of the liquidation; after that the leftover may no longer be claimable. | 04 |
ASwap.convertToNative(marketToken, inputToken, inputAmount, sell) converts the pair asset or the main to and from a market token, not outcome shares. Only registered prediction hosts may call it (hosts only); no wallet can. The SDK has no wrapper.
After liquidationTime a keeper liquidates the position. Assume it can happen in the first block after the deadline. Until that transaction lands a repay or a paid extension still goes through; do not plan on the gap.
client.factory
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
createTokenWithMetadata(params) | CreateTokenParams | tx | Create a token and its IPFS metadata. Sends msg.value = feeWhitelist(wallet) ? 0 : feeAmount() exactly; any other value reverts Wrong fee. presaleTokens is a count of whole tokens sold in the presale (0 = no presale), not a pair-asset amount. Calls createTokenFor(CreateParams), or createReversedTokenFor when reversed: true. Bounds: hybridMultiplier 1–100 (100 = Stable+, 50 to 99 = Utility+, 1 to 49 = Floor+; reversed: 1 to 50 Meme+, 51 to 99 Yolo+, 100 Yolo), startLP 1,000 to 100,000, autoVestDuration 1–990 days, frozen needs a presale, supplyMultiplier at most the main's MAX_SUPPLY_MULTIPLIER(). | 07 |
createTokenFor(params) | CreateParams | tx | The same creation without metadata: picks the main, supplyMultiplier and rewardsEnabled. | 07 |
createReversedToken(params) | CreateParams | tx | Create a reversed token, Meme+, Yolo+ or Yolo (reversed() is true): createReversedTokenFor. The presale is at most half the launch supply. | 07 |
disableFreeze(tokenAddress) | address | tx | token.disableFreeze(), called on the token. Irreversible. | 07 |
setWhitelistedWallet(tokenAddress, wallets, amount, tag) | address, address[], bigint, string | tx | token.setWhitelistedWallet(wallets, amount, tag). amount caps the tokens each wallet may buy during a frozen presale. | 07 |
removeWhitelist(tokenAddress, wallet) | address, address | tx | token.removeWhitelist(wallet) | 07 |
claimRewards(tokenAddress) | address | tx | Claim holder rewards: token.claimRewards(). Only tokens created with rewardsEnabled pay; rewards are paid in the main's pair asset. It never pays a creator. | 07 |
getTokenState(tokenAddress) | address | TokenState | frozen, presaleComplete, presaleSold, presaleTarget, reversed, rewardsEnabled, hybridMultiplier, totalSupply, the price in main units (getTokenPrice) and in pair-asset units (getPairPrice), main, pairAsset. | 07,10 |
isEcosystemToken(tokenAddress) | address | boolean | Verify token is legit | 10 |
getTokensByCreator(wallet) | address | address[] | Factory tokens whose factory caller was the wallet. A market token is created by its host, so a wallet's markets are not in this list. | 07,10 |
getFeeAmount() | - | bigint | Creation fee in ETH: feeAmount() | 07 |
isFeeWhitelisted(wallet) | address | boolean | feeWhitelist(wallet): such a wallet sends 0 | 07 |
getClaimableRewards(tokenAddress, wallet) | address, address | bigint | token.getClaimableRewards(wallet); 0 on a token without rewards | 07,10 |
getFloorPrice(tokenAddress) | address | bigint | The floor in pair-asset units: calculateFloor(). calculateTokenFloor() gives it in main units. | 04,10 |
client.loans
⚠️ These methods act on HUB LOANS only. SWAP opens and closes leverage positions, and each one is recorded on its token's main. The hub methods (
repayLoan,extendLoan,increaseLoan,claimLiquidation,hubPartialLoanSell) take a hub id and never reach a leverage position. For leverage useclient.trading:partialLoanSellFor(main, positionId, pct, true, minOut)to sell down or close,extendLeverage,repayLeverage, andclaimLeverageLiquidationafter a keeper liquidation.
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
takeLoan(main, collateral, amount, days) | address, address, bigint, number | tx | Borrow the main's pair asset against amount of collateral: ALOAN_HUB.takeLoan(ecosystem, collateral, amount, daysCount). ecosystem is the main: the collateral itself when it is a main, else its quoteToken(). 10 to 1000 days. The fee, 2% + 0.005% per day, is taken up front. The loan value must reach the main's minimumLoan. One open loan per wallet, main and collateral token: add to it with increaseLoan (Open loan: increase it). Returns a hub id; ids start at 1. | 05 |
repayLoan(hubId) | number | tx | ALOAN_HUB.repayLoan(hubId, amount); nothing is sold. An amount at or above the debt closes the loan and returns all the collateral (send type(uint256).max). A smaller amount repays that part and returns the same share of the collateral; what is left must stay at least the main's minimumLoan (Repay in full). To repay with another token: repayLoanWith(hubId, tokenIn, amountIn, minStableOut, close, deadline). Works until a keeper liquidates the loan, even after the term. | 05 |
extendLoan(hubId, days, payInStable?, refinance?) | number, number, boolean?, boolean? | tx | ALOAN_HUB.extendLoan(hubId, addDays, payInStable, refinance). The two flags are exclusive (Pay in stable or refinance, not both). days = 0 needs refinance. | 05 |
increaseLoan(hubId, amountToAdd) | number, bigint | tx | Add collateral to the loan: ALOAN_HUB.increaseLoan(hubId, amountToAdd) | 05 |
claimLiquidation(hubId) | number | tx | After a keeper liquidated the loan: claim the remainder (the collateral left after the debt, less the 10% liquidation fee). Claim within 365 days of the liquidation; after that the leftover may no longer be claimable. | 05 |
hubPartialLoanSell(hubId, percentage, minOut) | number, number, bigint | tx | Partial sell of a hub loan: ALOAN_HUB.hubPartialLoanSell(hubId, percentage, minOut), in 10% steps (10 to 100). Pays the pair asset, and the residual sold pays the token's normal sell rate (base + creator + rewards fee, no referral). There is no leverage flag: the hub only sells hub loans. For leverage use client.trading.partialLoanSellFor(). | 05 |
getUserLoanDetails(wallet, hubId) | address, number | FullLoanDetails (14 fields) | Loan state by hub id. An unknown id reverts Loan does not exist. | 05,10 |
getUserLoanCount(wallet) | address | number | userLoanCount(wallet): loans the wallet ever opened on the hub. Ids are 1 to count: loop from 1. | 05,10 |
A vault loan is owned by the vault in the hub: these methods fail for it (use client.vault). After liquidationTime a keeper liquidates the loan. Assume it can happen in the first block after the deadline. Until that transaction lands a repay or a paid extension still goes through; do not plan on the gap.
client.vault(main?)
One vault contract serves every main (SWAP.pairs(main).staking names it). Each main has its own pool, and every contract call names the main first; every SDK method takes an optional main (default: the default main). A stake is not a token: it cannot be transferred or approved, and the vault has no balanceOf: the stake is positions(main, wallet).staked. Rewards: 10% of the base part of every fee on that main's tokens, bought into the main and paid to that main's stakers only. A liquidation settles the vault position in the same transaction: there is no settle call.
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
stake(amount) | bigint | tx | Stake the main 1:1: AStasisVault.stake(main, amount). Minimum minStake(). Approve the main to the vault. | 06 |
unstake(amount, toMainPair?, minMainPair?) | bigint, boolean?, bigint? | tx | unstake(main, amount, toMainPair, minMainPair). At most freeToUnstake(main, wallet): the pledged part stays. With toMainPair the main is sold for the pair asset at the wallet's own tax; minMainPair is the floor. | 06 |
claim() | - | tx | claim(main): pay out the earned rewards, in the main. With a loan open, only the part not needed as collateral. | 06 |
compound() | - | tx | compound(main): add the earned rewards to the stake | 06 |
borrow(mainAmount, days) | bigint, number | tx | Pledge mainAmount of the staked main and borrow its pair asset: borrow(main, stasisAmount, days). The first argument is an amount of the main, not of the pair asset. One loan per position; the pledged part keeps earning. | 06 |
addToLoan(additionalMain) | bigint | tx | Pledge more staked main and borrow more: addToLoan(main, additionalStasis). Needs more than 10 days left on the loan (Duration too short). | 06 |
repay() | - | tx | repay(main): repay the vault loan in full. Approve the pair asset to the vault. | 06 |
extendLoan(daysToAdd, payInMainPair, refinance) | number, boolean, boolean | tx | extendLoan(main, daysToAdd, payInMainPair, refinance): extend the vault loan. daysToAdd = 0 needs refinance = true and payInMainPair = false. | 06 |
earned(wallet) | address | bigint | earned(main, wallet): rewards earned and not yet claimed, in the main | 06,10 |
getPosition(wallet) | address | VaultPosition | positions(main, wallet) = (staked, pledged, hubId, checkpoint, pending, hub) (a loan is open when hub is set), plus earned(main, wallet), collateralOf(main, wallet) and freeToUnstake(main, wallet) | 06,10 |
getAvailableStasis(wallet) | address | bigint | getAvailableStasis(main, wallet): stake plus unclaimed rewards the wallet can still pledge | 06,10 |
getVaultLoan(wallet) | address | LoanDetails | null | The wallet's vault loan, read from positions(main, wallet).hub and .hubId. The borrower of record on the hub is the vault, not the wallet. | 06,10 |
getTotals() | - | { totalStaked, totalPledged, rewardsHeld } | pools(main) = (totalStaked, totalPledged, rewardsHeld, accRewardPerStake): that main's pool, in the main | 06,10 |
client.vesting
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
createGradualVesting(beneficiary, token, totalAmount, startTime, durationInDays, timeUnit, memo, ecosystem, renounceOnCreation?) | address, address, bigint, number, number, number, string, address, boolean? | tx | Linear vesting. beneficiary cannot be the zero address (Invalid beneficiary address). startTime may be at most 990 days ahead (Start too far); a past time means now. ecosystem is the token's main (the token must be that main or one of its tokens). Payable only when the vesting fee is on and the wallet is not fee-whitelisted (off by default; the surplus is refunded). | 09 |
createCliffVesting(beneficiary, token, totalAmount, unlockTime, memo, ecosystem, renounceOnCreation?) | address, address, bigint, number, string, address, boolean? | tx | Cliff vesting; same beneficiary, ecosystem and fee rules | 09 |
batchCreateGradualVesting(beneficiaries[], token, totalAmounts[], memos[], startTime, durationInDays, timeUnit, ecosystem, renounceOnCreation?) | parallel arrays + one shared token, schedule and main | tx | Batch gradual | 09 |
batchCreateCliffVesting(beneficiaries[], token, totalAmounts[], unlockTime, memos[], ecosystem, renounceOnCreation?) | parallel arrays + one shared token, unlock time and main | tx | Batch cliff | 09 |
claimTokens(vestingId) | number | tx | Claim unlocked | 09 |
takeLoanOnVesting(vestingId) | number | tx | Borrow against the vesting. No days argument: the term is the schedule's remaining days plus loanBuffer (10). Pledges every unclaimed token; the beneficiary receives the loan in the main's pair asset. | 09 |
repayLoanOnVesting(vestingId) | number | tx | Repay the vesting loan in full; also settles a loan a keeper liquidated. The beneficiary may call it, and so may the creator while the vesting is not renounced (the caller pays). | 09 |
repayExtendAndReborrow(vestingId, additionalDays) | number, number | tx | Repay, extend the schedule and borrow again in one transaction | 09 |
renounceVesting(vestingId) | number | tx | After it the creator can no longer change the beneficiary, extend the schedule or repay its loan. Adding tokens and handing on the creator role still work. | 09 |
changeBeneficiary(vestingId, newBeneficiary) | number, address | tx | Change recipient (not on a renounced vesting) | 09 |
extendVestingPeriod(vestingId, additionalDays) | number, number | tx | Extend, in days. Creator or beneficiary. Reverts Loan open: repay first while a loan is linked. | 09 |
addTokensToVesting(vestingId, amount) | number, bigint | tx | Add tokens (same loan guard) | 09 |
transferCreatorRole(vestingId, newCreator) | number, address | tx | Transfer creator | 09 |
getVestingDetails(vestingId) | number | VestingDetails (14 fields) | Schedule details; ecosystem is field 3 and renounced is last | 09,10 |
getClaimableAmount(vestingId) | number | bigint | Claimable now | 09,10 |
getVestedAmount(vestingId) | number | bigint | Total vested | 09,10 |
getEffectiveTotalAmount(vestingId) / getEffectiveVestedAmount(vestingId) | number | bigint | effectiveTotalAmount / effectiveVestedAmount: totals after a liquidation reduced the vesting | 09,10 |
getVestingsByBeneficiary(wallet) | address | vestingId[] | My vestings | 09,10 |
getVestingsByCreator(wallet) | address | vestingId[] | Created vestings | 09,10 |
getActiveLoan(vestingId) | number | bigint | The hub id of the linked loan; 0 = none | 09,10 |
getLoanHubOf(vestingId) | number | address | loanHubOf(vestingId): the hub that holds this vesting's loan | 09 |
getTokenVestingIds(tokenAddress, startIndex, endIndex) | address, number, number | vestingId[] | Vestings of a token, paged | 09 |
getVestingDetailsBatch(vestingIds[]) | number[] | VestingDetails[] | Batch read | 09,10 |
getVestingCount() | - | number | vestingCount(); ids start at 0 | 09 |
client.predictionMarkets
Public markets live on the marketTrading host (ATrancheMarket). Sizes are set per main: read TrancheReader.sizesFor(host, main, n) → (unit, seedStep, minBet, perOutcome, totalPool). The seed floor is minSeed() × unit, in steps of seedStep. The outcome limit is MAX_OUTCOMES(), read live.
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
createMarketWithMetadata(params) | CreateMarketParams | tx | Create a public market: ATrancheMarket.createMarket(CreateParams, deadline, approvalSignature) with the moderator approval (POST /api/v1/markets/approve) and exactly the signed name, symbol, end time and outcomes. CreateParams = { marketName, symbol, endTime, optionNames, trancheBP, maintoken, frozen, bonding, seedAmount }. endTime: 0 for an open-ended market, else at least 1 minute ahead. The end time is part of the moderator approval: an approval is only valid for the end time it was signed for, and the approval step refuses end times too far out. trancheBP: 1 to 10 slices that sum to 10000 ([10000] = winner takes all). seedAmount: raw pair-asset amount, at least minSeed() × sizesFor.unit and a multiple of seedStep. Approve the seed of the pair asset to the host. msg.value = the factory fee for the host, exactly. | 08 |
buy(marketAddress, outcomeId, inputToken, inputAmount, minTokens, minShares) | address, number, address, bigint, bigint, bigint | tx | buy(marketToken, outcomeId, inputToken, inputAmount, minUsdc, minShares, deadline); after deadline it reverts Deadline. inputToken is the market token, the pair asset, the market's main or another BASIS token (an outside token only where a route exists). minTokens (contract name minUsdc) is the smallest net market-token amount accepted; minShares comes from marketReader.quoteShares. Never pass 0. AMM bets stop once an outcome is proposed. | 08 |
redeem(marketAddress, opts?) | address, { fractionBps?, slices?, minOut? } | tx | redeem(marketToken, fractionBps, slices, minOut); default (10000, 1, …). The payout is held in market tokens and sold to the pair asset here. | 08 |
buyOrdersAndContract(marketAddress, outcomeId, orderIds[], inputToken, totalInput, minShares) | address, number, number[], address, bigint, bigint | tx | Combined order book + AMM. Takes only the pair asset as inputToken. | 08 |
getMarketData(marketAddress) | address | MarketData | 12 fields. finalOutcome: 254 = INVALID, 255 = unresolved. usdc is the market's pair asset. generalPot always reads 0: do not use it. | 08,10 |
getOutcome(marketAddress, outcomeId) | address, number | OutcomeData | Outcome details | 08,10 |
getUserShares(marketAddress, wallet, outcomeId) | address, address, number | bigint | Share balance | 08,10 |
getNumOutcomes(marketAddress) | address | number | Outcome count | 08 |
getOptionNames(marketAddress) | address | string[] | Outcome names | 08 |
hasBettedOnMarket(marketAddress, wallet) | address, address | boolean | Has bet | 08,10 |
getTrancheBP(marketAddress) | address | number[] | The payout split | 08 |
getFinalRanking(marketAddress) | address | number[] | The resolved ranking | 08 |
isValidRanking(marketAddress, ranking[], tieMask) | address, number[], bigint | boolean | Check a ranking before proposing or voting | 08,14 |
quoteScenario(marketAddress, ranking[], tieMask, wallet) | address, number[], bigint, address | bigint | Payout in market tokens if that ranking wins | 08,32 |
quoteRedeem(marketAddress, wallet) | address, address | bigint | Payout in market tokens after resolution | 08,32 |
getPendingPayout(marketAddress, wallet) | address, address | bigint | pendingPayout(market, wallet): market tokens still to redeem after a partial redeem | 08 |
getMarketSizes(main, numOutcomes) | address, number | { unit, seedStep, minBet, perOutcome, totalPool } | TrancheReader.sizesFor(host, main, n): the sizes in force. minBet is in 18-decimal market tokens, after conversion and before the fee. | 08 |
Total pot: there is no getter. It is the sum of totalCost over marketReader.getAllOutcomes(host, market), in market tokens; marketReader.valueInUsdb(host, market, amount) gives its pair-asset value.
client.orderBook
Every call goes to the market's own host (public or private).
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
listOrder(marketAddress, outcomeId, amount, pricePerShare) | address, number, bigint, bigint | tx | Create a limit sell. pricePerShare is the odds × 1e18, from 0.001 (1e15) to 0.999 (999e15), or 0 to sell at the live AMM price. | 08 |
cancelOrder(marketAddress, orderId) | address, number | tx | Cancel order | 08 |
buyOrder(marketAddress, orderId, fill, maxCost) | address, number, bigint, bigint | tx | Fill an order (not your own). fill is a share count; maxCost caps the total cost in the market's pair asset. | 08 |
getBuyOrderCost(marketAddress, orderId, fill) | address, number, bigint | { baseUsdc, buyerTax, totalCostToBuyer, netToSeller } | Cost of a fill | 08 |
getBuyOrderAmountsOut(marketAddress, orderId, amount) | address, number, bigint | { fill, baseUsdc, buyerTax, totalCostToBuyer } | Shares a pair-asset amount buys from that order | 08 |
To sweep several orders use buyOrdersAndContract with the order ids.
client.resolver
Every tranche market registers with the resolver when it is created and is ranked. The single-outcome contract entry points (one uint8 outcome) revert Ranked market: use the *Ranked entrypoints. Only wallets on the voter panel (authorizedVoter) vote: no stake, no lock. Bonds are paid in BOND_TOKEN: 5 units, doubled after each EARLY reset, at most 8 doublings (1,280 units), never above BOND_MAX() (8,000 units). Read requiredBond(market, wallet). The winner gets their own bond back, plus the loser's bond up to twice the winner's own bond (so at most three times their own bond in total). Anything above that goes to insurance. If neither key wins, both bonds go to insurance. When an EARLY dispute wins, the disputer gets their own bond back plus half the proposer's bond; the other half goes to insurance.
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
propose(marketAddress, ranking[], tieMask?) | address, number[], bigint? | tx | proposeRanked(marketToken, ranking, tieMask). [outcome] for a winner-take-all market; an empty ranking = INVALID. Bond: requiredBond(market, wallet) in BOND_TOKEN. The creator may propose at endTime, everyone else 15 minutes later. | 08,14 |
dispute(marketAddress, ranking[], tieMask?) | address, number[], bigint? | tx | disputeRanked(…). The bond matches the proposer's bond, capped at BOND_CAP. The proposer cannot dispute its own proposal. | 08,14 |
disputeEarly(marketAddress) | address | tx | disputeRankedEarly(marketToken): "proposed too early". EARLY can only be a dispute or a vote, never a proposal or a veto. | 08,14 |
vote(marketAddress, ranking[], tieMask?) | address, number[], bigint? | tx | voteRanked(…). Only wallets on the voter panel (authorizedVoter) may vote. | 08,14 |
voteEarly(marketAddress) | address | tx | voteRankedEarly(marketToken) | 08,14 |
finalizeUncontested(marketAddress) | address | tx | Finalize after the quiet period | 08,14 |
finalizeMarket(marketAddress) | address | tx | Finalize after a vote: the plurality leader wins once MIN_QUORUM (2) votes are in; a tie or no quorum opens a new round. Bonds are settled here; there is nothing to claim. | 08,14 |
veto(marketAddress, ranking[], tieMask?) | address, number[], bigint? | tx | vetoRanked(…). Open to anyone except the proposer and the disputer. Bond: the proposer's bond, clamped to VETO_FLOOR..BOND_CAP (100 to 500 units). It moves the market into the veto stage (inVeto). | 14 |
getDisputeData(marketAddress) | address | DisputeData | disputes(market): 10 fields; outcomes are bytes32 keys | 08,14 |
isResolved(marketAddress) | address | boolean | resolved(market) | 08 |
getFinalOutcome(marketAddress) | address | number | finalOutcome(market) | 08 |
isInDispute(marketAddress) / isInVeto(marketAddress) | address | boolean | inDispute / inVeto | 08,14 |
getCurrentRound(marketAddress) | address | number | currentRound(market) | 14 |
getVoteCount(marketAddress, round, key) | address, number, bytes32 | bigint | voteCount(market, round, key) | 14 |
hasVoted(marketAddress, round, wallet) | address, number, address | boolean | Has voted in that round | 14 |
getVoterChoice(marketAddress, round, wallet) | address, number, address | bytes32 | voterChoice(market, round, wallet): the key voted for | 14 |
getTally(marketAddress, round) | address, number | Tally | tallies(market, round) = (leader, leaderCount, totalVotes, tie) | 14 |
getRanking(marketAddress, key) | address, bytes32 | { ranking, tieMask } | Decode a key; rankingKey(ranking) encodes one | 14 |
getRequiredBond(marketAddress, proposer) | address, address | bigint | requiredBond(market, proposer), in BOND_UNIT of BOND_TOKEN | 08,14 |
hasProposal(marketAddress) | address | boolean | A proposal is open | 08,14 |
hostOf(marketAddress) | address | address | hostOf(market): the host the market registered from | 08,14 |
isVoter(wallet) | address | boolean | authorizedVoter(wallet): on the voter panel | 14 |
getConstants() | - | ResolverConstants | DISPUTE_PERIOD, PROPOSAL_PERIOD, VETO_PERIOD, PROPOSAL_BOND, MIN_QUORUM, EARLY_FAST_PERIOD, BOND_CAP, BOND_MAX, VETO_FLOOR, BOND_TOKEN, BOND_UNIT | 14 |
client.privateMarkets
Private markets live on the privateMarket host (ATrancheMarketPrivate). buy, redeem, listOrder, cancelOrder, buyOrder, buyOrdersAndContract, getBuyOrderCost, getBuyOrderAmountsOut, getTrancheBP, getFinalRanking, quoteScenario and quoteRedeem take the same arguments as on the public host (tables above). The seed floor is minSeedPublic() × sizesFor.unit for a public-visibility event and minSeedPrivate() × sizesFor.unit for a private one.
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
createMarketWithMetadata(params) | CreatePrivateMarketParams | tx | Create a private market: ATrancheMarketPrivate.createMarket(CreateParams, deadline, approvalSignature), same rules as the public host, except that endTime has no upper limit; CreateParams also has privateEvent. | 08 |
buy(marketAddress, outcomeId, inputToken, inputAmount, minTokens, minShares) | address, number, address, bigint, bigint, bigint | tx | Buy on private (seven arguments with deadline, as public) | 08 |
redeem(marketAddress, opts?) | address, { fractionBps?, slices?, minOut? } | tx | redeem(marketToken, fractionBps, slices, minOut) | 08 |
listOrder(marketAddress, outcomeId, amount, pricePerShare) | address, number, bigint, bigint | tx | List order | 08 |
cancelOrder(marketAddress, orderId) | address, number | tx | Cancel | 08 |
buyOrder(marketAddress, orderId, fill, maxCost) | address, number, bigint, bigint | tx | Fill; fill in shares | 08 |
buyOrdersAndContract(marketAddress, outcomeId, orderIds[], inputToken, totalInput, minShares) | address, number, number[], address, bigint, bigint | tx | Combined | 08 |
vote(marketAddress, ranking[], tieMask?) | address, number[], bigint? | tx | vote(marketToken, ranking, tieMask). [outcome] for a winner-take-all market; an empty ranking = INVALID. | 08,14 |
finalize(marketAddress) | address | tx | Finalize after firstVoteTime + VOTING_WINDOW (15 minutes) | 08,14 |
manageVoter(marketAddress, voter, add) | address, address, boolean | tx | Add/remove voter. At most 11 voters including the creator; the list is fixed after the first vote. | 08 |
canUserBuy(marketAddress, wallet) | address, address | boolean | Eligible: reads userCanBuyEvent(market, wallet) | 08 |
isMarketVoter(marketAddress, wallet) | address, address | boolean | Is voter | 08,14 |
getVoters(marketAddress) | address | address[] | The voter list | 08,14 |
getVoterChoice(marketAddress, wallet) | address, address | { key, ranking, tieMask } | The vote: voterKey(market, wallet) (bytes32, 0 = not voted) decoded with getRanking(market, key) | 14 |
getRanking(marketAddress, key) | address, bytes32 | { ranking, tieMask } | Decode a key | 14 |
getFinalKey(marketAddress) | address | bytes32 | finalKey(market) | 14 |
getFirstVoteTime(marketAddress) | address | bigint | firstVoteTime(market) | 14 |
getMarketData(marketAddress) | address | MarketData | Private market data | 08,10 |
getNumOutcomes(marketAddress) | address | number | Outcomes | 08 |
getOutcome(marketAddress, outcomeId) | address, number | OutcomeData | Outcome | 08 |
getMarketOrders(marketAddress) | address | Order[] | No on-chain list exists: reads marketOrders(market, id) for each id below nextOrderId(market) | 08 |
getNextOrderId(marketAddress) | address | number | Next ID | 08 |
getBuyOrderCost(marketAddress, orderId, fill) | address, number, bigint | { baseUsdc, buyerTax, totalCostToBuyer, netToSeller } | Cost | 08 |
getBuyOrderAmountsOut(marketAddress, orderId, amount) | address, number, bigint | { fill, baseUsdc, buyerTax, totalCostToBuyer } | Preview | 08 |
client.marketReader
Every call takes the host first (marketTrading or privateMarket from /contracts.json).
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
getAllOutcomes(host, marketAddress) | address, address | OutcomeInfo[] | All outcomes. probability is in basis points; pricePerShare is 1e18 odds. | 08,10 |
quoteShares(host, marketAddress, outcomeId, inputToken, inputAmount, buyer) | address, address, number, address, bigint, address | { sharesOut, netToken } | The pre-bet quote; use it for minShares. It returns 0 for an input token the host does not quote directly: convert first with SWAP.quoteCross(path, amount, bettor), then quote the result. | 08,32 |
estimateSharesOut(host, marketAddress, outcomeId, amount, orderIds[], wallet) | address, address, number, bigint, number[], address | bigint | Shares for a pair-asset amount across the listed orders and the AMM | 08,32 |
getAllUserShares(host, marketAddress, wallet) | address, address, address | bigint[] | A wallet's shares per outcome | 08,10 |
getUserSharesBatch(host, marketAddress, wallets[], outcomeIds[]) | address, address, address[], number[] | bigint[] | Batch share read | 08,10 |
quoteScenarioUSDB(host, marketAddress, ranking[], tieMask, wallet) | address, address, number[], bigint, address | { tokenPayout, usdbPayout } | Payout if that ranking wins. "USDB" in the name means the market's pair asset. | 08,32 |
quoteRedeemUSDB(host, marketAddress, wallet) | address, address, address | { tokenPayout, usdbPayout } | Payout after resolution | 08,32 |
valueInUsdb(host, marketAddress, amount) | address, address, bigint | bigint | Pair-asset value of a market-token amount | 08,10 |
client.leverageSimulator (alias: client.leverageSim)
These SDK helpers take a token address and an amount and return a preview. The simulation charges the swap tax of address(0), so it ignores a wallet's referral discount.
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
simulateLeverageLocked(tokenAddress, amountIn, days, leveragePct) | address, bigint, number, bigint | SimResult (13 fields) | For a main: simulateLeverageLocked(amount, [pairAsset, main], numberOfDays, leveragePct); leveragePct 100 quotes a leverageBuy, 1 to 99 a mixedBuy. The fields to use: totalColleteral (the ABI's spelling; the position size minOut is checked against), totalBorrowed, totalRepay, totalFees and totalDexTax. | 04,32 |
simulateLeverageFactoryLocked(tokenAddress, amountIn, days, leveragePct) | address, bigint, number, bigint | SimResult | For a factory token: simulateLeverageFactoryLocked(amount, [pairAsset, main, token], numberOfDays, leveragePct) | 04,32 |
calculateFloor(tokenAddress) | address | bigint | Floor price of the token, in pair-asset units (the same as trading.getFloorPrice) | 04,32 |
getTokenPrice(tokenAddress) | address | bigint | Price of the token in main units (the same as trading.getTokenPrice) | 32 |
getPairPrice(tokenAddress) | address | bigint | Price of the token in pair-asset units (the same as trading.getPairPrice) | 32 |
getCollateralValue(tokenAddress, amount) | address, bigint | bigint | Collateral value of an amount of a main | 04,32 |
getCollateralValueHybrid(tokenAddress, amount) | address, bigint | bigint | Collateral value of an amount of a factory token | 04,32 |
calculateTokensForBuy(tokenAddress, amountIn) | address, bigint | bigint | Tokens an amount buys, before tax | 32 |
For a loan or a trade preview on live state, use trading.getAmountsOut or trading.quoteCross (SWAP.getAmountsOut / SWAP.quoteCross), the token's own calculateFloor(), and the MainLens previews such as getPartialLoanSellAmounts.
client.taxes
One base fee on every trade and bet, TAXES.baseRate() (60 bps today; 54 for a wallet with an on-chain referrer), plus, on a factory token, the creator fee its creator set (at most 1%) and, on a rewards-enabled token, its rewards fee (at most maxRewardsFee). A main pays the base only; a fee-whitelisted wallet pays 0. Read the rate right before trading.
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
getTaxRate(tokenAddress, wallet?) | address, address? | bigint (bps) | getTaxRate(token, user): one number. 0 for a fee-whitelisted wallet. On a main: the base rate. On any other token: base + creator fee + rewards fee. | 04,10 |
getTokenTaxInfo(tokenAddress) | address | TokenTaxInfo | The full breakdown and the caps | 07,10 |
getBaseRate() | - | bigint | baseRate() | 10 |
setCreatorFee(tokenAddress, bps) | address, number | tx | The token's DEV sets the creator fee: at most 100 bps, 4 h cooldown | 07 |
setRewardsFee(tokenAddress, bps) | address, number | tx | Only on a rewards-enabled token; at most maxRewardsFee(hybridMultiplier, reversed); 4 h cooldown | 07 |
addDevShare(tokenAddress, wallet, basisPoints) | address, address, number | tx | Split the creator's income: 1 to 10000 basis points per wallet, at most 10000 in total and 10 wallets. DEV only. | 07 |
removeDevShare(tokenAddress, wallet) | address, address | tx | Remove a dev wallet | 07 |
getDevWallets(tokenAddress) | address | address[] | The dev wallets of a token | 07 |
getCreatorEarnings(tokenAddress, devWallet) | address, address | bigint | tokenDevEarnings(token, recipient): the running total already paid to that wallet from this token, in its pair asset. Not an unpaid balance. | 07,10 |
getDevTotalEarnings(devWallet, pairAsset) | address, address | bigint | devTotalEarnings(recipient, pairAsset): lifetime total in that pair asset | 07,10 |
setReferrer(referrer) | address | tx | Set the fee referrer: AReferrals.setReferrer on the referral registry (TAXES.referrals()). Once set, you can't change it yourself. The referrer needs no trading history. | 03 |
getReferrer(wallet) / getReferralCount(wallet) / getReferralEarnings(referrer, pairAsset) | address (+ address) | address / bigint / bigint | TAXES.referrerOf, AReferrals.referralCount, TAXES.referralEarnings: the on-chain referral reads | 03,10 |
client.agentIdentity (alias: client.agent)
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
register(name, description, agentWallet) | string, string, address | tx | ERC-8004 registration | 03 |
registerAndSync(name, description, agentWallet) | string, string, address | tx+sync | Full flow | 03 |
setAgentURI(agentId, uri) | number, string | tx | Update metadata URI | 03 |
getAgentURI(agentId) | number | string | Read URI | 03 |
getAgentWallet(agentId) | number | address | Linked wallet | 03 |
getMetadata(agentId) | number | AgentMetadata | Read metadata | 03 |
isRegistered(wallet) | address | boolean | Check registered | 03 |
getAgentIdFromChain(wallet) | address | number | Lookup ID | 03 |
syncToApi(agentId) | number | void | Sync to backend | 03 |
lookupFromApi(wallet) | address | AgentInfo | API lookup | 03 |
listAgents() | - | AgentInfo[] | All agents | 03 |
client.updown
One MultiPrediction contract serves every asset of the Up/Down product. client.updown.assets() lists them (assetCount() and assets(i) = (priceFeed, poolToken, paused, label, main, settle, virtFloor)). Assets can be added at any time: do not hardcode the list. asset is the index (examples use 0). tf is 0=5m, 1=15m, 2=1h, 3=4h, 4=24h. On chain side is 1 = Bull, 2 = Bear. Failures are custom errors, except Deadline, fraction 1-10000, slices 1-25 and Below minOut.
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
assets() / getAsset(asset) | - / number | Asset[] / Asset | The asset registry | 08 |
bet(asset, tf, side, amount, opts?) | number, number, 'bull'|'bear', bigint, { inputToken?, tolerance? } | tx | betBull / betBear(asset, tf, inputToken, amount, minShares, deadline); after deadline it reverts Deadline. inputToken is the asset's pool token, its settle asset, its main or another BASIS token (default: the settle asset); approve it to MultiPrediction. minShares = quoteSharesForInput less the tolerance; never 0. Betting closes 15 s before the round ends; one side per round; the net stake must be at least virtFloor / 10000. | 08 |
claim(asset, tf, roundId, opts?) | number, number, number, { fractionBps?, slices?, minOut? } | tx | claim(asset, tf, roundId, fractionBps, slices, minOut); paid in the settle asset after the pool tokens are sold | 08 |
settleCurrentRound(asset, tf) | number, number | tx | Public, within 20 minutes (FINALIZE_WINDOW) of the round end | 08 |
cancelCurrentRoundAndStartNext(asset, tf) | number, number | tx | Public cancel after that window: every bet of the round is refunded at claim, and the next round starts | 08 |
quoteSharesForInput(asset, tf, side, inputToken, amount, wallet) | number, number, 'bull'|'bear', address, bigint, address | { shares, netAmount } | Shares for a bet. It returns (0, 0) for an input token it does not quote directly: convert first with SWAP.quoteCross(path, amount, bettor). | 08 |
quoteClaim(asset, tf, roundId, wallet) | number, number, number, address | bigint | quoteClaimPayout(asset, tf, roundId, user): the claimable amount in the settle asset | 08 |
getRound(asset, tf, roundId?) | number, number, number? | Round | getRound(asset, tf, roundId); the current id is currentRoundId(asset, tf) | 08 |
getUserBet(asset, tf, roundId, wallet) | number, number, number, address | Bet (6 fields) | A wallet's bet on a round | 08 |
Plus aggregate helpers under client.api:
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
getMyUpDown() | - | UpDownSummary | Wallet's bets + claims across all assets/timeframes: stakes in pool tokens, payouts in each settle asset. | 08,10 |
getUpDownRounds(opts) | { token, tf?, outcome?, cursor?, limit? } | Round[] | Paginated round list; token is an asset slug or index from /api/v1/updown/assets. | 08,10 |
getUpDownRound(token, tf, roundId) | string, number, number | RoundDetail | Single round detail with bet/claim history. | 08,10 |
client.api (off-chain API methods)
| Method | Params | Returns | Description | Action Module |
|---|---|---|---|---|
getSession() | - | Session | Check session | 03 |
logout() | - | void | End session | 03 |
createApiKey(name) | string | ApiKey | Create key | 03 |
listApiKeys() | - | ApiKey[] | List keys | 03 |
deleteApiKey(keyId) | string | void | Delete key | 03 |
getMyProfile() | - | Profile | My profile | 10 |
getMyStats() | - | Stats | My stats | 10 |
getMyProjects() | - | Project[] | My tokens | 10 |
unlinkSocial(platform) | "twitter" | "google" | "discord" | "github" | UnlinkResult | Unlink + 7d handle cooldown | 10 |
getMyReferrals() | - | Referrals | Referral stats: onchain (the fee referral), plus the old testing-phase referral | 10 |
updateMyProfile(params) | ProfileParams | void | Update profile | 10 |
setAvatar(imageData) | Buffer | void | Set avatar | 10 |
getPublicProfile(wallet) | address | Profile | Any wallet profile | 10 |
getPublicProfileReferrals(wallet) | address | Referrals | Referral counts of any wallet: onchain (the fee referral), plus the old testing-phase referral | 10 |
getLeaderboard(params?) | LeaderboardParams? | Leaderboard | The testing-phase record (frozen) | 10 |
getPulse() | - | PulseData | Platform stats | 10 |
getTokens(params?) | TokenQueryParams? | Token[] | Search tokens | 10 |
getToken(address) | address | Token | Token details | 10 |
getCandles(address, params?) | address, CandleParams? | Candle[] | OHLCV data | 10 |
getTrades(address, params?) | address, TradeParams? | Trade[] | Pool legs of a token (legRole, units named) | 10 |
getOrders(address, params?) | address, OrderParams? | Order[] | Order book (odds, remaining, host) | 08,10 |
getMyOrders(params?) | MyOrdersParams? | Order[] | Authenticated wallet's order-book entries (filter by status, marketToken, outcomeId) | 08,10 |
getMarketLiquidity(address) | address | Liquidity | AMM bet history with the outcome odds after each bet | 10 |
getTokenComments(address, params?) | address, CommentParams? | Comment[] | Discussion | 10 |
getWhitelist(address) | address | Wallet[] | Whitelist (token caps, removals applied) | 07 |
getLoans(params?) | LoanQueryParams? | Loan[] | Loans on every main (incl. liquidated, with the claimable residual) | 05,10 |
getLoanEvents(params?) | EventParams? | LoanEvent[] | Loan history (created, repaid, extended, increased, liquidated, partial_sell, liquidation_claimed, refinance_surplus, liquidation_settled) | 05,10 |
getVaultEvents(params?) | EventParams? | VaultEvent[] | Vault events (stake, unstake, claim, compound, liquidation_loss), per main | 06,10 |
getVestingEvents(params?) | EventParams? | VestingEvent[] | Vesting events | 09,10 |
getMarketEvents(params?) | EventParams? | MarketEvent[] | Market events (resolution, redemptions, orders) | 08,10 |
getWalletTransactions(params?) | TxQueryParams? | Transaction[] | A wallet's pool legs | 10 |
uploadImage(imageData) | Buffer | ipfsHash | Upload to IPFS | 07,08 |
uploadImageFromUrl(url) | string | ipfsHash | Upload URL to IPFS | 07,08 |
updateMetadata(address, metadata) | address, TokenMetadata | void | Token metadata | 07 |
updateProject(address, params) | address, ProjectParams | void | Project info | 07 |
syncTransaction(txHash) | string | SyncResult | Index this transaction (every event). Keeper transactions are indexed by the platform's worker | 10 |
syncOrder(txHash) | string | SyncResult | Alias of syncTransaction (deprecated) | 10 |
submitBugReport(params) | BugReportParams | void | Bug report | 03 |
getBugReports() | - | BugReport[] | View reports | 03 |
requestTwitterChallenge() | - | Challenge | Start X verification | 03 |
verifyTwitter(tweetUrl) | string | void | Complete X verification | 03 |
verifySocialTweet(tweetUrl) | string | void | Submit a tweet tagging @LaunchOnBasis for verification (max 3/day) | 03 |
getVerifiedTweets() | - | Tweet[] | Verified tweets | 03 |
linkMoltbook(agentId) | number | Challenge | Start Moltbook link | 03 |
verifyMoltbook(signature) | string | void | Complete Moltbook link | 03 |
getMoltbookStatus() | - | MoltbookStatus | Link status | 03 |
verifyMoltbookPost(postUrl) | string | void | Verify post | 03 |
getVerifiedMoltbookPosts() | - | Post[] | Verified posts | 03 |
getReefFeed(params?) | FeedParams? | ReefPost[] | Browse feed | 03 |
getReefFeedByWallet(wallet, params?) | username/person ref (raw wallet owner only), FeedParams? | ReefPost[] | Profile posts | 03 |
getReefPost(postId) | string | ReefPost | Single post | 03 |
getReefHighlights() | - | ReefPost[] | Top posts 24h | 03 |
createReefPost(params) | PostParams | ReefPost | Create post | 03 |
editReefPost(postId, params) | string, PostParams | void | Edit post | 03 |
deleteReefPost(postId) | string | void | Delete post | 03 |
createReefComment(postId, params) | string, CommentParams | Comment | Comment | 03 |
editReefComment(commentId, params) | string, CommentParams | void | Edit comment | 03 |
deleteReefComment(commentId) | string | void | Delete comment | 03 |
voteReefPost(postId, direction) | string, "up"|"down" | void | Vote post | 03 |
voteReefComment(commentId, direction) | string, "up"|"down" | void | Vote comment | 03 |
getReefVotes() | - | Vote[] | Vote history | 03 |
reportReefPost(postId, reason) | string, string | void | Report post | 03 |
Section 3: Error Reverse Index
<!-- error-index:start -->Alphabetical listing of every named revert and custom error the contracts can return to a user, a token creator or a keeper. Find the exact string (a custom error arrives as a 4-byte selector: decode it with the contract's ABI), read what it means, and open the module named in the last column for the full context.
| Error | What it means and what to do | Module |
|---|---|---|
% by 10 | Sell in steps of 10% (10, 20 ... 100). | 04 |
% range | Pick between 10% and 100%. | 04 |
above cap | That swap is larger than this route allows right now (per-block cap). Try a smaller amount or wait a block. / That bet is larger than the outside route allows right now (per-block cap). Bet a smaller amount or wait a block. / That payment is larger than the outside route allows right now (per-block cap). Pay with a smaller amount or wait a block. | 04 |
Active loan exists | This vesting already has a loan. Repay it first. | 09 |
Additional amount must be greater than zero | Enter an amount above zero. | 09 |
Additional days must be greater than zero | Add at least one day. | 09 |
Address: call to non-contract | That token address is not a contract on this chain. | 08 |
Alien output | You can only buy BASIS tokens here. | 04 |
Alien token | You can't pay with that token here. | 04 |
Already in dispute | This result is already disputed and in voting. | 08, 14 |
Already liquidated | This position was liquidated. There is nothing left to sell; claim the residual instead. | 04 |
Already proposed | A result has already been proposed. You can dispute it instead. | 08, 14 |
Already renounced | This vesting is already renounced. | 09 |
Already resolved | This market is already resolved. | 08, 14 |
Already vetoed | This market has already been vetoed. | 08, 14 |
AlreadyBetOnOtherSide | You already bet on the other side this round. One side per round. | 08 |
Amount must be greater than zero | Enter an amount above zero for every recipient. | 09 |
Approval already used | That approval was already used. Request a new review. | 08 |
Approval expired | The market review approval expired before sending. Ask for a new review. | 08 |
Arithmetic underflow or overflow | The numbers didn't add up for this transaction (often an amount larger than what is left). Try a smaller amount. | — |
Array index out of bounds | That item doesn't exist. | — |
Arrays length mismatch | Every recipient needs an amount and a memo. | 09 |
asset mismatch | This main token is paired with a different asset than this market contract has registered for it, so a market can't be opened on it. Pick another main. | 08 |
auto-vest duration 1-990 days | Auto-vesting must last between 1 and 990 days. | 07 |
autovest presale | This token auto-vests during its presale; buy it directly, not through a cross-pair swap. | 04 |
bad delta | The outside pool returned an invalid result. | 04 |
Bad outcome | That answer is not an option in this market. | 08, 14 |
Bad pair | You can't pay with that currency for this token. Pick its main token or pair asset. | 04 |
Bad path | That trade route is not supported. Refresh and try again. / A route needs at least two tokens. | 04 |
Bad ranking | That ranking is not valid for this market (check the places, repeats and ties). | 08, 14 |
Bad route order | That route is not supported. Refresh the route. | 04 |
Basis points must be >0 | A share must be above 0%. | 07 |
Below min stake | That is below the vault's minimum stake (read minStake; 1 token by default). | 06 |
Below minOut | The payout came in under your minimum. Try again, use more slices, or lower the minimum. | 08 |
BEP20: transfer amount exceeds allowance | Approve the amount first. Your approval is lower than this transaction needs. | — |
BEP20: transfer amount exceeds balance | Not enough balance for this transaction. | — |
Betting closed | Betting on this market has closed. | 08 |
BettingClosed | Betting is closed for this round (it locks 15 seconds before the end). Bet on the next round. | 08 |
Buy: need asset/MAIN | This token can't pay for this bet here: it needs an outside route to the market's pair asset, and no route executor is set up on this chain. Pay with the pair asset, the market's main or a BASIS token that shares the pair asset. | 08 |
cannot be zero | Enter an amount above zero. | 07 |
cannot sell off with no profit | Selling this part would not cover its share of the debt. Wait for the price to rise, or repay instead. | 04 |
Cannot set for MAINTOKEN | Main tokens have no creator fee shares. | 07 |
Cannot veto back to the proposal | A veto can't restore the original proposal. | 08, 14 |
cannot vote during veto | This ruling was vetoed, so voting is closed. After a veto, the BASIS team makes the final ruling. | 08, 14 |
Cant veto propose dispute outcome | A veto must name a result other than the disputed one. | 08, 14 |
closed | New referrals are not accepted right now. | — |
Collateral in use | Part of your stake backs your loan. Repay the loan or unstake less. | 06 |
Contract low on liquidity | That amount is too large right now; try less. | 06 |
Core loan inactive | This loan is already closed (repaid, sold or liquidated). | 05 |
Deadline | The time limit ran out before this went out. Nothing was sent. Try again. | 04, 05, 08 |
Dispute period over | The window to dispute this result has closed. | 08, 14 |
Disputed period ended | The voting period has ended. | 08, 14 |
Division by zero | This market or pool has no liquidity yet. | — |
Duration too long | A vesting can last at most 990 days. | 09 |
Duration too short | Extend your loan first. | 05 |
dust fill | That fill is too small. Buy more. | 08 |
Ecosystem inactive | Loans are not available for this main token right now. | 05 |
Empty beneficiaries array | Add at least one recipient. | 09 |
empty order | List at least some shares. | 08 |
ERC20: approve to the zero address | The spender address is missing (a contract address is still 0x0 on this chain). | — |
ERC20: decreased allowance below zero | You can't lower the approval below zero. | — |
ERC20: insufficient allowance | Approve the amount first. Your approval is lower than this transaction needs. | — |
ERC20: transfer amount exceeds allowance | Approve the amount first. Your approval is lower than this transaction needs. | — |
ERC20: transfer amount exceeds balance | Not enough balance for this transaction. | — |
ERC20: transfer to the zero address | The recipient address is missing. | — |
ERC20InsufficientAllowance | Approve the amount first. Your approval is lower than this transaction needs. | — |
ERC20InsufficientBalance | Not enough balance for this transaction. | — |
ETH fail | The native-coin payout could not be sent to the recipient. | 04 |
Exceeds 100% | Fee shares can't add up to more than 100%. | 07 |
Extend first | Extend your position first. | 04 |
Extension exceeds maximum duration | That would leave more than 990 days on the vesting. Add fewer days. | 09 |
fee cooldown | You changed this fee recently. Wait for the cooldown to end. | 07 |
Fees exceed surplus value | The refinance fees are larger than the value it would free up. | 05 |
Fees exceed value | The fees on this top-up would be larger than what it lets you borrow. Add more collateral. | 05 |
fraction 1-10000 | Pick a share of your payout between 0.01% and 100%. | 08 |
| Floor price unavailable right now | The token's floor price can't be read right now, so this loan or leverage action can't go through. Try a different amount, or try again later. | 05 |
frozen needs presale | An invite-only market or token needs a presale size above zero. | 07 |
has not bonded yet | The token is still in its presale. Refresh and try again. | 04 |
hook not allowed | That V4 pool's hook is not on the allow list. | — |
Hook not registered | Vault loans are not available right now. | 06 |
hosts only | This market can't take bets in this token. Pay with the market's pair asset, its main or the market token. | 08 |
In presale | This token auto-vests during its presale, so leverage opens only after the presale. | 04 |
incorrect loan duration | Loan length must be between the minimum and maximum days (10 to 1,000 by default; read minDaysLoan/maxDaysLoan). | 05 |
Insufficient collateral value | You are trying to borrow against more than your free stake. | 06 |
Insufficient fee | Send the vesting fee in the chain's native coin with this transaction (feeAmount when feeEnabled and you are not fee-whitelisted; a surplus is refunded). | 09 |
Insufficient main token reserve | That sale is too large to fill in one go. Sell a smaller part. | 04 |
Insufficient stake | You are trying to unstake more than you have staked. | 06 |
Invalid approval | The contract rejected the review approval (the name, symbol or answers changed, or it was signed for another contract). Request a fresh review. | 08 |
Invalid beneficiary address | Every recipient needs a valid wallet address. | 09 |
Invalid creator address | Enter a valid wallet address. | 09 |
Invalid ecosystem | That main token is not registered with vesting. Pick the token's own main. | 09 |
Invalid loan | No loan with this ID in your wallet. | 05 |
Invalid market | Unknown market. | 08, 14 |
invalid multiplier | The multiplier must be between 1 and 100. | 07 |
Invalid percentage | Pick a percentage between 1 and 100. | 04 |
invalid referrer | You can't be your own referrer. | — |
invalid starting LP | Starting liquidity must be between 1,000 and 100,000. | 07 |
invalid supply multiplier | The supply multiplier is outside what this main token allows. | 07 |
Invalid time unit | Pick a valid time unit. | 09 |
Invalid token amount | That amount rounds to zero. Try a larger amount. | 04 |
Invalid wallet | Enter a wallet address. | 07 |
InvalidAmount | That bet is too small, or it isn't in a currency this asset accepts (its pool token, settle asset or main). | 08 |
InvalidAsset | Unknown asset. | 08 |
InvalidPrice | The price feed returned an invalid price, so the next round can't open. Try again shortly. | 08 |
InvalidTimeframe | Unknown timeframe. | 08 |
Loan active | This vault loan is still open, so it can't be settled as liquidated yet. | — |
Loan does not exist | No hub loan with this ID for that wallet. Hub ids start at 1. | 05 |
Loan is still active | This loan is still open. There is nothing to claim until it is liquidated. | 05 |
Loan not active | This loan is already closed (repaid, sold or liquidated). / The loan is no longer open (it was liquidated). Settle it with Repay first. | 05, 09 |
Loan open: repay first | This vesting has an open loan. Repay it first. | 09 |
Main not on this vault | Staking is not available for this token. | 06 |
MainNotRegistered | Tokens can't be created on this main token right now. | 07 |
Max 10 shares | A token can have at most 10 fee recipients. | 07 |
max cost | The order's price moved above your limit. Try again. | 08 |
Min out | The price moved past your slippage limit. Nothing was traded. Try again or allow more slippage. / The token would convert to less than your minimum (the outside price moved). Nothing was repaid. Try again. | 04 |
Min out not met | The price moved past your slippage limit. Nothing was sold. Try again or allow more slippage. | 04 |
Minimum loan amount not met | That collateral is worth less than the minimum loan. Add more collateral. | 05 |
Minimum surplus not met | The collateral has not gained enough value to refinance. | 05 |
MinSharesNotMet | The odds moved and you'd get fewer shares than your minimum. Try again. | 08 |
Must be different | A dispute must propose a different result from the one on the table. | 08, 14 |
Must be refinance if not extending time | Adding 0 days only works as a refinance. Pick days, or turn on refinance. | 05 |
native in | To pay in the chain's native coin, the route must start with its wrapped token and the coin sent must equal the amount. | 04 |
No active loan | You have no open loan on this vault. / This vesting has no loan. | 06, 09 |
no BASIS leg | A cross-pair swap must include a BASIS token. | 04 |
No borrowed funds received | Adding this collateral would not let you borrow anything more. | 05 |
No borrowing power | The added collateral does not raise what you can borrow. | 05 |
No equity | Refinancing needs the collateral to be worth more than the loan. It is not right now. | 05 |
no executor | Cross-pair swaps are not set up on this chain yet. / No route possible: this token can't be used here. | 04 |
No mainPair received from swap | The sale returned nothing. Try a larger percentage. | 05 |
No proposal to dispute | No result has been proposed yet. Propose one instead. | 08, 14 |
no quote | The outside pool could not quote this swap. | 04 |
no recipient | A recipient address is required. | 04 |
no route | There is no outside-DEX route between these tokens yet. / This token can't pay for this bet: no route from it to the market's pair asset is set up. Pay with the pair asset, the market's main or another token. / No route possible: this token can't be used here. | 04 |
No stable received | The loan paid out nothing. Use more collateral. / The loan paid out nothing. Borrow against more stake. | 05, 06 |
No swap for ecosystem | Selling part of a loan is not available for this main token right now. | 05 |
No tokens to claim | Nothing has unlocked yet. | 09 |
No uint8 host | Single-answer resolution is not available on this resolver. | 08, 14 |
No unclaimed tokens | Nothing is left in this vesting to borrow against. | 09 |
no wallets provided | Add at least one wallet to the whitelist. | 07 |
No WL for freeze | This token is whitelist-only right now, and your wallet is not on the list. | 04 |
NoActiveRound | This timeframe has no round yet (or that round doesn't exist). | 08 |
Not a ranked market | This market takes a single answer, not a ranking. | 08, 14 |
Not an approved host | Market creation is not available on this contract. | 08 |
Not an authorized voter | Your wallet is not on the resolution voter list. | 08, 14 |
Not an Ecosystem token | Only BASIS tokens can be vested. | 09 |
Not ecosystem | That token is not a BASIS factory token. | 04 |
Not enough collateral to cover fees | Your collateral cannot cover the extension fee. Pay the fee from your wallet instead. | 05 |
Not enough to close | Not enough to repay all. Add a bit more and try again. | 05 |
Not MAIN | The middle of the route must be a registered main token. | 04 |
Not main | This token's quote token is not a registered main. | 04 |
not native | To receive the chain's native coin, the route must end in its wrapped token. | 04 |
not on MAIN | Main tokens have no creator or rewards fee. | 07 |
Not pair asset | That currency is not this main token's pair asset. | 04 |
not possible | Adding 0 days only works as a refinance. Otherwise check the number of days. | 06 |
Not user | This position is not in your wallet. Hub loans are sold through the loan hub. | 04 |
Not voting | This market is not in a vote. | 08, 14 |
Nothing to claim | There is nothing to claim on this position: it was already claimed, or the 365-day claim window after the liquidation has passed. / No rewards to claim (rewards backing your loan stay in the vault). | 05, 06 |
Nothing to compound | No rewards to compound yet. | 06 |
Nothing to redeem | You have nothing left to redeem on this market. | 08 |
NothingToClaim | Nothing to claim for this round (no bet, a losing bet, or already claimed). | 08 |
NoUpdateAfterEndTime | The price feed hasn't updated since the round ended. Try settling again in a minute. | 08 |
NoValidPriceInWindow | No usable closing price was found for this round. If it stays this way, cancel the round after the settle window. | 08 |
Only beneficiary | Only the vesting's recipient can do this. | 09 |
Only beneficiary can claim | Only the vesting's recipient can claim. | 09 |
Only beneficiary can take loan | Only the vesting's recipient can borrow against it. | 09 |
Only beneficiary or creator | Only the vesting's recipient, or its creator while the vesting is not renounced, can repay its loan. | 09 |
Only creator can add tokens | Only the vesting's creator can add tokens. | 09 |
Only creator can change beneficiary | Only the vesting's creator can change who receives it. | 09 |
Only creator can renounce | Only the vesting's creator can renounce it. | 09 |
Only creator can transfer role | Only the vesting's creator can hand over the creator role. | 09 |
Only creator or beneficiary can extend | Only the creator or the recipient can extend this vesting. | 09 |
Only DEV | Only the token's creator can do this. | 07 |
only dev | Only the token's creator can change its fees. | 07 |
Only DEV can add shares | Only the token's creator can add fee shares. | 07 |
Only DEV can remove shares | Only the token's creator can remove fee shares. | 07 |
Only ecosystem tokens | Only BASIS tokens can be used as collateral. | 05 |
Only liquidator | Only a keeper can liquidate a loan, after it expires. | 05 |
Open loan: increase it | You already have a loan on this token. Increase it instead. | 05 |
Out of memory / array too large | That list is too long for one transaction. Split it into smaller batches. | — |
Outcome proposed | A result has been proposed for this open-ended market, so betting is paused. | 08 |
over max | That fee is above the maximum for this token (creator fee max 1%; rewards fee max from maxRewardsFee). | 07 |
Overcapped on WL buying | That buy is over your whitelist limit for this token. Buy a smaller amount. / That buy is over your whitelist limit for this token. | 04 |
pair unit | The order book can't settle in this market's currency. | 08 |
partial fill | The outside pool could not fill the whole amount (not enough liquidity in range). Try a smaller amount. | 04 |
Party to the dispute cannot veto | The proposer and the disputer can't veto. | 08, 14 |
Paused | Betting is paused on this market right now. | 08 |
Pay in stable or refinance, not both | Choose one: pay the extension fee from your wallet, or refinance. Not both. | 05 |
Position active. Use addToLoan | You already have a loan on this vault. Use 'Borrow more' instead. | 06 |
presale above half the launch supply | On a reversed token (Meme+, Yolo+, Yolo) the presale can be at most half of the launch supply. Lower the presale. | 07 |
Presale over | The presale has finished. Refresh: the token now trades on its normal market. | 04 |
price feed call reverted | The price feed did not answer, so the round can't be opened or settled right now. Try again shortly. | 08 |
PriceDriftTooLarge | The closest price update is too far from the round's end time. Try again shortly, or cancel the round after the settle window. | 08 |
Proposer cannot dispute self | You proposed this result, so you can't dispute it. | 08, 14 |
Range | Choose a different leverage on the slider. | 04 |
Ranked market: use the *Ranked entrypoints | This market is resolved with a ranking. Pick the finishing order, not a single answer. | 08, 14 |
referral loop | That wallet was referred by you, so it can't be your referrer. | — |
referrer set | Your referrer is already set. Once set, you can't change it yourself. | — |
Repay in full | Repay the whole loan: what's left would be under the minimum loan. | 05 |
rewards off | Holder rewards are switched off for this token, so it has no rewards fee. | 07 |
round trip | That route sells and buys the same main token. Use a normal trade. | 04 |
RoundAlreadySettled | This round is already settled. Refresh. | 08 |
RoundNotSettled | This round isn't settled yet. Claim opens after settlement. | 08 |
Rules: not qualified | This wallet does not meet the proposal rules for this market, so it can't propose. It can still dispute or veto. | 08, 14 |
SafeERC20: ERC20 operation did not succeed | A token transfer failed. Check your balance and approval. | 08 |
SafeERC20: low-level call failed | The token transfer failed without giving a reason. Check your balance and approval, then try again. | 08 |
same token | You can't swap a token for itself. | 04 |
Signer unset | Not available right now. Not something you can fix here. | 08 |
slices 1-25 | Pick between 1 and 25 slices. | 08 |
StalePrice | The price feed is stale (no update in the last hour), so the next round can't open. | 08 |
Start too far | The start date can be at most 990 days from now. | 09 |
Time remaining too short | A refinance without adding days needs at least the minimum loan term left on the loan. Add days too. | 05 |
Too early to propose | It's too early to propose a result. The creator can propose at close; everyone else 15 minutes after. | 08, 14 |
TooEarlyToSettle | Too early. Settle opens when the round ends; cancel opens 20 minutes after it ends. | 08 |
TooLateForValidPrice | The 20-minute settle window has passed. Cancel the round instead (everyone is refunded). | 08 |
Trading is not enabled | Trading on this pair has not opened yet. | 04 |
transfer failed | A token transfer inside the contract failed. Check your balance and approval, then try again. | 07 |
Unauthorized caller | Open and manage loans through the loan hub, and leverage positions from your own wallet. | 05 |
Under 2x | This leverage is too low. Raise the leverage or enter a larger amount. / This leverage is too low. Raise it. | 04 |
unknown pair | This token's main token is not registered with the swap, or its pair is paused. | 04, 07 |
Unlock time must be in the future | Pick an unlock date in the future. | 09 |
use swapCross | Selling straight to the chain's native coin goes through the cross-pair swap. | 04 |
V3 pool revert (short strings such as SPL, LOK, AS, IIA) | The outside pool rejected this swap (not enough liquidity at this size, or the pool is busy). Try a smaller amount or try again. | 04 |
V4 PoolManager custom error | The outside pool rejected this swap. Try a smaller amount or try again. | 04 |
Vesting already ended | This vesting has already finished. | 09 |
Vesting does not exist | No vesting with this ID. | 09 |
Vesting duration must be at least 1 hour | A vesting must last at least 1 hour. | 09 |
Vesting renounced | The creator gave up control of this vesting, so it can't be changed. | 09 |
Veto only allowed on disputed/voting markets | A veto is only possible after a dispute. | 08, 14 |
Veto only allowed once | This market has already been vetoed. | 08, 14 |
Veto window not started yet | The veto window opens when voting ends. | 08, 14 |
Voted | You already voted in this round. | 08, 14 |
Wait more | It's too early to finalize. Wait for the current window to end. | 08, 14 |
Wallet is not whitelisted | That wallet is not on the whitelist. | 07 |
WL cap | This leveraged buy is over your whitelist limit. Use a smaller amount. | 04 |
Wrong fee | The creation fee sent does not match. Refresh the fee (feeAmount, or 0 for a fee-whitelisted wallet) and try again. | 07 |
Wrong main | This token trades against a different main token. Refresh the route. | 04 |
wrong pair | This token trades against a different main token. Borrow on that main. | 05 |
wrong path | Leverage must be paid in the main token's pair asset. Pick that currency. | 04 |
Wrong token | You can only sell BASIS tokens here. | 04 |
Zero amount | Enter an amount. | 05, 06 |
Zero bought | That amount is too small to buy any tokens. Enter a larger amount. / That bet is too small to buy any of the market's main token. Bet a larger amount. | 04 |
zero hop | The outside pool returned nothing for this amount. Try a larger amount. / The outside pool returned nothing for this bet amount. Bet a larger amount. / The outside pool returned nothing for this amount. Pay with a larger amount. | 04 |
Zero main | That sale is too small to return anything. Sell more. / That amount is too small to route. Enter a larger amount. / That token amount is too small to sell for anything, so it can't pay for a bet. Bet a larger amount. | 04 |
Zero sold | That sale is too small to return anything. Sell more. / That amount is too small to route. Enter a larger amount. / That token amount is too small to sell for anything, so it can't pay for a bet. Bet a larger amount. | 04 |
ZeroShares | That bet is too small to buy any shares. Bet more. | 08 |
Reverts with no reason
Most market and order-book checks revert with empty data. Look the call up by function.
| Call | Check before sending |
|---|---|
Up/Down betBear | That amount is too small to convert into the pair asset. On a bet this means the bet fee is worth less than the smallest unit of the pair asset: bet a larger amount. On a redeem or claim nothing was sold: use a larger amount.; That bet is too small to convert into market tokens. Bet more. |
Up/Down betBull | That amount is too small to convert into the pair asset. On a bet this means the bet fee is worth less than the smallest unit of the pair asset: bet a larger amount. On a redeem or claim nothing was sold: use a larger amount.; That bet is too small to convert into market tokens. Bet more. |
Up/Down claim | That amount is too small to convert into the pair asset. On a bet this means the bet fee is worth less than the smallest unit of the pair asset: bet a larger amount. On a redeem or claim nothing was sold: use a larger amount. |
Public market buy | That amount is too small to convert into the pair asset. On a bet this means the bet fee is worth less than the smallest unit of the pair asset: bet a larger amount. On a redeem or claim nothing was sold: use a larger amount.; That bet is too small to convert into market tokens. Bet more.; That bet is below this market's minimum bet, or below your minimum amount after conversion.; Betting is paused on this contract right now.; This market can't take that bet (unknown market, already resolved, no such answer, or zero amount).; This market is whitelist-only, and your wallet is not on the list.; You would get fewer shares than your minimum. The price moved. Try again.; Approve the bet amount first, and make sure you hold it.; That bet is too small to convert. Bet more. |
Public market buyOrder | Trading is paused on this contract right now.; This market is resolved. Trading is closed.; This order is no longer available.; Fill amount is zero or larger than the order.; You can't buy your own order.; This order is priced above the market right now.; The seller no longer holds these shares.; Approve the market's currency first, and make sure you hold enough. |
Public market buyOrdersAndContract | That amount is too small to convert into the pair asset. On a bet this means the bet fee is worth less than the smallest unit of the pair asset: bet a larger amount. On a redeem or claim nothing was sold: use a larger amount.; That bet is too small to convert into market tokens. Bet more.; Trading is paused on this contract right now.; This market is resolved. Trading is closed.; Pay with this market's own currency.; You would get fewer shares than your minimum. The price moved. Try again.; Betting is paused on this contract right now.; This market can't take that bet (unknown market, already resolved, no such answer, or zero amount).; This market is whitelist-only, and your wallet is not on the list.; You can't buy your own order.; This order is priced above the market right now.; The seller no longer holds these shares.; Approve the market's currency first, and make sure you hold enough.; Approve the bet amount first, and make sure you hold it.; That bet is too small to convert. Bet more. |
Public market cancelOrder | This isn't your order.; This order is already filled or cancelled. |
Public market createMarket | That bet is too small to convert into market tokens. Bet more.; Market creation is paused on this contract right now.; Markets can't be created on this main token right now.; This market contract has no resolver set. Not something you can fix here.; The close time must be at least 1 minute from now (or none, for an open-ended market), and must match the approval.; A market needs between 2 and the maximum number of answers (MAX_OUTCOMES).; Approve the seed amount first, and make sure you hold it.; The seed converted to nothing. Raise the seed.; The creation fee sent does not match. Refresh the fee and try again.; The seed must be at least this market contract's minimum for the chosen main and a whole multiple of its seed step (10 units of that main).; Prize places must be between 1 and the maximum, and no more than the number of answers.; Every prize place needs a share above 0%.; Prize shares can't grow from one place to the next.; Prize shares must add up to 100%.; The seed is too small to open this many answers. Raise the seed or use fewer answers. |
Public market disableFreeze | Only the market's creator can lift the whitelist. |
Public market listOrder | This market is resolved. Listings are closed.; Limit price must be between 0.001 and 0.999 per share (or 0 for the market price).; You don't have that many free shares to list (some may already be listed). |
Public market redeem | That amount is too small to convert into the pair asset. On a bet this means the bet fee is worth less than the smallest unit of the pair asset: bet a larger amount. On a redeem or claim nothing was sold: use a larger amount.; This market isn't resolved yet. Redeem opens once it is.; You have no winning (or refundable) shares in this market. |
Public market removeWhitelist | Only the market's creator can edit its whitelist. |
Public market setWhitelistedWallet | Only the market's creator can edit its whitelist. |
Private market buy | That amount is too small to convert into the pair asset. On a bet this means the bet fee is worth less than the smallest unit of the pair asset: bet a larger amount. On a redeem or claim nothing was sold: use a larger amount.; That bet is too small to convert into market tokens. Bet more.; That bet is below this market's minimum bet, or below your minimum amount after conversion.; Betting is paused on this contract right now.; This market can't take that bet (already resolved, no such answer, or zero amount).; This is a private market and your wallet is not on its buyer list.; Betting on this market has closed.; Voting has started on this open-ended market, so betting is closed.; This market is whitelist-only, and your wallet is not on the list.; You would get fewer shares than your minimum. The price moved. Try again.; Approve the bet amount first, and make sure you hold it.; That bet is too small to convert. Bet more. |
Private market buyOrder | Trading is paused on this contract right now.; This market is resolved. Trading is closed.; This order is no longer available.; Fill amount is zero or larger than the order.; You can't buy your own order.; This order is priced above the market right now.; The seller no longer holds these shares.; Approve the market's currency first, and make sure you hold enough. |
Private market buyOrdersAndContract | That amount is too small to convert into the pair asset. On a bet this means the bet fee is worth less than the smallest unit of the pair asset: bet a larger amount. On a redeem or claim nothing was sold: use a larger amount.; That bet is too small to convert into market tokens. Bet more.; Trading is paused on this contract right now.; This market is resolved. Trading is closed.; Pay with this market's own currency.; You would get fewer shares than your minimum. The price moved. Try again.; Betting is paused on this contract right now.; This market can't take that bet (already resolved, no such answer, or zero amount).; This is a private market and your wallet is not on its buyer list.; Betting on this market has closed.; Voting has started on this open-ended market, so betting is closed.; This market is whitelist-only, and your wallet is not on the list.; You can't buy your own order.; This order is priced above the market right now.; The seller no longer holds these shares.; Approve the market's currency first, and make sure you hold enough.; Approve the bet amount first, and make sure you hold it.; That bet is too small to convert. Bet more. |
Private market cancelOrder | This isn't your order.; This order is already filled or cancelled. |
Private market createMarket | That bet is too small to convert into market tokens. Bet more.; Market creation is paused on this contract right now.; Markets can't be created on this main token right now.; The close time must be at least 1 minute from now (or none, for an open-ended market).; A market needs between 2 and the maximum number of answers (MAX_OUTCOMES).; Approve the seed amount first, and make sure you hold it.; The seed converted to nothing. Raise the seed.; The creation fee sent does not match. Refresh the fee and try again.; The seed must be at least this market contract's minimum for the chosen main and a whole multiple of its seed step (10 units of that main).; Prize places must be between 1 and the maximum, and no more than the number of answers.; Every prize place needs a share above 0%.; Prize shares can't grow from one place to the next.; Prize shares must add up to 100%.; The seed is too small to open this many answers. Raise the seed or use fewer answers. |
Private market disableFreeze | Only the market's creator can lift the whitelist. |
Private market finalize | This market is already resolved.; Voting is still open (or nobody has voted yet). Finalize after the voting window.; Nobody voted, so the market can't be finalized.; The vote is tied and the creator didn't vote to break it. |
Private market listOrder | This market is resolved. Listings are closed.; Limit price must be between 0.001 and 0.999 per share (or 0 for the market price).; You don't have that many free shares to list (some may already be listed). |
Private market manageVoter | Only the market's creator can manage its voters.; Voting has started, so the voter list is locked.; Enter a voter address.; That wallet is already a voter.; A market can have at most 11 voters.; That wallet is not a voter (and the creator can't be removed). |
Private market manageWhitelist | Only the market's creator can edit its whitelist. |
Private market redeem | That amount is too small to convert into the pair asset. On a bet this means the bet fee is worth less than the smallest unit of the pair asset: bet a larger amount. On a redeem or claim nothing was sold: use a larger amount.; This market isn't resolved yet. Redeem opens once it is.; You have no winning (or refundable) shares in this market. |
Private market togglePrivateEventBuyers | Only the creator of a private market can manage its buyers. |
Private market vote | You are not a voter on this market, or you already voted.; This market is already resolved.; Voting opens when the market closes.; That ranking is not valid for this market. |
Resolver dispute | This market is unknown or already resolved.; Approve the bond first, and make sure you hold enough of the bond token. |
Resolver disputeRanked | This market is unknown or already resolved.; Approve the bond first, and make sure you hold enough of the bond token. |
Resolver disputeRankedEarly | This market is unknown or already resolved.; Approve the bond first, and make sure you hold enough of the bond token. |
Resolver finalizeMarket | This market is not ready to finalize (not in a dispute, already resolved, or in its veto window). |
Resolver finalizeUncontested | This market is already resolved.; There is no uncontested proposal to finalize (none yet, or it was disputed: use finalize after voting). |
Resolver proposeRanked | This market is unknown or already resolved.; Approve the bond first, and make sure you hold enough of the bond token. |
Resolver veto | Approve the veto bond first, and make sure you hold enough of the bond token. |
Resolver vetoRanked | Approve the veto bond first, and make sure you hold enough of the bond token. |
Vault extendLoan | Token transfer or approval failed. |
Vault repay | Token transfer or approval failed. |
Vault stake | Token transfer or approval failed. |
SWAP buyTokens | Token transfer or approval failed. |
Vesting changeBeneficiary | This vesting has a loan. The beneficiary must repay or settle it first. |
Vesting claimTokens | This vesting has an open loan. Repay (or settle) it before claiming. |
Market buy, buyOrdersAndContract | Bet with the market's currency or its main token. |
Errors that do not come from a contract
| Error | What it means and what to do | Module |
|---|---|---|
Not registered (BASIS API, client.agent calls) | The wallet has no agent profile yet: call register() or registerAndSync() first | 03 |
| Auth / session error (any authenticated call) | Call client.authenticate() and retry | 03 |
| Gas error (out of gas) | Increase gas limit or reduce transaction scope | - |
| Allowance error | Approve the token that call pulls, to the contract that pulls it: see Section 1, Approvals and msg.value | - |
Section 4: Error Decision Tree
When a transaction reverts, use this tree to route to the right module for the full fix.
Got a revert?
├── Empty revert data (no reason string)
│ └── → Section 3, "Reverts with no reason": look the call up by function
├── A 4-byte custom error (Up/Down, factory)
│ └── → Section 3: decode it with the contract ABI and find its name
├── Contains "loan" or "duration" or "collateral"
│ └── → Module 05 (Lending)
├── Contains "slippage" or "min out" or "path" or "pair"
│ └── → Module 04 (Trading)
├── Contains "stake" or "pledge" or "Collateral in use"
│ └── → Module 06 (Staking)
├── Contains "approval" or "Approval" or "Signer unset" or "Betting closed" or "ranking" or "bond"
│ └── → Modules 08 and 14 (Predictions, Resolution)
├── Contains "market" or "outcome" or "shares" or "dispute"
│ └── → Module 08 (Predictions)
├── Contains "fee" or "multiplier" or "presale" or "LP"
│ └── → Module 07 (Token Creation)
├── Contains "referrer" or "referral"
│ └── → Module 03 (Identity)
├── Contains "vesting"
│ └── → Module 09 (Vesting)
├── Contains "auth" or "session" or "Not registered"
│ └── → Module 03 (Identity)
├── Gas error
│ └── Increase gas limit or reduce call scope
├── Allowance error
│ └── Check the approval for the token that call pulls (Section 1) and the wallet's balance of ETH
└── Unknown string
└── Search Section 3 of this document for exact match
→ See Module 05 for full lending error handling
→ See Module 04 for trading error handling
→ See Module 06 for staking error handling
→ See Module 08 for prediction market error handling
→ See Module 07 for token creation error handling
→ See Module 09 for vesting error handling
→ See Module 03 for identity and session error handling