Data structure in our centralized system

This page explains the data structure of Velora's centralized service handling limit orders. It's adding some features like:

  • tracking maker balance and allowance for ERC20 tokens.

  • tracking state of orders

    • Fulfillment.

    • Cancellation.

    • Expiration.

    • Partially fulfillment.

For more information, please refer to the following document:

On chain Data Structure

ERC20: Order structure

{
    "expiry": 0,
    "createdAt": 1661165141,
    "updatedAt": 1661165141,
    "transactionHash": null,
    "chainId": 137,
    "nonceAndMeta": "7433034152904838547212883274543254857465784035140417181410394112",
    "maker": "0x05182e579fdfcf69e4390c3411d8fea1fb6467cf",
    "taker": "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
    "takerFromMeta": "0x0000000000000000000000000000000000000000",
    "makerAsset": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
    "takerAsset": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",
    "makerAmount": "10000000000000000",
    "fillableBalance": "10000000000000000",
    "swappableBalance": "10000000000000000",
    "makerBalance": "10000000000000000",
    "takerAmount": "7775870000000000",
    "signature": "0x43dd8dbc8228594171d0ed3e633ca0eb5c24f46bf0575100623ae56723712f807ecaf7dc8edfcf0d4517f80f11bf016bde0a9a20e243eea2bb32e55eadbb6b0d1b",
    "orderHash": "0xdef400fd95d028d8caaba2c4887d2694563e0bc7f73c17d747feac2e24ed411d",
    "permitMakerAsset": null,
    "type": "LIMIT",
    "state": "PENDING"
}

Difference with on-chain limit order

  • nonceAndMeta: In our centralized system we force nonce and meta to be constructed from an address plus a random integer between 0 and 2 ^ 53 - 1 shifted 160 bits. The address that we pack is the actual taker address. (The address that swap takerAsset to maketAsset)

  • takerFromMeta: is the decoded taker from nonceAndMeta. In Augustus contract we check the actual takerAddress (The address who swap takerAsset to makerAsset) by extracting its value from nonceAndMeta.

  • fillableBalance: is the amount that remains to be filled and can be used to check if the amount is partially filled. (fillableBalancemakeAmount)

  • swappableBalance: is the actual amount that can be filled at this time.

  • makerBalance: max amount makerAddress can fill the limit order.

  • orderHash: hash of the on-chain Data structure.

  • permitMakerAsset: always null for now will be used to store permit.

  • type: P2P / LIMIT differentiate p2p from normal orders

    • P2P: has takerFromMeta set to some specific address.

    • LIMIT: has takerFromMeta set to 0x....0.

  • state: PENDING / FULFILLED / EXPIRED / CANCELLED.

    • PENDING: order is still usable.

    • FULFILLED: order is fully fulfilled.

    • EXPIRED: order is expired.

    • CANCELLED: order is canceled.

NFT ERC 20/721/1155 Order structure

Difference with on-chain NFT order

  • makerAsset: is the decoded address of the makerAsset from our limit order contract.

  • makerAssetId: is the decoded token type from the makerAsset from our limit order contract.

  • takerAsset: is the decoded address of the makerAsset from our limit order contract.

  • takerAssetId: is the decoded token type from the takerAsset from our limit order contract.

  • takerFromMeta: is the decoded taker from nonceAndMeta. In Augustus contract we check the actual takerAddress (The address who swap takerAsset to makerAsset) by extracting its value from nonceAndMeta.

  • fillableBalance: is the amount that remains to be filled and can be used to check if the amount is partially filled. (fillableBalancemakeAmount)

  • orderHash: hash of the on-chain Data structure.

  • permitMakerAsset: always null for now will be used to store permit.

  • type: P2P / LIMIT differentiate p2p from normal orders

    • P2P: has takerFromMeta set to some specific address.

    • LIMIT: has takerFromMeta set to 0x....0.

  • state: PENDING / FULFILLED / EXPIRED / CANCELLED.

    • PENDING: order is still usable.

    • FULFILLED: order is fully fulfilled.

    • EXPIRED: order is expired.

    • CANCELLED: order is canceled.

Last updated