@1delta/calldatalib 0.0.46 → 0.0.51
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/dist/cjs/CalldataLib.js
CHANGED
|
@@ -49,6 +49,7 @@ exports.encodeNextGenDexSettleBalancer = encodeNextGenDexSettleBalancer;
|
|
|
49
49
|
exports.encodeTransferIn = encodeTransferIn;
|
|
50
50
|
exports.encodeSweep = encodeSweep;
|
|
51
51
|
exports.encodeWrap = encodeWrap;
|
|
52
|
+
exports.encodeWrapWithReceiver = encodeWrapWithReceiver;
|
|
52
53
|
exports.encodeApprove = encodeApprove;
|
|
53
54
|
exports.encodeUnwrap = encodeUnwrap;
|
|
54
55
|
exports.encodeBalancerV2FlashLoan = encodeBalancerV2FlashLoan;
|
|
@@ -56,8 +57,9 @@ exports.encodeFlashLoan = encodeFlashLoan;
|
|
|
56
57
|
exports.encodeUint8AndBytes = encodeUint8AndBytes;
|
|
57
58
|
exports.encodeMorphoMarket = encodeMorphoMarket;
|
|
58
59
|
exports.encodeMorphoDepositCollateral = encodeMorphoDepositCollateral;
|
|
60
|
+
exports.encodeListaSupplyCollateralViaProvider = encodeListaSupplyCollateralViaProvider;
|
|
59
61
|
exports.encodeMorphoDeposit = encodeMorphoDeposit;
|
|
60
|
-
exports.
|
|
62
|
+
exports.encodeErc4626Deposit = encodeErc4626Deposit;
|
|
61
63
|
exports.encodeErc4646Withdraw = encodeErc4646Withdraw;
|
|
62
64
|
exports.encodeMorphoWithdraw = encodeMorphoWithdraw;
|
|
63
65
|
exports.encodeMorphoWithdrawCollateral = encodeMorphoWithdrawCollateral;
|
|
@@ -117,6 +119,7 @@ var TransferIds;
|
|
|
117
119
|
TransferIds[TransferIds["UNWRAP_WNATIVE"] = 3] = "UNWRAP_WNATIVE";
|
|
118
120
|
TransferIds[TransferIds["PERMIT2_TRANSFER_FROM"] = 4] = "PERMIT2_TRANSFER_FROM";
|
|
119
121
|
TransferIds[TransferIds["APPROVE"] = 5] = "APPROVE";
|
|
122
|
+
TransferIds[TransferIds["WRAP"] = 6] = "WRAP";
|
|
120
123
|
})(TransferIds || (exports.TransferIds = TransferIds = {}));
|
|
121
124
|
var PermitIds;
|
|
122
125
|
(function (PermitIds) {
|
|
@@ -189,8 +192,10 @@ var CompoundV2Selector;
|
|
|
189
192
|
(function (CompoundV2Selector) {
|
|
190
193
|
CompoundV2Selector[CompoundV2Selector["MINT_BEHALF"] = 0] = "MINT_BEHALF";
|
|
191
194
|
CompoundV2Selector[CompoundV2Selector["MINT"] = 1] = "MINT";
|
|
195
|
+
CompoundV2Selector[CompoundV2Selector["MINT_ITOKEN"] = 2] = "MINT_ITOKEN";
|
|
192
196
|
CompoundV2Selector[CompoundV2Selector["REDEEM"] = 0] = "REDEEM";
|
|
193
197
|
CompoundV2Selector[CompoundV2Selector["REDEEM_BEHALF"] = 1] = "REDEEM_BEHALF";
|
|
198
|
+
CompoundV2Selector[CompoundV2Selector["REDEEM_ITOKEN"] = 2] = "REDEEM_ITOKEN";
|
|
194
199
|
})(CompoundV2Selector || (exports.CompoundV2Selector = CompoundV2Selector = {}));
|
|
195
200
|
var SiloV2CollateralType;
|
|
196
201
|
(function (SiloV2CollateralType) {
|
|
@@ -446,12 +451,7 @@ function encodeUniswapV4Take(singleton, asset, receiver, amount) {
|
|
|
446
451
|
]);
|
|
447
452
|
}
|
|
448
453
|
function swapHead(amount, amountOutMin, assetIn) {
|
|
449
|
-
return (0, utils_js_1.encodePacked)(["uint8", "uint128", "uint128", "address"], [
|
|
450
|
-
(0, utils_js_1.uint8)(ComposerCommands.SWAPS),
|
|
451
|
-
(0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(amount), false, false),
|
|
452
|
-
(0, utils_js_1.uint128)(amountOutMin),
|
|
453
|
-
assetIn,
|
|
454
|
-
]);
|
|
454
|
+
return (0, utils_js_1.encodePacked)(["uint8", "uint128", "uint128", "address"], [(0, utils_js_1.uint8)(ComposerCommands.SWAPS), (0, utils_js_1.uint128)(amount), (0, utils_js_1.uint128)(amountOutMin), assetIn]);
|
|
455
455
|
}
|
|
456
456
|
function attachBranch(data, hops, splits, splitsData) {
|
|
457
457
|
if (hops !== 0n && splits !== 0n)
|
|
@@ -656,6 +656,9 @@ function encodeWrap(amount, wrapTarget) {
|
|
|
656
656
|
(0, utils_js_1.uint128)(amount),
|
|
657
657
|
]);
|
|
658
658
|
}
|
|
659
|
+
function encodeWrapWithReceiver(amount, weth, receiver) {
|
|
660
|
+
return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint128"], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.WRAP), weth, receiver, (0, utils_js_1.uint128)(amount)]);
|
|
661
|
+
}
|
|
659
662
|
function encodeApprove(asset, target) {
|
|
660
663
|
return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address"], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.APPROVE), asset, target]);
|
|
661
664
|
}
|
|
@@ -711,6 +714,19 @@ function encodeMorphoDepositCollateral(market, assets, receiver, data, morphoB,
|
|
|
711
714
|
data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
|
|
712
715
|
]);
|
|
713
716
|
}
|
|
717
|
+
function encodeListaSupplyCollateralViaProvider(market, assets, receiver, data, provider, pId) {
|
|
718
|
+
return (0, utils_js_1.encodePacked)(["uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
|
|
719
|
+
(0, utils_js_1.uint8)(ComposerCommands.LENDING),
|
|
720
|
+
(0, utils_js_1.uint8)(LenderOps.DEPOSIT),
|
|
721
|
+
(0, utils_js_1.uint16)(LenderIds.UP_TO_MORPHO - 1),
|
|
722
|
+
market,
|
|
723
|
+
(0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(assets), false, true),
|
|
724
|
+
receiver,
|
|
725
|
+
provider,
|
|
726
|
+
(0, utils_js_1.uint16)(data.length / 2 - 1 > 0 ? data.length / 2 - 1 + 1 : 0),
|
|
727
|
+
data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
|
|
728
|
+
]);
|
|
729
|
+
}
|
|
714
730
|
function encodeMorphoDeposit(market, isShares, assets, receiver, data, morphoB, pId) {
|
|
715
731
|
return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
|
|
716
732
|
encodeApprove((0, utils_js_1.getMorphoLoanAsset)(market), morphoB),
|
|
@@ -725,7 +741,7 @@ function encodeMorphoDeposit(market, isShares, assets, receiver, data, morphoB,
|
|
|
725
741
|
data.length / 2 - 1 === 0 ? (0, utils_js_1.newbytes)(0) : encodeUint8AndBytes((0, utils_js_1.uint8)(pId), data),
|
|
726
742
|
]);
|
|
727
743
|
}
|
|
728
|
-
function
|
|
744
|
+
function encodeErc4626Deposit(asset, vault, isShares, assets, receiver) {
|
|
729
745
|
return (0, utils_js_1.encodePacked)(["bytes", "uint8", "uint8", "address", "address", "uint128", "address"], [
|
|
730
746
|
encodeApprove(asset, vault),
|
|
731
747
|
(0, utils_js_1.uint8)(ComposerCommands.ERC4626),
|
package/dist/esm/CalldataLib.js
CHANGED
|
@@ -32,6 +32,7 @@ export var TransferIds;
|
|
|
32
32
|
TransferIds[TransferIds["UNWRAP_WNATIVE"] = 3] = "UNWRAP_WNATIVE";
|
|
33
33
|
TransferIds[TransferIds["PERMIT2_TRANSFER_FROM"] = 4] = "PERMIT2_TRANSFER_FROM";
|
|
34
34
|
TransferIds[TransferIds["APPROVE"] = 5] = "APPROVE";
|
|
35
|
+
TransferIds[TransferIds["WRAP"] = 6] = "WRAP";
|
|
35
36
|
})(TransferIds || (TransferIds = {}));
|
|
36
37
|
export var PermitIds;
|
|
37
38
|
(function (PermitIds) {
|
|
@@ -104,8 +105,10 @@ export var CompoundV2Selector;
|
|
|
104
105
|
(function (CompoundV2Selector) {
|
|
105
106
|
CompoundV2Selector[CompoundV2Selector["MINT_BEHALF"] = 0] = "MINT_BEHALF";
|
|
106
107
|
CompoundV2Selector[CompoundV2Selector["MINT"] = 1] = "MINT";
|
|
108
|
+
CompoundV2Selector[CompoundV2Selector["MINT_ITOKEN"] = 2] = "MINT_ITOKEN";
|
|
107
109
|
CompoundV2Selector[CompoundV2Selector["REDEEM"] = 0] = "REDEEM";
|
|
108
110
|
CompoundV2Selector[CompoundV2Selector["REDEEM_BEHALF"] = 1] = "REDEEM_BEHALF";
|
|
111
|
+
CompoundV2Selector[CompoundV2Selector["REDEEM_ITOKEN"] = 2] = "REDEEM_ITOKEN";
|
|
109
112
|
})(CompoundV2Selector || (CompoundV2Selector = {}));
|
|
110
113
|
export var SiloV2CollateralType;
|
|
111
114
|
(function (SiloV2CollateralType) {
|
|
@@ -361,12 +364,7 @@ export function encodeUniswapV4Take(singleton, asset, receiver, amount) {
|
|
|
361
364
|
]);
|
|
362
365
|
}
|
|
363
366
|
export function swapHead(amount, amountOutMin, assetIn) {
|
|
364
|
-
return encodePacked(["uint8", "uint128", "uint128", "address"], [
|
|
365
|
-
uint8(ComposerCommands.SWAPS),
|
|
366
|
-
generateAmountBitmap(uint128(amount), false, false),
|
|
367
|
-
uint128(amountOutMin),
|
|
368
|
-
assetIn,
|
|
369
|
-
]);
|
|
367
|
+
return encodePacked(["uint8", "uint128", "uint128", "address"], [uint8(ComposerCommands.SWAPS), uint128(amount), uint128(amountOutMin), assetIn]);
|
|
370
368
|
}
|
|
371
369
|
export function attachBranch(data, hops, splits, splitsData) {
|
|
372
370
|
if (hops !== 0n && splits !== 0n)
|
|
@@ -571,6 +569,9 @@ export function encodeWrap(amount, wrapTarget) {
|
|
|
571
569
|
uint128(amount),
|
|
572
570
|
]);
|
|
573
571
|
}
|
|
572
|
+
export function encodeWrapWithReceiver(amount, weth, receiver) {
|
|
573
|
+
return encodePacked(["uint8", "uint8", "address", "address", "uint128"], [uint8(ComposerCommands.TRANSFERS), uint8(TransferIds.WRAP), weth, receiver, uint128(amount)]);
|
|
574
|
+
}
|
|
574
575
|
export function encodeApprove(asset, target) {
|
|
575
576
|
return encodePacked(["uint8", "uint8", "address", "address"], [uint8(ComposerCommands.TRANSFERS), uint8(TransferIds.APPROVE), asset, target]);
|
|
576
577
|
}
|
|
@@ -626,6 +627,19 @@ export function encodeMorphoDepositCollateral(market, assets, receiver, data, mo
|
|
|
626
627
|
data.length / 2 - 1 === 0 ? newbytes(0) : encodeUint8AndBytes(uint8(pId), data),
|
|
627
628
|
]);
|
|
628
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
|
+
}
|
|
629
643
|
export function encodeMorphoDeposit(market, isShares, assets, receiver, data, morphoB, pId) {
|
|
630
644
|
return encodePacked(["bytes", "uint8", "uint8", "uint16", "bytes", "uint128", "address", "address", "uint16", "bytes"], [
|
|
631
645
|
encodeApprove(getMorphoLoanAsset(market), morphoB),
|
|
@@ -640,7 +654,7 @@ export function encodeMorphoDeposit(market, isShares, assets, receiver, data, mo
|
|
|
640
654
|
data.length / 2 - 1 === 0 ? newbytes(0) : encodeUint8AndBytes(uint8(pId), data),
|
|
641
655
|
]);
|
|
642
656
|
}
|
|
643
|
-
export function
|
|
657
|
+
export function encodeErc4626Deposit(asset, vault, isShares, assets, receiver) {
|
|
644
658
|
return encodePacked(["bytes", "uint8", "uint8", "address", "address", "uint128", "address"], [
|
|
645
659
|
encodeApprove(asset, vault),
|
|
646
660
|
uint8(ComposerCommands.ERC4626),
|
|
@@ -24,7 +24,8 @@ export declare enum TransferIds {
|
|
|
24
24
|
WRAP_NATIVE = 2,
|
|
25
25
|
UNWRAP_WNATIVE = 3,
|
|
26
26
|
PERMIT2_TRANSFER_FROM = 4,
|
|
27
|
-
APPROVE = 5
|
|
27
|
+
APPROVE = 5,
|
|
28
|
+
WRAP = 6
|
|
28
29
|
}
|
|
29
30
|
export declare enum PermitIds {
|
|
30
31
|
TOKEN_PERMIT = 0,
|
|
@@ -88,8 +89,10 @@ export declare enum BridgeIds {
|
|
|
88
89
|
export declare enum CompoundV2Selector {
|
|
89
90
|
MINT_BEHALF = 0,
|
|
90
91
|
MINT = 1,
|
|
92
|
+
MINT_ITOKEN = 2,
|
|
91
93
|
REDEEM = 0,
|
|
92
|
-
REDEEM_BEHALF = 1
|
|
94
|
+
REDEEM_BEHALF = 1,
|
|
95
|
+
REDEEM_ITOKEN = 2
|
|
93
96
|
}
|
|
94
97
|
export declare enum SiloV2CollateralType {
|
|
95
98
|
PROTECTED = 0,
|
|
@@ -172,6 +175,7 @@ export declare function encodeNextGenDexSettleBalancer(singleton: Address, asset
|
|
|
172
175
|
export declare function encodeTransferIn(asset: Address, receiver: Address, amount: bigint): Hex;
|
|
173
176
|
export declare function encodeSweep(asset: Address, receiver: Address, amount: bigint, sweepType: any): Hex;
|
|
174
177
|
export declare function encodeWrap(amount: bigint, wrapTarget: Address): Hex;
|
|
178
|
+
export declare function encodeWrapWithReceiver(amount: bigint, weth: Address, receiver: Address): Hex;
|
|
175
179
|
export declare function encodeApprove(asset: Address, target: Address): Hex;
|
|
176
180
|
export declare function encodeUnwrap(target: Address, receiver: Address, amount: bigint, sweepType: any): Hex;
|
|
177
181
|
export declare function encodeBalancerV2FlashLoan(asset: Address, amount: bigint, poolId: number, data: Hex): Hex;
|
|
@@ -179,8 +183,9 @@ export declare function encodeFlashLoan(asset: Address, amount: bigint, pool: Ad
|
|
|
179
183
|
export declare function encodeUint8AndBytes(poolId: number, data: Hex): Hex;
|
|
180
184
|
export declare function encodeMorphoMarket(loanToken: Address, collateralToken: Address, oracle: Address, irm: Address, lltv: bigint): Hex;
|
|
181
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;
|
|
182
187
|
export declare function encodeMorphoDeposit(market: Hex, isShares: boolean, assets: bigint, receiver: Address, data: Hex, morphoB: Address, pId: bigint): Hex;
|
|
183
|
-
export declare function
|
|
188
|
+
export declare function encodeErc4626Deposit(asset: Address, vault: Address, isShares: boolean, assets: bigint, receiver: Address): Hex;
|
|
184
189
|
export declare function encodeErc4646Withdraw(vault: Address, isShares: boolean, assets: bigint, receiver: Address): Hex;
|
|
185
190
|
export declare function encodeMorphoWithdraw(market: Hex, isShares: boolean, assets: bigint, receiver: Address, morphoB: Address): Hex;
|
|
186
191
|
export declare function encodeMorphoWithdrawCollateral(market: Hex, assets: bigint, receiver: Address, morphoB: Address): Hex;
|