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

refactor: updated the staging jobs with fixes and new data feeds #83

4 changes: 2 additions & 2 deletions test/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const weiToEther = (weiValue) => {

const decodeUniswapV2Data = (data, returnType) => {
// Check if data can be converted into a number
if (!isNaN(Number(data))) {
if (typeof data === "number") {
return Number(data);
}

Expand All @@ -48,7 +48,7 @@ const decodeUniswapV2Data = (data, returnType) => {
if (returnType === "hex") {
// Convert hex to number and return
return Number(data);
} else if (returnType === "hexArray") {
} else if (returnType.startsWith("hexArray")) {
const match = returnType.match(/\[(\d+)\]/);
const index = match ? parseInt(match[1], 10) : null;
if (index !== null) {
Expand Down
22 changes: 11 additions & 11 deletions testnet/collections.json
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
[
{
"jobIDs": [1, 2, 3, 5, 6, 8, 9, 24],
"jobIDs": [1, 2, 3, 5, 6, 7, 8, 10],
"aggregationMethod": 2,
"power": 2,
"name": "ethCollectionMedian",
"tolerance": 500000
},
{
"jobIDs": [10, 11, 58],
"jobIDs": [11, 12, 13, 14, 15],
"aggregationMethod": 2,
"power": 8,
"name": "RAZORUSD",
"tolerance": 500000
},
{
"jobIDs": [13, 15, 16],
"jobIDs": [16, 17, 18],
"aggregationMethod": 2,
"power": 2,
"name": "UFTUSD",
"tolerance": 500000
},
{
"jobIDs": [18, 19, 20, 21, 23],
"jobIDs": [19, 20, 21, 22, 23, 24, 25],
"aggregationMethod": 2,
"power": 2,
"name": "BTCUSD",
"tolerance": 500000
},
{
"jobIDs": [25, 26, 27],
"jobIDs": [26, 27, 28, 29],
"aggregationMethod": 2,
"power": 5,
"name": "USDCUSD",
"tolerance": 500000
},
{
"jobIDs": [28, 29, 30],
"jobIDs": [30, 31, 32, 33],
"aggregationMethod": 2,
"power": 5,
"name": "USDTUSD",
"tolerance": 500000
},
{
"jobIDs": [31, 32, 33, 34, 35, 36],
"jobIDs": [34, 35, 36, 37, 38, 39],
"aggregationMethod": 2,
"power": 4,
"name": "MATICUSD",
"tolerance": 500000
},
{
"jobIDs": [38, 39, 40, 41, 42],
"jobIDs": [40, 41, 42, 43, 44, 45],
"aggregationMethod": 2,
"power": 4,
"name": "GRTUSD",
"tolerance": 500000
},
{
"jobIDs": [44, 45, 46],
"jobIDs": [46, 47, 48, 49],
"aggregationMethod": 2,
"power": 4,
"name": "ARBUSD",
"tolerance": 500000
},
{
"jobIDs": [48, 49, 50, 51],
"jobIDs": [50, 51, 52, 53, 54],
"aggregationMethod": 2,
"power": 4,
"name": "SOLUSD",
"tolerance": 500000
},
{
"jobIDs": [52, 53, 54, 57],
"jobIDs": [55, 56, 57, 58, 59, 60],
"aggregationMethod": 2,
"power": 6,
"name": "SKALEUSD",
Expand Down
164 changes: 86 additions & 78 deletions testnet/jobs.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@
"selector": "/html/body/div[5]/div[5]/div[1]/div/div[1]/div[3]/div/div[1]/span[1]/span",
"url": "https://www.coingecko.com/en/coins/ethereum"
},
{
"weight": 1,
"power": 2,
"selectorType": 0,
"name": "ethusd_binance",
"selector": "price",
"url": "https://api.binance.com/api/v3/avgPrice?symbol=ETHBUSD"
},
{
"weight": 1,
"power": 2,
Expand All @@ -60,48 +52,72 @@
"power": 2,
"selectorType": 0,
"name": "ethusd_bitfinex",
"selector": "[0]",
"url": "https://api-pub.bitfinex.com/v2/ticker/tETHUSD"
"selector": "last_price",
"url": "https://api.bitfinex.com/v1/pubticker/ethusd"
},
{
"weight": 1,
"power": 2,
"selectorType": 0,
"name": "ethusd_cryptocompare",
"selector": "[USD]",
"selector": "USD",
"url": "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD"
},
{
"weight": 1,
"power": 2,
"power": -4,
"selectorType": 0,
"name": "razorusd_cryptocompare",
"selector": "[USD]",
"url": "https://min-api.cryptocompare.com/data/price?fsym=RAZOR&tsyms=USD"
"name": "ethusd_postJob",
"selector": "result",
"url": "{\"type\": \"POST\",\"url\": \"https://rpc.ankr.com/eth\",\"body\": {\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"0xb27308f9f90d607463bb33ea1bebb41c27ce5ab6\",\"data\":\"0xf7729d43000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000\"}],\"id\":5},\"header\": {\"content-type\": \"application/json\"}, \"returnType\": \"hex\"}"
},
{
"weight": 1,
"power": 2,
"selectorType": 0,
"name": "razorusd_mexc",
"selector": "data[0][last]",
"url": "https://www.mexc.com/open/api/v2/market/ticker?symbol=RAZOR_USDT"
"name": "pricefeed_eth",
"selector": "ethCollectionMedian",
"url": "https://datafeeds-staging.razorscan.io/prices"
},
{
"weight": 1,
"power": 2,
"power": 8,
"selectorType": 0,
"name": "razorusd_cryptocompare",
"selector": "USD",
"url": "https://min-api.cryptocompare.com/data/price?fsym=RAZOR&tsyms=USD"
},
{
"weight": 1,
"power": 8,
"selectorType": 0,
"name": "razorusd_gateio",
"selector": "[0].last",
"url": "https://api.gateio.ws/api/v4/spot/tickers?currency_pair=RAZOR_USDT"
},
{
"weight": 1,
"power": 2,
"power": 8,
"selectorType": 0,
"name": "razorusd_coinbase",
"selector": "data.amount",
"url": "https://api.coinbase.com/v2/prices/RAZOR-USD/spot"
},
{
"weight": 1,
"power": 8,
"selectorType": 0,
"name": "razorusdp_uniswap_v2",
"selector": "result",
"url": "{\"type\": \"POST\",\"url\": \"https://rpc.ankr.com/eth\",\"body\": {\"jsonrpc\":\"2.0\",\"id\":7269270904970082,\"method\":\"eth_call\",\"params\":[{\"from\":\"0x0000000000000000000000000000000000000000\",\"data\":\"0xd06ca61f0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000050de6856358cc35f3a9a57eaaa34bd4cb707d2cd0000000000000000000000008e870d67f660d95d5be530380d0ec0bd388289e1\",\"to\":\"0x7a250d5630b4cf539739df2c5dacb4c659f2488d\"},\"latest\"]},\"header\": {\"content-type\": \"application/json\"}, \"returnType\": \"hexArray[1]\"}"
},
{
"weight": 1,
"power": 8,
"selectorType": 0,
"name": "uftusd_mexc",
"selector": "data[0][last]",
"url": "https://www.mexc.com/open/api/v2/market/ticker?symbol=UFT_USDT"
"name": "pricefeed_rzr",
"selector": "RAZORUSD",
"url": "https://datafeeds-staging.razorscan.io/prices"
},
{
"weight": 1,
Expand All @@ -116,24 +132,16 @@
"power": 2,
"selectorType": 0,
"name": "uftusd_cryptocompare",
"selector": "[USD]",
"selector": "USD",
"url": "https://min-api.cryptocompare.com/data/price?fsym=UFT&tsyms=USD"
},
{
"weight": 1,
"power": 2,
"selectorType": 0,
"name": "uftusd_binance",
"selector": "price",
"url": "https://api.binance.com/api/v3/avgPrice?symbol=UFTBUSD"
},
{
"weight": 1,
"power": -4,
"selectorType": 0,
"name": "ethusd_postJob",
"selector": "result",
"url": "{\"type\": \"POST\",\"url\": \"https://rpc.ankr.com/eth\",\"body\": {\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"0xb27308f9f90d607463bb33ea1bebb41c27ce5ab6\",\"data\":\"0xf7729d43000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000\"}],\"id\":5},\"header\": {\"content-type\": \"application/json\"}, \"returnType\": \"hex\"}"
"name": "pricefeed_uft",
"selector": "UFTUSD",
"url": "https://datafeeds-staging.razorscan.io/prices"
},
{
"weight": 1,
Expand Down Expand Up @@ -187,9 +195,9 @@
"weight": 1,
"power": 2,
"selectorType": 0,
"name": "eth_kucoin_common_api",
"selector": "data.ETH",
"url": "https://api.kucoin.com/api/v1/prices?base=USD&currencies=ETH,BTC"
"name": "pricefeed_btc",
"selector": "BTCUSD",
"url": "https://datafeeds-staging.razorscan.io/prices"
},
{
"weight": 1,
Expand All @@ -215,6 +223,14 @@
"selector": "result.USDCUSD.c[0]",
"url": "https://api.kraken.com/0/public/Ticker?pair=USDCUSD"
},
{
"weight": 1,
"power": 5,
"selectorType": 0,
"name": "pricefeed_usdc",
"selector": "USDCUSD",
"url": "https://datafeeds-staging.razorscan.io/prices"
},
{
"weight": 1,
"power": 5,
Expand All @@ -239,6 +255,14 @@
"selector": "result.USDTZUSD.c[0]",
"url": "https://api.kraken.com/0/public/Ticker?pair=USDTZUSD"
},
{
"weight": 1,
"power": 5,
"selectorType": 0,
"name": "pricefeed_usdt",
"selector": "USDTUSD",
"url": "https://datafeeds-staging.razorscan.io/prices"
},
{
"weight": 1,
"power": 4,
Expand All @@ -263,14 +287,6 @@
"selector": "result.MATICUSD.c[0]",
"url": "https://api.kraken.com/0/public/Ticker?pair=MATICUSD"
},
{
"weight": 1,
"power": 4,
"selectorType": 0,
"name": "maticusd_binance",
"selector": "price",
"url": "https://api.binance.com/api/v3/avgPrice?symbol=MATICBUSD"
},
{
"weight": 1,
"power": 4,
Expand All @@ -290,10 +306,10 @@
{
"weight": 1,
"power": 4,
"selectorType": 1,
"name": "maticusd_coinmarjetcap_xhtml",
"selector": "/html/body/div[1]/div[2]/div/div[2]/div/div/div[2]/div[1]/div[2]/span",
"url": "https://coinmarketcap.com/currencies/polygon/"
"selectorType": 0,
"name": "pricefeed_matic",
"selector": "MATICUSD",
"url": "https://datafeeds-staging.razorscan.io/prices"
},
{
"weight": 1,
Expand Down Expand Up @@ -338,10 +354,10 @@
{
"weight": 1,
"power": 4,
"selectorType": 1,
"name": "grtusd_blockworks_xhtml",
"selector": "/html/body/div[1]/div/main/div[2]/div[1]/section[2]/div[1]/div/div[1]/div[1]/p",
"url": "https://blockworks.co/price/grt"
"selectorType": 0,
"name": "pricefeed_grt",
"selector": "GRTUSD",
"url": "https://datafeeds-staging.razorscan.io/prices"
},
{
"weight": 1,
Expand Down Expand Up @@ -370,10 +386,10 @@
{
"weight": 1,
"power": 4,
"selectorType": 1,
"name": "arb_binance_xhtml",
"selector": "/html/body/div[3]/section/div/div[2]/div[4]/div[1]/div[1]",
"url": "https://www.binance.com/en-IN/price/arbitrum"
"selectorType": 0,
"name": "pricefeed_arb",
"selector": "ARBUSD",
"url": "https://datafeeds-staging.razorscan.io/prices"
},
{
"weight": 1,
Expand Down Expand Up @@ -407,6 +423,14 @@
"selector": "last",
"url": "https://api.gemini.com/v1/pubticker/solusd"
},
{
"weight": 1,
"power": 4,
"selectorType": 0,
"name": "pricefeed_sol",
"selector": "SOLUSD",
"url": "https://datafeeds-staging.razorscan.io/prices"
},
{
"weight": 1,
"power": 6,
Expand All @@ -431,14 +455,6 @@
"selector": "data.amount",
"url": "https://api.coinbase.com/v2/prices/SKL-USD/spot"
},
{
"weight": 1,
"power": 6,
"selectorType": 1,
"name": "sklusd_binance_xhtml",
"selector": "/html/body/div[3]/section/div/div[2]/div[4]/div[1]/div[1]",
"url": "https://www.binance.com/en-IN/price/skale-network"
},
{
"weight": 1,
"power": 6,
Expand All @@ -457,18 +473,10 @@
},
{
"weight": 1,
"power": 8,
"selectorType": 0,
"name": "razorusd_coinbase",
"selector": "data.amount",
"url": "https://api.coinbase.com/v2/prices/RAZOR-USD/spot"
},
{
"weight": 1,
"power": 8,
"power": 6,
"selectorType": 0,
"name": "razorusdp_uniswap_v2",
"selector": "result",
"url": "{\"type\": \"POST\",\"url\": \"https://rpc.ankr.com/eth\",\"body\": {\"jsonrpc\":\"2.0\",\"id\":7269270904970082,\"method\":\"eth_call\",\"params\":[{\"from\":\"0x0000000000000000000000000000000000000000\",\"data\":\"0xd06ca61f0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000050de6856358cc35f3a9a57eaaa34bd4cb707d2cd0000000000000000000000008e870d67f660d95d5be530380d0ec0bd388289e1\",\"to\":\"0x7a250d5630b4cf539739df2c5dacb4c659f2488d\"},\"latest\"]},\"header\": {\"content-type\": \"application/json\"}, \"returnType\": \"hexArray[1]\"}"
"name": "pricefeed_skale",
"selector": "SKALEUSD",
"url": "https://datafeeds-staging.razorscan.io/prices"
}
]
Loading