When NFT (ERC-721) is traded, I'd like its minter (creator) of the NFT to receive a royalty.
In order to achieve this, I've tried
- call ERC20.transferFrom inside of ERC721.transferFrom -> it compiled, but had runtime error.
- created a third contract importing both ERC721, ERC20 and then a new function to call ERC20.transferFrom and ERC721.transferFrom -> again, the same runtime error.
How should I go about implementing this? My full code is here -> https://github.com/NCGlobalTech/NFT_Voting_Dapp
Inside contract folder: ERC20Token.sol: my ERC20 contract inheriting openzeppelin erc20 interface NFTTrade.sol: my ERC721 contract inheriting openzeppelin erc721 interface NFTtoken.sol: The third contract to call TransferFrom both ERC20/ERC721 contracts by inheriting both.
Code to reproduce
Environment
Truffle v5.4.28 (core: 5.4.28)
Solidity - 0.7.0 (solc-js)
Node v12.14.0
Web3.js v1.5.3