opnet 1.2.23 → 1.2.25

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 (27) hide show
  1. package/browser/_version.d.ts +1 -1
  2. package/browser/abi/shared/interfaces/motoswap/IMotoswapStakingContract.d.ts +75 -0
  3. package/browser/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +2 -1
  4. package/browser/abi/shared/json/motoswap/MOTOSWAP_STAKING_ABI.d.ts +3 -0
  5. package/browser/index.js +1 -1
  6. package/browser/providers/AbstractRpcProvider.d.ts +1 -1
  7. package/build/_version.d.ts +1 -1
  8. package/build/_version.js +1 -1
  9. package/build/abi/shared/interfaces/motoswap/IMotoswapStakingContract.d.ts +75 -0
  10. package/build/abi/shared/interfaces/motoswap/IMotoswapStakingContract.js +1 -0
  11. package/build/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +2 -1
  12. package/build/abi/shared/json/motoswap/MOTOSWAP_STAKING_ABI.d.ts +3 -0
  13. package/build/abi/shared/json/motoswap/MOTOSWAP_STAKING_ABI.js +158 -0
  14. package/build/abi/shared/json/motoswap/NATIVE_SWAP_ABI.js +8 -0
  15. package/build/contracts/Contract.js +10 -0
  16. package/build/contracts/TypeToStr.js +1 -0
  17. package/build/providers/AbstractRpcProvider.d.ts +1 -1
  18. package/build/providers/AbstractRpcProvider.js +4 -4
  19. package/package.json +16 -16
  20. package/src/_version.ts +1 -1
  21. package/src/abi/shared/interfaces/motoswap/IMotoswapStakingContract.ts +200 -0
  22. package/src/abi/shared/interfaces/motoswap/INativeSwapContract.ts +2 -0
  23. package/src/abi/shared/json/motoswap/MOTOSWAP_STAKING_ABI.ts +168 -0
  24. package/src/abi/shared/json/motoswap/NATIVE_SWAP_ABI.ts +8 -0
  25. package/src/contracts/Contract.ts +10 -0
  26. package/src/contracts/TypeToStr.ts +1 -0
  27. package/src/providers/AbstractRpcProvider.ts +8 -5
@@ -1,6 +1,6 @@
1
1
  import { Network } from '@btc-vision/bitcoin';
2
- import '../serialize/BigInt.js';
3
2
  import { Address, AddressTypes } from '@btc-vision/transaction';
3
+ import '../serialize/BigInt.js';
4
4
  import { Block } from '../block/Block.js';
5
5
  import { BlockGasParameters } from '../block/BlockGasParameters.js';
6
6
  import { BlockWitnesses } from '../block/interfaces/BlockWitness.js';
@@ -1 +1 @@
1
- export declare const version = "1.2.20";
1
+ export declare const version = "1.2.25";
package/build/_version.js CHANGED
@@ -1 +1 @@
1
- export const version = '1.2.20';
1
+ export const version = '1.2.25';
@@ -0,0 +1,75 @@
1
+ import { Address } from '@btc-vision/transaction';
2
+ import { CallResult } from '../../../../opnet.js';
3
+ import { IOwnableReentrancyGuardContract } from './IOwnableReentrancyGuardContract.js';
4
+ export type GetMotoAddress = CallResult<{
5
+ motoAddress: Address;
6
+ }>;
7
+ export type BalanceOf = CallResult<{
8
+ balance: bigint;
9
+ }>;
10
+ export type TotalSupply = CallResult<{
11
+ totalSupply: bigint;
12
+ }>;
13
+ export type LastInteractedBlock = CallResult<{
14
+ lastInteractedBlock: bigint;
15
+ }>;
16
+ export type RewardDebt = CallResult<{
17
+ rewardDebt: bigint;
18
+ }>;
19
+ export type RewardBalances = CallResult<{
20
+ rewardBalance: bigint;
21
+ }>;
22
+ export type CalculateSlashingFee = CallResult<{
23
+ slashingFee: bigint;
24
+ }>;
25
+ export type EnabledRewardTokens = CallResult<{
26
+ enabledRewardTokens: Address[];
27
+ }>;
28
+ export type Stake = CallResult<{
29
+ success: boolean;
30
+ }>;
31
+ export type Unstake = CallResult<{
32
+ success: boolean;
33
+ }>;
34
+ export type ClaimRewards = CallResult<{
35
+ success: boolean;
36
+ }>;
37
+ export type AdminAddRewardToken = CallResult<{
38
+ success: boolean;
39
+ }>;
40
+ export type AdminRemoveRewardToken = CallResult<{
41
+ success: boolean;
42
+ }>;
43
+ export type AdminChangeMotoAddress = CallResult<{
44
+ success: boolean;
45
+ }>;
46
+ export type AdminChangeLockupParameters = CallResult<{
47
+ success: boolean;
48
+ }>;
49
+ export type AdminEnableEmergencyWithdrawals = CallResult<{
50
+ success: boolean;
51
+ }>;
52
+ export type RewardTokenAddedEvent = {
53
+ readonly token: Address;
54
+ };
55
+ export type RewardTokenRemovedEvent = {
56
+ readonly token: Address;
57
+ };
58
+ export interface IMotoswapStakingContract extends IOwnableReentrancyGuardContract {
59
+ getMotoAddress(): Promise<GetMotoAddress>;
60
+ balanceOf(address: Address): Promise<BalanceOf>;
61
+ totalSupply(): Promise<TotalSupply>;
62
+ lastInteractedBlock(address: Address): Promise<LastInteractedBlock>;
63
+ rewardDebt(user: Address, rewardToken: Address): Promise<RewardDebt>;
64
+ rewardBalances(user: Address): Promise<RewardBalances>;
65
+ calculateSlashingFee(user: Address, amount: bigint): Promise<CalculateSlashingFee>;
66
+ enabledRewardTokens(): Promise<EnabledRewardTokens>;
67
+ stake(amount: bigint): Promise<Stake>;
68
+ unstake(): Promise<Unstake>;
69
+ claimRewards(): Promise<ClaimRewards>;
70
+ adminAddRewardToken(token: Address): Promise<AdminAddRewardToken>;
71
+ adminRemoveRewardToken(token: Address): Promise<AdminAddRewardToken>;
72
+ adminChangeMotoAddress(token: Address): Promise<AdminAddRewardToken>;
73
+ adminChangeLockupParameters(newLockupDuration: bigint, newMaxSlashingFeePercent: bigint, newBlocksPerOnePercentSlashingFeeReduction: bigint): Promise<AdminChangeLockupParameters>;
74
+ adminEnableEmergencyWithdrawals(): Promise<AdminEnableEmergencyWithdrawals>;
75
+ }
@@ -77,6 +77,7 @@ export type GetQuote = CallResult<{
77
77
  tokensOut: bigint;
78
78
  requiredSatoshis: bigint;
79
79
  price: bigint;
80
+ scale: bigint;
80
81
  }, [
81
82
  ]>;
82
83
  export type GetProviderDetails = CallResult<{
@@ -94,7 +95,7 @@ export interface INativeSwapContract extends IOP_NETContract {
94
95
  listLiquidity(token: Address, receiver: string, amountIn: bigint, priority: boolean): Promise<ListLiquidity>;
95
96
  cancelListing(token: Address): Promise<CancelListing>;
96
97
  createPool(token: Address, floorPrice: bigint, initialLiquidity: bigint, receiver: string, antiBotEnabledFor: number, antiBotMaximumTokensPerReservation: bigint, maxReservesIn5BlocksPercent: number): Promise<CreatePool>;
97
- createPoolWithSignature(signature: Buffer, approveAmount: bigint, token: Address, floorPrice: bigint, initialLiquidity: bigint, receiver: string, antiBotEnabledFor: number, antiBotMaximumTokensPerReservation: bigint, maxReservesIn5BlocksPercent: number): Promise<CreatePool>;
98
+ createPoolWithSignature(signature: Buffer, approveAmount: bigint, nonce: bigint, token: Address, floorPrice: bigint, initialLiquidity: bigint, receiver: string, antiBotEnabledFor: number, antiBotMaximumTokensPerReservation: bigint, maxReservesIn5BlocksPercent: number): Promise<CreatePool>;
98
99
  setFees(reservationBaseFee: bigint, priorityQueueBaseFee: bigint, pricePerUserInPriorityQueueBTC: bigint): Promise<SetFees>;
99
100
  getFees(): Promise<GetFees>;
100
101
  addLiquidity(token: Address, receiver: string): Promise<AddLiquidity>;
@@ -0,0 +1,3 @@
1
+ import { BitcoinInterfaceAbi } from '../../../interfaces/BitcoinInterfaceAbi.js';
2
+ export declare const MotoswapStakingEvents: BitcoinInterfaceAbi;
3
+ export declare const MOTOSWAP_STAKING_ABI: BitcoinInterfaceAbi;
@@ -0,0 +1,158 @@
1
+ import { ABIDataTypes } from '@btc-vision/transaction';
2
+ import { BitcoinAbiTypes } from '../../../BitcoinAbiTypes.js';
3
+ import { OP_NET_ABI } from '../opnet/OP_NET_ABI.js';
4
+ import OWNABLE_ABI from './OWNABLE_ABI.js';
5
+ import { REENTRANCY_GUARD_ABI } from './REENTRANCY_GUARD_ABI.js';
6
+ export const MotoswapStakingEvents = [
7
+ {
8
+ name: 'RewardTokenAdded',
9
+ type: BitcoinAbiTypes.Event,
10
+ values: [
11
+ {
12
+ name: 'token',
13
+ type: ABIDataTypes.ADDRESS,
14
+ },
15
+ ],
16
+ },
17
+ {
18
+ name: 'RewardTokenRemoved',
19
+ type: BitcoinAbiTypes.Event,
20
+ values: [
21
+ {
22
+ name: 'token',
23
+ type: ABIDataTypes.ADDRESS,
24
+ },
25
+ ],
26
+ },
27
+ ];
28
+ export const MOTOSWAP_STAKING_ABI = [
29
+ {
30
+ name: 'getMotoAddress',
31
+ type: BitcoinAbiTypes.Function,
32
+ constant: true,
33
+ inputs: [],
34
+ outputs: [{ name: 'motoAddress', type: ABIDataTypes.ADDRESS }],
35
+ },
36
+ {
37
+ name: 'balanceOf',
38
+ type: BitcoinAbiTypes.Function,
39
+ constant: true,
40
+ inputs: [{ name: 'address', type: ABIDataTypes.ADDRESS }],
41
+ outputs: [{ name: 'balance', type: ABIDataTypes.UINT256 }],
42
+ },
43
+ {
44
+ name: 'totalSupply',
45
+ type: BitcoinAbiTypes.Function,
46
+ constant: true,
47
+ inputs: [],
48
+ outputs: [{ name: 'totalSupply', type: ABIDataTypes.UINT256 }],
49
+ },
50
+ {
51
+ name: 'lastInteractedBlock',
52
+ type: BitcoinAbiTypes.Function,
53
+ constant: true,
54
+ inputs: [{ name: 'address', type: ABIDataTypes.ADDRESS }],
55
+ outputs: [{ name: 'lastInteractedBlock', type: ABIDataTypes.UINT256 }],
56
+ },
57
+ {
58
+ name: 'rewardDebt',
59
+ type: BitcoinAbiTypes.Function,
60
+ constant: true,
61
+ inputs: [
62
+ { name: 'user', type: ABIDataTypes.ADDRESS },
63
+ { name: 'rewardToken', type: ABIDataTypes.ADDRESS },
64
+ ],
65
+ outputs: [{ name: 'rewardDebt', type: ABIDataTypes.UINT256 }],
66
+ },
67
+ {
68
+ name: 'rewardBalance',
69
+ type: BitcoinAbiTypes.Function,
70
+ constant: false,
71
+ inputs: [
72
+ { name: 'user', type: ABIDataTypes.ADDRESS },
73
+ { name: 'rewardToken', type: ABIDataTypes.ADDRESS },
74
+ ],
75
+ outputs: [{ name: 'rewardBalance', type: ABIDataTypes.UINT256 }],
76
+ },
77
+ {
78
+ name: 'calculateSlashingFee',
79
+ type: BitcoinAbiTypes.Function,
80
+ constant: true,
81
+ inputs: [
82
+ { name: 'user', type: ABIDataTypes.ADDRESS },
83
+ { name: 'amount', type: ABIDataTypes.UINT256 },
84
+ ],
85
+ outputs: [{ name: 'rewardDebt', type: ABIDataTypes.UINT256 }],
86
+ },
87
+ {
88
+ name: 'enabledRewardTokens',
89
+ type: BitcoinAbiTypes.Function,
90
+ constant: false,
91
+ inputs: [],
92
+ outputs: [{ name: 'enabledRewardTokens', type: ABIDataTypes.ARRAY_OF_ADDRESSES }],
93
+ },
94
+ {
95
+ name: 'stake',
96
+ type: BitcoinAbiTypes.Function,
97
+ constant: false,
98
+ payable: false,
99
+ inputs: [{ name: 'amount', type: ABIDataTypes.UINT256 }],
100
+ outputs: [{ name: 'success', type: ABIDataTypes.BOOL }],
101
+ },
102
+ {
103
+ name: 'unstake',
104
+ type: BitcoinAbiTypes.Function,
105
+ constant: false,
106
+ payable: false,
107
+ inputs: [],
108
+ outputs: [{ name: 'success', type: ABIDataTypes.BOOL }],
109
+ },
110
+ {
111
+ name: 'claimRewards',
112
+ type: BitcoinAbiTypes.Function,
113
+ constant: false,
114
+ payable: false,
115
+ inputs: [],
116
+ outputs: [{ name: 'success', type: ABIDataTypes.BOOL }],
117
+ },
118
+ {
119
+ name: 'adminAddRewardToken',
120
+ type: BitcoinAbiTypes.Function,
121
+ constant: false,
122
+ payable: false,
123
+ inputs: [{ name: 'token', type: ABIDataTypes.ADDRESS }],
124
+ outputs: [{ name: 'success', type: ABIDataTypes.BOOL }],
125
+ },
126
+ {
127
+ name: 'adminRemoveRewardToken',
128
+ type: BitcoinAbiTypes.Function,
129
+ constant: false,
130
+ payable: false,
131
+ inputs: [{ name: 'token', type: ABIDataTypes.ADDRESS }],
132
+ outputs: [{ name: 'success', type: ABIDataTypes.BOOL }],
133
+ },
134
+ {
135
+ name: 'adminChangeMotoAddress',
136
+ type: BitcoinAbiTypes.Function,
137
+ constant: false,
138
+ payable: false,
139
+ inputs: [{ name: 'token', type: ABIDataTypes.ADDRESS }],
140
+ outputs: [{ name: 'success', type: ABIDataTypes.BOOL }],
141
+ },
142
+ {
143
+ name: 'adminChangeLockupParameters',
144
+ type: BitcoinAbiTypes.Function,
145
+ constant: false,
146
+ payable: false,
147
+ inputs: [
148
+ { name: 'newLockupDuration', type: ABIDataTypes.UINT256 },
149
+ { name: 'newMaxSlashingFeePercent', type: ABIDataTypes.UINT256 },
150
+ { name: 'newBlocksPerOnePercentSlashingFeeReduction', type: ABIDataTypes.UINT256 },
151
+ ],
152
+ outputs: [{ name: 'success', type: ABIDataTypes.BOOL }],
153
+ },
154
+ ...MotoswapStakingEvents,
155
+ ...OP_NET_ABI,
156
+ ...REENTRANCY_GUARD_ABI,
157
+ ...OWNABLE_ABI,
158
+ ];
@@ -241,6 +241,10 @@ export const NativeSwapAbi = [
241
241
  name: 'approveAmount',
242
242
  type: ABIDataTypes.UINT256,
243
243
  },
244
+ {
245
+ name: 'nonce',
246
+ type: ABIDataTypes.UINT256,
247
+ },
244
248
  {
245
249
  name: 'token',
246
250
  type: ABIDataTypes.ADDRESS,
@@ -430,6 +434,10 @@ export const NativeSwapAbi = [
430
434
  name: 'price',
431
435
  type: ABIDataTypes.UINT256,
432
436
  },
437
+ {
438
+ name: 'scale',
439
+ type: ABIDataTypes.UINT64,
440
+ },
433
441
  ],
434
442
  type: BitcoinAbiTypes.Function,
435
443
  },
@@ -161,6 +161,13 @@ export class IBaseContract {
161
161
  const type = abi.type;
162
162
  const name = abi.name;
163
163
  switch (type) {
164
+ case ABIDataTypes.INT128: {
165
+ if (typeof value !== 'bigint') {
166
+ throw new Error(`Expected value to be of type bigint (${name})`);
167
+ }
168
+ writer.writeI128(value);
169
+ break;
170
+ }
164
171
  case ABIDataTypes.UINT256: {
165
172
  if (typeof value !== 'bigint') {
166
173
  throw new Error(`Expected value to be of type bigint (${name})`);
@@ -327,6 +334,9 @@ export class IBaseContract {
327
334
  const name = abi[i].name;
328
335
  let decodedResult;
329
336
  switch (type) {
337
+ case ABIDataTypes.INT128:
338
+ decodedResult = reader.readI128();
339
+ break;
330
340
  case ABIDataTypes.UINT256:
331
341
  decodedResult = reader.readU256();
332
342
  break;
@@ -6,6 +6,7 @@ export const AbiTypeToStr = {
6
6
  [ABIDataTypes.UINT256]: 'uint256',
7
7
  [ABIDataTypes.UINT128]: 'uint128',
8
8
  [ABIDataTypes.UINT64]: 'uint64',
9
+ [ABIDataTypes.INT128]: 'int128',
9
10
  [ABIDataTypes.UINT32]: 'uint32',
10
11
  [ABIDataTypes.UINT16]: 'uint16',
11
12
  [ABIDataTypes.UINT8]: 'uint8',
@@ -1,6 +1,6 @@
1
1
  import { Network } from '@btc-vision/bitcoin';
2
- import '../serialize/BigInt.js';
3
2
  import { Address, AddressTypes } from '@btc-vision/transaction';
3
+ import '../serialize/BigInt.js';
4
4
  import { Block } from '../block/Block.js';
5
5
  import { BlockGasParameters } from '../block/BlockGasParameters.js';
6
6
  import { BlockWitnesses } from '../block/interfaces/BlockWitness.js';
@@ -1,5 +1,5 @@
1
- import '../serialize/BigInt.js';
2
1
  import { Address, AddressVerificator, BufferHelper } from '@btc-vision/transaction';
2
+ import '../serialize/BigInt.js';
3
3
  import { Block } from '../block/Block.js';
4
4
  import { BlockGasParameters } from '../block/BlockGasParameters.js';
5
5
  import { CallResult } from '../contracts/CallResult.js';
@@ -289,7 +289,7 @@ export class AbstractRpcProvider {
289
289
  const rawWitnesses = await this.callPayloadSingle(payload);
290
290
  const result = rawWitnesses.result;
291
291
  for (let i = 0; i < result.length; i++) {
292
- result[i].blockNumber = BigInt('0x' + result[i].blockNumber);
292
+ result[i].blockNumber = BigInt('0x' + result[i].blockNumber.toString());
293
293
  }
294
294
  return result;
295
295
  }
@@ -305,8 +305,8 @@ export class AbstractRpcProvider {
305
305
  if (result.length > 0) {
306
306
  for (let i = 0; i < result.length; i++) {
307
307
  const res = result[i];
308
- res.fromBlock = BigInt('0x' + res.fromBlock);
309
- res.toBlock = BigInt('0x' + res.toBlock);
308
+ res.fromBlock = BigInt('0x' + res.fromBlock.toString());
309
+ res.toBlock = BigInt('0x' + res.toBlock.toString());
310
310
  }
311
311
  }
312
312
  return result;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opnet",
3
3
  "type": "module",
4
- "version": "1.2.23",
4
+ "version": "1.2.25",
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.0",
63
+ "@babel/core": "^7.26.8",
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.25.9",
67
- "@babel/preset-env": "^7.26.0",
66
+ "@babel/plugin-transform-runtime": "^7.26.8",
67
+ "@babel/preset-env": "^7.26.8",
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.17.0",
72
- "@types/node": "^22.10.5",
71
+ "@eslint/js": "^9.20.0",
72
+ "@types/node": "^22.13.2",
73
73
  "@types/sha.js": "^2.4.4",
74
- "@types/ws": "^8.5.13",
74
+ "@types/ws": "^8.5.14",
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.17.0",
80
+ "eslint": "^9.20.1",
81
81
  "gulp": "^5.0.0",
82
82
  "gulp-cached": "^1.1.1",
83
83
  "gulp-clean": "^0.4.0",
@@ -86,24 +86,24 @@
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.4.2",
89
+ "prettier": "^3.5.0",
90
90
  "process": "^0.11.10",
91
91
  "stream-browserify": "^3.0.0",
92
92
  "stream-http": "^3.2.0",
93
- "ts-loader": "^9.5.1",
93
+ "ts-loader": "^9.5.2",
94
94
  "ts-node": "^10.9.2",
95
- "typedoc": "^0.27.6",
96
- "typescript": "^5.7.2",
97
- "typescript-eslint": "^8.19.0",
95
+ "typedoc": "^0.27.7",
96
+ "typescript": "^5.7.3",
97
+ "typescript-eslint": "^8.24.0",
98
98
  "webpack": "^5.97.1",
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
- "@btc-vision/bitcoin-rpc": "^1.0.0",
105
- "@btc-vision/transaction": "^1.2.10",
106
- "@noble/hashes": "^1.7.0",
104
+ "@btc-vision/bitcoin-rpc": "^1.0.1",
105
+ "@btc-vision/transaction": "^1.2.13",
106
+ "@noble/hashes": "^1.7.1",
107
107
  "bignumber.js": "^9.1.2",
108
108
  "buffer": "^6.0.3",
109
109
  "ecpair": "^2.1.0",
package/src/_version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.2.20';
1
+ export const version = '1.2.25';
@@ -0,0 +1,200 @@
1
+ import { ABIDataTypes, Address } from '@btc-vision/transaction';
2
+ import { CallResult } from '../../../../opnet.js';
3
+ import { IOwnableReentrancyGuardContract } from './IOwnableReentrancyGuardContract.js';
4
+
5
+ export type GetMotoAddress = CallResult<{
6
+ motoAddress: Address;
7
+ }>;
8
+
9
+ export type BalanceOf = CallResult<{
10
+ balance: bigint;
11
+ }>;
12
+
13
+ export type TotalSupply = CallResult<{
14
+ totalSupply: bigint;
15
+ }>;
16
+
17
+ export type LastInteractedBlock = CallResult<{
18
+ lastInteractedBlock: bigint;
19
+ }>;
20
+
21
+ export type RewardDebt = CallResult<{
22
+ rewardDebt: bigint;
23
+ }>;
24
+
25
+ export type RewardBalances = CallResult<{
26
+ rewardBalance: bigint;
27
+ }>;
28
+
29
+ export type CalculateSlashingFee = CallResult<{
30
+ slashingFee: bigint;
31
+ }>;
32
+
33
+ export type EnabledRewardTokens = CallResult<{
34
+ enabledRewardTokens: Address[];
35
+ }>;
36
+
37
+ export type Stake = CallResult<{
38
+ success: boolean;
39
+ }>;
40
+
41
+ export type Unstake = CallResult<{
42
+ success: boolean;
43
+ }>;
44
+
45
+ export type ClaimRewards = CallResult<{
46
+ success: boolean;
47
+ }>;
48
+
49
+ export type AdminAddRewardToken = CallResult<{
50
+ success: boolean;
51
+ }>;
52
+
53
+ export type AdminRemoveRewardToken = CallResult<{
54
+ success: boolean;
55
+ }>;
56
+
57
+ export type AdminChangeMotoAddress = CallResult<{
58
+ success: boolean;
59
+ }>;
60
+
61
+ export type AdminChangeLockupParameters = CallResult<{
62
+ success: boolean;
63
+ }>;
64
+
65
+ export type AdminEnableEmergencyWithdrawals = CallResult<{
66
+ success: boolean;
67
+ }>;
68
+
69
+ // EVENTS
70
+ export type RewardTokenAddedEvent = {
71
+ readonly token: Address;
72
+ };
73
+
74
+ export type RewardTokenRemovedEvent = {
75
+ readonly token: Address;
76
+ };
77
+
78
+ /**
79
+ * @description This interface represents the MotoChef contract.
80
+ * @interface IMotoswapStakingContract
81
+ * @extends {IOwnableReentrancyGuardContract}
82
+ * @cathegory Contracts
83
+ */
84
+ 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
+ /**
92
+ * @description Gets the stake of a given user
93
+ * @param address {Address} the address of the staker
94
+ * @returns {BalanceOf}
95
+ */
96
+ balanceOf(address: Address): Promise<BalanceOf>;
97
+
98
+ /**
99
+ * @description Returns the total amount locked in the staking contract
100
+ * @returns {TotalSupply}
101
+ */
102
+ totalSupply(): Promise<TotalSupply>;
103
+
104
+ /**
105
+ * @description Returns the last block the user interacted with the protocol by staking, unstaking or claiming rewards
106
+ * @param address {Address} the address of the staker
107
+ * @returns {TotalSupply}
108
+ */
109
+ lastInteractedBlock(address: Address): Promise<LastInteractedBlock>;
110
+
111
+ /**
112
+ * @description Returns the reward debt (number of tokens claimed) for a given user and reward token
113
+ * @param user {Address} the address of the staker
114
+ * @param rewardToken {Address} the token whose reward debt is returned
115
+ * @returns {RewardDebt}
116
+ */
117
+ rewardDebt(user: Address, rewardToken: Address): Promise<RewardDebt>;
118
+
119
+ /**
120
+ * @description Returns the pending reward balances that a user can claim.
121
+ * @param user {Address} the address of the staker
122
+ * @returns {RewardBalances}
123
+ */
124
+ rewardBalances(user: Address): Promise<RewardBalances>;
125
+
126
+ /**
127
+ * @description Returns the amount of the user's stake that would be slashed, if they were to withdraw
128
+ * @param user {Address} the address of the staker
129
+ * @param amount {bigint} the amount to calculate the slashing fee of
130
+ * @returns {RewardDebt}
131
+ */
132
+ calculateSlashingFee(user: Address, amount: bigint): Promise<CalculateSlashingFee>;
133
+
134
+ /**
135
+ * @description Returns a list of all tokens which rewards can be claimed for
136
+ * @returns {EnabledRewardTokens}
137
+ */
138
+ enabledRewardTokens(): Promise<EnabledRewardTokens>;
139
+
140
+ /**
141
+ * @description Stakes Moto tokens in the staking contract
142
+ * @param amount {bigint} amount of Moto to stake
143
+ * @returns {Stake}
144
+ */
145
+ stake(amount: bigint): Promise<Stake>;
146
+
147
+ /**
148
+ * @description Unstakes all Moto tokens the user has staked
149
+ * Subject to a slashing fee according to the protocol
150
+ * @returns {Unstake}
151
+ */
152
+ unstake(): Promise<Unstake>;
153
+
154
+ /**
155
+ * @description Claims all rewards the user is entitled to.
156
+ * @returns {ClaimRewards}
157
+ */
158
+ claimRewards(): Promise<ClaimRewards>;
159
+
160
+ /**
161
+ * @description Enables distribution of rewards for a given token
162
+ * @param token {Address} the address of the token to enable
163
+ * @returns {AdminAddRewardToken}
164
+ */
165
+ adminAddRewardToken(token: Address): Promise<AdminAddRewardToken>;
166
+
167
+ /**
168
+ * @description Disables distribution of rewards for a given token
169
+ * @param token {Address} the address of the token to disable
170
+ * @returns {AdminRemoveRewardToken}
171
+ */
172
+ adminRemoveRewardToken(token: Address): Promise<AdminAddRewardToken>;
173
+
174
+ /**
175
+ * @description Changes the address of the Moto token the protocol allows the users to stake
176
+ * Also affects what token is paid out when unstaking.
177
+ * @param token {Address} the address of the Moto token
178
+ * @returns {AdminChangeMotoAddress}
179
+ */
180
+ adminChangeMotoAddress(token: Address): Promise<AdminAddRewardToken>;
181
+
182
+ /**
183
+ * @description Changes the following parameters of the protocol
184
+ * @param newLockupDuration {bigint} New lockup duration
185
+ * @param newMaxSlashingFeePercent {bigint} New slashing fee percentage at maximum lockup time
186
+ * @param newBlocksPerOnePercentSlashingFeeReduction {bigint} New value for how many blocks reduce the slashing fee by 1 percent
187
+ * @returns {AdminChangeLockupParameters}
188
+ */
189
+ adminChangeLockupParameters(
190
+ newLockupDuration: bigint,
191
+ newMaxSlashingFeePercent: bigint,
192
+ newBlocksPerOnePercentSlashingFeeReduction: bigint,
193
+ ): Promise<AdminChangeLockupParameters>;
194
+
195
+ /**
196
+ * @description Enables emergency withdrawals, allowing users to withdraw their rewards and stake at no penalty
197
+ * @returns {AdminEnableEmergencyWithdrawals}
198
+ */
199
+ adminEnableEmergencyWithdrawals(): Promise<AdminEnableEmergencyWithdrawals>;
200
+ }
@@ -158,6 +158,7 @@ export type GetQuote = CallResult<
158
158
  tokensOut: bigint;
159
159
  requiredSatoshis: bigint;
160
160
  price: bigint;
161
+ scale: bigint;
161
162
  },
162
163
  []
163
164
  >;
@@ -254,6 +255,7 @@ export interface INativeSwapContract extends IOP_NETContract {
254
255
  createPoolWithSignature(
255
256
  signature: Buffer,
256
257
  approveAmount: bigint,
258
+ nonce: bigint,
257
259
  token: Address,
258
260
  floorPrice: bigint,
259
261
  initialLiquidity: bigint,