@curvefi/llamalend-api 2.0.10 → 2.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@ export const ALIASES_ARBITRUM = lowerCaseValues({
25
25
  export const ALIASES_OPTIMISM = lowerCaseValues({
26
26
  "crv": "0x0994206dfE8De6Ec6920FF4D779B0d950605Fb53",
27
27
  "one_way_factory": "0x5EA8f3D674C70b020586933A0a5b250734798BeF",
28
- "one_way_factory_v2": "0x7E0D6AA94d342c8EaccCf30ff84911ea6b5d5C15",
28
+ "one_way_factory_v2": "0x68f33663b76874166Bf3C3cB2D7C117dFf38a262",
29
29
  "gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
30
30
  "gauge_factory_old": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
31
31
  "gauge_factory": "0x871fBD4E01012e2E8457346059e8C189d664DbA4",
@@ -65,7 +65,6 @@ export const getFactoryMarketDataV2 = (llamalend) => __awaiter(void 0, void 0, v
65
65
  const calls = [];
66
66
  for (let i = 0; i < markets_count; i++) {
67
67
  calls.push(createCall(factory, 'markets', [i]));
68
- calls.push(createCall(factory, 'names', [i]));
69
68
  }
70
69
  const res = yield llamalend.multicallProvider.all(calls);
71
70
  const names = [];
@@ -77,15 +76,14 @@ export const getFactoryMarketDataV2 = (llamalend) => __awaiter(void 0, void 0, v
77
76
  const monetary_policies = [];
78
77
  const gauges = [];
79
78
  for (let i = 0; i < markets_count; i++) {
80
- const marketData = res[i * 2];
81
- const name = res[(i * 2) + 1];
79
+ const marketData = res[i];
82
80
  vaults.push(marketData[0].toLowerCase());
83
81
  controllers.push(marketData[1].toLowerCase());
84
82
  amms.push(marketData[2].toLowerCase());
85
83
  collateral_tokens.push(marketData[3].toLowerCase());
86
84
  borrowed_tokens.push(marketData[4].toLowerCase());
87
85
  monetary_policies.push(marketData[6].toLowerCase());
88
- names.push(name);
86
+ names.push(''); // new factory does not give names, it's generated at the market creation level
89
87
  gauges.push(llamalend.constants.ZERO_ADDRESS);
90
88
  }
91
89
  return {
@@ -43,7 +43,7 @@ const registerMarkets = (llamalend, names, amms, controllers, borrowed_tokens, c
43
43
  llamalend.constants.DECIMALS[vaults[index]] = 18;
44
44
  llamalend.constants.DECIMALS[gauges[index]] = 18;
45
45
  const marketData = {
46
- name: names[index],
46
+ name: names[index] || `${COIN_DATA[collateral_tokens[index]].symbol}/${COIN_DATA[borrowed_tokens[index]].symbol}`,
47
47
  version: version,
48
48
  addresses: {
49
49
  amm: amms[index],
@@ -6,6 +6,7 @@ export interface IUserPosition {
6
6
  _borrowed: bigint;
7
7
  _debt: bigint;
8
8
  _N: bigint;
9
+ isSoftLiquidation: boolean;
9
10
  }>;
10
11
  userBandsBigInt: (address: string) => Promise<bigint[]>;
11
12
  userState: (address?: string) => Promise<{
@@ -13,6 +14,7 @@ export interface IUserPosition {
13
14
  borrowed: string;
14
15
  debt: string;
15
16
  N: string;
17
+ isSoftLiquidation: boolean;
16
18
  }>;
17
19
  userHealth: (full?: boolean, address?: string) => Promise<string>;
18
20
  userBands: (address?: string) => Promise<number[]>;
@@ -12,12 +12,14 @@ export declare class UserPositionModule implements IUserPosition {
12
12
  borrowed: string;
13
13
  debt: string;
14
14
  N: string;
15
+ isSoftLiquidation: boolean;
15
16
  }>;
16
17
  userStateBigInt(address?: string): Promise<{
17
18
  _collateral: bigint;
18
19
  _borrowed: bigint;
19
20
  _debt: bigint;
20
21
  _N: bigint;
22
+ isSoftLiquidation: boolean;
21
23
  }>;
22
24
  userHealth(full?: boolean, address?: string): Promise<string>;
23
25
  private _userBands;
@@ -38,12 +38,14 @@ export class UserPositionModule {
38
38
  borrowed: formatUnits(_borrowed, this.market.borrowed_token.decimals),
39
39
  debt: formatUnits(_debt, this.market.borrowed_token.decimals),
40
40
  N: formatUnits(_N, 0),
41
+ isSoftLiquidation: !!_debt && !!_borrowed,
41
42
  };
42
43
  });
43
44
  }
44
45
  userStateBigInt() {
45
46
  return __awaiter(this, arguments, void 0, function* (address = "") {
46
- return yield this._userState(address);
47
+ const state = yield this._userState(address);
48
+ return Object.assign(Object.assign({}, state), { isSoftLiquidation: !!state._debt && !!state._borrowed });
47
49
  });
48
50
  }
49
51
  userHealth() {
@@ -16,7 +16,7 @@ export class LoanV2Module extends LoanBaseModule {
16
16
  const contract = this.llamalend.contracts[this.market.addresses.controller].contract;
17
17
  const collateral = parseUnits(collateralAmount, this.market.collateral_token.decimals);
18
18
  const address = _getAddress.call(this.llamalend, '');
19
- const N = range ? BigInt(range) : null;
19
+ const N = BigInt(range || 0);
20
20
  return contract.max_borrowable(collateral, N, address, this.llamalend.constantOptions);
21
21
  });
22
22
  }
@@ -176,6 +176,7 @@ export declare class MintMarketTemplate {
176
176
  collateral: string;
177
177
  stablecoin: string;
178
178
  debt: string;
179
+ isSoftLiquidation: boolean;
179
180
  }>;
180
181
  userLoss(userAddress?: string): Promise<{
181
182
  deposited_collateral: string;
@@ -515,6 +515,7 @@ export class MintMarketTemplate {
515
515
  collateral: formatUnits(_collateral, this.collateralDecimals),
516
516
  stablecoin: formatUnits(_stablecoin),
517
517
  debt: formatUnits(_debt),
518
+ isSoftLiquidation: !!_debt && !!_stablecoin,
518
519
  };
519
520
  });
520
521
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/llamalend-api",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "JavaScript library for Curve Lending",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",