From ac37d30facf78934412e832d6b2a421916e5df2a Mon Sep 17 00:00:00 2001 From: BobTheBuidler Date: Wed, 9 Feb 2022 23:02:33 +0000 Subject: [PATCH 1/3] fix: curve Ids enum for id 6 --- yearn/prices/curve.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/yearn/prices/curve.py b/yearn/prices/curve.py index 7c1fb4895..64cbf3c0f 100644 --- a/yearn/prices/curve.py +++ b/yearn/prices/curve.py @@ -60,7 +60,9 @@ 'voting_escrow': '0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2', 'gauge_controller': '0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB', # additional factories not listed as metapool factory - 'factories': ['0xF18056Bbd320E96A48e3Fbf8bC061322531aac99'], + # if we need to manually add a curve factory that isn't recorded + # on the registry, uncomment the below line and paste it into the list + #'factories': [] }, Network.Fantom: { 'address_provider': ADDRESS_PROVIDER, @@ -78,6 +80,7 @@ class Ids(IntEnum): Metapool_Factory = 3 Fee_Distributor = 4 CryptoSwap_Registry = 5 + CryptoPool_Factory = 6 class CurveRegistry(metaclass=Singleton): @@ -158,6 +161,18 @@ def load_factories(self): self.token_to_pool[pool] = pool self.factories[factory].add(pool) + for factory in self.identifiers[Ids.CryptoPool_Factory]: + pool_list = self.read_pools(factory) + for pool in pool_list: + if pool in self.factories[factory]: + continue + # for curve v5 pools, pool and lp token are separate + lp_token = contract(factory).get_token(pool) + self.token_to_pool[lp_token] = pool + self.factories[factory].add(pool) + + + # we keep this so we can manually add factories that haven't yet been added to the on-chain Curve Registry for factory in curve_contracts[chain.id].get('factories', []): pool_list = self.read_pools(factory) for pool in pool_list: From 85bd14dcbbd3222150016daf9219c3aa3a5fb984 Mon Sep 17 00:00:00 2001 From: BobTheBuidler Date: Thu, 10 Feb 2022 00:17:11 +0000 Subject: [PATCH 2/3] chore: improve comments --- yearn/prices/curve.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yearn/prices/curve.py b/yearn/prices/curve.py index 64cbf3c0f..b9662f2d0 100644 --- a/yearn/prices/curve.py +++ b/yearn/prices/curve.py @@ -61,7 +61,7 @@ 'gauge_controller': '0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB', # additional factories not listed as metapool factory # if we need to manually add a curve factory that isn't recorded - # on the registry, uncomment the below line and paste it into the list + # on the address provider, uncomment the below line and paste it into the list #'factories': [] }, Network.Fantom: { @@ -172,7 +172,7 @@ def load_factories(self): self.factories[factory].add(pool) - # we keep this so we can manually add factories that haven't yet been added to the on-chain Curve Registry + # we keep this so we can manually add factories that haven't yet been added to the on-chain address provider for factory in curve_contracts[chain.id].get('factories', []): pool_list = self.read_pools(factory) for pool in pool_list: From c92ec4846b1ce2c0bbd14bf711827f4688d49473 Mon Sep 17 00:00:00 2001 From: BobTheBuidler Date: Thu, 10 Feb 2022 22:42:21 +0000 Subject: [PATCH 3/3] chore: cleanup comments --- yearn/prices/curve.py | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/yearn/prices/curve.py b/yearn/prices/curve.py index b9662f2d0..eb1e16318 100644 --- a/yearn/prices/curve.py +++ b/yearn/prices/curve.py @@ -59,10 +59,6 @@ 'crv': '0xD533a949740bb3306d119CC777fa900bA034cd52', 'voting_escrow': '0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2', 'gauge_controller': '0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB', - # additional factories not listed as metapool factory - # if we need to manually add a curve factory that isn't recorded - # on the address provider, uncomment the below line and paste it into the list - #'factories': [] }, Network.Fantom: { 'address_provider': ADDRESS_PROVIDER, @@ -161,6 +157,8 @@ def load_factories(self): self.token_to_pool[pool] = pool self.factories[factory].add(pool) + # if there are factories that haven't yet been added to the on-chain address provider, + # please refer to commit 3f70c4246615017d87602e03272b3ed18d594d3c to see how to add them manually for factory in self.identifiers[Ids.CryptoPool_Factory]: pool_list = self.read_pools(factory) for pool in pool_list: @@ -171,18 +169,6 @@ def load_factories(self): self.token_to_pool[lp_token] = pool self.factories[factory].add(pool) - - # we keep this so we can manually add factories that haven't yet been added to the on-chain address provider - for factory in curve_contracts[chain.id].get('factories', []): - pool_list = self.read_pools(factory) - for pool in pool_list: - if pool in self.factories[factory]: - continue - # for curve v5 pools, pool and lp token are separate - lp_token = contract(factory).get_token(pool) - self.token_to_pool[lp_token] = pool - self.factories[factory].add(pool) - def get_factory(self, pool): """ Get metapool factory that has spawned a pool.