Ooga Booga
  • AGGREGATOR
    • How Does It Work?
    • Liquidity Sources
    • Fee Model
  • DEVELOPERS
    • Swap API
      • Guide
      • Reference
      • Troubleshooting
    • Price API
      • Guide (WIP)
      • Reference
    • Endpoints
  • Resources
    • Audit
    • Media
    • Community Made Resources
  • DEPLOYMENTS
    • Aggregator
      • OBRouter Reference
    • Token
    • Ooga Bucks
  • TWAP
    • Benefits
    • Architecture
    • Miscellaneous
    • Trade Execution Logic and Retry Behavior
    • Frontrunning Considerations and Parameter Confidentiality
Powered by GitBook
On this page
  1. DEVELOPERS
  2. Swap API

Reference

PreviousGuideNextTroubleshooting

Last updated 3 months ago

Swap tokens

get

Gets a quote for a swap between two tokens given an amount. If a to address is provided, the swap execution data will be included in the response to be used to build the calldata to be executed on-chain. Make sure to not tamper with the arguments provided in the response as it can lead to loss of funds. Only possible to trade whitelisted tokens specified on the /tokens endpoint. Permissionless trading is coming soon. Native token (BERA) is specified as zero address (0x0000000000000000000000000000000000000000)

Authorizations
Query parameters
tokenInstringRequired

Input token address

Default: 0x0000000000000000000000000000000000000000Example: 0x6969696969696969696969696969696969696969Pattern: ^0x(.*)$
tokenOutstringRequired

Output token address

Default: 0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0DceExample: 0x6969696969696969696969696969696969696969Pattern: ^0x(.*)$
amountany ofRequired

Amount of input token

Default: 1000000000000000000
string · numericOptional
or
string · numericOptional

Amount of input token

Default: 0
or
numberOptional

Amount of input token

Default: 1000000000000000000
tostringOptional

Recipient address, if not set, calldata cannot be generated

Example: 0x6969696969696969696969696969696969696969Pattern: ^0x(.*)$
slippageany of · max: 1Optional

Slippage tolerance in decimal between 0 (0%) and 1 (100%), default 0.02 (=2%)

Default: 0.02Example: 0.01
string · numeric · max: 1Optional

Slippage tolerance in decimal between 0 (0%) and 1 (100%), default 0.02 (=2%)

Default: 0Example: 0.01
or
number · max: 1Optional

Slippage tolerance in decimal between 0 (0%) and 1 (100%), default 0.02 (=2%)

Default: 0.02Example: 0.01
poolBlackliststring[]Optional

Specify which pool addresses to not use on path finding. Otherwise all will be used by default. Becareful as some pools share the same poolAddress and the blacklist will ignore multiple pools

Example: 0x6969696969696969696969696969696969696969
referralCodeany ofOptional

Partner referral code

string · numericOptional

Partner referral code

Default: 0
or
numberOptional

Partner referral code

Responses
200Success
Responseany of
or
or
422Error
get
GET /v1/swap HTTP/1.1
Host: mainnet.api.oogabooga.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "status": "Success",
  "blockNumber": 1068258,
  "tokenFrom": 1,
  "tokenTo": 2,
  "price": 280,
  "priceImpact": -0.025,
  "tokens": [
    {
      "address": "0x6969696969696969696969696969696969696969",
      "name": "HONEY",
      "symbol": "HONEY",
      "decimals": 18
    }
  ],
  "amountIn": "1000000000000000",
  "amountOutFee": "1000000000000000",
  "assumedAmountOut": "1000000000000000",
  "hasExecutionParams": true,
  "route": [
    {
      "poolAddress": "0x6969696969696969696969696969696969696969",
      "poolType": "Classic",
      "poolName": "KodiakV2 0.3%",
      "liquiditySource": "KodiakV2",
      "poolFee": 0.003,
      "tokenFrom": 1,
      "tokenTo": 2,
      "share": 1,
      "assumedAmountIn": "1000000000000000",
      "assumedAmountOut": "1000000000000000"
    }
  ],
  "tx": {
    "to": "0x6969696969696969696969696969696969696969",
    "data": "0x095ea7b300000000000000000000000089fe079d1daea2db9cde973e5adaa8e2228938ea0000000000000000000000000000000000000000000000000000000000000001",
    "value": "1000000000000000"
  },
  "routerAddr": "0x6969696969696969696969696969696969696969",
  "routerParams": {
    "swapTokenInfo": {
      "inputToken": "0x6969696969696969696969696969696969696969",
      "inputAmount": "1000000000000000",
      "outputToken": "0x6969696969696969696969696969696969696969",
      "outputQuote": "1000000000000000",
      "outputMin": "900000000000000",
      "outputReceiver": "0x6969696969696969696969696969696969696969"
    },
    "pathDefinition": "0x7f746573743200",
    "executor": "0x6969696969696969696969696969696969696969",
    "referralCode": 1,
    "value": "1000000000000000"
  }
}

Token List

get

Get the list of tokens for trading on the Ooga Booga's Smart Order Routing

Authorizations
Responses
200Success
500Error
get
GET /v1/tokens HTTP/1.1
Host: mainnet.api.oogabooga.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
  {
    "address": "0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce",
    "name": "Honey",
    "symbol": "HONEY",
    "decimals": 18,
    "tokenURI": "https://artio-static-asset-public.s3.ap-southeast-1.amazonaws.com/assets/honey.png"
  }
]

Liquidity Sources

get

Get all the liquidity sources available on the router to be used on swap

Authorizations
Responses
200Success
get
GET /v1/liquidity-sources HTTP/1.1
Host: mainnet.api.oogabooga.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200Success
[
  "text"
]
  • GETSwap tokens
  • GETToken List
  • GETLiquidity Sources