ERC404
ERC404 copied to clipboard
ERC1155 Alternative?
I’ve decided to try to rewrite the protocol as an ERC1155 protocol for several reasons:
No mixed function/signature pairs in ERC1155/ERC20. Use of batch _update allows users to specify the NFT/ERC20 pairings specifically.
What I did:
Made a mapping _totalSupply[erc20Id] to override ERC20 totalSupply() using erc20Id of 0 Made ERC1155 ids above erc20Id non-fungible using _totalSupply[id]; Overrode ERC20 and ERC1155 _update functions ensuring all balance mappings were pointing to the ERC1155 contract using _balances[erc20Id] and that _totalSupply was correctly calculated Ensured that any mismatch of ERC20 and NF ERC1155 tokens (incorrectly called erc721 in the code) is brought up and checked against balance.
Thanks to this approach all native ERC20 and ERC1155 minting, burning and transfer functions behave as expected.
See my repo, it’s a vastly different approach to the current standard but achieves similar effects to what “ERC404” does.
github.com/TechnicallyWeb3/TW3404
Things I haven’t had time to do to make it complete: Add formal “ERC420” errors Add in function balanceOfNft(address) to mimic old ERC721 balanceOf using ownedTokens.length (optional - not necessary for ERC1155 platforms) Add ownerOf mapping/function to mimic ERC721 function (also optional for same reason) Add ERC1155 and ERC20 emits where needed Full testing scripts Check how brutal gas is😅