On chain Data Structure

ERC20: Order structure

{
    "maker": "0x05182E579FDfCf69E4390c3411D8FeA1fb6467cf",
    "taker": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",
    "nonceAndMeta": "7433034152904838547212883274543254857465784035140417181410394112",
    "expiry": 0,
    "makerAsset": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
    "takerAsset": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",
    "makerAmount": "10000000000000000",
    "takerAmount": "7775870000000000",
    "signature": "0x43de8dbc8228594171d0ed3e623ca0ab5c24f46bf0575800624ae56723712f807ecaf7dc8edfcf0d4517f80f11bf016bde0a9a20e243eea2bb32e55eadbb6b0d1b" 
}
  • maker: address of owner of the order. (The user or contract who want to swap makerAsset to takerAsset).

  • taker: address that can fulfilled this order on chain.

    • taker == 0: anybody can fill the order

    • taker != 0: during the execution we will verify that msg.sender == taker. (taker needs to be the contract or user who fill an order).

  • nonceAndMeta: This field combine nonce value (guarantee uniqueness of the order) and some meta data

  • expiry: expiry timestamp in seconds. Can also be set 0 for an order that never expires

  • makerAsset: address of ERC20 token that maker want to sell to the taker.

  • takerAsset: address of ERC20 token that maker want to buy from the taker.

  • makerAmount: amount of makerAsset that maker want to swap to taker.

  • takerAmount: amount of makerAsset that maker want to swap to taker.

  • signature: EIP712 Signature of a JSON Object with all above fields signed with the private key of maker.

ERC 20/721/1155: Order structure

{
	"maker": "0x0838956f18c895be401834E29F67Dd59Fe459b1F",
	"taker": "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
	"nonceAndMeta": "13369123495123320437930534572810746342548445613241166057167403033431113728",
	"expiry": 1653750633,
	"makerAsset": "3341504144865114989387489881442130991666264814706",
	"makerAmount": "1",
	"makerAssetId": "3333",
	"takerAsset": "381568316899389611396986334098972276236720652278",
	"takerAssetId": "0",
	"takerAmount": "2000000000000000000"
	"signature": "0x9281423eb0679d03dc110ce8d9002059f9dd02b05e5425179a0bdd3d2b154f89105cd8c2f2c040548d9fa605dd46eb71216c25908a7f3d227517fcd26c6b18b51b",
}

Token type encoding

ERC20   -> 00
ERC1155 -> 01
ERC721  -> 10
  • maker: address of owner of the order. (The user or contract who want to swap makerAsset to takerAsset).

  • taker: address that can fulfilled this order on chain.

    • taker == 0: anybody can fill the order

    • taker != 0: during the execution we will verify that msg.sender == taker. (taker needs to be the contract or user who fill an order).

  • nonceAndMeta: This field combine nonce value (guarantee uniqueness of the order) and some meta data

  • expiry: expiry timestamp in seconds. Can also be set 0 for an order that never expires

  • makerAsset: Packed field containing address of an ERC20/721/1155 token that maker want to sell to the taker (between 0-19 bits). Token type encoded as show above on 20-21 bits.

  • makerAssetId: ignored for ERC20. For ERC/721/1155 the maker token.

  • takerAsset: Packed field containing address of an ERC20/721/1155 token that maker want to sell to the taker (between 0-19 bits). Token type encoded as show above on 20-21 bits.

  • makerAssetId: ignored for ERC20. For ERC/721/1155 the taker token.

  • makerAmount: amount of makerAsset (at id makerAssetId for ERC/721/1155) that maker want to swap to taker.

  • takerAmount: amount of takerAsset (at id takerAssetId for ERC/721/1155) that maker want to swap to taker.

  • signature: EIP712 Signature of a JSON Object with all above fields signed with the private key of maker.

Last updated