Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider ERC1155? #34

Open
TechnicallyWeb3 opened this issue Feb 19, 2024 · 2 comments
Open

Consider ERC1155? #34

TechnicallyWeb3 opened this issue Feb 19, 2024 · 2 comments

Comments

@TechnicallyWeb3
Copy link

Has anyone considered this would be better with ERC1155, as it has batchTransfers, different function signatures it would be way better for blending ERC20, afterall, ERC1155 is designed for multiple tokens. I wrote my own version of "ERC404" using ERC1155, feel free to check it out or use it: https://github.com/TechnicallyWeb3/TW3404

@TechnicallyWeb3
Copy link
Author

I commented on the original repo but this one seems more active:

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

@LyghtCode
Copy link

This is dope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants