Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitor v2 #8

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import './App.css';
import { React, useState, useEffect } from 'react';
import { getAllChains, getChainById } from './utils/chains';
import { Layout, Card, Space, List, ConfigProvider } from 'antd';
import { unitToEth } from './utils/ethersHelper';
import { unitToEth, unitToRtx } from './utils/ethersHelper';
import dayjs from "dayjs";
import relativeTime from 'dayjs/plugin/relativeTime';
import requests from './utils/requests';

dayjs.extend(relativeTime);

Expand Down Expand Up @@ -61,15 +62,17 @@ function App() {

const [submitionCount, setSubmitionCount] = useState({});
async function checkOracleSignerSubmition() {
console.log("===============checkOracleSignerSubmition");
const darwiniaChain = getChainById(46);
const subAPIMultisig = darwiniaChain.contract.signcribe;
const provider = new ethers.JsonRpcProvider(darwiniaChain.endpoint);
const finalized = await provider.getBlock("finalized");
console.log("finalized: ", finalized);
const logs = await provider.getLogs({
fromBlock: finalized.number - 1000,
fromBlock: finalized.number - 500,
toBlock: finalized.number,
address: subAPIMultisig,
topics: [ethers.id('SignatureSubmittion(uint256,uint256,address,bytes,bytes)')]
topics: [ethers.id('SignatureSubmittion(uint256,address,address,uint256,bytes,bytes)')]
})
console.log(logs);
const count = {};
Expand Down Expand Up @@ -132,12 +135,33 @@ function App() {
continue;
}
const operatorBalance = {};
const provider = new ethers.JsonRpcProvider(chain.endpoint);
let relayerBalance = await provider.getBalance(chain.operator.relayer);
operatorBalance.relayer = unitToEth(relayerBalance);
let oracleBalance = await provider.getBalance(chain.operator.oracle);
operatorBalance.oracle = unitToEth(oracleBalance);
operatorBalance.symbol = chain.symbol;

if (!chain.name.includes("tron")) {
const provider = new ethers.JsonRpcProvider(chain.endpoint);
let relayerBalance = await provider.getBalance(chain.operator.relayer);
operatorBalance.relayer = unitToEth(relayerBalance);
let oracleBalance = await provider.getBalance(chain.operator.oracle);
operatorBalance.oracle = unitToEth(oracleBalance);
operatorBalance.symbol = chain.symbol;
} else {
const relayerBalance = Number((await requests.post(chain.endpoint, {
"method": "eth_getBalance",
"params": [chain.operator.relayer, "latest"],
"id": "1",
"jsonrpc": "2.0"
})).result);
operatorBalance.relayer = unitToRtx(relayerBalance);

const oracleBalance = Number((await requests.post(chain.endpoint, {
"method": "eth_getBalance",
"params": [chain.operator.oracle, "latest"],
"id": "1",
"jsonrpc": "2.0"
})).result);
operatorBalance.oracle = unitToRtx(oracleBalance);
}


operatorInfo[chain.id] = operatorBalance;
console.log(operatorInfo);
setOperatorInfo({ ...operatorInfo });
Expand Down
292 changes: 153 additions & 139 deletions client/src/utils/chains.js
Original file line number Diff line number Diff line change
@@ -1,143 +1,157 @@
const Chains = [
{
"name": "crab",
"id": 44,
"endpoint": "https://crab-rpc.darwinia.network",
"indexer": {
"ormp": "https://thegraph-g2.darwinia.network/ormpipe/subgraphs/name/ormpipe-crab",
"signcribe": "https://thegraph-g2.darwinia.network/ormpipe/subgraphs/name/signcribe-darwinia"
},
"contract": {
"signcribe": "0x57dd62e0986a61a269c769b107a5a7952d73b7ed",
"relayer": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1",
"ormp": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"oracle": "0x0000000003ebeF32D8f0ED406a5CA8805c80AFba",
"multisig": "0x000000000d60704384100A29efb6C9cf8cD72820"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 100,
},
"symbol": "CRAB",
"scan": "https://crab.subscan.io",
},
{
"name": "darwinia",
"id": 46,
"endpoint": "https://rpc.darwinia.network",
"indexer": {
"ormp": "https://thegraph-g2.darwinia.network/ormpipe/subgraphs/name/ormpipe-darwinia",
"signcribe": "https://thegraph-g2.darwinia.network/ormpipe/subgraphs/name/signcribe-darwinia"
},
"contract": {
"signcribe": "0x57dd62e0986a61a269c769b107a5a7952d73b7ed",
"relayer": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1",
"ormp": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"oracle": "0x0000000003ebeF32D8f0ED406a5CA8805c80AFba",
"multisig": "0x000000000d60704384100A29efb6C9cf8cD72820"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 100,
},
"symbol": "RING",
"scan": "https://darwinia-evm.subscan.io",
},
{
"name": "arbitrum",
"id": 42161,
"endpoint": "https://arbitrum-one.publicnode.com",
"indexer": {
"ormp": "https://api.studio.thegraph.com/proxy/51152/ormpipe-arbitrum/version/latest",
"signcribe": "https://thegraph-g2.darwinia.network/ormpipe/subgraphs/name/signcribe-darwinia"
},
"contract": {
"signcribe": "0x57dd62e0986a61a269c769b107a5a7952d73b7ed",
"relayer": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1",
"ormp": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"oracle": "0x0000000003ebeF32D8f0ED406a5CA8805c80AFba",
"multisig": "0x000000000d60704384100A29efb6C9cf8cD72820"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 0.01,
},
"symbol": "AETH",
"scan": "https://arbiscan.io",
},
{
"name": "ethereum",
"id": 1,
"endpoint": "https://ethereum.publicnode.com",
"indexer": {
"ormp": "https://api.studio.thegraph.com/proxy/51152/ormpipe-ethereum/version/latest",
"signcribe": "https://thegraph-g2.darwinia.network/ormpipe/subgraphs/name/signcribe-darwinia"
},
"contract": {
"signcribe": "0x57dd62e0986a61a269c769b107a5a7952d73b7ed",
"relayer": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1",
"ormp": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"oracle": "0x0000000003ebeF32D8f0ED406a5CA8805c80AFba",
"multisig": "0x000000000d60704384100A29efb6C9cf8cD72820"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 0.02,
},
"symbol": "ETH",
"scan": "https://etherscan.io",
},
{
"name": "polygon",
"id": 137,
"endpoint": "https://polygon-bor-rpc.publicnode.com",
"indexer": {
"ormp": "https://api.studio.thegraph.com/proxy/51152/ormpipe-polygon/version/latest",
"signcribe": "https://thegraph-g2.darwinia.network/ormpipe/subgraphs/name/signcribe-darwinia"
},
"contract": {
"signcribe": "0x57dd62e0986a61a269c769b107a5a7952d73b7ed",
"relayer": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1",
"ormp": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"oracle": "0x0000000003ebeF32D8f0ED406a5CA8805c80AFba",
"multisig": "0x000000000d60704384100A29efb6C9cf8cD72820"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 0.1,
},
"symbol": "MATIC",
"scan": "https://polygonscan.com",
},
{
"name": "blast",
"id": 81457,
"endpoint": "https://rpc.blast.io",
"indexer": {
"ormp": "https://api.studio.thegraph.com/proxy/51152/ormpipe-blast/version/latest",
"signcribe": "https://thegraph-g2.darwinia.network/ormpipe/subgraphs/name/signcribe-darwinia"
},
"contract": {
"signcribe": "0x57dd62e0986a61a269c769b107a5a7952d73b7ed",
"relayer": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1",
"ormp": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"oracle": "0x0000000003ebeF32D8f0ED406a5CA8805c80AFba",
"multisig": "0x000000000d60704384100A29efb6C9cf8cD72820"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 0.01,
},
"symbol": "ETH",
"scan": "https://blastscan.io",
}
]
{
"name": "crab",
"id": 44,
"endpoint": "https://crab-rpc.darwinia.network",
"contract": {
"signcribe": "0x57aa601a0377f5ab313c5a955ee874f5d495fc92",
"relayer": "0xaC2b224c2E1eD2E8663097a361A05a72d6671C7D",
"ormp": "0xA72d283015c01807bc0788Bf22C1A774bDbFC8fA",
"oracle": "0x3f938756ceFa33665719Eb528E581FF3f460b7C6",
"multisig": "0x22117Db68370590c1031f52a6D1aDE3DCe0cCf9a"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 100,
},
"symbol": "CRAB",
"scan": "https://crab.subscan.io",
},
{
"name": "darwinia",
"id": 46,
"endpoint": "https://rpc.darwinia.network",
"contract": {
"signcribe": "0x57aa601a0377f5ab313c5a955ee874f5d495fc92",
"relayer": "0xaC2b224c2E1eD2E8663097a361A05a72d6671C7D",
"ormp": "0xA72d283015c01807bc0788Bf22C1A774bDbFC8fA",
"oracle": "0x3f938756ceFa33665719Eb528E581FF3f460b7C6",
"multisig": "0x22117Db68370590c1031f52a6D1aDE3DCe0cCf9a"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 100,
},
"symbol": "RING",
"scan": "https://darwinia.subscan.io",
},
{
"name": "arbitrum",
"id": 42161,
"endpoint": "https://arbitrum-one.publicnode.com",
"contract": {
"signcribe": "0x57aa601a0377f5ab313c5a955ee874f5d495fc92",
"relayer": "0xaC2b224c2E1eD2E8663097a361A05a72d6671C7D",
"ormp": "0xA72d283015c01807bc0788Bf22C1A774bDbFC8fA",
"oracle": "0x3f938756ceFa33665719Eb528E581FF3f460b7C6",
"multisig": "0x22117Db68370590c1031f52a6D1aDE3DCe0cCf9a"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 0.01,
},
"symbol": "AETH",
"scan": "https://arbiscan.io",
},
{
"name": "ethereum",
"id": 1,
"endpoint": "https://ethereum.publicnode.com",
"contract": {
"signcribe": "0x57aa601a0377f5ab313c5a955ee874f5d495fc92",
"relayer": "0xaC2b224c2E1eD2E8663097a361A05a72d6671C7D",
"ormp": "0xA72d283015c01807bc0788Bf22C1A774bDbFC8fA",
"oracle": "0x3f938756ceFa33665719Eb528E581FF3f460b7C6",
"multisig": "0x22117Db68370590c1031f52a6D1aDE3DCe0cCf9a"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 0.02,
},
"symbol": "ETH",
"scan": "https://etherscan.io",
},
{
"name": "polygon",
"id": 137,
"endpoint": "https://polygon-bor-rpc.publicnode.com",
"contract": {
"signcribe": "0x57aa601a0377f5ab313c5a955ee874f5d495fc92",
"relayer": "0xaC2b224c2E1eD2E8663097a361A05a72d6671C7D",
"ormp": "0xA72d283015c01807bc0788Bf22C1A774bDbFC8fA",
"oracle": "0x3f938756ceFa33665719Eb528E581FF3f460b7C6",
"multisig": "0x22117Db68370590c1031f52a6D1aDE3DCe0cCf9a"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 0.1,
},
"symbol": "MATIC",
"scan": "https://polygonscan.com",
},
{
"name": "blast",
"id": 81457,
"endpoint": "https://rpc.blast.io",
"contract": {
"signcribe": "0x57aa601a0377f5ab313c5a955ee874f5d495fc92",
"relayer": "0xaC2b224c2E1eD2E8663097a361A05a72d6671C7D",
"ormp": "0xA72d283015c01807bc0788Bf22C1A774bDbFC8fA",
"oracle": "0x3f938756ceFa33665719Eb528E581FF3f460b7C6",
"multisig": "0x22117Db68370590c1031f52a6D1aDE3DCe0cCf9a"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 0.01,
},
"symbol": "ETH",
"scan": "https://blastscan.io",
},
{
"name": "moonbeam",
"id": 1284,
"endpoint": "https://moonbeam-rpc.dwellir.com",
"contract": {
"signcribe": "0x57aa601a0377f5ab313c5a955ee874f5d495fc92",
"relayer": "0xaC2b224c2E1eD2E8663097a361A05a72d6671C7D",
"ormp": "0xA72d283015c01807bc0788Bf22C1A774bDbFC8fA",
"oracle": "0x3f938756ceFa33665719Eb528E581FF3f460b7C6",
"multisig": "0x22117Db68370590c1031f52a6D1aDE3DCe0cCf9a"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 10,
},
"symbol": "GLMR",
"scan": "https://moonbeam.subscan.io/",
},
{
"name": "tron",
"id": 728126428,
"endpoint": "https://api.trongrid.io/jsonrpc",
"contract": {
"signcribe": "0x57aa601a0377f5ab313c5a955ee874f5d495fc92",
"relayer": "0xDD9622309aa2798D74CD39C772D289dfe3EEdaD5",
"ormp": "0x152c6DdDD0A4cfD817af7Cf4cf5491D4AC44e886",
"oracle": "0xf7A4217c2c372E50c19fdF68D86b3C7E493d2d21",
"multisig": "0x7D2B4704d72A41817b06df3Bc813161A13550006"
},
"operator": {
"oracle": "0x178E699c9a6bB2Cd624557Fbd85ed219e6faBa77",
"relayer": "0x912D7601569cBc2DF8A7f0aaE50BFd18e8C64d05",
"warnBalance": 500,
},
"symbol": "TRX",
"scan": "https://tronscan.org/#",
}
]

function getChainById(id) {
for (const item of Chains) {
Expand Down
6 changes: 5 additions & 1 deletion client/src/utils/ethersHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ function unitToEth(num) {
return Number(num) / Math.pow(10, 18);
}

export { unitToEth }
function unitToRtx(num) {
return Number(num) / Math.pow(10, 6);
}

export { unitToEth, unitToRtx }
Loading
Loading