LogoLogo
Join DiscordFollow on XBridge FundsLong $BERA
  • Doc Bros v1
    • Overview
    • Key Features
      • Speed & Liquidity is Key
      • Bropetual Markets
      • A Hub for Berachain DeFi
    • Proof-of-Liquidity
      • Reward Vault
    • Power of Points
    • Partners & Integrations
    • Campaigns
      • bro.trade Em Up
  • bullish bros
    • SuperBros NFT
  • Technicals
    • What is Proof-of-Liquidity?
    • One-Click Trading
    • Funding Rates
  • Liquidations & Insurance Fund
  • Vertex Edge Sequencer
  • Fees
  • PnL Settlements
  • Withdrawals
  • Pricing (Oracles)
  • links & resources
    • bro.trade Links
      • Website
      • Trade Bropetuals
      • Discord
      • X (Twitter)
      • Medium
      • Swap on OogaBooga
    • Berachain Links
      • Berachain.com
      • Official Bridge
      • BeraHub
      • Berascan
      • Bera Discord
      • Berachain X (Twitter)
      • Berachain Docs
    • FAQ
  • developer bros
    • API
      • Gateway
        • Executes
          • Place Order
          • Cancel Order
          • Cancel and Place
          • Cancel Product Order
          • Withdraw Colleteral
          • Transfer Quote
          • Liquidate Subaccount
          • Mint LP
          • Burn LP
          • Link Signer
        • Queries
          • All Products
          • Contracts
          • Fee Rates
          • Health Groups
          • Insurance
          • Linked Signer
          • Market Liquidity
          • Market Prices
          • Max Lp Mintable
          • Max Order Size
          • Max Withdrawable
          • Min Deposit Rates
          • Nonces
          • Order
          • Orders
          • Status
          • Subaccount Info
          • Symbols
        • Signing
          • Examples
          • Q A
      • Subscriptions
        • Authentication
        • Streams
        • Events
        • Rate Limits
      • Archive (indexer)
        • Candlesticks
        • Events
        • Funding Rate
        • Interest Funding Payments
        • Linked Signer Rate Limit
        • Liquidation Feed
        • Maker Statistics
        • Market Snapshots
        • Matches
        • Merkle Proofs
        • Oracle Price
        • Orders
        • Perp Prices
        • Product Snapshots
        • Rewards
        • Signatures
        • Subaccounts
        • Summary
        • HONEY Price
      • Trigger
        • Executes
          • Place Order
          • Cancel Orders
          • Cancel Product Orders
        • Queries
          • List Trigger Orders
      • V2
        • Apr
        • Assets
        • Contracts
        • Orderbook
        • Pairs
        • Tickers
        • Trades
      • Rate limits
      • Errors
      • Symbols
      • Depositing
      • Withdrawing (on-chain)
      • Integrate via Smart Contracts
      • Definitions / Formulas
    • On-Chain Contracts
Powered by GitBook
On this page
  1. developer bros
  2. API
  3. Gateway

Executes

PreviousGatewayNextPlace Order

Last updated 2 months ago

All executes go through the following endpoint; the exact details of the execution are specified by the JSON payload.

  • Websocket: WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]

  • REST: POST [GATEWAY_REST_ENDPOINT]/execute

See more info in the page.

Signing

All executes are signed using . Each execute request contains:

  1. A piece of structured data that includes the sender address

  2. A signature of the hash of that structured data, signed by the sender

You can check the SDK for some examples of how to generate these signatures.

See more info in the page.

Sender Field Structure

The sender field is a solidity bytes32 . There are two components:

  • an address that is a bytes20

  • a subaccount identifier that is a bytes12

For example, if your address was 0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43, and you wanted to use the default subaccount identifier (i.e: the word default) you can set sender to 0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c4364656661756c740000000000 , which sets the subaccount identifier to 64656661756c740000000000.

Amounts

For DepositCollateral and WithdrawCollateral, the amount specifies the physical token amount that you want to receive. i.e. if HONEY has 6 decimals, and you want to deposit or withdraw 1 HONEY, you specify amount = 1e6.

For all other transactions, amount is normalized to 18 decimals, so 1e18 == one unit of the underlying asset. For example, if you want to buy 1 wETH, regardless of the amount of decimals the wETH contract has on chain, you specify 1e18 in the amount field of the order.

All Execute messages return the following information:

{
  "status": "success",
  "signature": "{signature}",
  "data"?: {data_obj}
  "request_type": "{request_type}"
}
{
  "status": "failure",
  "signature": "{signature}"
  "error": "{error_msg}"
  "error_code": {error_code},
  "request_type": "{request_type}"
}

API Response

Success

Failure

signing
​
EIP712
signing
​
​
​
​
​