From 04f497c070fb5cd08e6e5a970659f2107be4e851 Mon Sep 17 00:00:00 2001 From: jstashh <19509999+jstashh@users.noreply.github.com> Date: Wed, 26 Jan 2022 08:41:17 +0000 Subject: [PATCH] [WEB-1253-200] fix: arbitrum fixes (#200) * fix: arbitrum pricing fixes, disable curve apy for now * fix: revert change to interface * fix: remove unused interface import --- scripts/s3.py | 4 +++- yearn/apy/curve/simple.py | 3 +++ yearn/prices/magic.py | 8 ++++++++ yearn/v2/registry.py | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/s3.py b/scripts/s3.py index 5f0730ca6..118aca3f6 100644 --- a/scripts/s3.py +++ b/scripts/s3.py @@ -124,6 +124,8 @@ def registry_adapter(): registry_adapter_address = web3.ens.resolve("lens.ychad.eth") elif chain.id == Network.Fantom: registry_adapter_address = "0xF628Fb7436fFC382e2af8E63DD7ccbaa142E3cd1" + elif chain.id == Network.Arbitrum: + registry_adapter_address = "0x57AA88A0810dfe3f9b71a9b179Dd8bF5F956C46A" return contract(registry_adapter_address) @@ -148,7 +150,7 @@ def main(): special = [YveCRVJar(), Backscratcher()] registry_v1 = RegistryV1() vaults = itertools.chain(special, registry_v1.vaults, registry_v2.vaults, registry_v2.experiments) - elif chain.id == Network.Fantom: + else: vaults = registry_v2.vaults assets_metadata = get_assets_metadata(registry_v2.vaults) diff --git a/yearn/apy/curve/simple.py b/yearn/apy/curve/simple.py index dfb6f51a9..89bc456d4 100644 --- a/yearn/apy/curve/simple.py +++ b/yearn/apy/curve/simple.py @@ -30,6 +30,9 @@ def simple(vault, samples: ApySamples) -> Apy: + if chain.id == Network.Arbitrum: + raise ApyError("crv", "not yet implemented") + lp_token = vault.token.address pool_address = curve.get_pool(lp_token) diff --git a/yearn/prices/magic.py b/yearn/prices/magic.py index 829f142dd..9e18f921e 100644 --- a/yearn/prices/magic.py +++ b/yearn/prices/magic.py @@ -53,6 +53,14 @@ def get_price_arbi(token, block=None): logger.debug("peel %s %s", price, underlying) return price * get_price(underlying, block=block) + if token in curve.curve: + price = curve.curve.get_price(token, block=block) + logger.debug("curve lp -> %s", price) + + if not price: + price = uniswap_v3.get_price(token, block=block) + logger.debug("uniswap v3 -> %s", price) + if not price: logger.error("failed to get price for %s", token) raise PriceError(f'could not fetch price for {token} at {block}') diff --git a/yearn/v2/registry.py b/yearn/v2/registry.py index 2c214ddd9..6103b4a41 100644 --- a/yearn/v2/registry.py +++ b/yearn/v2/registry.py @@ -40,7 +40,7 @@ def load_registry(self): elif chain.id == Network.Fantom: return [contract('0x727fe1759430df13655ddb0731dE0D0FDE929b04')] elif chain.id == Network.Arbitrum: - return [contract('0xC8f17f8E15900b6D6079680b15Da3cE5263f62AA')] + return [contract('0x3199437193625DCcD6F9C9e98BDf93582200Eb1f')] else: raise UnsupportedNetwork('yearn v2 is not available on this network')