Reference

Contracts & Addresses

How addresses are recorded, where ABIs come from, and how the dApp loads configuration.

Address records

  • Deploy scripts write addresses into addresses.<env>.json at the repository root.
  • Ops scripts read these files to perform checks and diagnostics against the correct chain.
  • Commit address updates so the frontend can pick them up during the next deploy.

ABIs

  • Hardhat artifacts are exported to the dApp under src/abi/ using the provided script:
npm run compile  # at repo root (Hardhat)
node scripts/export-abi.js

Import ABIs as needed, for example import stageSaleAbi from '@/abi/BATACoinStageSale.json'.

Frontend config

The dApp loads contract addresses and the active chain via a small config helper:

export async function loadConfig() {
  return { chainId: 97, sale: '0x...', usdt: '0x...' } as const;
}

Update these values when deploying a new environment. The purchase flow reads this config to quote, approve and buy.

Networks

  • USDT must have 18 decimals for compatibility with the StageSale contract.
  • Ensure the dApp prompts a network switch to the required chain before interacting.