This contract allows an escrowed NFT to be fairly drawn in a raffle format backed by a Chainlink VRF contract.
This contract has 2 safeguards:
- If no user claims the winning NFT the contest can be re-drawn
- If desired, after a specific time window the NFT can be withdrawn by the owner. While this function is recommended it is not required in cases of a fully trustless raffle. However, issues with chainlink VRF not returning entropy could result in a frozen NFT. This is up to the raffle submitter to decide.
-
Create drawing
- Deploying drawing via factory, set nft information, timelock information, chainlink coordinator
- Start off drawing connected to a "raffle ticket" NFT (easy to do with any editioned 721 such as ZORA drops contracts)
-
Users in drawing can check if they've won and claim their nft
- If no user claims the nft within a TIME_CLAIM_PERIOD
- The admin can re-roll for another user
- [note]: this functionality can be disabled
- If the admin ADMIN_RECOVERY_PERIOD elapses
- The admin can withdraw the nft and repeat the process, etc.
- [note]: this functionality can be disabled
- If no user claims the nft within a TIME_CLAIM_PERIOD
- Install forge/foundry: See https://book.getfoundry.sh/getting-started/installation
- Setup git submodules:
git submodules init && git submodules update
- Run tests:
forge test
- Run tests w/ gas reports:
forge test --gas-report
- Run Deploy Script:
forge script ./script/SetupContractsScript.s.sol
(recommended to also verify withforge script --verify
)
-
https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/ a. Utilized for
-
https://github.com/smartcontractkit/chainlink/ a. Chainlink smartcontractkit:
- Görli
- Factory: 0x71877Aa4ABbad79e0C93477020A41ff7e06AA746
- Mainnet
- None yet, awaiting audit.