From 0f7bca6bd749cbef3658e71d47b3a455b6230793 Mon Sep 17 00:00:00 2001 From: niv vaknin Date: Sun, 29 Dec 2024 17:22:28 +0200 Subject: [PATCH 1/4] Change output format for price feed check --- Quorum/apis/price_feeds/price_feed_utils.py | 3 --- Quorum/checks/price_feed.py | 11 +++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Quorum/apis/price_feeds/price_feed_utils.py b/Quorum/apis/price_feeds/price_feed_utils.py index 5156ae7..f636d45 100644 --- a/Quorum/apis/price_feeds/price_feed_utils.py +++ b/Quorum/apis/price_feeds/price_feed_utils.py @@ -29,7 +29,6 @@ class Config: def __str__(self) -> str: s = "" - s += f"Address: {self.address}\n" if self.name: s += f"Name: {self.name}\n" if self.pair: @@ -39,8 +38,6 @@ def __str__(self) -> str: s += f"Pairs: {pair_str}\n" else: s += f"Pair: {self.pair}\n" - if self.proxy_address: - s += f"Proxy Address: {self.proxy_address}\n" if self.decimals: s += f"Decimals: {self.decimals}\n" return s diff --git a/Quorum/checks/price_feed.py b/Quorum/checks/price_feed.py index 3419f77..2a46774 100644 --- a/Quorum/checks/price_feed.py +++ b/Quorum/checks/price_feed.py @@ -75,9 +75,16 @@ def __check_price_feed_address(self, address: str, file_name: str) -> dict | Non """ for provider in self.providers: if (price_feed := provider.get_price_feed(self.chain, address)): + + message = f"Found {address} on {provider.get_name()}\n" + message += f"info: {price_feed}" + if price_feed.proxy_address and price_feed.proxy_address.lower() != address.lower(): + message += f"Proxy address: {price_feed.proxy_address}\n" + if address.lower() != price_feed.address.lower(): + message += f"Origin Address: {price_feed.address}\n" + pp.pretty_print( - f"Found {address} on {provider.get_name()}\n" - f"info: {price_feed}", + message, pp.Colors.SUCCESS ) return price_feed.model_dump() From 51e9b73dbe63bd62644893af9b593215b63ee3dc Mon Sep 17 00:00:00 2001 From: niv vaknin Date: Sun, 29 Dec 2024 17:38:19 +0200 Subject: [PATCH 2/4] Address case where proxy address being used in the contract --- Quorum/checks/price_feed.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Quorum/checks/price_feed.py b/Quorum/checks/price_feed.py index 2a46774..e53cc01 100644 --- a/Quorum/checks/price_feed.py +++ b/Quorum/checks/price_feed.py @@ -76,16 +76,19 @@ def __check_price_feed_address(self, address: str, file_name: str) -> dict | Non for provider in self.providers: if (price_feed := provider.get_price_feed(self.chain, address)): + color = pp.Colors.SUCCESS message = f"Found {address} on {provider.get_name()}\n" message += f"info: {price_feed}" if price_feed.proxy_address and price_feed.proxy_address.lower() != address.lower(): message += f"Proxy address: {price_feed.proxy_address}\n" if address.lower() != price_feed.address.lower(): + color = pp.Colors.FAILURE + message += f"This is an implementation contract with a proxy address\n" message += f"Origin Address: {price_feed.address}\n" pp.pretty_print( message, - pp.Colors.SUCCESS + color ) return price_feed.model_dump() From 221631cb7ec3e6442318d09b0e28709efb23eeaf Mon Sep 17 00:00:00 2001 From: niv vaknin Date: Sun, 29 Dec 2024 18:41:38 +0200 Subject: [PATCH 3/4] Prettyfiy --- Quorum/checks/price_feed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Quorum/checks/price_feed.py b/Quorum/checks/price_feed.py index e53cc01..f9a79a8 100644 --- a/Quorum/checks/price_feed.py +++ b/Quorum/checks/price_feed.py @@ -78,7 +78,7 @@ def __check_price_feed_address(self, address: str, file_name: str) -> dict | Non color = pp.Colors.SUCCESS message = f"Found {address} on {provider.get_name()}\n" - message += f"info: {price_feed}" + message += str(price_feed) if price_feed.proxy_address and price_feed.proxy_address.lower() != address.lower(): message += f"Proxy address: {price_feed.proxy_address}\n" if address.lower() != price_feed.address.lower(): From 8570213eb6caa224609299029ef8150875836edd Mon Sep 17 00:00:00 2001 From: niv vaknin Date: Mon, 30 Dec 2024 09:19:54 +0200 Subject: [PATCH 4/4] Change to symbol --- Quorum/apis/price_feeds/price_feed_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Quorum/apis/price_feeds/price_feed_utils.py b/Quorum/apis/price_feeds/price_feed_utils.py index f636d45..7069c70 100644 --- a/Quorum/apis/price_feeds/price_feed_utils.py +++ b/Quorum/apis/price_feeds/price_feed_utils.py @@ -37,7 +37,7 @@ def __str__(self) -> str: if pair_str != ",": s += f"Pairs: {pair_str}\n" else: - s += f"Pair: {self.pair}\n" + s += f"Symbol: {self.pair}\n" if self.decimals: s += f"Decimals: {self.decimals}\n" return s