0x – How to Extend the 0x v4 NFT Protocol?

0x

Hello guys I am having a really hard time figuring out how to extend the protocol to add my validations prior to execute a filling order. I am on 0x v4 NFT, I figured out from the docs that adding the sender field in the maker order forces 0x to reject any taker different from the sender address. This allows me to create a 0x extension that I could place between offer and buy to make my own validations. I have asked on the Trader discord why this field was not available on their SDK and they told me that the sender property is not implemented in 0x NFT v4. Is that true? If so, how am I supposed to extend the protocol to add my own logic and validation? thanks

Best Answer

Sadly, Trader is correct. There is no sender field because NFT orders are not designed to work with meta transactions.

I don't know the requirements of your design but an option might be to instead use the taker field.

  1. Have all makers on your platform to set taker to a contract you control.
  2. Have all takers set allowances and perform fills through that contract (you were probably doing the latter with the sender approach anyway).
  3. During a fill, your contract performs its custom validation on the order, reverting if unsuccessful.
  4. Your contract pulls taker assets from the taker to pay for filling the order.
  5. Your contract calls the fill function on the 0x Exchange V4 contract directly (acting as the taker).
  6. Your contract transfers the bought asset to the user, who is the actual taker.

If the validation you're performing is just on the NFT itself (as opposed to other details of the order), you might be able to leverage property validators to avoid having to use a middleman contract entirely.

Related Topic