@curvefi/llamalend-api 1.0.41 → 1.1.0

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.
package/src/llamalend.ts CHANGED
@@ -348,6 +348,7 @@ class Llamalend implements ILlamalend {
348
348
  this.setContract(this.constants.ALIASES['one_way_factory'], OneWayLendingFactoryABI);
349
349
  this.setContract(this.constants.ALIASES['gauge_controller'], GaugeControllerABI);
350
350
  this.setContract(this.constants.ALIASES['leverage_zap'], LeverageZapABI);
351
+ this.setContract(this.constants.ALIASES['leverage_zap_v2'], LeverageZapABI);
351
352
  if (this.chainId === 1) {
352
353
  this.setContract(this.constants.ALIASES.minter, MinterABI);
353
354
  this.setContract(this.constants.ALIASES.gauge_factory, GaugeFactoryMainnetABI);
package/src/utils.ts CHANGED
@@ -515,4 +515,15 @@ export const calculateFutureLeverage = (
515
515
  } else {
516
516
  return currentCollateralBN.minus(collateralBN).div(totalDepositBN.minus(collateralBN)).toString();
517
517
  }
518
- };
518
+ };
519
+
520
+ export const buildCalldataForLeverageZapV2 = (routerAddress: string, exchangeCalldata: string): string => {
521
+ const cleanCalldata = exchangeCalldata.startsWith('0x') ? exchangeCalldata.slice(2) : exchangeCalldata;
522
+
523
+ const abiCoder = ethers.AbiCoder.defaultAbiCoder();
524
+ return abiCoder.encode(
525
+ ['address', 'bytes'],
526
+ [routerAddress, '0x' + cleanCalldata]
527
+ );
528
+ };
529
+