Skip to content

Commit

Permalink
Add var name
Browse files Browse the repository at this point in the history
  • Loading branch information
akremstudy committed Jul 28, 2023
1 parent 34e54d7 commit 571cee2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/telliot_feeds/sources/sweth_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

logger = get_logger(__name__)

MAVERICK_CONTRACT = "0x9980ce3b5570e41324904f46A06cE7B466925E23"
SWETH_CONTRACT = "0xf951E335afb289353dc249e82926178EaC7DEd78"


class swETHSpotPriceService(WebPriceService):
"""Custom swETH Price Service"""
Expand Down Expand Up @@ -45,7 +48,7 @@ def get_sweth_eth_ratio(self) -> Optional[float]:
sweth_eth_ratio_decoded = w3.toInt(sweth_eth_ratio_bytes)
sweth_eth_ratio = w3.fromWei(sweth_eth_ratio_decoded, "ether")
# Maverick AMM uses square root of ratio
if self.contract == "0x9980ce3b5570e41324904f46A06cE7B466925E23":
if self.contract == MAVERICK_CONTRACT:
sweth_eth_ratio = sweth_eth_ratio**2
logger.debug(f"sweth_eth_ratio: {sweth_eth_ratio}")
return float(sweth_eth_ratio)
Expand Down Expand Up @@ -82,7 +85,7 @@ class swETHSpotPriceSource(PriceSource):
service: swETHSpotPriceService = field(default_factory=swETHSpotPriceService, init=False)

def __post_init__(self) -> None:
self.service.contract = "0xf951E335afb289353dc249e82926178EaC7DEd78"
self.service.contract = SWETH_CONTRACT
self.service.calldata = "0xd68b2cb6"


Expand All @@ -93,5 +96,5 @@ class swETHMaverickSpotPriceSource(PriceSource):
service: swETHSpotPriceService = field(default_factory=swETHSpotPriceService)

def __post_init__(self) -> None:
self.service.contract = "0x9980ce3b5570e41324904f46A06cE7B466925E23"
self.service.contract = MAVERICK_CONTRACT
self.service.calldata = "0x91c0914e000000000000000000000000817e8c9a99db98082ca187e4f80498586bf6bc1b"

0 comments on commit 571cee2

Please sign in to comment.