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

Add heartbeat #104

Merged
merged 12 commits into from
Nov 26, 2021
126 changes: 100 additions & 26 deletions packages/api/src/dataFeeds.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"label": "$",
"pollingPeriod": 1500000,
"color": "#8d5fd3",
"blockExplorer": "https://etherscan.io/address/{address}"
"blockExplorer": "https://etherscan.io/address/{address}",
"deviation": 2,
"heartbeat": 87300000
},
{
"feedFullName": "ethereum-mainnet_eth-usd_6",
Expand All @@ -19,7 +21,9 @@
"label": "$",
"pollingPeriod": 1500000,
"color": "#8d5fd3",
"blockExplorer": "https://etherscan.io/address/{address}"
"blockExplorer": "https://etherscan.io/address/{address}",
"deviation": 3.5,
"heartbeat": 87300000
},
{
"feedFullName": "ethereum-rinkeby_btc-usd_6",
Expand All @@ -30,7 +34,9 @@
"label": "$",
"pollingPeriod": 1500000,
"color": "#00d4aa",
"blockExplorer": "https://rinkeby.etherscan.io/address/{address}"
"blockExplorer": "https://rinkeby.etherscan.io/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "ethereum-rinkeby_eth-usd_6",
Expand All @@ -41,7 +47,9 @@
"label": "$",
"pollingPeriod": 1500000,
"color": "#00d4aa",
"blockExplorer": "https://rinkeby.etherscan.io/address/{address}"
"blockExplorer": "https://rinkeby.etherscan.io/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "ethereum-goerli_btc-usd_6",
Expand All @@ -52,7 +60,9 @@
"label": "$",
"pollingPeriod": 1500000,
"color": "#ff5599",
"blockExplorer": "https://goerli.etherscan.io/address/{address}"
"blockExplorer": "https://goerli.etherscan.io/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "ethereum-goerli_eth-usd_6",
Expand All @@ -63,7 +73,9 @@
"label": "$",
"pollingPeriod": 1500000,
"color": "#ff5599",
"blockExplorer": "https://goerli.etherscan.io/address/{address}"
"blockExplorer": "https://goerli.etherscan.io/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "conflux-testnet_cfx-usdt_6",
Expand All @@ -74,7 +86,9 @@
"label": "₮",
"pollingPeriod": 300000,
"color": "#6600ff",
"blockExplorer": "https://testnet.confluxscan.io/address/{address}"
"blockExplorer": "https://testnet.confluxscan.io/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "conflux-testnet_btc-usd_6",
Expand All @@ -85,7 +99,9 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#6600ff",
"blockExplorer": "https://testnet.confluxscan.io/address/{address}"
"blockExplorer": "https://testnet.confluxscan.io/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "conflux-testnet_btc-usd_6",
Expand All @@ -96,7 +112,9 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#6600ff",
"blockExplorer": "https://testnet.confluxscan.io/address/{address}"
"blockExplorer": "https://testnet.confluxscan.io/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "conflux-testnet_eth-usd_6",
Expand All @@ -107,7 +125,9 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#6600ff",
"blockExplorer": "https://testnet.confluxscan.io/address/{address}"
"blockExplorer": "https://testnet.confluxscan.io/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "conflux-mainnet_cfx-usdt_6",
Expand All @@ -118,7 +138,9 @@
"label": "₮",
"pollingPeriod": 300000,
"color": "#6600ff",
"blockExplorer": "https://confluxscan.io/address/{address}"
"blockExplorer": "https://confluxscan.io/address/{address}",
"deviation": 1,
"heartbeat": 87300000
},
{
"feedFullName": "conflux-mainnet_btc-usd_6",
Expand All @@ -129,7 +151,9 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#6600ff",
"blockExplorer": "https://confluxscan.io/address/{address}"
"blockExplorer": "https://confluxscan.io/address/{address}",
"deviation": 1,
"heartbeat": 87300000
},
{
"feedFullName": "conflux-mainnet_eth-usd_6",
Expand All @@ -140,7 +164,9 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#6600ff",
"blockExplorer": "https://confluxscan.io/address/{address}"
"blockExplorer": "https://confluxscan.io/address/{address}",
"deviation": 1,
"heartbeat": 87300000
},
{
"feedFullName": "celo-alfajores_btc-usd_6",
Expand All @@ -151,7 +177,9 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#1cd8d2",
"blockExplorer": "https://alfajores-blockscout.celo-testnet.org/address/{address}"
"blockExplorer": "https://alfajores-blockscout.celo-testnet.org/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "celo-alfajores_eth-usd_6",
Expand All @@ -162,7 +190,9 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#1cd8d2",
"blockExplorer": "https://alfajores-blockscout.celo-testnet.org/address/{address}"
"blockExplorer": "https://alfajores-blockscout.celo-testnet.org/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "celo-alfajores_celo-usd_6",
Expand All @@ -173,18 +203,22 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#1cd8d2",
"blockExplorer": "https://alfajores-blockscout.celo-testnet.org/address/{address}"
"blockExplorer": "https://alfajores-blockscout.celo-testnet.org/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "celo-alfajores_celo-eur_6",
"abi": "./src/abi/PriceFeed.json",
"address": "0x9627CB0314368BC70587912119a4F03Ba0b179B5",
"network": "celo-alfajores",
"name": "celo/eur",
"label": "$",
"label": "",
"pollingPeriod": 300000,
"color": "#1cd8d2",
"blockExplorer": "https://alfajores-blockscout.celo-testnet.org/address/{address}"
"blockExplorer": "https://alfajores-blockscout.celo-testnet.org/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "celo-mainnet_btc-usd_6",
Expand All @@ -195,7 +229,9 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#ff8100",
"blockExplorer": "https://explorer.celo.org/address/{address}"
"blockExplorer": "https://explorer.celo.org/address/{address}",
"deviation": 1,
"heartbeat": 8100000
},
{
"feedFullName": "celo-mainnet_eth-usd_6",
Expand All @@ -206,7 +242,35 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#ff8100",
"blockExplorer": "https://explorer.celo.org/address/{address}"
"blockExplorer": "https://explorer.celo.org/address/{address}",
"deviation": 1,
"heartbeat": 8100000
},
{
"feedFullName": "celo-mainnet_celo-eur_6",
"abi": "./src/abi/PriceFeed.json",
"address": "0xdDBf8eBC2C5435bf2251611466b45bf625a6E1DB",
"network": "celo-mainnet",
"name": "celo/eur",
"label": "€",
"pollingPeriod": 300000,
"color": "#ff8100",
"blockExplorer": "https://explorer.celo.org/address/{address}",
"deviation": 1,
"heartbeat": 8100000
},
{
"feedFullName": "celo-mainnet_celo-usd_6",
"abi": "./src/abi/PriceFeed.json",
"address": "0x45EE6664E3be238C3ebC0462e0750e103ff6F24E",
"network": "celo-mainnet",
"name": "celo/usd",
"label": "$",
"pollingPeriod": 300000,
"color": "#ff8100",
"blockExplorer": "https://explorer.celo.org/address/{address}",
"deviation": 1,
"heartbeat": 8100000
},
{
"feedFullName": "boba-rinkeby_btc-usd_6",
Expand All @@ -217,7 +281,9 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#1cd83d",
"blockExplorer": "https://blockexplorer.rinkeby.boba.network/address/{address}"
"blockExplorer": "https://blockexplorer.rinkeby.boba.network/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "boba-rinkeby_eth-usd_6",
Expand All @@ -228,7 +294,9 @@
"label": "$",
"pollingPeriod": 300000,
"color": "#1cd83d",
"blockExplorer": "https://blockexplorer.rinkeby.boba.network/address/{address}"
"blockExplorer": "https://blockexplorer.rinkeby.boba.network/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "boba-rinkeby_omg-btc_9",
Expand All @@ -239,18 +307,22 @@
"label": "₿",
"pollingPeriod": 300000,
"color": "#1cd83d",
"blockExplorer": "https://blockexplorer.rinkeby.boba.network/address/{address}"
"blockExplorer": "https://blockexplorer.rinkeby.boba.network/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "boba-rinkeby_omg-eth_9",
"abi": "./src/abi/PriceFeed.json",
"address": "0x225BAd150B9D5202DC805B34A0DF64B1a77459dF",
"network": "boba-rinkeby",
"name": "omg/eth",
"label": "ETH",
"label": "Ξ",
"pollingPeriod": 300000,
"color": "#1cd83d",
"blockExplorer": "https://blockexplorer.rinkeby.boba.network/address/{address}"
"blockExplorer": "https://blockexplorer.rinkeby.boba.network/address/{address}",
"deviation": 1,
"heartbeat": 4500000
},
{
"feedFullName": "boba-rinkeby_omg-usdt_6",
Expand All @@ -261,6 +333,8 @@
"label": "₮",
"pollingPeriod": 300000,
"color": "#1cd83d",
"blockExplorer": "https://blockexplorer.rinkeby.boba.network/address/{address}"
"blockExplorer": "https://blockexplorer.rinkeby.boba.network/address/{address}",
"deviation": 1,
"heartbeat": 4500000
}
]
4 changes: 3 additions & 1 deletion packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ function validateDataFeeds (dataFeeds: Array<FeedInfoConfig>) {
'name',
'pollingPeriod',
'color',
'blockExplorer'
'blockExplorer',
'deviation',
'heartbeat'
]

dataFeeds.forEach((feedInfoConfig, index) => {
Expand Down
6 changes: 6 additions & 0 deletions packages/api/src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ const resolvers = {
},
blockExplorer: async (parent, _args, { config }: Context) => {
return config[parent.feedFullName]?.blockExplorer || ''
},
deviation: async (parent, _args, { config }: Context) => {
return config[parent.feedFullName]?.deviation || ''
},
heartbeat: async (parent, _args, { config }: Context) => {
return config[parent.feedFullName]?.heartbeat || ''
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/api/src/typeDefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const typeDefs = gql`
name: String! @column
network: String! @column
lastResult: String
deviation: String!
heartbeat: String!
requests(timestamp: Int!): [ResultRequest]!
}

Expand Down
2 changes: 2 additions & 0 deletions packages/api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export type FeedInfoGeneric<ABI> = {
label: string
color: string
blockExplorer: string
deviation: string
heartbeat: string
}
export type FeedInfo = FeedInfoGeneric<Array<AbiItem>>
export type FeedInfoConfig = FeedInfoGeneric<string>
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/apollo/queries/feed.gql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ query feed($feedFullName: String!, $timestamp: Int!) {
lastResult
network
label
deviation
heartbeat
requests(timestamp: $timestamp) {
feedFullName
result
Expand Down
Loading