# Foundry Configuration for Hardhat Compatibility
# Based on: https://getfoundry.sh/config/hardhat/

[profile.default]
# Use Hardhat's directory structure
src = "contracts"
out = "out"  # Keep separate from Hardhat's artifacts to avoid conflicts
libs = ["node_modules", "lib"]
test = "test/foundry"
script = "script"
cache_path = "cache_forge"

# Enable FFI for OpenZeppelin Upgrades plugin
ffi = true
ast = true
build_info = true
extra_output = ["storageLayout"]
build_info_path = "out/build-info"

# Solidity compiler settings (match Hardhat)
solc_version = "0.8.28"
optimizer = true
optimizer_runs = 200
via_ir = false
evm_version = "cancun"

# File system permissions for OpenZeppelin plugin
fs_permissions = [{ access = "read", path = "out" }]

# Linked libraries (deployed on Celo Mainnet)
libraries = [
    "contracts/libraries/CustomVerifier.sol:CustomVerifier:0x9E66B82Da87309fAE1403078d498a069A30860c4",
    "node_modules/poseidon-solidity/PoseidonT3.sol:PoseidonT3:0xF134707a4C4a3a76b8410fC0294d620A7c341581"
]

# Celo mainnet and testnet RPC endpoints
[rpc_endpoints]
celo = "${CELO_RPC_URL}"
celo_alfajores = "https://alfajores-forno.celo-testnet.org"

# Etherscan API configuration for contract verification
[etherscan]
celo = { key = "${CELOSCAN_API_KEY}", url = "https://api.celoscan.io/api" }
celo_alfajores = { key = "${CELOSCAN_API_KEY}", url = "https://api-alfajores.celoscan.io/api" }

# Formatting settings
[fmt]
line_length = 120
tab_width = 4
bracket_spacing = true
int_types = "long"
multiline_func_header = "all"
quote_style = "double"
number_underscore = "thousands"
