Learn how to compile your smart contracts using Foundry on Abstract.
Smart contracts must be compiled to Zksync VM-compatible bytecode using the zksolc compiler to prepare them for deployment on Abstract.
1
Configure foundry.toml
Update your foundry.toml file to include the following options:
Copy
[profile.default]src = 'src'libs = ['lib']fallback_oz = trueis_system = false # Note: NonceHolder and the ContractDeployer system contracts can only be called with a special is_system flag as truemode = "3"[etherscan]abstractTestnet = { chain = "11124", url = "https://api-sepolia.abscan.org/api", key = "TACK2D1RGYX9U7MC31SZWWQ7FCWRYQ96AD"}abstractMainnet = { chain = "2741", url = "https://api.abscan.org/api", key = ""}
2
Compile contracts
Compile your contracts using the following command:
Copy
forge build --zksync
This will generate the zkout directory containing the compiled smart contracts.