@gitmyabi/oracle 1.0.0 → 1.0.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.
@@ -1,1035 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Oracle_json = exports.Oracle_jsonAbi = void 0;
4
- const viem_1 = require("viem");
5
- /**
6
- * Oracle_json ABI
7
- *
8
- * This ABI is typed using viem's type system for full type safety.
9
- */
10
- exports.Oracle_jsonAbi = [
11
- {
12
- "inputs": [
13
- {
14
- "internalType": "address",
15
- "name": "_weth9",
16
- "type": "address"
17
- },
18
- {
19
- "internalType": "uint32",
20
- "name": "_intervalShort",
21
- "type": "uint32"
22
- },
23
- {
24
- "internalType": "uint32",
25
- "name": "_intervalLong",
26
- "type": "uint32"
27
- },
28
- {
29
- "internalType": "uint256",
30
- "name": "_flexFeeThreshold",
31
- "type": "uint256"
32
- },
33
- {
34
- "internalType": "address",
35
- "name": "_chainlinkUSDFeed",
36
- "type": "address"
37
- }
38
- ],
39
- "stateMutability": "nonpayable",
40
- "type": "constructor"
41
- },
42
- {
43
- "anonymous": false,
44
- "inputs": [
45
- {
46
- "indexed": false,
47
- "internalType": "uint256",
48
- "name": "_flexFeeThreshold",
49
- "type": "uint256"
50
- }
51
- ],
52
- "name": "FlexFeeThreshold",
53
- "type": "event"
54
- },
55
- {
56
- "anonymous": false,
57
- "inputs": [
58
- {
59
- "indexed": false,
60
- "internalType": "uint32",
61
- "name": "_intervalLong",
62
- "type": "uint32"
63
- }
64
- ],
65
- "name": "IntervalLong",
66
- "type": "event"
67
- },
68
- {
69
- "anonymous": false,
70
- "inputs": [
71
- {
72
- "indexed": false,
73
- "internalType": "uint32",
74
- "name": "_intervalShort",
75
- "type": "uint32"
76
- }
77
- ],
78
- "name": "IntervalShort",
79
- "type": "event"
80
- },
81
- {
82
- "anonymous": false,
83
- "inputs": [
84
- {
85
- "indexed": true,
86
- "internalType": "address",
87
- "name": "previousOwner",
88
- "type": "address"
89
- },
90
- {
91
- "indexed": true,
92
- "internalType": "address",
93
- "name": "newOwner",
94
- "type": "address"
95
- }
96
- ],
97
- "name": "OwnershipTransferred",
98
- "type": "event"
99
- },
100
- {
101
- "inputs": [
102
- {
103
- "internalType": "address",
104
- "name": "_chainlinkFeed",
105
- "type": "address"
106
- }
107
- ],
108
- "name": "chainlinkPrice",
109
- "outputs": [
110
- {
111
- "internalType": "uint256",
112
- "name": "",
113
- "type": "uint256"
114
- }
115
- ],
116
- "stateMutability": "view",
117
- "type": "function"
118
- },
119
- {
120
- "inputs": [],
121
- "name": "chainlinkUSDFeed",
122
- "outputs": [
123
- {
124
- "internalType": "address",
125
- "name": "",
126
- "type": "address"
127
- }
128
- ],
129
- "stateMutability": "view",
130
- "type": "function"
131
- },
132
- {
133
- "inputs": [],
134
- "name": "flexFeeThreshold",
135
- "outputs": [
136
- {
137
- "internalType": "uint256",
138
- "name": "",
139
- "type": "uint256"
140
- }
141
- ],
142
- "stateMutability": "view",
143
- "type": "function"
144
- },
145
- {
146
- "inputs": [
147
- {
148
- "internalType": "uint256",
149
- "name": "_amount",
150
- "type": "uint256"
151
- },
152
- {
153
- "internalType": "address",
154
- "name": "_chainlinkFeed",
155
- "type": "address"
156
- },
157
- {
158
- "internalType": "address",
159
- "name": "_xftPool",
160
- "type": "address"
161
- }
162
- ],
163
- "name": "getCost",
164
- "outputs": [
165
- {
166
- "internalType": "uint256",
167
- "name": "",
168
- "type": "uint256"
169
- }
170
- ],
171
- "stateMutability": "view",
172
- "type": "function"
173
- },
174
- {
175
- "inputs": [
176
- {
177
- "internalType": "uint256",
178
- "name": "_amount",
179
- "type": "uint256"
180
- },
181
- {
182
- "internalType": "address",
183
- "name": "_chainlinkFeed",
184
- "type": "address"
185
- },
186
- {
187
- "internalType": "address",
188
- "name": "_xftPool",
189
- "type": "address"
190
- },
191
- {
192
- "internalType": "address",
193
- "name": "_tokenPool",
194
- "type": "address"
195
- }
196
- ],
197
- "name": "getCostSimpleShift",
198
- "outputs": [
199
- {
200
- "internalType": "uint256",
201
- "name": "",
202
- "type": "uint256"
203
- }
204
- ],
205
- "stateMutability": "view",
206
- "type": "function"
207
- },
208
- {
209
- "inputs": [
210
- {
211
- "internalType": "uint256",
212
- "name": "_usdFee",
213
- "type": "uint256"
214
- },
215
- {
216
- "internalType": "address",
217
- "name": "_chainlinkFeed",
218
- "type": "address"
219
- },
220
- {
221
- "internalType": "address",
222
- "name": "_tokenPool",
223
- "type": "address"
224
- }
225
- ],
226
- "name": "getFeeInTargetCurrency",
227
- "outputs": [
228
- {
229
- "internalType": "uint256",
230
- "name": "",
231
- "type": "uint256"
232
- }
233
- ],
234
- "stateMutability": "view",
235
- "type": "function"
236
- },
237
- {
238
- "inputs": [
239
- {
240
- "internalType": "address",
241
- "name": "_pool",
242
- "type": "address"
243
- },
244
- {
245
- "internalType": "uint32",
246
- "name": "_intervalShort",
247
- "type": "uint32"
248
- },
249
- {
250
- "internalType": "uint32",
251
- "name": "_intervalLong",
252
- "type": "uint32"
253
- },
254
- {
255
- "internalType": "address",
256
- "name": "_chainlinkFeed",
257
- "type": "address"
258
- },
259
- {
260
- "internalType": "uint256",
261
- "name": "_amount",
262
- "type": "uint256"
263
- },
264
- {
265
- "internalType": "address",
266
- "name": "_weth9",
267
- "type": "address"
268
- }
269
- ],
270
- "name": "getTokensForAmount",
271
- "outputs": [
272
- {
273
- "internalType": "uint256",
274
- "name": "",
275
- "type": "uint256"
276
- }
277
- ],
278
- "stateMutability": "view",
279
- "type": "function"
280
- },
281
- {
282
- "inputs": [
283
- {
284
- "internalType": "address",
285
- "name": "_pool",
286
- "type": "address"
287
- },
288
- {
289
- "internalType": "uint32",
290
- "name": "_intervalShort",
291
- "type": "uint32"
292
- },
293
- {
294
- "internalType": "uint32",
295
- "name": "_intervalLong",
296
- "type": "uint32"
297
- },
298
- {
299
- "internalType": "address",
300
- "name": "_chainlinkFeed",
301
- "type": "address"
302
- },
303
- {
304
- "internalType": "uint256",
305
- "name": "_amount",
306
- "type": "uint256"
307
- },
308
- {
309
- "internalType": "address",
310
- "name": "_weth9",
311
- "type": "address"
312
- }
313
- ],
314
- "name": "getTokensForAmountCeiling",
315
- "outputs": [
316
- {
317
- "internalType": "uint256",
318
- "name": "",
319
- "type": "uint256"
320
- }
321
- ],
322
- "stateMutability": "view",
323
- "type": "function"
324
- },
325
- {
326
- "inputs": [
327
- {
328
- "internalType": "address",
329
- "name": "_pool",
330
- "type": "address"
331
- },
332
- {
333
- "internalType": "uint32",
334
- "name": "_intervalShort",
335
- "type": "uint32"
336
- },
337
- {
338
- "internalType": "uint32",
339
- "name": "_intervalLong",
340
- "type": "uint32"
341
- },
342
- {
343
- "internalType": "address",
344
- "name": "_chainlinkFeed",
345
- "type": "address"
346
- },
347
- {
348
- "internalType": "uint256",
349
- "name": "_amount",
350
- "type": "uint256"
351
- },
352
- {
353
- "internalType": "address",
354
- "name": "_weth9",
355
- "type": "address"
356
- }
357
- ],
358
- "name": "getTokensForAmountSimpleShift",
359
- "outputs": [
360
- {
361
- "internalType": "uint256",
362
- "name": "",
363
- "type": "uint256"
364
- }
365
- ],
366
- "stateMutability": "view",
367
- "type": "function"
368
- },
369
- {
370
- "inputs": [
371
- {
372
- "internalType": "address",
373
- "name": "_xftPool",
374
- "type": "address"
375
- },
376
- {
377
- "internalType": "address",
378
- "name": "_tokenPool",
379
- "type": "address"
380
- },
381
- {
382
- "internalType": "uint32",
383
- "name": "_intervalShort",
384
- "type": "uint32"
385
- },
386
- {
387
- "internalType": "uint32",
388
- "name": "_intervalLong",
389
- "type": "uint32"
390
- },
391
- {
392
- "internalType": "uint256",
393
- "name": "_amount",
394
- "type": "uint256"
395
- },
396
- {
397
- "internalType": "address",
398
- "name": "_weth9",
399
- "type": "address"
400
- }
401
- ],
402
- "name": "getTokensRaw",
403
- "outputs": [
404
- {
405
- "internalType": "uint256",
406
- "name": "",
407
- "type": "uint256"
408
- }
409
- ],
410
- "stateMutability": "view",
411
- "type": "function"
412
- },
413
- {
414
- "inputs": [
415
- {
416
- "internalType": "address",
417
- "name": "uniswapV3Pool",
418
- "type": "address"
419
- },
420
- {
421
- "internalType": "uint32",
422
- "name": "_intervalShort",
423
- "type": "uint32"
424
- },
425
- {
426
- "internalType": "uint32",
427
- "name": "_intervalLong",
428
- "type": "uint32"
429
- }
430
- ],
431
- "name": "getV3SqrtPrice",
432
- "outputs": [
433
- {
434
- "internalType": "uint160",
435
- "name": "sqrtPriceX96",
436
- "type": "uint160"
437
- }
438
- ],
439
- "stateMutability": "view",
440
- "type": "function"
441
- },
442
- {
443
- "inputs": [
444
- {
445
- "internalType": "address",
446
- "name": "uniswapV3Pool",
447
- "type": "address"
448
- },
449
- {
450
- "internalType": "uint32",
451
- "name": "_interval",
452
- "type": "uint32"
453
- }
454
- ],
455
- "name": "getV3SqrtPriceAvg",
456
- "outputs": [
457
- {
458
- "internalType": "uint160",
459
- "name": "sqrtPriceX96",
460
- "type": "uint160"
461
- }
462
- ],
463
- "stateMutability": "view",
464
- "type": "function"
465
- },
466
- {
467
- "inputs": [
468
- {
469
- "internalType": "address",
470
- "name": "uniswapV3Pool",
471
- "type": "address"
472
- },
473
- {
474
- "internalType": "uint32",
475
- "name": "_intervalShort",
476
- "type": "uint32"
477
- },
478
- {
479
- "internalType": "uint32",
480
- "name": "_intervalLong",
481
- "type": "uint32"
482
- }
483
- ],
484
- "name": "getV3SqrtPriceSimpleShift",
485
- "outputs": [
486
- {
487
- "internalType": "uint160",
488
- "name": "sqrtPriceX96",
489
- "type": "uint160"
490
- }
491
- ],
492
- "stateMutability": "view",
493
- "type": "function"
494
- },
495
- {
496
- "inputs": [],
497
- "name": "intervalLong",
498
- "outputs": [
499
- {
500
- "internalType": "uint32",
501
- "name": "",
502
- "type": "uint32"
503
- }
504
- ],
505
- "stateMutability": "view",
506
- "type": "function"
507
- },
508
- {
509
- "inputs": [],
510
- "name": "intervalShort",
511
- "outputs": [
512
- {
513
- "internalType": "uint32",
514
- "name": "",
515
- "type": "uint32"
516
- }
517
- ],
518
- "stateMutability": "view",
519
- "type": "function"
520
- },
521
- {
522
- "inputs": [
523
- {
524
- "internalType": "uint256",
525
- "name": "_threshold",
526
- "type": "uint256"
527
- },
528
- {
529
- "internalType": "address",
530
- "name": "_pool",
531
- "type": "address"
532
- },
533
- {
534
- "internalType": "uint32",
535
- "name": "_intervalShort",
536
- "type": "uint32"
537
- },
538
- {
539
- "internalType": "uint32",
540
- "name": "_intervalLong",
541
- "type": "uint32"
542
- },
543
- {
544
- "internalType": "address",
545
- "name": "_chainlinkFeed",
546
- "type": "address"
547
- },
548
- {
549
- "internalType": "address",
550
- "name": "_weth9",
551
- "type": "address"
552
- }
553
- ],
554
- "name": "isTokenBelowThreshold",
555
- "outputs": [
556
- {
557
- "internalType": "bool",
558
- "name": "",
559
- "type": "bool"
560
- }
561
- ],
562
- "stateMutability": "view",
563
- "type": "function"
564
- },
565
- {
566
- "inputs": [],
567
- "name": "owner",
568
- "outputs": [
569
- {
570
- "internalType": "address",
571
- "name": "",
572
- "type": "address"
573
- }
574
- ],
575
- "stateMutability": "view",
576
- "type": "function"
577
- },
578
- {
579
- "inputs": [],
580
- "name": "renounceOwnership",
581
- "outputs": [],
582
- "stateMutability": "nonpayable",
583
- "type": "function"
584
- },
585
- {
586
- "inputs": [
587
- {
588
- "internalType": "uint256",
589
- "name": "_flexFeeThreshold",
590
- "type": "uint256"
591
- }
592
- ],
593
- "name": "setFlexFeeThreshold",
594
- "outputs": [],
595
- "stateMutability": "nonpayable",
596
- "type": "function"
597
- },
598
- {
599
- "inputs": [
600
- {
601
- "internalType": "uint32",
602
- "name": "_interval",
603
- "type": "uint32"
604
- }
605
- ],
606
- "name": "setIntervalLong",
607
- "outputs": [],
608
- "stateMutability": "nonpayable",
609
- "type": "function"
610
- },
611
- {
612
- "inputs": [
613
- {
614
- "internalType": "uint32",
615
- "name": "_interval",
616
- "type": "uint32"
617
- }
618
- ],
619
- "name": "setIntervalShort",
620
- "outputs": [],
621
- "stateMutability": "nonpayable",
622
- "type": "function"
623
- },
624
- {
625
- "inputs": [
626
- {
627
- "internalType": "address",
628
- "name": "newOwner",
629
- "type": "address"
630
- }
631
- ],
632
- "name": "transferOwnership",
633
- "outputs": [],
634
- "stateMutability": "nonpayable",
635
- "type": "function"
636
- },
637
- {
638
- "inputs": [],
639
- "name": "weth9",
640
- "outputs": [
641
- {
642
- "internalType": "address",
643
- "name": "",
644
- "type": "address"
645
- }
646
- ],
647
- "stateMutability": "view",
648
- "type": "function"
649
- }
650
- ];
651
- /**
652
- * Oracle_json Contract Class
653
- *
654
- * Provides a class-based API similar to TypeChain for interacting with the contract.
655
- *
656
- * @example
657
- * ```typescript
658
- * import { createPublicClient, createWalletClient, http } from 'viem';
659
- * import { mainnet } from 'viem/chains';
660
- * import { Oracle_json } from 'Oracle_json';
661
- *
662
- * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
663
- * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
664
- *
665
- * const contract = new Oracle_json('0x...', { publicClient, walletClient });
666
- *
667
- * // Read functions
668
- * const result = await contract.balanceOf('0x...');
669
- *
670
- * // Write functions
671
- * const hash = await contract.transfer('0x...', 1000n);
672
- *
673
- * // Simulate transactions (dry-run)
674
- * const simulation = await contract.simulate.transfer('0x...', 1000n);
675
- * console.log('Gas estimate:', simulation.request.gas);
676
- *
677
- * // Watch events
678
- * const unwatch = contract.watch.Transfer((event) => {
679
- * console.log('Transfer event:', event);
680
- * });
681
- * ```
682
- */
683
- class Oracle_json {
684
- constructor(address, clients) {
685
- this.contractAddress = address;
686
- this.publicClient = clients.publicClient;
687
- this.contract = (0, viem_1.getContract)({
688
- address,
689
- abi: exports.Oracle_jsonAbi,
690
- client: {
691
- public: clients.publicClient,
692
- wallet: clients.walletClient,
693
- },
694
- });
695
- }
696
- /**
697
- * Get the contract address
698
- */
699
- get address() {
700
- return this.contractAddress;
701
- }
702
- /**
703
- * Get the underlying viem contract instance
704
- */
705
- getContract() {
706
- return this.contract;
707
- }
708
- /**
709
- * chainlinkPrice
710
- * view
711
- */
712
- async chainlinkPrice(_chainlinkFeed) {
713
- return this.contract.read.chainlinkPrice([_chainlinkFeed]);
714
- }
715
- /**
716
- * chainlinkUSDFeed
717
- * view
718
- */
719
- async chainlinkUSDFeed() {
720
- return this.contract.read.chainlinkUSDFeed();
721
- }
722
- /**
723
- * flexFeeThreshold
724
- * view
725
- */
726
- async flexFeeThreshold() {
727
- return this.contract.read.flexFeeThreshold();
728
- }
729
- /**
730
- * getCost
731
- * view
732
- */
733
- async getCost(_amount, _chainlinkFeed, _xftPool) {
734
- return this.contract.read.getCost([_amount, _chainlinkFeed, _xftPool]);
735
- }
736
- /**
737
- * getCostSimpleShift
738
- * view
739
- */
740
- async getCostSimpleShift(_amount, _chainlinkFeed, _xftPool, _tokenPool) {
741
- return this.contract.read.getCostSimpleShift([_amount, _chainlinkFeed, _xftPool, _tokenPool]);
742
- }
743
- /**
744
- * getFeeInTargetCurrency
745
- * view
746
- */
747
- async getFeeInTargetCurrency(_usdFee, _chainlinkFeed, _tokenPool) {
748
- return this.contract.read.getFeeInTargetCurrency([_usdFee, _chainlinkFeed, _tokenPool]);
749
- }
750
- /**
751
- * getTokensForAmount
752
- * view
753
- */
754
- async getTokensForAmount(_pool, _intervalShort, _intervalLong, _chainlinkFeed, _amount, _weth9) {
755
- return this.contract.read.getTokensForAmount([_pool, _intervalShort, _intervalLong, _chainlinkFeed, _amount, _weth9]);
756
- }
757
- /**
758
- * getTokensForAmountCeiling
759
- * view
760
- */
761
- async getTokensForAmountCeiling(_pool, _intervalShort, _intervalLong, _chainlinkFeed, _amount, _weth9) {
762
- return this.contract.read.getTokensForAmountCeiling([_pool, _intervalShort, _intervalLong, _chainlinkFeed, _amount, _weth9]);
763
- }
764
- /**
765
- * getTokensForAmountSimpleShift
766
- * view
767
- */
768
- async getTokensForAmountSimpleShift(_pool, _intervalShort, _intervalLong, _chainlinkFeed, _amount, _weth9) {
769
- return this.contract.read.getTokensForAmountSimpleShift([_pool, _intervalShort, _intervalLong, _chainlinkFeed, _amount, _weth9]);
770
- }
771
- /**
772
- * getTokensRaw
773
- * view
774
- */
775
- async getTokensRaw(_xftPool, _tokenPool, _intervalShort, _intervalLong, _amount, _weth9) {
776
- return this.contract.read.getTokensRaw([_xftPool, _tokenPool, _intervalShort, _intervalLong, _amount, _weth9]);
777
- }
778
- /**
779
- * getV3SqrtPrice
780
- * view
781
- */
782
- async getV3SqrtPrice(uniswapV3Pool, _intervalShort, _intervalLong) {
783
- return this.contract.read.getV3SqrtPrice([uniswapV3Pool, _intervalShort, _intervalLong]);
784
- }
785
- /**
786
- * getV3SqrtPriceAvg
787
- * view
788
- */
789
- async getV3SqrtPriceAvg(uniswapV3Pool, _interval) {
790
- return this.contract.read.getV3SqrtPriceAvg([uniswapV3Pool, _interval]);
791
- }
792
- /**
793
- * getV3SqrtPriceSimpleShift
794
- * view
795
- */
796
- async getV3SqrtPriceSimpleShift(uniswapV3Pool, _intervalShort, _intervalLong) {
797
- return this.contract.read.getV3SqrtPriceSimpleShift([uniswapV3Pool, _intervalShort, _intervalLong]);
798
- }
799
- /**
800
- * intervalLong
801
- * view
802
- */
803
- async intervalLong() {
804
- return this.contract.read.intervalLong();
805
- }
806
- /**
807
- * intervalShort
808
- * view
809
- */
810
- async intervalShort() {
811
- return this.contract.read.intervalShort();
812
- }
813
- /**
814
- * isTokenBelowThreshold
815
- * view
816
- */
817
- async isTokenBelowThreshold(_threshold, _pool, _intervalShort, _intervalLong, _chainlinkFeed, _weth9) {
818
- return this.contract.read.isTokenBelowThreshold([_threshold, _pool, _intervalShort, _intervalLong, _chainlinkFeed, _weth9]);
819
- }
820
- /**
821
- * owner
822
- * view
823
- */
824
- async owner() {
825
- return this.contract.read.owner();
826
- }
827
- /**
828
- * weth9
829
- * view
830
- */
831
- async weth9() {
832
- return this.contract.read.weth9();
833
- }
834
- /**
835
- * renounceOwnership
836
- * nonpayable
837
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
838
- */
839
- async renounceOwnership(options) {
840
- if (!this.contract.write) {
841
- throw new Error('Wallet client is required for write operations');
842
- }
843
- return this.contract.write.renounceOwnership(options);
844
- }
845
- /**
846
- * setFlexFeeThreshold
847
- * nonpayable
848
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
849
- */
850
- async setFlexFeeThreshold(_flexFeeThreshold, options) {
851
- if (!this.contract.write) {
852
- throw new Error('Wallet client is required for write operations');
853
- }
854
- return this.contract.write.setFlexFeeThreshold([_flexFeeThreshold], options);
855
- }
856
- /**
857
- * setIntervalLong
858
- * nonpayable
859
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
860
- */
861
- async setIntervalLong(_interval, options) {
862
- if (!this.contract.write) {
863
- throw new Error('Wallet client is required for write operations');
864
- }
865
- return this.contract.write.setIntervalLong([_interval], options);
866
- }
867
- /**
868
- * setIntervalShort
869
- * nonpayable
870
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
871
- */
872
- async setIntervalShort(_interval, options) {
873
- if (!this.contract.write) {
874
- throw new Error('Wallet client is required for write operations');
875
- }
876
- return this.contract.write.setIntervalShort([_interval], options);
877
- }
878
- /**
879
- * transferOwnership
880
- * nonpayable
881
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
882
- */
883
- async transferOwnership(newOwner, options) {
884
- if (!this.contract.write) {
885
- throw new Error('Wallet client is required for write operations');
886
- }
887
- return this.contract.write.transferOwnership([newOwner], options);
888
- }
889
- /**
890
- * Simulate contract write operations (dry-run without sending transaction)
891
- *
892
- * @example
893
- * const result = await contract.simulate.transfer('0x...', 1000n);
894
- * console.log('Gas estimate:', result.request.gas);
895
- * console.log('Would succeed:', result.result);
896
- */
897
- get simulate() {
898
- const contract = this.contract;
899
- if (!contract.simulate) {
900
- throw new Error('Public client is required for simulation');
901
- }
902
- return {
903
- /**
904
- * Simulate renounceOwnership
905
- * Returns gas estimate and result without sending transaction
906
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
907
- */
908
- async renounceOwnership(options) {
909
- return contract.simulate.renounceOwnership(options);
910
- },
911
- /**
912
- * Simulate setFlexFeeThreshold
913
- * Returns gas estimate and result without sending transaction
914
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
915
- */
916
- async setFlexFeeThreshold(_flexFeeThreshold, options) {
917
- return contract.simulate.setFlexFeeThreshold([_flexFeeThreshold], options);
918
- },
919
- /**
920
- * Simulate setIntervalLong
921
- * Returns gas estimate and result without sending transaction
922
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
923
- */
924
- async setIntervalLong(_interval, options) {
925
- return contract.simulate.setIntervalLong([_interval], options);
926
- },
927
- /**
928
- * Simulate setIntervalShort
929
- * Returns gas estimate and result without sending transaction
930
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
931
- */
932
- async setIntervalShort(_interval, options) {
933
- return contract.simulate.setIntervalShort([_interval], options);
934
- },
935
- /**
936
- * Simulate transferOwnership
937
- * Returns gas estimate and result without sending transaction
938
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
939
- */
940
- async transferOwnership(newOwner, options) {
941
- return contract.simulate.transferOwnership([newOwner], options);
942
- }
943
- };
944
- }
945
- /**
946
- * Watch contract events
947
- *
948
- * @example
949
- * // Watch all Transfer events
950
- * const unwatch = contract.watch.Transfer((event) => {
951
- * console.log('Transfer:', event);
952
- * });
953
- *
954
- * // Stop watching
955
- * unwatch();
956
- */
957
- get watch() {
958
- return {
959
- /**
960
- * Watch FlexFeeThreshold events
961
- * @param callback Function to call when event is emitted
962
- * @param filter Optional filter for indexed parameters
963
- * @returns Unwatch function to stop listening
964
- */
965
- FlexFeeThreshold: (callback) => {
966
- return this.publicClient.watchContractEvent({
967
- address: this.contractAddress,
968
- abi: exports.Oracle_jsonAbi,
969
- eventName: 'FlexFeeThreshold',
970
- onLogs: (logs) => {
971
- logs.forEach((log) => {
972
- callback(log.args);
973
- });
974
- },
975
- });
976
- },
977
- /**
978
- * Watch IntervalLong events
979
- * @param callback Function to call when event is emitted
980
- * @param filter Optional filter for indexed parameters
981
- * @returns Unwatch function to stop listening
982
- */
983
- IntervalLong: (callback) => {
984
- return this.publicClient.watchContractEvent({
985
- address: this.contractAddress,
986
- abi: exports.Oracle_jsonAbi,
987
- eventName: 'IntervalLong',
988
- onLogs: (logs) => {
989
- logs.forEach((log) => {
990
- callback(log.args);
991
- });
992
- },
993
- });
994
- },
995
- /**
996
- * Watch IntervalShort events
997
- * @param callback Function to call when event is emitted
998
- * @param filter Optional filter for indexed parameters
999
- * @returns Unwatch function to stop listening
1000
- */
1001
- IntervalShort: (callback) => {
1002
- return this.publicClient.watchContractEvent({
1003
- address: this.contractAddress,
1004
- abi: exports.Oracle_jsonAbi,
1005
- eventName: 'IntervalShort',
1006
- onLogs: (logs) => {
1007
- logs.forEach((log) => {
1008
- callback(log.args);
1009
- });
1010
- },
1011
- });
1012
- },
1013
- /**
1014
- * Watch OwnershipTransferred events
1015
- * @param callback Function to call when event is emitted
1016
- * @param filter Optional filter for indexed parameters
1017
- * @returns Unwatch function to stop listening
1018
- */
1019
- OwnershipTransferred: (callback, filter) => {
1020
- return this.publicClient.watchContractEvent({
1021
- address: this.contractAddress,
1022
- abi: exports.Oracle_jsonAbi,
1023
- eventName: 'OwnershipTransferred',
1024
- args: filter,
1025
- onLogs: (logs) => {
1026
- logs.forEach((log) => {
1027
- callback(log.args);
1028
- });
1029
- },
1030
- });
1031
- }
1032
- };
1033
- }
1034
- }
1035
- exports.Oracle_json = Oracle_json;