@wireio/stake 0.1.3 → 0.2.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 (135) hide show
  1. package/lib/stake.browser.js +15333 -4964
  2. package/lib/stake.browser.js.map +1 -1
  3. package/lib/stake.d.ts +4880 -112
  4. package/lib/stake.js +15636 -5116
  5. package/lib/stake.js.map +1 -1
  6. package/lib/stake.m.js +15333 -4964
  7. package/lib/stake.m.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.dbg.json +1 -1
  10. package/src/assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.json +26 -65
  11. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IAccounting.dbg.json +1 -1
  12. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IAccounting.json +24 -20
  13. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositContract.dbg.json +1 -1
  14. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositManager.dbg.json +1 -1
  15. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IRewardsERC20.dbg.json +1 -1
  16. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IStakingModule.dbg.json +1 -1
  17. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IStakingModule.json +0 -20
  18. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.dbg.json +1 -1
  19. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IWithdrawalRecord.dbg.json +1 -1
  20. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/LiqEthCommon.dbg.json +1 -1
  21. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/LiqEthCommon.json +2 -2
  22. package/src/assets/ethereum/ABI/liqEth/RewardsERC20.sol/RewardsERC20.dbg.json +1 -1
  23. package/src/assets/ethereum/ABI/liqEth/RewardsERC20Pausable.sol/RewardsERC20Pausable.dbg.json +1 -1
  24. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/BeaconRoots.dbg.json +1 -1
  25. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZ.dbg.json +1 -1
  26. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/ValidatorBalanceVerifier.dbg.json +1 -1
  27. package/src/assets/ethereum/ABI/liqEth/Yield.sol/BeaconRoots.dbg.json +1 -1
  28. package/src/assets/ethereum/ABI/liqEth/Yield.sol/BeaconRoots.json +2 -2
  29. package/src/assets/ethereum/ABI/liqEth/Yield.sol/SSZ.dbg.json +1 -1
  30. package/src/assets/ethereum/ABI/liqEth/Yield.sol/SSZ.json +2 -2
  31. package/src/assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.dbg.json +1 -1
  32. package/src/assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.json +2 -2
  33. package/src/assets/ethereum/ABI/liqEth/accounting.sol/Accounting.dbg.json +1 -1
  34. package/src/assets/ethereum/ABI/liqEth/accounting.sol/Accounting.json +31 -109
  35. package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.dbg.json +1 -1
  36. package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.json +2 -25
  37. package/src/assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.dbg.json +1 -1
  38. package/src/assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.json +30 -72
  39. package/src/assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.dbg.json +1 -1
  40. package/src/assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.json +2 -2
  41. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/Uint64BE.dbg.json +1 -1
  42. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/Uint64BE.json +2 -2
  43. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.dbg.json +1 -1
  44. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.json +2 -2
  45. package/src/assets/ethereum/ABI/outpost/BAR.sol/BAR.dbg.json +4 -0
  46. package/src/assets/ethereum/ABI/outpost/BAR.sol/BAR.json +1856 -0
  47. package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.dbg.json +4 -0
  48. package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.json +1753 -0
  49. package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.dbg.json +4 -0
  50. package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.json +122 -0
  51. package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.dbg.json +4 -0
  52. package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.json +601 -0
  53. package/src/assets/ethereum/ABI/outpost/OPP.sol/OPP.dbg.json +4 -0
  54. package/src/assets/ethereum/ABI/outpost/OPP.sol/OPP.json +930 -0
  55. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPP.dbg.json +4 -0
  56. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPP.json +88 -0
  57. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPEndpoint.dbg.json +4 -0
  58. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPEndpoint.json +29 -0
  59. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPInbound.dbg.json +4 -0
  60. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPInbound.json +194 -0
  61. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPReceiver.dbg.json +4 -0
  62. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPReceiver.json +29 -0
  63. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPSender.dbg.json +4 -0
  64. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPSender.json +36 -0
  65. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/OPPCommon.dbg.json +4 -0
  66. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/OPPCommon.json +199 -0
  67. package/src/assets/ethereum/ABI/outpost/OPPEndpoint.sol/OPPEndpoint.dbg.json +4 -0
  68. package/src/assets/ethereum/ABI/outpost/OPPEndpoint.sol/OPPEndpoint.json +273 -0
  69. package/src/assets/ethereum/ABI/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.dbg.json +4 -0
  70. package/src/assets/ethereum/ABI/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.json +394 -0
  71. package/src/assets/ethereum/ABI/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.dbg.json +4 -0
  72. package/src/assets/ethereum/ABI/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.json +378 -0
  73. package/src/assets/ethereum/ABI/outpost/OPPErrors.sol/OPPErrors.dbg.json +4 -0
  74. package/src/assets/ethereum/ABI/outpost/OPPErrors.sol/OPPErrors.json +224 -0
  75. package/src/assets/ethereum/ABI/outpost/OPPInbound.sol/OPPInbound.dbg.json +4 -0
  76. package/src/assets/ethereum/ABI/outpost/OPPInbound.sol/OPPInbound.json +1010 -0
  77. package/src/assets/ethereum/ABI/outpost/OPPReceiver.sol/OPPReceiver.dbg.json +4 -0
  78. package/src/assets/ethereum/ABI/outpost/OPPReceiver.sol/OPPReceiver.json +291 -0
  79. package/src/assets/ethereum/ABI/outpost/OPPSender.sol/OPPSender.dbg.json +4 -0
  80. package/src/assets/ethereum/ABI/outpost/OPPSender.sol/OPPSender.json +298 -0
  81. package/src/assets/ethereum/ABI/outpost/OutpostErrors.sol/OutpostErrors.dbg.json +4 -0
  82. package/src/assets/ethereum/ABI/outpost/OutpostErrors.sol/OutpostErrors.json +473 -0
  83. package/src/assets/ethereum/ABI/outpost/OutpostManaged.sol/OutpostManaged.dbg.json +4 -0
  84. package/src/assets/ethereum/ABI/outpost/OutpostManaged.sol/OutpostManaged.json +229 -0
  85. package/src/assets/ethereum/ABI/outpost/OutpostManager.sol/OutpostManager.dbg.json +4 -0
  86. package/src/assets/ethereum/ABI/outpost/OutpostManager.sol/OutpostManager.json +730 -0
  87. package/src/assets/ethereum/ABI/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.dbg.json +4 -0
  88. package/src/assets/ethereum/ABI/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.json +1432 -0
  89. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostManager.dbg.json +4 -0
  90. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostManager.json +130 -0
  91. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.dbg.json +4 -0
  92. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.json +29 -0
  93. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.dbg.json +4 -0
  94. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.json +141 -0
  95. package/src/assets/ethereum/ABI/outpost/OutpostOwnable.sol/OutpostOwnable.dbg.json +4 -0
  96. package/src/assets/ethereum/ABI/outpost/OutpostOwnable.sol/OutpostOwnable.json +213 -0
  97. package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.dbg.json +4 -0
  98. package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.json +921 -0
  99. package/src/assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.dbg.json +4 -0
  100. package/src/assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.json +2020 -0
  101. package/src/assets/ethereum/ABI/outpost/Warrant.sol/Warrant.dbg.json +4 -0
  102. package/src/assets/ethereum/ABI/outpost/Warrant.sol/Warrant.json +1650 -0
  103. package/src/assets/ethereum/ABI/outpost/interfaces/IWarrant.sol/IWarrant.dbg.json +4 -0
  104. package/src/assets/ethereum/ABI/{liqEth/LiqEthCommon.sol/ILiqEthMint.json → outpost/interfaces/IWarrant.sol/IWarrant.json} +6 -12
  105. package/src/assets/ethereum/ABI/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.dbg.json +4 -0
  106. package/src/assets/ethereum/ABI/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.json +858 -0
  107. package/src/assets/ethereum/ABI/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.dbg.json +4 -0
  108. package/src/assets/ethereum/ABI/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.json +30 -0
  109. package/src/assets/solana/idl/liqsol_core.json +1369 -1129
  110. package/src/assets/solana/idl/liqsol_token.json +1 -1
  111. package/src/assets/solana/idl/validator_leaderboard.json +1 -1
  112. package/src/assets/solana/types/liqsol_core.ts +1369 -1129
  113. package/src/assets/solana/types/liqsol_token.ts +1 -1
  114. package/src/assets/solana/types/validator_leaderboard.ts +1 -1
  115. package/src/index.ts +2 -1
  116. package/src/networks/ethereum/clients/deposit.client.ts +82 -0
  117. package/src/networks/ethereum/clients/stake.client.ts +215 -0
  118. package/src/networks/ethereum/contract.ts +82 -23
  119. package/src/networks/ethereum/ethereum.ts +148 -69
  120. package/src/networks/ethereum/types.ts +74 -7
  121. package/src/networks/solana/clients/deposit.client.ts +7 -11
  122. package/src/networks/solana/clients/distribution.client.ts +1 -3
  123. package/src/networks/solana/clients/outpost.client.ts +474 -0
  124. package/src/networks/solana/constants.ts +90 -52
  125. package/src/networks/solana/solana.ts +155 -128
  126. package/src/networks/solana/types.ts +95 -8
  127. package/src/networks/solana/utils.ts +111 -94
  128. package/src/staker/types.ts +7 -5
  129. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthBurn.dbg.json +0 -4
  130. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthBurn.json +0 -24
  131. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthMint.dbg.json +0 -4
  132. package/src/assets/ethereum/ABI/liqEth/liqEthBurn.sol/LiqEthBurn.dbg.json +0 -4
  133. package/src/assets/ethereum/ABI/liqEth/liqEthBurn.sol/LiqEthBurn.json +0 -391
  134. package/src/assets/ethereum/ABI/liqEth/liqEthMint.sol/LiqEthMint.dbg.json +0 -4
  135. package/src/assets/ethereum/ABI/liqEth/liqEthMint.sol/LiqEthMint.json +0 -402
@@ -5,7 +5,7 @@
5
5
  * IDL can be found at `target/idl/liqsol_token.json`.
6
6
  */
7
7
  export type LiqsolToken = {
8
- "address": "AY6sWK1dt23rkAiqiETwaEcbjhJCwb5cNC6hVWadZLFf",
8
+ "address": "HEAKvfg2X7K4zbGDiAbfuu5abxQyk1HbKVgskZZFXrUx",
9
9
  "metadata": {
10
10
  "name": "liqsolToken",
11
11
  "version": "0.1.0",
@@ -5,7 +5,7 @@
5
5
  * IDL can be found at `target/idl/validator_leaderboard.json`.
6
6
  */
7
7
  export type ValidatorLeaderboard = {
8
- "address": "5Nf6jL5B2qkMbnLoN3RTT1sKcBKrrsRnovTBDZXcQnfo",
8
+ "address": "BcMW7wN54FexYaB7Xujvag5uUQ1WoDoGbzVg1VEXPBhV",
9
9
  "metadata": {
10
10
  "name": "validatorLeaderboard",
11
11
  "version": "0.1.0",
package/src/index.ts CHANGED
@@ -15,4 +15,5 @@ export * from './networks/solana/utils';
15
15
  // CLIENTS
16
16
  export * from './networks/solana/clients/deposit.client';
17
17
  export * from './networks/solana/clients/distribution.client';
18
- export * from './networks/solana/clients/leaderboard.client';
18
+ export * from './networks/solana/clients/leaderboard.client';
19
+ export * from './networks/solana/clients/outpost.client';
@@ -0,0 +1,82 @@
1
+ import { BigNumber, ethers } from "ethers";
2
+ import { DepositEvent, DepositResult } from "../types";
3
+ import { EthereumContractService } from "../contract";
4
+
5
+ export class DepositClient {
6
+
7
+ private readonly contractService: EthereumContractService;
8
+
9
+ get contract() { return this.contractService.contract; }
10
+
11
+ constructor(contract: EthereumContractService) {
12
+ this.contractService = contract;
13
+ }
14
+
15
+
16
+ /**
17
+ * Simulate a deposit via callStatic.
18
+ *
19
+ * Useful for pre-flight checks; will throw with the same revert
20
+ * reason as a real tx if it would fail.
21
+ */
22
+ async simulateDeposit(amount: number | string | bigint | BigNumber): Promise<void> {
23
+ const amountWei = BigNumber.isBigNumber(amount)
24
+ ? amount
25
+ : BigNumber.from(amount);
26
+
27
+ // callStatic executes the function locally without sending a tx.
28
+ // deposit() doesn't return anything, so we only care if it reverts.
29
+ await this.contract.DepositManager.callStatic.deposit({
30
+ value: amountWei,
31
+ });
32
+ }
33
+
34
+
35
+
36
+ /**
37
+ *
38
+ * @param amountWei an amount of WEI to deposit in exchange for liqETH
39
+ * @returns the hash of the transaction
40
+ */
41
+ async performDeposit(amountWei: BigNumber): Promise<DepositResult> {
42
+ // Pre-check minDeposit
43
+ const minDeposit: BigNumber = await this.contract.DepositManager.minDeposit();
44
+ if (amountWei.lt(minDeposit)) {
45
+ throw new Error(
46
+ `Deposit amount below minDeposit: ` +
47
+ `amount=${ethers.utils.formatEther(amountWei)} ETH, ` +
48
+ `min=${ethers.utils.formatEther(minDeposit)} ETH`
49
+ );
50
+ }
51
+
52
+ // Send the payable tx
53
+ const tx = await this.contract.DepositManager.deposit({
54
+ value: amountWei,
55
+ });
56
+
57
+ // Wait for 1 confirmation
58
+ const receipt = await tx.wait(1);
59
+
60
+ // Parse Deposited event if present
61
+ let deposited: DepositEvent | undefined;
62
+ const ev = receipt.events?.find((e) => e.event === 'Deposited');
63
+
64
+ if (ev && ev.args) {
65
+ const { user, netEth, fee, shares } = ev.args;
66
+ deposited = {
67
+ user,
68
+ netEth: BigNumber.from(netEth),
69
+ fee: BigNumber.from(fee),
70
+ shares: BigNumber.from(shares),
71
+ };
72
+ }
73
+
74
+ return {
75
+ txHash: tx.hash,
76
+ receipt,
77
+ deposited,
78
+ };
79
+ }
80
+
81
+
82
+ }
@@ -0,0 +1,215 @@
1
+ import { BigNumber, ethers } from "ethers";
2
+ import { preLaunchReceipt, StakedEvent, StakedResult, WithdrawnStakeEvent, WithdrawnStakeResult } from "../types";
3
+ import { EthereumContractService } from "../contract";
4
+
5
+ export class StakeClient {
6
+
7
+ private readonly contractService: EthereumContractService;
8
+
9
+ get contract() { return this.contractService.contract; }
10
+
11
+ constructor(contract: EthereumContractService) {
12
+ this.contractService = contract;
13
+ }
14
+
15
+
16
+
17
+ /**
18
+ * Simulate a stake via callStatic.
19
+ *
20
+ * Useful for pre-flight checks; will throw with the same revert
21
+ * reason as a real tx if it would fail.
22
+ */
23
+ async simulateStake(amount: number | string | bigint | BigNumber): Promise<void> {
24
+ const amountWei = BigNumber.isBigNumber(amount)
25
+ ? amount
26
+ : BigNumber.from(amount);
27
+
28
+ // callStatic executes the function locally without sending a tx.
29
+ // stakeLiqEth() doesn't return anything, so we only care if it reverts.
30
+ await this.contract.Depositor.callStatic.stakeLiqETH(amountWei);
31
+ }
32
+
33
+
34
+ /**
35
+ *
36
+ * @param amountWei an amount of liqETH (in WEI) to stake to the Outpost
37
+ * @returns txHash (hash of the transaction), receipt, Staked event
38
+ */
39
+ async performStake(amountWei: BigNumber, signerAddress: string): Promise<StakedResult> {
40
+ const liq = this.contract.LiqEth;
41
+ const depositorAddress = this.contract.Depositor.address;
42
+
43
+ // check allowance
44
+ const allowance = await liq.allowance(signerAddress, depositorAddress);
45
+
46
+ // if allowance is less than the requested stake amount, request permission to spend LiqEth
47
+ if (allowance.lt(amountWei)) {
48
+ const liqWrite = this.contractService.getWrite('LiqEth');
49
+
50
+ // currently requested unlimited amount - potentially change to only request up to the current amount?
51
+ const approveAmount = ethers.constants.MaxUint256;
52
+
53
+ console.warn(`allowance insufficient (${allowance.toString()} < ${amountWei.toString()}); sending approve(${depositorAddress}, ${approveAmount.toString()})`);
54
+ const approveTx = await liqWrite.approve(depositorAddress, approveAmount);
55
+ await approveTx.wait(1);
56
+
57
+ // re-read allowance to ensure approval succeeded
58
+ const newAllowance = await liq.allowance(signerAddress, depositorAddress);
59
+ if (newAllowance.lt(amountWei)) {
60
+ throw new Error('Approval failed or allowance still insufficient after approve');
61
+ }
62
+ }
63
+
64
+
65
+ // send the tx to stake liqeth
66
+ const tx = await this.contract.Depositor.stakeLiqETH(amountWei);
67
+
68
+ // Wait for 1 confirmation
69
+ const receipt = await tx.wait(1);
70
+
71
+ // Parse Staked event if present
72
+ let staked: StakedEvent | undefined;
73
+ const ev = receipt.events?.find((e) => e.event === 'Staked');
74
+
75
+ if (ev && ev.args) {
76
+ const { user, amountLiq, shares, tokenId } = ev.args;
77
+ staked = {
78
+ user,
79
+ amountLiq: BigNumber.from(amountLiq),
80
+ shares: BigNumber.from(shares),
81
+ tokenId: BigNumber.from(tokenId)
82
+ };
83
+ }
84
+
85
+ return {
86
+ txHash: tx.hash,
87
+ receipt,
88
+ staked,
89
+ };
90
+ }
91
+
92
+
93
+
94
+ async getOwnedTokenIdsFor(
95
+ owner: string,
96
+ fromBlock = 1850820,
97
+ toBlock: number | string = "latest"
98
+ ): Promise<BigNumber[]> {
99
+ const receiptContract = this.contract.ReceiptNFT;
100
+
101
+ // Logs where address received tokens
102
+ const toLogs = await receiptContract.queryFilter(
103
+ receiptContract.filters.Transfer(null, owner),
104
+ fromBlock,
105
+ toBlock
106
+ );
107
+
108
+ // Logs where address sent tokens (including burns from owner → 0)
109
+ const fromLogs = await receiptContract.queryFilter(
110
+ receiptContract.filters.Transfer(owner, null),
111
+ fromBlock,
112
+ toBlock
113
+ );
114
+
115
+ const owned = new Set<string>();
116
+
117
+ // Add all received tokenIds
118
+ for (const e of toLogs) {
119
+ const tokenId = e.args?.tokenId;
120
+ if (!tokenId) continue;
121
+ owned.add(tokenId.toString());
122
+ }
123
+
124
+ // Remove all sent tokenIds
125
+ for (const e of fromLogs) {
126
+ const tokenId = e.args?.tokenId;
127
+ if (!tokenId) continue;
128
+ owned.delete(tokenId.toString());
129
+ }
130
+
131
+ // Convert to BigNumbers
132
+ return Array.from(owned).map((id) => BigNumber.from(id));
133
+ }
134
+
135
+
136
+ /**
137
+ *
138
+ * @param amountWei an amount of liqETH (in WEI) to stake to the Outpost
139
+ * @returns txHash (hash of the transaction), receipt, WithdrawnStake event
140
+ */
141
+ async fetchPreLaunchReceipts(address: string): Promise<preLaunchReceipt[]> {
142
+ const receiptContract = this.contract.ReceiptNFT;
143
+
144
+ // first figure out which tokenIds this address owns, from events
145
+ const tokenIds = await this.getOwnedTokenIdsFor(address);
146
+
147
+ const results: preLaunchReceipt[] = [];
148
+
149
+ // next fetch on-chain receipt data just for those ids
150
+ for (const idBN of tokenIds) {
151
+ try {
152
+ const receiptData = await receiptContract.getReceipt(idBN);
153
+
154
+ const formattedReceipt = {
155
+ account: receiptData.account,
156
+ currency: receiptData.currency,
157
+ kind: receiptData.kind,
158
+ indexAtMint: receiptData.indexAtMint.toBigInt(),
159
+ principal: {
160
+ amount: receiptData.principal.toBigInt(),
161
+ decimals: 18,
162
+ symbol: "LiqETH"
163
+ },
164
+ shares: {
165
+ amount: receiptData.shares.toBigInt(),
166
+ decimals: 18,
167
+ symbol: "LiqETH"
168
+ },
169
+ timestamp: new Date(Number(receiptData.timestamp.toString()) * 1000).toLocaleString(),
170
+ }
171
+
172
+ results.push({ tokenId: idBN.toBigInt(), receipt: formattedReceipt } as any);
173
+ } catch (err) {
174
+ // in case of any mismatch or race, just skip this id
175
+ console.warn(`Failed to load receipt for tokenId=${idBN.toString()}`, err);
176
+ continue;
177
+ }
178
+ }
179
+
180
+ return results;
181
+ }
182
+
183
+
184
+ /**
185
+ *
186
+ * @param amountWei an amount of liqETH (in WEI) to stake to the Outpost
187
+ * @returns txHash (hash of the transaction), receipt, WithdrawnStake event
188
+ */
189
+ async performWithdrawStake(tokenId: BigNumber, recipient: string): Promise<WithdrawnStakeResult> {
190
+ // Send the payable tx
191
+ const tx = await this.contract.Depositor.withdrawStake(tokenId, recipient);
192
+
193
+ // Wait for 1 confirmation
194
+ const receipt = await tx.wait(1);
195
+
196
+ // Parse Staked event if present
197
+ let withdrawnstake: WithdrawnStakeEvent | undefined;
198
+ const ev = receipt.events?.find((e) => e.event === 'WithdrawnStake');
199
+
200
+ if (ev && ev.args) {
201
+ const { user, tokenOut, tokenId } = ev.args;
202
+ withdrawnstake = {
203
+ user: user,
204
+ tokenOut: BigNumber.from(tokenOut),
205
+ tokenId: BigNumber.from(tokenId)
206
+ };
207
+ }
208
+
209
+ return {
210
+ txHash: tx.hash,
211
+ receipt,
212
+ withdrawnstake,
213
+ };
214
+ }
215
+ }
@@ -6,14 +6,26 @@
6
6
  import AccountingArtifact from '../../assets/ethereum/ABI/liqEth/accounting.sol/Accounting.json';
7
7
  import DepositManagerArtifact from '../../assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.json';
8
8
  import LiqEthArtifact from '../../assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.json';
9
- import LiqEthBurnArtifact from '../../assets/ethereum/ABI/liqEth/liqEthBurn.sol/LiqEthBurn.json';
10
- // import LiqEthCommonArtifact from '../../assets/ethereum/ABI/liqEth/liqEthCommon.sol/liqEthCommon.json';
11
- import LiqEthMintArtifact from '../../assets/ethereum/ABI/liqEth/liqEthMint.sol/LiqEthMint.json';
12
- // import RewardsERC20Artifact from '../../assets/ethereum/ABI/liqEth/RewardsERC20.sol/RewardsERC20.json';
9
+ // import LiqEthBurnArtifact from '../../assets/ethereum/ABI/liqEth/liqEthBurn.sol/LiqEthBurn.json';
10
+ // import LiqEthMintArtifact from '../../assets/ethereum/ABI/liqEth/liqEthMint.sol/LiqEthMint.json';
13
11
  import StakingModuleArtifact from '../../assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.json';
14
- // import ValidatorBalanceArtifact from '../../assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/ValidatorBalanceVerifier.json';
15
12
  import WithdrawalQueueArtifact from '../../assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.json';
16
13
  import WithdrawalVaultArtifact from '../../assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.json';
14
+
15
+ // Outpost Artifacts
16
+ import DepositorArtifact from '../../assets/ethereum/ABI/outpost/Depositor.sol/Depositor.json';
17
+ import ReceiptNFTArtifact from '../../assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.json';
18
+ import OutpostManagerArtifact from '../../assets/ethereum/ABI/outpost/OutpostManager.sol/OutpostManager.json';
19
+ import BARArtifact from '../../assets/ethereum/ABI/outpost/BAR.sol/BAR.json';
20
+ import OPPArtifact from '../../assets/ethereum/ABI/outpost/OPP.sol/OPP.json';
21
+ import OPPCommonArtifact from '../../assets/ethereum/ABI/outpost/OPPCommon.sol/OPPCommon.json';
22
+ import OPPInboundArtifact from '../../assets/ethereum/ABI/outpost/OPPInbound.sol/OPPInbound.json';
23
+ import WarrantArtifact from '../../assets/ethereum/ABI/outpost/Warrant.sol/Warrant.json';
24
+
25
+ // Currently Unused Artifacts
26
+ // import LiqEthCommonArtifact from '../../assets/ethereum/ABI/liqEth/liqEthCommon.sol/liqEthCommon.json';
27
+ // import RewardsERC20Artifact from '../../assets/ethereum/ABI/liqEth/RewardsERC20.sol/RewardsERC20.json';
28
+ // import ValidatorBalanceArtifact from '../../assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/ValidatorBalanceVerifier.json';
17
29
  // import YieldArtifact from '../../assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.json';
18
30
 
19
31
  import ERC20Artifact from '../../assets/ethereum/ABI/token/ERC20Token.sol/ERC20Token.json';
@@ -35,14 +47,26 @@ export const ERC1155Abi = ERC1155Artifact.abi;
35
47
 
36
48
  // Make sure ContractName in ./types includes all of these keys.
37
49
  export const ADDRESSES: AddressBook = {
38
- Accounting: "0xd51CC479c25dc7Cd23f568Ef5c1AdE1671a4D15b",
39
- DepositManager: "0x2249D309f086363ABF5057Ae7f8057279162786B",
40
- LiqEth: "0xd5bd3DC2fD86e917A46f7571708aBB88CbfCc197",
41
- LiqEthMint: "0xdBAa1539eB7b80C29d825FCda76c0d7F8F0E6cFB",
42
- LiqEthBurn: "0x02e0A02fE2311FAd661677B7117FDdc801c1216b",
43
- StakingModule: "0x87047291c3b0D55A551C97B9194A02E1D84e06A9",
44
- WithdrawalQueue: "0x7781368720294fE0bB6D97F14fE2E9275fFED071",
45
- WithdrawalVault: "0x24457626938d4132556005ecA4d9e6F24F85297E",
50
+ Accounting: "0xDf9da63E9CD14c79bD9f0E8F2E797096A40B6031",
51
+ DepositManager: "0x3fEd507e554cd0e973CeCAf2168526b1617418d3",
52
+ LiqEth: "0x1dA6aB23c2E2fA0a52C74F7f4189F770ED1eF9B3",
53
+ StakingModule: "0xBd13C85fdefBBc63904e7301aCdeFE87c9C93234",
54
+ WithdrawalQueue: "0xD9A1D38ae4A636DEf20B02F35387a6b126D73fAe", //aka "queue"
55
+ WithdrawalVault: "0x150334D09a1d3d30EE93d5e6009EB897B5dDF5b2", //aka withdrawVault
56
+
57
+ //not in last set of deployments 12/18/25
58
+ // LiqEthMint: "0xdBAa1539eB7b80C29d825FCda76c0d7F8F0E6cFB",
59
+ // LiqEthBurn: "0x02e0A02fE2311FAd661677B7117FDdc801c1216b",
60
+
61
+ //Outpost contracts
62
+ Depositor: "0x0876f5f411651dFc67386Bc3D36315a3B2249F2e",
63
+ ReceiptNFT: "0x726c91fB3218A745Bfec0302B4cBaeBeaA023a6d",
64
+ OutpostManager: "0xB6Eb20f7916295853a318581eCB51Be4eeb107Fe",
65
+ BAR: "0x1936EB941361da83EE0E68FB7Bd0DF210f090B5C",
66
+ OPP: "0x2e4cc69D6F8CEC3eEec81F3051AD90fEa71e5D57",
67
+ OPPCommon: "0xA79fB9e563cF70190346D66eA20A1F2E09e0f732",
68
+ OPPInbound: "0xd63644d0e8c3610eEf9f0Fd5Ea884b962762c469",
69
+ Warrant: "0x8613F6Bb9ad883e81338EF97A06c53459250c625",
46
70
  };
47
71
 
48
72
  export type Contracts<T extends string = ContractName> = Record<T, ContractConfig>;
@@ -69,14 +93,14 @@ export const CONTRACTS: Contracts<ContractName> = {
69
93
  address: ADDRESSES.DepositManager,
70
94
  abi: DepositManagerArtifact.abi as JsonFragment[],
71
95
  },
72
- LiqEthMint: {
73
- address: ADDRESSES.LiqEthMint,
74
- abi: LiqEthMintArtifact.abi as JsonFragment[],
75
- },
76
- LiqEthBurn: {
77
- address: ADDRESSES.LiqEthBurn,
78
- abi: LiqEthBurnArtifact.abi as JsonFragment[],
79
- },
96
+ // LiqEthMint: {
97
+ // address: ADDRESSES.LiqEthMint,
98
+ // abi: LiqEthMintArtifact.abi as JsonFragment[],
99
+ // },
100
+ // LiqEthBurn: {
101
+ // address: ADDRESSES.LiqEthBurn,
102
+ // abi: LiqEthBurnArtifact.abi as JsonFragment[],
103
+ // },
80
104
  // RewardsERC20: {
81
105
  // address: ADDRESSES.RewardsERC20,
82
106
  // abi: RewardsERC20Artifact.abi as JsonFragment[],
@@ -101,6 +125,41 @@ export const CONTRACTS: Contracts<ContractName> = {
101
125
  // address: ADDRESSES.Yield,
102
126
  // abi: YieldArtifact.abi as JsonFragment[],
103
127
  // },
128
+
129
+
130
+ // Outpost Contracts
131
+ Depositor: {
132
+ address: ADDRESSES.Depositor,
133
+ abi: DepositorArtifact.abi as JsonFragment[],
134
+ },
135
+ ReceiptNFT: {
136
+ address: ADDRESSES.ReceiptNFT,
137
+ abi: ReceiptNFTArtifact.abi as JsonFragment[],
138
+ },
139
+ OutpostManager: {
140
+ address: ADDRESSES.OutpostManager,
141
+ abi: OutpostManagerArtifact.abi as JsonFragment[],
142
+ },
143
+ BAR: {
144
+ address: ADDRESSES.BAR,
145
+ abi: BARArtifact.abi as JsonFragment[],
146
+ },
147
+ OPP: {
148
+ address: ADDRESSES.OPP,
149
+ abi: OPPArtifact.abi as JsonFragment[],
150
+ },
151
+ OPPCommon: {
152
+ address: ADDRESSES.OPPCommon,
153
+ abi: OPPCommonArtifact.abi as JsonFragment[],
154
+ },
155
+ OPPInbound: {
156
+ address: ADDRESSES.OPPInbound,
157
+ abi: OPPInboundArtifact.abi as JsonFragment[],
158
+ },
159
+ Warrant: {
160
+ address: ADDRESSES.Warrant,
161
+ abi: WarrantArtifact.abi as JsonFragment[],
162
+ }
104
163
  };
105
164
 
106
165
  export interface ContractOptions {
@@ -187,8 +246,8 @@ export class EthereumContractService {
187
246
  AccountingArtifact,
188
247
  DepositManagerArtifact,
189
248
  LiqEthArtifact,
190
- LiqEthBurnArtifact,
191
- LiqEthMintArtifact,
249
+ // LiqEthBurnArtifact,
250
+ // LiqEthMintArtifact,
192
251
  // RewardsERC20Artifact,
193
252
  StakingModuleArtifact,
194
253
  // ValidatorBalanceArtifact,