Skip to content

Instantly share code, notes, and snippets.

@raypulver
Created September 11, 2018 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save raypulver/2f318db5dc497cab8019d3ae391af1d2 to your computer and use it in GitHub Desktop.
Save raypulver/2f318db5dc497cab8019d3ae391af1d2 to your computer and use it in GitHub Desktop.
the function arguments to the IDEX trade function

Question

What do all of these fields on a trade represent?

MethodID: 0xef343588 [0]: 0000000000000000000000000000000000000000000006a2147ceaa14651c4ed [1]: 00000000000000000000000000000000000000000000000007d322ff9719600a [2]: 000000000000000000000000000000000000000000000000000000000002e630 [3]: 000000000000000000000000000000000000000000000000000000000000002d [4]: 0000000000000000000000000000000000000000000006a2147ceaa14651c4ed [5]: 000000000000000000000000000000000000000000000000000000000000046f [6]: 00000000000000000000000000000000000000000000000000038d7ea4c68000 [7]: 000000000000000000000000000000000000000000000000001950b996dfce70 [8]: 000000000000000000000000a849eaae994fb86afa73382e9bd88c2b6b18dc71 [9]: 0000000000000000000000000000000000000000000000000000000000000000 [10]: 000000000000000000000000f0ec187925afd056711a95cccecf4af984fe5a4c [11]: 000000000000000000000000951c7c87537d236bb54c178b091073a36e0a3b8b [12]: 000000000000000000000000000000000000000000000000000000000000001c [13]: 000000000000000000000000000000000000000000000000000000000000001c [14]: 3d3b7b2f84f600ff8e3cd079e73a438211a91d003275c44a3fa7343f9c12cc49 [15]: 2ea0431b220783c91f1637b7de31eb655d932de72a176805d4ed58f2c4c70fd9 [16]: a911812b43c220f2bd8100718ade043b70e5257f8bf47db99fd2625fbc0c79ba [17]: 6748478f13d9fc78163adfab0d138dba7e3e42dbf381a2b09cd79ba4fd161b1d

Breakdown

MethodID: 0xef343588

This is the soliditySha3 hash of the function signature: trade(uint256[8],address[4],uint8[2],bytes32[4])

[0] - amountBuy

This is the amount of the token being bought by the maker if the whole order were to be filled, signed by the maker

Example: Hex --> Int (31324047749915079722221) of tokenBuy)

[1] - amountSell

This is the amount of the token being sold by the maker if the whole order were to be filled, signed by the maker

Example: Hex --> Int (563832859498471434 of tokenSell)

[2] - expires

This is a currently unused field, always set to 190000, but inactive. In the future it will represent a block number after which the order can no longer be filled, signed by the maker

[3] - nonce

This is a one time integer between 1 and 2^256 used to make the order unique while preventing replay attacks, signed by the maker

Example: Hex --> Int 45

[4] - amount

This it the amount (<= amountBuy) that the order is being filled for, signed by the taker

Exmaple: Hex --> Int 31324047749915079722221

[5] - tradeNonce

This is the nonce that the taker signs

Eample: Hex --> Int 1135

[6] - feeMake

This is the fee taken from the maker as a proportion of 1 ether, in units of tokenBuy

Example: Hex --> Int 1000000000000000 -> divide by 1000000000000000000 == 0.1% fee

[7] - feeTake

This is the fee taken from the taker as a proportion of 1 ether, in units of tokenSell

Example: Hex --> Int 7125632448188016 -> divide by 1000000000000000000 approximately = 0.7125632448188016#% fee

[8] - tokenBuy

Address of the token being bought by the maker, sold by the taker.

Example: Hex --> Address 0xa849eaae994fb86afa73382e9bd88c2b6b18dc71 (MVL)

[9] - tokenSell

Address of the token being sold by the maker, bought by the taker.

Example: Hex --> Address 0x0000000000000000000000000000000000000000 (this is the null address, which denotes Ether)

[10] - maker

Address of the maker

Example: Hex --> Address 0xf0ec187925afd056711a95cccecf4af984fe5a4c

[11] - taker

Address of the taker

Example: Hex --> Address 0x951c7c87537d236bb54c178b091073a36e0a3b8b

[12] - maker v

The signature "v" value of the maker signature.

Example: Hex --> Int (27 or 28) 28

[13] taker v

The signature "v" value of the taker signature.

Exmaple: HEx --> Int (27 or 28) 28

[14] maker r

The signature "r" value of the maker signature.

Exmaple: Hex --> Bytes32 0x3d3b7b2f84f600ff8e3cd079e73a438211a91d003275c44a3fa7343f9c12cc49

[15] maker s

The signature "s" value of the maker signature.

Exmaple: Hex --> Bytes32 0x2ea0431b220783c91f1637b7de31eb655d932de72a176805d4ed58f2c4c70fd9

[16] taker r

The signature "r" value of the taker signature.

Example: Hex --> Bytes32 0xa911812b43c220f2bd8100718ade043b70e5257f8bf47db99fd2625fbc0c79ba

[17] taker s

The signature "s" value of the taker signature.

Exmaple: Hex --> Bytes32 0x6748478f13d9fc78163adfab0d138dba7e3e42dbf381a2b09cd79ba4fd161b1d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment