This is a Next.js project bootstrapped with create-next-app.
- Node.js (v18 or higher)
- Foundry (for smart contract development)
- Git
- A Web3 wallet (e.g., MetaMask) for testing
# Clone the repository
git clone <your-repo-url>
cd <your-repo-name>
# Update contract submodules
make update-contract-submodules# Install frontend dependencies
npm install
# or
yarn installCreate a .env.local file in the root directory:
cp .env.example .env.localIn a separate terminal, start Anvil (local Ethereum node):
make anvilThis will:
- Fork Gnosis Chain at the latest block
- Run on
http://localhost:8545 - Use chain ID
31337 - Mine blocks every 5 seconds
Keep this terminal running throughout your development session.
In another terminal, deploy the smart contracts to your local network:
make deployThis will:
- Compile the contracts
- Deploy them to your local Anvil instance
- Automatically update your
.env.localwith the deployed contract addresses
Default deployer account: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (Anvil's first account)
Add the local network to MetaMask:
- Network Name: Anvil Local
- RPC URL:
http://localhost:8545 - Chain ID:
31337 - Currency Symbol:
ETH
Import the default Anvil account for testing:
- Private Key:
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
pnpm run devOpen http://localhost:3000 to see your dApp.
If the contract submodules are out of date, update them and redeploy:
make update-contract-submodules
make anvil-reset
make deployIf you need a fresh state:
make anvil-resetThen redeploy:
make deployAnvil derives its block timestamps from your machine's system clock. To simulate future dates and test time-dependent contract logic, you need to manually set your machine's date and time to a future value.
To move time forward:
- Change your machine's system date/time to the desired future date.
- Mine a new block so Anvil picks up the new timestamp:
make mine- Verify the new timestamp:
make timestamp
⚠️ Important: Anvil only moves time forward. If you set your machine's clock back to the present (or any earlier time), Anvil will not reflect that change — it will continue using the last recorded timestamp. To work around this, always set your system clock to a time further in the future than the last block's timestamp, never backwards.
Typical workflow for time-based testing:
- Set system clock → future date (e.g. 30 days ahead)
make mineto produce a block at that timestamp- Interact with contracts as needed
- To advance further, set system clock to an even later date and repeat
To return to normal development, restart Anvil (make anvil-reset) after resetting your system clock — the reset will start a fresh chain anchored to the current block timestamp of the Gnosis fork.
make mine # Mine a single block
make timestamp # Show current block timestamp| Command | Description |
|---|---|
make anvil |
Start local blockchain (Gnosis fork) |
make deploy |
Deploy contracts and update .env.local |
make anvil-reset |
Reset blockchain to fresh state |
make update-contract-submodules |
Update contract dependencies |
make mine |
Mine a single block |
make timestamp |
Show current block timestamp |
To deploy with custom parameters:
make deploy \
RPC_URL=http://localhost:8545 \
PRIVATE_KEY=0x... \
ADMIN_ADDRESS=0x...Manually check the deployment file:
cat contracts/out/SAVING_CIRCLES_DEPLOYMENT.jsonThen run:
make update-envIf transactions fail with nonce errors after anvil-reset, restart MetaMask or clear its activity data for the local network.
If port 8545 or 3000 is already in use:
# For Anvil, stop the existing process
lsof -ti:8545 | xargs kill -9
# For Next.js, use a different port
npm run dev -- -p 3001