Skip to content

BrownFi/v3-core

Repository files navigation

v3-core

Core smart contracts for the BrownFi V3 protocol — an oracle-based AMM with asymmetric liquidity depth, dynamic bid-ask spread, and configurable fees. V3 evolves from V1 (Verichain-audited) and V2 (Certik-audited) to reduce delta risk, limit rebalancing incentives, and react to market volatility.

Key features

  • Asymmetric pools with a distinct base/quote token, separate Kappa_base / Kappa_quote for buy/sell liquidity concentration, and direction-dependent bid-ask spread.
  • Dual oracle aggregation (Pyth + AMM) with min/max price selection and a TVL-gated pool inclusion rule.
  • Dynamic fees and spread driven by pool skew, price discrepancy, and volatility, bounded by on-chain constraints.
  • Permissioned pool creation and separated admin roles via access manager and timelock controller.

Contracts

File Purpose
BrownFiV3Factory.sol Permissioned deployment of pair contracts via CREATE2.
BrownFiV3Pair.sol Core swap, mint, and burn logic for a base/quote pool.
BrownFiV3PairConfig.sol Per-pool configurable parameters (Kappa, fees, spread, skew, thresholds).
BrownFiV3ERC20.sol LP share token.
adapters/PythPriceOracleV3.sol Oracle adapter combining Pyth and AMM prices.
helper/BrownFiV3AccessManager.sol Role-based admin access.
helper/BrownFiV3TimelockController.sol Timelocked governance actions.
libraries/ Math and SafeMath helpers.

Development

Requirements: Node.js 18+, npm.

npm install
npm run compile   # hardhat compile
npm test          # hardhat test
npm run coverage  # hardhat coverage, writes coverage/ and coverage.json
npm run clean     # remove build, cache, artifacts

Configure networks and keys via .env (see hardhat.config.ts): ARB_SEPOLIA_RPC_URL, PRIVATE_KEY.

Solidity 0.8.28 with viaIR and optimizer enabled (999,999 runs; 200 for Factory and Pair to stay under EIP-170 and avoid stack-too-deep).

License

Business Source License 1.1 — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors