erc404's People
Forkers
huaigu pegasus4me mathdroid cryptolisboa anyinu uwecerron rich9029 yukai-w daleboy txthanh1178793 nunoyhaxxana big-aaron kaelsensei siweibozhe oopsky billdng chainge-potti baseic-erc404 venusgalstar ibold-dev alfiedarko leetesla developerfred yongkangc nitishnaidu368 srsydv margerx osmania danijel-enoch crazycloudcc coldstar1993 sidereus404 0xaladdin666 igordias2 forestkeeperio phatstraw mantarayminer-erc404 ltmuyuan felsey lecle-youngz pu11en mahi070 tribewriter666 0xnekr rb1717 kl3ins raylin51 eltociear 00x-dx archytus10 omahs khadsr3 creliafutu allishoesa trippindsto-c i-griffondirty messagesta-backinfo mowervie buggytrauma43 tonyonst-t gazernumero-84 godzillayellowquestan flavoredbubble69 ratchapter-bluebanx spreamhachoneprep bizarrework-w marcsear-e saviorrazu0glutilli chirpik75 ratchapter-slipkray minglueue-quayleflea runninger-y billitejuzmyhero hydrupsw20 geniusboaairqu storiesgigaolympicry multion-aquatical insidelifej larvional2 spidererio-chicktips cephagne-o k-oprokets readerenesgotiz chaitanyareddyk agbegbetech halonode 0xmusashi hellocrunch dr-pablo cryptalien ldamichael1 nexanetofficial p2xcarter 0x-xamurai orbis404 mxito3 hokentech 0xzapata hendrayoga chtokenerc404's Issues
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😅
MEV protection
What would happen in the scenario where:
- Malicious searcher acquire an NFT
- Sells the NFT on a marketplace
- As soon as buy tx lands in the mempool, search insert a transfer tx where they remove 99% of the tokens
ERC-20 transfer events not being handled correctly
Resulting in most of the ERC-404 tokens being unindexed by etherscan.
As a workout, we have used libraries to separate events and correctly emit ERC20 transfer events here
Usage of for loops might lead to large amounts of tokens not beeing transferable.
Usage of for loops might lead to large amounts of tokens not beeing transferable.
In the code bellow, if the variables tokens_to_burn
or tokens_to_mint
are big enough, that would lead to an Out of Gas error and prevent large token transfers.
Lines 324 to 340 in 14c1362
UNLICENSED is used for non-open source projects
UNLICENSED is used for non-open source projects. Since README.md mentions that a project is free for anyone to use, I suggest changing the licence to MIT to make it true open source.
If you do not want to specify a license or if the source code is not open-source, please use the special value UNLICENSED. Note that UNLICENSED (no usage allowed, not present in SPDX license list) is different from UNLICENSE (grants all rights to everyone).
Source: https://docs.soliditylang.org/en/latest/layout-of-source-files.html
No obvious correlation to official ERCs
Hi there,
I checked the following:
and I couldn't see any mention of this ERC on any of them, so I'm confused how this ended up as ERC-404. Am I missing something?
If amount is smaller then minted how to transfer?
With this code here
Line 215 in 14c1362
you enforce that if amountOrId in transferFrom is smaller than minted it will try to transfer NFT.
But what if I want to transfer less than 10k amount, for example I want to transfer 1000 amount and transferFrom is called, how will I transfer that tokens when it will keep going to the first part of condition and fail there?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.