After using https://eips.ethereum.org/EIPS/eip-2981 as the final standard, I have taken IERC2981.sol and forged this into ERC2981.sol and ERC2981Collection.sol
By using a Struct we are attempting to use closer to a 21k gas fee (full 2^256 slot).
mappedRoyalties.receiver - address for royalties
mappedRoyalties.percentage - uint for pecentage (yes can change to permille)
mapping(uint256 => mappedRoyalties) royalty - mapping per tokenId
_setRoyalties(uint, address, uint) internal - sets the mapping
royaltyInfo(uint, address) - override of IERC2981.sol
- returns mappedRoyalties.receiver
- returns value to be sent from sale
Designed more for x amount of minters for an artist collection.
By using 2 variables, royaltyAddress and royaltyPercent more gas intensive, but should be a one time setting.
_setRoyalties(address, uint) internal - sets the two variable
royaltyInfo(uint, address) - override of IERC2981.sol
- returns royaltyAddress
- returns value to be sent from sale
- Node.js - Latest
- NPM - Latest
- Truffle - Latest (npm install -g truffle)
- hdwallet-provider - Latest (npm install -g @truffle/hdwallet-provider)
- truffle-plugin-verify - Latest (npm install -g truffle-plugin-verify)
- Infura API-Key
- Ftmscan API-Key
- mnemonic for generation of Private Key
- .env setup:
- MNEMONIC=""
- INFURA_API_KEY=
- FTMSCAN_API_KEY=
- dotenv - Latest (npm install -g dotenv)
- git - Latest (if you plan on developing with us)
- create .gitignore
- add .env