Synthetixio / bfp-market

swsteth <> 1x short eth. l1 perp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bfp-market

⚠️ IMPORTANT: ⚠️ This repository has been deprecated, and its market functionality has been merged into synthetix-v3. Users are recommended to refer to PR#2018 for details. Ongoing development will be exclusively in the synthetix-v3 repository, and users are advised to transition accordingly.

Welcome to bfp-market!

The big fucking freaking perp market (or just BFP-Market) is a perpetual swap market, leveraging the capabilities of Synthetix v3 as its underlying infrastructure. bfp-market inherits core features from v2x, such as dynamic funding rates, PD (Premium/Discount) adjusted market prices, and asynchronous hybrid oracle-based order executions through Pyth.

In addition to these features, it also introduces various enhancements, including multi-collateral support, improved dynamic keeper fees, user-adjustable keeper fees on order commitments, improved liquidations, a host of quality-of-life improvements, a strong emphasis on gas optimization (soon), and obviously built on Synthetix v3.

The primary use case of bfp-market is to create a hyper-stable perp derivative utilizing wstETH as collateral, allowing users to open a 1x wstETH short with minimal negative funding, completely on-chain.

Please caution as this project is still under active development, not yet released, currently undergoing audit.

Development

# Download and install repository
git clone git@github.com:synthetixio/bfp-market.git

# Install dependencies
yarn

# Install ipfs
#
# @see: https://docs.ipfs.tech/install/ipfs-desktop/

# Install anvil
#
# @see: https://github.com/foundry-rs/foundry/tree/master/anvil

# Configure cannon locally (use default prompts)
#
# @see: https://usecannon.com/docs
npx cannon setup

# Build using cannon.
yarn build

Running tests

The test environment is a composition of bootstrap function calls, tighly coupled with Synthetix. As such, much of the design choices follow that of Synthetix V3 for consistency. A base bootstrap() function is provided which does the following:

  • Invokes coreBootstrap from Synthetix to setup base Synthetix contracts
  • Creates a single staking pool with liquidity to back test markets
  • Generates TypeScript interfaces and aliases for test development
  • Registers and configures perp markets with the core system

All of these operates happen asynchronously in loosely chained before blocks. You can execute tests by:

Two primary differences to note in how tests are written in bfp-market is all tests defined in it blocks are isolated (ensured by the beforeEach(restore) rather than a before(restore)) and the use of generator functions and a mixture of realistic market parameters rather than hardcoded values as input data for each test.

yarn test

About

swsteth <> 1x short eth. l1 perp


Languages

Language:TypeScript 69.8%Language:Solidity 30.1%Language:Shell 0.0%