@wireio/stake 0.4.3 → 0.5.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 +12682 -6721
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +158 -13
- package/lib/stake.js +12356 -6388
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +12682 -6721
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/ethereum/ABI/common/Base58.sol/Base58.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/Base58.sol/Base58.json +164 -0
- package/src/assets/ethereum/ABI/common/OpenZepArtifacts.sol/__Dummy_OZ_UUPS__.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/OpenZepArtifacts.sol/__Dummy_OZ_UUPS__.json +76 -0
- package/src/assets/ethereum/ABI/common/RestrictedCallers.sol/RestrictedCallers.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/RestrictedCallers.sol/RestrictedCallers.json +10 -0
- package/src/assets/ethereum/ABI/common/iodata.sol/iodata.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/iodata.sol/iodata.json +618 -0
- package/src/assets/ethereum/ABI/common/iodata_util.sol/iodata_util.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/iodata_util.sol/iodata_util.json +40 -0
- package/src/assets/ethereum/ABI/common/sysio_data.sol/sysio_data.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/sysio_data.sol/sysio_data.json +10 -0
- package/src/assets/ethereum/ABI/common/sysio_errors.sol/sysio_errors.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/sysio_errors.sol/sysio_errors.json +10 -0
- package/src/assets/ethereum/ABI/common/sysio_merkle.sol/sysio_merkle.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/sysio_merkle.sol/sysio_merkle.json +233 -0
- package/src/assets/ethereum/ABI/common/sysio_name.sol/sysio_name.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/sysio_name.sol/sysio_name.json +49 -0
- package/src/assets/ethereum/ABI/common/sysio_pubkey.sol/sysio_pubkey.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/sysio_pubkey.sol/sysio_pubkey.json +64 -0
- package/src/assets/ethereum/ABI/common/sysio_read.sol/sysio_read.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/sysio_read.sol/sysio_read.json +1458 -0
- package/src/assets/ethereum/ABI/common/sysio_tester.sol/SysioTester.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/sysio_tester.sol/SysioTester.json +1532 -0
- package/src/assets/ethereum/ABI/common/sysio_verify.sol/sysio_verify.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/sysio_verify.sol/sysio_verify.json +1525 -0
- package/src/assets/ethereum/ABI/common/sysio_write.sol/sysio_write.dbg.json +4 -0
- package/src/assets/ethereum/ABI/common/sysio_write.sol/sysio_write.json +1076 -0
- package/src/assets/ethereum/ABI/liqEth/BeaconState.sol/BeaconState.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.json +28 -2
- package/src/assets/ethereum/ABI/liqEth/LiqEthAuthority.sol/LiqEthAuthority.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IAccounting.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositContract.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositManager.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthUpgradeable.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IRewardsERC20.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IRewardsERC20Pausable.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IStakingModule.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IWithdrawalRecord.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/LiqEthCommon.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/LiqEthManaged.sol/LiqEthManaged.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/RewardsERC20.sol/RewardsERC20Upgradeable.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/RewardsERC20Pausable.sol/RewardsERC20PausableUpgradeable.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.json +2 -2
- package/src/assets/ethereum/ABI/liqEth/accounting.sol/Accounting.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/accounting.sol/Accounting.json +2 -15
- package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.json +6 -25
- package/src/assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/Uint64BE.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/Uint64BE.json +2 -2
- package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.json +6 -25
- package/src/assets/ethereum/ABI/outpost/BAR.sol/BAR.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.json +26 -26
- package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPP.sol/OPP.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPP.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPEndpoint.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPInbound.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPReceiver.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPSender.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/OPPCommon.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPEndpoint.sol/OPPEndpoint.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPErrors.sol/OPPErrors.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPInbound.sol/OPPInbound.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPReceiver.sol/OPPReceiver.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OPPSender.sol/OPPSender.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OutpostErrors.sol/OutpostErrors.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OutpostManaged.sol/OutpostManaged.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OutpostManager.sol/OutpostManager.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostManager.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OutpostOwnable.sol/OutpostOwnable.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.json +2 -2
- package/src/assets/ethereum/ABI/outpost/Pretoken.sol/Pretoken.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Pretoken.sol/Pretoken.json +9 -9
- package/src/assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/interfaces/IPretoken.sol/IPretoken.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/interfaces/IWarrant.sol/IWarrant.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.dbg.json +1 -1
- package/src/networks/ethereum/clients/convert.client.ts +2 -2
- package/src/networks/ethereum/clients/pretoken.client.ts +6 -4
- package/src/networks/ethereum/clients/stake.client.ts +2 -2
- package/src/networks/ethereum/contract.ts +102 -49
- package/src/networks/ethereum/ethereum.ts +64 -52
- package/src/networks/ethereum/types.ts +26 -17
- package/src/networks/ethereum/utils.ts +8 -8
- package/src/networks/solana/clients/distribution.client.ts +36 -1
- package/src/networks/solana/solana.ts +131 -7
- package/src/networks/solana/types.ts +129 -0
- package/src/types.ts +6 -2
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/BeaconRoots.dbg.json +0 -4
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/BeaconRoots.json +0 -10
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZ.dbg.json +0 -4
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZ.json +0 -10
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZExtras.dbg.json +0 -4
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZExtras.json +0 -10
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZVec48.dbg.json +0 -4
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZVec48.json +0 -10
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/ValidatorBalanceVerifier.dbg.json +0 -4
- package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/ValidatorBalanceVerifier.json +0 -291
- package/src/assets/ethereum/ABI/outpost/Aggregator.sol/Aggregator.json +0 -82
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides a unified service for interacting with Ethereum smart contracts using ethers.js.
|
|
5
5
|
*/
|
|
6
|
+
|
|
7
|
+
// LiqETH Artifacts
|
|
6
8
|
import AccountingArtifact from '../../assets/ethereum/ABI/liqEth/accounting.sol/Accounting.json';
|
|
7
9
|
import DepositManagerArtifact from '../../assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.json';
|
|
8
10
|
import LiqEthArtifact from '../../assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.json';
|
|
9
11
|
import StakingModuleArtifact from '../../assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.json';
|
|
10
12
|
import WithdrawalQueueArtifact from '../../assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.json';
|
|
11
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';
|
|
12
16
|
|
|
13
17
|
// Outpost Artifacts
|
|
14
18
|
import DepositorArtifact from '../../assets/ethereum/ABI/outpost/Depositor.sol/Depositor.json';
|
|
@@ -19,10 +23,18 @@ import OPPArtifact from '../../assets/ethereum/ABI/outpost/OPP.sol/OPP.json';
|
|
|
19
23
|
import OPPCommonArtifact from '../../assets/ethereum/ABI/outpost/OPPCommon.sol/OPPCommon.json';
|
|
20
24
|
import OPPInboundArtifact from '../../assets/ethereum/ABI/outpost/OPPInbound.sol/OPPInbound.json';
|
|
21
25
|
import PretokenArtifact from '../../assets/ethereum/ABI/outpost/Pretoken.sol/Pretoken.json';
|
|
22
|
-
import AggregatorArtifact from '../../assets/ethereum/ABI/outpost/
|
|
26
|
+
import AggregatorArtifact from '../../assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.json';
|
|
23
27
|
import EthUsdPriceConsumerArtifact from '../../assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.json';
|
|
24
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';
|
|
25
36
|
|
|
37
|
+
// ERC Token Artifacts
|
|
26
38
|
import ERC20Artifact from '../../assets/ethereum/ABI/token/ERC20Token.sol/ERC20Token.json';
|
|
27
39
|
import ERC721Artifact from '../../assets/ethereum/ABI/token/ERC721Token.sol/ERC721Token.json';
|
|
28
40
|
import ERC1155Artifact from '../../assets/ethereum/ABI/token/ERC1155Token.sol/ERC1155Token.json';
|
|
@@ -43,25 +55,33 @@ export const ERC1155Abi = ERC1155Artifact.abi;
|
|
|
43
55
|
// Make sure ContractName in ./types includes all of these keys.
|
|
44
56
|
export const ADDRESSES: AddressBook = {
|
|
45
57
|
// LiqETH contracts
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
LiqEthAuthority: "0x9686E04F30Fa93496B7d7fE0FBc2e4e0aD52891E",
|
|
59
|
+
BeaconState: "0x207b249d7a83F6E9FCa04a1CD9b484D4f4f9aD2D",
|
|
60
|
+
WithdrawalQueue: "0x9a575c7Acce9e616cD07A0BDb2D28866027b75Ae",
|
|
61
|
+
LiqEthToken: "0x5f7192fa756304b255F6F9C1123426Db6A1Db748",
|
|
62
|
+
Accounting: "0xBAbAd5219f022B29282b904ceEaeBB7ab1b069fC",
|
|
63
|
+
DepositManager: "0x2e1986508472805c1649e4BBB424879B89720741",
|
|
64
|
+
WithdrawalVault: "0xC82FAf3Fed135B70A7E797864F504819a98E96c4",
|
|
65
|
+
StakingModule: "0xdd24EffAa4B42f3273E2b44995639119c08daBea",
|
|
66
|
+
YieldOracle: "0x56A27E1d10d4aEc7402dC26693fb7c0Eb66eF802",
|
|
52
67
|
|
|
53
68
|
//Outpost contracts
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
OutpostManagerAuthority: "0xAEcd2aa6EeFa4Aa7Cb9368728aA89Ca59Aa9ea59",
|
|
70
|
+
iodata: "0x2c2ab53F6Bc146bd31B459E832Ce0B9Da78712d8",
|
|
71
|
+
Base58: "0x9F188Ec124c9ad9bF6D195650d8360Fd052F585A",
|
|
72
|
+
sysio_merkle: "0x6eDA3C4c34421Cd667800C17fe33E48f5698e004",
|
|
73
|
+
ReceiptNFT: "0xd083051d9bb8353875abCecAB50C6e4FB5e527a8",
|
|
74
|
+
MockAggregator: "0xD721d15Ae1D1bF58DF1B9471198d968A16B8e58D",
|
|
75
|
+
Pool: "0xee5F11aC9b104c18d2423f266c5E737fC95ebA92",
|
|
76
|
+
OutpostManager: "0xB1B6ba7FA156652849069aC7ADB281283D235B9f",
|
|
77
|
+
sysio_write: "0xEfA608136d372349C09a7aA57665C09Fb4a620Ca",
|
|
78
|
+
EthUsdPriceConsumer: "0x6337A23b61f98b1526faF2848385Abe9cB4cFF21",
|
|
79
|
+
BAR: "0x9264eAA449da94caF70Fc18522021a94C8DF32Fb",
|
|
80
|
+
OPPCommon: "0x86A8cA16ce521De3EBdd1C541fAf188795b59FD0",
|
|
81
|
+
OPP: "0x79e8395Bb5131FB285aCEE5329BB43E66f50F88C",
|
|
82
|
+
Pretoken: "0x62f98AF2f9C3EF4eF2fA7bc0245BD5a9315E7541",
|
|
83
|
+
OPPInbound: "0xC85f57Ff069711e0b3472De3963bd2fC2FEfF3e2",
|
|
84
|
+
Depositor: "0xb0BACAb6f13dd96281300be13a6346461b2f35F3"
|
|
65
85
|
};
|
|
66
86
|
|
|
67
87
|
export type Contracts<T extends string = ContractName> = Record<T, ContractConfig>;
|
|
@@ -76,76 +96,109 @@ export type ContractConfig = {
|
|
|
76
96
|
// -----------------------------------------------------------------------------
|
|
77
97
|
|
|
78
98
|
export const CONTRACTS: Contracts<ContractName> = {
|
|
99
|
+
// LiqETH Contracts
|
|
100
|
+
LiqEthAuthority: {
|
|
101
|
+
address: ADDRESSES.LiqEthAuthority,
|
|
102
|
+
abi: LiqEthArtifact.abi as JsonFragment[],
|
|
103
|
+
},
|
|
104
|
+
BeaconState: {
|
|
105
|
+
address: ADDRESSES.BeaconState,
|
|
106
|
+
abi: BeaconStateArtifact.abi as JsonFragment[]
|
|
107
|
+
},
|
|
108
|
+
WithdrawalQueue: {
|
|
109
|
+
address: ADDRESSES.WithdrawalQueue,
|
|
110
|
+
abi: WithdrawalQueueArtifact.abi as JsonFragment[],
|
|
111
|
+
},
|
|
112
|
+
LiqEthToken: {
|
|
113
|
+
address: ADDRESSES.LiqEthToken,
|
|
114
|
+
abi: LiqEthArtifact.abi as JsonFragment[],
|
|
115
|
+
},
|
|
79
116
|
Accounting: {
|
|
80
117
|
address: ADDRESSES.Accounting,
|
|
81
118
|
abi: AccountingArtifact.abi as JsonFragment[],
|
|
82
119
|
},
|
|
83
|
-
LiqEth: {
|
|
84
|
-
address: ADDRESSES.LiqEth,
|
|
85
|
-
abi: LiqEthArtifact.abi as JsonFragment[],
|
|
86
|
-
},
|
|
87
120
|
DepositManager: {
|
|
88
121
|
address: ADDRESSES.DepositManager,
|
|
89
122
|
abi: DepositManagerArtifact.abi as JsonFragment[],
|
|
90
123
|
},
|
|
124
|
+
WithdrawalVault: {
|
|
125
|
+
address: ADDRESSES.WithdrawalVault,
|
|
126
|
+
abi: WithdrawalVaultArtifact.abi as JsonFragment[],
|
|
127
|
+
},
|
|
91
128
|
StakingModule: {
|
|
92
129
|
address: ADDRESSES.StakingModule,
|
|
93
130
|
abi: StakingModuleArtifact.abi as JsonFragment[],
|
|
94
131
|
},
|
|
95
|
-
|
|
96
|
-
address: ADDRESSES.
|
|
97
|
-
abi:
|
|
98
|
-
},
|
|
99
|
-
WithdrawalVault: {
|
|
100
|
-
address: ADDRESSES.WithdrawalVault,
|
|
101
|
-
abi: WithdrawalVaultArtifact.abi as JsonFragment[],
|
|
132
|
+
YieldOracle: {
|
|
133
|
+
address: ADDRESSES.YieldOracle,
|
|
134
|
+
abi: YieldOracleArtifact.abi as JsonFragment[],
|
|
102
135
|
},
|
|
103
136
|
|
|
104
137
|
// Outpost Contracts
|
|
105
|
-
|
|
106
|
-
address: ADDRESSES.
|
|
107
|
-
abi:
|
|
138
|
+
OutpostManagerAuthority: {
|
|
139
|
+
address: ADDRESSES.OutpostManagerAuthority,
|
|
140
|
+
abi: OutpostManagerAuthorityArtifact.abi as JsonFragment[],
|
|
141
|
+
},
|
|
142
|
+
iodata: {
|
|
143
|
+
address: ADDRESSES.iodata,
|
|
144
|
+
abi: IodataArtifact.abi as JsonFragment[],
|
|
145
|
+
},
|
|
146
|
+
Base58: {
|
|
147
|
+
address: ADDRESSES.Base58,
|
|
148
|
+
abi: Base58Artifact.abi as JsonFragment[],
|
|
149
|
+
},
|
|
150
|
+
sysio_merkle: {
|
|
151
|
+
address: ADDRESSES.sysio_merkle,
|
|
152
|
+
abi: sysio_merkleArtifact.abi as JsonFragment[],
|
|
108
153
|
},
|
|
109
154
|
ReceiptNFT: {
|
|
110
155
|
address: ADDRESSES.ReceiptNFT,
|
|
111
156
|
abi: ReceiptNFTArtifact.abi as JsonFragment[],
|
|
112
157
|
},
|
|
158
|
+
MockAggregator: {
|
|
159
|
+
address: ADDRESSES.MockAggregator,
|
|
160
|
+
abi: AggregatorArtifact.abi as JsonFragment[],
|
|
161
|
+
},
|
|
162
|
+
Pool: {
|
|
163
|
+
address: ADDRESSES.Pool,
|
|
164
|
+
abi: PoolArtifact.abi as JsonFragment[],
|
|
165
|
+
},
|
|
113
166
|
OutpostManager: {
|
|
114
167
|
address: ADDRESSES.OutpostManager,
|
|
115
168
|
abi: OutpostManagerArtifact.abi as JsonFragment[],
|
|
116
169
|
},
|
|
170
|
+
sysio_write: {
|
|
171
|
+
address: ADDRESSES.sysio_write,
|
|
172
|
+
abi: sysio_writeArtifact.abi as JsonFragment[],
|
|
173
|
+
},
|
|
174
|
+
EthUsdPriceConsumer: {
|
|
175
|
+
address: ADDRESSES.EthUsdPriceConsumer,
|
|
176
|
+
abi: EthUsdPriceConsumerArtifact.abi as JsonFragment[],
|
|
177
|
+
},
|
|
117
178
|
BAR: {
|
|
118
179
|
address: ADDRESSES.BAR,
|
|
119
180
|
abi: BARArtifact.abi as JsonFragment[],
|
|
120
181
|
},
|
|
121
|
-
OPP: {
|
|
122
|
-
address: ADDRESSES.OPP,
|
|
123
|
-
abi: OPPArtifact.abi as JsonFragment[],
|
|
124
|
-
},
|
|
125
182
|
OPPCommon: {
|
|
126
183
|
address: ADDRESSES.OPPCommon,
|
|
127
184
|
abi: OPPCommonArtifact.abi as JsonFragment[],
|
|
128
185
|
},
|
|
129
|
-
|
|
130
|
-
address: ADDRESSES.
|
|
131
|
-
abi:
|
|
186
|
+
OPP: {
|
|
187
|
+
address: ADDRESSES.OPP,
|
|
188
|
+
abi: OPPArtifact.abi as JsonFragment[],
|
|
132
189
|
},
|
|
133
190
|
Pretoken: {
|
|
134
191
|
address: ADDRESSES.Pretoken,
|
|
135
192
|
abi: PretokenArtifact.abi as JsonFragment[],
|
|
136
193
|
},
|
|
137
|
-
|
|
138
|
-
address: ADDRESSES.
|
|
139
|
-
abi:
|
|
194
|
+
OPPInbound: {
|
|
195
|
+
address: ADDRESSES.OPPInbound,
|
|
196
|
+
abi: OPPInboundArtifact.abi as JsonFragment[],
|
|
140
197
|
},
|
|
141
|
-
|
|
142
|
-
address: ADDRESSES.
|
|
143
|
-
abi:
|
|
198
|
+
Depositor: {
|
|
199
|
+
address: ADDRESSES.Depositor,
|
|
200
|
+
abi: DepositorArtifact.abi as JsonFragment[],
|
|
144
201
|
},
|
|
145
|
-
Pool: {
|
|
146
|
-
address: ADDRESSES.Pool,
|
|
147
|
-
abi: PoolArtifact.abi as JsonFragment[],
|
|
148
|
-
}
|
|
149
202
|
};
|
|
150
203
|
|
|
151
204
|
export interface ContractOptions {
|
|
@@ -165,7 +165,7 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
165
165
|
const nativeSymbol = this.network?.nativeCurrency?.symbol ?? 'ETH';
|
|
166
166
|
|
|
167
167
|
// 2) liqETH ERC-20 balance (actual)
|
|
168
|
-
const liqBalance: ethers.BigNumber = await this.contract.
|
|
168
|
+
const liqBalance: ethers.BigNumber = await this.contract.LiqEthToken.balanceOf(walletAddress);
|
|
169
169
|
const liqSymbol = 'Liq' + (this.network?.nativeCurrency?.symbol ?? 'ETH');
|
|
170
170
|
|
|
171
171
|
// 3) staked liqEth ERC-20 balance (calculate from receipts)
|
|
@@ -304,7 +304,7 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
async getEthStats(): Promise<any> {
|
|
307
|
-
let withdrawDelay = await this.contract.
|
|
307
|
+
let withdrawDelay = await this.contract.WithdrawalQueue.withdrawDelay();
|
|
308
308
|
let minDeposit = await this.contract.DepositManager.minDeposit();
|
|
309
309
|
let rewardCooldown = await this.contract.DepositManager.rewardCooldown();
|
|
310
310
|
|
|
@@ -332,55 +332,67 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
332
332
|
} = options ?? {};
|
|
333
333
|
|
|
334
334
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
335
|
+
try {
|
|
336
|
+
|
|
337
|
+
const blockNumber = await this.provider.getBlockNumber();
|
|
338
|
+
const blockTag = { blockTag: blockNumber };
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
// Fetch all required contract data
|
|
342
|
+
const [totalSharesBn, indexBn, trancheNumberBn, trancheSupplyBn, tranchePriceWadBn, totalSupplyBn, supplyGrowthBps, priceIncrementUsd, minPriceUsd, maxPriceUsd] = await Promise.all([
|
|
343
|
+
this.contract.Depositor.totalShares(blockTag),
|
|
344
|
+
this.contract.Depositor.index(blockTag),
|
|
345
|
+
this.contract.Pretoken.trancheNumber(blockTag),
|
|
346
|
+
this.contract.Pretoken.trancheSupply(blockTag),
|
|
347
|
+
this.contract.Pretoken.tranchePriceUsd(blockTag),
|
|
348
|
+
this.contract.Pretoken.totalSupply(blockTag),
|
|
349
|
+
this.contract.Pretoken.supplyGrowthBps(blockTag),
|
|
350
|
+
this.contract.Pretoken.priceIncrementUsd(blockTag),
|
|
351
|
+
this.contract.EthUsdPriceConsumer.MIN_PRICE(),
|
|
352
|
+
this.contract.EthUsdPriceConsumer.MAX_PRICE(),
|
|
353
|
+
]);
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
const totalTrancheSupply = BigInt(totalSupplyBn.toString()) / BigInt(1e10);
|
|
357
|
+
const currentTrancheSupply = BigInt(trancheSupplyBn.toString()) / BigInt(1e10);
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
// fetch price and timestamp from aggregator
|
|
361
|
+
const [roundId, answer, startedAt, updatedAt, answeredInRound] = await this.contract.MockAggregator.latestRoundData();
|
|
362
|
+
let ethPriceUsd: bigint = BigInt(answer.toString());
|
|
363
|
+
let nativePriceTimestamp: number = Number(updatedAt);
|
|
364
|
+
|
|
365
|
+
// ! Placeholder from hoodi deployment - don't think this can be fetched dynamically
|
|
366
|
+
const initialTrancheSupply = BigInt(70000) * BigInt(1e8);
|
|
367
|
+
|
|
368
|
+
console.log('priceIncrementUsd',priceIncrementUsd);
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
return buildEthereumTrancheSnapshot({
|
|
372
|
+
chainID,
|
|
373
|
+
totalSharesBn,
|
|
374
|
+
indexBn,
|
|
375
|
+
trancheNumberBn,
|
|
376
|
+
currentTrancheSupply,
|
|
377
|
+
tranchePriceWadBn,
|
|
378
|
+
totalTrancheSupply,
|
|
379
|
+
initialTrancheSupply,
|
|
380
|
+
supplyGrowthBps,
|
|
381
|
+
priceIncrementUsd,
|
|
382
|
+
minPriceUsd,
|
|
383
|
+
maxPriceUsd,
|
|
384
|
+
|
|
385
|
+
ethPriceUsd,
|
|
386
|
+
nativePriceTimestamp,
|
|
387
|
+
ladderWindowBefore: windowBefore,
|
|
388
|
+
ladderWindowAfter: windowAfter,
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
catch (err: any) {
|
|
392
|
+
console.log(err);
|
|
393
|
+
|
|
394
|
+
throw new Error(`Error fetching Ethereum tranche snapshot: ${err?.message || err}`);
|
|
395
|
+
}
|
|
384
396
|
}
|
|
385
397
|
|
|
386
398
|
// ---------------------------------------------------------------------
|
|
@@ -389,7 +401,7 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
389
401
|
|
|
390
402
|
// ! This is a temporary measure for Hoodi testnet because there is no aggregator deployed
|
|
391
403
|
private async updateMockAggregatorPrice() {
|
|
392
|
-
const aggregator = this.contract.
|
|
404
|
+
const aggregator = this.contract.MockAggregator;
|
|
393
405
|
|
|
394
406
|
// read latest round & compute age
|
|
395
407
|
const [roundId, answer, startedAt, updatedAt, answeredInRound] = await aggregator.latestRoundData();
|
|
@@ -2,25 +2,34 @@ import { BigNumber, ethers } from 'ethers';
|
|
|
2
2
|
import { BalanceView } from '../../types';
|
|
3
3
|
|
|
4
4
|
export const CONTRACT_NAMES = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
// LiqETH contracts
|
|
6
|
+
"LiqEthAuthority",
|
|
7
|
+
"BeaconState",
|
|
8
|
+
"WithdrawalQueue",
|
|
9
|
+
"LiqEthToken",
|
|
10
|
+
"Accounting",
|
|
11
|
+
"DepositManager",
|
|
12
|
+
"WithdrawalVault",
|
|
13
|
+
"StakingModule",
|
|
14
|
+
"YieldOracle",
|
|
11
15
|
|
|
12
16
|
//Outpost contracts
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
"OutpostManagerAuthority",
|
|
18
|
+
"iodata",
|
|
19
|
+
"Base58",
|
|
20
|
+
"sysio_merkle",
|
|
21
|
+
"ReceiptNFT",
|
|
22
|
+
"MockAggregator",
|
|
23
|
+
"Pool",
|
|
24
|
+
"OutpostManager",
|
|
25
|
+
"sysio_write",
|
|
26
|
+
"EthUsdPriceConsumer",
|
|
27
|
+
"BAR",
|
|
28
|
+
"OPPCommon",
|
|
29
|
+
"OPP",
|
|
30
|
+
"Pretoken",
|
|
31
|
+
"OPPInbound",
|
|
32
|
+
"Depositor",
|
|
24
33
|
|
|
25
34
|
] as const;
|
|
26
35
|
|
|
@@ -157,7 +157,7 @@ export function buildEthereumTrancheLadder(options: {
|
|
|
157
157
|
currentTrancheSupply: bigint;
|
|
158
158
|
currentPriceUsd: bigint;
|
|
159
159
|
supplyGrowthBps: number;
|
|
160
|
-
|
|
160
|
+
priceIncrementUsd: number;
|
|
161
161
|
windowBefore?: number;
|
|
162
162
|
windowAfter?: number;
|
|
163
163
|
}): TrancheLadderItem[] {
|
|
@@ -167,7 +167,7 @@ export function buildEthereumTrancheLadder(options: {
|
|
|
167
167
|
currentTrancheSupply,
|
|
168
168
|
currentPriceUsd,
|
|
169
169
|
supplyGrowthBps,
|
|
170
|
-
|
|
170
|
+
priceIncrementUsd,
|
|
171
171
|
windowBefore = 5,
|
|
172
172
|
windowAfter = 5,
|
|
173
173
|
} = options;
|
|
@@ -190,7 +190,7 @@ export function buildEthereumTrancheLadder(options: {
|
|
|
190
190
|
const prevCap = capacity.get(id - 1)!;
|
|
191
191
|
const prevPrice = price.get(id - 1)!;
|
|
192
192
|
capacity.set(id, growOnce(prevCap, supplyGrowthBps));
|
|
193
|
-
price.set(id, growOnce(prevPrice,
|
|
193
|
+
price.set(id, growOnce(prevPrice, priceIncrementUsd));
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
// Backward (past tranches)
|
|
@@ -198,7 +198,7 @@ export function buildEthereumTrancheLadder(options: {
|
|
|
198
198
|
const nextCap = capacity.get(id + 1)!;
|
|
199
199
|
const nextPrice = price.get(id + 1)!;
|
|
200
200
|
capacity.set(id, shrinkOnce(nextCap, supplyGrowthBps));
|
|
201
|
-
price.set(id, shrinkOnce(nextPrice,
|
|
201
|
+
price.set(id, shrinkOnce(nextPrice, priceIncrementUsd));
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
const ladder: TrancheLadderItem[] = [];
|
|
@@ -240,7 +240,7 @@ export async function buildEthereumTrancheSnapshot(options: {
|
|
|
240
240
|
totalTrancheSupply;
|
|
241
241
|
initialTrancheSupply;
|
|
242
242
|
supplyGrowthBps;
|
|
243
|
-
|
|
243
|
+
priceIncrementUsd;
|
|
244
244
|
minPriceUsd;
|
|
245
245
|
maxPriceUsd;
|
|
246
246
|
|
|
@@ -264,7 +264,7 @@ export async function buildEthereumTrancheSnapshot(options: {
|
|
|
264
264
|
totalTrancheSupply,
|
|
265
265
|
initialTrancheSupply,
|
|
266
266
|
supplyGrowthBps,
|
|
267
|
-
|
|
267
|
+
priceIncrementUsd,
|
|
268
268
|
minPriceUsd,
|
|
269
269
|
maxPriceUsd,
|
|
270
270
|
} = options;
|
|
@@ -284,7 +284,7 @@ export async function buildEthereumTrancheSnapshot(options: {
|
|
|
284
284
|
currentTrancheSupply,
|
|
285
285
|
currentPriceUsd,
|
|
286
286
|
supplyGrowthBps,
|
|
287
|
-
|
|
287
|
+
priceIncrementUsd,
|
|
288
288
|
windowBefore: ladderWindowBefore,
|
|
289
289
|
windowAfter: ladderWindowAfter,
|
|
290
290
|
});
|
|
@@ -297,7 +297,7 @@ export async function buildEthereumTrancheSnapshot(options: {
|
|
|
297
297
|
currentTranche,
|
|
298
298
|
currentPriceUsd,
|
|
299
299
|
supplyGrowthBps,
|
|
300
|
-
|
|
300
|
+
priceIncrementUsd,
|
|
301
301
|
currentTrancheSupply,
|
|
302
302
|
initialTrancheSupply,
|
|
303
303
|
totalPretokensSold: totalTrancheSupply,
|
|
@@ -5,10 +5,12 @@ import { SolanaProgramService } from '../program';
|
|
|
5
5
|
import type { LiqsolCore } from '../../../assets/solana/types/liqsol_core';
|
|
6
6
|
import {
|
|
7
7
|
deriveDistributionStatePda,
|
|
8
|
+
deriveGlobalConfigPda,
|
|
8
9
|
deriveLiqsolMintPda,
|
|
10
|
+
derivePayRateHistoryPda,
|
|
9
11
|
deriveUserRecordPda,
|
|
10
12
|
} from '../constants';
|
|
11
|
-
import type { DistributionState, DistributionUserRecord } from '../types';
|
|
13
|
+
import type { DistributionState, DistributionUserRecord, GlobalConfig, PayRateHistory } from '../types';
|
|
12
14
|
import { getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID } from '@solana/spl-token';
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -55,6 +57,39 @@ export class DistributionClient {
|
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Fetch the global payRateHistory account (circular buffer of scaled pay rates).
|
|
63
|
+
*
|
|
64
|
+
* IDL account name: "payRateHistory"
|
|
65
|
+
*/
|
|
66
|
+
async getPayRateHistory(): Promise<PayRateHistory | null> {
|
|
67
|
+
const pda = derivePayRateHistoryPda();
|
|
68
|
+
try {
|
|
69
|
+
// Anchor types map directly onto our PayRateHistory TS type
|
|
70
|
+
return (await this.program.account.payRateHistory.fetch(
|
|
71
|
+
pda,
|
|
72
|
+
)) as PayRateHistory;
|
|
73
|
+
} catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Fetch the globalConfig account (contains depositFeeMultiplier, etc).
|
|
80
|
+
*
|
|
81
|
+
* IDL account name: "globalConfig"
|
|
82
|
+
*/
|
|
83
|
+
async getGlobalConfig(): Promise<GlobalConfig | null> {
|
|
84
|
+
const pda = deriveGlobalConfigPda();
|
|
85
|
+
try {
|
|
86
|
+
return (await this.program.account.globalConfig.fetch(
|
|
87
|
+
pda,
|
|
88
|
+
));
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
58
93
|
/**
|
|
59
94
|
* Fetch a user's distribution userRecord (or null if missing).
|
|
60
95
|
*
|