πŸ’°
Creative Lootbox
How Creative NFTs will be distributed
  • Each campaign will have a loot box (erc1155) containing the max supply of NFTs (erc721).
  • Winners of the campaign will have access to this loot box to claim their NFT and other rewards.
A LootBox contract ephemerally exists within a transaction. The owner of an ERC721 owns the LootBox.
  1. 1.
    A ERC721 is created by calling createERC721Controlled() on the ERC721ProxyFactory by anyone:
1
function createERC721Controlled(
2
string memory name,
3
string memory symbol,
4
string memory baseURI
5
) external returns (ERC721Controlled)
Copied!
​
  1. 1.
    mint() can then be called on the ControlledERC721 which effectively creates a LootBox with an Owner defined by the to field:
1
function mint(address to) external onlyAdmin returns (uint256)
Copied!
2. The LootBox address is calculated by calling:
1
computeAddress(address erc721, uint256 tokenId)
Copied!
4. Anyone can call plunder() on the LootBox controller which will transfer all the passed tokens to the LootBox owner.
1
function plunder(
2
address erc721,
3
uint256 tokenId,
4
address[] calldata erc20s,
5
WithdrawERC721[] calldata erc721s,
6
WithdrawERC1155[] calldata erc1155s
7
)
Copied!
where erc20s is defined as an array of ERC-20 addresses,
erc721s is defined as:
1
struct WithdrawERC721 {
2
address token;
3
uint256[] tokenIds;
4
}
Copied!
and erc1155s as:
1
struct WithdrawERC1155 {
2
address token;
3
uint256[] ids;
4
uint256[] amounts;
5
bytes data;
6
}
Copied!
Last modified 7mo ago
Export as PDF
Copy link