@alephium/powfi-sdk 0.0.1-rc.1

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 (146) hide show
  1. package/README.md +4 -0
  2. package/clmm/artifacts/BitmapWord.ral.json +125 -0
  3. package/clmm/artifacts/BitmapWordDeployer.ral.json +31 -0
  4. package/clmm/artifacts/CreateConfig.ral.json +37 -0
  5. package/clmm/artifacts/CreateLiquidPool.ral.json +55 -0
  6. package/clmm/artifacts/DexAccount.ral.json +110 -0
  7. package/clmm/artifacts/LiquidityAmountsTest.ral.json +161 -0
  8. package/clmm/artifacts/LiquidityManagmentTest.ral.json +384 -0
  9. package/clmm/artifacts/Pool.ral.json +1530 -0
  10. package/clmm/artifacts/PoolConfig.ral.json +31 -0
  11. package/clmm/artifacts/PoolFactory.ral.json +300 -0
  12. package/clmm/artifacts/PoolRouterDemo.ral.json +49 -0
  13. package/clmm/artifacts/PoolUser.ral.json +89 -0
  14. package/clmm/artifacts/Position.ral.json +183 -0
  15. package/clmm/artifacts/PositionManager.ral.json +416 -0
  16. package/clmm/artifacts/SwapWithoutAccount.ral.json +46 -0
  17. package/clmm/artifacts/TestToken.ral.json +68 -0
  18. package/clmm/artifacts/Tick.ral.json +161 -0
  19. package/clmm/artifacts/TickBitmapTest.ral.json +220 -0
  20. package/clmm/artifacts/constants.ral.json +81 -0
  21. package/clmm/artifacts/structs.ral.json +335 -0
  22. package/clmm/artifacts/ts/BitmapWord.ts +337 -0
  23. package/clmm/artifacts/ts/BitmapWordDeployer.ts +164 -0
  24. package/clmm/artifacts/ts/DexAccount.ts +330 -0
  25. package/clmm/artifacts/ts/LiquidityAmountsTest.ts +464 -0
  26. package/clmm/artifacts/ts/LiquidityManagmentTest.ts +859 -0
  27. package/clmm/artifacts/ts/Pool.ts +2535 -0
  28. package/clmm/artifacts/ts/PoolConfig.ts +179 -0
  29. package/clmm/artifacts/ts/PoolFactory.ts +640 -0
  30. package/clmm/artifacts/ts/PoolUser.ts +237 -0
  31. package/clmm/artifacts/ts/Position.ts +440 -0
  32. package/clmm/artifacts/ts/PositionManager.ts +929 -0
  33. package/clmm/artifacts/ts/TestToken.ts +277 -0
  34. package/clmm/artifacts/ts/Tick.ts +351 -0
  35. package/clmm/artifacts/ts/TickBitmapTest.ts +512 -0
  36. package/clmm/artifacts/ts/constants.ts +17 -0
  37. package/clmm/artifacts/ts/contracts.ts +26 -0
  38. package/clmm/artifacts/ts/deployments.ts +160 -0
  39. package/clmm/artifacts/ts/index.ts +20 -0
  40. package/clmm/artifacts/ts/scripts.ts +76 -0
  41. package/clmm/artifacts/ts/types.ts +105 -0
  42. package/clmm/deployments/.deployments.devnet.json +350 -0
  43. package/clmm/deployments/.deployments.testnet.json +350 -0
  44. package/cpmm/artifacts/dex/DexAccount.ral.json +110 -0
  45. package/cpmm/artifacts/dex/Router.ral.json +361 -0
  46. package/cpmm/artifacts/dex/TokenPair.ral.json +512 -0
  47. package/cpmm/artifacts/dex/TokenPairFactory.ral.json +297 -0
  48. package/cpmm/artifacts/examples/ExampleOracleSimple.ral.json +192 -0
  49. package/cpmm/artifacts/examples/FeeCollectorFactoryImpl.ral.json +185 -0
  50. package/cpmm/artifacts/examples/FeeCollectorPerTokenPairImpl.ral.json +216 -0
  51. package/cpmm/artifacts/examples/FullMathTest.ral.json +123 -0
  52. package/cpmm/artifacts/scripts/AddLiquidity.ral.json +46 -0
  53. package/cpmm/artifacts/scripts/Burn.ral.json +31 -0
  54. package/cpmm/artifacts/scripts/CollectFee.ral.json +25 -0
  55. package/cpmm/artifacts/scripts/CreatePair.ral.json +37 -0
  56. package/cpmm/artifacts/scripts/CreatePairAndAddLiquidity.ral.json +43 -0
  57. package/cpmm/artifacts/scripts/EnableFeeCollector.ral.json +28 -0
  58. package/cpmm/artifacts/scripts/Mint.ral.json +34 -0
  59. package/cpmm/artifacts/scripts/RemoveLiquidity.ral.json +43 -0
  60. package/cpmm/artifacts/scripts/SetFeeCollectorFactory.ral.json +28 -0
  61. package/cpmm/artifacts/scripts/Swap.ral.json +46 -0
  62. package/cpmm/artifacts/scripts/SwapMaxIn.ral.json +46 -0
  63. package/cpmm/artifacts/scripts/SwapMinOut.ral.json +46 -0
  64. package/cpmm/artifacts/test/GetToken.ral.json +31 -0
  65. package/cpmm/artifacts/test/MathTest.ral.json +49 -0
  66. package/cpmm/artifacts/test/TestToken.ral.json +87 -0
  67. package/cpmm/artifacts/ts/DexAccount.ts +329 -0
  68. package/cpmm/artifacts/ts/ExampleOracleSimple.ts +383 -0
  69. package/cpmm/artifacts/ts/FeeCollectorFactoryImpl.ts +227 -0
  70. package/cpmm/artifacts/ts/FeeCollectorPerTokenPairImpl.ts +327 -0
  71. package/cpmm/artifacts/ts/FullMathTest.ts +251 -0
  72. package/cpmm/artifacts/ts/MathTest.ts +183 -0
  73. package/cpmm/artifacts/ts/Router.ts +554 -0
  74. package/cpmm/artifacts/ts/TestToken.ts +312 -0
  75. package/cpmm/artifacts/ts/TokenPair.ts +947 -0
  76. package/cpmm/artifacts/ts/TokenPairFactory.ts +501 -0
  77. package/cpmm/artifacts/ts/contracts.ts +26 -0
  78. package/cpmm/artifacts/ts/deployments.ts +109 -0
  79. package/cpmm/artifacts/ts/index.ts +16 -0
  80. package/cpmm/artifacts/ts/scripts.ts +142 -0
  81. package/cpmm/deployments/.deployments.devnet.json +77 -0
  82. package/cpmm/deployments/.deployments.testnet.json +79 -0
  83. package/lib/index.d.mts +8800 -0
  84. package/lib/index.d.ts +8800 -0
  85. package/lib/index.js +21769 -0
  86. package/lib/index.js.map +1 -0
  87. package/lib/index.mjs +22118 -0
  88. package/lib/index.mjs.map +1 -0
  89. package/package.json +80 -0
  90. package/src/clmm/clmm.ts +607 -0
  91. package/src/clmm/constants.ts +7 -0
  92. package/src/clmm/index.ts +6 -0
  93. package/src/clmm/liquidity.ts +163 -0
  94. package/src/clmm/pool.ts +154 -0
  95. package/src/clmm/tick.ts +335 -0
  96. package/src/clmm/types.ts +155 -0
  97. package/src/common/constants.ts +1 -0
  98. package/src/common/error.ts +46 -0
  99. package/src/common/index.ts +7 -0
  100. package/src/common/logger.ts +82 -0
  101. package/src/common/math.ts +88 -0
  102. package/src/common/numeric.ts +64 -0
  103. package/src/common/types.ts +49 -0
  104. package/src/common/utils.ts +3 -0
  105. package/src/cpmm/constants.ts +2 -0
  106. package/src/cpmm/cpmm.ts +631 -0
  107. package/src/cpmm/index.ts +3 -0
  108. package/src/cpmm/types.ts +113 -0
  109. package/src/index.ts +25 -0
  110. package/src/moduleBase.ts +64 -0
  111. package/src/staking/index.ts +4 -0
  112. package/src/staking/settings.ts +38 -0
  113. package/src/staking/staking.ts +277 -0
  114. package/src/staking/types.ts +15 -0
  115. package/src/staking/utils.ts +25 -0
  116. package/src/token/index.ts +1 -0
  117. package/src/token/token.ts +163 -0
  118. package/src/zeta.ts +105 -0
  119. package/staking/artifacts/AlphStakeAndLock.ral.json +31 -0
  120. package/staking/artifacts/AlphUnstakeVault.ral.json +151 -0
  121. package/staking/artifacts/XAlphStakeVault.ral.json +559 -0
  122. package/staking/artifacts/XAlphToken.ral.json +404 -0
  123. package/staking/artifacts/XAlphUnlockAndStartUnstake.ral.json +31 -0
  124. package/staking/artifacts/examples/GovernanceDemo.ral.json +282 -0
  125. package/staking/artifacts/examples/RewardSharingVault.ral.json +253 -0
  126. package/staking/artifacts/structs.ral.json +47 -0
  127. package/staking/artifacts/ts/AlphUnstakeVault.ts +354 -0
  128. package/staking/artifacts/ts/FullMathTest.ts +175 -0
  129. package/staking/artifacts/ts/GovernanceDemo.ts +726 -0
  130. package/staking/artifacts/ts/RewardSharingVault.ts +559 -0
  131. package/staking/artifacts/ts/TestDynamicArrayByteVec32.ts +431 -0
  132. package/staking/artifacts/ts/TestDynamicSortedArrayForU256.ts +516 -0
  133. package/staking/artifacts/ts/TestMerkleProof.ts +343 -0
  134. package/staking/artifacts/ts/XAlphStakeVault.ts +1120 -0
  135. package/staking/artifacts/ts/XAlphToken.ts +835 -0
  136. package/staking/artifacts/ts/contracts.ts +26 -0
  137. package/staking/artifacts/ts/deployments.ts +109 -0
  138. package/staking/artifacts/ts/index.ts +15 -0
  139. package/staking/artifacts/ts/scripts.ts +35 -0
  140. package/staking/artifacts/ts/types.ts +19 -0
  141. package/staking/artifacts/utils/FullMathTest.ral.json +57 -0
  142. package/staking/artifacts/utils/TestDynamicArrayByteVec32.ral.json +165 -0
  143. package/staking/artifacts/utils/TestDynamicSortedArrayForU256.ral.json +189 -0
  144. package/staking/artifacts/utils/TestMerkleProof.ral.json +134 -0
  145. package/staking/deployments/.deployments.devnet.json +77 -0
  146. package/staking/deployments/.deployments.testnet.json +78 -0
@@ -0,0 +1,559 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import {
6
+ Address,
7
+ Contract,
8
+ ContractState,
9
+ TestContractResult,
10
+ HexString,
11
+ ContractFactory,
12
+ EventSubscribeOptions,
13
+ EventSubscription,
14
+ CallContractParams,
15
+ CallContractResult,
16
+ TestContractParams,
17
+ ContractEvent,
18
+ subscribeContractEvent,
19
+ subscribeContractEvents,
20
+ testMethod,
21
+ callMethod,
22
+ multicallMethods,
23
+ fetchContractState,
24
+ Asset,
25
+ ContractInstance,
26
+ getContractEventsCurrentCount,
27
+ TestContractParamsWithoutMaps,
28
+ TestContractResultWithoutMaps,
29
+ SignExecuteContractMethodParams,
30
+ SignExecuteScriptTxResult,
31
+ signExecuteMethod,
32
+ addStdIdToFields,
33
+ encodeContractFields,
34
+ Narrow,
35
+ } from "@alephium/web3";
36
+ import { default as RewardSharingVaultContractJson } from "../examples/RewardSharingVault.ral.json";
37
+ import { getContractByCodeHash, registerContract } from "./contracts";
38
+ import * as types from "./types";
39
+ import { RalphMap } from "@alephium/web3";
40
+
41
+ // Custom types for the contract
42
+ export namespace RewardSharingVaultTypes {
43
+ export type Fields = {
44
+ stakeVault: HexString;
45
+ rewardTokenId: HexString;
46
+ totalAmountStaked: bigint;
47
+ rewardPerTokenCumulative: bigint;
48
+ };
49
+
50
+ export type State = ContractState<Fields>;
51
+
52
+ export type StakedEvent = ContractEvent<{ staker: Address; amount: bigint }>;
53
+ export type UnstakedEvent = ContractEvent<{
54
+ staker: Address;
55
+ amount: bigint;
56
+ }>;
57
+ export type RewardDepositedEvent = ContractEvent<{
58
+ depositor: Address;
59
+ amount: bigint;
60
+ }>;
61
+ export type RewardClaimedEvent = ContractEvent<{
62
+ staker: Address;
63
+ amount: bigint;
64
+ }>;
65
+
66
+ export interface CallMethodTable {
67
+ onStake: {
68
+ params: CallContractParams<{ user: Address; newStakedAmount: bigint }>;
69
+ result: CallContractResult<null>;
70
+ };
71
+ onUnstake: {
72
+ params: CallContractParams<{ user: Address; unstakedAmount: bigint }>;
73
+ result: CallContractResult<null>;
74
+ };
75
+ mulDiv: {
76
+ params: CallContractParams<{ a: bigint; b: bigint; denominator: bigint }>;
77
+ result: CallContractResult<bigint>;
78
+ };
79
+ depositReward: {
80
+ params: CallContractParams<{ amount: bigint }>;
81
+ result: CallContractResult<null>;
82
+ };
83
+ claimPendingRewards: {
84
+ params: Omit<CallContractParams<{}>, "args">;
85
+ result: CallContractResult<null>;
86
+ };
87
+ claimUserPendingRewards: {
88
+ params: CallContractParams<{ user: Address }>;
89
+ result: CallContractResult<null>;
90
+ };
91
+ getUserPendingRewards: {
92
+ params: CallContractParams<{ user: Address }>;
93
+ result: CallContractResult<bigint>;
94
+ };
95
+ }
96
+ export type CallMethodParams<T extends keyof CallMethodTable> =
97
+ CallMethodTable[T]["params"];
98
+ export type CallMethodResult<T extends keyof CallMethodTable> =
99
+ CallMethodTable[T]["result"];
100
+ export type MultiCallParams = Partial<{
101
+ [Name in keyof CallMethodTable]: CallMethodTable[Name]["params"];
102
+ }>;
103
+ export type MultiCallResults<T extends MultiCallParams> = {
104
+ [MaybeName in keyof T]: MaybeName extends keyof CallMethodTable
105
+ ? CallMethodTable[MaybeName]["result"]
106
+ : undefined;
107
+ };
108
+ export type MulticallReturnType<Callss extends MultiCallParams[]> = {
109
+ [index in keyof Callss]: MultiCallResults<Callss[index]>;
110
+ };
111
+
112
+ export interface SignExecuteMethodTable {
113
+ onStake: {
114
+ params: SignExecuteContractMethodParams<{
115
+ user: Address;
116
+ newStakedAmount: bigint;
117
+ }>;
118
+ result: SignExecuteScriptTxResult;
119
+ };
120
+ onUnstake: {
121
+ params: SignExecuteContractMethodParams<{
122
+ user: Address;
123
+ unstakedAmount: bigint;
124
+ }>;
125
+ result: SignExecuteScriptTxResult;
126
+ };
127
+ mulDiv: {
128
+ params: SignExecuteContractMethodParams<{
129
+ a: bigint;
130
+ b: bigint;
131
+ denominator: bigint;
132
+ }>;
133
+ result: SignExecuteScriptTxResult;
134
+ };
135
+ depositReward: {
136
+ params: SignExecuteContractMethodParams<{ amount: bigint }>;
137
+ result: SignExecuteScriptTxResult;
138
+ };
139
+ claimPendingRewards: {
140
+ params: Omit<SignExecuteContractMethodParams<{}>, "args">;
141
+ result: SignExecuteScriptTxResult;
142
+ };
143
+ claimUserPendingRewards: {
144
+ params: SignExecuteContractMethodParams<{ user: Address }>;
145
+ result: SignExecuteScriptTxResult;
146
+ };
147
+ getUserPendingRewards: {
148
+ params: SignExecuteContractMethodParams<{ user: Address }>;
149
+ result: SignExecuteScriptTxResult;
150
+ };
151
+ }
152
+ export type SignExecuteMethodParams<T extends keyof SignExecuteMethodTable> =
153
+ SignExecuteMethodTable[T]["params"];
154
+ export type SignExecuteMethodResult<T extends keyof SignExecuteMethodTable> =
155
+ SignExecuteMethodTable[T]["result"];
156
+
157
+ export type Maps = {
158
+ userRewardSharingInfo?: Map<Address, types.UserRewardSharingInfo>;
159
+ };
160
+ }
161
+
162
+ class Factory extends ContractFactory<
163
+ RewardSharingVaultInstance,
164
+ RewardSharingVaultTypes.Fields
165
+ > {
166
+ encodeFields(fields: RewardSharingVaultTypes.Fields) {
167
+ return encodeContractFields(
168
+ addStdIdToFields(this.contract, fields),
169
+ this.contract.fieldsSig,
170
+ types.AllStructs
171
+ );
172
+ }
173
+
174
+ eventIndex = { Staked: 0, Unstaked: 1, RewardDeposited: 2, RewardClaimed: 3 };
175
+ consts = {
176
+ SCALING_FACTOR: BigInt("1000000000000000000"),
177
+ FullMathError: { DivByZero: BigInt("350"), MulDivOverflow: BigInt("351") },
178
+ ErrorCodes: {
179
+ StakeVaultCallerOnly: BigInt("40"),
180
+ NoUserRewardSharingInfo: BigInt("41"),
181
+ TotalStakedAmountIsZero: BigInt("42"),
182
+ InvalidStakedAmount: BigInt("43"),
183
+ InvalidUnstakedAmount: BigInt("44"),
184
+ },
185
+ };
186
+
187
+ at(address: string): RewardSharingVaultInstance {
188
+ return new RewardSharingVaultInstance(address);
189
+ }
190
+
191
+ tests = {
192
+ onStake: async (
193
+ params: TestContractParams<
194
+ RewardSharingVaultTypes.Fields,
195
+ { user: Address; newStakedAmount: bigint },
196
+ RewardSharingVaultTypes.Maps
197
+ >
198
+ ): Promise<TestContractResult<null, RewardSharingVaultTypes.Maps>> => {
199
+ return testMethod(this, "onStake", params, getContractByCodeHash);
200
+ },
201
+ onUnstake: async (
202
+ params: TestContractParams<
203
+ RewardSharingVaultTypes.Fields,
204
+ { user: Address; unstakedAmount: bigint },
205
+ RewardSharingVaultTypes.Maps
206
+ >
207
+ ): Promise<TestContractResult<null, RewardSharingVaultTypes.Maps>> => {
208
+ return testMethod(this, "onUnstake", params, getContractByCodeHash);
209
+ },
210
+ mulDiv: async (
211
+ params: TestContractParams<
212
+ RewardSharingVaultTypes.Fields,
213
+ { a: bigint; b: bigint; denominator: bigint },
214
+ RewardSharingVaultTypes.Maps
215
+ >
216
+ ): Promise<TestContractResult<bigint, RewardSharingVaultTypes.Maps>> => {
217
+ return testMethod(this, "mulDiv", params, getContractByCodeHash);
218
+ },
219
+ depositReward: async (
220
+ params: TestContractParams<
221
+ RewardSharingVaultTypes.Fields,
222
+ { amount: bigint },
223
+ RewardSharingVaultTypes.Maps
224
+ >
225
+ ): Promise<TestContractResult<null, RewardSharingVaultTypes.Maps>> => {
226
+ return testMethod(this, "depositReward", params, getContractByCodeHash);
227
+ },
228
+ claimPendingRewards: async (
229
+ params: Omit<
230
+ TestContractParams<
231
+ RewardSharingVaultTypes.Fields,
232
+ never,
233
+ RewardSharingVaultTypes.Maps
234
+ >,
235
+ "args"
236
+ >
237
+ ): Promise<TestContractResult<null, RewardSharingVaultTypes.Maps>> => {
238
+ return testMethod(
239
+ this,
240
+ "claimPendingRewards",
241
+ params,
242
+ getContractByCodeHash
243
+ );
244
+ },
245
+ claimUserPendingRewards: async (
246
+ params: TestContractParams<
247
+ RewardSharingVaultTypes.Fields,
248
+ { user: Address },
249
+ RewardSharingVaultTypes.Maps
250
+ >
251
+ ): Promise<TestContractResult<null, RewardSharingVaultTypes.Maps>> => {
252
+ return testMethod(
253
+ this,
254
+ "claimUserPendingRewards",
255
+ params,
256
+ getContractByCodeHash
257
+ );
258
+ },
259
+ getUserPendingRewards: async (
260
+ params: TestContractParams<
261
+ RewardSharingVaultTypes.Fields,
262
+ { user: Address },
263
+ RewardSharingVaultTypes.Maps
264
+ >
265
+ ): Promise<TestContractResult<bigint, RewardSharingVaultTypes.Maps>> => {
266
+ return testMethod(
267
+ this,
268
+ "getUserPendingRewards",
269
+ params,
270
+ getContractByCodeHash
271
+ );
272
+ },
273
+ };
274
+
275
+ stateForTest(
276
+ initFields: RewardSharingVaultTypes.Fields,
277
+ asset?: Asset,
278
+ address?: string,
279
+ maps?: RewardSharingVaultTypes.Maps
280
+ ) {
281
+ return this.stateForTest_(initFields, asset, address, maps);
282
+ }
283
+ }
284
+
285
+ // Use this object to test and deploy the contract
286
+ export const RewardSharingVault = new Factory(
287
+ Contract.fromJson(
288
+ RewardSharingVaultContractJson,
289
+ "=6-2+d0=2-2+8=1-3=2-2+6e=2-1+a=3-2+bb42f2=2-2+50=13-1+6=235-1+7=74+7a7e0214696e73657274206174206d617020706174683a2000=55-1+8=173-1+c=38+7a7e021472656d6f7665206174206d617020706174683a2000=1004",
290
+ "ad1203de899174ecc3a6b2fdf1ea73664ad5ae8ae74b0113feb5404f15b96347",
291
+ types.AllStructs
292
+ )
293
+ );
294
+ registerContract(RewardSharingVault);
295
+
296
+ // Use this class to interact with the blockchain
297
+ export class RewardSharingVaultInstance extends ContractInstance {
298
+ constructor(address: Address) {
299
+ super(address);
300
+ }
301
+
302
+ maps = {
303
+ userRewardSharingInfo: new RalphMap<Address, types.UserRewardSharingInfo>(
304
+ RewardSharingVault.contract,
305
+ this.contractId,
306
+ "userRewardSharingInfo"
307
+ ),
308
+ };
309
+
310
+ async fetchState(): Promise<RewardSharingVaultTypes.State> {
311
+ return fetchContractState(RewardSharingVault, this);
312
+ }
313
+
314
+ async getContractEventsCurrentCount(): Promise<number> {
315
+ return getContractEventsCurrentCount(this.address);
316
+ }
317
+
318
+ subscribeStakedEvent(
319
+ options: EventSubscribeOptions<RewardSharingVaultTypes.StakedEvent>,
320
+ fromCount?: number
321
+ ): EventSubscription {
322
+ return subscribeContractEvent(
323
+ RewardSharingVault.contract,
324
+ this,
325
+ options,
326
+ "Staked",
327
+ fromCount
328
+ );
329
+ }
330
+
331
+ subscribeUnstakedEvent(
332
+ options: EventSubscribeOptions<RewardSharingVaultTypes.UnstakedEvent>,
333
+ fromCount?: number
334
+ ): EventSubscription {
335
+ return subscribeContractEvent(
336
+ RewardSharingVault.contract,
337
+ this,
338
+ options,
339
+ "Unstaked",
340
+ fromCount
341
+ );
342
+ }
343
+
344
+ subscribeRewardDepositedEvent(
345
+ options: EventSubscribeOptions<RewardSharingVaultTypes.RewardDepositedEvent>,
346
+ fromCount?: number
347
+ ): EventSubscription {
348
+ return subscribeContractEvent(
349
+ RewardSharingVault.contract,
350
+ this,
351
+ options,
352
+ "RewardDeposited",
353
+ fromCount
354
+ );
355
+ }
356
+
357
+ subscribeRewardClaimedEvent(
358
+ options: EventSubscribeOptions<RewardSharingVaultTypes.RewardClaimedEvent>,
359
+ fromCount?: number
360
+ ): EventSubscription {
361
+ return subscribeContractEvent(
362
+ RewardSharingVault.contract,
363
+ this,
364
+ options,
365
+ "RewardClaimed",
366
+ fromCount
367
+ );
368
+ }
369
+
370
+ subscribeAllEvents(
371
+ options: EventSubscribeOptions<
372
+ | RewardSharingVaultTypes.StakedEvent
373
+ | RewardSharingVaultTypes.UnstakedEvent
374
+ | RewardSharingVaultTypes.RewardDepositedEvent
375
+ | RewardSharingVaultTypes.RewardClaimedEvent
376
+ >,
377
+ fromCount?: number
378
+ ): EventSubscription {
379
+ return subscribeContractEvents(
380
+ RewardSharingVault.contract,
381
+ this,
382
+ options,
383
+ fromCount
384
+ );
385
+ }
386
+
387
+ view = {
388
+ onStake: async (
389
+ params: RewardSharingVaultTypes.CallMethodParams<"onStake">
390
+ ): Promise<RewardSharingVaultTypes.CallMethodResult<"onStake">> => {
391
+ return callMethod(
392
+ RewardSharingVault,
393
+ this,
394
+ "onStake",
395
+ params,
396
+ getContractByCodeHash
397
+ );
398
+ },
399
+ onUnstake: async (
400
+ params: RewardSharingVaultTypes.CallMethodParams<"onUnstake">
401
+ ): Promise<RewardSharingVaultTypes.CallMethodResult<"onUnstake">> => {
402
+ return callMethod(
403
+ RewardSharingVault,
404
+ this,
405
+ "onUnstake",
406
+ params,
407
+ getContractByCodeHash
408
+ );
409
+ },
410
+ mulDiv: async (
411
+ params: RewardSharingVaultTypes.CallMethodParams<"mulDiv">
412
+ ): Promise<RewardSharingVaultTypes.CallMethodResult<"mulDiv">> => {
413
+ return callMethod(
414
+ RewardSharingVault,
415
+ this,
416
+ "mulDiv",
417
+ params,
418
+ getContractByCodeHash
419
+ );
420
+ },
421
+ depositReward: async (
422
+ params: RewardSharingVaultTypes.CallMethodParams<"depositReward">
423
+ ): Promise<RewardSharingVaultTypes.CallMethodResult<"depositReward">> => {
424
+ return callMethod(
425
+ RewardSharingVault,
426
+ this,
427
+ "depositReward",
428
+ params,
429
+ getContractByCodeHash
430
+ );
431
+ },
432
+ claimPendingRewards: async (
433
+ params?: RewardSharingVaultTypes.CallMethodParams<"claimPendingRewards">
434
+ ): Promise<
435
+ RewardSharingVaultTypes.CallMethodResult<"claimPendingRewards">
436
+ > => {
437
+ return callMethod(
438
+ RewardSharingVault,
439
+ this,
440
+ "claimPendingRewards",
441
+ params === undefined ? {} : params,
442
+ getContractByCodeHash
443
+ );
444
+ },
445
+ claimUserPendingRewards: async (
446
+ params: RewardSharingVaultTypes.CallMethodParams<"claimUserPendingRewards">
447
+ ): Promise<
448
+ RewardSharingVaultTypes.CallMethodResult<"claimUserPendingRewards">
449
+ > => {
450
+ return callMethod(
451
+ RewardSharingVault,
452
+ this,
453
+ "claimUserPendingRewards",
454
+ params,
455
+ getContractByCodeHash
456
+ );
457
+ },
458
+ getUserPendingRewards: async (
459
+ params: RewardSharingVaultTypes.CallMethodParams<"getUserPendingRewards">
460
+ ): Promise<
461
+ RewardSharingVaultTypes.CallMethodResult<"getUserPendingRewards">
462
+ > => {
463
+ return callMethod(
464
+ RewardSharingVault,
465
+ this,
466
+ "getUserPendingRewards",
467
+ params,
468
+ getContractByCodeHash
469
+ );
470
+ },
471
+ };
472
+
473
+ transact = {
474
+ onStake: async (
475
+ params: RewardSharingVaultTypes.SignExecuteMethodParams<"onStake">
476
+ ): Promise<RewardSharingVaultTypes.SignExecuteMethodResult<"onStake">> => {
477
+ return signExecuteMethod(RewardSharingVault, this, "onStake", params);
478
+ },
479
+ onUnstake: async (
480
+ params: RewardSharingVaultTypes.SignExecuteMethodParams<"onUnstake">
481
+ ): Promise<
482
+ RewardSharingVaultTypes.SignExecuteMethodResult<"onUnstake">
483
+ > => {
484
+ return signExecuteMethod(RewardSharingVault, this, "onUnstake", params);
485
+ },
486
+ mulDiv: async (
487
+ params: RewardSharingVaultTypes.SignExecuteMethodParams<"mulDiv">
488
+ ): Promise<RewardSharingVaultTypes.SignExecuteMethodResult<"mulDiv">> => {
489
+ return signExecuteMethod(RewardSharingVault, this, "mulDiv", params);
490
+ },
491
+ depositReward: async (
492
+ params: RewardSharingVaultTypes.SignExecuteMethodParams<"depositReward">
493
+ ): Promise<
494
+ RewardSharingVaultTypes.SignExecuteMethodResult<"depositReward">
495
+ > => {
496
+ return signExecuteMethod(
497
+ RewardSharingVault,
498
+ this,
499
+ "depositReward",
500
+ params
501
+ );
502
+ },
503
+ claimPendingRewards: async (
504
+ params: RewardSharingVaultTypes.SignExecuteMethodParams<"claimPendingRewards">
505
+ ): Promise<
506
+ RewardSharingVaultTypes.SignExecuteMethodResult<"claimPendingRewards">
507
+ > => {
508
+ return signExecuteMethod(
509
+ RewardSharingVault,
510
+ this,
511
+ "claimPendingRewards",
512
+ params
513
+ );
514
+ },
515
+ claimUserPendingRewards: async (
516
+ params: RewardSharingVaultTypes.SignExecuteMethodParams<"claimUserPendingRewards">
517
+ ): Promise<
518
+ RewardSharingVaultTypes.SignExecuteMethodResult<"claimUserPendingRewards">
519
+ > => {
520
+ return signExecuteMethod(
521
+ RewardSharingVault,
522
+ this,
523
+ "claimUserPendingRewards",
524
+ params
525
+ );
526
+ },
527
+ getUserPendingRewards: async (
528
+ params: RewardSharingVaultTypes.SignExecuteMethodParams<"getUserPendingRewards">
529
+ ): Promise<
530
+ RewardSharingVaultTypes.SignExecuteMethodResult<"getUserPendingRewards">
531
+ > => {
532
+ return signExecuteMethod(
533
+ RewardSharingVault,
534
+ this,
535
+ "getUserPendingRewards",
536
+ params
537
+ );
538
+ },
539
+ };
540
+
541
+ async multicall<Calls extends RewardSharingVaultTypes.MultiCallParams>(
542
+ calls: Calls
543
+ ): Promise<RewardSharingVaultTypes.MultiCallResults<Calls>>;
544
+ async multicall<Callss extends RewardSharingVaultTypes.MultiCallParams[]>(
545
+ callss: Narrow<Callss>
546
+ ): Promise<RewardSharingVaultTypes.MulticallReturnType<Callss>>;
547
+ async multicall<
548
+ Callss extends
549
+ | RewardSharingVaultTypes.MultiCallParams
550
+ | RewardSharingVaultTypes.MultiCallParams[]
551
+ >(callss: Callss): Promise<unknown> {
552
+ return await multicallMethods(
553
+ RewardSharingVault,
554
+ this,
555
+ callss,
556
+ getContractByCodeHash
557
+ );
558
+ }
559
+ }