Skip to content

Commit

Permalink
[WEB-1253-200] fix: arbitrum fixes (yearn#200)
Browse files Browse the repository at this point in the history
* fix: arbitrum pricing fixes, disable curve apy for now

* fix: revert change to interface

* fix: remove unused interface import
  • Loading branch information
jstashh authored Jan 26, 2022
1 parent 6296ab8 commit 04f497c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion scripts/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions yearn/apy/curve/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions yearn/prices/magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down
2 changes: 1 addition & 1 deletion yearn/v2/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down

0 comments on commit 04f497c

Please sign in to comment.