RISE Logo-Light

Compiling Contracts

Compile smart contracts with Foundry for RISE

Compile your Solidity contracts using Foundry's forge build command.

Configuration

Configure the Solidity compiler in your foundry.toml:

foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc = "0.8.30"

# Optimizer settings
optimizer = true
optimizer_runs = 200

[rpc_endpoints]
rise = "https://testnet.riselabs.xyz"

[etherscan]
rise = { key = "", url = "https://explorer.testnet.riselabs.xyz/api" }

Compile

Run Build

Compile all contracts in the src/ directory:

forge build

Check Artifacts

Compilation generates artifacts in the out/ directory containing:

  • Contract ABI
  • Bytecode
  • Metadata

The compiled JSON files can be found at:

out/YourContract.sol/YourContract.json

Compiler Options

Specify Solidity Version

forge build --use 0.8.30

Enable Optimizer

forge build --optimize --optimizer-runs 200

Watch Mode

Automatically recompile on file changes:

forge build --watch

Clean and Rebuild

To force a fresh compilation:

forge clean
forge build

Check Contract Sizes

Ensure your contracts are within the 24KB size limit:

forge build --sizes

Output shows each contract's size.

Next Steps