@dhedge/v2-sdk 1.10.6 → 1.10.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/v2-sdk",
3
- "version": "1.10.6",
3
+ "version": "1.10.8",
4
4
  "license": "MIT",
5
5
  "description": "🛠 An SDK for building applications on top of dHEDGE V2",
6
6
  "main": "dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "@size-limit/preset-small-lib": "^5.0.1",
35
35
  "@types/jest": "^28.1.7",
36
36
  "@types/lodash": "^4.14.178",
37
- "hardhat": "2.19.3",
37
+ "hardhat": "2.22.18",
38
38
  "husky": "^7.0.1",
39
39
  "jest": "^28.1.3",
40
40
  "size-limit": "^5.0.1",
@@ -822,34 +822,6 @@
822
822
  "stateMutability": "nonpayable",
823
823
  "type": "function"
824
824
  },
825
- {
826
- "inputs": [
827
- {
828
- "internalType": "address",
829
- "name": "from",
830
- "type": "address"
831
- },
832
- {
833
- "internalType": "address",
834
- "name": "to",
835
- "type": "address"
836
- },
837
- {
838
- "internalType": "uint256",
839
- "name": "tokenId",
840
- "type": "uint256"
841
- },
842
- {
843
- "internalType": "bytes",
844
- "name": "_data",
845
- "type": "bytes"
846
- }
847
- ],
848
- "name": "safeTransferFrom",
849
- "outputs": [],
850
- "stateMutability": "nonpayable",
851
- "type": "function"
852
- },
853
825
  {
854
826
  "inputs": [
855
827
  {
@@ -0,0 +1,115 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "uint256",
6
+ "name": "tokenId",
7
+ "type": "uint256"
8
+ },
9
+ {
10
+ "internalType": "address",
11
+ "name": "to",
12
+ "type": "address"
13
+ }
14
+ ],
15
+ "name": "harvest",
16
+ "outputs": [
17
+ {
18
+ "internalType": "uint256",
19
+ "name": "reward",
20
+ "type": "uint256"
21
+ }
22
+ ],
23
+ "stateMutability": "nonpayable",
24
+ "type": "function"
25
+ },
26
+ {
27
+ "inputs": [
28
+ {
29
+ "internalType": "uint256",
30
+ "name": "_tokenId",
31
+ "type": "uint256"
32
+ },
33
+ {
34
+ "internalType": "address",
35
+ "name": "_to",
36
+ "type": "address"
37
+ }
38
+ ],
39
+ "name": "withdraw",
40
+ "outputs": [
41
+ {
42
+ "internalType": "uint256",
43
+ "name": "reward",
44
+ "type": "uint256"
45
+ }
46
+ ],
47
+ "stateMutability": "nonpayable",
48
+ "type": "function"
49
+ },
50
+ {
51
+ "inputs": [
52
+ {
53
+ "internalType": "bytes[]",
54
+ "name": "data",
55
+ "type": "bytes[]"
56
+ }
57
+ ],
58
+ "name": "multicall",
59
+ "outputs": [
60
+ {
61
+ "internalType": "bytes[]",
62
+ "name": "results",
63
+ "type": "bytes[]"
64
+ }
65
+ ],
66
+ "stateMutability": "payable",
67
+ "type": "function"
68
+ },
69
+ {
70
+ "inputs": [
71
+ {
72
+ "components": [
73
+ {
74
+ "internalType": "uint256",
75
+ "name": "tokenId",
76
+ "type": "uint256"
77
+ },
78
+ {
79
+ "internalType": "address",
80
+ "name": "recipient",
81
+ "type": "address"
82
+ },
83
+ {
84
+ "internalType": "uint128",
85
+ "name": "amount0Max",
86
+ "type": "uint128"
87
+ },
88
+ {
89
+ "internalType": "uint128",
90
+ "name": "amount1Max",
91
+ "type": "uint128"
92
+ }
93
+ ],
94
+ "internalType": "struct INonfungiblePositionManager.CollectParams",
95
+ "name": "params",
96
+ "type": "tuple"
97
+ }
98
+ ],
99
+ "name": "collect",
100
+ "outputs": [
101
+ {
102
+ "internalType": "uint256",
103
+ "name": "amount0",
104
+ "type": "uint256"
105
+ },
106
+ {
107
+ "internalType": "uint256",
108
+ "name": "amount1",
109
+ "type": "uint256"
110
+ }
111
+ ],
112
+ "stateMutability": "payable",
113
+ "type": "function"
114
+ }
115
+ ]
@@ -0,0 +1,241 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ { "internalType": "address", "name": "governor_", "type": "address" }
5
+ ],
6
+ "stateMutability": "nonpayable",
7
+ "type": "constructor"
8
+ },
9
+ {
10
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
11
+ "name": "AlreadyConfigured",
12
+ "type": "error"
13
+ },
14
+ { "inputs": [], "name": "BadData", "type": "error" },
15
+ {
16
+ "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
17
+ "name": "InvalidUInt64",
18
+ "type": "error"
19
+ },
20
+ {
21
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
22
+ "name": "NotPermitted",
23
+ "type": "error"
24
+ },
25
+ {
26
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
27
+ "name": "NotSupported",
28
+ "type": "error"
29
+ },
30
+ {
31
+ "inputs": [
32
+ { "internalType": "address", "name": "", "type": "address" },
33
+ { "internalType": "uint256", "name": "", "type": "uint256" }
34
+ ],
35
+ "name": "TransferOutFailed",
36
+ "type": "error"
37
+ },
38
+ {
39
+ "anonymous": false,
40
+ "inputs": [
41
+ {
42
+ "indexed": true,
43
+ "internalType": "address",
44
+ "name": "oldGovernor",
45
+ "type": "address"
46
+ },
47
+ {
48
+ "indexed": true,
49
+ "internalType": "address",
50
+ "name": "newGovernor",
51
+ "type": "address"
52
+ }
53
+ ],
54
+ "name": "GovernorTransferred",
55
+ "type": "event"
56
+ },
57
+ {
58
+ "anonymous": false,
59
+ "inputs": [
60
+ {
61
+ "indexed": true,
62
+ "internalType": "address",
63
+ "name": "src",
64
+ "type": "address"
65
+ },
66
+ {
67
+ "indexed": true,
68
+ "internalType": "address",
69
+ "name": "recipient",
70
+ "type": "address"
71
+ },
72
+ {
73
+ "indexed": true,
74
+ "internalType": "address",
75
+ "name": "token",
76
+ "type": "address"
77
+ },
78
+ {
79
+ "indexed": false,
80
+ "internalType": "uint256",
81
+ "name": "amount",
82
+ "type": "uint256"
83
+ }
84
+ ],
85
+ "name": "RewardClaimed",
86
+ "type": "event"
87
+ },
88
+ {
89
+ "anonymous": false,
90
+ "inputs": [
91
+ {
92
+ "indexed": true,
93
+ "internalType": "address",
94
+ "name": "user",
95
+ "type": "address"
96
+ },
97
+ {
98
+ "indexed": true,
99
+ "internalType": "address",
100
+ "name": "comet",
101
+ "type": "address"
102
+ },
103
+ {
104
+ "indexed": false,
105
+ "internalType": "uint256",
106
+ "name": "amount",
107
+ "type": "uint256"
108
+ }
109
+ ],
110
+ "name": "RewardsClaimedSet",
111
+ "type": "event"
112
+ },
113
+ {
114
+ "inputs": [
115
+ { "internalType": "address", "name": "comet", "type": "address" },
116
+ { "internalType": "address", "name": "src", "type": "address" },
117
+ { "internalType": "bool", "name": "shouldAccrue", "type": "bool" }
118
+ ],
119
+ "name": "claim",
120
+ "outputs": [],
121
+ "stateMutability": "nonpayable",
122
+ "type": "function"
123
+ },
124
+ {
125
+ "inputs": [
126
+ { "internalType": "address", "name": "comet", "type": "address" },
127
+ { "internalType": "address", "name": "src", "type": "address" },
128
+ { "internalType": "address", "name": "to", "type": "address" },
129
+ { "internalType": "bool", "name": "shouldAccrue", "type": "bool" }
130
+ ],
131
+ "name": "claimTo",
132
+ "outputs": [],
133
+ "stateMutability": "nonpayable",
134
+ "type": "function"
135
+ },
136
+ {
137
+ "inputs": [
138
+ { "internalType": "address", "name": "comet", "type": "address" },
139
+ { "internalType": "address", "name": "account", "type": "address" }
140
+ ],
141
+ "name": "getRewardOwed",
142
+ "outputs": [
143
+ {
144
+ "components": [
145
+ { "internalType": "address", "name": "token", "type": "address" },
146
+ { "internalType": "uint256", "name": "owed", "type": "uint256" }
147
+ ],
148
+ "internalType": "struct CometRewards.RewardOwed",
149
+ "name": "",
150
+ "type": "tuple"
151
+ }
152
+ ],
153
+ "stateMutability": "nonpayable",
154
+ "type": "function"
155
+ },
156
+ {
157
+ "inputs": [],
158
+ "name": "governor",
159
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
160
+ "stateMutability": "view",
161
+ "type": "function"
162
+ },
163
+ {
164
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
165
+ "name": "rewardConfig",
166
+ "outputs": [
167
+ { "internalType": "address", "name": "token", "type": "address" },
168
+ { "internalType": "uint64", "name": "rescaleFactor", "type": "uint64" },
169
+ { "internalType": "bool", "name": "shouldUpscale", "type": "bool" },
170
+ { "internalType": "uint256", "name": "multiplier", "type": "uint256" }
171
+ ],
172
+ "stateMutability": "view",
173
+ "type": "function"
174
+ },
175
+ {
176
+ "inputs": [
177
+ { "internalType": "address", "name": "", "type": "address" },
178
+ { "internalType": "address", "name": "", "type": "address" }
179
+ ],
180
+ "name": "rewardsClaimed",
181
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
182
+ "stateMutability": "view",
183
+ "type": "function"
184
+ },
185
+ {
186
+ "inputs": [
187
+ { "internalType": "address", "name": "comet", "type": "address" },
188
+ { "internalType": "address", "name": "token", "type": "address" }
189
+ ],
190
+ "name": "setRewardConfig",
191
+ "outputs": [],
192
+ "stateMutability": "nonpayable",
193
+ "type": "function"
194
+ },
195
+ {
196
+ "inputs": [
197
+ { "internalType": "address", "name": "comet", "type": "address" },
198
+ { "internalType": "address", "name": "token", "type": "address" },
199
+ { "internalType": "uint256", "name": "multiplier", "type": "uint256" }
200
+ ],
201
+ "name": "setRewardConfigWithMultiplier",
202
+ "outputs": [],
203
+ "stateMutability": "nonpayable",
204
+ "type": "function"
205
+ },
206
+ {
207
+ "inputs": [
208
+ { "internalType": "address", "name": "comet", "type": "address" },
209
+ { "internalType": "address[]", "name": "users", "type": "address[]" },
210
+ {
211
+ "internalType": "uint256[]",
212
+ "name": "claimedAmounts",
213
+ "type": "uint256[]"
214
+ }
215
+ ],
216
+ "name": "setRewardsClaimed",
217
+ "outputs": [],
218
+ "stateMutability": "nonpayable",
219
+ "type": "function"
220
+ },
221
+ {
222
+ "inputs": [
223
+ { "internalType": "address", "name": "newGovernor", "type": "address" }
224
+ ],
225
+ "name": "transferGovernor",
226
+ "outputs": [],
227
+ "stateMutability": "nonpayable",
228
+ "type": "function"
229
+ },
230
+ {
231
+ "inputs": [
232
+ { "internalType": "address", "name": "token", "type": "address" },
233
+ { "internalType": "address", "name": "to", "type": "address" },
234
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
235
+ ],
236
+ "name": "withdrawToken",
237
+ "outputs": [],
238
+ "stateMutability": "nonpayable",
239
+ "type": "function"
240
+ }
241
+ ]
package/src/config.ts CHANGED
@@ -81,10 +81,15 @@ export const stakingAddress: AddressDappNetworkMap = {
81
81
  [Dapp.AAVEV3]: "0x929EC64c34a17401F460460D4B9390518E5B473e"
82
82
  },
83
83
  [Network.OPTIMISM]: {
84
- [Dapp.AAVEV3]: "0x929EC64c34a17401F460460D4B9390518E5B473e"
84
+ [Dapp.AAVEV3]: "0x929EC64c34a17401F460460D4B9390518E5B473e",
85
+ [Dapp.COMPOUNDV3]: "0x443ea0340cb75a160f31a440722dec7b5bc3c2e9"
85
86
  },
86
- [Network.ARBITRUM]: {},
87
- [Network.BASE]: {}
87
+ [Network.ARBITRUM]: {
88
+ [Dapp.COMPOUNDV3]: "0x88730d254a2f7e6ac8388c3198afd694ba9f7fae"
89
+ },
90
+ [Network.BASE]: {
91
+ [Dapp.PANCAKECL]: "0xC6A2Db661D5a5690172d8eB0a7DEA2d3008665A3"
92
+ }
88
93
  };
89
94
 
90
95
  export const aaveAddressProvider: AddressDappNetworkMap = {
@@ -117,7 +122,8 @@ export const nonfungiblePositionManagerAddress: AddressDappNetworkMap = {
117
122
  },
118
123
  [Network.BASE]: {
119
124
  [Dapp.UNISWAPV3]: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",
120
- [Dapp.AERODROMECL]: "0x827922686190790b37229fd06084350e74485b72"
125
+ [Dapp.AERODROMECL]: "0x827922686190790b37229fd06084350e74485b72",
126
+ [Dapp.PANCAKECL]: "0x46A15B0b27311cedF172AB29E4f4766fbE7F4364"
121
127
  }
122
128
  };
123
129
 
@@ -46,8 +46,8 @@ import {
46
46
  } from "../services/toros/easySwapper";
47
47
  import { getAaveV3ClaimTxData } from "../services/aave/incentives";
48
48
  import {
49
+ getClOwner,
49
50
  getVelodromeAddLiquidityTxData,
50
- getVelodromeClOwner,
51
51
  getVelodromeRemoveLiquidityTxData
52
52
  } from "../services/velodrome/liquidity";
53
53
  import {
@@ -80,6 +80,12 @@ import {
80
80
  getCompoundV3LendTxData,
81
81
  getCompoundV3WithdrawTxData
82
82
  } from "../services/compound/lending";
83
+ import { getCompoundV3ClaimTxData } from "../services/compound/rewards";
84
+ import {
85
+ getPancakeHarvestClaimTxData,
86
+ getPancakeStakeTxData,
87
+ getPancakeUnStakeTxData
88
+ } from "../services/pancake/staking";
83
89
 
84
90
  export class Pool {
85
91
  public readonly poolLogic: Contract;
@@ -581,12 +587,19 @@ export class Pool {
581
587
  case Dapp.AERODROMECL:
582
588
  stakeTxData = getVelodromeStakeTxData(amount, true);
583
589
  break;
590
+ case Dapp.PANCAKECL:
591
+ stakeTxData = getPancakeStakeTxData(this, amount.toString(), gauge);
592
+ break;
584
593
  default:
585
594
  throw new Error("dapp not supported");
586
595
  }
596
+ const txTo =
597
+ dapp !== Dapp.PANCAKECL
598
+ ? gauge
599
+ : nonfungiblePositionManagerAddress[this.network][dapp];
587
600
  const tx = await getPoolTxOrGasEstimate(
588
601
  this,
589
- [gauge, stakeTxData, options],
602
+ [txTo, stakeTxData, options],
590
603
  estimateGas
591
604
  );
592
605
  return tx;
@@ -637,10 +650,18 @@ export class Pool {
637
650
  options: any = null,
638
651
  estimateGas = false
639
652
  ): Promise<any> {
653
+ let unstakeTxData;
640
654
  const rewardsGauge = new ethers.utils.Interface(IBalancerRewardsGauge.abi);
641
- const unstakeTxData = rewardsGauge.encodeFunctionData("withdraw(uint256)", [
642
- amount
643
- ]);
655
+ if (
656
+ gauge.toLowerCase() ===
657
+ stakingAddress[this.network][Dapp.PANCAKECL]?.toLowerCase()
658
+ ) {
659
+ unstakeTxData = getPancakeUnStakeTxData(this, amount.toString());
660
+ } else {
661
+ unstakeTxData = rewardsGauge.encodeFunctionData("withdraw(uint256)", [
662
+ amount
663
+ ]);
664
+ }
644
665
  const tx = await getPoolTxOrGasEstimate(
645
666
  this,
646
667
  [gauge, unstakeTxData, options],
@@ -1040,6 +1061,31 @@ export class Pool {
1040
1061
  return tx;
1041
1062
  }
1042
1063
 
1064
+ /**
1065
+ * Claim rewards from CompoundV3
1066
+ * @param {string} asset Compound lending asset
1067
+ * @param {any} options Transaction options
1068
+ * @param {boolean} estimateGas Simulate/estimate gas
1069
+ * @returns {Promise<any>} Transaction
1070
+ */
1071
+ async harvestCompoundV3Rewards(
1072
+ asset: string,
1073
+ options: any = null,
1074
+ estimateGas = false
1075
+ ): Promise<any> {
1076
+ const claimTxData = await getCompoundV3ClaimTxData(this, asset);
1077
+ const tx = await getPoolTxOrGasEstimate(
1078
+ this,
1079
+ [
1080
+ stakingAddress[this.network][Dapp.COMPOUNDV3] as string,
1081
+ claimTxData,
1082
+ options
1083
+ ],
1084
+ estimateGas
1085
+ );
1086
+ return tx;
1087
+ }
1088
+
1043
1089
  /**
1044
1090
  * Create UniswapV3 liquidity pool
1045
1091
  * @param {dapp} Platform UniswapV3, VelodromeCL, AerodromeCL or RamesesCL
@@ -1057,7 +1103,12 @@ export class Pool {
1057
1103
  * @returns {Promise<any>} Transaction
1058
1104
  */
1059
1105
  async addLiquidityUniswapV3(
1060
- dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL | Dapp.RAMSESCL,
1106
+ dapp:
1107
+ | Dapp.UNISWAPV3
1108
+ | Dapp.VELODROMECL
1109
+ | Dapp.AERODROMECL
1110
+ | Dapp.RAMSESCL
1111
+ | Dapp.PANCAKECL,
1061
1112
  assetA: string,
1062
1113
  assetB: string,
1063
1114
  amountA: BigNumber | string,
@@ -1130,7 +1181,8 @@ export class Pool {
1130
1181
  break;
1131
1182
  case Dapp.VELODROMECL:
1132
1183
  case Dapp.AERODROMECL:
1133
- const tokenIdOwner = await getVelodromeClOwner(this, dapp, tokenId);
1184
+ case Dapp.PANCAKECL:
1185
+ const tokenIdOwner = await getClOwner(this, dapp, tokenId);
1134
1186
  if (tokenIdOwner.toLowerCase() === this.address.toLowerCase()) {
1135
1187
  dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1136
1188
  } else {
@@ -1145,8 +1197,14 @@ export class Pool {
1145
1197
  default:
1146
1198
  throw new Error("dapp not supported");
1147
1199
  }
1148
- if (!isStaked) {
1149
- txData = await getDecreaseLiquidityTxData(this, dapp, tokenId, amount);
1200
+ if (!isStaked || dapp === Dapp.PANCAKECL) {
1201
+ txData = await getDecreaseLiquidityTxData(
1202
+ this,
1203
+ dapp,
1204
+ tokenId,
1205
+ amount,
1206
+ isStaked
1207
+ );
1150
1208
  } else {
1151
1209
  throw new Error(
1152
1210
  "unsupported decreaseStakedLiquidity: unstake first to decrease lp"
@@ -1188,7 +1246,8 @@ export class Pool {
1188
1246
  break;
1189
1247
  case Dapp.VELODROMECL:
1190
1248
  case Dapp.AERODROMECL:
1191
- const tokenIdOwner = await getVelodromeClOwner(this, dapp, tokenId);
1249
+ case Dapp.PANCAKECL:
1250
+ const tokenIdOwner = await getClOwner(this, dapp, tokenId);
1192
1251
  if (tokenIdOwner.toLowerCase() === this.address.toLowerCase()) {
1193
1252
  dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1194
1253
  } else {
@@ -1203,7 +1262,8 @@ export class Pool {
1203
1262
  default:
1204
1263
  throw new Error("dapp not supported");
1205
1264
  }
1206
- if (!isStaked) {
1265
+ //PancakeCL supports increase liquidity to staked position
1266
+ if (!isStaked || dapp === Dapp.PANCAKECL) {
1207
1267
  txData = await getIncreaseLiquidityTxData(
1208
1268
  this,
1209
1269
  dapp,
@@ -1270,7 +1330,8 @@ export class Pool {
1270
1330
  break;
1271
1331
  case Dapp.VELODROMECL:
1272
1332
  case Dapp.AERODROMECL:
1273
- const tokenIdOwner = await getVelodromeClOwner(this, dapp, tokenId);
1333
+ case Dapp.PANCAKECL:
1334
+ const tokenIdOwner = await getClOwner(this, dapp, tokenId);
1274
1335
  if (tokenIdOwner.toLowerCase() === this.address.toLowerCase()) {
1275
1336
  contractAddress =
1276
1337
  nonfungiblePositionManagerAddress[this.network][dapp];
@@ -1279,9 +1340,13 @@ export class Pool {
1279
1340
  [[tokenId, this.address, MaxUint128, MaxUint128]]
1280
1341
  );
1281
1342
  } else {
1282
- //staked in gauge
1343
+ //staked in gauge or pancake masterchef
1283
1344
  contractAddress = tokenIdOwner;
1284
- txData = getVelodromeCLClaimTxData(tokenId);
1345
+ if (dapp === Dapp.PANCAKECL) {
1346
+ txData = getPancakeHarvestClaimTxData(this, tokenId);
1347
+ } else {
1348
+ txData = getVelodromeCLClaimTxData(tokenId);
1349
+ }
1285
1350
  }
1286
1351
  break;
1287
1352
  default:
@@ -0,0 +1,9 @@
1
+ import { ethers } from "ethers";
2
+ import ICometRewards from "../../abi/compound/ICometRewards.json";
3
+ import { Pool } from "../..";
4
+
5
+ export function getCompoundV3ClaimTxData(pool: Pool, asset: string): string {
6
+ const iCometRewards = new ethers.utils.Interface(ICometRewards);
7
+
8
+ return iCometRewards.encodeFunctionData("claim", [asset, pool.address, true]);
9
+ }
@@ -0,0 +1,46 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { ethers } from "ethers";
3
+ import INonfungiblePositionManager from "../../abi/INonfungiblePositionManager.json";
4
+ import IPanncakeMasterChef from "../../abi/IPancakeMasterChefV3.json";
5
+ import { Pool } from "../../entities";
6
+ import { Transaction } from "../../types";
7
+ import { MaxUint128 } from "../../config";
8
+ const iNonfungiblePositionManager = new ethers.utils.Interface(
9
+ INonfungiblePositionManager.abi
10
+ );
11
+ const iMasterChef = new ethers.utils.Interface(IPanncakeMasterChef);
12
+
13
+ export function getPancakeStakeTxData(
14
+ pool: Pool,
15
+ tokenId: string,
16
+ stakingAddress: string
17
+ ): string {
18
+ return iNonfungiblePositionManager.encodeFunctionData("safeTransferFrom", [
19
+ pool.address,
20
+ stakingAddress,
21
+ tokenId
22
+ ]);
23
+ }
24
+
25
+ export function getPancakeUnStakeTxData(pool: Pool, tokenId: string): string {
26
+ return iMasterChef.encodeFunctionData("withdraw", [tokenId, pool.address]);
27
+ }
28
+
29
+ export function getPancakeHarvestClaimTxData(
30
+ pool: Pool,
31
+ tokenId: string
32
+ ): string {
33
+ const harvestTxData = iMasterChef.encodeFunctionData(Transaction.HARVEST, [
34
+ tokenId,
35
+ pool.address
36
+ ]);
37
+ const collectTxData = iMasterChef.encodeFunctionData(Transaction.COLLECT, [
38
+ [tokenId, pool.address, MaxUint128, MaxUint128]
39
+ ]);
40
+
41
+ const multicallParams = [harvestTxData, collectTxData];
42
+
43
+ return iMasterChef.encodeFunctionData(Transaction.MULTI_CALL, [
44
+ multicallParams
45
+ ]);
46
+ }