Comments (3)
If Type A (fungible), Type B (non-fungible) and Type C (fungible) all needed to be minted in your contract how would your code handle that situation?
from erc-1155.
@AC0DEM0NK3Y I don't get what situation did you mean since when minting there're two different functions for fungible and non-fungible
(which are
function mintNonFungible(uint256 _type, address[] calldata _tos) external creatorOnly(_type)
function mintFungible(uint256 _id, address[] calldata _tos, uint256[] calldata _quantities) external creatorOnly(_id)
)
and when identifying credit whether it is fungible or non-fungible there are a masking bit for that.
In your case (Type A (fungible), Type B (non-fungible) and Type C (fungible)), the id for A, B and C could be like the following (let say I store ID in the uint8 instead of the uint 256)
- A:
0000 0001
- B:
1010 0000
- C:
0000 0011
from erc-1155.
There is a common create function, that is where the code the OP mentioned was pulled from.
...and sure you could store it there yes, but now to get type you first have to test fungibility and then either use a mask or pull from uint8 (essentially a mask on the lower bits), and have limited yourself to 255 fungible types.
By storing the type in the same place for all you can use a common way to get the type from any id.
But it's up to you, the id mechanism is up to the implementor this is just an example of how you could do it.
from erc-1155.
Related Issues (17)
- It's not safe HOT 1
- Inline ASM Required? Can't support in Vyper HOT 4
- A question about function create() and mint() in ERC1155Mintable.sol HOT 3
- Could not find suitable configuration file. HOT 5
- Rename ERC1155Mintable.sol HOT 4
- Cannot read property 'match' of undefined
- Cannot use import statement outside a module HOT 2
- What is the difference between 'create' and 'mint' functions in ERC1155Mintable.sol
- Replace the EIP-1538 Implementation with EIP-2535, the Diamond Standard
- expectThrow.js unexpected token issue HOT 1
- id from mintNonFungible duplicating, skips even numbers
- ERC1155Mintable does not follow the metadata standard
- ERC1155 Questions about ID, Metadata and uniqueness
- How to withdraw tokens from ERC1155 contract?
- Vulnerability: Nonce must be limited to 2^127 in split bit design
- Spend allowance
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.
from erc-1155.