Skip to content

Tutorial project for compiling, testing, and deploying smart contracts on the Core Blockchain using Foundry.

Notifications You must be signed in to change notification settings

coredao-org/Core-Foundry-Kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Core - Foundry Starter Kit

This project demonstrates how to compile, deploy, and interact with smart contracts on the Core Blockchain using Foundry. It supports multiple Core networks, including Core Mainnet and Core Testnet2.

Recommended for developers building and testing smart contracts on Core Blockchain.

⚙️ Setup Instructions

1. Clone the Repository

git clone https://github.com/your-username/your-repository.git
cd your-repository

2. Install Foundry

Install Foundry on Unix-based systems:

curl -L https://foundry.paradigm.xyz | bash

Verify the Installation:

forge --version

Update Foundry:

foundryup

3. Configure Environment Variables

Create a .env file in the project root directory and add the following variables:

RPC_URL="https://rpc.test2.btcs.network"
PRIVATE_KEY="your_core_wallet_private_key"
CORESCAN_API_KEY="your_corescan_api_key"
API_URL="https://api.test2.btcs.network/api"

All the above configurations are specific to Core Testnet2. If you're deploying to a different network, please make sure to update the values accordingly.

Source the .env File

To make the environment variables available in your shell, run the following command:

source .env

⚠️ Important: Never expose your private key or commit the .env file to version control.


🛠 Foundry Commands

Compile Contracts

forge build

Run Tests

forge test

Deploy Contracts

Using forge create:

forge create --rpc-url $RPC_URL --private-key $PRIVATE_KEY src/YourContract.sol:YourContract --broadcast

Using Deployment Scripts:

forge script script/YourScript.s.sol:YourScript --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast

🔍 Contract Verification

Verify deployed contracts with CoreScan:

forge verify-contract 0xDeployedContractAddress YourContract --verifier-url $API_URL --api-key $CORESCAN_API_KEY --watch

🌐 Network Configuration

Example network configurations for Core Mainnet and Testnet2:

  • Mainnet:
    • RPC URL: https://rpc.coredao.org
    • Chain ID: 1116
    • API URL: https://openapi.coredao.org/api
  • Testnet2:
    • RPC URL: https://rpc.test2.btcs.network
    • Chain ID: 1114
    • API URL: https://api.test2.btcs.network/api

Update these values in your .env file as needed.


🧠 Compiler Notes

The EVM version and Solidity compiler settings for this project are configured in the foundry.toml file.

Default Configuration:

  • EVM Version: Shanghai

  • Solidity Version: 0.8.24

For Core Testnet1:

If you are using Core Testnet1, update the foundry.toml file as follows:

  • EVM Version: Paris

  • Solidity Version: 0.8.19

[profile.default]
evm_version = "paris"
solc_version = "0.8.19"

Ensure the settings match the network requirements to avoid compatibility issues.

📚 Resources


🛡 Disclaimer

This project is intended for educational and development purposes only. Always safeguard your private keys and avoid exposing sensitive credentials in your codebase or version control.

About

Tutorial project for compiling, testing, and deploying smart contracts on the Core Blockchain using Foundry.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published