opnet 1.2.26 → 1.3.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.
Files changed (46) hide show
  1. package/browser/_version.d.ts +1 -1
  2. package/browser/abi/shared/interfaces/motoswap/IMotoChefContract.d.ts +101 -34
  3. package/browser/abi/shared/interfaces/motoswap/IMotoswapFactoryContract.d.ts +6 -0
  4. package/browser/abi/shared/interfaces/motoswap/IMotoswapPoolContract.d.ts +13 -1
  5. package/browser/abi/shared/interfaces/motoswap/IMotoswapStakingContract.d.ts +4 -1
  6. package/browser/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +3 -4
  7. package/browser/abi/shared/interfaces/opnet/IOP_20Contract.d.ts +1 -1
  8. package/browser/index.js +1 -1
  9. package/browser/providers/AbstractRpcProvider.d.ts +1 -1
  10. package/build/_version.d.ts +1 -1
  11. package/build/_version.js +1 -1
  12. package/build/abi/shared/interfaces/motoswap/IMotoChefContract.d.ts +101 -34
  13. package/build/abi/shared/interfaces/motoswap/IMotoswapFactoryContract.d.ts +6 -0
  14. package/build/abi/shared/interfaces/motoswap/IMotoswapPoolContract.d.ts +13 -1
  15. package/build/abi/shared/interfaces/motoswap/IMotoswapStakingContract.d.ts +4 -1
  16. package/build/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +3 -4
  17. package/build/abi/shared/interfaces/opnet/IOP_20Contract.d.ts +1 -1
  18. package/build/abi/shared/json/motoswap/MOTOSWAP_FACTORY_ABI.js +27 -0
  19. package/build/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.js +115 -50
  20. package/build/abi/shared/json/motoswap/MOTOSWAP_POOL_ABI.js +12 -1
  21. package/build/abi/shared/json/motoswap/MOTOSWAP_ROUTER_ABI.js +2 -2
  22. package/build/abi/shared/json/motoswap/MOTOSWAP_STAKING_ABI.js +14 -6
  23. package/build/abi/shared/json/motoswap/NATIVE_SWAP_ABI.js +107 -363
  24. package/build/abi/shared/json/opnet/OP_20_ABI.js +1 -1
  25. package/build/contracts/Contract.js +2 -12
  26. package/build/contracts/TypeToStr.js +0 -1
  27. package/build/providers/AbstractRpcProvider.d.ts +1 -1
  28. package/build/providers/AbstractRpcProvider.js +8 -4
  29. package/package.json +13 -13
  30. package/src/_version.ts +1 -1
  31. package/src/abi/shared/interfaces/motoswap/IMotoChefContract.ts +147 -62
  32. package/src/abi/shared/interfaces/motoswap/IMotoswapFactoryContract.ts +6 -0
  33. package/src/abi/shared/interfaces/motoswap/IMotoswapPoolContract.ts +9 -1
  34. package/src/abi/shared/interfaces/motoswap/IMotoswapStakingContract.ts +12 -7
  35. package/src/abi/shared/interfaces/motoswap/INativeSwapContract.ts +31 -11
  36. package/src/abi/shared/interfaces/opnet/IOP_20Contract.ts +1 -1
  37. package/src/abi/shared/json/motoswap/MOTOSWAP_FACTORY_ABI.ts +27 -0
  38. package/src/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.ts +116 -51
  39. package/src/abi/shared/json/motoswap/MOTOSWAP_POOL_ABI.ts +12 -1
  40. package/src/abi/shared/json/motoswap/MOTOSWAP_ROUTER_ABI.ts +2 -2
  41. package/src/abi/shared/json/motoswap/MOTOSWAP_STAKING_ABI.ts +15 -6
  42. package/src/abi/shared/json/motoswap/NATIVE_SWAP_ABI.ts +128 -375
  43. package/src/abi/shared/json/opnet/OP_20_ABI.ts +1 -1
  44. package/src/contracts/Contract.ts +2 -13
  45. package/src/contracts/TypeToStr.ts +0 -1
  46. package/src/providers/AbstractRpcProvider.ts +21 -32
@@ -63,13 +63,14 @@ export class AbstractRpcProvider {
63
63
  const payload = this.buildJsonRpcPayload(JSONRpcMethods.TRANSACTION_PREIMAGE, []);
64
64
  const rawBlockNumber = await this.callPayloadSingle(payload);
65
65
  const result = rawBlockNumber.result;
66
- if (!result || result.preimage === '0000000000000000000000000000000000000000000000000000000000000000') {
66
+ if (!result ||
67
+ result.preimage === '0000000000000000000000000000000000000000000000000000000000000000') {
67
68
  throw new Error('No preimage found. OPNet is probably not active yet on this blockchain.');
68
69
  }
69
70
  const preimage = Buffer.from(result.preimage, 'hex');
70
71
  this.preimageCache = {
71
72
  preimage: preimage,
72
- expireAt: Date.now() + 10_000
73
+ expireAt: Date.now() + 10_000,
73
74
  };
74
75
  return preimage;
75
76
  }
@@ -361,7 +362,7 @@ export class AbstractRpcProvider {
361
362
  jsonrpc: '2.0',
362
363
  };
363
364
  }
364
- async getPublicKeysInfo(addresses) {
365
+ async getPublicKeysInfo(addresses, logErrors = false) {
365
366
  const addressArray = Array.isArray(addresses) ? addresses : [addresses];
366
367
  addressArray.forEach((addr) => {
367
368
  if (this.validateAddress(addr, this.network) === null) {
@@ -380,7 +381,10 @@ export class AbstractRpcProvider {
380
381
  for (const pubKey of keys) {
381
382
  const pubKeyValue = result[pubKey];
382
383
  if ('error' in pubKeyValue) {
383
- throw new Error(`Error fetching public key info: ${pubKeyValue.error}`);
384
+ if (logErrors) {
385
+ console.error(`Error fetching public key info for ${pubKey}: ${pubKeyValue.error}`);
386
+ }
387
+ continue;
384
388
  }
385
389
  response[pubKey] = pubKeyValue.originalPubKey
386
390
  ? Address.fromString(pubKeyValue.originalPubKey)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opnet",
3
3
  "type": "module",
4
- "version": "1.2.26",
4
+ "version": "1.3.0",
5
5
  "author": "OP_NET",
6
6
  "description": "The perfect library for building Bitcoin-based applications.",
7
7
  "engines": {
@@ -60,24 +60,24 @@
60
60
  "docs": "typedoc --out docs --tsconfig tsconfig.json --readme README.md --name OPNet --plugin typedoc-material-theme --themeColor '#cb9820' --exclude src/scripts/test.ts --exclude src/index.ts src"
61
61
  },
62
62
  "devDependencies": {
63
- "@babel/core": "^7.26.8",
63
+ "@babel/core": "^7.26.9",
64
64
  "@babel/plugin-proposal-class-properties": "^7.18.6",
65
65
  "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
66
- "@babel/plugin-transform-runtime": "^7.26.8",
67
- "@babel/preset-env": "^7.26.8",
66
+ "@babel/plugin-transform-runtime": "^7.26.9",
67
+ "@babel/preset-env": "^7.26.9",
68
68
  "@babel/preset-flow": "^7.25.9",
69
69
  "@babel/preset-react": "^7.26.3",
70
70
  "@babel/preset-typescript": "^7.26.0",
71
- "@eslint/js": "^9.20.0",
72
- "@types/node": "^22.13.2",
71
+ "@eslint/js": "^9.22.0",
72
+ "@types/node": "^22.13.10",
73
73
  "@types/sha.js": "^2.4.4",
74
- "@types/ws": "^8.5.14",
74
+ "@types/ws": "^8.18.0",
75
75
  "assert": "^2.1.0",
76
76
  "babel-loader": "^9.2.1",
77
77
  "babel-plugin-transform-import-meta": "^2.3.2",
78
78
  "babel-preset-react": "^6.24.1",
79
79
  "babelify": "^10.0.0",
80
- "eslint": "^9.20.1",
80
+ "eslint": "^9.22.0",
81
81
  "gulp": "^5.0.0",
82
82
  "gulp-cached": "^1.1.1",
83
83
  "gulp-clean": "^0.4.0",
@@ -86,23 +86,23 @@
86
86
  "gulp-typescript": "^6.0.0-alpha.1",
87
87
  "https-browserify": "^1.0.0",
88
88
  "os-browserify": "^0.3.0",
89
- "prettier": "^3.5.0",
89
+ "prettier": "^3.5.3",
90
90
  "process": "^0.11.10",
91
91
  "stream-browserify": "^3.0.0",
92
92
  "stream-http": "^3.2.0",
93
93
  "ts-loader": "^9.5.2",
94
94
  "ts-node": "^10.9.2",
95
- "typedoc": "^0.27.7",
95
+ "typedoc": "^0.27.9",
96
96
  "typescript": "^5.7.3",
97
- "typescript-eslint": "^8.24.0",
98
- "webpack": "^5.97.1",
97
+ "typescript-eslint": "^8.26.0",
98
+ "webpack": "^5.98.0",
99
99
  "webpack-cli": "^6.0.1"
100
100
  },
101
101
  "dependencies": {
102
102
  "@bitcoinerlab/secp256k1": "^1.2.0",
103
103
  "@btc-vision/bitcoin": "^6.3.6",
104
104
  "@btc-vision/bitcoin-rpc": "^1.0.1",
105
- "@btc-vision/transaction": "^1.2.14",
105
+ "@btc-vision/transaction": "^1.3.1",
106
106
  "@noble/hashes": "^1.7.1",
107
107
  "bignumber.js": "^9.1.2",
108
108
  "buffer": "^6.0.3",
package/src/_version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.2.26';
1
+ export const version = '1.3.0';
@@ -1,5 +1,5 @@
1
1
  import { Address } from '@btc-vision/transaction';
2
- import { CallResult } from '../../../../opnet.js';
2
+ import { CallResult, OPNetEvent } from '../../../../opnet.js';
3
3
  import { IOwnableReentrancyGuardContract } from './IOwnableReentrancyGuardContract.js';
4
4
 
5
5
  export type PoolInfo = {
@@ -13,20 +13,31 @@ export type UserInfo = {
13
13
  rewardDebt: bigint;
14
14
  };
15
15
 
16
- export type Initialize = CallResult<{
17
- success: boolean;
18
- }>;
16
+ export type Initialize = CallResult<
17
+ {
18
+ success: boolean;
19
+ },
20
+ [OPNetEvent<LogPoolAdditionEvent>, OPNetEvent<LogInitEvent>]
21
+ >;
19
22
 
20
23
  export type GetLpToken = CallResult<{
21
24
  lpTokenAddress: Address;
22
25
  }>;
23
26
 
27
+ export type GetLpTokens = CallResult<{
28
+ lpTokens: Address[];
29
+ }>;
30
+
24
31
  export type GetRewarder = CallResult<{
25
32
  rewarderAddress: Address;
26
33
  }>;
27
34
 
28
35
  export type GetPoolInfo = CallResult<PoolInfo>;
29
36
 
37
+ export type GetPoolsLength = CallResult<{
38
+ poolLength: bigint;
39
+ }>;
40
+
30
41
  export type GetUserInfo = CallResult<UserInfo>;
31
42
 
32
43
  export type Pools = CallResult<{
@@ -54,14 +65,36 @@ export type BonusMultiplier = CallResult<{
54
65
  bonusMultiplier: bigint;
55
66
  }>;
56
67
 
57
- export type Add = CallResult<{
58
- success: boolean;
68
+ export type TotalBtcStaked = CallResult<{
69
+ totalBtcStaked: bigint;
59
70
  }>;
60
71
 
61
- export type Set = CallResult<{
62
- success: boolean;
72
+ export type TreasuryAddress = CallResult<{
73
+ TreasuryAddress: string;
74
+ }>;
75
+
76
+ export type GetStakingTxId = CallResult<{
77
+ stakingTxId: bigint;
63
78
  }>;
64
79
 
80
+ export type GetStakingIndex = CallResult<{
81
+ stakingIndex: bigint;
82
+ }>;
83
+
84
+ export type Add = CallResult<
85
+ {
86
+ success: boolean;
87
+ },
88
+ [OPNetEvent<LogPoolAdditionEvent>]
89
+ >;
90
+
91
+ export type Set = CallResult<
92
+ {
93
+ success: boolean;
94
+ },
95
+ [OPNetEvent<LogSetPoolEvent>]
96
+ >;
97
+
65
98
  export type SetMigrator = CallResult<{
66
99
  success: boolean;
67
100
  }>;
@@ -82,23 +115,35 @@ export type MassUpdatePools = CallResult<{
82
115
  success: boolean;
83
116
  }>;
84
117
 
85
- export type UpdatePool = CallResult<PoolInfo>;
86
-
87
- export type Deposit = CallResult<{
88
- success: boolean;
89
- }>;
90
-
91
- export type Withdraw = CallResult<{
92
- success: boolean;
93
- }>;
94
-
95
- export type Harvest = CallResult<{
96
- success: boolean;
97
- }>;
98
-
99
- export type WithdrawAndHarvest = CallResult<{
100
- success: boolean;
101
- }>;
118
+ export type UpdatePool = CallResult<PoolInfo, [OPNetEvent<LogUpdatePoolEvent>]>;
119
+
120
+ export type Deposit = CallResult<
121
+ {
122
+ success: boolean;
123
+ },
124
+ [OPNetEvent<DepositEvent>]
125
+ >;
126
+
127
+ export type Withdraw = CallResult<
128
+ {
129
+ success: boolean;
130
+ },
131
+ [OPNetEvent<WithdrawEvent>]
132
+ >;
133
+
134
+ export type Harvest = CallResult<
135
+ {
136
+ success: boolean;
137
+ },
138
+ [OPNetEvent<HarvestEvent>]
139
+ >;
140
+
141
+ export type WithdrawAndHarvest = CallResult<
142
+ {
143
+ success: boolean;
144
+ },
145
+ [OPNetEvent<WithdrawEvent>, OPNetEvent<HarvestEvent>]
146
+ >;
102
147
 
103
148
  export type SetDev = CallResult<{
104
149
  success: boolean;
@@ -116,27 +161,48 @@ export type SetBonusMultiplier = CallResult<{
116
161
  success: boolean;
117
162
  }>;
118
163
 
119
- export type EmergencyWithdraw = CallResult<{
120
- success: boolean;
121
- }>;
164
+ export type EmergencyWithdraw = CallResult<
165
+ {
166
+ success: boolean;
167
+ },
168
+ [OPNetEvent<EmergencyWithdrawEvent>]
169
+ >;
170
+
171
+ export type StakeBtc = CallResult<
172
+ {
173
+ success: boolean;
174
+ },
175
+ [OPNetEvent<StakeBTCEvent>]
176
+ >;
177
+
178
+ export type UnstakeBtc = CallResult<
179
+ {
180
+ success: boolean;
181
+ },
182
+ [OPNetEvent<UnstakeBTCEvent>]
183
+ >;
122
184
 
123
185
  // EVENTS
186
+ export type LogInitEvent = {
187
+ success: boolean;
188
+ };
189
+
124
190
  export type LogPoolAdditionEvent = {
125
- readonly pid: number; // uint32
191
+ readonly pid: bigint; // uint256
126
192
  readonly allocPoint: bigint; // uint256
127
193
  readonly lpToken: Address;
128
194
  readonly rewarder: Address;
129
195
  };
130
196
 
131
197
  export type LogSetPoolEvent = {
132
- readonly pid: number; // uint32
198
+ readonly pid: bigint; // uint256
133
199
  readonly allocPoint: bigint; // uint256
134
200
  readonly rewarder: Address;
135
201
  readonly overwrite: boolean; // bool
136
202
  };
137
203
 
138
204
  export type LogUpdatePoolEvent = {
139
- readonly pid: number; // uint32
205
+ readonly pid: bigint; // uint256
140
206
  readonly lastRewardBlock: bigint; // uint64
141
207
  readonly lpSupply: bigint; // uint256
142
208
  readonly accMotoPerShare: bigint; // uint256
@@ -144,32 +210,44 @@ export type LogUpdatePoolEvent = {
144
210
 
145
211
  export type DepositEvent = {
146
212
  readonly user: Address;
147
- readonly pid: number; // uint32
213
+ readonly pid: bigint; // uint32
148
214
  readonly amount: bigint; // uint256
149
215
  readonly to: Address;
150
216
  };
151
217
 
152
218
  export type WithdrawEvent = {
153
219
  readonly user: Address;
154
- readonly pid: number; // uint32
220
+ readonly pid: bigint; // uint256
155
221
  readonly amount: bigint; // uint256
156
222
  readonly to: Address;
157
223
  };
158
224
 
159
225
  export type HarvestEvent = {
160
226
  readonly user: Address;
161
- readonly pid: number; // uint32
227
+ readonly pid: bigint; // uint256
162
228
  readonly amount: bigint; // uint256
163
229
  };
164
230
 
165
231
  export type EmergencyWithdrawEvent = {
166
232
  readonly user: Address;
167
- readonly pid: number; // uint32
233
+ readonly pid: bigint; // uint256
168
234
  readonly amount: bigint; // uint256
169
235
  readonly to: Address;
170
236
  };
171
237
 
172
- // TODO: Add events to results.
238
+ export type StakeBTCEvent = {
239
+ readonly user: Address;
240
+ readonly amount: bigint;
241
+ readonly stakingTxId: bigint;
242
+ readonly stakingIndex: bigint;
243
+ };
244
+
245
+ export type UnstakeBTCEvent = {
246
+ readonly user: Address;
247
+ readonly amount: bigint;
248
+ readonly stakingTxId: bigint;
249
+ readonly stakingIndex: bigint;
250
+ };
173
251
 
174
252
  /**
175
253
  * @description This interface represents the MotoChef contract.
@@ -186,6 +264,8 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
186
264
  * @param {bigint} motoPerBlock The amount of MOTOs created per block.
187
265
  * @param {bigint} bonusEndBlock The block number when the bonus MOTO period ends.
188
266
  * @param {bigint} bonusMultiplier The bonus muliplier for early moto makers.
267
+ * @param treasuryAddress The treasury address for btc
268
+ * @param btcAllocPoint The alloc point for the BTC pool
189
269
  * @returns {Initialize}
190
270
  */
191
271
  initialize(
@@ -195,6 +275,8 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
195
275
  motoPerBlock: bigint,
196
276
  bonusEndBlock: bigint,
197
277
  bonusMultiplier: bigint,
278
+ treasuryAddress: string,
279
+ btcAllocPoint: bigint,
198
280
  ): Promise<Initialize>;
199
281
 
200
282
  /**
@@ -202,21 +284,18 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
202
284
  * @param {number} pid The index of the pool
203
285
  * @returns {GetLpToken}
204
286
  */
205
- getLpToken(pid: number): Promise<GetLpToken>;
287
+ getLpToken(pid: bigint): Promise<GetLpToken>;
206
288
 
207
- /**
208
- * @description Gets the rewarder address of a pool
209
- * @param {number} pid The index of the pool
210
- * @returns {GetRewarder}
211
- */
212
- getRewarder(pid: number): Promise<GetRewarder>;
289
+ getLpTokens(): Promise<GetLpTokens>;
213
290
 
214
291
  /**
215
292
  * @description Gets the pool info of a pool
216
293
  * @param {number} pid The index of the pool
217
294
  * @returns {GetPoolInfo}
218
295
  */
219
- getPoolInfo(pid: number): Promise<GetPoolInfo>;
296
+ getPoolInfo(pid: bigint): Promise<GetPoolInfo>;
297
+
298
+ getPoolsLength(): Promise<GetPoolsLength>;
220
299
 
221
300
  /**
222
301
  * @description Gets the user info of a pool
@@ -224,13 +303,7 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
224
303
  * @param {Address} user The address of the user
225
304
  * @returns {GetUserInfo}
226
305
  */
227
- getUserInfo(pid: number, user: Address): Promise<GetUserInfo>;
228
-
229
- /**
230
- * @description Gets all the available pools
231
- * @returns {Pools}
232
- */
233
- pools(): Promise<Pools>;
306
+ getUserInfo(pid: bigint, user: Address): Promise<GetUserInfo>;
234
307
 
235
308
  /**
236
309
  * @description Gets the total alloc point
@@ -262,6 +335,14 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
262
335
  */
263
336
  getBonusMultiplier(): Promise<BonusMultiplier>;
264
337
 
338
+ totalBtcStaked(): Promise<TotalBtcStaked>;
339
+
340
+ treasuryAddress(): Promise<TreasuryAddress>;
341
+
342
+ getStakingTxId(): Promise<GetStakingTxId>;
343
+
344
+ getStakingIndex(): Promise<GetStakingIndex>;
345
+
265
346
  /**
266
347
  * @description Set the moto per block. Can only be called by an admin.
267
348
  * @param {bigint} motoPerBlock The amount of MOTO per block.
@@ -290,7 +371,7 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
290
371
  * @param {Address} rewarder Address of the rewarder delegate.
291
372
  * @returns {Add}
292
373
  */
293
- add(allocPoint: bigint, lpToken: Address, rewarder: Address): Promise<Add>;
374
+ add(allocPoint: bigint, lpToken: Address): Promise<Add>;
294
375
 
295
376
  /**
296
377
  * @description Update the given pool's MOTO allocation point and `IRewarder` contract. Can only be called by an admin.
@@ -300,7 +381,7 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
300
381
  * @param {boolean} overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored.
301
382
  * @returns {Set}
302
383
  */
303
- set(pid: number, allocPoint: bigint, rewarder: Address, overwrite: boolean): Promise<Set>;
384
+ set(pid: bigint, allocPoint: bigint): Promise<Set>;
304
385
 
305
386
  /**
306
387
  * @description Set the `migrator` contract. Can only be called by an admin.
@@ -314,7 +395,7 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
314
395
  * @param {number} pid The index of the pool.
315
396
  * @returns {Migrate}
316
397
  */
317
- migrate(pid: number): Promise<Migrate>;
398
+ migrate(pid: bigint): Promise<Migrate>;
318
399
 
319
400
  /**
320
401
  * @description Get the multiplier over the given _from to _to block.
@@ -330,7 +411,7 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
330
411
  * @param {Address} user Address of user.
331
412
  * @returns {PendingMoto}
332
413
  */
333
- pendingMoto(pid: number, user: Address): Promise<PendingMoto>;
414
+ pendingMoto(pid: bigint, user: Address): Promise<PendingMoto>;
334
415
 
335
416
  /**
336
417
  * @description Update reward variables for all pools. Be careful of gas spending!
@@ -338,14 +419,14 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
338
419
  * @param {number[]} pids Pool IDs of all to be updated. Make sure to update all active pools.
339
420
  * @returns {MassUpdatePools}
340
421
  */
341
- massUpdatePools(length: number, pids: number[]): Promise<MassUpdatePools>;
422
+ massUpdatePools(length: number, pids: bigint[]): Promise<MassUpdatePools>;
342
423
 
343
424
  /**
344
425
  * @description Update reward variables of the given pool.
345
426
  * @param {number} pid The index of the pool
346
427
  * @returns {UpdatePool}
347
428
  */
348
- updatePool(pid: number): Promise<UpdatePool>;
429
+ updatePool(pid: bigint): Promise<UpdatePool>;
349
430
 
350
431
  /**
351
432
  * @description Deposit LP tokens to MotoChef for MOTO allocation.
@@ -354,7 +435,7 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
354
435
  * @param {Address} to The receiver of `amount` deposit benefit.
355
436
  * @returns {Deposit}
356
437
  */
357
- deposit(pid: number, amount: bigint, to: Address): Promise<Deposit>;
438
+ deposit(pid: bigint, amount: bigint, to: Address): Promise<Deposit>;
358
439
 
359
440
  /**
360
441
  * @description Withdraw LP tokens from MotoChef.
@@ -363,7 +444,7 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
363
444
  * @param {Address} to The receiver of `amount` deposit benefit.
364
445
  * @returns {Withdraw}
365
446
  */
366
- withdraw(pid: number, amount: bigint, to: Address): Promise<Withdraw>;
447
+ withdraw(pid: bigint, amount: bigint, to: Address): Promise<Withdraw>;
367
448
 
368
449
  /**
369
450
  * @description Harvest proceeds for transaction sender to `to`.
@@ -371,7 +452,7 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
371
452
  * @param {Address} to Receiver of MOTO rewards.
372
453
  * @returns {Harvest}
373
454
  */
374
- harvest(pid: number, to: Address): Promise<Harvest>;
455
+ harvest(pid: bigint, to: Address): Promise<Harvest>;
375
456
 
376
457
  /**
377
458
  * @description Withdraw LP tokens from MotoChef and harvest proceeds for transaction sender to `to`.
@@ -380,7 +461,7 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
380
461
  * @param {Address} to Receiver of the LP tokens and MOTO rewards.
381
462
  * @returns {WithdrawAndHarvest}
382
463
  */
383
- withdrawAndHarvest(pid: number, amount: bigint, to: Address): Promise<WithdrawAndHarvest>;
464
+ withdrawAndHarvest(pid: bigint, amount: bigint, to: Address): Promise<WithdrawAndHarvest>;
384
465
 
385
466
  /**
386
467
  * @description Withdraw without caring about rewards. EMERGENCY ONLY.
@@ -388,7 +469,7 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
388
469
  * @param {Address} to Receiver of the LP tokens.
389
470
  * @returns {EmergencyWithdraw}
390
471
  */
391
- emergencyWithdraw(pid: number, to: Address): Promise<EmergencyWithdraw>;
472
+ emergencyWithdraw(pid: bigint, to: Address): Promise<EmergencyWithdraw>;
392
473
 
393
474
  /**
394
475
  * @description Update dev address by the previous dev.
@@ -396,4 +477,8 @@ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
396
477
  * @returns {SetDev}
397
478
  */
398
479
  setDev(devaddr: Address): Promise<SetDev>;
480
+
481
+ stakeBtc(stakeAmount: bigint): Promise<StakeBtc>;
482
+
483
+ unstakeBtc(): Promise<UnstakeBtc>;
399
484
  }
@@ -34,4 +34,10 @@ export interface IMotoswapFactoryContract extends IOP_NETContract {
34
34
  token0: Address,
35
35
  token1: Address,
36
36
  ): Promise<CallResult<{ pool: bigint; address: Address }, [OPNetEvent<PoolCreatedEvent>]>>;
37
+
38
+ setStakingContractAddress(
39
+ stakingContractAddress: Address,
40
+ ): Promise<CallResult<{ success: boolean }>>;
41
+
42
+ getStakingContractAddress(): Promise<CallResult<{ stakingContractAddress: Address }>>;
37
43
  }
@@ -98,7 +98,9 @@ export interface IMotoswapPoolContract extends Omit<IOP_20Contract, 'burn' | 'mi
98
98
  * @param {Address} to
99
99
  * @returns {Promise<CallResult>}
100
100
  */
101
- burn(to: Address): Promise<CallResult>;
101
+ burn(
102
+ to: Address,
103
+ ): Promise<CallResult<{ amount0: bigint; amount1: bigint }, [OPNetEvent<PoolBurnEvent>]>>;
102
104
 
103
105
  /**
104
106
  * Get block timestamp last
@@ -124,4 +126,10 @@ export interface IMotoswapPoolContract extends Omit<IOP_20Contract, 'burn' | 'mi
124
126
  * @returns {Promise<CallResult>}
125
127
  */
126
128
  price1CumulativeLast(): Promise<CallResult<{ price1CumulativeLast: bigint }>>;
129
+
130
+ MINIMUM_LIQUIDITY(): Promise<CallResult<{ MINIMUM_LIQUIDITY: bigint }>>;
131
+
132
+ mint(to: Address): Promise<CallResult<{ liquidity: bigint }, [OPNetEvent<PoolMintEvent>]>>;
133
+
134
+ initialize(token0: Address, token1: Address): Promise<CallResult<{ success: boolean }>>;
127
135
  }
@@ -1,4 +1,4 @@
1
- import { ABIDataTypes, Address } from '@btc-vision/transaction';
1
+ import { Address } from '@btc-vision/transaction';
2
2
  import { CallResult } from '../../../../opnet.js';
3
3
  import { IOwnableReentrancyGuardContract } from './IOwnableReentrancyGuardContract.js';
4
4
 
@@ -14,6 +14,10 @@ export type TotalSupply = CallResult<{
14
14
  totalSupply: bigint;
15
15
  }>;
16
16
 
17
+ export type MotoAddress = CallResult<{
18
+ totalSupply: bigint;
19
+ }>;
20
+
17
21
  export type LastInteractedBlock = CallResult<{
18
22
  lastInteractedBlock: bigint;
19
23
  }>;
@@ -82,12 +86,6 @@ export type RewardTokenRemovedEvent = {
82
86
  * @cathegory Contracts
83
87
  */
84
88
  export interface IMotoswapStakingContract extends IOwnableReentrancyGuardContract {
85
- /**
86
- * @description Gets the Moto token address the staking contract uses for deposits
87
- * @returns {GetMotoAddress}
88
- */
89
- getMotoAddress(): Promise<GetMotoAddress>;
90
-
91
89
  /**
92
90
  * @description Gets the stake of a given user
93
91
  * @param address {Address} the address of the staker
@@ -101,6 +99,12 @@ export interface IMotoswapStakingContract extends IOwnableReentrancyGuardContrac
101
99
  */
102
100
  totalSupply(): Promise<TotalSupply>;
103
101
 
102
+ /**
103
+ * @description Returns the address of the MOTO token accepted as a deposit by the staking contract
104
+ * @returns {MotoAddress}
105
+ */
106
+ motoAddress(): Promise<MotoAddress>;
107
+
104
108
  /**
105
109
  * @description Returns the last block the user interacted with the protocol by staking, unstaking or claiming rewards
106
110
  * @param address {Address} the address of the staker
@@ -174,6 +178,7 @@ export interface IMotoswapStakingContract extends IOwnableReentrancyGuardContrac
174
178
  /**
175
179
  * @description Changes the address of the Moto token the protocol allows the users to stake
176
180
  * Also affects what token is paid out when unstaking.
181
+ * NOTE: Can only be called if the Moto token address is not set yet (i.e. == Address.dead())
177
182
  * @param token {Address} the address of the Moto token
178
183
  * @returns {AdminChangeMotoAddress}
179
184
  */