2.0.69 • Published 22 days ago

@wildcatfi/wildcat-sdk v2.0.69

Weekly downloads
-
License
MIT
Repository
-
Last release
22 days ago

MarketController

Deploying markets

1. Get controller info for borrower

import { getController, MarketController, MarketParameters } from '@wildcatfi/wildcat-sdk';

const controller: MarketController = await getController(signer, borrower);

2. Get parameter constraints for new markets

controller.constraints: MarketParameterConstraints contains the min/max values of

  • annualInterestBips
  • delinquencyFeeBips
  • withdrawalBatchDuration
  • reserveRatioBips
  • delinquencyGracePeriod

If provided values are out of this range, market deployment will revert.

3. Deploying a mock token for new market

import { deployToken } from "@wildcatfi/wildcat-sdk";

await deployToken(signer, 'name', 'symbol')

4. Deploying new market

const marketParameters: MarketParameters = {...}

// 1. Ensure borrower is registered on the arch-controller.
// For the testnet deployment, anyone can register a borrower
if (!controller.isRegisteredBorrower) {
  await controller.registerBorrower()
}
// 2. Ensure the `asset, namePrefix, symbolPrefix` are unique.
if (controller.getExistingMarketForParameters(marketParameters)) {
  throw Error()
}
// 3. Deploy market
const market: Market = await controller.deployMarket(marketParameters);

Market

Get market instances

1. Get all Market instances on Wildcat

import { getAllMarkets } from '@wildcatfi/wildcat-sdk';

const markets = getAllMarkets(provider);

2. Get all Market instances for borrower

const controller: MarketController = await getController(signer, borrower);
// controller.markets has an array of all Market instances for the controller

MarketAccount

Get MarketAccount

1. Get MarketAccount for every market

import { getAllMarketAccountsForLender } from '@wildcatfi/wildcat-sdk';
const accounts = await getAllMarketAccountsForLender(signer, lenderAddress);

Deposit

1. Get underlying assets from mock token

if (market.underlyingToken.isMock) {
  await market.underlyingToken.faucet();
}
2.0.69

22 days ago

2.0.68

2 months ago

2.0.66

2 months ago

2.0.67

2 months ago

2.0.64

2 months ago

2.0.65

2 months ago

2.0.63

2 months ago

2.0.59

3 months ago

2.0.58

3 months ago

2.0.62

3 months ago

2.0.60

3 months ago

2.0.61

3 months ago

2.0.57

3 months ago

2.0.56

4 months ago

2.0.55

4 months ago

2.0.54

4 months ago

2.0.53

4 months ago

2.0.52

4 months ago

2.0.51

4 months ago

2.0.49

5 months ago

2.0.50

5 months ago

2.0.48

5 months ago

2.0.47

5 months ago

2.0.46

5 months ago

2.0.37

5 months ago

2.0.38

5 months ago

2.0.39

5 months ago

2.0.44

5 months ago

2.0.45

5 months ago

2.0.42

5 months ago

2.0.43

5 months ago

2.0.40

5 months ago

2.0.41

5 months ago

2.0.36

5 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

2.0.28

6 months ago

1.0.4

11 months ago

2.0.29

6 months ago

1.0.3

11 months ago

2.0.3

6 months ago

2.0.2

7 months ago

2.0.35

6 months ago

2.0.5

6 months ago

2.0.4

6 months ago

2.0.33

6 months ago

2.0.7

6 months ago

2.0.34

6 months ago

2.0.6

6 months ago

2.0.9

6 months ago

2.0.32

6 months ago

2.0.30

6 months ago

2.0.1

7 months ago

2.0.0

7 months ago

2.0.15

6 months ago

2.0.16

6 months ago

2.0.13

6 months ago

2.0.14

6 months ago

2.0.11

6 months ago

2.0.12

6 months ago

2.0.10

6 months ago

2.0.19

6 months ago

2.0.17

6 months ago

2.0.18

6 months ago

2.0.26

6 months ago

2.0.27

6 months ago

2.0.24

6 months ago

2.0.25

6 months ago

2.0.22

6 months ago

2.0.23

6 months ago

2.0.20

6 months ago

2.0.21

6 months ago

1.0.11

10 months ago

1.0.10

10 months ago

1.0.15

10 months ago

1.0.14

10 months ago

1.0.13

10 months ago

1.0.12

10 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago