
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@magicdust/binary-erc1155
Advanced tools
A binary ERC1155 is an ERC1155 where an address can possess a maximum of one instance of a given token id.
Given this rule, the batch minting operation consumes on average 12 times less gas than the general-purpose ERC1155 implementation.
[PASS] testBatchMintingGasConsumptionBinary(uint256) (runs: 256, μ: 102289, ~: 61374)
[PASS] testBatchMintingGasConsumptionOpenZeppelin(uint256[]) (runs: 256, μ: 1117223, ~: 635232)
[PASS] testMintingGasConsumptionBinary(uint8) (runs: 256, μ: 35630, ~: 35630)
[PASS] testMintingGasConsumptionOpenZeppelin(uint8) (runs: 256, μ: 31285, ~: 31285)
This contract can be used in any context where you want an address to hold a token or not, the classical usecase is for badge rewarding.
The need for this type of ERC1155 comes from the reward logic, where a single address can be given several badges of different types, but only one badge of a given type can be owned at a time.
This implementation is based on the OpenZeppelin ERC1155 implementation and takes advantage of the binary aspect to reduce operations' gas cost.
Due to the internal storage structure, the total number of different token types is limited to 256.
yarn
yarn test
yarn benchmark
FAQs
Binary implementation of the ERC1155 multi-token standard
We found that @magicdust/binary-erc1155 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.