# Foundry Configuration
# This file configures Foundry for the project

[profile.default]
src = "contracts"
out = "out"
libs = ["lib"]
solc = "0.8.20"
optimizer = true
optimizer_runs = 200
via_ir = true
evm_version = "london"
remappings = [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "forge-std/=lib/forge-std/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "@emoney/=contracts/emoney/",
    "@emoney-scripts/=script/emoney/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
]

[profile.ci]
fuzz = { runs = 100 }
invariant = { runs = 10 }

[profile.lite]
optimizer = false
via_ir = false

[profile.fast]
optimizer = true
optimizer_runs = 1
via_ir = false

[profile.deploy]
optimizer = true
optimizer_runs = 100
via_ir = true

# RPC endpoints — use: forge create ... --rpc-url chain138
# Prevents default localhost:8545 when ETH_RPC_URL not set
[rpc_endpoints]
chain138 = "http://192.168.11.211:8545"
avalanche = "https://avalanche-c-chain.publicnode.com"
arbitrum = "https://arbitrum-one.publicnode.com"
cronos = "https://evm.cronos.org"

# Etherscan-compatible verification (Etherscan V2 API key works across many chains)
[etherscan]
avalanche = { key = "${SNOWTRACE_API_KEY:-${ETHERSCAN_API_KEY}}", url = "https://api.snowtrace.io/api" }
arbitrum = { key = "${ARBISCAN_API_KEY:-${ETHERSCAN_API_KEY}}", url = "https://api.arbiscan.io/api" }
# Cronos mainnet (chain 25). Etherscan-style API; chainid required for v2.
# API key from explorer.cronos.org/register (CRONOSCAN_API_KEY)
cronos = { key = "${CRONOSCAN_API_KEY:-${ETHERSCAN_API_KEY}}", url = "https://explorer-api.cronos.org/mainnet/api?chainid=25" }

