Token Bundler
The contract enables bundling ERC20, ERC721, and/or ERC1155 tokens into a single ERC1155 token (the Bundle token).
- Deployment addresses
- Source code
- TokenBundler.sol contract is written in Solidity version 0.8.16
The owner of the bundle NFT has rights to:
- Transferring ownership of the bundle token to another address
- Unwrap the entire bundle resulting in burning the bundle token and gaining ownership over the wrapped tokens
This contract inherits from the ERC1155 token standard. This comes with all of the ERC1155 functionalities like transfers etc. Please read the ERC1155 specification for more details.
Mint bundle token and transfers assets to Bundler contract.
Make sure to approve all bundled assets towards the Token Bundler contract before calling this function.
This function takes one argument:
MultiToken.Asset[] memory
_assets
- List of assets to include in a bundle
Returns:
uint256
- Bundle id
Burns the bundle token and transfers assets to the caller.
The caller of this function has to be the bundle owner.
This function takes one argument:
uint256
_bundleId
- Bundle id to unwrap
Functions that don't modify the state of the contract. These functions are used to get information about the bundle token.
Each token has its nonce. This function returns an Asset struct (see MultiToken) for a provided token nonce.
This function takes one argument:
uint265
_tokenId
- Token nonce from bundle asset list.
Returns a list of assets in a bundle as a
uint256[]
.This function takes one argument:
uint256
_bundleId
- Bundle id
Returns maximum bundle size.
This function does not take any argument.
Token Bundler contract defines two events and no custom errors.
event BundleCreated(uint256 indexed id, address indexed creator);
event BundleUnwrapped(uint256 indexed id);
BundleCreated event is emitted when a new bundle is created.
This event has two parameters:
uint256 indexed
id
- Id of the bundleaddress indexed
creator
- Address of the bundle creator
BundleUnwrapped event is emitted when a bundle is unwrapped and burned.
This event has one parameter:
uint256 indexed
id
- Id of the unwrapped bundle.
Last modified 5mo ago