Trade NFT

An ERC-721 contract that represents trade ownership as a transferable NFT. Token IDs map 1:1 to trade IDs in the Symmio protocol. Transferring the NFT automatically updates trade ownership in the protocol, and vice versa.

How It Works

Token ID = Trade ID. When an NFT is minted for trade 42, the token ID is 42. No auto-increment.

NFTs are opt-in. Not every trade gets an NFT. PartyA must explicitly mint one via the core protocol.

Two transfer paths exist, kept in sync:

  1. User moves the NFT_beforeTokenTransfer hook calls symmio.transferTradeFromNFT() to update the protocol.

  2. Protocol moves the NFTtransferTradeNFT() sets a flag (transferInitiatedInSymmio) so the hook doesn't call back into the protocol, avoiding an infinite loop.


Constructor

constructor(address symmio_) ERC721("Trade Ownership NFT", "TRNFT")

Reverts with InvalidSymmioAddress if symmio_ is address(0).


Functions

mintNFTForTrade()

function mintNFTForTrade(address partyA, uint256 tradeId) external onlySymmio;

Mints token tradeId to partyA. Only the Symmio contract can call this.

The _beforeTokenTransfer hook fires but skips the sync logic because from == address(0) (mint).

Event: TradeNFTMinted(partyA, tradeId)

transferTradeNFT()

Transfer trade ownership associated with NFT.


Events

Event
When

TradeNFTMinted(address indexed owner, uint256 indexed tokenId)

NFT minted

TradeNFTTransferred(uint256 indexed tokenId, address indexed from, address indexed to)

User-initiated NFT transfer only

Last updated