0.1.0-rc.6 • Published 1 year ago

@mclb/lending-api v0.1.0-rc.6

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Millenium Club Lending API

This API is the typechain for ethers with multicall bindings bundled together using EVMContractsRegistry

Features

  • Typescript typings
  • Contract addresses included
  • Multichain
  • Multicalls

How to use

install

yarn add @mclb/lending-api ethers @hovoh/ethcall

@hovoh/ethcall is a package for multicalls. If you're not using multicalls you don't need to install it.

Using the api

Initialise your ProvidersRegistry from EVMContractsRegistry and use the initMaiApi(providers: ProviderRegistry) to initialise the API.

import {providers} from "@hovoh/evmcontractsregistry";
import {initLendingClubApi, LendingClubApi} from "@mclb/lending-api";

const lcApi: LendingClubApi = initLendingClubApi(providers);

The LendingClubApi object has two NetworkContractsRegistry: 1. vaults has all the vaults 2. peripherals has all the other contracts. It also has the bindings to call arbitrary vaults.

Examples:

To query a vault (using multicalls):

        const [symbol, closingFee] = await vaults.forNetwork(Network.OPERA_MAINNET).multiCall((get) => [
            get("WFTMVault").symbol(),
            get("WFTMVault").closingFee()
        ])

To query vault available funds:

import {Network} from "@hovoh/evmcontractsregistry";
const wftmVault = lcApi.vaults.forNetwork(Network.OPERA_MAINNET)
    .getContractInstance("WFTMVault");
const maiBorrowAvailable = maiApi.peripherals.forNetwork(Network.OPERA_MAINNET).getContractInstance("mUSD").balanceOf(wftmVault.address)

Publishing

Publishing is done automatically via a Github Action every time the version in the package.json is increased.

0.1.0-rc.6

1 year ago

0.1.0-rc.5

1 year ago

0.1.0-rc.4

1 year ago

0.1.0-rc.3

1 year ago

0.1.0-rc.2

1 year ago

0.1.0-rc.1

1 year ago