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:
[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
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.jsonCompiler Options
Specify Solidity Version
forge build --use 0.8.30Enable Optimizer
forge build --optimize --optimizer-runs 200Watch Mode
Automatically recompile on file changes:
forge build --watchClean and Rebuild
To force a fresh compilation:
forge clean
forge buildCheck Contract Sizes
Ensure your contracts are within the 24KB size limit:
forge build --sizesOutput shows each contract's size.