This project is based on the Foundry Smart Contract Lottery, part of the full Foundry course. For more details, you can visit the Foundry Full Course.
Alternatively, you can check the project website to learn more at: Updraft by Cyfrin
- Users can enter by paying for a ticket.
- The ticket fees are awarded to the winner during the draw.
- After a set period, the lottery will automatically draw a winner.
- This process will be done programmatically.
- Utilizing Chainlink VRF & Chainlink Automation:
- Chainlink VRF: Provides randomness.
- Chainlink Automation: Manages time-based scripts.
forge install smartcontractkit/chainlink-brownie-contracts@1.1.1 --no-commit
Chainlink Brownie Contracts Repository
Add remappings to foundry.toml
:
remappings = ["@chainlink/contracts/=lib/chainlink-brownie-contracts/contracts/"]
forge install transmissions11/solmate --no-commit
Add remappings:
"@solmate=lib/solmate/src/"
forge install Cyfrin/foundry-devops --no-commit
In test files, the function names to test should start with "testSomething":
testRaffleRevertNotEnoughEth
-> OKraffleRevertNotEnoughEth
-> KO
In previous versions of Forge (video), to choose a specific test function it appears like:
forge test -m $test_function_name
In the current Forge version (0.2.0) it should be:
forge test --mt $test_function_name
- Version
- Imports
- Errors
- Interfaces, Libraries, Contracts
- Type Declarations
- State Variables
- Events
- Modifiers
- Functions
- Constructor
- Receive function (if exists)
- Fallback function (if exists)
- External
- Public
- Internal
- Private
- View & Pure functions
- For functions -> CEI: Checks, Effects, Interaction
- For tests -> Arrange, Act, Assert