@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/.github/workflows/publish.yml +7 -14
- package/README.md +451 -1
- package/lib/constants/aliases.js +15 -0
- package/lib/interfaces.d.ts +11 -0
- package/lib/lendMarkets/LendMarketTemplate.d.ts +6 -3
- package/lib/lendMarkets/LendMarketTemplate.js +40 -1
- package/lib/lendMarkets/interfaces/leverageZapV2.d.ts +223 -0
- package/lib/lendMarkets/interfaces/leverageZapV2.js +1 -0
- package/lib/lendMarkets/modules/index.d.ts +1 -0
- package/lib/lendMarkets/modules/index.js +1 -0
- package/lib/lendMarkets/modules/leverageZapV2.d.ts +253 -0
- package/lib/lendMarkets/modules/leverageZapV2.js +681 -0
- package/lib/llamalend.js +1 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +5 -0
- package/package.json +2 -1
- package/src/cache/index.ts +1 -1
- package/src/constants/aliases.ts +15 -0
- package/src/external-api.ts +4 -4
- package/src/interfaces.ts +19 -0
- package/src/lendMarkets/LendMarketTemplate.ts +81 -32
- package/src/lendMarkets/interfaces/leverageZapV2.ts +282 -0
- package/src/lendMarkets/modules/index.ts +1 -0
- package/src/lendMarkets/modules/leverageZapV2.ts +991 -0
- package/src/llamalend.ts +1 -0
- package/src/utils.ts +12 -1
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
|
+
|