Original Author: @tari404, Eric @DoraFactory
simple summary
Example
Example
In general, anything that can be programmed can be executed in Loot Box. Some initial use cases include perks, giveaways, token rewards, airdrops, on-chain registries, whitelists, and more. But make no mistake, the programmable usage scenarios for the Loot Box are limitless.
set up
Minters of NFTs can use setLootBox(uint256,address) (or initialize at minting time) to bind their BUIDL NFTs to the LootBox contract.
interface BuidlNFT {
function setLootBox(uint256 tokenId, address lootBoxAddr) external;
function mint(uint256 initPrice, uint256 bid, address lootBoxAddr, bytes calldata sign) external;
function mint(uint256 initPrice, uint256 bid, bytes calldata sign) external;
}
interface ILootBox {
function afterHarbergerBuy(uint256 tokenId, address newNFTOwner) external;
}
When the NFT is harbergerBuy()ed by anyone, if there is an existing LootBox, it will attempt to call the afterHarbergerBuy() function from the LootBox. Miners (aka BUIDLers) of BUIDL NFTs can define the behavior of afterHarbergerBuy() arbitrarily. Generally, this will be an incentive/incentive for the buyer. NFT buyers can predict how this feature will behave before purchasing.
To be safe, LootBox should always check:
Ÿmsg.sender: prevent the interface from being abused.
example
example
background
pragma solidity 0.8.6;
import "./BuidlNFT.sol";
contract AirdropLootBox is ILootBox {
address public token;
address public owner;
address public entrypoint;
uint256 public mintTokenId;
constructor(address _toAirdropToken, address _ep, uint256 _mintTokenId) {
owner = msg.sender;
token = _toAirdropToken;
entrypoint = _ep;
mintTokenId = _mintTokenId;
}
function afterHarbergerBuy(uint256 _tokenId, address _newOwner) override external {
require(msg.sender == entrypoint);
require(_tokenId == mintTokenId);
(,,,uint256 currentPrice,,,,) = BuidlNFT(msg.sender).metadataOf(_tokenId);
ERC20(token).transferFrom(owner, _newOwner, currentPrice / 100);
}
}
background
BUIDL NFTs were originally proposed in an article (Geeks and Painters: Open Source Projects, NFTs, and a Simplified Harberger Tax) that discussed how NFTs using transaction mechanisms like a simple Harberger Tax could help fund Web3 open source software, and how to create fun for collectors of unique collectibles created by open source projects.
The mechanism was first trialed on HackerLink. Over a dozen HackerLink BUIDL minted their BUIDL NFTs. There is a leaderboard of all BUIDL NFTs on HackerLink.
In the original text, the party creating the NFT should define the meaning of the NFT. It has two requirements that are not popular in the Web3 era:
1) Require unverifiable trust. Like Web2/offline services, permissions are confirmed off-chain. An example is crowdfunding platforms, where benefits and rights are often written down in text and difficult to enforce/verify after the actual purchase.
2) Limits what NFT can do.
BUIDL NFTs were originally described as "Uniswap Socks" for open source projects/public goods. Now with Loot Box, BUIDL NFT can be programmed, providing more flexible interaction for developers and NFT collectors.
idea
For ideas for interesting Loot Box use cases, we maintain a lootboxideas.md. Everyone can contribute to this list of ideas and inspire others to do what Loot Box can do. View details: https://github.com/dorahacksglobal/BUIDL-NFT
