Deploy using Foundry
Foundry is a Solidity framework for deploying smart contracts, built by Paradigm and written in Rust to be blazingly fast.
Before you Begin
Check if you are using the right network configuration
Have enough test tokens in your wallet
Foundry Setup
Simply follow their "Getting Started" documentation to install and run Foundry, then follow their "Projects" documentation to create a new project.
Run the following commands in your terminal:
curl -L https://foundry.paradigm.xyz | bash
foundryup
Setup your project
To start a new project with Foundry, use forge init
:
forge init plume
Let's install the OpenZeppelin dependency required for our sample smart contract.
forge install openzeppelin/openzeppelin-contracts
Then, compile the project using forge build
:
forge build
[⠰] Compiling...
[⠔] Compiling 38 files with Solc 0.8.27
[⠒] Solc 0.8.27 finished in 1.01s
Compiler run successful!
Deploy your Contract
Follow the instructions on in the "Deploying" documentation and set your PLUME_RPC_URL
environment variable similar to the ETH RPC URL. The below command will deploy the sample smart contract provided above on Plume Testnet for instance.
export PLUME_RPC_URL=https://testnet-rpc.plume.org
export CONTRACT_PATH=<contract_file>:<contract_name>
forge create $CONTRACT_PATH \
--rpc-url $PLUME_RPC_URL \
--broadcast \
--legacy --interactive
The below command will verify the contract and deploy it simultaneously.
export PLUME_RPC_URL=https://testnet-rpc.plume.org
export VERIFIER_URL=https://testnet-explorer.plume.org/api/
export CONTRACT_PATH=<contract_file>:<contract_name>
forge create $CONTRACT_PATH \
--rpc-url $PLUME_RPC_URL \
--verify \
--verifier blockscout \
--verifier-url $VERIFIER_URL \
--broadcast \
--legacy --interactive
Make sure to replace the details in the <contract_file>:<contract_name>
with your contract details.
Sample Output
No files changed, compilation skipped
Enter private key:
Deployer: 0x32820DE739394C1ee69264ef3C0193E4B5C0122c
Deployed to: 0xa43a88ccfec87295aa0c5017a7ddcc5cdfcacdd0
Transaction hash: 0x1441297a9288fc37820a09e2e9b1d14d62b5d6341fd1e14159eabcedb7dfe115
You can view the deployed contract on the Plume Testnet Explorer.
Last updated