Skip to content

nathaniel1616/Foundry-Raffle

Repository files navigation

This is a smart contract lottery

it uses the verified random to declare the winner

user can enter raffle at a given time the raffle will end the random winner is calculated

some of the raffle contract has been deployed on Sepolia Testnet and Avalance Testnet .

Check them out

Requirement

To use this repo locally , you need to have the following installed on your machine

  • Foundry , foundry can be install using the documentation here
  • Git

installing dependencies

use the commannds in the MakeFile

$ make install

Remember to set your environment variable before deploying.

See .env.example to make your own .

Save your config in .env

deploying on anvil

$ make deploy

deploying on testnet , eg sepolia

$ make deploy --network sepolia


#### Foundry

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**

Foundry consists of:

-   **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
-   **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
-   **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
-   **Chisel**: Fast, utilitarian, and verbose solidity REPL.

## Documentation

https://book.getfoundry.sh/

## Usage

### Build

```shell
$ forge build

Test

$ forge test

Format

$ forge fmt

Gas Snapshots

$ forge snapshot

Anvil

$ anvil

Deploy

$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>