Data structure in our centralized system
Last updated
Last updated
This page explains the data structure of ParaSwap'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:
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. (fillableBalance
≠ makeAmount
)
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.
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. (fillableBalance
≠ makeAmount
)
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.