@wireio/stake 0.7.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,34 +54,67 @@ export const ERC1155Abi = ERC1155Artifact.abi;
54
54
 
55
55
  // Make sure ContractName in ./types includes all of these keys.
56
56
  export const ADDRESSES: AddressBook = {
57
+ /**
58
+ * MAINNET LATEST
59
+ * 1/23/26
60
+ */
61
+ LiqEthAuthority: "0xB8fb7dBA2de501c94EAB723fa48679f698a39Aa4",
62
+ BeaconState: "0x29719E8e76C52F5fD4888DF401579859c305f2DF",
63
+ WithdrawalQueue: "0xce388339bFDAed9cAF536ea7b4F42123b4D755d4",
64
+ LiqEthToken: "0x2C0e75e930Fc72ceD0725854C5E7A55566333F3f",
65
+ Accounting: "0xE31C44d04c7B055afAC9301F55840f030eaF04BC",
66
+ DepositManager: "0x21b339ED55A0f037f91B88044C808CcfCCBbF9A8",
67
+ WithdrawalVault: "0x028743bE7E727aA331A1e952575cb00623B95fE2",
68
+ StakingModule: "0xDe9754Fb58CcD4D74e94DA5682192E4e6eC334b0",
69
+ YieldOracle: "0x7B7B8894e75b44B6cA7Dc8bE6dED5059621907b2",
70
+
71
+ OutpostManagerAuthority: "0xeaE32b94c0F858b3600861aAE4Caeee6B6341751",
72
+ iodata: "0x485Ed153c45189d623Bb37816eD3016A56552273",
73
+ Base58: "0x8bB3856EC1114B1cE45a78620CF174D90a1Fd4e7",
74
+ sysio_merkle: "0x5180a926D71c6d94c5c939Fe7Fed14cD7dcAa541",
75
+ ReceiptNFT: "0x651De616A20b17De1095f9A0694A0e0E68025b78",
76
+ EthUsdPriceConsumer: "0x2d866f8DB6F6c94997b0027Ba24bc64a03627ddc",
77
+ Pool: "0xDA268Adcb90c422C2102A5f713182A42A8b9EA0D",
78
+ OutpostManager: "0x9f279804Cb8539c53709AA37a4C1b30A52A85175",
79
+ sysio_write: "0x3F8c880efd2c8C3aA1f0CE40b886cc6913eEC1d3",
80
+ Pretoken: "0xCabF19Fdb7cD063738dd63a418702Ee3642FFc68",
81
+ BAR: "0x2D8f4D4435509d7b8F93C3Ba93D45447C892f7ED",
82
+ OPPCommon: "0x1716EEC9f1E0c1aF7BbbA8Fed10652138914f766",
83
+ OPP: "0x5e1135cF8987268a3e7F68551558Ae92c454429f",
84
+ Depositor: "0xf4b4ccfD684feB46504D77232FBde23b23d4F774",
85
+ OPPInbound: "0x088484d45fF93AFabC63810FB0b335792E2B24f3"
86
+
87
+ /**
88
+ * HOODI TESTNET LATEST
89
+ * 1/23/26
90
+ */
57
91
  // LiqETH contracts
58
- LiqEthAuthority: "0x3Eb66Bb91F7a022FbABc1619Cb6acce7025Bc41F",
59
- BeaconState: "0x08F879c6D0964E0A17bF688Af23168f654DF372e",
60
- WithdrawalQueue: "0x74aDeD940369baDDb0F36426F23B08499e45Fe18",
61
- LiqEthToken: "0x8C974517D038e2e3b8a1da7b1A026bC8132A4b2e",
62
- Accounting: "0x766CE996B8132b927988c5b2ECAE8108fB1a9307",
63
- DepositManager: "0xEd391dB5DB11B5eDBE08e69A51D16e84293C09a3",
64
- WithdrawalVault: "0xbaBc0D5997283ab9886696A0dEaB8A8093436b48",
65
- StakingModule: "0x4998fBb6Ca5Ee3Db6c339e2962A34791Af643fEa",
66
- YieldOracle: "0x61Fe311C57dd9a38Fb7B0c5A8ec521452dB25378",
67
-
68
- //Outpost contracts
69
- OutpostManagerAuthority: "0x3B8705Ba1195AF632b3bd9E46F19348BC828FA3D",
70
- iodata: "0x4aCABbC74a1cA9B0058d9ADAa0E00Af0f4f73212",
71
- Base58: "0x1241F36ff30065deD52d51f0d6524EF971259A12",
72
- sysio_merkle: "0x58ca9b5515266Fd6bF94D5F1268C505b2eC9679c",
73
- ReceiptNFT: "0x03d6bD46cA9F54B8F8bbA21CfAfe717b36cB8593",
74
- EthUsdPriceConsumer: "0xdC2DD993A13b3DD6D255B52285625694bd967c9A",
75
- Pool: "0xd4742757AA61B1Fd3Fcd87980D7D460B12Cd9275",
76
- OutpostManager: "0x38ec2B56cBCeCaFFe28b535517de1a102C3D74E3",
77
- sysio_write: "0x0Ec4C1BaB772958aa3Db27459643bfbE7d92E305",
78
- Pretoken: "0x8c97a51A71640fa411DEfab8feC3401eFfd1a2E4",
79
- BAR: "0xbAFac13ffd3Aa9aEabaaeb6e4C2cF3dFf3479DC0",
80
- OPPCommon: "0x12283a6d4E6cE4A0e8AdB319Fc161c7F4f91EA8F",
81
- OPP: "0x87CE3Fe2CDca39C04aa2c14bbF1E1d9DB6358C4A",
82
- Depositor: "0x5351B30EA4b75bD9be9Fc0048e88F675f7b3Ac2b",
83
- OPPInbound: "0x0B1f7FB1c7f01A9cf490a1387E1E100F2bEA6C6d",
84
- MockAggregator: "0xFCfc3ddd4CBd9Ad3b3af3A374B8bdA1b66eE6FFF",
92
+ // LiqEthAuthority: "0x3Eb66Bb91F7a022FbABc1619Cb6acce7025Bc41F",
93
+ // BeaconState: "0x08F879c6D0964E0A17bF688Af23168f654DF372e",
94
+ // WithdrawalQueue: "0x74aDeD940369baDDb0F36426F23B08499e45Fe18",
95
+ // LiqEthToken: "0x8C974517D038e2e3b8a1da7b1A026bC8132A4b2e",
96
+ // Accounting: "0x766CE996B8132b927988c5b2ECAE8108fB1a9307",
97
+ // DepositManager: "0xEd391dB5DB11B5eDBE08e69A51D16e84293C09a3",
98
+ // WithdrawalVault: "0xbaBc0D5997283ab9886696A0dEaB8A8093436b48",
99
+ // StakingModule: "0x4998fBb6Ca5Ee3Db6c339e2962A34791Af643fEa",
100
+ // YieldOracle: "0x61Fe311C57dd9a38Fb7B0c5A8ec521452dB25378",
101
+ // //Outpost contracts
102
+ // OutpostManagerAuthority: "0x3B8705Ba1195AF632b3bd9E46F19348BC828FA3D",
103
+ // iodata: "0x4aCABbC74a1cA9B0058d9ADAa0E00Af0f4f73212",
104
+ // Base58: "0x1241F36ff30065deD52d51f0d6524EF971259A12",
105
+ // sysio_merkle: "0x58ca9b5515266Fd6bF94D5F1268C505b2eC9679c",
106
+ // ReceiptNFT: "0x03d6bD46cA9F54B8F8bbA21CfAfe717b36cB8593",
107
+ // EthUsdPriceConsumer: "0xdC2DD993A13b3DD6D255B52285625694bd967c9A",
108
+ // Pool: "0xd4742757AA61B1Fd3Fcd87980D7D460B12Cd9275",
109
+ // OutpostManager: "0x38ec2B56cBCeCaFFe28b535517de1a102C3D74E3",
110
+ // sysio_write: "0x0Ec4C1BaB772958aa3Db27459643bfbE7d92E305",
111
+ // Pretoken: "0x8c97a51A71640fa411DEfab8feC3401eFfd1a2E4",
112
+ // BAR: "0xbAFac13ffd3Aa9aEabaaeb6e4C2cF3dFf3479DC0",
113
+ // OPPCommon: "0x12283a6d4E6cE4A0e8AdB319Fc161c7F4f91EA8F",
114
+ // OPP: "0x87CE3Fe2CDca39C04aa2c14bbF1E1d9DB6358C4A",
115
+ // Depositor: "0x5351B30EA4b75bD9be9Fc0048e88F675f7b3Ac2b",
116
+ // OPPInbound: "0x0B1f7FB1c7f01A9cf490a1387E1E100F2bEA6C6d",
117
+ // MockAggregator: "0xFCfc3ddd4CBd9Ad3b3af3A374B8bdA1b66eE6FFF",
85
118
  };
86
119
 
87
120
  export type Contracts<T extends string = ContractName> = Record<T, ContractConfig>;
@@ -155,10 +188,6 @@ export const CONTRACTS: Contracts<ContractName> = {
155
188
  address: ADDRESSES.ReceiptNFT,
156
189
  abi: ReceiptNFTArtifact.abi as JsonFragment[],
157
190
  },
158
- MockAggregator: {
159
- address: ADDRESSES.MockAggregator,
160
- abi: AggregatorArtifact.abi as JsonFragment[],
161
- },
162
191
  Pool: {
163
192
  address: ADDRESSES.Pool,
164
193
  abi: PoolArtifact.abi as JsonFragment[],
@@ -199,8 +228,14 @@ export const CONTRACTS: Contracts<ContractName> = {
199
228
  address: ADDRESSES.Depositor,
200
229
  abi: DepositorArtifact.abi as JsonFragment[],
201
230
  },
231
+
232
+ // MockAggregator: {
233
+ // address: ADDRESSES.MockAggregator,
234
+ // abi: AggregatorArtifact.abi as JsonFragment[],
235
+ // },
202
236
  };
203
237
 
238
+
204
239
  export interface ContractOptions {
205
240
  /** RPC endpoint or injected EIP-1193 provider */
206
241
  provider?: ethers.providers.Provider;
@@ -142,10 +142,10 @@ export class EthereumStakingClient implements IStakingClient {
142
142
  const buyer = await this.signer!.getAddress();
143
143
 
144
144
  // ! Hoodi only - check if the mock aggregator price is stale, and if so, update it before submitting the buy request
145
- const network = await this.provider.getNetwork();
146
- const chainId = network.chainId;
147
- const allowedTestChains = new Set([560048]);
148
- if (allowedTestChains.has(chainId)) await this.updateMockAggregatorPrice();
145
+ // const network = await this.provider.getNetwork();
146
+ // const chainId = network.chainId;
147
+ // const allowedTestChains = new Set([560048]);
148
+ // if (allowedTestChains.has(chainId)) await this.updateMockAggregatorPrice();
149
149
 
150
150
  let result = await this.pretokenClient.purchasePretokensWithLiqETH(amount, buyer);
151
151
  return result && result.txHash ? result.txHash : "Error - no resulting txHash";
@@ -339,7 +339,7 @@ export class EthereumStakingClient implements IStakingClient {
339
339
  windowAfter?: number;
340
340
  }): Promise<TrancheSnapshot> {
341
341
  const {
342
- chainID = EvmChainID.Hoodi,
342
+ chainID = EvmChainID.Ethereum,
343
343
  windowBefore,
344
344
  windowAfter,
345
345
  } = options ?? {};
@@ -370,14 +370,14 @@ export class EthereumStakingClient implements IStakingClient {
370
370
 
371
371
 
372
372
  // fetch price and timestamp from aggregator
373
- const [roundId, answer, startedAt, updatedAt, answeredInRound] = await this.contract.MockAggregator.latestRoundData();
373
+ // const [roundId, answer, startedAt, updatedAt, answeredInRound] = await this.contract.MockAggregator.latestRoundData();
374
374
  //originally fetched ethPrice from aggregator - pulling from EthUsdPriceConsumer instead - this is where the actual price gets pulled from when purchasing pretokens.
375
375
  // let ethPriceUsd: bigint = BigInt(answer.toString());)
376
376
 
377
377
  let ethPriceUsdBn = await this.contract.EthUsdPriceConsumer.getPrice18Decimals();
378
378
  let ethPriceUsd: bigint = BigInt(ethPriceUsdBn.toString()) / BigInt(1e10);
379
379
 
380
- let nativePriceTimestamp: number = Number(updatedAt);
380
+ // let nativePriceTimestamp: number = Number(updatedAt);
381
381
 
382
382
  const initialTrancheSupply = BigInt(INITIAL_TRANCHE_SUPPLY) * BigInt(1e8);
383
383
 
@@ -396,7 +396,7 @@ export class EthereumStakingClient implements IStakingClient {
396
396
  maxPriceUsd,
397
397
 
398
398
  ethPriceUsd,
399
- nativePriceTimestamp,
399
+ // nativePriceTimestamp,
400
400
  ladderWindowBefore: windowBefore,
401
401
  ladderWindowAfter: windowAfter,
402
402
  });
@@ -482,49 +482,49 @@ export class EthereumStakingClient implements IStakingClient {
482
482
  // ---------------------------------------------------------------------
483
483
 
484
484
  // ! This is a temporary measure for Hoodi testnet because there is no aggregator deployed
485
- private async updateMockAggregatorPrice() {
486
- const aggregator = this.contract.MockAggregator;
487
-
488
- // read latest round & compute age
489
- const [roundId, answer, startedAt, updatedAt, answeredInRound] = await aggregator.latestRoundData();
490
- const now = (await this.provider.getBlock("latest")).timestamp;
491
- const ageSec = Number(now) - Number(updatedAt);
492
-
493
- const ONE_HOUR = 1 * 3600;
494
- // const ONE_HOUR = 10;
495
- if (ageSec > ONE_HOUR) {
496
- // safety check - only run in non-production contexts
497
- const network = await this.provider.getNetwork();
498
- const chainId = network.chainId;
499
- const allowedTestChains = new Set([560048]);
500
- if (!allowedTestChains.has(chainId)) {
501
- console.warn(`MockAggregator is stale (${ageSec}s) but chainId ${chainId} is not a test/local network — skipping update.`);
502
- return;
503
- }
504
-
505
-
506
- //fetch the current ETH / USD price
507
- const res = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd');
508
- const data = await res.json();
509
- const ethUsd = data.ethereum.usd;
510
-
511
- const currentEthPrice = ethers.utils.parseUnits(ethUsd.toString(), 8);
512
-
513
- try {
514
- //update to be intentionally stale
515
- // const alttx = await aggregator.updateStale(currentEthPrice, now - 7200);
516
- // const altreceipt = await alttx.wait(1);
517
- // console.log('stale update receipt', altreceipt)
518
-
519
- //update answer with current timestamp
520
- const tx = await aggregator.updateAnswer(currentEthPrice);
521
- const txreceipt = await tx.wait(1);
522
- // console.log('MockAggregator answer updated - receipt:', txreceipt)
523
- } catch (err: any) {
524
- console.error('MockAggregator updateAnswer failed', err?.message || err);
525
- }
526
- } else {
527
- console.log(`MockAggregator updated ${ageSec}s ago — no update needed`);
528
- }
529
- }
485
+ // private async updateMockAggregatorPrice() {
486
+ // const aggregator = this.contract.MockAggregator;
487
+
488
+ // // read latest round & compute age
489
+ // const [roundId, answer, startedAt, updatedAt, answeredInRound] = await aggregator.latestRoundData();
490
+ // const now = (await this.provider.getBlock("latest")).timestamp;
491
+ // const ageSec = Number(now) - Number(updatedAt);
492
+
493
+ // const ONE_HOUR = 1 * 3600;
494
+ // // const ONE_HOUR = 10;
495
+ // if (ageSec > ONE_HOUR) {
496
+ // // safety check - only run in non-production contexts
497
+ // const network = await this.provider.getNetwork();
498
+ // const chainId = network.chainId;
499
+ // const allowedTestChains = new Set([560048]);
500
+ // if (!allowedTestChains.has(chainId)) {
501
+ // console.warn(`MockAggregator is stale (${ageSec}s) but chainId ${chainId} is not a test/local network — skipping update.`);
502
+ // return;
503
+ // }
504
+
505
+
506
+ // //fetch the current ETH / USD price
507
+ // const res = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd');
508
+ // const data = await res.json();
509
+ // const ethUsd = data.ethereum.usd;
510
+
511
+ // const currentEthPrice = ethers.utils.parseUnits(ethUsd.toString(), 8);
512
+
513
+ // try {
514
+ // //update to be intentionally stale
515
+ // // const alttx = await aggregator.updateStale(currentEthPrice, now - 7200);
516
+ // // const altreceipt = await alttx.wait(1);
517
+ // // console.log('stale update receipt', altreceipt)
518
+
519
+ // //update answer with current timestamp
520
+ // const tx = await aggregator.updateAnswer(currentEthPrice);
521
+ // const txreceipt = await tx.wait(1);
522
+ // // console.log('MockAggregator answer updated - receipt:', txreceipt)
523
+ // } catch (err: any) {
524
+ // console.error('MockAggregator updateAnswer failed', err?.message || err);
525
+ // }
526
+ // } else {
527
+ // console.log(`MockAggregator updated ${ageSec}s ago — no update needed`);
528
+ // }
529
+ // }
530
530
  }
@@ -19,7 +19,6 @@ export const CONTRACT_NAMES = [
19
19
  "Base58",
20
20
  "sysio_merkle",
21
21
  "ReceiptNFT",
22
- "MockAggregator",
23
22
  "Pool",
24
23
  "OutpostManager",
25
24
  "sysio_write",
@@ -30,7 +29,7 @@ export const CONTRACT_NAMES = [
30
29
  "Pretoken",
31
30
  "OPPInbound",
32
31
  "Depositor",
33
-
32
+ // "MockAggregator",
34
33
  ] as const;
35
34
 
36
35
  export type ContractName = typeof CONTRACT_NAMES[number];
@@ -355,7 +355,7 @@ export const deriveEphemeralStakeAddress = async (
355
355
  * Constant keys (Chainlink)
356
356
  */
357
357
  export const CHAINLINK_FEED = new PublicKey(
358
- '99B2bTijsU6f1GCT73HmdR7HCFFjGMBcPZY6jZ96ynrR',
358
+ 'CH31Xns5z3M1cTAbKW34jcxPPciazARpijcHj9rxtemt',
359
359
  );
360
360
  export const CHAINLINK_PROGRAM = new PublicKey(
361
361
  'HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny',