# InfinityKeys - NFT Raffle
## Requirements
- Draw opened to holders of arbitrary infinity keys achievement nft
- Smart contact should escrow an ERC721 when a draw is created
- Raffle should be conducted based on list of holders of the IKAchievementNFT snapshoted at the moment raffle is triggered
- draw should be based on addresses holding at least one token from an arbitrary set of key Ids
- Contract should integrate Chainlink VRF2 to get a trustless source of randomness
- Simple interface for winner to check if they won and claim the prize
- This will be handled by InfinitKeys frontend team
- Instead, write Contract Unit tests and E2E tests so they can be used as a guide to build a UI to create new raffles and inform draw winners
## Milestones
| No | Objective | Est. Time (Hours) |
| -- | --------- | --------- |
| 1 | **Key holder snaphost logic** | - |
| 1.1 | Build a TS script to get an off-chain snapshot of IkAchievementNFT key holders that qualify for a raffle (using Flipside SDK) | 4 |
| 1.2 | Build a TS script to build a Merkle tree from Key holder snapshot | 4 |
| 2 | **Create a `VRF NFT Drawing` contract project using hardhat** | - |
| 2.1 | Setup project + Implement ERC721 escrow logic | 4 |
| 2.2 | Integrate Chainlink VRF2 to get a trustles source of entrophy | 6 |
| 2.3 | Implement Draw and claiming logic based on VRF2 and Merkle tree snapshot | 5 |
| 2.4 | Write Proxy Factory contract to create new raffles | 3 |
| 2.5 | Write Unit tests | 5 |
| 3 | Deploy both InfiniteKeys and `VRF NFT Drawing` contracts on Sepolia and run integration tests with Chainlink VRF2 | 5 |
| 4 | Write E2E tests and README file explaining how to deploy and use contracts on a frontend | 4 |
| | **TOTAL** | **40** |
## Deliverables
- Hardhat project repository
- `VRF NFT Drawing` contract
- Raffle Proxy Factory contract
- Key Holder Snapshot + Merkle Tree scripts
- Unit / E2E tests
- README File with setup instructions
## Estimated Time
- 40 Hours (~2 weeks mid-time work)
## Payout
- 1600 US Dollars (DAI/USDC/RAI accepted)