@curvefi/llamalend-api 2.0.11 → 2.0.13

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.
@@ -29,7 +29,7 @@ export const ALIASES_ARBITRUM = lowerCaseValues({
29
29
  export const ALIASES_OPTIMISM = lowerCaseValues({
30
30
  "crv": "0x0994206dfE8De6Ec6920FF4D779B0d950605Fb53",
31
31
  "one_way_factory": "0x5EA8f3D674C70b020586933A0a5b250734798BeF",
32
- "one_way_factory_v2": "0x7E0D6AA94d342c8EaccCf30ff84911ea6b5d5C15",
32
+ "one_way_factory_v2": "0x68f33663b76874166Bf3C3cB2D7C117dFf38a262",
33
33
  "gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
34
34
  "gauge_factory_old": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
35
35
  "gauge_factory": "0x871fBD4E01012e2E8457346059e8C189d664DbA4",
@@ -163,6 +163,7 @@ export class LendMarketTemplate<V extends 'v1' | 'v2' = 'v1' | 'v2'> {
163
163
  userBoost: userPosition.userBoost.bind(userPosition),
164
164
  forceUpdateUserState: userPosition.forceUpdateUserState.bind(userPosition),
165
165
  getCurrentLeverageParams: userPosition.getCurrentLeverageParams.bind(userPosition),
166
+ clearCache: userPosition.clearCache.bind(userPosition),
166
167
  }
167
168
 
168
169
  this.stats = {
@@ -72,7 +72,6 @@ export const getFactoryMarketDataV2 = async (llamalend: Llamalend) => {
72
72
 
73
73
  for (let i = 0; i < markets_count; i++) {
74
74
  calls.push(createCall(factory, 'markets', [i]));
75
- calls.push(createCall(factory, 'names', [i]));
76
75
  }
77
76
 
78
77
  const res = await llamalend.multicallProvider.all(calls);
@@ -87,8 +86,7 @@ export const getFactoryMarketDataV2 = async (llamalend: Llamalend) => {
87
86
  const gauges: string[] = [];
88
87
 
89
88
  for (let i = 0; i < markets_count; i++) {
90
- const marketData = res[i * 2] as any;
91
- const name = res[(i * 2) + 1] as string;
89
+ const marketData = res[i] as any;
92
90
 
93
91
  vaults.push(marketData[0].toLowerCase());
94
92
  controllers.push(marketData[1].toLowerCase());
@@ -96,7 +94,7 @@ export const getFactoryMarketDataV2 = async (llamalend: Llamalend) => {
96
94
  collateral_tokens.push(marketData[3].toLowerCase());
97
95
  borrowed_tokens.push(marketData[4].toLowerCase());
98
96
  monetary_policies.push(marketData[6].toLowerCase());
99
- names.push(name);
97
+ names.push(''); // new factory does not give names, it's generated at the market creation level
100
98
  gauges.push(llamalend.constants.ZERO_ADDRESS);
101
99
  }
102
100
 
@@ -52,7 +52,7 @@ const registerMarkets = (
52
52
  llamalend.constants.DECIMALS[gauges[index]] = 18;
53
53
 
54
54
  const marketData = {
55
- name: names[index],
55
+ name: names[index] || `${COIN_DATA[collateral_tokens[index]].symbol}/${COIN_DATA[borrowed_tokens[index]].symbol}`,
56
56
  version: version,
57
57
  addresses: {
58
58
  amm: amms[index],
@@ -21,4 +21,5 @@ export interface IUserPosition {
21
21
  userBoost: (address?: string) => Promise<string>,
22
22
  forceUpdateUserState: (newTx: string, userAddress?: string) => Promise<void>,
23
23
  getCurrentLeverageParams: (userAddress: string) => Promise<{ stateCollateral: string, totalDepositFromUser: string }>,
24
+ clearCache: () => void,
24
25
  }
@@ -231,6 +231,9 @@ export class UserPositionModule implements IUserPosition {
231
231
  };
232
232
  }
233
233
 
234
+ /** Clears the user position cache for the current user. */
235
+ public clearCache = (): void => this._userState.clear();
236
+
234
237
  public async forceUpdateUserState(newTx: string, userAddress?: string): Promise<void> {
235
238
  const address = userAddress || this.llamalend.signerAddress;
236
239
  if (!address) throw Error("Need to connect wallet or pass address into args");
@@ -68,7 +68,7 @@ export class LoanV2Module extends LoanBaseModule implements ILoanV2 {
68
68
  const contract = this.llamalend.contracts[this.market.addresses.controller].contract;
69
69
  const collateral = parseUnits(collateralAmount, this.market.collateral_token.decimals)
70
70
  const address = _getAddress.call(this.llamalend, '');
71
- const N = range ? BigInt(range) : null;
71
+ const N = BigInt(range || 0);
72
72
 
73
73
  return contract.max_borrowable(collateral, N, address, this.llamalend.constantOptions);
74
74
  }