opnet 1.2.1 → 1.2.3

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 (118) hide show
  1. package/browser/_version.d.ts +1 -1
  2. package/browser/abi/shared/interfaces/motoswap/IAdministeredOP20.d.ts +21 -0
  3. package/browser/abi/shared/interfaces/motoswap/IMotoChefContract.d.ts +121 -0
  4. package/browser/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +71 -0
  5. package/browser/abi/shared/interfaces/motoswap/IOwnableContract.d.ts +12 -0
  6. package/browser/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.d.ts +13 -0
  7. package/browser/abi/shared/interfaces/motoswap/IReentrancyGuardContract.d.ts +7 -0
  8. package/browser/abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.d.ts +3 -0
  9. package/browser/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.d.ts +4 -0
  10. package/browser/abi/shared/json/motoswap/NATIVE_SWAP_ABI.d.ts +3 -0
  11. package/browser/abi/shared/json/motoswap/OWNABLE_ABI.d.ts +3 -0
  12. package/browser/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.d.ts +2 -0
  13. package/browser/bitcoin/UTXOs.d.ts +1 -1
  14. package/browser/bitcoin/interfaces/IUTXO.d.ts +1 -1
  15. package/browser/block/Block.d.ts +2 -1
  16. package/browser/contracts/CallResult.d.ts +1 -0
  17. package/browser/index.js +1 -1
  18. package/browser/opnet.d.ts +7 -2
  19. package/browser/providers/AbstractRpcProvider.d.ts +1 -1
  20. package/browser/transactions/Transaction.d.ts +5 -1
  21. package/browser/transactions/TransactionParser.d.ts +3 -2
  22. package/browser/transactions/decoders/DeploymentTransaction.d.ts +2 -1
  23. package/browser/transactions/decoders/GenericTransaction.d.ts +2 -1
  24. package/browser/transactions/decoders/InteractionTransaction.d.ts +2 -1
  25. package/browser/transactions/interfaces/ITransaction.d.ts +2 -0
  26. package/browser/transactions/interfaces/ProofOfWorkChallenge.d.ts +12 -0
  27. package/browser/transactions/interfaces/transactions/ICommonTransaction.d.ts +2 -0
  28. package/browser/transactions/metadata/TransactionInput.d.ts +1 -1
  29. package/browser/transactions/metadata/TransactionOutput.d.ts +1 -1
  30. package/browser/transactions/metadata/TransactionReceipt.d.ts +2 -1
  31. package/build/_version.d.ts +1 -1
  32. package/build/_version.js +1 -1
  33. package/build/abi/shared/interfaces/motoswap/IAdministeredOP20.d.ts +21 -0
  34. package/build/abi/shared/interfaces/motoswap/IMotoChefContract.d.ts +121 -0
  35. package/build/abi/shared/interfaces/motoswap/IMotoChefContract.js +1 -0
  36. package/build/abi/shared/interfaces/motoswap/INativeSwapContract.d.ts +71 -0
  37. package/build/abi/shared/interfaces/motoswap/INativeSwapContract.js +1 -0
  38. package/build/abi/shared/interfaces/motoswap/IOwnableContract.d.ts +12 -0
  39. package/build/abi/shared/interfaces/motoswap/IOwnableContract.js +1 -0
  40. package/build/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.d.ts +13 -0
  41. package/build/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.js +1 -0
  42. package/build/abi/shared/interfaces/motoswap/IReentrancyGuardContract.d.ts +7 -0
  43. package/build/abi/shared/interfaces/motoswap/IReentrancyGuardContract.js +1 -0
  44. package/build/abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.d.ts +3 -0
  45. package/build/abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.js +81 -0
  46. package/build/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.d.ts +4 -0
  47. package/build/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.js +443 -0
  48. package/build/abi/shared/json/motoswap/NATIVE_SWAP_ABI.d.ts +3 -0
  49. package/build/abi/shared/json/motoswap/{EWMA_ABI.js → NATIVE_SWAP_ABI.js} +208 -37
  50. package/build/abi/shared/json/motoswap/OWNABLE_ABI.d.ts +3 -0
  51. package/build/abi/shared/json/motoswap/OWNABLE_ABI.js +35 -0
  52. package/build/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.d.ts +2 -0
  53. package/build/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.js +15 -0
  54. package/build/bitcoin/UTXOs.d.ts +1 -1
  55. package/build/bitcoin/interfaces/IUTXO.d.ts +1 -1
  56. package/build/block/Block.d.ts +2 -1
  57. package/build/block/Block.js +2 -2
  58. package/build/contracts/CallResult.d.ts +1 -0
  59. package/build/contracts/CallResult.js +7 -3
  60. package/build/opnet.d.ts +7 -2
  61. package/build/opnet.js +7 -2
  62. package/build/providers/AbstractRpcProvider.d.ts +1 -1
  63. package/build/providers/AbstractRpcProvider.js +4 -4
  64. package/build/transactions/Transaction.d.ts +5 -1
  65. package/build/transactions/Transaction.js +14 -2
  66. package/build/transactions/TransactionParser.d.ts +3 -2
  67. package/build/transactions/TransactionParser.js +6 -6
  68. package/build/transactions/decoders/DeploymentTransaction.d.ts +2 -1
  69. package/build/transactions/decoders/DeploymentTransaction.js +2 -2
  70. package/build/transactions/decoders/GenericTransaction.d.ts +2 -1
  71. package/build/transactions/decoders/GenericTransaction.js +2 -2
  72. package/build/transactions/decoders/InteractionTransaction.d.ts +2 -1
  73. package/build/transactions/decoders/InteractionTransaction.js +2 -2
  74. package/build/transactions/interfaces/ITransaction.d.ts +2 -0
  75. package/build/transactions/interfaces/ProofOfWorkChallenge.d.ts +12 -0
  76. package/build/transactions/interfaces/ProofOfWorkChallenge.js +1 -0
  77. package/build/transactions/interfaces/transactions/ICommonTransaction.d.ts +2 -0
  78. package/build/transactions/metadata/TransactionInput.d.ts +1 -1
  79. package/build/transactions/metadata/TransactionOutput.d.ts +1 -1
  80. package/build/transactions/metadata/TransactionReceipt.d.ts +2 -1
  81. package/build/transactions/metadata/TransactionReceipt.js +12 -8
  82. package/package.json +14 -14
  83. package/src/_version.ts +1 -1
  84. package/src/abi/shared/interfaces/motoswap/IAdministeredOP20.ts +56 -0
  85. package/src/abi/shared/interfaces/motoswap/IMotoChefContract.ts +348 -0
  86. package/src/abi/shared/interfaces/motoswap/INativeSwapContract.ts +267 -0
  87. package/src/abi/shared/interfaces/motoswap/IOwnableContract.ts +32 -0
  88. package/src/abi/shared/interfaces/motoswap/IOwnableReentrancyGuardContract.ts +33 -0
  89. package/src/abi/shared/interfaces/motoswap/IReentrancyGuardContract.ts +18 -0
  90. package/src/abi/shared/json/motoswap/ADMINISTERD_OP_20_ABI.ts +85 -0
  91. package/src/abi/shared/json/motoswap/MOTOSWAP_MOTOCHEF_ABI.ts +455 -0
  92. package/src/abi/shared/json/motoswap/{EWMA_ABI.ts → NATIVE_SWAP_ABI.ts} +252 -37
  93. package/src/abi/shared/json/motoswap/OWNABLE_ABI.ts +38 -0
  94. package/src/abi/shared/json/motoswap/REENTRANCY_GUARD_ABI.ts +20 -0
  95. package/src/bitcoin/UTXOs.ts +2 -2
  96. package/src/bitcoin/interfaces/IUTXO.ts +1 -1
  97. package/src/block/Block.ts +3 -1
  98. package/src/contracts/CallResult.ts +9 -6
  99. package/src/opnet.ts +7 -2
  100. package/src/providers/AbstractRpcProvider.ts +5 -5
  101. package/src/providers/JSONRpcProvider.ts +1 -1
  102. package/src/transactions/Transaction.ts +30 -8
  103. package/src/transactions/TransactionParser.ts +7 -8
  104. package/src/transactions/decoders/DeploymentTransaction.ts +3 -2
  105. package/src/transactions/decoders/GenericTransaction.ts +3 -2
  106. package/src/transactions/decoders/InteractionTransaction.ts +3 -2
  107. package/src/transactions/interfaces/ITransaction.ts +6 -0
  108. package/src/transactions/interfaces/ProofOfWorkChallenge.ts +13 -0
  109. package/src/transactions/interfaces/transactions/ICommonTransaction.ts +6 -0
  110. package/src/transactions/metadata/TransactionInput.ts +1 -1
  111. package/src/transactions/metadata/TransactionOutput.ts +1 -1
  112. package/src/transactions/metadata/TransactionReceipt.ts +23 -11
  113. package/browser/abi/shared/interfaces/motoswap/IEwmaContract.d.ts +0 -46
  114. package/browser/abi/shared/json/motoswap/EWMA_ABI.d.ts +0 -3
  115. package/build/abi/shared/interfaces/motoswap/IEwmaContract.d.ts +0 -46
  116. package/build/abi/shared/json/motoswap/EWMA_ABI.d.ts +0 -3
  117. package/src/abi/shared/interfaces/motoswap/IEwmaContract.ts +0 -188
  118. /package/build/abi/shared/interfaces/motoswap/{IEwmaContract.js → IAdministeredOP20.js} +0 -0
@@ -0,0 +1,348 @@
1
+ import { Address } from '@btc-vision/transaction';
2
+ import { IOwnableReentrancyGuardContract } from './IOwnableReentrancyGuardContract';
3
+ import { CallResult } from '../../../../opnet';
4
+
5
+ export type PoolInfo = {
6
+ allocPoint: number;
7
+ lastRewardBlock: number;
8
+ accMotoPerShare: bigint;
9
+ };
10
+
11
+ export type UserInfo = {
12
+ amount: bigint;
13
+ rewardDebt: bigint;
14
+ };
15
+
16
+ export type Initialize = CallResult<{
17
+ success: boolean;
18
+ }>;
19
+
20
+ export type GetLpToken = CallResult<{
21
+ lpTokenAddress: Address;
22
+ }>;
23
+
24
+ export type GetRewarder = CallResult<{
25
+ rewarderAddress: Address;
26
+ }>;
27
+
28
+ export type GetPoolInfo = CallResult<PoolInfo>;
29
+
30
+ export type GetUserInfo = CallResult<UserInfo>;
31
+
32
+ export type Pools = CallResult<{
33
+ poolLength: number;
34
+ poolsData: Uint8Array;
35
+ }>;
36
+
37
+ export type TotalAllocPoint = CallResult<{
38
+ totalAllocPoint: bigint;
39
+ }>;
40
+
41
+ export type Devaddr = CallResult<{
42
+ devaddr: Address;
43
+ }>;
44
+
45
+ export type MotoPerBlock = CallResult<{
46
+ motoPerBlock: bigint;
47
+ }>;
48
+
49
+ export type BonusEndBlock = CallResult<{
50
+ bonusEndBlock: bigint;
51
+ }>;
52
+
53
+ export type BonusMultiplier = CallResult<{
54
+ bonusMultiplier: bigint;
55
+ }>;
56
+
57
+ export type Add = CallResult<{
58
+ success: boolean;
59
+ }>;
60
+
61
+ export type Set = CallResult<{
62
+ success: boolean;
63
+ }>;
64
+
65
+ export type SetMigrator = CallResult<{
66
+ success: boolean;
67
+ }>;
68
+
69
+ export type Migrate = CallResult<{
70
+ success: boolean;
71
+ }>;
72
+
73
+ export type GetMultiplier = CallResult<{
74
+ multiplier: bigint;
75
+ }>;
76
+
77
+ export type PendingMoto = CallResult<{
78
+ pendingMoto: number;
79
+ }>;
80
+
81
+ export type MassUpdatePools = CallResult<{
82
+ success: boolean;
83
+ }>;
84
+
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
+ }>;
102
+
103
+ export type SetDev = CallResult<{
104
+ success: boolean;
105
+ }>;
106
+
107
+ export type SetMotoPerBlock = CallResult<{
108
+ success: boolean;
109
+ }>;
110
+
111
+ export type SetBonusEndBlock = CallResult<{
112
+ success: boolean;
113
+ }>;
114
+
115
+ export type SetBonusMultiplier = CallResult<{
116
+ success: boolean;
117
+ }>;
118
+
119
+ export type EmergencyWithdraw = CallResult<{
120
+ success: boolean;
121
+ }>;
122
+
123
+ /**
124
+ * @description This interface represents the MotoChef contract.
125
+ * @interface IMotoChefContract
126
+ * @extends {IOwnableReentrancyGuardContract}
127
+ * @cathegory Contracts
128
+ */
129
+ export interface IMotoChefContract extends IOwnableReentrancyGuardContract {
130
+ /**
131
+ * @description Initialize the MotoChef contract. Can only be called by an admin.
132
+ * @param {Address} MOTO The address of the MOTO token. MotoChef needs to be the owner/admin of the MOTO token.
133
+ * @param {bigint} premineAmount The amount of MOTO to mint on deploy.
134
+ * @param {Address} devaddr The address of the dev.
135
+ * @param {bigint} motoPerBlock The amount of MOTOs created per block.
136
+ * @param {bigint} bonusEndBlock The block number when the bonus MOTO period ends.
137
+ * @param {bigint} bonusMultiplier The bonus muliplier for early moto makers.
138
+ * @returns {Initialize}
139
+ */
140
+ initialize(
141
+ MOTO: Address,
142
+ premineAmount: bigint,
143
+ devaddr: Address,
144
+ motoPerBlock: bigint,
145
+ bonusEndBlock: bigint,
146
+ bonusMultiplier: bigint,
147
+ ): Promise<Initialize>;
148
+
149
+ /**
150
+ * @description Gets the LP token address of a pool
151
+ * @param {number} pid The index of the pool
152
+ * @returns {GetLpToken}
153
+ */
154
+ getLpToken(pid: number): Promise<GetLpToken>;
155
+
156
+ /**
157
+ * @description Gets the rewarder address of a pool
158
+ * @param {number} pid The index of the pool
159
+ * @returns {GetRewarder}
160
+ */
161
+ getRewarder(pid: number): Promise<GetRewarder>;
162
+
163
+ /**
164
+ * @description Gets the pool info of a pool
165
+ * @param {number} pid The index of the pool
166
+ * @returns {GetPoolInfo}
167
+ */
168
+ getPoolInfo(pid: number): Promise<GetPoolInfo>;
169
+
170
+ /**
171
+ * @description Gets the user info of a pool
172
+ * @param {number} pid The index of the pool
173
+ * @param {Address} user The address of the user
174
+ * @returns {GetUserInfo}
175
+ */
176
+ getUserInfo(pid: number, user: Address): Promise<GetUserInfo>;
177
+
178
+ /**
179
+ * @description Gets all the available pools
180
+ * @returns {Pools}
181
+ */
182
+ pools(): Promise<Pools>;
183
+
184
+ /**
185
+ * @description Gets the total alloc point
186
+ * @returns {TotalAllocPoint}
187
+ */
188
+ totalAllocPoint(): Promise<TotalAllocPoint>;
189
+
190
+ /**
191
+ * @description Gets the dev address
192
+ * @returns {Devaddr}
193
+ */
194
+ devaddr(): Promise<Devaddr>;
195
+
196
+ /**
197
+ * @description Gets the moto per block
198
+ * @returns {MotoPerBlock}
199
+ */
200
+ getMotoPerBlock(): Promise<MotoPerBlock>;
201
+
202
+ /**
203
+ * @description Gets the bonus end block
204
+ * @returns {BonusEndBlock}
205
+ */
206
+ getBonusEndBlock(): Promise<BonusEndBlock>;
207
+
208
+ /**
209
+ * @description Gets the bonus multiplier
210
+ * @returns {BonusMultiplier}
211
+ */
212
+ getBonusMultiplier(): Promise<BonusMultiplier>;
213
+
214
+ /**
215
+ * @description Set the moto per block. Can only be called by an admin.
216
+ * @param {bigint} motoPerBlock The amount of MOTO per block.
217
+ * @returns {SetMotoPerBlock}
218
+ */
219
+ setMotoPerBlock(motoPerBlock: bigint): Promise<SetMotoPerBlock>;
220
+
221
+ /**
222
+ * @description Set the bonus end block. Can only be called by an admin.
223
+ * @param {bigint} bonusEndBlock The block number when the bonus period ends.
224
+ * @returns {SetBonusEndBlock}
225
+ */
226
+ setBonusEndBlock(bonusEndBlock: bigint): Promise<SetBonusEndBlock>;
227
+
228
+ /**
229
+ * @description Set the bonus multiplier. Can only be called by an admin.
230
+ * @param {bigint} bonusMultiplier The bonus multiplier.
231
+ * @returns {SetBonusMultiplier}
232
+ */
233
+ setBonusMultiplier(bonusMultiplier: bigint): Promise<SetBonusMultiplier>;
234
+
235
+ /**
236
+ * @description Add a new lp to the pool. Can only be called by an admin.
237
+ * @param {bigint} allocPoint allocPoint AP of the new pool.
238
+ * @param {Address} lpToken Address of the LP OP-20 token.
239
+ * @param {Address} rewarder Address of the rewarder delegate.
240
+ * @returns {Add}
241
+ */
242
+ add(allocPoint: bigint, lpToken: Address, rewarder: Address): Promise<Add>;
243
+
244
+ /**
245
+ * @description Update the given pool's MOTO allocation point and `IRewarder` contract. Can only be called by an admin.
246
+ * @param {number} pid the index of the pool
247
+ * @param {bigint} allocPoint New AP of the pool.
248
+ * @param {Address} rewarder Address of the rewarder delegate.
249
+ * @param {boolean} overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored.
250
+ * @returns {Set}
251
+ */
252
+ set(pid: number, allocPoint: bigint, rewarder: Address, overwrite: boolean): Promise<Set>;
253
+
254
+ /**
255
+ * @description Set the `migrator` contract. Can only be called by an admin.
256
+ * @param {Address} migrator The contract address to set.
257
+ * @returns {SetMigrator}
258
+ */
259
+ setMigrator(migrator: Address): Promise<SetMigrator>;
260
+
261
+ /**
262
+ * @description Migrate LP token to another LP contract through the `migrator` contract.
263
+ * @param {number} pid The index of the pool.
264
+ * @returns {Migrate}
265
+ */
266
+ migrate(pid: number): Promise<Migrate>;
267
+
268
+ /**
269
+ * @description Get the multiplier over the given _from to _to block.
270
+ * @param {bigint} from the from block
271
+ * @param {bigint} to the to block
272
+ * @returns {GetMultiplier}
273
+ */
274
+ getMultiplier(from: bigint, to: bigint): Promise<GetMultiplier>;
275
+
276
+ /**
277
+ * @description View function to see pending MOTO on frontend.
278
+ * @param {number} pid The index of the pool
279
+ * @param {Address} user Address of user.
280
+ * @returns {PendingMoto}
281
+ */
282
+ pendingMoto(pid: number, user: Address): Promise<PendingMoto>;
283
+
284
+ /**
285
+ * @description Update reward variables for all pools. Be careful of gas spending!
286
+ * @param {number} length The length of the pids array.
287
+ * @param {number[]} pids Pool IDs of all to be updated. Make sure to update all active pools.
288
+ * @returns {MassUpdatePools}
289
+ */
290
+ massUpdatePools(length: number, pids: number[]): Promise<MassUpdatePools>;
291
+
292
+ /**
293
+ * @description Update reward variables of the given pool.
294
+ * @param {number} pid The index of the pool
295
+ * @returns {UpdatePool}
296
+ */
297
+ updatePool(pid: number): Promise<UpdatePool>;
298
+
299
+ /**
300
+ * @description Deposit LP tokens to MotoChef for MOTO allocation.
301
+ * @param {number} pid The index of the pool.
302
+ * @param {bigint} amount LP token amount to deposit.
303
+ * @param {Address} to The receiver of `amount` deposit benefit.
304
+ * @returns {Deposit}
305
+ */
306
+ deposit(pid: number, amount: bigint, to: Address): Promise<Deposit>;
307
+
308
+ /**
309
+ * @description Withdraw LP tokens from MotoChef.
310
+ * @param {number} pid The index of the pool.
311
+ * @param {bigint} amount LP token amount to deposit.
312
+ * @param {Address} to The receiver of `amount` deposit benefit.
313
+ * @returns {Withdraw}
314
+ */
315
+ withdraw(pid: number, amount: bigint, to: Address): Promise<Withdraw>;
316
+
317
+ /**
318
+ * @description Harvest proceeds for transaction sender to `to`.
319
+ * @param {number} pid The index of the pool.
320
+ * @param {Address} to Receiver of MOTO rewards.
321
+ * @returns {Harvest}
322
+ */
323
+ harvest(pid: number, to: Address): Promise<Harvest>;
324
+
325
+ /**
326
+ * @description Withdraw LP tokens from MotoChef and harvest proceeds for transaction sender to `to`.
327
+ * @param {number} pid The index of the pool.
328
+ * @param {bigint} amount LP token amount to withdraw.
329
+ * @param {Address} to Receiver of the LP tokens and MOTO rewards.
330
+ * @returns {WithdrawAndHarvest}
331
+ */
332
+ withdrawAndHarvest(pid: number, amount: bigint, to: Address): Promise<WithdrawAndHarvest>;
333
+
334
+ /**
335
+ * @description Withdraw without caring about rewards. EMERGENCY ONLY.
336
+ * @param {number} pid The index of the pool.
337
+ * @param {Address} to Receiver of the LP tokens.
338
+ * @returns {EmergencyWithdraw}
339
+ */
340
+ emergencyWithdraw(pid: number, to: Address): Promise<EmergencyWithdraw>;
341
+
342
+ /**
343
+ * @description Update dev address by the previous dev.
344
+ * @param {Address} devaddr The new dev address.s
345
+ * @returns {SetDev}
346
+ */
347
+ setDev(devaddr: Address): Promise<SetDev>;
348
+ }
@@ -0,0 +1,267 @@
1
+ import { Address } from '@btc-vision/transaction';
2
+ import { CallResult } from '../../../../contracts/CallResult.js';
3
+ import { IOP_NETContract } from '../opnet/IOP_NETContract.js';
4
+
5
+ /**
6
+ * @description Represents the result of the reserve function call.
7
+ */
8
+ export type ReserveEWMA = CallResult<{
9
+ reserved: bigint;
10
+ }>;
11
+
12
+ /**
13
+ * @description Represents the result of adding liquidity.
14
+ */
15
+ export type AddLiquidity = CallResult<{
16
+ ok: boolean;
17
+ }>;
18
+
19
+ /**
20
+ * @description Represents the result of removing liquidity.
21
+ */
22
+ export type RemoveLiquidity = CallResult<{
23
+ ok: boolean;
24
+ }>;
25
+
26
+ /**
27
+ * @description Represents the result of listing liquidity (new).
28
+ */
29
+ export type ListLiquidity = CallResult<{
30
+ ok: boolean;
31
+ }>;
32
+
33
+ /**
34
+ * @description Represents the result of canceling a listing (new).
35
+ */
36
+ export type CancelListing = CallResult<{
37
+ totalTokensReturned: bigint;
38
+ }>;
39
+
40
+ /**
41
+ * @description Represents the result of creating a new pool (new).
42
+ */
43
+ export type CreatePool = CallResult<{
44
+ ok: boolean;
45
+ }>;
46
+
47
+ /**
48
+ * @description Represents the result of setting fees (new).
49
+ */
50
+ export type SetFees = CallResult<{
51
+ ok: boolean;
52
+ }>;
53
+
54
+ /**
55
+ * @description Represents the result of retrieving the fees (new).
56
+ */
57
+ export type GetFees = CallResult<{
58
+ reservationBaseFee: bigint;
59
+ priorityQueueBaseFee: bigint;
60
+ pricePerUserInPriorityQueueBTC: bigint;
61
+ }>;
62
+
63
+ /**
64
+ * @description Represents the result of a swap operation.
65
+ */
66
+ export type Swap = CallResult<{
67
+ ok: boolean;
68
+ }>;
69
+
70
+ /**
71
+ * @description Represents the result of the getReserve function call.
72
+ * Now includes virtualBTCReserve and virtualTokenReserve.
73
+ */
74
+ export type GetReserve = CallResult<{
75
+ liquidity: bigint;
76
+ reservedLiquidity: bigint;
77
+ virtualBTCReserve: bigint;
78
+ virtualTokenReserve: bigint;
79
+ }>;
80
+
81
+ /**
82
+ * @description Represents the result of the getQuote function call.
83
+ * Renamed currentPrice -> price.
84
+ */
85
+ export type GetQuote = CallResult<{
86
+ tokensOut: bigint;
87
+ requiredSatoshis: bigint;
88
+ price: bigint;
89
+ }>;
90
+
91
+ /**
92
+ * @description Represents the result of retrieving provider details.
93
+ */
94
+ export type GetProviderDetails = CallResult<{
95
+ liquidity: bigint;
96
+ reserved: bigint;
97
+ btcReceiver: string;
98
+ }>;
99
+
100
+ /**
101
+ * @description Represents the result of retrieving the priority queue cost.
102
+ */
103
+ export type GetPriorityQueueCost = CallResult<{
104
+ cost: bigint;
105
+ }>;
106
+
107
+ /**
108
+ * @description Represents the result of retrieving the virtual reserves
109
+ */
110
+ export type VirtualReserves = CallResult<{
111
+ virtualBTCReserve: bigint;
112
+ virtualTokenReserve: bigint;
113
+ }>;
114
+
115
+ /**
116
+ * @description This interface represents the NativeSwap contract,
117
+ * including all new/updated methods and type definitions.
118
+ *
119
+ * @interface INativeSwapContract
120
+ * @extends {IOP_NETContract}
121
+ * @category Contracts
122
+ */
123
+ export interface INativeSwapContract extends IOP_NETContract {
124
+ /**
125
+ * @description Reserves a certain amount of tokens, possibly for LP.
126
+ * @param token - The address of the token to reserve.
127
+ * @param maximumAmountIn - The maximum amount of tokens to reserve.
128
+ * @param minimumAmountOut - The minimum amount of tokens expected out.
129
+ * @param forLP - Whether this reservation is for LP or not.
130
+ * @returns {Promise<ReserveEWMA>}
131
+ */
132
+ reserve(
133
+ token: Address,
134
+ maximumAmountIn: bigint,
135
+ minimumAmountOut: bigint,
136
+ forLP: boolean,
137
+ ): Promise<ReserveEWMA>;
138
+
139
+ /**
140
+ * @description Lists liquidity for sale (new).
141
+ * @param token - The address of the token to list.
142
+ * @param receiver - The Bitcoin address for receiving payments.
143
+ * @param amountIn - The amount of tokens to list for sale.
144
+ * @param priority - Whether to place this listing in the priority queue.
145
+ * @returns {Promise<ListLiquidity>}
146
+ */
147
+ listLiquidity(
148
+ token: Address,
149
+ receiver: string,
150
+ amountIn: bigint,
151
+ priority: boolean,
152
+ ): Promise<ListLiquidity>;
153
+
154
+ /**
155
+ * @description Cancels a previously listed liquidity position (new).
156
+ * @param token - The address of the token to remove from the listing.
157
+ * @returns {Promise<CancelListing>}
158
+ */
159
+ cancelListing(token: Address): Promise<CancelListing>;
160
+
161
+ /**
162
+ * @description Creates a new liquidity pool (new).
163
+ * @param token - The token address.
164
+ * @param floorPrice - The floor price to set.
165
+ * @param initialLiquidity - The amount of liquidity to seed.
166
+ * @param receiver - The Bitcoin address for receiving payments.
167
+ * @param antiBotEnabledFor - Number of blocks for anti-bot protection.
168
+ * @param antiBotMaximumTokensPerReservation - Anti-bot max tokens per user.
169
+ * @param maxReservesIn5BlocksPercent - Cap on reserves in a short window.
170
+ * @returns {Promise<CreatePool>}
171
+ */
172
+ createPool(
173
+ token: Address,
174
+ floorPrice: bigint,
175
+ initialLiquidity: bigint,
176
+ receiver: string,
177
+ antiBotEnabledFor: number,
178
+ antiBotMaximumTokensPerReservation: bigint,
179
+ maxReservesIn5BlocksPercent: number,
180
+ ): Promise<CreatePool>;
181
+
182
+ /**
183
+ * @description Sets the global fee parameters (new).
184
+ * @param reservationBaseFee - Base fee for a reservation.
185
+ * @param priorityQueueBaseFee - Base fee for priority queue usage.
186
+ * @param pricePerUserInPriorityQueueBTC - Additional cost per user in queue.
187
+ * @returns {Promise<SetFees>}
188
+ */
189
+ setFees(
190
+ reservationBaseFee: bigint,
191
+ priorityQueueBaseFee: bigint,
192
+ pricePerUserInPriorityQueueBTC: bigint,
193
+ ): Promise<SetFees>;
194
+
195
+ /**
196
+ * @description Retrieves the current fee parameters (new).
197
+ * @returns {Promise<GetFees>}
198
+ */
199
+ getFees(): Promise<GetFees>;
200
+
201
+ /**
202
+ * @description Adds liquidity to the contract.
203
+ * @param token - The address of the token to add liquidity for.
204
+ * @param receiver - The receiver of the liquidity (Bitcoin address).
205
+ * @param amountIn - The amount of tokens to add.
206
+ * @param priority - Whether to prioritize the liquidity addition.
207
+ * @returns {Promise<AddLiquidity>}
208
+ */
209
+ addLiquidity(
210
+ token: Address,
211
+ receiver: string,
212
+ amountIn: bigint,
213
+ priority: boolean,
214
+ ): Promise<AddLiquidity>;
215
+
216
+ /**
217
+ * @description Removes liquidity from the contract.
218
+ * @param token - The address of the token to remove liquidity for.
219
+ * @returns {Promise<RemoveLiquidity>}
220
+ */
221
+ removeLiquidity(token: Address): Promise<RemoveLiquidity>;
222
+
223
+ /**
224
+ * @description Executes a swap operation.
225
+ * @param token - The address of the token to swap.
226
+ * @param isSimulation - Whether this is just a simulation.
227
+ * @returns {Promise<Swap>}
228
+ */
229
+ swap(token: Address, isSimulation: boolean): Promise<Swap>;
230
+
231
+ /**
232
+ * @description Retrieves the reserve information for a token.
233
+ * Now includes virtual pool reserves.
234
+ * @param token - The address of the token.
235
+ * @returns {Promise<GetReserve>}
236
+ */
237
+ getReserve(token: Address): Promise<GetReserve>;
238
+
239
+ /**
240
+ * @description Retrieves a quote for swapping tokens.
241
+ * @param token - The address of the token.
242
+ * @param satoshisIn - The amount of satoshis being sent.
243
+ * @returns {Promise<GetQuote>}
244
+ */
245
+ getQuote(token: Address, satoshisIn: bigint): Promise<GetQuote>;
246
+
247
+ /**
248
+ * @description Retrieves the provider details for a token.
249
+ * @param token - The address of the token.
250
+ * @returns {Promise<GetProviderDetails>}
251
+ */
252
+ getProviderDetails(token: Address): Promise<GetProviderDetails>;
253
+
254
+ /**
255
+ * @description Retrieves the virtual reserves (akin to EWMA).
256
+ * @param token - The address of the token.
257
+ * @returns {Promise<VirtualReserves>}
258
+ */
259
+ getVirtualReserves(token: Address): Promise<VirtualReserves>;
260
+
261
+ /**
262
+ * @description Retrieves the cost for using the priority queue (new).
263
+ * @param token - The address of the token.
264
+ * @returns {Promise<GetPriorityQueueCost>}
265
+ */
266
+ getPriorityQueueCost(token: Address): Promise<GetPriorityQueueCost>;
267
+ }
@@ -0,0 +1,32 @@
1
+ import { Address } from '@btc-vision/transaction';
2
+ import { CallResult, IOP_NETContract } from '../../../../opnet';
3
+
4
+ export type Admin = CallResult<{
5
+ adminAddress: Address;
6
+ }>;
7
+
8
+ export type ChangeAdmin = CallResult<{
9
+ success: boolean;
10
+ }>;
11
+
12
+ /**
13
+ * @description This interface represents the Ownable contract. It adds the ability to have an admin address that can access certain methods.
14
+ * @interface IOwnableContract
15
+ * @extends {IOP_NETContract}
16
+ * @category Contracts
17
+ *
18
+ */
19
+ export interface IOwnableContract extends IOP_NETContract {
20
+ /**
21
+ * @description Gets the current admin address.
22
+ * @returns {Admin}
23
+ */
24
+ admin(): Promise<Admin>;
25
+
26
+ /**
27
+ * @description Changes the contract admin. Only callable by the current admin.
28
+ * @param {Address} newAdmin The new admin address.
29
+ * @returns {ChangeAdmin}
30
+ */
31
+ changeAdmin(newAdmin: Address): Promise<ChangeAdmin>;
32
+ }
@@ -0,0 +1,33 @@
1
+ import { Address } from '@btc-vision/transaction';
2
+ import { CallResult } from '../../../../opnet';
3
+ import { IReentrancyGuard } from './IReentrancyGuardContract';
4
+
5
+ export type Admin = CallResult<{
6
+ adminAddress: Address;
7
+ }>;
8
+
9
+ export type ChangeAdmin = CallResult<{
10
+ success: boolean;
11
+ }>;
12
+
13
+ /**
14
+ * @description This interface represents the OwnableReentrancyGuard contract.
15
+ * @interface IOwnableContract
16
+ * @extends {IOP_NETContract}
17
+ * @category Contracts
18
+ *
19
+ */
20
+ export interface IOwnableReentrancyGuardContract extends IReentrancyGuard {
21
+ /**
22
+ * @description Gets the current admin address.
23
+ * @returns {Admin}
24
+ */
25
+ admin(): Promise<Admin>;
26
+
27
+ /**
28
+ * @description Changes the contract admin. Only callable by the current admin.
29
+ * @param {Address} newAdmin The new admin address.
30
+ * @returns {ChangeAdmin}
31
+ */
32
+ changeAdmin(newAdmin: Address): Promise<ChangeAdmin>;
33
+ }
@@ -0,0 +1,18 @@
1
+ import { CallResult, IOP_NETContract } from '../../../../opnet';
2
+
3
+ export type Status = CallResult<{ status: bigint }>;
4
+
5
+ /**
6
+ * @description This interface represents the ReentrancyGuard contract.
7
+ * @interface IReentrancyGuardContract
8
+ * @extends {IOP_NETContract}
9
+ * @category Contracts
10
+ *
11
+ */
12
+ export interface IReentrancyGuard extends IOP_NETContract {
13
+ /**
14
+ * @description Gets the current admin address.
15
+ * @returns {Status}
16
+ */
17
+ status(): Promise<Status>;
18
+ }