I have created a Dapp using OpenZeppelin Contracts, where users can purchase NFTs and then eventually resale them. The seller needs to initially authorise my Smart Contract (SC) to sale ALL his items on his behalf (similarly to what is done on OpenSea), by calling via my Web Portal the setApprovalForAll method on the SC. Upon putting a specific NFT for sale, the seller enters the price he wishes to sell his item for on the same Portal. However, what prevents another user who wishes to purchase the NFT, to buy it directly on the SC without going through my Portal, at a lower price than the one at which the seller wishes to sale for, which has been specified only on my Web Portal? If I include and update the selling price on the Smart Contract, the seller will need to pay gas every time that an item is put up for sale at a specific price. Am I missing something.
Currently, the Token Transfer is initiated by the purchaser from my web portal using the following code:
this.contInst.methods.tokTransfer(tokOwner, this.account, TokenId, PriceBN, ComBN).send({
from: this.account, // Corresponds to Purchaser Account
value: this.web3.utils.toWei(PriceStr, 'ether')
})
And my Smart Contract contains the following code:
function tokTransfer(address payable from, address to, uint256 tokenId, uint256 price, uint256 commission) whenNotPaused() nonReentrant() external payable {
require(msg.value >= price);
this.safeTransferFrom(from, to, tokenId);
AddressUpgradeable.sendValue(from, price.sub(commission));
}
Thank you. J