Skip to content

d-agent/dagent-contracts

Repository files navigation

Solidity Smart Contracts Project

This repository contains smart contracts built with Foundry, a blazing fast, portable and modular toolkit for Ethereum application development.

Project Structure

├── 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)

Prerequisites

  • Foundry - Make sure you have Foundry installed

Getting Started

  1. Clone the repository:
git clone <repository-url>
cd solidity
  1. Install dependencies:
forge install

Building

To compile the contracts:

forge build

Testing

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

Deployment

  1. 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
  1. 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

Contract Verification

To verify your contract on Etherscan:

forge verify-contract <deployed-address> <contract-name> --chain <chain-id> --watch

Available Scripts

  • forge build: Compile contracts
  • forge test: Run tests
  • forge coverage: Generate coverage report
  • forge script: Run deployment scripts
  • forge verify-contract: Verify contracts on Etherscan
  • forge clean: Remove compiled artifacts
  • forge snapshot: Create gas snapshots

About

staking contract and agent contract.

Resources

License

Stars

Watchers

Forks