Learn to Build Smart Contracts and Onchain Apps.
- Site: Base Docs
- Claim Roles: Base Learn
-
Software
Foundry Forge 0.2.0
- Foundry
- OpenZeppelin
-
First, you'll need to install Foundry. Run this command in your terminal
curl -L https://foundry.paradigm.xyz | bash -
Then run
foundryup
-
Clone base-learn Repository
git clone https://github.com/0xfas/base-learn.git -
Move to base-learn Repository
cd base-learn
-
Create a .env file
touch .env -
Edit .env file
BASE_MAINNET_RPC="https://mainnet.base.org" BASE_SEPOLIA_RPC="https://sepolia.base.org" BASESCAN_API_KEY="Your Base API Key" PRIVATE_KEY="Your Private Key" CHAIN="84532" -
Build Your Project
source .envforge build -
Run Tests
forge test
-
For Basic Deploy
forge create --rpc-url $BASE_SEPOLIA_RPC --private-key $PRIVATE_KEY <src/"Your Deploy Files":"Your Contract">Example:
forge create --rpc-url $BASE_SEPOLIA_RPC --private-key $PRIVATE_KEY src/BasicMath.sol:BasicMath -
For Deploy With Constructor Arguments
forge create --rpc-url $BASE_SEPOLIA_RPC --private-key $PRIVATE_KEY <src/"Your Deploy Files":"Your Contract"> --constructor-args "value 1" "value 2"Example:
forge create --rpc-url $BASE_SEPOLIA_RPC --private-key $PRIVATE_KEY src/EmployeeStorage.sol:EmployeeStorage --constructor-args 1000 Pat 50000 112358132134 -
For Basic Verify
forge verify-contract <Your Contract Address> --chain $CHAIN <src/"Your Deploy Files":"Your Contract">Example:
forge verify-contract 0xF1EaXXXXX --chain $CHAIN src/BasicMath.sol:BasicMath -
For Verify With Constructor Arguments
forge verify-contract <Your Contract Address> --chain $CHAIN <src/"Your Deploy Files":"Your Contract"> --constructor-args $(cast abi-encode "constructor(data type, data type)" "value 1" "value 2")Example:
forge verify-contract 0xF1EaXXXXX --chain $CHAIN src/EmployeeStorage.sol:EmployeeStorage --constructor-args $(cast abi-encode "constructor(uint16,string,uint32,uint256)" 1000 Pat 50000 112358132134)
-
Install The OpenZeppelin Library
forge install OpenZeppelin/openzeppelin-contracts -
Export a Remapping in Our Directory to Help Locate The Library
forge remappings > remappings.txt -
Flag Indicating Whether to Flatten The Source Code Before Verifying
--flatten -
Wait For Verification Result After Submission
--watch
➖ Telegram Channel: Airdrop Infinity
➖ Telegram Group: Airdrop Infinity Group
➖ X: 0xFAS
❤️ Thank You