This repository contains smart contracts built with Foundry, a blazing fast, portable and modular toolkit for Ethereum application development.
├── src/ # Source directory for smart contracts
│ ├── AgentContract.sol # Agent smart contract
│ └── StakeContract.sol # Staking smart contract
├── test/ # Test directory containing contract tests
│ ├── AgentContract.t.sol # Tests for Agent contract
│ └── StakeContract.t.sol # Tests for Stake contract
├── deploy/ # Deployment scripts
│ ├── Agent.s.sol # Script to deploy Agent contract
│ └── Stake.s.sol # Script to deploy Stake contract
└── lib/ # Dependencies (including forge-std)
- Foundry - Make sure you have Foundry installed
- Clone the repository:
git clone <repository-url>
cd solidity
- Install dependencies:
forge install
To compile the contracts:
forge build
Run all tests:
forge test
Run tests with verbosity (for more detailed output):
forge test -vvv
Run a specific test:
forge test --match-test testFunctionName
- Set up your environment variables:
Create a
.env
file and add your private key and RPC URL:
PRIVATE_KEY=your_private_key
RPC_URL=your_rpc_url
- Deploy contracts:
# Deploy to a local network
forge script script/Deploy.s.sol --rpc-url localhost
# Deploy to a specific network (e.g., Sepolia)
forge script script/Deploy.s.sol --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast
To verify your contract on Etherscan:
forge verify-contract <deployed-address> <contract-name> --chain <chain-id> --watch
forge build
: Compile contractsforge test
: Run testsforge coverage
: Generate coverage reportforge script
: Run deployment scriptsforge verify-contract
: Verify contracts on Etherscanforge clean
: Remove compiled artifactsforge snapshot
: Create gas snapshots