Repository navigation
feat: Base Sepolia internal funding and controlled test USDC - #46
Merged
Merged
Conversation
Additive Base Sepolia support for the machine funding server, behind INTERNAL_FUNDING_BASE_ENABLED. Existing Seismic routes, budgets, ledger keys, and deployment commands are unchanged. - BaseChainDriver: standard EVM (EIP-1559) driver where the dedicated reserve key sends native ETH gas drips and plain ERC20 USDC transfers; startup preflight checks chain id, signer/address match, token code, six decimals, and both reserves against configured floors - routes POST /api/internal/base/gas, POST /api/internal/base/erc20-usdc/ transfers, GET /api/internal/base/readiness (503 reserve_low below either floor); same bearer auth, Redis idempotency, budgets, rate limits - every Base ledger key is scoped to asset + chain id + token + reserve - refuses a Base key that reuses a Seismic funding key unless explicitly approved via INTERNAL_FUNDING_BASE_ALLOW_SHARED_KEY - DeployBaseTestnetUSDC.s.sol deploys the six-decimal TestnetUSDC on Base and mints the initial supply into the reserve; deploy_base_erc20_usdc_ contract alias records the returned address and runs --check-base - risk register: Base section
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Faucet counterpart to the sandbox Stage 1 rollout (Base Sepolia + standard ERC20 test USDC + native ETH gas). Everything here is additive: Seismic funding endpoints, budgets, ledger keys, and deployment commands are unchanged.
Summary
BaseChainDriver: standard EVM (EIP-1559) driver. The dedicated Base reserve key sends native ETH gas drips and plain ERC20 USDC transfers directly; there is no faucet contract on Base. Transactions are signed locally and persisted before broadcast, same as the Seismic driver.--check-base): RPC chain id equalsBASE_CHAIN_ID, signer matchesINTERNAL_FUNDING_BASE_ADDRESS, token has code and six decimals, native ETH and ERC20 reserves are at or above their configured floors.POST /api/internal/base/gas(fixedINTERNAL_FUNDING_BASE_GAS_ETH_AMOUNT)POST /api/internal/base/erc20-usdc/transfersGET /api/internal/base/readiness(reports both reserve balances;503 reserve_lowbelow either floor)INTERNAL_FUNDING_BASE_ALLOW_SHARED_KEY=trueis set with explicit approval.contracts/script/DeployBaseTestnetUSDC.s.soldeploys the six-decimalTestnetUSDCon Base Sepolia and mints the initial supply into the reserve; the deployer keeps mint authority.deploy_base_erc20_usdc_contractrecords the returned token address into the env file and runs the preflight. Integrations must read that address from configuration, never hardcode it.Configuration (no values)
INTERNAL_FUNDING_BASE_ENABLED,BASE_RPC_URL,BASE_CHAIN_ID,INTERNAL_FUNDING_BASE_PRIVATE_KEY,INTERNAL_FUNDING_BASE_ADDRESS,BASE_ERC20_USDC_TOKEN_ADDRESS,INTERNAL_FUNDING_BASE_GAS_ETH_AMOUNT(wei),INTERNAL_FUNDING_MAX_BASE_ERC20_USDC_AMOUNT,INTERNAL_FUNDING_GLOBAL_BASE_GAS_ETH_BUDGET(wei),INTERNAL_FUNDING_GLOBAL_BASE_ERC20_USDC_BUDGET, optionalINTERNAL_FUNDING_BASE_ETH_RESERVE_FLOOR,INTERNAL_FUNDING_BASE_ERC20_USDC_RESERVE_FLOOR,INTERNAL_FUNDING_BASE_RATE_LIMIT,INTERNAL_FUNDING_BASE_RATE_WINDOW_SECONDS,INTERNAL_FUNDING_BASE_CONFIRMATIONS,INTERNAL_FUNDING_BASE_ALLOW_SHARED_KEY;BASE_DEPLOYER_PRIVATE_KEYandBASE_ERC20_USDC_INITIAL_RESERVE_SUPPLYfor the deploy script only. The human fundsINTERNAL_FUNDING_BASE_ADDRESSwith Base Sepolia ETH before deploying.Test plan
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --locked -- -D warnings,cargo test --workspace --locked(25 unit + 23 Redis integration),cargo build --workspace --release --lockedsforge fmt --check,sforge build,sforge test(34),bun run scripts/check-contract-abi.tsinsufficient funds) is a terminal 422 that never rebroadcasts; Base requests refused by a Seismic driver and vice versa; rotated deployment identity rejected; routes 401 unauthenticated and 404 when disabled; wire shape; amount limit; readiness diagnostic and503 reserve_lowNot included:
.env.machine-funding.examplewas not edited (tooling policy blocks reading env files); the variable list above is authoritative. Commit is unsigned: the signing key's agent refused from the automation shell.