You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/nft_guide.rst
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ Create an ERC721Order
15
15
The following code snippet shows how to construct a basic ERC721 sell order in JavaScript. In the following example, the seller indicates that they would like to receive ether by providing the sentinel value `0xeee...`` as the `erc20Token`.
@@ -48,6 +49,7 @@ The following code snippet shows how to construct a basic ERC721 sell order in J
48
49
An ERC721 sell order can be created similarly. Note that buy orders must use WETH instead of ether, because the ERC20 `transferFrom` functionality is needed to execute a buy order.
@@ -97,6 +99,7 @@ Fees are paid by the **buyer**, denominated in the asset paid by the buyer, and
97
99
The following code snippet shows how to create an ERC721 order with a single fee. Multiple fees can be specified by providing multiple fee objects in the order fees field.
@@ -130,6 +133,7 @@ The following code snippet shows how to create an ERC721 order with a single fee
130
133
In 0x V4, it is possible to create a bid for any NFT in a particular collection. The following code snippet shows how to create an order to buy any CryptoCoven $WITCH.
@@ -169,6 +173,7 @@ Off-chain orders must be signed by the order maker to be filled. For on-chain or
169
173
Signing an order with a private key is easy: the `ERC721Order` and `ERC1155Order` classes from `@0x/protocol-utils` expose a `getSignatureWithKey`function that take a 0x-prefixed private key string.
@@ -243,6 +249,7 @@ Signing an order with a private key is easy: the `ERC721Order` and `ERC1155Order
243
249
Orders can be simultaneously "signed" and listed on-chain using the `preSignERC721Order` or `preSignERC1155Order` functions. Orders can only be signed by the maker address specified in the order.
244
250
245
251
.. code-block:: solidity
252
+
246
253
/// @dev Approves an ERC721 order on-chain. After pre-signing
247
254
/// the order, the `PRESIGNED` signature type will become
248
255
/// valid for that order and signer.
@@ -260,6 +267,7 @@ Orders can be simultaneously "signed" and listed on-chain using the `preSignERC7
260
267
If an order has been pre-signed, it can be filled by providing a “null” signature with the PRESIGNED signature type (see `LibSignature.sol <https://github.com/0xProject/protocol/blob/refactor/nft-orders/contracts/zero-ex/contracts/src/features/libs/LibSignature.sol#L42-L61>`_):
@@ -270,6 +278,7 @@ If an order has been pre-signed, it can be filled by providing a “null” sign
270
278
The pre-sign functions emit the entire order as an event, so that the order is easily indexable by subgraphs and thus easily indexable by subgraphs and thus easily discoverable without the need for an off-chain database.
271
279
272
280
.. code-block:: solidity
281
+
273
282
/// @dev Emitted when an `ERC721Order` is pre-signed.
274
283
/// Contains all the fields of the order.
275
284
event ERC721OrderPreSigned(
@@ -311,6 +320,7 @@ Filling an ERC721 Order
311
320
The basic functions used for filling NFT orders are the following:
312
321
313
322
.. code-block:: solidity
323
+
314
324
/// @dev Sells an ERC721 asset to fill the given order.
315
325
/// @param buyOrder The ERC721 buy order.
316
326
/// @param signature The order signature from the maker.
@@ -407,6 +417,7 @@ Cancelling an ERC721 Order
407
417
All orders, whether off-chain or on-chain, can only be cancelled on-chain. The following contract functions are used to cancel individual ERC721 and ERC1155 orders.
408
418
409
419
.. code-block:: solidity
420
+
410
421
/// @dev Cancel a single ERC721 order by its nonce. The caller
411
422
/// should be the maker of the order. Silently succeeds if
412
423
/// an order with the same nonce has already been filled or
@@ -427,6 +438,7 @@ Note that if there are multiple outstanding orders with the same nonce, calling
427
438
The following functions can be used to cancel multiple orders.
428
439
429
440
.. code-block:: solidity
441
+
430
442
/// @dev Cancel multiple ERC721 orders by their nonces. The caller
431
443
/// should be the maker of the orders. Silently succeeds if
432
444
/// an order with the same nonce has already been filled or
0 commit comments