@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.
- package/lib/stake.browser.js +13027 -6773
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +7627 -646
- package/lib/stake.js +13406 -7147
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +13027 -6773
- package/lib/stake.m.js.map +1 -1
- package/package.json +4 -3
- package/src/assets/solana/mainnet/idl/liqsol_core.json +6166 -0
- package/src/assets/solana/mainnet/idl/liqsol_token.json +183 -0
- package/src/assets/solana/mainnet/idl/transfer_hook.json +197 -0
- package/src/assets/solana/mainnet/idl/validator_leaderboard.json +574 -0
- package/src/assets/solana/mainnet/types/liqsol_core.ts +6172 -0
- package/src/assets/solana/mainnet/types/liqsol_token.ts +189 -0
- package/src/assets/solana/mainnet/types/transfer_hook.ts +203 -0
- package/src/assets/solana/mainnet/types/validator_leaderboard.ts +580 -0
- package/src/networks/ethereum/clients/convert.client.ts +30 -1
- package/src/networks/ethereum/clients/opp.client.ts +20 -21
- package/src/networks/ethereum/clients/receipt.client.ts +89 -4
- package/src/networks/ethereum/clients/stake.client.ts +1 -0
- package/src/networks/ethereum/contract.ts +260 -222
- package/src/networks/ethereum/ethereum.ts +121 -104
- package/src/networks/ethereum/types.ts +17 -2
- package/src/networks/solana/clients/deposit.client.ts +294 -65
- package/src/networks/solana/clients/distribution.client.ts +13 -18
- package/src/networks/solana/clients/leaderboard.client.ts +9 -11
- package/src/networks/solana/clients/outpost.client.ts +11 -10
- package/src/networks/solana/clients/token.client.ts +11 -13
- package/src/networks/solana/constants.ts +44 -285
- package/src/networks/solana/program.ts +365 -26
- package/src/networks/solana/solana.ts +213 -69
- package/src/networks/solana/types.ts +4 -4
- package/src/networks/solana/utils.ts +16 -301
- package/src/staker.ts +11 -2
- package/src/types.ts +19 -6
- /package/src/assets/ethereum/{ABI → mainnet}/common/Base58.sol/Base58.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/Base58.sol/Base58.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/OpenZepArtifacts.sol/__Dummy_OZ_UUPS__.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/OpenZepArtifacts.sol/__Dummy_OZ_UUPS__.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/RestrictedCallers.sol/RestrictedCallers.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/RestrictedCallers.sol/RestrictedCallers.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/iodata.sol/iodata.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/iodata.sol/iodata.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/iodata_util.sol/iodata_util.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/iodata_util.sol/iodata_util.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_data.sol/sysio_data.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_data.sol/sysio_data.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_errors.sol/sysio_errors.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_errors.sol/sysio_errors.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_merkle.sol/sysio_merkle.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_merkle.sol/sysio_merkle.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_name.sol/sysio_name.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_name.sol/sysio_name.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_pubkey.sol/sysio_pubkey.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_pubkey.sol/sysio_pubkey.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_read.sol/sysio_read.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_read.sol/sysio_read.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_tester.sol/SysioTester.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_tester.sol/SysioTester.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_verify.sol/sysio_verify.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_verify.sol/sysio_verify.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_write.sol/sysio_write.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/common/sysio_write.sol/sysio_write.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/BeaconState.sol/BeaconState.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/BeaconState.sol/BeaconState.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/DepositManager.sol/DepositManager.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/DepositManager.sol/DepositManager.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthAuthority.sol/LiqEthAuthority.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthAuthority.sol/LiqEthAuthority.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IAccounting.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IAccounting.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositContract.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositContract.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositManager.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IDepositManager.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/ILiqEthUpgradeable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/ILiqEthUpgradeable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20Pausable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IRewardsERC20Pausable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IStakingModule.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IStakingModule.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IWithdrawalRecord.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/IWithdrawalRecord.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/LiqEthCommon.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthCommon.sol/LiqEthCommon.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthManaged.sol/LiqEthManaged.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/LiqEthManaged.sol/LiqEthManaged.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20.sol/RewardsERC20Upgradeable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20.sol/RewardsERC20Upgradeable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20Pausable.sol/RewardsERC20PausableUpgradeable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/RewardsERC20Pausable.sol/RewardsERC20PausableUpgradeable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/Yield.sol/YieldOracle.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/Yield.sol/YieldOracle.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/accounting.sol/Accounting.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/accounting.sol/Accounting.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/liqEth.sol/LiqEthToken.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/liqEth.sol/LiqEthToken.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/stakingModule.sol/StakingModule.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/stakingModule.sol/StakingModule.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalQueue.sol/WithdrawalQueue.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalQueue.sol/WithdrawalQueue.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/Uint64BE.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/Uint64BE.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/WithdrawalVault.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/liqEth/withdrawalVault.sol/WithdrawalVault.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Aggregator.sol/Aggregator.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/BAR.sol/BAR.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/BAR.sol/BAR.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Depositor.sol/Depositor.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Depositor.sol/Depositor.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPP.sol/OPP.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPP.sol/OPP.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPP.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPP.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPEndpoint.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPEndpoint.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPInbound.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPInbound.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPReceiver.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPReceiver.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPSender.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/IOPPSender.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/OPPCommon.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPCommon.sol/OPPCommon.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpoint.sol/OPPEndpoint.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpoint.sol/OPPEndpoint.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPErrors.sol/OPPErrors.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPErrors.sol/OPPErrors.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPInbound.sol/OPPInbound.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPInbound.sol/OPPInbound.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPReceiver.sol/OPPReceiver.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPReceiver.sol/OPPReceiver.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPSender.sol/OPPSender.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OPPSender.sol/OPPSender.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostErrors.sol/OutpostErrors.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostErrors.sol/OutpostErrors.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManaged.sol/OutpostManaged.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManaged.sol/OutpostManaged.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManager.sol/OutpostManager.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManager.sol/OutpostManager.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostManager.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostManager.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostOwnable.sol/OutpostOwnable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/OutpostOwnable.sol/OutpostOwnable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pool.sol/Pool.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pool.sol/Pool.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pretoken.sol/Pretoken.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/Pretoken.sol/Pretoken.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/ReceiptNFT.sol/ReceiptNFT.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/ReceiptNFT.sol/ReceiptNFT.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IPretoken.sol/IPretoken.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IPretoken.sol/IPretoken.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IWarrant.sol/IWarrant.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/interfaces/IWarrant.sol/IWarrant.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC1155Token.sol/ERC1155Token.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC1155Token.sol/ERC1155Token.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC20Token.sol/ERC20Token.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC20Token.sol/ERC20Token.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC721Token.sol/ERC721Token.dbg.json +0 -0
- /package/src/assets/ethereum/{ABI → mainnet}/token/ERC721Token.sol/ERC721Token.json +0 -0
- /package/src/assets/solana/{idl → devnet/idl}/liqsol_core.json +0 -0
- /package/src/assets/solana/{idl → devnet/idl}/liqsol_token.json +0 -0
- /package/src/assets/solana/{idl → devnet/idl}/transfer_hook.json +0 -0
- /package/src/assets/solana/{idl → devnet/idl}/validator_leaderboard.json +0 -0
- /package/src/assets/solana/{types → devnet/types}/liqsol_core.ts +0 -0
- /package/src/assets/solana/{types → devnet/types}/liqsol_token.ts +0 -0
- /package/src/assets/solana/{types → devnet/types}/transfer_hook.ts +0 -0
- /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/
|
|
9
|
-
import DepositManagerArtifact from '../../assets/ethereum/
|
|
10
|
-
import LiqEthArtifact from '../../assets/ethereum/
|
|
11
|
-
import StakingModuleArtifact from '../../assets/ethereum/
|
|
12
|
-
import WithdrawalQueueArtifact from '../../assets/ethereum/
|
|
13
|
-
import WithdrawalVaultArtifact from '../../assets/ethereum/
|
|
14
|
-
import BeaconStateArtifact from '../../assets/ethereum/
|
|
15
|
-
import YieldOracleArtifact from '../../assets/ethereum/
|
|
16
|
-
|
|
17
|
-
// Outpost Artifacts
|
|
18
|
-
import DepositorArtifact from '../../assets/ethereum/
|
|
19
|
-
import ReceiptNFTArtifact from '../../assets/ethereum/
|
|
20
|
-
import OutpostManagerArtifact from '../../assets/ethereum/
|
|
21
|
-
import BARArtifact from '../../assets/ethereum/
|
|
22
|
-
import OPPArtifact from '../../assets/ethereum/
|
|
23
|
-
import OPPCommonArtifact from '../../assets/ethereum/
|
|
24
|
-
import OPPInboundArtifact from '../../assets/ethereum/
|
|
25
|
-
import PretokenArtifact from '../../assets/ethereum/
|
|
26
|
-
import AggregatorArtifact from '../../assets/ethereum/
|
|
27
|
-
import EthUsdPriceConsumerArtifact from '../../assets/ethereum/
|
|
28
|
-
import PoolArtifact from '../../assets/ethereum/
|
|
29
|
-
import OutpostManagerAuthorityArtifact from '../../assets/ethereum/
|
|
30
|
-
|
|
31
|
-
// Common Artifacts
|
|
32
|
-
import IodataArtifact from '../../assets/ethereum/
|
|
33
|
-
import Base58Artifact from '../../assets/ethereum/
|
|
34
|
-
import sysio_merkleArtifact from '../../assets/ethereum/
|
|
35
|
-
import sysio_writeArtifact from '../../assets/ethereum/
|
|
36
|
-
|
|
37
|
-
// ERC Token Artifacts
|
|
38
|
-
import ERC20Artifact from '../../assets/ethereum/
|
|
39
|
-
import ERC721Artifact from '../../assets/ethereum/
|
|
40
|
-
import ERC1155Artifact from '../../assets/ethereum/
|
|
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
|
|
54
|
+
// Address books (per-chain)
|
|
53
55
|
// -----------------------------------------------------------------------------
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// YieldOracle:
|
|
101
|
-
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
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
|
|
123
|
-
|
|
124
|
-
|
|
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
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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(
|
|
258
|
-
const { address, abi } =
|
|
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
|
|
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 } =
|
|
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 } =
|
|
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(
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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(
|
|
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);
|