-
Notifications
You must be signed in to change notification settings - Fork 126
feat: improve scenario #555
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
lgalabru
wants to merge
8
commits into
main
Choose a base branch
from
feat/revisit-scenario
base: main
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
8 commits
Select commit
Hold shift + click to select a range
fd7903a
refactor: migrate verified tokens from JSON to CSV
lgalabru 0674c17
feat: revisit scenario types and registry
lgalabru ee87f01
feat: add and update protocol scenarios
lgalabru d56b568
feat: update core runtime for revised scenario handling
lgalabru e26021d
feat: update MCP server for revised scenarios
lgalabru 7c18f3f
feat: update CLI and workspace dependencies
lgalabru 9cb2398
chore: cargo fmt / lint
lgalabru c448448
fix: broken test
lgalabru 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
59 changes: 59 additions & 0 deletions
59
crates/core/src/scenarios/examples/kamino-liquidation-arbitrage.json
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,59 @@ | ||
| { | ||
| "id": "kamino-liquidation-arb-example", | ||
| "name": "Kamino Liquidation Arbitrage - POPCAT/SOL", | ||
| "description": "A scenario replicating the liquidation arbitrage from tx 5xDtqZcY4CzDHjdT61VsGuF1YL7fADUhPz6hCdA2RVMFMhUjuSh5rqkrLKFXfh4gXevMN1L2NjnCaRCAZYxVmqpz. This scenario sets up a Kamino obligation to be liquidatable, and manipulates Whirlpool and Raydium AMM pool states to create a profitable arbitrage opportunity.", | ||
| "tags": ["liquidation", "arbitrage", "kamino", "whirlpool", "raydium"], | ||
| "overrides": [ | ||
| { | ||
| "id": "obligation-unhealthy", | ||
| "templateId": "kamino-obligation-health", | ||
| "label": "Make Obligation Unhealthy", | ||
| "scenarioRelativeSlot": 0, | ||
| "enabled": true, | ||
| "fetchBeforeUse": true, | ||
| "account": { | ||
| "pubkey": "3iprSGrEQdBxhmqV399tYQQPG8Z1Hh2aYFrBwgqFXjGS" | ||
| }, | ||
| "values": { | ||
| "borrowed_value_sf": 1000000000000000000, | ||
| "unhealthy_borrow_value_sf": 500000000000000000, | ||
| "deposited_value_sf": 800000000000000000, | ||
| "allowed_borrow_value_sf": 600000000000000000 | ||
| } | ||
| }, | ||
| { | ||
| "id": "whirlpool-popcat-sol-price", | ||
| "templateId": "whirlpool-popcat-sol", | ||
| "label": "Set Whirlpool POPCAT/SOL Price", | ||
| "scenarioRelativeSlot": 0, | ||
| "enabled": true, | ||
| "fetchBeforeUse": true, | ||
| "account": { | ||
| "pubkey": "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE" | ||
| }, | ||
| "values": { | ||
| "liquidity": "5000000000000000", | ||
| "sqrt_price": "1844674407370955161", | ||
| "tick_current_index": 0 | ||
| } | ||
| }, | ||
| { | ||
| "id": "raydium-amm-popcat-sol-state", | ||
| "templateId": "raydium-amm-popcat-sol", | ||
| "label": "Set Raydium AMM POPCAT/SOL State", | ||
| "scenarioRelativeSlot": 0, | ||
| "enabled": true, | ||
| "fetchBeforeUse": true, | ||
| "account": { | ||
| "pubkey": "FRhB8L7Y9Qq41qZXYLtC2nw8An1RJfLLxRF2x9RwLLMo" | ||
| }, | ||
| "values": { | ||
| "status": 1, | ||
| "state": 1, | ||
| "lp_amount": 10000000000000, | ||
| "fees.swap_fee_numerator": 25, | ||
| "fees.swap_fee_denominator": 10000 | ||
| } | ||
| } | ||
| ] | ||
| } |
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.
We have a very similar code path to
surfnet_svm.restore_from_snapshotat https://github.com/txtx/surfpool/blob/9cb2398b2cf5caf1969aa9715bcb5a45e7c4c49e/crates/core/src/surfnet/locker.rs#L481It is initialized a few lines below this (line 89 of this file) where the snapshot file contents are processed and stored on the simnet config.
That one does a few extra things - allowing useres to provide
<pubkey>: nullin their snapshot to fetch from remote.Is this current loop causing a double import? Do we want to go with just one of these approaches?