-
Notifications
You must be signed in to change notification settings - Fork 27
Add filter for paused contracts in subgraph queries #1753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
trizin
wants to merge
18
commits into
rename-ocean-token-to-prediction-token
Choose a base branch
from
issue1752-update-subgraph-functions-and-calls-to-filter-out-paused-prediction-contracts
base: rename-ocean-token-to-prediction-token
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4617cbb
Add filter for paused contracts in subgraph queries
trizin 49a317d
Add integration test for filtering out paused contracts in subgraph q…
trizin 0561558
format
trizin a45bb6a
fix
trizin 6ed93e4
Merge branch 'rename-ocean-token-to-prediction-token' of https://gith…
trizin b61fb65
feat: add --include_paused option to claim_payouts command for queryi…
trizin c893cbc
feat: pass include_paused argument to do_ocean_payout in do_claim_pay…
trizin 19c4562
feat: add include_paused parameter to payout functions and update tests
trizin 630e1b9
Formatting
trizin eaf3465
feat: enhance test for paused contracts to verify pending payouts wit…
trizin b34b98f
refactor: clean up test for paused contracts by improving assertions …
trizin f620a02
feat: update query_pending_payouts function docstring to clarify para…
trizin 9c7d906
remove ai slop
trizin 6c78a63
fix linter
trizin df2de89
feat: add pause_predictions command and functionality to pause contra…
trizin fe9ea33
fix: correct token price calculation in publish_assets function
trizin 6a3513f
updated rate
trizin f1226c6
feat: implement pause_predictions function to manage contract predict…
trizin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import logging | ||
| from typing import List | ||
|
|
||
| from enforce_typing import enforce_types | ||
|
|
||
| from pdr_backend.contract.feed_contract import FeedContract | ||
| from pdr_backend.ppss.web3_pp import Web3PP | ||
|
|
||
| logger = logging.getLogger("pause_predictions") | ||
|
|
||
|
|
||
| @enforce_types | ||
| def pause_predictions(web3_pp: Web3PP, contract_addresses: List[str]): | ||
| """ | ||
| Pause predictions for a list of feed contracts. | ||
|
|
||
| @arguments | ||
| web3_pp: Web3PP instance with network configuration | ||
| contract_addresses: List of contract addresses to pause | ||
| """ | ||
| logger.info("Pausing predictions on network = %s", web3_pp.network) | ||
| logger.info("Number of contracts to pause: %d", len(contract_addresses)) | ||
|
|
||
| successful = [] | ||
| failed = [] | ||
|
|
||
| for address in contract_addresses: | ||
| logger.info("Pausing predictions for contract: %s", address) | ||
| try: | ||
| feed_contract = FeedContract(web3_pp, address) | ||
| tx = feed_contract.pause_predictions(wait_for_receipt=True) | ||
|
|
||
| if tx is not None: | ||
| logger.info("Successfully paused predictions for %s", address) | ||
| successful.append(address) | ||
| else: | ||
| logger.error("Failed to pause predictions for %s", address) | ||
| failed.append(address) | ||
| except Exception as e: | ||
| logger.error("Error pausing predictions for %s: %s", address, e) | ||
| failed.append(address) | ||
|
|
||
| logger.info("Done pausing predictions.") | ||
| logger.info("Successfully paused: %d", len(successful)) | ||
| logger.info("Failed to pause: %d", len(failed)) | ||
|
|
||
| if failed: | ||
| logger.warning("Failed contracts: %s", failed) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest renaming this to '_INCLUDE_PAUSED_FALSE'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easier to read, but not a mandatory change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why would we add "false" to the end? I don't get it