Skip to content

Commit

Permalink
Merge pull request #164 from tellor-io/more-disputer-configs
Browse files Browse the repository at this point in the history
used feeds for disputer-config.yaml
  • Loading branch information
akremstudy authored Mar 23, 2024
2 parents 554a1c3 + 30db3dd commit d5ca124
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 17 deletions.
45 changes: 45 additions & 0 deletions disputer-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,51 @@ feeds: # please reference https://github.com/tellor-io/dataSpecs/tree/main/types
threshold:
type: Percentage
amount: 0.75 # 75%
#OETH/USD
- query_id: "0xf30c232070ffa631fc6fc7b350ba261dab4d43cc98d43f4a29bff453b06e0911"
threshold:
type: Percentage
amount: 0.75 # 75%
#USDC/USD
- query_id: "0x8ee44cd434ed5b0e007eee581fbe0855336f3f84484e8d9989a620a4a49aa0f7"
threshold:
type: Percentage
amount: 0.75 # 75%
#USDT/USD
- query_id: "0x68a37787e65e85768d4aa6e385fb15760d46df0f67a18ec032d8fd5848aca264"
threshold:
type: Percentage
amount: 0.75 # 75%
#WBTC/USD
- query_id: "0x6fad0305c4cbd56b25a8ff90ec4e40031d1a74a5512f38c361514198d6184b6d"
threshold:
type: Percentage
amount: 0.75 # 75%
#WMNT/USD
- query_id: "0x931529a866017d1d1356bf4098b91e48060da9cede36f019446209a246abbef8"
threshold:
type: Percentage
amount: 0.75 # 75%
#METH/USD
- query_id: "0x3a9e54c25e1da43fe0321b83f173cf8db9026d012a9012422c2029b42bce0c09"
threshold:
type: Percentage
amount: 0.75 # 75%
#wUSDM/USD
- query_id: "0x6908dd654640ba7c223a7bfb615a6b6238b839f31e3cdcc8804483a620439912"
threshold:
type: Percentage
amount: 0.75 # 75%
#sDAI/USD
- query_id: "0x05cddb6b67074aa61fcbe1d2fd5924e028bb699b506267df28c88f7deac4edc6"
threshold:
type: Percentage
amount: 0.75 # 75%
#sFRAX/USD
- query_id: "0x53895ab7997ea4c92803bf333392bdbf8a79b10df9f1ef098ff3cea77a87f6b5"
threshold:
type: Percentage
amount: 0.75 # 75%
#EVMCALL
- query_type: EVMCall
threshold:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pytest-asyncio = "^0.19.0"
click = "^8.1.3"
pydantic = "^1.10.2"
python-box = "^7.0.1"
telliot-feeds = "^0.1.13"
telliot-feeds = "^0.1.19"

[tool.poetry.dev-dependencies]
pytest = "^7.1.0"
Expand Down
34 changes: 19 additions & 15 deletions tests/test_auto_dispute_multiple_ids.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import csv
import io
from contextlib import ExitStack
from typing import Awaitable
Expand Down Expand Up @@ -315,11 +316,12 @@ async def test_custom_spot_type(stake_deposited: Awaitable[TelliotCore]):
expected = "AmpleforthCustomSpotPrice,N/A,N/A,0.0000,yes ❗📲"

with open("table.csv", "r") as f:
lines = f.readlines()
# get the last row
last_row = lines[-1]

assert expected in last_row
reader = csv.reader(f)
rows = list(reader)
matching_rows = [row for row in rows if expected in ",".join(row)]
result = matching_rows[0] if matching_rows else None
assert result is not None, "Expected row not found."
assert expected in ",".join(result), "Expected row not in the response."


@pytest.mark.asyncio
Expand Down Expand Up @@ -351,11 +353,12 @@ async def test_gas_oracle_type(stake_deposited: Awaitable[TelliotCore]):
expected = "GasPriceOracle,N/A,N/A,46.6130,yes ❗📲"

with open("table.csv", "r") as f:
lines = f.readlines()
# get the last row
last_row = lines[-1]

assert expected in last_row
reader = csv.reader(f)
rows = list(reader)
matching_rows = [row for row in rows if expected in ",".join(row)]
result = matching_rows[0] if matching_rows else None
assert result is not None, "Expected row not found."
assert expected in ",".join(result), "Expected row not in the response."


@pytest.mark.asyncio
Expand All @@ -375,8 +378,9 @@ async def test_evmcall_right_value_wrong_timestamp(submit_multiple_bad_values: A
expected = "EVMCall,N/A,N/A,(b'\\x0...1435),no ✔️,1337"

with open("table.csv", "r") as f:
lines = f.readlines()
# get the last row
last_row = lines[-1]

assert expected in last_row
reader = csv.reader(f)
rows = list(reader)
matching_rows = [row for row in rows if expected in ",".join(row)]
result = matching_rows[0] if matching_rows else None
assert result is not None, "Expected row not found."
assert expected in ",".join(result), "Expected row not in the response."
15 changes: 14 additions & 1 deletion tests/test_disputer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest
from chained_accounts import ChainedAccount
from telliot_core.apps.core import TelliotConfig
from telliot_core.model.endpoints import default_endpoint_list
from telliot_core.model.endpoints import RPCEndpoint
from telliot_core.utils.response import ResponseStatus
from telliot_feeds.feeds.eth_usd_feed import eth_usd_median_feed
Expand Down Expand Up @@ -208,8 +209,20 @@ async def test_dispute_using_sample_log(

@pytest.mark.asyncio
async def test_get_dispute_fee():

rpc = RPCEndpoint(
chain_id=80001,
provider="polygon",
network="mumbai",
url="https://polygon-mumbai-bor-rpc.publicnode.com",
explorer="https://mumbai.polygonscan.com/",
)
# todo: use mock instead
cfg = TelliotConfig()
for i, ep in enumerate(default_endpoint_list):
if ep.chain_id == 80001:
default_endpoint_list[i] = rpc
break
cfg.endpoints.endpoints = default_endpoint_list
cfg.main.chain_id = 80001

report = NewReport(
Expand Down

0 comments on commit d5ca124

Please sign in to comment.