Zilliqa / marketplace-contracts

GNU General Public License v3.0
2 stars 4 forks source link

[RIAL-1091 RIAL-1092 RIAL-1093] Signed order for fixed price #59

Closed inamirandaz closed 2 years ago

inamirandaz commented 2 years ago

Added support for "signed orders" which allows business logic on order fulfillment to be handled off-chain. This signature could be used to prove that an order has been validated and checked by a trusted third party (i.e. Order Validator) and can thus be executed.

By default, the "signed order" mode is disabled. Existing applications that use this contract can continue to use the transition FulfillOrder to execute orders. Applications that wish to implement additional business requirements on order fulfillment can enable the signed order by calling EnableSignedOrder, passing the public key of the Order Validator (verifier_pub_key). The contract only allows one validator at the moment.

The keypair of the Order Validator is based on the secp256k1 curve, while signature scheme used is ECDSA.

The message is packed as hex string. Offset table for the parameters are given below. The size of the parameters are based on their data types. Offset Name Notes
00-19 Token address NFT contract address
20-51 Token Id ID of the NFT
52-71 Destination address recipient of the NFT
72-75 Side Buy side or sell side
76-94 Price Price of the token
92-111 Payment token address Native zil or ZRC2 token address
112-127 Block number The block number when the signature was created. Validity of the signature is within 5 blocks