Skip to content

Commit

Permalink
Fetch latest oracles config
Browse files Browse the repository at this point in the history
  • Loading branch information
tsudmi committed Nov 22, 2021
1 parent 867c4a6 commit 8ce57ad
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
1 change: 0 additions & 1 deletion src/merkle_distributor/distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def process(self) -> None:
oracles_settings: OraclesSettings = get_oracles_config(
node_id=self.ens_node_id,
ens_resolver=self.ens_resolver,
block_number=new_rewards_block_number,
ens_text_record=ORACLES_ENS_TEXT_RECORD,
ipfs_endpoint=IPFS_ENDPOINT,
)
Expand Down
10 changes: 1 addition & 9 deletions src/merkle_distributor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,20 +285,12 @@ def get_staked_eth_distributions(
def get_oracles_config(
node_id: bytes,
ens_resolver: Contract,
block_number: BlockNumber,
ens_text_record: str,
ipfs_endpoint: str,
) -> OraclesSettings:
"""Fetches oracles config from the DAO's ENS text record."""
# fetch IPFS URL
oracles_config_url = ens_resolver.functions.text(node_id, ens_text_record).call(
block_identifier=block_number
)
if not oracles_config_url:
# try for the latest block
oracles_config_url = ens_resolver.functions.text(node_id, ens_text_record).call(
block_identifier="latest"
)
oracles_config_url = ens_resolver.functions.text(node_id, ens_text_record).call(block_identifier="latest")

if oracles_config_url.startswith(IPFS_PREFIX):
oracles_config_url = oracles_config_url[7:]
Expand Down

0 comments on commit 8ce57ad

Please sign in to comment.