buy & sell
The Buy & Sell functionality in Poply enables users to interact with the marketplace contract by purchasing and selling NFTs (Non-Fungible Tokens)
Buy
To initiate a purchase, users can call buyItem function in the contract. The request should include the following parameters: -Collection address -Token ID of NFT
Upon receiving the purchase request, Poply's smart contract verifies the availability and ownership of the NFT. If the NFT is available and the user has sufficient funds, the smart contract executes the transaction by transferring ownership of the NFT to the buyer's wallet address. The corresponding payment is also processed and recorded on the blockchain.
Sell
To create a listing for selling a NFT, users should call listItem function of the contract. The request should include the following parameters:
- Collection address
- Token ID for NFT
- Listing price
Upon receiving the sell request, Poply's smart contract verifies the ownership of the NFT and creates a new listing on the marketplace. The smart contract records the seller's wallet address, the NFT details, and the specified selling price.
Listing Management
Users can manage their active listings through the Poply platform. They can update the selling price, edit the listing details, or remove the listing altogether. These actions trigger corresponding updates on the smart contract, ensuring the accuracy and integrity of the marketplace.
Error Handling
Poply's smart contract implementation include robust error handling mechanisms. In case of any errors or exceptions during the buy or sell process, appropriate error codes and messages are returned to the user, providing clear feedback on the encountered issue.
Smart Contract Events
Poply's smart contract emits events related to buy and sell functions. These events can be subscribed to by external applications or services to receive real-time updates on buy and sell of NFTs. The events provide information such as the NFT ID, the buyer and seller wallet addresses, NFT collection, and price.