đ´ââ ī¸ Loot Box
What is a PoolTogether Loot Box?
Overview
A Loot Box is an address that can be controlled by the owner of an ERC721. Any ERC721 can have an associated Loot Box address, to which tokens and pretty much anything can be sent to. Anyone can "plunder" the Loot Box for tokens, and those tokens will be sent to the owner of The ERC721.
In this way, Loot Boxes allow addresses to be traded like NFTs.
The code can be found here: https://github.com/pooltogether/loot-box
How it works
A LootBox contract ephemerally exists within a transaction. The owner of an ERC721
owns the LootBox.
A
ERC721
is created by callingcreateERC721Controlled()
on theERC721ControlledFactory
by anyone:
mint()
can then be called on theControlledERC721
which effectively creates a LootBox with an Owner defined by theto
field:
The LootBox address is calculated by calling:
Tokens are transferred/minted to this address. In the case of PoolTogether, these are usually external ERC20, ERC721 and ERC1155 rewards for a Prize Period.
Anyone can call
plunder()
on the LootBox controller which will transfer all the passed tokens to the LootBox owner.
where erc20s
is defined as an array of ERC-20 addresses,
erc721s
is defined as:
and erc1155s
as:
Last updated