@dhedge/v2-sdk 1.10.12 → 1.10.14
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/entities/pool.d.ts +1 -1
- package/dist/services/uniswap/V3Liquidity.d.ts +1 -1
- package/dist/test/constants.d.ts +20 -0
- package/dist/test/wallet.d.ts +1 -0
- package/dist/types.d.ts +4 -2
- package/dist/v2-sdk.cjs.development.js +1254 -25
- package/dist/v2-sdk.cjs.development.js.map +1 -1
- package/dist/v2-sdk.cjs.production.min.js +1 -1
- package/dist/v2-sdk.cjs.production.min.js.map +1 -1
- package/dist/v2-sdk.esm.js +1254 -25
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/IShadowNonfungiblePositionManager.json +697 -0
- package/src/config.ts +23 -5
- package/src/entities/pool.ts +52 -48
- package/src/services/uniswap/V3Liquidity.ts +16 -4
- package/src/test/constants.ts +23 -2
- package/src/test/wallet.ts +2 -1
- package/src/types.ts +4 -2
package/src/config.ts
CHANGED
|
@@ -17,7 +17,8 @@ export const factoryAddress: AddressNetworkMap = {
|
|
|
17
17
|
: "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0",
|
|
18
18
|
[Network.OPTIMISM]: "0x5e61a079A178f0E5784107a4963baAe0c5a680c6",
|
|
19
19
|
[Network.ARBITRUM]: "0xfffb5fb14606eb3a548c113026355020ddf27535",
|
|
20
|
-
[Network.BASE]: "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F"
|
|
20
|
+
[Network.BASE]: "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F",
|
|
21
|
+
[Network.SONIC]: ""
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export const routerAddress: AddressDappNetworkMap = {
|
|
@@ -60,6 +61,10 @@ export const routerAddress: AddressDappNetworkMap = {
|
|
|
60
61
|
[Dapp.AAVEV3]: "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5",
|
|
61
62
|
[Dapp.TOROS]: "0xf067575Eb60c7587C11e867907AA7284833704d1",
|
|
62
63
|
[Dapp.ODOS]: "0x19cEeAd7105607Cd444F5ad10dd51356436095a1"
|
|
64
|
+
},
|
|
65
|
+
[Network.SONIC]: {
|
|
66
|
+
[Dapp.AAVEV3]: "0x5362dBb1e601abF3a4c14c22ffEdA64042E5eAA3",
|
|
67
|
+
[Dapp.ODOS]: "0xaC041Df48dF9791B0654f1Dbbf2CC8450C5f2e9D"
|
|
63
68
|
}
|
|
64
69
|
};
|
|
65
70
|
|
|
@@ -70,7 +75,8 @@ export const dappFactoryAddress: AddressDappNetworkMap = {
|
|
|
70
75
|
},
|
|
71
76
|
[Network.OPTIMISM]: {},
|
|
72
77
|
[Network.ARBITRUM]: {},
|
|
73
|
-
[Network.BASE]: {}
|
|
78
|
+
[Network.BASE]: {},
|
|
79
|
+
[Network.SONIC]: {}
|
|
74
80
|
};
|
|
75
81
|
|
|
76
82
|
export const stakingAddress: AddressDappNetworkMap = {
|
|
@@ -90,6 +96,9 @@ export const stakingAddress: AddressDappNetworkMap = {
|
|
|
90
96
|
},
|
|
91
97
|
[Network.BASE]: {
|
|
92
98
|
[Dapp.PANCAKECL]: "0xC6A2Db661D5a5690172d8eB0a7DEA2d3008665A3"
|
|
99
|
+
},
|
|
100
|
+
[Network.SONIC]: {
|
|
101
|
+
[Dapp.SHADOWCL]: "0xe879d0E44e6873cf4ab71686055a4f6817685f02" //specific for wS/USDC CL
|
|
93
102
|
}
|
|
94
103
|
};
|
|
95
104
|
|
|
@@ -107,6 +116,9 @@ export const aaveAddressProvider: AddressDappNetworkMap = {
|
|
|
107
116
|
[Network.BASE]: {
|
|
108
117
|
// https://docs.aave.com/developers/deployed-contracts/v3-mainnet/base
|
|
109
118
|
[Dapp.AAVEV3]: "0xe20fCBdBfFC4Dd138cE8b2E6FBb6CB49777ad64D"
|
|
119
|
+
},
|
|
120
|
+
[Network.SONIC]: {
|
|
121
|
+
[Dapp.AAVEV3]: "0x5C2e738F6E27bCE0F7558051Bf90605dD6176900"
|
|
110
122
|
}
|
|
111
123
|
};
|
|
112
124
|
export const nonfungiblePositionManagerAddress: AddressDappNetworkMap = {
|
|
@@ -126,6 +138,9 @@ export const nonfungiblePositionManagerAddress: AddressDappNetworkMap = {
|
|
|
126
138
|
[Dapp.UNISWAPV3]: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",
|
|
127
139
|
[Dapp.AERODROMECL]: "0x827922686190790b37229fd06084350e74485b72",
|
|
128
140
|
[Dapp.PANCAKECL]: "0x46A15B0b27311cedF172AB29E4f4766fbE7F4364"
|
|
141
|
+
},
|
|
142
|
+
[Network.SONIC]: {
|
|
143
|
+
[Dapp.SHADOWCL]: "0x12e66c8f215ddd5d48d150c8f46ad0c6fb0f4406"
|
|
129
144
|
}
|
|
130
145
|
};
|
|
131
146
|
|
|
@@ -133,7 +148,8 @@ export const networkChainIdMap: NetworkChainIdMap = {
|
|
|
133
148
|
[Network.POLYGON]: 137,
|
|
134
149
|
[Network.OPTIMISM]: 10,
|
|
135
150
|
[Network.ARBITRUM]: 42161,
|
|
136
|
-
[Network.BASE]: 8453
|
|
151
|
+
[Network.BASE]: 8453,
|
|
152
|
+
[Network.SONIC]: 146
|
|
137
153
|
};
|
|
138
154
|
|
|
139
155
|
export const balancerSubgraph: AddressNetworkMap = {
|
|
@@ -141,14 +157,16 @@ export const balancerSubgraph: AddressNetworkMap = {
|
|
|
141
157
|
"https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2",
|
|
142
158
|
[Network.OPTIMISM]: "",
|
|
143
159
|
[Network.ARBITRUM]: "",
|
|
144
|
-
[Network.BASE]: ""
|
|
160
|
+
[Network.BASE]: "",
|
|
161
|
+
[Network.SONIC]: ""
|
|
145
162
|
};
|
|
146
163
|
|
|
147
164
|
export const multiCallAddress: AddressNetworkMap = {
|
|
148
165
|
[Network.POLYGON]: "0x275617327c958bD06b5D6b871E7f491D76113dd8",
|
|
149
166
|
[Network.OPTIMISM]: "",
|
|
150
167
|
[Network.ARBITRUM]: "",
|
|
151
|
-
[Network.BASE]: ""
|
|
168
|
+
[Network.BASE]: "",
|
|
169
|
+
[Network.SONIC]: ""
|
|
152
170
|
};
|
|
153
171
|
|
|
154
172
|
export const lyraNetworkMap: LyraNetworkMap = {
|
package/src/entities/pool.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
nonfungiblePositionManagerAddress,
|
|
20
20
|
routerAddress,
|
|
21
21
|
stakingAddress,
|
|
22
|
-
SYNTHETIX_TRACKING_CODE
|
|
22
|
+
SYNTHETIX_TRACKING_CODE,
|
|
23
23
|
} from "../config";
|
|
24
24
|
import {
|
|
25
25
|
Dapp,
|
|
@@ -30,60 +30,60 @@ import {
|
|
|
30
30
|
LyraOptionMarket,
|
|
31
31
|
LyraOptionType,
|
|
32
32
|
LyraTradeType,
|
|
33
|
-
LyraPosition
|
|
33
|
+
LyraPosition,
|
|
34
34
|
} from "../types";
|
|
35
35
|
|
|
36
36
|
import { Utils } from "./utils";
|
|
37
37
|
import {
|
|
38
38
|
getDecreaseLiquidityTxData,
|
|
39
39
|
getIncreaseLiquidityTxData,
|
|
40
|
-
getUniswapV3MintTxData
|
|
40
|
+
getUniswapV3MintTxData,
|
|
41
41
|
} from "../services/uniswap/V3Liquidity";
|
|
42
42
|
import { getUniswapV3SwapTxData } from "../services/uniswap/V3Trade";
|
|
43
43
|
import {
|
|
44
44
|
getCompleteWithdrawalTxData,
|
|
45
|
-
getEasySwapperTxData
|
|
45
|
+
getEasySwapperTxData,
|
|
46
46
|
} from "../services/toros/easySwapper";
|
|
47
47
|
import { getAaveV3ClaimTxData } from "../services/aave/incentives";
|
|
48
48
|
import {
|
|
49
49
|
getClOwner,
|
|
50
50
|
getVelodromeAddLiquidityTxData,
|
|
51
|
-
getVelodromeRemoveLiquidityTxData
|
|
51
|
+
getVelodromeRemoveLiquidityTxData,
|
|
52
52
|
} from "../services/velodrome/liquidity";
|
|
53
53
|
import {
|
|
54
54
|
getVelodromeClaimTxData,
|
|
55
55
|
getVelodromeCLClaimTxData,
|
|
56
|
-
getVelodromeStakeTxData
|
|
56
|
+
getVelodromeStakeTxData,
|
|
57
57
|
} from "../services/velodrome/staking";
|
|
58
58
|
import { getLyraOptionTxData } from "../services/lyra/trade";
|
|
59
59
|
import { getOptionPositions } from "../services/lyra/positions";
|
|
60
60
|
import { getDeadline } from "../utils/deadline";
|
|
61
61
|
import {
|
|
62
62
|
getFuturesChangePositionTxData,
|
|
63
|
-
getFuturesChangeMarginTxData
|
|
63
|
+
getFuturesChangeMarginTxData,
|
|
64
64
|
} from "../services/futures";
|
|
65
65
|
import { getFuturesCancelOrderTxData } from "../services/futures/trade";
|
|
66
66
|
import { getOneInchSwapTxData } from "../services/oneInch";
|
|
67
67
|
import {
|
|
68
68
|
getCreateVestTxData,
|
|
69
69
|
getExitVestTxData,
|
|
70
|
-
getRewardsTxDta
|
|
70
|
+
getRewardsTxDta,
|
|
71
71
|
} from "../services/ramses/vesting";
|
|
72
72
|
import { getPoolTxOrGasEstimate } from "../utils/contract";
|
|
73
73
|
import {
|
|
74
74
|
cancelOrderViaFlatMoney,
|
|
75
75
|
mintUnitViaFlatMoney,
|
|
76
|
-
redeemUnitViaFlatMoney
|
|
76
|
+
redeemUnitViaFlatMoney,
|
|
77
77
|
} from "../services/flatmoney/stableLp";
|
|
78
78
|
import {
|
|
79
79
|
getCompoundV3LendTxData,
|
|
80
|
-
getCompoundV3WithdrawTxData
|
|
80
|
+
getCompoundV3WithdrawTxData,
|
|
81
81
|
} from "../services/compound/lending";
|
|
82
82
|
import { getCompoundV3ClaimTxData } from "../services/compound/rewards";
|
|
83
83
|
import {
|
|
84
84
|
getPancakeHarvestClaimTxData,
|
|
85
85
|
getPancakeStakeTxData,
|
|
86
|
-
getPancakeUnStakeTxData
|
|
86
|
+
getPancakeUnStakeTxData,
|
|
87
87
|
} from "../services/pancake/staking";
|
|
88
88
|
import { getOdosSwapTxData } from "../services/odos";
|
|
89
89
|
|
|
@@ -130,7 +130,7 @@ export class Pool {
|
|
|
130
130
|
asset: asset,
|
|
131
131
|
isDeposit: isDeposit,
|
|
132
132
|
balance: result[1][index],
|
|
133
|
-
rate: result[2][index]
|
|
133
|
+
rate: result[2][index],
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
);
|
|
@@ -225,7 +225,7 @@ export class Pool {
|
|
|
225
225
|
const iERC20 = new ethers.utils.Interface(IERC20.abi);
|
|
226
226
|
const approveTxData = iERC20.encodeFunctionData("approve", [
|
|
227
227
|
routerAddress[this.network][dapp],
|
|
228
|
-
amount
|
|
228
|
+
amount,
|
|
229
229
|
]);
|
|
230
230
|
const tx = await getPoolTxOrGasEstimate(
|
|
231
231
|
this,
|
|
@@ -254,7 +254,7 @@ export class Pool {
|
|
|
254
254
|
const iERC20 = new ethers.utils.Interface(IERC20.abi);
|
|
255
255
|
const approveTxData = iERC20.encodeFunctionData("approve", [
|
|
256
256
|
stakingAddress[this.network][dapp],
|
|
257
|
-
amount
|
|
257
|
+
amount,
|
|
258
258
|
]);
|
|
259
259
|
const tx = await getPoolTxOrGasEstimate(
|
|
260
260
|
this,
|
|
@@ -282,7 +282,7 @@ export class Pool {
|
|
|
282
282
|
const iERC20 = new ethers.utils.Interface(IERC20.abi);
|
|
283
283
|
const approveTxData = iERC20.encodeFunctionData("approve", [
|
|
284
284
|
nonfungiblePositionManagerAddress[this.network][Dapp.UNISWAPV3],
|
|
285
|
-
amount
|
|
285
|
+
amount,
|
|
286
286
|
]);
|
|
287
287
|
const tx = await getPoolTxOrGasEstimate(
|
|
288
288
|
this,
|
|
@@ -311,7 +311,7 @@ export class Pool {
|
|
|
311
311
|
const iERC20 = new ethers.utils.Interface(IERC20.abi);
|
|
312
312
|
const approveTxData = iERC20.encodeFunctionData("approve", [
|
|
313
313
|
spender,
|
|
314
|
-
amount
|
|
314
|
+
amount,
|
|
315
315
|
]);
|
|
316
316
|
const tx = await getPoolTxOrGasEstimate(
|
|
317
317
|
this,
|
|
@@ -340,7 +340,7 @@ export class Pool {
|
|
|
340
340
|
const iERC721 = new ethers.utils.Interface(IERC721.abi);
|
|
341
341
|
const approveTxData = iERC721.encodeFunctionData("approve", [
|
|
342
342
|
spender,
|
|
343
|
-
tokenId
|
|
343
|
+
tokenId,
|
|
344
344
|
]);
|
|
345
345
|
const tx = await getPoolTxOrGasEstimate(
|
|
346
346
|
this,
|
|
@@ -392,7 +392,7 @@ export class Pool {
|
|
|
392
392
|
break;
|
|
393
393
|
case Dapp.SYNTHETIX:
|
|
394
394
|
const iSynthetix = new ethers.utils.Interface(ISynthetix.abi);
|
|
395
|
-
const assets = [assetFrom, assetTo].map(asset =>
|
|
395
|
+
const assets = [assetFrom, assetTo].map((asset) =>
|
|
396
396
|
ethers.utils.formatBytes32String(asset)
|
|
397
397
|
);
|
|
398
398
|
const daoAddress = await this.factory.owner();
|
|
@@ -401,7 +401,7 @@ export class Pool {
|
|
|
401
401
|
amountIn,
|
|
402
402
|
assets[1],
|
|
403
403
|
daoAddress,
|
|
404
|
-
SYNTHETIX_TRACKING_CODE
|
|
404
|
+
SYNTHETIX_TRACKING_CODE,
|
|
405
405
|
]);
|
|
406
406
|
break;
|
|
407
407
|
case Dapp.TOROS:
|
|
@@ -438,7 +438,7 @@ export class Pool {
|
|
|
438
438
|
minAmountOut,
|
|
439
439
|
[assetFrom, assetTo],
|
|
440
440
|
this.address,
|
|
441
|
-
await getDeadline(this)
|
|
441
|
+
await getDeadline(this),
|
|
442
442
|
]);
|
|
443
443
|
}
|
|
444
444
|
const tx = await getPoolTxOrGasEstimate(
|
|
@@ -480,7 +480,7 @@ export class Pool {
|
|
|
480
480
|
0,
|
|
481
481
|
0,
|
|
482
482
|
this.address,
|
|
483
|
-
await getDeadline(this)
|
|
483
|
+
await getDeadline(this),
|
|
484
484
|
]
|
|
485
485
|
);
|
|
486
486
|
const tx = await getPoolTxOrGasEstimate(
|
|
@@ -543,7 +543,7 @@ export class Pool {
|
|
|
543
543
|
const stakeTxData = iMiniChefV2.encodeFunctionData(Transaction.DEPOSIT, [
|
|
544
544
|
poolId,
|
|
545
545
|
amount,
|
|
546
|
-
this.address
|
|
546
|
+
this.address,
|
|
547
547
|
]);
|
|
548
548
|
const tx = await getPoolTxOrGasEstimate(
|
|
549
549
|
this,
|
|
@@ -576,7 +576,7 @@ export class Pool {
|
|
|
576
576
|
IBalancerRewardsGauge.abi
|
|
577
577
|
);
|
|
578
578
|
stakeTxData = rewardsGauge.encodeFunctionData("deposit(uint256)", [
|
|
579
|
-
amount
|
|
579
|
+
amount,
|
|
580
580
|
]);
|
|
581
581
|
break;
|
|
582
582
|
case Dapp.VELODROME:
|
|
@@ -628,7 +628,7 @@ export class Pool {
|
|
|
628
628
|
const unStakeTxData = iMiniChefV2.encodeFunctionData(Transaction.WITHDRAW, [
|
|
629
629
|
poolId,
|
|
630
630
|
amount,
|
|
631
|
-
this.address
|
|
631
|
+
this.address,
|
|
632
632
|
]);
|
|
633
633
|
const tx = await getPoolTxOrGasEstimate(
|
|
634
634
|
this,
|
|
@@ -661,7 +661,7 @@ export class Pool {
|
|
|
661
661
|
unstakeTxData = getPancakeUnStakeTxData(this, amount.toString());
|
|
662
662
|
} else {
|
|
663
663
|
unstakeTxData = rewardsGauge.encodeFunctionData("withdraw(uint256)", [
|
|
664
|
-
amount
|
|
664
|
+
amount,
|
|
665
665
|
]);
|
|
666
666
|
}
|
|
667
667
|
const tx = await getPoolTxOrGasEstimate(
|
|
@@ -695,7 +695,7 @@ export class Pool {
|
|
|
695
695
|
asset,
|
|
696
696
|
amount,
|
|
697
697
|
this.address,
|
|
698
|
-
referralCode
|
|
698
|
+
referralCode,
|
|
699
699
|
]);
|
|
700
700
|
|
|
701
701
|
const tx = await getPoolTxOrGasEstimate(
|
|
@@ -812,7 +812,7 @@ export class Pool {
|
|
|
812
812
|
amount,
|
|
813
813
|
2,
|
|
814
814
|
referralCode,
|
|
815
|
-
this.address
|
|
815
|
+
this.address,
|
|
816
816
|
]);
|
|
817
817
|
const tx = await getPoolTxOrGasEstimate(
|
|
818
818
|
this,
|
|
@@ -843,7 +843,7 @@ export class Pool {
|
|
|
843
843
|
asset,
|
|
844
844
|
amount,
|
|
845
845
|
2,
|
|
846
|
-
this.address
|
|
846
|
+
this.address,
|
|
847
847
|
]);
|
|
848
848
|
const tx = await getPoolTxOrGasEstimate(
|
|
849
849
|
this,
|
|
@@ -871,7 +871,7 @@ export class Pool {
|
|
|
871
871
|
const poolId = await this.utils.getLpPoolId(dapp, asset);
|
|
872
872
|
const harvestTxData = iMiniChefV2.encodeFunctionData(Transaction.HARVEST, [
|
|
873
873
|
poolId,
|
|
874
|
-
this.address
|
|
874
|
+
this.address,
|
|
875
875
|
]);
|
|
876
876
|
const tx = await getPoolTxOrGasEstimate(
|
|
877
877
|
this,
|
|
@@ -894,12 +894,12 @@ export class Pool {
|
|
|
894
894
|
estimateGas = false
|
|
895
895
|
): Promise<any> {
|
|
896
896
|
const currentAssetsEnabled = await this.getComposition();
|
|
897
|
-
const currentAssets = currentAssetsEnabled.map(e =>
|
|
897
|
+
const currentAssets = currentAssetsEnabled.map((e) =>
|
|
898
898
|
e.asset.toLocaleLowerCase()
|
|
899
899
|
);
|
|
900
|
-
const newAssets = assets.map(e => e.asset.toLocaleLowerCase());
|
|
901
|
-
const removedAssets = currentAssets.filter(e => !newAssets.includes(e));
|
|
902
|
-
const changedAssets = assets.map(e => [e.asset, e.isDeposit]);
|
|
900
|
+
const newAssets = assets.map((e) => e.asset.toLocaleLowerCase());
|
|
901
|
+
const removedAssets = currentAssets.filter((e) => !newAssets.includes(e));
|
|
902
|
+
const changedAssets = assets.map((e) => [e.asset, e.isDeposit]);
|
|
903
903
|
|
|
904
904
|
if (estimateGas) {
|
|
905
905
|
return await this.managerLogic.estimateGas.changeAssets(
|
|
@@ -1056,7 +1056,7 @@ export class Pool {
|
|
|
1056
1056
|
[
|
|
1057
1057
|
stakingAddress[this.network][Dapp.AAVEV3] as string,
|
|
1058
1058
|
claimTxData,
|
|
1059
|
-
options
|
|
1059
|
+
options,
|
|
1060
1060
|
],
|
|
1061
1061
|
estimateGas
|
|
1062
1062
|
);
|
|
@@ -1081,7 +1081,7 @@ export class Pool {
|
|
|
1081
1081
|
[
|
|
1082
1082
|
stakingAddress[this.network][Dapp.COMPOUNDV3] as string,
|
|
1083
1083
|
claimTxData,
|
|
1084
|
-
options
|
|
1084
|
+
options,
|
|
1085
1085
|
],
|
|
1086
1086
|
estimateGas
|
|
1087
1087
|
);
|
|
@@ -1110,7 +1110,8 @@ export class Pool {
|
|
|
1110
1110
|
| Dapp.VELODROMECL
|
|
1111
1111
|
| Dapp.AERODROMECL
|
|
1112
1112
|
| Dapp.RAMSESCL
|
|
1113
|
-
| Dapp.PANCAKECL
|
|
1113
|
+
| Dapp.PANCAKECL
|
|
1114
|
+
| Dapp.SHADOWCL,
|
|
1114
1115
|
assetA: string,
|
|
1115
1116
|
assetB: string,
|
|
1116
1117
|
amountA: BigNumber | string,
|
|
@@ -1150,7 +1151,7 @@ export class Pool {
|
|
|
1150
1151
|
[
|
|
1151
1152
|
nonfungiblePositionManagerAddress[this.network][dapp],
|
|
1152
1153
|
mintTxData,
|
|
1153
|
-
options
|
|
1154
|
+
options,
|
|
1154
1155
|
],
|
|
1155
1156
|
estimateGas
|
|
1156
1157
|
);
|
|
@@ -1179,6 +1180,7 @@ export class Pool {
|
|
|
1179
1180
|
switch (dapp) {
|
|
1180
1181
|
case Dapp.UNISWAPV3:
|
|
1181
1182
|
case Dapp.RAMSESCL:
|
|
1183
|
+
case Dapp.SHADOWCL:
|
|
1182
1184
|
dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
|
|
1183
1185
|
break;
|
|
1184
1186
|
case Dapp.VELODROMECL:
|
|
@@ -1244,6 +1246,7 @@ export class Pool {
|
|
|
1244
1246
|
switch (dapp) {
|
|
1245
1247
|
case Dapp.UNISWAPV3:
|
|
1246
1248
|
case Dapp.RAMSESCL:
|
|
1249
|
+
case Dapp.SHADOWCL:
|
|
1247
1250
|
dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
|
|
1248
1251
|
break;
|
|
1249
1252
|
case Dapp.VELODROMECL:
|
|
@@ -1308,6 +1311,7 @@ export class Pool {
|
|
|
1308
1311
|
switch (dapp) {
|
|
1309
1312
|
case Dapp.UNISWAPV3:
|
|
1310
1313
|
case Dapp.RAMSESCL:
|
|
1314
|
+
case Dapp.SHADOWCL:
|
|
1311
1315
|
contractAddress = nonfungiblePositionManagerAddress[this.network][dapp];
|
|
1312
1316
|
txData = iNonfungiblePositionManager.encodeFunctionData(
|
|
1313
1317
|
Transaction.COLLECT,
|
|
@@ -1378,13 +1382,13 @@ export class Pool {
|
|
|
1378
1382
|
options: any = null,
|
|
1379
1383
|
estimateGas = false
|
|
1380
1384
|
): Promise<any> {
|
|
1385
|
+
const claimAddress =
|
|
1386
|
+
dapp === Dapp.SHADOWCL
|
|
1387
|
+
? stakingAddress[this.network][dapp] //specific for wS/USDC CL
|
|
1388
|
+
: nonfungiblePositionManagerAddress[this.network][dapp];
|
|
1381
1389
|
const tx = await getPoolTxOrGasEstimate(
|
|
1382
1390
|
this,
|
|
1383
|
-
[
|
|
1384
|
-
nonfungiblePositionManagerAddress[this.network][dapp],
|
|
1385
|
-
getRewardsTxDta(tokenId, rewards),
|
|
1386
|
-
options
|
|
1387
|
-
],
|
|
1391
|
+
[claimAddress, getRewardsTxDta(tokenId, rewards), options],
|
|
1388
1392
|
estimateGas
|
|
1389
1393
|
);
|
|
1390
1394
|
return tx;
|
|
@@ -1459,7 +1463,7 @@ export class Pool {
|
|
|
1459
1463
|
amountB,
|
|
1460
1464
|
isStable
|
|
1461
1465
|
),
|
|
1462
|
-
options
|
|
1466
|
+
options,
|
|
1463
1467
|
],
|
|
1464
1468
|
estimateGas
|
|
1465
1469
|
);
|
|
@@ -1495,7 +1499,7 @@ export class Pool {
|
|
|
1495
1499
|
amount,
|
|
1496
1500
|
isStable
|
|
1497
1501
|
),
|
|
1498
|
-
options
|
|
1502
|
+
options,
|
|
1499
1503
|
],
|
|
1500
1504
|
estimateGas
|
|
1501
1505
|
);
|
|
@@ -1534,7 +1538,7 @@ export class Pool {
|
|
|
1534
1538
|
amountB,
|
|
1535
1539
|
isStable
|
|
1536
1540
|
),
|
|
1537
|
-
options
|
|
1541
|
+
options,
|
|
1538
1542
|
],
|
|
1539
1543
|
estimateGas
|
|
1540
1544
|
);
|
|
@@ -1570,7 +1574,7 @@ export class Pool {
|
|
|
1570
1574
|
amount,
|
|
1571
1575
|
isStable
|
|
1572
1576
|
),
|
|
1573
|
-
options
|
|
1577
|
+
options,
|
|
1574
1578
|
],
|
|
1575
1579
|
estimateGas
|
|
1576
1580
|
);
|
|
@@ -1611,7 +1615,7 @@ export class Pool {
|
|
|
1611
1615
|
amountB,
|
|
1612
1616
|
isStable
|
|
1613
1617
|
),
|
|
1614
|
-
options
|
|
1618
|
+
options,
|
|
1615
1619
|
],
|
|
1616
1620
|
estimateGas
|
|
1617
1621
|
);
|
|
@@ -1649,7 +1653,7 @@ export class Pool {
|
|
|
1649
1653
|
amount,
|
|
1650
1654
|
isStable
|
|
1651
1655
|
),
|
|
1652
|
-
options
|
|
1656
|
+
options,
|
|
1653
1657
|
],
|
|
1654
1658
|
estimateGas
|
|
1655
1659
|
);
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "../../config";
|
|
20
20
|
import INonfungiblePositionManager from "../../abi/INonfungiblePositionManager.json";
|
|
21
21
|
import IVeldodromePositionManager from "../../abi/IVelodromeNonfungiblePositionManager.json";
|
|
22
|
+
import IShadowNonfungiblePositionManager from "../../abi/IShadowNonfungiblePositionManager.json";
|
|
22
23
|
import IRamsesPositionManager from "../../abi/IRamsesNonfungiblePositionManager.json";
|
|
23
24
|
import IArrakisV1RouterStaking from "../../abi/IArrakisV1RouterStaking.json";
|
|
24
25
|
import IPancakeMasterChef from "../../abi/IPancakeMasterChefV3.json";
|
|
@@ -77,7 +78,8 @@ export async function getUniswapV3MintTxData(
|
|
|
77
78
|
| Dapp.VELODROMECL
|
|
78
79
|
| Dapp.AERODROMECL
|
|
79
80
|
| Dapp.RAMSESCL
|
|
80
|
-
| Dapp.PANCAKECL
|
|
81
|
+
| Dapp.PANCAKECL
|
|
82
|
+
| Dapp.SHADOWCL,
|
|
81
83
|
pool: Pool,
|
|
82
84
|
assetA: string,
|
|
83
85
|
assetB: string,
|
|
@@ -168,6 +170,12 @@ export async function getUniswapV3MintTxData(
|
|
|
168
170
|
mintParams.push(0);
|
|
169
171
|
}
|
|
170
172
|
|
|
173
|
+
if (dapp === Dapp.SHADOWCL) {
|
|
174
|
+
iNonfungiblePositionManager = new ethers.utils.Interface(
|
|
175
|
+
IShadowNonfungiblePositionManager
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
171
179
|
return iNonfungiblePositionManager.encodeFunctionData(Transaction.MINT, [
|
|
172
180
|
mintParams
|
|
173
181
|
]);
|
|
@@ -188,7 +196,9 @@ export async function getUniswapV3Liquidity(
|
|
|
188
196
|
const iNonfungiblePositionManager = new ethers.Contract(
|
|
189
197
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
190
198
|
nonfungiblePositionManagerAddress[pool.network][dapp]!,
|
|
191
|
-
|
|
199
|
+
dapp === Dapp.SHADOWCL
|
|
200
|
+
? IShadowNonfungiblePositionManager
|
|
201
|
+
: INonfungiblePositionManager.abi,
|
|
192
202
|
pool.signer
|
|
193
203
|
);
|
|
194
204
|
const result = await iNonfungiblePositionManager.positions(tokenId);
|
|
@@ -208,7 +218,8 @@ export async function getIncreaseLiquidityTxData(
|
|
|
208
218
|
dapp === Dapp.VELODROMECL ||
|
|
209
219
|
dapp === Dapp.AERODROMECL ||
|
|
210
220
|
dapp === Dapp.RAMSESCL ||
|
|
211
|
-
dapp === Dapp.PANCAKECL
|
|
221
|
+
dapp === Dapp.PANCAKECL ||
|
|
222
|
+
dapp === Dapp.SHADOWCL
|
|
212
223
|
) {
|
|
213
224
|
const abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
|
|
214
225
|
txData = abi.encodeFunctionData(Transaction.INCREASE_LIQUIDITY, [
|
|
@@ -245,7 +256,8 @@ export async function getDecreaseLiquidityTxData(
|
|
|
245
256
|
dapp === Dapp.VELODROMECL ||
|
|
246
257
|
dapp === Dapp.AERODROMECL ||
|
|
247
258
|
dapp === Dapp.RAMSESCL ||
|
|
248
|
-
dapp === Dapp.PANCAKECL
|
|
259
|
+
dapp === Dapp.PANCAKECL ||
|
|
260
|
+
dapp === Dapp.SHADOWCL
|
|
249
261
|
) {
|
|
250
262
|
const abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
|
|
251
263
|
const liquidity = (await getUniswapV3Liquidity(dapp, tokenId, pool))
|
package/src/test/constants.ts
CHANGED
|
@@ -133,6 +133,25 @@ export const CONTRACT_ADDRESS = {
|
|
|
133
133
|
VELO: "0x940181a94A35A4569E4529A3CDfB74e38FD98631",
|
|
134
134
|
COMPOUNDV3_WETH: "",
|
|
135
135
|
TOROS: ""
|
|
136
|
+
},
|
|
137
|
+
[Network.SONIC]: {
|
|
138
|
+
USDC: "0x29219dd400f2bf60e5a23d13be72b486d4038894",
|
|
139
|
+
USDT: "",
|
|
140
|
+
SUSD: "",
|
|
141
|
+
WETH: "0x50c42deacd8fc9773493ed674b675be577f2634b",
|
|
142
|
+
WBTC: "",
|
|
143
|
+
SWETH: "",
|
|
144
|
+
uniswapV3: {
|
|
145
|
+
nonfungiblePositionManager: ""
|
|
146
|
+
},
|
|
147
|
+
//
|
|
148
|
+
ARRAKIS_USDC_WETH_GAUGE: "",
|
|
149
|
+
ARRAKIS_USDC_WETH_LP: "",
|
|
150
|
+
WMATIC: "",
|
|
151
|
+
VELODROME_CL_USDC_WETH_GAUGE: "",
|
|
152
|
+
VELO: "",
|
|
153
|
+
COMPOUNDV3_WETH: "",
|
|
154
|
+
TOROS: ""
|
|
136
155
|
}
|
|
137
156
|
};
|
|
138
157
|
|
|
@@ -142,12 +161,14 @@ export const USDC_BALANCEOF_SLOT = {
|
|
|
142
161
|
[Network.OPTIMISM]: 9,
|
|
143
162
|
[Network.ARBITRUM]: 9,
|
|
144
163
|
[Network.POLYGON]: 0,
|
|
145
|
-
[Network.BASE]: 9
|
|
164
|
+
[Network.BASE]: 9,
|
|
165
|
+
[Network.SONIC]: 9
|
|
146
166
|
};
|
|
147
167
|
|
|
148
168
|
export const WETH_BALANCEOF_SLOT = {
|
|
149
169
|
[Network.OPTIMISM]: 3,
|
|
150
170
|
[Network.ARBITRUM]: 51,
|
|
151
171
|
[Network.POLYGON]: 0,
|
|
152
|
-
[Network.BASE]: 0
|
|
172
|
+
[Network.BASE]: 0,
|
|
173
|
+
[Network.SONIC]: 0
|
|
153
174
|
};
|
package/src/test/wallet.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -5,7 +5,8 @@ export enum Network {
|
|
|
5
5
|
POLYGON = "polygon",
|
|
6
6
|
OPTIMISM = "optimism",
|
|
7
7
|
ARBITRUM = "arbitrum",
|
|
8
|
-
BASE = "base"
|
|
8
|
+
BASE = "base",
|
|
9
|
+
SONIC = "sonic"
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export enum Dapp {
|
|
@@ -29,7 +30,8 @@ export enum Dapp {
|
|
|
29
30
|
RAMSESCL = "ramsesCL",
|
|
30
31
|
PANCAKECL = "pancakeCL",
|
|
31
32
|
COMPOUNDV3 = "compoundV3",
|
|
32
|
-
ODOS = "odos"
|
|
33
|
+
ODOS = "odos",
|
|
34
|
+
SHADOWCL = "shadowCL"
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export enum Transaction {
|