Trade NFT
Last updated
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.
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:
User moves the NFT → _beforeTokenTransfer hook calls symmio.transferTradeFromNFT() to update the protocol.
Protocol moves the NFT → transferTradeNFT() sets a flag (transferInitiatedInSymmio) so the hook doesn't call back into the protocol, avoiding an infinite loop.
constructor(address symmio_) ERC721("Trade Ownership NFT", "TRNFT")Reverts with InvalidSymmioAddress if symmio_ is address(0).
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)
Transfer trade ownership associated with NFT.
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
function transferTradeNFT(address from, address to, uint256 tradeId) external onlySymmio;
