npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bzxnetwork/contracts

v0.4.9

Published

Smart contracts for the bZx protocol and external integrations

Downloads

34

Readme

bZx Smart Contracts Build Status Coverage Status

Overview

bZx Smart Contracts ecosystem is built around two things simple for understanding: Loan orders and Trade orders. Trade order is an order to exchange to move funds between users' accounts. Loan order is an order to the lending platform to take the lender's funds and provide the borrower with that funds directly or indirectly.

Key Smart Contracts

BZx (BZx.sol)

The entry point of the system. This interface is meant to used with the deployed BZxProxy contract (BZxProxy.sol) address.

// js example: 
var bZx = await BZx.at((await BZxProxy.deployed()).address);

Provides users with the abilities to use:

  • Order taking functions,
  • Trade placing functions,
  • Loan maintenance functions,
  • Loan health functions.

See also BZxProxy.sol contract.

The next foundational blocks in the ecosystem are top-level contracts modules that provide all needed interfaces to trade using loaned ERC20 tokens.

BZxOrderTaking.sol / BZxOrderTakingOnChain.sol

The key contract is BZxOrderTaking/BZxOrderTakingOnChain that manages order taking and allows users to

  • Take the order as trader,
  • Take the order as lender,
  • Cancel remaining (untaken) loan.

Dev notes: This smart contract is deployed and attached to the system as submodule of BZx and not designed to be used directly. Use BZx.sol and BZxProxy.sol instead.

BZxTradePlacing.sol / BZxTradePlacing0xV2.sol

The important smart contract that give the ability to trade using loaned funds:

  • Executes a 0x trade using loaned funds,
  • Executes a market order trade using the oracle contract specified in the loan referenced by loanOrderHash.

Dev notes: This smart contract is deployed and attached to the system as submodule of BZx and not designed to be used directly. Use BZx.sol and BZxProxy.sol instead.

BZxLoanHealth.sol

Functions that allow users to close loans, liquidate positions and other related stuff.

Dev notes: This smart contract is deployed and attached to the system as submodule of BZx and not designed to be used directly. Use BZx.sol and BZxProxy.sol instead.

BZxLoanMaintenance.sol

Collateral and profit management functions. Allows users to change amount of collaterals, allows the trader/lender to transfer ownership of the underlying assets in a position to another user and withdraw their profits.

Dev notes: This smart contract is deployed and attached to the system as submodule of BZx and not designed to be used directly. Use BZx.sol and BZxProxy.sol instead.

BZxOrderHistory.sol

Returns information about currently registered orders and loans in the system. Users (traders and lenders) can get their orders and loans by utilizing functions from this smart contract.

Dev notes: This smart contract is deployed and attached to the system as submodule of BZx and not designed to be used directly. Use BZx.sol and BZxProxy.sol instead.

BZxOracle.sol

The key contract is BZxOracle that provides logic for price discovery of ERC20 token pairs, and handle the trading of those pairs through an on-chain mechanism. Uses Kyber Network as a liquidity provider.

The oracle address should be specified in the loan order. See BZxOrderTaking::takeLoanOrder* and BZxTradePlacing::tradePositionWithOracle function for more details.

Other

OracleRegistry.sol

The contract which keeps track of all oracles registered in the system. Oracles added to the bZx network by decentralized governance.

Documention

https://bZxNetwork.github.io/bZx-monorepo/

How to build docs

  1. Make sure that node_modules are updated
yarn install
  1. Go to smart contracts folder
cd ./packages/contracts/
  1. Initialize doxity by installing node modules
cd ./scripts/doxity
npm i
  1. Go back to smart contracts folder and build the docs by running
./extra/generate_documentation_doxity.sh