From 35dc6f2688345af255ebf80b7d4f17987a25bd5b Mon Sep 17 00:00:00 2001 From: Daniel McCartney Date: Sat, 19 Oct 2024 03:17:28 -0700 Subject: [PATCH] feat: add /nodeset with basic info --- web/src/App.js | 2 + web/src/components/NodeSetIcon.js | 12 + web/src/components/WalletChip.js | 5 +- web/src/contracts.js | 20 + .../contracts/OperatorDistributor.json | 724 +++++++++ .../generated/contracts/SuperNodeAccount.json | 911 +++++++++++ web/src/generated/contracts/WETH.json | 282 ++++ web/src/generated/contracts/WETHVault.json | 1409 +++++++++++++++++ web/src/hooks/useBlock.js | 17 + web/src/pages/NodeSetPage.js | 476 ++++++ web/src/utils.js | 8 + 11 files changed, 3865 insertions(+), 1 deletion(-) create mode 100644 web/src/components/NodeSetIcon.js create mode 100644 web/src/generated/contracts/OperatorDistributor.json create mode 100644 web/src/generated/contracts/SuperNodeAccount.json create mode 100644 web/src/generated/contracts/WETH.json create mode 100644 web/src/generated/contracts/WETHVault.json create mode 100644 web/src/hooks/useBlock.js create mode 100644 web/src/pages/NodeSetPage.js diff --git a/web/src/App.js b/web/src/App.js index d8acdeb..8d4afc8 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -1,6 +1,7 @@ import { BrowserRouter, HashRouter, Route, Routes } from "react-router-dom"; import HomePage from "./pages/HomePage"; import NodePage from "./pages/NodePage"; +import NodeSetPage from "./pages/NodeSetPage"; import IntervalPage from "./pages/IntervalPage"; function Router({ children }) { @@ -21,6 +22,7 @@ function App() { exact element={} /> + } /> ); diff --git a/web/src/components/NodeSetIcon.js b/web/src/components/NodeSetIcon.js new file mode 100644 index 0000000..bc7a07d --- /dev/null +++ b/web/src/components/NodeSetIcon.js @@ -0,0 +1,12 @@ +import { SvgIcon } from "@mui/material"; + +export default function NodeSetIcon(props) { + return ( + + {/* from https://nodeset.io */} + + + + + ); +} diff --git a/web/src/components/WalletChip.js b/web/src/components/WalletChip.js index a00a3ed..1184b8b 100644 --- a/web/src/components/WalletChip.js +++ b/web/src/components/WalletChip.js @@ -21,7 +21,10 @@ export default function WalletChip({ }); return ( } component={href ? "a" : to ? Link : "div"} diff --git a/web/src/contracts.js b/web/src/contracts.js index db58e95..7905844 100644 --- a/web/src/contracts.js +++ b/web/src/contracts.js @@ -1,3 +1,4 @@ +import OperatorDistributor from "./generated/contracts/OperatorDistributor.json"; import RocketMerkleDistributorMainnet from "./generated/contracts/RocketMerkleDistributorMainnet.json"; import RocketMinipoolBase from "./generated/contracts/RocketMinipoolBase.json"; import RocketMinipoolDelegate from "./generated/contracts/RocketMinipoolDelegate.json"; @@ -7,11 +8,18 @@ import RocketNodeDistributorInterface from "./generated/contracts/RocketNodeDist import RocketNodeManager from "./generated/contracts/RocketNodeManager.json"; import RocketRewardsPool from "./generated/contracts/RocketRewardsPool.json"; import RocketStorageK from "./generated/contracts/RocketStorage.json"; +import SuperNodeAccount from "./generated/contracts/SuperNodeAccount.json"; +import WETH from "./generated/contracts/WETH.json"; +import WETHVault from "./generated/contracts/WETHVault.json"; // This names, locates, and defines the interface to the contracts we use. // The address can change during a rocketpool upgrade. The first `address` is the latest address. // But we hang onto the old addresses for things like searching all event logs. const contracts = { + OperatorDistributor: { + address: "0x102809fE582ecaa527bB316DCc4E99fc35FBAbb9", + abi: OperatorDistributor.abi, + }, RocketMerkleDistributorMainnet: { address: [ "0x5cE71E603B138F7e65029Cc1918C0566ed0dBD4B", @@ -64,6 +72,18 @@ const contracts = { address: "0x1d8f8f00cfa6758d7bE78336684788Fb0ee0Fa46", abi: RocketStorageK.abi, }, + SuperNodeAccount: { + address: "0x2A906f92B0378Bb19a3619E2751b1e0b8cab6B29", + abi: SuperNodeAccount.abi, + }, + WETH: { + address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + abi: WETH.abi, + }, + WETHVault: { + address: "0xbb22d59b73d7a6f3a8a83a214becc67eb3b511fe", + abi: WETHVault.abi, + }, }; // TODO: consider pulling addresses/abi from on-chain like this: diff --git a/web/src/generated/contracts/OperatorDistributor.json b/web/src/generated/contracts/OperatorDistributor.json new file mode 100644 index 0000000..b3faa3a --- /dev/null +++ b/web/src/generated/contracts/OperatorDistributor.json @@ -0,0 +1,724 @@ +{ + "contractName": "OperatorDistributor", + "abi": [ + { + "inputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "LowLevelEthTransfer", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldRatio", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newRatio", + "type": "uint256" + } + ], + "name": "MinStakeRatioUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minipool", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ethRewards", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bool", + "name": "finalized", + "type": "bool" + } + ], + "name": "MinipoolProcessed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "isAllowed", + "type": "bool" + } + ], + "name": "MinipoolProcessingEnabledChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "isAllowed", + "type": "bool" + } + ], + "name": "RPLStakeRebalanceEnabledChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "minipool", + "type": "address" + } + ], + "name": "SuspectedPenalizedMinipoolExit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldRatio", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newRatio", + "type": "uint256" + } + ], + "name": "TargetStakeRatioUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_minipool", + "type": "address" + } + ], + "name": "WarningEthBalanceSmallerThanRefundBalance", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_minipoolAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum MinipoolStatus", + "name": "_status", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "bool", + "name": "_isFinalized", + "type": "bool" + } + ], + "name": "WarningMinipoolNotStaking", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "WarningNoMiniPoolsToHarvest", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_existingRplStake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_ethStaked", + "type": "uint256" + } + ], + "name": "calculateRequiredRplTopDown", + "outputs": [ + { + "internalType": "uint256", + "name": "withdrawableStakeRpl", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_existingRplStake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_rpEthMatched", + "type": "uint256" + } + ], + "name": "calculateRplStakeShortfall", + "outputs": [ + { + "internalType": "uint256", + "name": "requiredStakeRpl", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IMinipool", + "name": "minipool", + "type": "address" + } + ], + "name": "distributeExitedMinipool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getDirectory", + "outputs": [ + { + "internalType": "contract Directory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextMinipool", + "outputs": [ + { + "internalType": "contract IMinipool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextMinipoolIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTvlEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTvlRpl", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_directory", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastProcessedMinipoolIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumStakeRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minipoolProcessingEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "rewardAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "avgTreasuryFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "avgOperatorsFee", + "type": "uint256" + } + ], + "name": "onEthBeaconRewardsReceived", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "onIncreaseOracleError", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "oracleError", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IMinipool", + "name": "minipool", + "type": "address" + } + ], + "name": "processMinipool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "processNextMinipool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_ethStaked", + "type": "uint256" + } + ], + "name": "rebalanceRplStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rebalanceRplVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rebalanceWethVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "resetOracleError", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rplStakeRebalanceEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sendEthForMinipool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minimumStakeRatio", + "type": "uint256" + } + ], + "name": "setMinimumStakeRatio", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_newValue", + "type": "bool" + } + ], + "name": "setMinipoolProcessingEnabled", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_newValue", + "type": "bool" + } + ], + "name": "setRplStakeRebalanceEnabled", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_targetStakeRatio", + "type": "uint256" + } + ], + "name": "setTargetStakeRatio", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "stakeRpl", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "rewardIndex", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amountRPL", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amountETH", + "type": "uint256[]" + }, + { + "internalType": "bytes32[][]", + "name": "merkleProof", + "type": "bytes32[][]" + } + ], + "name": "submitMerkleClaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "targetStakeRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "ethAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rplAmount", + "type": "uint256" + } + ], + "name": "transferMerkleClaimToStreamer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "unstakeRpl", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ] +} diff --git a/web/src/generated/contracts/SuperNodeAccount.json b/web/src/generated/contracts/SuperNodeAccount.json new file mode 100644 index 0000000..6836df1 --- /dev/null +++ b/web/src/generated/contracts/SuperNodeAccount.json @@ -0,0 +1,911 @@ +{ + "contractName": "SuperNodeAccount", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bool", + "name": "oldValue", + "type": "bool" + }, + { + "indexed": true, + "internalType": "bool", + "name": "newValue", + "type": "bool" + } + ], + "name": "AdminServerCheckChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bool", + "name": "oldValue", + "type": "bool" + }, + { + "indexed": true, + "internalType": "bool", + "name": "newValue", + "type": "bool" + } + ], + "name": "AllowSubNodeOperatorDelegateChangesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "oldValue", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "BondChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "oldLockThreshold", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "newLockThreshold", + "type": "uint256" + } + ], + "name": "LockThresholdChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "oldValue", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "MaxValidatorsChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "oldValue", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "MinimumNodeFeeChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minipoolAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operatorAddress", + "type": "address" + } + ], + "name": "MinipoolCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minipoolAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operatorAddress", + "type": "address" + } + ], + "name": "MinipoolDestroyed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minipoolAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operatorAddress", + "type": "address" + } + ], + "name": "MinipoolStaked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "__subNodeOperatorMinipools__", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "adminServerCheck", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "allowSubOpDelegateChanges", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "minipoolAddress", + "type": "address" + } + ], + "name": "closeDissolvedMinipool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "validatorPubkey", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "validatorSignature", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "depositDataRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "salt", + "type": "uint256" + }, + { + "internalType": "address", + "name": "expectedMinipoolAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct SuperNodeAccount.CreateMinipoolConfig", + "name": "_config", + "type": "tuple" + } + ], + "name": "createMinipool", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "getDirectory", + "outputs": [ + { + "internalType": "contract Directory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getEthMatched", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getEthStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "minipool", + "type": "address" + } + ], + "name": "getIsMinipoolRecognized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_subNodeOperator", + "type": "address" + } + ], + "name": "getMinipoolCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_subNodeOperator", + "type": "address" + } + ], + "name": "getMinipools", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNumMinipools", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRplStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_bond", + "type": "uint256" + } + ], + "name": "hasSufficientLiquidity", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_directory", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "invalidateAllOutstandingSigs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_nodeOperator", + "type": "address" + } + ], + "name": "invalidateSingleOustandingSig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lazyInitialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lockThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "lockedEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxValidators", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumNodeFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "minipoolData", + "outputs": [ + { + "internalType": "address", + "name": "subNodeOperator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "ethTreasuryFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "noFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_minipool", + "type": "address" + } + ], + "name": "minipoolDelegateRollback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_minipool", + "type": "address" + } + ], + "name": "minipoolDelegateUpgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "minipools", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "minipool", + "type": "address" + } + ], + "name": "removeMinipool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "newValue", + "type": "bool" + } + ], + "name": "setAdminServerCheck", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "newValue", + "type": "bool" + } + ], + "name": "setAllowSubNodeOpDelegateChanges", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newBond", + "type": "uint256" + } + ], + "name": "setBond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newLockThreshold", + "type": "uint256" + } + ], + "name": "setLockAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxValidators", + "type": "uint256" + } + ], + "name": "setMaxValidators", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newMinimumNodeFee", + "type": "uint256" + } + ], + "name": "setMinimumNodeFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_useSmoothingPool", + "type": "bool" + } + ], + "name": "setSmoothingPoolParticipation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_setting", + "type": "bool" + }, + { + "internalType": "address", + "name": "_minipool", + "type": "address" + } + ], + "name": "setUseLatestMinipoolDelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_validatorSignature", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "_depositDataRoot", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_minipool", + "type": "address" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ] +} diff --git a/web/src/generated/contracts/WETH.json b/web/src/generated/contracts/WETH.json new file mode 100644 index 0000000..77f1757 --- /dev/null +++ b/web/src/generated/contracts/WETH.json @@ -0,0 +1,282 @@ +{ + "contractName": "WETH", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "guy", + "type": "address" + }, + { + "name": "wad", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "src", + "type": "address" + }, + { + "name": "dst", + "type": "address" + }, + { + "name": "wad", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "wad", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dst", + "type": "address" + }, + { + "name": "wad", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "src", + "type": "address" + }, + { + "indexed": true, + "name": "guy", + "type": "address" + }, + { + "indexed": false, + "name": "wad", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "src", + "type": "address" + }, + { + "indexed": true, + "name": "dst", + "type": "address" + }, + { + "indexed": false, + "name": "wad", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "dst", + "type": "address" + }, + { + "indexed": false, + "name": "wad", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "src", + "type": "address" + }, + { + "indexed": false, + "name": "wad", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + } + ] +} diff --git a/web/src/generated/contracts/WETHVault.json b/web/src/generated/contracts/WETHVault.json new file mode 100644 index 0000000..516bcec --- /dev/null +++ b/web/src/generated/contracts/WETHVault.json @@ -0,0 +1,1409 @@ +{ + "contractName": "WETHVault", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bool", + "name": "oldValue", + "type": "bool" + }, + { + "indexed": true, + "internalType": "bool", + "name": "newValue", + "type": "bool" + } + ], + "name": "DepositsEnabledChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bool", + "name": "oldValue", + "type": "bool" + }, + { + "indexed": true, + "internalType": "bool", + "name": "newValue", + "type": "bool" + } + ], + "name": "DifferingSenderRecipientEnabledChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "oldValue", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "MaxWethRplRatioChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "oldValue", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "MintFeeChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "oldValue", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "NodeOperatorFeeChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "oldValue", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "TreasuryFeeChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "oldValue", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "WETHLiquidityReservePercentChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "asset", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "convertToAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "convertToShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "depositsEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "differingSenderRecipientEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "getAdditionalMintFeeToReceive", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDirectory", + "outputs": [ + { + "internalType": "contract Directory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDistributableYield", + "outputs": [ + { + "internalType": "uint256", + "name": "distributableYield", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "signed", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "income", + "type": "uint256" + } + ], + "name": "getIncomeAfterFees", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "getIsDepositAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "getIsWithdrawAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaximumDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaximumWithdrawAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "getMintFeePortion", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMissingLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "deposit", + "type": "uint256" + } + ], + "name": "getMissingLiquidityAfterDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "deposit", + "type": "uint256" + } + ], + "name": "getMissingLiquidityAfterDepositNoFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "getOperatorPortion", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "getTreasuryPortion", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "directoryAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "directoryAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "weth", + "type": "address" + } + ], + "name": "initializeVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidityReservePercent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "maxRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxWethRplRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "maxWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "mintFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nodeOperatorFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "previewDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "previewMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "previewRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "previewWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_newValue", + "type": "bool" + } + ], + "name": "setDepositsEnabled", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_newValue", + "type": "bool" + } + ], + "name": "setDifferingSenderRecipientEnabled", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_liquidityReservePercent", + "type": "uint256" + } + ], + "name": "setLiquidityReservePercent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxWethRplRatio", + "type": "uint256" + } + ], + "name": "setMaxWethRplRatio", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMintFee", + "type": "uint256" + } + ], + "name": "setMintFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_nodeOperatorFee", + "type": "uint256" + } + ], + "name": "setNodeOperatorFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_nodeOperatorFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_treasuryFee", + "type": "uint256" + } + ], + "name": "setProtocolFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_treasuryFee", + "type": "uint256" + } + ], + "name": "setTreasuryFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "treasuryFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newDeposit", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isWeth", + "type": "bool" + } + ], + "name": "tvlRatioEthRpl", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/web/src/hooks/useBlock.js b/web/src/hooks/useBlock.js new file mode 100644 index 0000000..fe5ae8a --- /dev/null +++ b/web/src/hooks/useBlock.js @@ -0,0 +1,17 @@ +import { useClient } from "wagmi"; +import { useQuery } from "react-query"; + +export default function useBlock({ blockNumber }) { + const publicClient = useClient(); + + return useQuery( + ["useBlock", blockNumber], + async () => { + let provider = await publicClient.getProvider(); + return provider.getBlock(blockNumber); + }, + { + enabled: !!blockNumber || !!publicClient, + } + ); +} diff --git a/web/src/pages/NodeSetPage.js b/web/src/pages/NodeSetPage.js new file mode 100644 index 0000000..599cb59 --- /dev/null +++ b/web/src/pages/NodeSetPage.js @@ -0,0 +1,476 @@ +import Layout from "../components/Layout"; +import { + Avatar, + Box, + Button, + Card, + CardActionArea, + CardContent, + CardHeader, + Chip, + FormHelperText, + Grid, + Stack, + Typography, +} from "@mui/material"; +import useK from "../hooks/useK"; +import _ from "lodash"; +import WalletChip from "../components/WalletChip"; +import NodeSetIcon from "../components/NodeSetIcon"; +import CurrencyValue from "../components/CurrencyValue"; +import { ethers } from "ethers"; +import { etherscanUrl, shortenAddress } from "../utils"; +import { ExpandLess, ExpandMore } from "@mui/icons-material"; +import { useTransaction, useBalance } from "wagmi"; +import moment from "moment"; +import { useState } from "react"; +import contracts from "../contracts"; +import useBlock from "../hooks/useBlock"; +import { Link } from "react-router-dom"; + +export default function NodeSetPage() { + return ( + + + {/* TODO */} + {/**/} + {/* */} + {/**/} + + + + + + + + + ); +} + +function NodeDepositCard() { + let [isShowingAll, setShowingAll] = useState(false); + let { data: depositsInOrder } = useK.WETHVault.Find.Deposit({ + args: [null, null], + from: 0, + to: "latest", + }); + let { data: withdrawalsInOrder } = useK.WETHVault.Find.Withdraw({ + args: [null, null], + from: 0, + to: "latest", + }); + let { data: withdrawableETH } = useK.WETH.Read.balanceOf({ + args: [contracts.WETHVault.address], + }); + let { data: opBalance } = useBalance({ + address: contracts.OperatorDistributor.address, + }); + let deposits = _.reverse(_.clone(depositsInOrder || [])); + let withdrawals = _.reverse(_.clone(withdrawalsInOrder || [])); + let totalDepositedEth = deposits.reduce( + (sum, { args: [, , assets] }) => sum.add(assets), + ethers.BigNumber.from(0) + ); + let totalWithdrawnEth = withdrawals.reduce( + (sum, { args: [, , , assets] }) => sum.add(assets), + ethers.BigNumber.from(0) + ); + let minipoolCreatableEth = opBalance?.value; + return ( + + + + } + subheader="NodeSet xrETH Deposits" + /> + + + + {" "} + deposits from{" "} + senderAddress) + ).length + } + />{" "} + depositors. + + + + + + Deposits + + + + + + + + withdrawn + + + + + + + + Available + + + + + for minipools + + + + + + for withdraw + + + + + + + + + + + {deposits + .slice(0, isShowingAll ? deposits.length : 5) + .map(({ transactionHash, args: [senderAddress, , amountEth] }) => ( + + + } + subheader={ + + deposited + + } + action={ + + + + + } + /> + + + ))} + {deposits.length > 0 && ( + + )} + + + ); +} + +function NodeSetWalletChip({ walletAddress }) { + return ( + + + + + + + ); +} + +function NodeSetMiniPoolsCard() { + let [isShowingAll, setShowingAll] = useState(false); + let { data: minipoolsInOrder } = useK.SuperNodeAccount.Find.MinipoolCreated({ + args: [null, null], + from: 0, + to: "latest", + }); + let minipools = _.reverse(_.clone(minipoolsInOrder || [])); + let activeMinipools = minipools || []; + return ( + + + + } + subheader="NodeSet Minipools" + /> + + + + {" "} + minipools created across{" "} + operatorAddress + ) + ).length + } + />{" "} + operators. + + + + + + + from + + + rETH + + + deposits + + + + + + from + + + + + + deposits + + + + + + + + + {(minipools || []) + .slice(0, isShowingAll ? (minipools || []).length : 5) + .map( + ({ transactionHash, args: [minipoolAddress, operatorAddress] }) => ( + + + + + + } + subheader={ + + created minipool + + } + action={ + + + + + } + /> + + + ) + )} + {(minipools || []).length > 0 && ( + + )} + + + ); +} + +function TransactionTimeAgoCaption({ tx }) { + let { data: txn } = useTransaction({ hash: tx }); + let { data: block } = useBlock({ blockNumber: txn?.blockNumber }); + let txnAt = (block?.timestamp || 0) * 1000; + var label = ""; + if (!!block) { + label = moment(txnAt).fromNow(); + } + return ( + + {label} + + ); +} diff --git a/web/src/utils.js b/web/src/utils.js index 4954877..45b1d1b 100644 --- a/web/src/utils.js +++ b/web/src/utils.js @@ -12,6 +12,14 @@ export function shortenAddress(address, charCount = 4) { return `${a.substring(0, charCount + 2)}...${a.substring(42 - charCount)}`; } +// Trim the input hash to be "0x####...####" +export function shortenHash(hash, charCount = 4) { + const a = hash || "0x00000000"; + return `${a.substring(0, charCount + 2)}...${a.substring( + a.length - charCount + )}`; +} + // Sort BigNumber params `a` and `b` (for use in DataGrid sortComparator) export function BNSortComparator(a, b) { if (!a) {