🎲Fortune
The NFTEarth Fortune is an onchain game powered by NFTEarth and Chainlink VRF, live on Arbitrum layer2 scaling network.
Last updated
The NFTEarth Fortune is an onchain game powered by NFTEarth and Chainlink VRF, live on Arbitrum layer2 scaling network.
Last updated
The Fortune system is designed to operate a transparent, fair, and decentralized game directly onchain. It utilizes smart contracts to handle the process, ensuring trust and integrity and is deployed on leading Ethereum layer2 network Arbitrum. The Fortune system is structured around a series of 'rounds'. Each round represents a single iteration of the game, where participants can enter by making deposits (ETH
/ERC-721
/ERC-20
), and winners are selected at the end.
The likelihood of a participant winning is equivalent to the share of the total pot they deposited. Each deposit value is calculated, and each participant is allocated a number of entry spots proportional to the value deposited. The Fortune contract relies on a few external oracles: Chainlink for fair randomness, Reservoir for ERC-721 pricing data and Uniswap for ERC-20 pricing data.
The benefits of onchain gaming applications like Fortune include several aspects, but primarily 2 major benefits stand out: first, by using Chainlink VRF, the ability to tamper with the outcome is nearly impossible - leading to more fair and transparent games accessible to anyone with an internet connection across the world. Second, by deploying the game on a scaling solution such as Arbitrum; this makes the costs to enter and play the game significantly lower than using Ethereum Mainnet - meaning many more users to be reached through the game.
NOTE: All NFTs in a collection will be valued at the floor price of the collection; rarity is not accounted for.
1. How does the Fortune system handle participant deposits?
The value of each deposit from a participant is obtained either directly for ETH
or via one of the external oracles for ERC-20/ERC-721. Once the value is determined, it gets divided by the valuePerEntry
defined in the contract and the number of entries is then allocated to the depositor. This way, each depositor has a number of entries proportional to the total value of the assets deposited.
NOTE: All NFTs in a collection will be valued at the floor price of the collection; rarity is not accounted for.
2. How does a round completes?
A round completes when the time has elapsed and there are at least two participants, or when the maximum number of participants or deposits per round is reached; whichever occurs first.
3. How is the winner of a round selected?
The winner is selected based on a provably fair random number generated by the Chainlink oracle. This ensures that the drawing process is fair and resistant to manipulation.
For each request, Chainlink VRF generates a random values and cryptographic proof of how the value were determined. The proof is published and verified on-chain. This process ensures that results cannot be tampered with or manipulated by any single entity including oracle operators, validators, users, or smart contract developers.
The random number is used to select the winning entry, and the depositor associated with that entry is the winner of the round.
4. How does the Fortune drawing process ensure fairness?
The contract employs Chainlink's Verifiable Random Function (VRF) to generate a provably fair random number for a Fortune round draw. This ensures that the process is fair, transparent, and tamper-proof.
For more details, see the Chainlink VRF Documentation.
5. How does the contract interact with external oracles?
The Fortune contract relies on 3 external oracles:
The Chainlink oracle to request a provably fair random value.
The Reservoir oracle to validate the collection floor price for an ERC-721
.
The Uniswap oracle to get the price of an ERC-20
.
6. What is the lifecycle of a Fortune round?
A round starts in the Open
status, where it can accept new deposits. Once the cutoff time is reached, the round progresses to the Drawing
status while waiting for the Chainlink oracle to provide the randomness requested. Once Chainlink fulfills the request, the round moves to the Drawn
status and a winner is declared. If certain conditions aren't met, the round can be Cancelled
.
Reasons for a round being cancelled are:
There were less than two participants when the cutoff time was reached.
The randomness request sent to Chainlink has not been fulfilled within 1 day.
As soon as a round is completed (Drawn
) or cancelled (Cancelled
) a new one will start.
7. What happens if a round does not have enough participants within the expected time frame?
If a round doesn't reach at least 2 distinct participants within the cutoff time, the round will be cancelled.
8. What happens when a round is cancelled?
If a round is cancelled, the system will immediately start a new round. The depositors will be able to withdraw their deposits on any cancelled round. Reasons for a round being cancelled are:
There were less than two participants when the cutoff time was reached.
The randomness request sent to Chainlink has not been fulfilled within 1 day.
9. How is the price for an ERC-20 token determined?
An ERC-20 token price is determined by relying on the Uniswap oracle.
The Fortune contract requests the TWAP (time-weighted average price) from Uniswap.
10. How is the price for an ERC-721 token determined?
The asset’s price is determined by relying on the Reservoir oracle to validate the collection floor price on-chain. The necessary data can be retrieved via their API (see get collection floor with the configurations set to 1 day TWAP). Then the contract verifies the signature to ensure Reservoir provided the data and that the request is not expired (older than signatureValidityPeriod
).
NOTE: All NFTs in a collection will be valued at the floor price of the collection; rarity is not accounted for.
11. Are the prices fetched at each deposit?
The price will be fetched only when a collection or currency (tokenAddress
) is deposited for the first time. Then the same value will be used for the duration of the round if more of those assets are deposited.
12. Is the contract audited?
The NFTEarth Fortune smart contract is a fork of the YOLO contract deployed on Ethereum Mainnet by the team at LooksRare. Their contract has been audited by a reputable third-party auditor to ensure the highest level of safety and reliability. The audit assesses the contract for potential vulnerabilities and compliance with best practices in the blockchain industry.
Audit Report: