Giter VIP home page Giter VIP logo

bfp-market's Introduction

bfp-market

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, or audited.

You can find more details on the working model under docs/images.

Development

# Download and install repository
git clone [email protected]:davidvuong/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

bfp-market's People

Contributors

davidvuong avatar 0xjocke avatar jaredborders avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.