Players can enter the raffle by paying in ETH and a random winner will be picked by chainlink nodes.
forge test
File | % Lines | % Statements | % Branches | % Funcs |
---|---|---|---|---|
script/DeployRaffle.s.sol | 100.00% (17/17) | 100.00% (21/21) | 50.00% (2/4) | 100.00% (1/1) |
src/Raffle.sol | 100.00% (36/36) | 100.00% (45/45) | 87.50% (7/8) | 100.00% (10/10) |
or
forge test --rpc-url <RPC_URL>
forge coverage
forge coverage --report debug > coverage.txt
- To generate lcov report
make generateTestReport
This will default to your local node. You need to have it running in another terminal in order for it to deploy.
make deployToAnvil
- Setup environment variables
- You'll want to set your
SEPOLIA_RPC_URL
in environment variables. You can add them to a.env
file, similar to what you see in.env.example
.
- Use wallet options to Encrypt Private Keys
Optionally, add your ETHERSCAN_API_KEY
if you want to verify your contract on Etherscan.
Head over to faucets.chain.link and get some testnet ETH. You should see the ETH show up in your metamask.
make deployToSepolia
This will setup a ChainlinkVRF Subscription for you. If you already have one, update it in the scripts/HelperConfig.s.sol
file. It will also automatically add your contract as a consumer.
-
Go to automation.chain.link and register a new upkeep. Choose
Custom logic
as your trigger mechanism for automation.
You can estimate how much gas things cost by running:
forge snapshot
And you'll see an output file called .gas-snapshot