@1delta/calldatalib 0.0.49 → 0.0.52

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.
@@ -57,13 +57,16 @@ exports.encodeFlashLoan = encodeFlashLoan;
57
57
  exports.encodeUint8AndBytes = encodeUint8AndBytes;
58
58
  exports.encodeMorphoMarket = encodeMorphoMarket;
59
59
  exports.encodeMorphoDepositCollateral = encodeMorphoDepositCollateral;
60
+ exports.encodeListaSupplyCollateralViaProvider = encodeListaSupplyCollateralViaProvider;
60
61
  exports.encodeMorphoDeposit = encodeMorphoDeposit;
61
62
  exports.encodeErc4626Deposit = encodeErc4626Deposit;
62
63
  exports.encodeErc4646Withdraw = encodeErc4646Withdraw;
63
64
  exports.encodeMorphoWithdraw = encodeMorphoWithdraw;
64
65
  exports.encodeMorphoWithdrawCollateral = encodeMorphoWithdrawCollateral;
66
+ exports.encodeListaWithdrawCollateralViaProvider = encodeListaWithdrawCollateralViaProvider;
65
67
  exports.encodeMorphoBorrow = encodeMorphoBorrow;
66
68
  exports.encodeMorphoRepay = encodeMorphoRepay;
69
+ exports.encodeListaRepayViaProvider = encodeListaRepayViaProvider;
67
70
  exports.encodeAaveDeposit = encodeAaveDeposit;
68
71
  exports.encodeAaveBorrow = encodeAaveBorrow;
69
72
  exports.encodeAaveRepay = encodeAaveRepay;
@@ -191,8 +194,10 @@ var CompoundV2Selector;
191
194
  (function (CompoundV2Selector) {
192
195
  CompoundV2Selector[CompoundV2Selector["MINT_BEHALF"] = 0] = "MINT_BEHALF";
193
196
  CompoundV2Selector[CompoundV2Selector["MINT"] = 1] = "MINT";
197
+ CompoundV2Selector[CompoundV2Selector["MINT_ITOKEN"] = 2] = "MINT_ITOKEN";
194
198
  CompoundV2Selector[CompoundV2Selector["REDEEM"] = 0] = "REDEEM";
195
199
  CompoundV2Selector[CompoundV2Selector["REDEEM_BEHALF"] = 1] = "REDEEM_BEHALF";
200
+ CompoundV2Selector[CompoundV2Selector["REDEEM_ITOKEN"] = 2] = "REDEEM_ITOKEN";
196
201
  })(CompoundV2Selector || (exports.CompoundV2Selector = CompoundV2Selector = {}));
197
202
  var SiloV2CollateralType;
198
203
  (function (SiloV2CollateralType) {
@@ -711,6 +716,19 @@ function encodeMorphoDepositCollateral(market, assets, receiver, data, morphoB,
711
716
  data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
712
717
  ]);
713
718
  }
719
+ function encodeListaSupplyCollateralViaProvider(market, assets, receiver, data, provider, pId) {
720
+ return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
721
+ (0, utils_js_1.uint8)(ComposerCommands.LENDING),
722
+ (0, utils_js_1.uint8)(LenderOps.DEPOSIT),
723
+ (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO - 1),
724
+ market,
725
+ (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), false, true),
726
+ receiver,
727
+ provider,
728
+ (0, utils_js_1.uint16)(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0),
729
+ data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
730
+ ]);
731
+ }
714
732
  function encodeMorphoDeposit(market, isShares, assets, receiver, data, morphoB, pId) {
715
733
  return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
716
734
  encodeApprove((0, utils_js_1.getMorphoLoanAsset)(market), morphoB),
@@ -767,6 +785,17 @@ function encodeMorphoWithdrawCollateral(market, assets, receiver, morphoB) {
767
785
  morphoB,
768
786
  ]);
769
787
  }
788
+ function encodeListaWithdrawCollateralViaProvider(market, assets, receiver, provider) {
789
+ return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address"], [
790
+ (0, utils_js_1.uint8)(ComposerCommands.LENDING),
791
+ (0, utils_js_1.uint8)(LenderOps.WITHDRAW),
792
+ (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO - 1),
793
+ market,
794
+ (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), false, true),
795
+ receiver,
796
+ provider,
797
+ ]);
798
+ }
770
799
  function encodeMorphoBorrow(market, isShares, assets, receiver, morphoB) {
771
800
  return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address"], [
772
801
  (0, utils_js_1.uint8)(ComposerCommands.LENDING),
@@ -792,6 +821,19 @@ function encodeMorphoRepay(market, isShares, assets, receiver, data, morphoB, pI
792
821
  data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
793
822
  ]);
794
823
  }
824
+ function encodeListaRepayViaProvider(market, isShares, assets, receiver, data, morphoB, pId) {
825
+ return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
826
+ (0, utils_js_1.uint8)(ComposerCommands.LENDING),
827
+ (0, utils_js_1.uint8)(LenderOps.REPAY),
828
+ (0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO - 1),
829
+ market,
830
+ (0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), isShares, true),
831
+ receiver,
832
+ morphoB,
833
+ (0, utils_js_1.uint16)(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0),
834
+ data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
835
+ ]);
836
+ }
795
837
  function encodeAaveDeposit(token, amount, receiver, pool) {
796
838
  return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
797
839
  encodeApprove(token, pool),
@@ -105,8 +105,10 @@ export var CompoundV2Selector;
105
105
  (function (CompoundV2Selector) {
106
106
  CompoundV2Selector[CompoundV2Selector["MINT_BEHALF"] = 0] = "MINT_BEHALF";
107
107
  CompoundV2Selector[CompoundV2Selector["MINT"] = 1] = "MINT";
108
+ CompoundV2Selector[CompoundV2Selector["MINT_ITOKEN"] = 2] = "MINT_ITOKEN";
108
109
  CompoundV2Selector[CompoundV2Selector["REDEEM"] = 0] = "REDEEM";
109
110
  CompoundV2Selector[CompoundV2Selector["REDEEM_BEHALF"] = 1] = "REDEEM_BEHALF";
111
+ CompoundV2Selector[CompoundV2Selector["REDEEM_ITOKEN"] = 2] = "REDEEM_ITOKEN";
110
112
  })(CompoundV2Selector || (CompoundV2Selector = {}));
111
113
  export var SiloV2CollateralType;
112
114
  (function (SiloV2CollateralType) {
@@ -625,6 +627,19 @@ export function encodeMorphoDepositCollateral(market, assets, receiver, data, mo
625
627
  data.length / 2 - 1 === 0 ? newbytes(0) : encodeUint8AndBytes(uint8(pId), data),
626
628
  ]);
627
629
  }
630
+ export function encodeListaSupplyCollateralViaProvider(market, assets, receiver, data, provider, pId) {
631
+ return encodePacked(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
632
+ uint8(ComposerCommands.LENDING),
633
+ uint8(LenderOps.DEPOSIT),
634
+ uint16(LenderIds.UP_TO_MORPHO - 1),
635
+ market,
636
+ generateAmountBitmap(uint128(assets), false, true),
637
+ receiver,
638
+ provider,
639
+ uint16(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0),
640
+ data.length / 2 - 1 === 0 ? newbytes(0) : encodeUint8AndBytes(uint8(pId), data),
641
+ ]);
642
+ }
628
643
  export function encodeMorphoDeposit(market, isShares, assets, receiver, data, morphoB, pId) {
629
644
  return encodePacked(["bytes", "uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
630
645
  encodeApprove(getMorphoLoanAsset(market), morphoB),
@@ -681,6 +696,17 @@ export function encodeMorphoWithdrawCollateral(market, assets, receiver, morphoB
681
696
  morphoB,
682
697
  ]);
683
698
  }
699
+ export function encodeListaWithdrawCollateralViaProvider(market, assets, receiver, provider) {
700
+ return encodePacked(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address"], [
701
+ uint8(ComposerCommands.LENDING),
702
+ uint8(LenderOps.WITHDRAW),
703
+ uint16(LenderIds.UP_TO_MORPHO - 1),
704
+ market,
705
+ generateAmountBitmap(uint128(assets), false, true),
706
+ receiver,
707
+ provider,
708
+ ]);
709
+ }
684
710
  export function encodeMorphoBorrow(market, isShares, assets, receiver, morphoB) {
685
711
  return encodePacked(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address"], [
686
712
  uint8(ComposerCommands.LENDING),
@@ -706,6 +732,19 @@ export function encodeMorphoRepay(market, isShares, assets, receiver, data, morp
706
732
  data.length / 2 - 1 === 0 ? newbytes(0) : encodeUint8AndBytes(uint8(pId), data),
707
733
  ]);
708
734
  }
735
+ export function encodeListaRepayViaProvider(market, isShares, assets, receiver, data, morphoB, pId) {
736
+ return encodePacked(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
737
+ uint8(ComposerCommands.LENDING),
738
+ uint8(LenderOps.REPAY),
739
+ uint16(LenderIds.UP_TO_MORPHO - 1),
740
+ market,
741
+ generateAmountBitmap(uint128(assets), isShares, true),
742
+ receiver,
743
+ morphoB,
744
+ uint16(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0),
745
+ data.length / 2 - 1 === 0 ? newbytes(0) : encodeUint8AndBytes(uint8(pId), data),
746
+ ]);
747
+ }
709
748
  export function encodeAaveDeposit(token, amount, receiver, pool) {
710
749
  return encodePacked(["bytes", "uint8", "uint8", "uint16", "address", "uint128", "address", "address"], [
711
750
  encodeApprove(token, pool),
@@ -89,8 +89,10 @@ export declare enum BridgeIds {
89
89
  export declare enum CompoundV2Selector {
90
90
  MINT_BEHALF = 0,
91
91
  MINT = 1,
92
+ MINT_ITOKEN = 2,
92
93
  REDEEM = 0,
93
- REDEEM_BEHALF = 1
94
+ REDEEM_BEHALF = 1,
95
+ REDEEM_ITOKEN = 2
94
96
  }
95
97
  export declare enum SiloV2CollateralType {
96
98
  PROTECTED = 0,
@@ -181,13 +183,16 @@ export declare function encodeFlashLoan(asset: Address, amount: bigint, pool: Ad
181
183
  export declare function encodeUint8AndBytes(poolId: number, data: Hex): Hex;
182
184
  export declare function encodeMorphoMarket(loanToken: Address, collateralToken: Address, oracle: Address, irm: Address, lltv: bigint): Hex;
183
185
  export declare function encodeMorphoDepositCollateral(market: Hex, assets: bigint, receiver: Address, data: Hex, morphoB: Address, pId: bigint): Hex;
186
+ export declare function encodeListaSupplyCollateralViaProvider(market: Hex, assets: bigint, receiver: Address, data: Hex, provider: Address, pId: bigint): Hex;
184
187
  export declare function encodeMorphoDeposit(market: Hex, isShares: boolean, assets: bigint, receiver: Address, data: Hex, morphoB: Address, pId: bigint): Hex;
185
188
  export declare function encodeErc4626Deposit(asset: Address, vault: Address, isShares: boolean, assets: bigint, receiver: Address): Hex;
186
189
  export declare function encodeErc4646Withdraw(vault: Address, isShares: boolean, assets: bigint, receiver: Address): Hex;
187
190
  export declare function encodeMorphoWithdraw(market: Hex, isShares: boolean, assets: bigint, receiver: Address, morphoB: Address): Hex;
188
191
  export declare function encodeMorphoWithdrawCollateral(market: Hex, assets: bigint, receiver: Address, morphoB: Address): Hex;
192
+ export declare function encodeListaWithdrawCollateralViaProvider(market: Hex, assets: bigint, receiver: Address, provider: Address): Hex;
189
193
  export declare function encodeMorphoBorrow(market: Hex, isShares: boolean, assets: bigint, receiver: Address, morphoB: Address): Hex;
190
194
  export declare function encodeMorphoRepay(market: Hex, isShares: boolean, assets: bigint, receiver: Address, data: Hex, morphoB: Address, pId: bigint): Hex;
195
+ export declare function encodeListaRepayViaProvider(market: Hex, isShares: boolean, assets: bigint, receiver: Address, data: Hex, morphoB: Address, pId: bigint): Hex;
191
196
  export declare function encodeAaveDeposit(token: Address, amount: bigint, receiver: Address, pool: Address): Hex;
192
197
  export declare function encodeAaveBorrow(token: Address, amount: bigint, receiver: Address, mode: bigint, pool: Address): Hex;
193
198
  export declare function encodeAaveRepay(token: Address, amount: bigint, receiver: Address, mode: bigint, dToken: Address, pool: Address): Hex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1delta/calldatalib",
3
- "version": "0.0.49",
3
+ "version": "0.0.52",
4
4
  "description": "Generated CalldataLib TypeScript functions for 1delta smart contracts",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",