Skip to content

Commit

Permalink
price feed providers tests
Browse files Browse the repository at this point in the history
  • Loading branch information
liav-certora committed Dec 18, 2024
1 parent 7155d73 commit 1ea8353
Show file tree
Hide file tree
Showing 24 changed files with 264 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "FIL / ETH",
"pair": [
"",
""
],
"address": "0x0260343eB7bEf134b8892Ee66712fd3D5a3f6274",
"proxy_address": "0x0606Be69451B1C9861Ac6b3626b99093b713E801",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "BAT / ETH",
"pair": [
"",
""
],
"address": "0x0b83B36bDb49E5010c2AeE53b3cbD131Fd24261C",
"proxy_address": "0x0d16d4528239e9ee52fa531af613AcdB23D88c94",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "MKR / ETH",
"pair": [
"",
""
],
"address": "0x6D68A0636246d1dE3EbE972AD8bEE886B10610Ee",
"proxy_address": "0x24551a8Fb2A7211A25a17B1481f043A8a8adC7f2",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "ENJ / ETH",
"pair": [
"",
""
],
"address": "0x63f71CB5c29c33656dCd5dcA144e12532A361bEF",
"proxy_address": "0x24D9aB51950F3d62E9144fdC2f3135DAA6Ce8D1B",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "ZRX / ETH",
"pair": [
"",
""
],
"address": "0x3547473DA7deB396ACF07D57340a8ef931d7414E",
"proxy_address": "0x2Da4983a622a8498bb1a21FaE9D8F6C664939962",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "REN / ETH",
"pair": [
"",
""
],
"address": "0xFfF8FdC3C2B041C783D90dFeFDDd842B15A98712",
"proxy_address": "0x3147D7203354Dc06D9fd350c7a2437bcA92387a4",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "AMPL / ETH",
"pair": [
"",
""
],
"address": "0xcC1843B09Ba15b829095Cbca8D7aB460d669236a",
"proxy_address": "0x492575FDD11a0fCf2C6C719867890a7648d526eB",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "RAI / ETH",
"pair": [
"",
""
],
"address": "0x019699e5b12331cf77DF9E39818c2E15C8B06215",
"proxy_address": "0x4ad7B025127e89263242aB68F0f9c4E5C033B489",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "KNC / ETH",
"pair": [
"",
""
],
"address": "0x714FF6b6Fc99c2Ee37BAC73aB41c8E4ae30508a5",
"proxy_address": "0x656c0544eF4C98A6a98491833A89204Abb045d6b",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "AAVE / ETH",
"pair": [
"",
""
],
"address": "0x347b3886BdC7242Ae7f5f00398e801c8bfA8F52C",
"proxy_address": "0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "1INCH / ETH",
"pair": [
"",
""
],
"address": "0x2b16C345E0558458E919E3351C62EcAD57cA7F36",
"proxy_address": "0x72AFAECF99C9d9C8215fF44C77B94B99C28741e8",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "SNX / ETH",
"pair": [
"",
""
],
"address": "0x84Cf90cfF80828dD32c69A2f25a09FC1ccbB7fc3",
"proxy_address": "0x79291A9d692Df95334B1a0B3B4AE6bC606782f8c",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "CRV / ETH",
"pair": [
"",
""
],
"address": "0xb3478aC41a7acD9a33eb15D7A764b7119e571A3C",
"proxy_address": "0x8a12Be339B0cD1829b91Adc01977caa5E9ac121e",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "BAL / ETH",
"pair": [
"",
""
],
"address": "0x84BB206a5B39DBB5Ea378074c9cBEde397F575dD",
"proxy_address": "0xC1438AA3823A6Ba0C159CfA8D98dF5A994bA120b",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "CVX / ETH",
"pair": [
"",
""
],
"address": "0xA3c0D69CedFf5b173Bc496074003dCe9C503e861",
"proxy_address": "0xC9CbF687f43176B302F03f5e58470b77D07c61c6",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "UNI / ETH",
"pair": [
"",
""
],
"address": "0x08B383db68EE48Cef76d3A48c4E0dE9B558704f5",
"proxy_address": "0xD6aA3D25116d8dA79Ea0246c4826EB951872e02e",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "LINK / ETH",
"pair": [
"",
""
],
"address": "0x3357974B41466c9Adb453Dc9D8A5a07278887174",
"proxy_address": "0xDC530D9457755926550b59e8ECcdaE7624181557",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "Calculated XSUSHI / ETH",
"pair": [
"",
""
],
"address": "0x2f28300Feef2Fe3F279E2A1cBb1f8be69e06Be85",
"proxy_address": "0xF05D9B6C08757EAcb1fbec18e36A1B7566a13DEB",
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Aave DAI",
"pair": "adai",
"address": "0x028171bca77440897b824ca71d1c56cac55b68a3",
"proxy_address": null,
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Rai Reflex Index",
"pair": "rai",
"address": "0x03ab458634910aad20ef5f1c8ee96f1d6ac54919",
"proxy_address": null,
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "yearn.finance",
"pair": "yfi",
"address": "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e",
"proxy_address": null,
"decimals": 18
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Aave MKR",
"pair": "amkr",
"address": "0xc713e5e149d5d0715dcd1c156a020976e7e56b88",
"proxy_address": null,
"decimals": 18
}
51 changes: 51 additions & 0 deletions Quorum/tests/test_price_feed_providers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import pytest

import Quorum.tests.utils as utils

from Quorum.utils.chain_enum import Chain
from Quorum.apis.price_feeds import PriceFeedData, ChainLinkAPI, ChronicleAPI, CoinGeckoAPI

import json
from pathlib import Path
import shutil

from typing import Generator


EXPECTED_DIR = utils.EXPECTED_DIR / 'test_price_feed_providers'


@pytest.fixture
def tmp_cache() -> Generator[Path, None, None]:
cache = Path(__file__).parent / 'tmp_cache'
cache.mkdir()
yield cache
shutil.rmtree(cache)


def test_chainlink(tmp_cache):
api = ChainLinkAPI()
api.cache_dir = tmp_cache
for file in (EXPECTED_DIR / 'Chainlink' / 'ETH').iterdir():
with open(file) as f:
expected = PriceFeedData(**json.load(f))
assert api.get_price_feed(Chain.ETH, file.stem) == expected


# TODO: Find chronicle price feeds...
# def test_chronicle(tmp_cache):
# api = ChronicleAPI()
# api.cache_dir = tmp_cache
# for file in (EXPECTED_DIR / 'Chronicle' / 'ETH').iterdir():
# with open(file) as f:
# expected = PriceFeedData(**json.load(f))
# api.get_price_feed(Chain.ETH, file.stem) == expected


def test_coingecko(tmp_cache):
api = CoinGeckoAPI()
api.cache_dir = tmp_cache
for file in (EXPECTED_DIR / 'Coingecko' / 'ETH').iterdir():
with open(file) as f:
expected = PriceFeedData(**json.load(f))
assert api.get_price_feed(Chain.ETH, file.stem) == expected
7 changes: 5 additions & 2 deletions Quorum/tests/test_source_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
import json


EXPECTED_DIR = utils.EXPECTED_DIR / 'test_source_code'


def test_get_state_variable():
source_codes = utils.load_source_codes('ETH/0xAD6c03BF78A3Ee799b86De5aCE32Bb116eD24637')
for s in source_codes:
with open(utils.EXPECTED_DIR / 'test_source_code' / 'state_variables' / f'{s.file_name}.json') as f:
with open(EXPECTED_DIR / 'state_variables' / f'{s.file_name}.json') as f:
expected = json.load(f)
assert s.get_state_variables() == expected, f'{s.file_name} state variables do not match expected.'


def test_get_functions():
source_codes = utils.load_source_codes('ETH/0xAD6c03BF78A3Ee799b86De5aCE32Bb116eD24637')
for s in source_codes:
with open(utils.EXPECTED_DIR / 'test_source_code' / 'functions' / f'{s.file_name}.json') as f:
with open(EXPECTED_DIR / 'functions' / f'{s.file_name}.json') as f:
expected = json.load(f)
assert s.get_functions() == expected, f'{s.file_name} functions do not match expected.'

0 comments on commit 1ea8353

Please sign in to comment.