I try to create NFT Market place (erc721) and accepted payment by token (erc20)
it mean everyone can mint buy and sell on my site
But if user want to buy NFT, the user must pay with my token only
and i got this error
I figure out to find where is the error line
and i found at the transferForm is a reason of an error
function buyItem(uint256 tokenId) public {
uint256 _price = forSale[tokenId];
require(forSale[tokenId] > 0, "NOT FOR SELL");
forSale[tokenId] = 0;
address payable itemOwner = payable(ownerOf(tokenId));
yourToken = IERC20(address(0x4f909dFE5Daaf94fbd1fD4C2E582F7608C87cd94));
yourToken.transferFrom(msg.sender,itemOwner, _price);
_transfer(itemOwner, msg.sender, tokenId);
emit Action(msg.sender, tokenId, "buy", _price);
}
How i can do for fixed this problem ?