@wireio/stake 1.0.1 → 2.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.
Files changed (190) hide show
  1. package/lib/stake.browser.js +13027 -6773
  2. package/lib/stake.browser.js.map +1 -1
  3. package/lib/stake.d.ts +7627 -646
  4. package/lib/stake.js +13406 -7147
  5. package/lib/stake.js.map +1 -1
  6. package/lib/stake.m.js +13027 -6773
  7. package/lib/stake.m.js.map +1 -1
  8. package/package.json +4 -3
  9. package/src/assets/solana/mainnet/idl/liqsol_core.json +6166 -0
  10. package/src/assets/solana/mainnet/idl/liqsol_token.json +183 -0
  11. package/src/assets/solana/mainnet/idl/transfer_hook.json +197 -0
  12. package/src/assets/solana/mainnet/idl/validator_leaderboard.json +574 -0
  13. package/src/assets/solana/mainnet/types/liqsol_core.ts +6172 -0
  14. package/src/assets/solana/mainnet/types/liqsol_token.ts +189 -0
  15. package/src/assets/solana/mainnet/types/transfer_hook.ts +203 -0
  16. package/src/assets/solana/mainnet/types/validator_leaderboard.ts +580 -0
  17. package/src/networks/ethereum/clients/convert.client.ts +30 -1
  18. package/src/networks/ethereum/clients/opp.client.ts +20 -21
  19. package/src/networks/ethereum/clients/receipt.client.ts +89 -4
  20. package/src/networks/ethereum/clients/stake.client.ts +1 -0
  21. package/src/networks/ethereum/contract.ts +260 -222
  22. package/src/networks/ethereum/ethereum.ts +121 -104
  23. package/src/networks/ethereum/types.ts +17 -2
  24. package/src/networks/solana/clients/deposit.client.ts +294 -65
  25. package/src/networks/solana/clients/distribution.client.ts +13 -18
  26. package/src/networks/solana/clients/leaderboard.client.ts +9 -11
  27. package/src/networks/solana/clients/outpost.client.ts +11 -10
  28. package/src/networks/solana/clients/token.client.ts +11 -13
  29. package/src/networks/solana/constants.ts +44 -285
  30. package/src/networks/solana/program.ts +365 -26
  31. package/src/networks/solana/solana.ts +213 -69
  32. package/src/networks/solana/types.ts +4 -4
  33. package/src/networks/solana/utils.ts +16 -301
  34. package/src/staker.ts +11 -2
  35. package/src/types.ts +19 -6
  36. /package/src/assets/ethereum/{ABI → mainnet}/common/Base58.sol/Base58.dbg.json +0 -0
  37. /package/src/assets/ethereum/{ABI → mainnet}/common/Base58.sol/Base58.json +0 -0
  38. /package/src/assets/ethereum/{ABI → mainnet}/common/OpenZepArtifacts.sol/__Dummy_OZ_UUPS__.dbg.json +0 -0
  39. /package/src/assets/ethereum/{ABI → mainnet}/common/OpenZepArtifacts.sol/__Dummy_OZ_UUPS__.json +0 -0
  40. /package/src/assets/ethereum/{ABI → mainnet}/common/RestrictedCallers.sol/RestrictedCallers.dbg.json +0 -0
  41. /package/src/assets/ethereum/{ABI → mainnet}/common/RestrictedCallers.sol/RestrictedCallers.json +0 -0
  42. /package/src/assets/ethereum/{ABI → mainnet}/common/iodata.sol/iodata.dbg.json +0 -0
  43. /package/src/assets/ethereum/{ABI → mainnet}/common/iodata.sol/iodata.json +0 -0
  44. /package/src/assets/ethereum/{ABI → mainnet}/common/iodata_util.sol/iodata_util.dbg.json +0 -0
  45. /package/src/assets/ethereum/{ABI → mainnet}/common/iodata_util.sol/iodata_util.json +0 -0
  46. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_data.sol/sysio_data.dbg.json +0 -0
  47. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_data.sol/sysio_data.json +0 -0
  48. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_errors.sol/sysio_errors.dbg.json +0 -0
  49. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_errors.sol/sysio_errors.json +0 -0
  50. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_merkle.sol/sysio_merkle.dbg.json +0 -0
  51. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_merkle.sol/sysio_merkle.json +0 -0
  52. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_name.sol/sysio_name.dbg.json +0 -0
  53. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_name.sol/sysio_name.json +0 -0
  54. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_pubkey.sol/sysio_pubkey.dbg.json +0 -0
  55. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_pubkey.sol/sysio_pubkey.json +0 -0
  56. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_read.sol/sysio_read.dbg.json +0 -0
  57. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_read.sol/sysio_read.json +0 -0
  58. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_tester.sol/SysioTester.dbg.json +0 -0
  59. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_tester.sol/SysioTester.json +0 -0
  60. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_verify.sol/sysio_verify.dbg.json +0 -0
  61. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_verify.sol/sysio_verify.json +0 -0
  62. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_write.sol/sysio_write.dbg.json +0 -0
  63. /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_write.sol/sysio_write.json +0 -0
  64. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/BeaconState.sol/BeaconState.dbg.json +0 -0
  65. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/BeaconState.sol/BeaconState.json +0 -0
  66. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/DepositManager.sol/DepositManager.dbg.json +0 -0
  67. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/DepositManager.sol/DepositManager.json +0 -0
  68. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthAuthority.sol/LiqEthAuthority.dbg.json +0 -0
  69. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthAuthority.sol/LiqEthAuthority.json +0 -0
  70. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IAccounting.dbg.json +0 -0
  71. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IAccounting.json +0 -0
  72. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositContract.dbg.json +0 -0
  73. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositContract.json +0 -0
  74. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositManager.dbg.json +0 -0
  75. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositManager.json +0 -0
  76. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/ILiqEthUpgradeable.dbg.json +0 -0
  77. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/ILiqEthUpgradeable.json +0 -0
  78. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20.dbg.json +0 -0
  79. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20.json +0 -0
  80. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20Pausable.dbg.json +0 -0
  81. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20Pausable.json +0 -0
  82. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IStakingModule.dbg.json +0 -0
  83. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IStakingModule.json +0 -0
  84. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.dbg.json +0 -0
  85. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.json +0 -0
  86. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IWithdrawalRecord.dbg.json +0 -0
  87. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IWithdrawalRecord.json +0 -0
  88. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/LiqEthCommon.dbg.json +0 -0
  89. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/LiqEthCommon.json +0 -0
  90. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthManaged.sol/LiqEthManaged.dbg.json +0 -0
  91. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthManaged.sol/LiqEthManaged.json +0 -0
  92. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20.sol/RewardsERC20Upgradeable.dbg.json +0 -0
  93. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20.sol/RewardsERC20Upgradeable.json +0 -0
  94. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20Pausable.sol/RewardsERC20PausableUpgradeable.dbg.json +0 -0
  95. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20Pausable.sol/RewardsERC20PausableUpgradeable.json +0 -0
  96. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/Yield.sol/YieldOracle.dbg.json +0 -0
  97. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/Yield.sol/YieldOracle.json +0 -0
  98. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/accounting.sol/Accounting.dbg.json +0 -0
  99. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/accounting.sol/Accounting.json +0 -0
  100. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/liqEth.sol/LiqEthToken.dbg.json +0 -0
  101. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/liqEth.sol/LiqEthToken.json +0 -0
  102. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/stakingModule.sol/StakingModule.dbg.json +0 -0
  103. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/stakingModule.sol/StakingModule.json +0 -0
  104. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalQueue.sol/WithdrawalQueue.dbg.json +0 -0
  105. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalQueue.sol/WithdrawalQueue.json +0 -0
  106. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/Uint64BE.dbg.json +0 -0
  107. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/Uint64BE.json +0 -0
  108. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/WithdrawalVault.dbg.json +0 -0
  109. /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/WithdrawalVault.json +0 -0
  110. /package/src/assets/ethereum/{ABI → mainnet}/outpost/Aggregator.sol/Aggregator.json +0 -0
  111. /package/src/assets/ethereum/{ABI → mainnet}/outpost/BAR.sol/BAR.dbg.json +0 -0
  112. /package/src/assets/ethereum/{ABI → mainnet}/outpost/BAR.sol/BAR.json +0 -0
  113. /package/src/assets/ethereum/{ABI → mainnet}/outpost/Depositor.sol/Depositor.dbg.json +0 -0
  114. /package/src/assets/ethereum/{ABI → mainnet}/outpost/Depositor.sol/Depositor.json +0 -0
  115. /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.dbg.json +0 -0
  116. /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.json +0 -0
  117. /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.dbg.json +0 -0
  118. /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.json +0 -0
  119. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPP.sol/OPP.dbg.json +0 -0
  120. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPP.sol/OPP.json +0 -0
  121. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPP.dbg.json +0 -0
  122. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPP.json +0 -0
  123. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPEndpoint.dbg.json +0 -0
  124. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPEndpoint.json +0 -0
  125. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPInbound.dbg.json +0 -0
  126. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPInbound.json +0 -0
  127. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPReceiver.dbg.json +0 -0
  128. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPReceiver.json +0 -0
  129. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPSender.dbg.json +0 -0
  130. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPSender.json +0 -0
  131. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/OPPCommon.dbg.json +0 -0
  132. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/OPPCommon.json +0 -0
  133. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpoint.sol/OPPEndpoint.dbg.json +0 -0
  134. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpoint.sol/OPPEndpoint.json +0 -0
  135. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.dbg.json +0 -0
  136. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.json +0 -0
  137. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.dbg.json +0 -0
  138. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.json +0 -0
  139. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPErrors.sol/OPPErrors.dbg.json +0 -0
  140. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPErrors.sol/OPPErrors.json +0 -0
  141. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPInbound.sol/OPPInbound.dbg.json +0 -0
  142. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPInbound.sol/OPPInbound.json +0 -0
  143. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPReceiver.sol/OPPReceiver.dbg.json +0 -0
  144. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPReceiver.sol/OPPReceiver.json +0 -0
  145. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPSender.sol/OPPSender.dbg.json +0 -0
  146. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPSender.sol/OPPSender.json +0 -0
  147. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostErrors.sol/OutpostErrors.dbg.json +0 -0
  148. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostErrors.sol/OutpostErrors.json +0 -0
  149. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManaged.sol/OutpostManaged.dbg.json +0 -0
  150. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManaged.sol/OutpostManaged.json +0 -0
  151. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManager.sol/OutpostManager.dbg.json +0 -0
  152. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManager.sol/OutpostManager.json +0 -0
  153. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.dbg.json +0 -0
  154. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.json +0 -0
  155. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostManager.dbg.json +0 -0
  156. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostManager.json +0 -0
  157. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.dbg.json +0 -0
  158. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.json +0 -0
  159. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.dbg.json +0 -0
  160. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.json +0 -0
  161. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostOwnable.sol/OutpostOwnable.dbg.json +0 -0
  162. /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostOwnable.sol/OutpostOwnable.json +0 -0
  163. /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pool.sol/Pool.dbg.json +0 -0
  164. /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pool.sol/Pool.json +0 -0
  165. /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pretoken.sol/Pretoken.dbg.json +0 -0
  166. /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pretoken.sol/Pretoken.json +0 -0
  167. /package/src/assets/ethereum/{ABI → mainnet}/outpost/ReceiptNFT.sol/ReceiptNFT.dbg.json +0 -0
  168. /package/src/assets/ethereum/{ABI → mainnet}/outpost/ReceiptNFT.sol/ReceiptNFT.json +0 -0
  169. /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IPretoken.sol/IPretoken.dbg.json +0 -0
  170. /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IPretoken.sol/IPretoken.json +0 -0
  171. /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IWarrant.sol/IWarrant.dbg.json +0 -0
  172. /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IWarrant.sol/IWarrant.json +0 -0
  173. /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.dbg.json +0 -0
  174. /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.json +0 -0
  175. /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.dbg.json +0 -0
  176. /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.json +0 -0
  177. /package/src/assets/ethereum/{ABI → mainnet}/token/ERC1155Token.sol/ERC1155Token.dbg.json +0 -0
  178. /package/src/assets/ethereum/{ABI → mainnet}/token/ERC1155Token.sol/ERC1155Token.json +0 -0
  179. /package/src/assets/ethereum/{ABI → mainnet}/token/ERC20Token.sol/ERC20Token.dbg.json +0 -0
  180. /package/src/assets/ethereum/{ABI → mainnet}/token/ERC20Token.sol/ERC20Token.json +0 -0
  181. /package/src/assets/ethereum/{ABI → mainnet}/token/ERC721Token.sol/ERC721Token.dbg.json +0 -0
  182. /package/src/assets/ethereum/{ABI → mainnet}/token/ERC721Token.sol/ERC721Token.json +0 -0
  183. /package/src/assets/solana/{idl → devnet/idl}/liqsol_core.json +0 -0
  184. /package/src/assets/solana/{idl → devnet/idl}/liqsol_token.json +0 -0
  185. /package/src/assets/solana/{idl → devnet/idl}/transfer_hook.json +0 -0
  186. /package/src/assets/solana/{idl → devnet/idl}/validator_leaderboard.json +0 -0
  187. /package/src/assets/solana/{types → devnet/types}/liqsol_core.ts +0 -0
  188. /package/src/assets/solana/{types → devnet/types}/liqsol_token.ts +0 -0
  189. /package/src/assets/solana/{types → devnet/types}/transfer_hook.ts +0 -0
  190. /package/src/assets/solana/{types → devnet/types}/validator_leaderboard.ts +0 -0
@@ -4,239 +4,270 @@
4
4
  * Provides a unified service for interacting with Ethereum smart contracts using ethers.js.
5
5
  */
6
6
 
7
- // LiqETH Artifacts
8
- import AccountingArtifact from '../../assets/ethereum/ABI/liqEth/accounting.sol/Accounting.json';
9
- import DepositManagerArtifact from '../../assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.json';
10
- import LiqEthArtifact from '../../assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.json';
11
- import StakingModuleArtifact from '../../assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.json';
12
- import WithdrawalQueueArtifact from '../../assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.json';
13
- import WithdrawalVaultArtifact from '../../assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.json';
14
- import BeaconStateArtifact from '../../assets/ethereum/ABI/liqEth/BeaconState.sol/BeaconState.json';
15
- import YieldOracleArtifact from '../../assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.json';
16
-
17
- // Outpost Artifacts
18
- import DepositorArtifact from '../../assets/ethereum/ABI/outpost/Depositor.sol/Depositor.json';
19
- import ReceiptNFTArtifact from '../../assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.json';
20
- import OutpostManagerArtifact from '../../assets/ethereum/ABI/outpost/OutpostManager.sol/OutpostManager.json';
21
- import BARArtifact from '../../assets/ethereum/ABI/outpost/BAR.sol/BAR.json';
22
- import OPPArtifact from '../../assets/ethereum/ABI/outpost/OPP.sol/OPP.json';
23
- import OPPCommonArtifact from '../../assets/ethereum/ABI/outpost/OPPCommon.sol/OPPCommon.json';
24
- import OPPInboundArtifact from '../../assets/ethereum/ABI/outpost/OPPInbound.sol/OPPInbound.json';
25
- import PretokenArtifact from '../../assets/ethereum/ABI/outpost/Pretoken.sol/Pretoken.json';
26
- import AggregatorArtifact from '../../assets/ethereum/ABI/outpost/Aggregator.sol/Aggregator.json';
27
- import EthUsdPriceConsumerArtifact from '../../assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.json';
28
- import PoolArtifact from '../../assets/ethereum/ABI/outpost/Pool.sol/Pool.json';
29
- import OutpostManagerAuthorityArtifact from '../../assets/ethereum/ABI/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.json';
30
-
31
- // Common Artifacts
32
- import IodataArtifact from '../../assets/ethereum/ABI/common/iodata.sol/iodata.json';
33
- import Base58Artifact from '../../assets/ethereum/ABI/common/Base58.sol/Base58.json';
34
- import sysio_merkleArtifact from '../../assets/ethereum/ABI/common/sysio_merkle.sol/sysio_merkle.json';
35
- import sysio_writeArtifact from '../../assets/ethereum/ABI/common/sysio_write.sol/sysio_write.json';
36
-
37
- // ERC Token Artifacts
38
- import ERC20Artifact from '../../assets/ethereum/ABI/token/ERC20Token.sol/ERC20Token.json';
39
- import ERC721Artifact from '../../assets/ethereum/ABI/token/ERC721Token.sol/ERC721Token.json';
40
- import ERC1155Artifact from '../../assets/ethereum/ABI/token/ERC1155Token.sol/ERC1155Token.json';
7
+ // LiqETH Artifacts (for now, used by both mainnet and hoodi)
8
+ import AccountingArtifact from '../../assets/ethereum/mainnet/liqEth/accounting.sol/Accounting.json';
9
+ import DepositManagerArtifact from '../../assets/ethereum/mainnet/liqEth/DepositManager.sol/DepositManager.json';
10
+ import LiqEthArtifact from '../../assets/ethereum/mainnet/liqEth/liqEth.sol/LiqEthToken.json';
11
+ import StakingModuleArtifact from '../../assets/ethereum/mainnet/liqEth/stakingModule.sol/StakingModule.json';
12
+ import WithdrawalQueueArtifact from '../../assets/ethereum/mainnet/liqEth/withdrawalQueue.sol/WithdrawalQueue.json';
13
+ import WithdrawalVaultArtifact from '../../assets/ethereum/mainnet/liqEth/withdrawalVault.sol/WithdrawalVault.json';
14
+ import BeaconStateArtifact from '../../assets/ethereum/mainnet/liqEth/BeaconState.sol/BeaconState.json';
15
+ import YieldOracleArtifact from '../../assets/ethereum/mainnet/liqEth/Yield.sol/YieldOracle.json';
16
+
17
+ // Outpost Artifacts (for now, used by both mainnet and hoodi)
18
+ import DepositorArtifact from '../../assets/ethereum/mainnet/outpost/Depositor.sol/Depositor.json';
19
+ import ReceiptNFTArtifact from '../../assets/ethereum/mainnet/outpost/ReceiptNFT.sol/ReceiptNFT.json';
20
+ import OutpostManagerArtifact from '../../assets/ethereum/mainnet/outpost/OutpostManager.sol/OutpostManager.json';
21
+ import BARArtifact from '../../assets/ethereum/mainnet/outpost/BAR.sol/BAR.json';
22
+ import OPPArtifact from '../../assets/ethereum/mainnet/outpost/OPP.sol/OPP.json';
23
+ import OPPCommonArtifact from '../../assets/ethereum/mainnet/outpost/OPPCommon.sol/OPPCommon.json';
24
+ import OPPInboundArtifact from '../../assets/ethereum/mainnet/outpost/OPPInbound.sol/OPPInbound.json';
25
+ import PretokenArtifact from '../../assets/ethereum/mainnet/outpost/Pretoken.sol/Pretoken.json';
26
+ import AggregatorArtifact from '../../assets/ethereum/mainnet/outpost/Aggregator.sol/Aggregator.json';
27
+ import EthUsdPriceConsumerArtifact from '../../assets/ethereum/mainnet/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.json';
28
+ import PoolArtifact from '../../assets/ethereum/mainnet/outpost/Pool.sol/Pool.json';
29
+ import OutpostManagerAuthorityArtifact from '../../assets/ethereum/mainnet/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.json';
30
+
31
+ // Common Artifacts (for now, used by both mainnet and hoodi)
32
+ import IodataArtifact from '../../assets/ethereum/mainnet/common/iodata.sol/iodata.json';
33
+ import Base58Artifact from '../../assets/ethereum/mainnet/common/Base58.sol/Base58.json';
34
+ import sysio_merkleArtifact from '../../assets/ethereum/mainnet/common/sysio_merkle.sol/sysio_merkle.json';
35
+ import sysio_writeArtifact from '../../assets/ethereum/mainnet/common/sysio_write.sol/sysio_write.json';
36
+
37
+ // ERC Token Artifacts (for now, used by both mainnet and hoodi)
38
+ import ERC20Artifact from '../../assets/ethereum/mainnet/token/ERC20Token.sol/ERC20Token.json';
39
+ import ERC721Artifact from '../../assets/ethereum/mainnet/token/ERC721Token.sol/ERC721Token.json';
40
+ import ERC1155Artifact from '../../assets/ethereum/mainnet/token/ERC1155Token.sol/ERC1155Token.json';
41
41
 
42
42
  import { AddressBook, ContractName } from './types';
43
43
  import { Contract, ethers, providers, Signer } from 'ethers';
44
44
  import { JsonFragment } from '@ethersproject/abi';
45
45
  import { ErrorDescription } from '@ethersproject/abi/lib/interface';
46
+ import { EvmChainID } from '@wireio/core';
47
+ import { SupportedEvmChainID } from '../../types';
46
48
 
47
49
  export const ERC20Abi = ERC20Artifact.abi;
48
50
  export const ERC721Abi = ERC721Artifact.abi;
49
51
  export const ERC1155Abi = ERC1155Artifact.abi;
50
52
 
51
53
  // -----------------------------------------------------------------------------
52
- // Address book
54
+ // Address books (per-chain)
53
55
  // -----------------------------------------------------------------------------
54
56
 
55
- // Make sure ContractName in ./types includes all of these keys.
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
+ /**
58
+ * MAINNET LATEST
59
+ * 1/23/26
60
+ */
61
+ export const MAINNET_ADDRESSES: AddressBook = {
91
62
  // LiqETH contracts
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",
63
+ LiqEthAuthority: '0xB8fb7dBA2de501c94EAB723fa48679f698a39Aa4',
64
+ BeaconState: '0x29719E8e76C52F5fD4888DF401579859c305f2DF',
65
+ WithdrawalQueue: '0xce388339bFDAed9cAF536ea7b4F42123b4D755d4',
66
+ LiqEthToken: '0x2C0e75e930Fc72ceD0725854C5E7A55566333F3f',
67
+ Accounting: '0xE31C44d04c7B055afAC9301F55840f030eaF04BC',
68
+ DepositManager: '0x21b339ED55A0f037f91B88044C808CcfCCBbF9A8',
69
+ WithdrawalVault: '0x028743bE7E727aA331A1e952575cb00623B95fE2',
70
+ StakingModule: '0xDe9754Fb58CcD4D74e94DA5682192E4e6eC334b0',
71
+ // YieldOracle: '0x7B7B8894e75b44B6cA7Dc8bE6dED5059621907b2',
72
+
73
+ // Outpost contracts
74
+ OutpostManagerAuthority: '0xeaE32b94c0F858b3600861aAE4Caeee6B6341751',
75
+ iodata: '0x485Ed153c45189d623Bb37816eD3016A56552273',
76
+ Base58: '0x8bB3856EC1114B1cE45a78620CF174D90a1Fd4e7',
77
+ sysio_merkle: '0x5180a926D71c6d94c5c939Fe7Fed14cD7dcAa541',
78
+ ReceiptNFT: '0x651De616A20b17De1095f9A0694A0e0E68025b78',
79
+ EthUsdPriceConsumer: '0x2d866f8DB6F6c94997b0027Ba24bc64a03627ddc',
80
+ Pool: '0xDA268Adcb90c422C2102A5f713182A42A8b9EA0D',
81
+ OutpostManager: '0x9f279804Cb8539c53709AA37a4C1b30A52A85175',
82
+ sysio_write: '0x3F8c880efd2c8C3aA1f0CE40b886cc6913eEC1d3',
83
+ Pretoken: '0xCabF19Fdb7cD063738dd63a418702Ee3642FFc68',
84
+ BAR: '0x2D8f4D4435509d7b8F93C3Ba93D45447C892f7ED',
85
+ OPPCommon: '0x1716EEC9f1E0c1aF7BbbA8Fed10652138914f766',
86
+ OPP: '0x5e1135cF8987268a3e7F68551558Ae92c454429f',
87
+ Depositor: '0xf4b4ccfD684feB46504D77232FBde23b23d4F774',
88
+ OPPInbound: '0x088484d45fF93AFabC63810FB0b335792E2B24f3',
89
+
90
+ // MockAggregator is not deployed on mainnet; keep as zero-address placeholder
91
+ MockAggregator: '0x0000000000000000000000000000000000000000',
118
92
  };
119
93
 
120
- export type Contracts<T extends string = ContractName> = Record<T, ContractConfig>;
94
+ /**
95
+ * HOODI TESTNET LATEST
96
+ * 1/23/26
97
+ */
98
+ export const HOODI_ADDRESSES: AddressBook = {
99
+ // LiqETH contracts
100
+ LiqEthAuthority: '0x3Eb66Bb91F7a022FbABc1619Cb6acce7025Bc41F',
101
+ BeaconState: '0x08F879c6D0964E0A17bF688Af23168f654DF372e',
102
+ WithdrawalQueue: '0x74aDeD940369baDDb0F36426F23B08499e45Fe18',
103
+ LiqEthToken: '0x8C974517D038e2e3b8a1da7b1A026bC8132A4b2e',
104
+ Accounting: '0x766CE996B8132b927988c5b2ECAE8108fB1a9307',
105
+ DepositManager: '0xEd391dB5DB11B5eDBE08e69A51D16e84293C09a3',
106
+ WithdrawalVault: '0xbaBc0D5997283ab9886696A0dEaB8A8093436b48',
107
+ StakingModule: '0x4998fBb6Ca5Ee3Db6c339e2962A34791Af643fEa',
108
+ // YieldOracle: '0x61Fe311C57dd9a38Fb7B0c5A8ec521452dB25378',
109
+
110
+ // Outpost contracts
111
+ OutpostManagerAuthority: '0x3B8705Ba1195AF632b3bd9E46F19348BC828FA3D',
112
+ iodata: '0x4aCABbC74a1cA9B0058d9ADAa0E00Af0f4f73212',
113
+ Base58: '0x1241F36ff30065deD52d51f0d6524EF971259A12',
114
+ sysio_merkle: '0x58ca9b5515266Fd6bF94D5F1268C505b2eC9679c',
115
+ ReceiptNFT: '0x03d6bD46cA9F54B8F8bbA21CfAfe717b36cB8593',
116
+ EthUsdPriceConsumer: '0xdC2DD993A13b3DD6D255B52285625694bd967c9A',
117
+ Pool: '0xd4742757AA61B1Fd3Fcd87980D7D460B12Cd9275',
118
+ OutpostManager: '0x38ec2B56cBCeCaFFe28b535517de1a102C3D74E3',
119
+ sysio_write: '0x0Ec4C1BaB772958aa3Db27459643bfbE7d92E305',
120
+ Pretoken: '0x8c97a51A71640fa411DEfab8feC3401eFfd1a2E4',
121
+ BAR: '0xbAFac13ffd3Aa9aEabaaeb6e4C2cF3dFf3479DC0',
122
+ OPPCommon: '0x12283a6d4E6cE4A0e8AdB319Fc161c7F4f91EA8F',
123
+ OPP: '0x87CE3Fe2CDca39C04aa2c14bbF1E1d9DB6358C4A',
124
+ Depositor: '0x5351B30EA4b75bD9be9Fc0048e88F675f7b3Ac2b',
125
+ OPPInbound: '0x0B1f7FB1c7f01A9cf490a1387E1E100F2bEA6C6d',
126
+
127
+ // Test-only mock aggregator
128
+ MockAggregator: '0xFCfc3ddd4CBd9Ad3b3af3A374B8bdA1b66eE6FFF',
129
+ };
121
130
 
122
- export type ContractConfig = {
123
- address: string;
124
- abi: JsonFragment[];
131
+ export const ADDRESS_BOOK_BY_CHAIN: Record<SupportedEvmChainID, AddressBook> = {
132
+ [EvmChainID.Ethereum]: MAINNET_ADDRESSES,
133
+ [EvmChainID.Hoodi]: HOODI_ADDRESSES,
125
134
  };
126
135
 
136
+ // Old name kept as a mainnet default (optional convenience)
137
+ export const ADDRESSES: AddressBook = MAINNET_ADDRESSES;
138
+
127
139
  // -----------------------------------------------------------------------------
128
140
  // Contract config
129
141
  // -----------------------------------------------------------------------------
130
142
 
131
- export const CONTRACTS: Contracts<ContractName> = {
132
- // LiqETH Contracts
133
- LiqEthAuthority: {
134
- address: ADDRESSES.LiqEthAuthority,
135
- abi: LiqEthArtifact.abi as JsonFragment[],
136
- },
137
- BeaconState: {
138
- address: ADDRESSES.BeaconState,
139
- abi: BeaconStateArtifact.abi as JsonFragment[]
140
- },
141
- WithdrawalQueue: {
142
- address: ADDRESSES.WithdrawalQueue,
143
- abi: WithdrawalQueueArtifact.abi as JsonFragment[],
144
- },
145
- LiqEthToken: {
146
- address: ADDRESSES.LiqEthToken,
147
- abi: LiqEthArtifact.abi as JsonFragment[],
148
- },
149
- Accounting: {
150
- address: ADDRESSES.Accounting,
151
- abi: AccountingArtifact.abi as JsonFragment[],
152
- },
153
- DepositManager: {
154
- address: ADDRESSES.DepositManager,
155
- abi: DepositManagerArtifact.abi as JsonFragment[],
156
- },
157
- WithdrawalVault: {
158
- address: ADDRESSES.WithdrawalVault,
159
- abi: WithdrawalVaultArtifact.abi as JsonFragment[],
160
- },
161
- StakingModule: {
162
- address: ADDRESSES.StakingModule,
163
- abi: StakingModuleArtifact.abi as JsonFragment[],
164
- },
165
- YieldOracle: {
166
- address: ADDRESSES.YieldOracle,
167
- abi: YieldOracleArtifact.abi as JsonFragment[],
168
- },
169
-
170
- // Outpost Contracts
171
- OutpostManagerAuthority: {
172
- address: ADDRESSES.OutpostManagerAuthority,
173
- abi: OutpostManagerAuthorityArtifact.abi as JsonFragment[],
174
- },
175
- iodata: {
176
- address: ADDRESSES.iodata,
177
- abi: IodataArtifact.abi as JsonFragment[],
178
- },
179
- Base58: {
180
- address: ADDRESSES.Base58,
181
- abi: Base58Artifact.abi as JsonFragment[],
182
- },
183
- sysio_merkle: {
184
- address: ADDRESSES.sysio_merkle,
185
- abi: sysio_merkleArtifact.abi as JsonFragment[],
186
- },
187
- ReceiptNFT: {
188
- address: ADDRESSES.ReceiptNFT,
189
- abi: ReceiptNFTArtifact.abi as JsonFragment[],
190
- },
191
- Pool: {
192
- address: ADDRESSES.Pool,
193
- abi: PoolArtifact.abi as JsonFragment[],
194
- },
195
- OutpostManager: {
196
- address: ADDRESSES.OutpostManager,
197
- abi: OutpostManagerArtifact.abi as JsonFragment[],
198
- },
199
- sysio_write: {
200
- address: ADDRESSES.sysio_write,
201
- abi: sysio_writeArtifact.abi as JsonFragment[],
202
- },
203
- EthUsdPriceConsumer: {
204
- address: ADDRESSES.EthUsdPriceConsumer,
205
- abi: EthUsdPriceConsumerArtifact.abi as JsonFragment[],
206
- },
207
- BAR: {
208
- address: ADDRESSES.BAR,
209
- abi: BARArtifact.abi as JsonFragment[],
210
- },
211
- OPPCommon: {
212
- address: ADDRESSES.OPPCommon,
213
- abi: OPPCommonArtifact.abi as JsonFragment[],
214
- },
215
- OPP: {
216
- address: ADDRESSES.OPP,
217
- abi: OPPArtifact.abi as JsonFragment[],
218
- },
219
- Pretoken: {
220
- address: ADDRESSES.Pretoken,
221
- abi: PretokenArtifact.abi as JsonFragment[],
222
- },
223
- OPPInbound: {
224
- address: ADDRESSES.OPPInbound,
225
- abi: OPPInboundArtifact.abi as JsonFragment[],
226
- },
227
- Depositor: {
228
- address: ADDRESSES.Depositor,
229
- abi: DepositorArtifact.abi as JsonFragment[],
230
- },
231
-
232
- // MockAggregator: {
233
- // address: ADDRESSES.MockAggregator,
234
- // abi: AggregatorArtifact.abi as JsonFragment[],
235
- // },
143
+ export type ContractConfig = {
144
+ address: string;
145
+ abi: JsonFragment[];
146
+ };
147
+
148
+ export type Contracts<T extends string = ContractName> = Record<T, ContractConfig>;
149
+
150
+ function buildContracts(addresses: AddressBook): Contracts<ContractName> {
151
+ return {
152
+ // LiqETH Contracts
153
+ LiqEthAuthority: {
154
+ address: addresses.LiqEthAuthority,
155
+ abi: LiqEthArtifact.abi as JsonFragment[],
156
+ },
157
+ BeaconState: {
158
+ address: addresses.BeaconState,
159
+ abi: BeaconStateArtifact.abi as JsonFragment[],
160
+ },
161
+ WithdrawalQueue: {
162
+ address: addresses.WithdrawalQueue,
163
+ abi: WithdrawalQueueArtifact.abi as JsonFragment[],
164
+ },
165
+ LiqEthToken: {
166
+ address: addresses.LiqEthToken,
167
+ abi: LiqEthArtifact.abi as JsonFragment[],
168
+ },
169
+ Accounting: {
170
+ address: addresses.Accounting,
171
+ abi: AccountingArtifact.abi as JsonFragment[],
172
+ },
173
+ DepositManager: {
174
+ address: addresses.DepositManager,
175
+ abi: DepositManagerArtifact.abi as JsonFragment[],
176
+ },
177
+ WithdrawalVault: {
178
+ address: addresses.WithdrawalVault,
179
+ abi: WithdrawalVaultArtifact.abi as JsonFragment[],
180
+ },
181
+ StakingModule: {
182
+ address: addresses.StakingModule,
183
+ abi: StakingModuleArtifact.abi as JsonFragment[],
184
+ },
185
+ // YieldOracle: {
186
+ // address: addresses.YieldOracle,
187
+ // abi: YieldOracleArtifact.abi as JsonFragment[],
188
+ // },
189
+
190
+ // Outpost Contracts
191
+ OutpostManagerAuthority: {
192
+ address: addresses.OutpostManagerAuthority,
193
+ abi: OutpostManagerAuthorityArtifact.abi as JsonFragment[],
194
+ },
195
+ iodata: {
196
+ address: addresses.iodata,
197
+ abi: IodataArtifact.abi as JsonFragment[],
198
+ },
199
+ Base58: {
200
+ address: addresses.Base58,
201
+ abi: Base58Artifact.abi as JsonFragment[],
202
+ },
203
+ sysio_merkle: {
204
+ address: addresses.sysio_merkle,
205
+ abi: sysio_merkleArtifact.abi as JsonFragment[],
206
+ },
207
+ ReceiptNFT: {
208
+ address: addresses.ReceiptNFT,
209
+ abi: ReceiptNFTArtifact.abi as JsonFragment[],
210
+ },
211
+ Pool: {
212
+ address: addresses.Pool,
213
+ abi: PoolArtifact.abi as JsonFragment[],
214
+ },
215
+ OutpostManager: {
216
+ address: addresses.OutpostManager,
217
+ abi: OutpostManagerArtifact.abi as JsonFragment[],
218
+ },
219
+ sysio_write: {
220
+ address: addresses.sysio_write,
221
+ abi: sysio_writeArtifact.abi as JsonFragment[],
222
+ },
223
+ EthUsdPriceConsumer: {
224
+ address: addresses.EthUsdPriceConsumer,
225
+ abi: EthUsdPriceConsumerArtifact.abi as JsonFragment[],
226
+ },
227
+ BAR: {
228
+ address: addresses.BAR,
229
+ abi: BARArtifact.abi as JsonFragment[],
230
+ },
231
+ OPPCommon: {
232
+ address: addresses.OPPCommon,
233
+ abi: OPPCommonArtifact.abi as JsonFragment[],
234
+ },
235
+ OPP: {
236
+ address: addresses.OPP,
237
+ abi: OPPArtifact.abi as JsonFragment[],
238
+ },
239
+ Pretoken: {
240
+ address: addresses.Pretoken,
241
+ abi: PretokenArtifact.abi as JsonFragment[],
242
+ },
243
+ OPPInbound: {
244
+ address: addresses.OPPInbound,
245
+ abi: OPPInboundArtifact.abi as JsonFragment[],
246
+ },
247
+ Depositor: {
248
+ address: addresses.Depositor,
249
+ abi: DepositorArtifact.abi as JsonFragment[],
250
+ },
251
+
252
+ MockAggregator: {
253
+ address: addresses.MockAggregator,
254
+ abi: AggregatorArtifact.abi as JsonFragment[],
255
+ },
256
+ };
257
+ }
258
+
259
+ export const CONTRACTS_BY_CHAIN: Record<SupportedEvmChainID, Contracts<ContractName>> = {
260
+ [EvmChainID.Ethereum]: buildContracts(MAINNET_ADDRESSES),
261
+ [EvmChainID.Hoodi]: buildContracts(HOODI_ADDRESSES),
236
262
  };
237
263
 
264
+ // -----------------------------------------------------------------------------
265
+ // Service
266
+ // -----------------------------------------------------------------------------
238
267
 
239
268
  export interface ContractOptions {
269
+ /** EVM chain id to select the correct address/contract set */
270
+ chainId: EvmChainID;
240
271
  /** RPC endpoint or injected EIP-1193 provider */
241
272
  provider?: ethers.providers.Provider;
242
273
  /** Only required if you need to send txns */
@@ -246,6 +277,8 @@ export interface ContractOptions {
246
277
  export class EthereumContractService {
247
278
  private provider?: providers.Provider;
248
279
  private signer?: Signer;
280
+ private readonly chainId: EvmChainID;
281
+ private readonly contractsConfig: Contracts<ContractName>;
249
282
 
250
283
  public readonly contract: { [N in ContractName]: ethers.Contract } = {} as any;
251
284
  public readonly iface: { [N in ContractName]: ethers.utils.Interface } = {} as any;
@@ -253,33 +286,40 @@ export class EthereumContractService {
253
286
  constructor(opts: ContractOptions) {
254
287
  this.provider = opts.provider;
255
288
  this.signer = opts.signer;
289
+ this.chainId = opts.chainId;
290
+
291
+ const contracts = CONTRACTS_BY_CHAIN[this.chainId];
292
+ if (!contracts) {
293
+ throw new Error(`Unsupported EVM chainId=${this.chainId}`);
294
+ }
295
+ this.contractsConfig = contracts;
256
296
 
257
- (Object.keys(CONTRACTS) as ContractName[]).forEach((name) => {
258
- const { address, abi } = CONTRACTS[name];
297
+ (Object.keys(contracts) as ContractName[]).forEach((name) => {
298
+ const { address, abi } = contracts[name];
259
299
  this.iface[name] = new ethers.utils.Interface(abi);
260
300
  this.contract[name] = new ethers.Contract(
261
301
  address,
262
302
  abi,
263
- this.signer ?? this.provider
303
+ this.signer ?? this.provider,
264
304
  );
265
305
  });
266
306
  }
267
307
 
268
308
  /** Get raw address for a contract */
269
309
  public getAddress(name: ContractName): string {
270
- return CONTRACTS[name].address;
310
+ return this.contractsConfig[name].address;
271
311
  }
272
312
 
273
313
  /** Utility: get a read-only handle even if signer is present */
274
314
  public getReadOnly(name: ContractName): Contract {
275
- const { address, abi } = CONTRACTS[name];
315
+ const { address, abi } = this.contractsConfig[name];
276
316
  return new Contract(address, abi, this.provider);
277
317
  }
278
318
 
279
319
  /** Utility: get a write-enabled handle (throws if no signer) */
280
320
  public getWrite(name: ContractName): Contract {
281
321
  if (!this.signer) throw new Error('No signer available for write calls');
282
- const { address, abi } = CONTRACTS[name];
322
+ const { address, abi } = this.contractsConfig[name];
283
323
  return new Contract(address, abi, this.signer);
284
324
  }
285
325
 
@@ -288,9 +328,9 @@ export class EthereumContractService {
288
328
  return this.provider?.getNetwork();
289
329
  }
290
330
 
291
- /** List all known contract names */
331
+ /** List all known contract names for this chain */
292
332
  public listContractNames(): ContractName[] {
293
- return Object.keys(CONTRACTS) as ContractName[];
333
+ return Object.keys(this.contractsConfig) as ContractName[];
294
334
  }
295
335
 
296
336
  /** Get Interface instance for a contract */
@@ -316,21 +356,17 @@ export class EthereumContractService {
316
356
  ERC721Artifact,
317
357
  ERC1155Artifact,
318
358
 
319
- // // liqETH suite
359
+ // If you want, you can gradually re-enable protocol ABIs here
320
360
  // AccountingArtifact,
321
361
  // DepositManagerArtifact,
322
362
  // LiqEthArtifact,
323
- // // LiqEthBurnArtifact,
324
- // // LiqEthMintArtifact,
325
- // // RewardsERC20Artifact,
326
363
  // StakingModuleArtifact,
327
- // // ValidatorBalanceArtifact,
328
364
  // WithdrawalQueueArtifact,
329
365
  // WithdrawalVaultArtifact,
330
- // YieldArtifact,
366
+ // YieldOracleArtifact,
331
367
  ];
332
368
 
333
- allArtifacts.forEach(artifact => {
369
+ allArtifacts.forEach((artifact) => {
334
370
  if (artifact && artifact.abi) {
335
371
  all.push(...artifact.abi);
336
372
  }
@@ -341,7 +377,9 @@ export class EthereumContractService {
341
377
  for (const item of all) {
342
378
  try {
343
379
  const frag = ethers.utils.Fragment.from(item);
344
- const key = `${frag.type}:${frag.format(ethers.utils.FormatTypes.full)}`.toLowerCase();
380
+ const key = `${frag.type}:${frag.format(
381
+ ethers.utils.FormatTypes.full,
382
+ )}`.toLowerCase();
345
383
  if (!seen.has(key)) {
346
384
  seen.add(key);
347
385
  dedup.push(item);