@bonzolabs/liquidity-pool
v5.7.2
Published
Client Access Library for the Bonzo Liquidity Pool
Downloads
7
Maintainers
Readme
BONZO Liquidity Pool
Lightweight Access Library to Bonzo Liquidity Pool
This library provides utilities abstracting away some of the complexities involved with retrieving account information from the Bonzo Finance Lending pool. For example, a user can use this library to retrieve an lender or borrower’s balances for all tokens supported by the pool.
Installation
This library does not provide a user interface nor command line tool, the intention is to be utilized by other JavaScript projects. It can be added to a project using npm
package manger:
npm install @bonzolabs/liquidity-pool
Usage
After installation, an instance of a pool client can be created with the LiquidityPool.create()
method:
const pool = await LiquidityPool.create(getProvider(), getPoolAddress());
Where getProvider()
returns a ethers Provider object connecting the library to a JSON-RPC relay (such as hashio) and getPoolAddress()
returns the contract address of the Bonzo Liquidity Pool contract for the ledger the Provider is connected with.
After Creation, the pool client can query for an account’s reserve, aToken and debt token balances with the LendingPool.getBalances()
method:
let balances = await pool.getBalances(getAccountAddress());
Where getAccountAddress()
returns the address of the account in question.
Building
For build instructions, please visit our source github project: https://github.com/bonzo-labs/bonzo-utils.git