Skip to content

Commit

Permalink
Switch pull oracles (#231)
Browse files Browse the repository at this point in the history
Adds support for switch pull oracles (aka sb-on-demand) when configuring a bank.
  • Loading branch information
jgur-psyops authored Aug 15, 2024
1 parent 2e8830d commit 9eae066
Show file tree
Hide file tree
Showing 13 changed files with 472 additions and 16 deletions.
134 changes: 120 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ anchor-client = { git = "https://github.com/mrgnlabs/anchor.git", rev = "fdcf299
pyth-sdk-solana = "=0.10.1"
pyth-solana-receiver-sdk = "0.3.0"
switchboard-solana = "0.29.0"
switchboard-on-demand = "0.1.13"
borsh = "0.10.3"

[profile.release]
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,14 @@ Run `./scripts/verify_mainnet.sh`
Integration tests for the on-chain marginfi programs are located under
`/programs/marginfi/tests`. To run the tests, use `cargo test-bpf`. Be sure to
use an x86 toolchain when compiling and running the tests.

Run the full test suite with `.scripts/test-program.sh <program_to_test>`
* e.g. `.scripts/test-program.sh all --sane`

Run a single test:
`.scripts/test-program.sh <program_to_test> <name_of_test>`
* e.g. `.scripts/test-program.sh marginfi configure_bank_success --verbose`

## Footguns

Debugging `I80F48`s by `msg!("val: {:?}", some_val_I80F48);` can cause silent build issues leading to `Program is not deployed`. Convert these values to string before printing them.
1 change: 1 addition & 0 deletions programs/marginfi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ anchor-spl = { workspace = true }
pyth-sdk-solana = { workspace = true }
pyth-solana-receiver-sdk = { workspace = true }
switchboard-solana = { workspace = true }
switchboard-on-demand = { workspace = true }
borsh = "0.10.3"

bytemuck = "1.9.1"
Expand Down
Loading

2 comments on commit 9eae066

@lmvdz
Copy link

@lmvdz lmvdz commented on 9eae066 Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't SWITCHBOARD_PROGRAM_ID be SWITCHBOARD_ON_DEMAND_PROGRAM_ID @jgur-psyops

@lmvdz
Copy link

@lmvdz lmvdz commented on 9eae066 Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suggest to update to 0.1.14 and using switchboard_on_demand::ON_DEMAND_MAINNET_PID
0.1.13 has some weird issue compiling a usable program with the lazy_static! macro for SWITCHBOARD_ON_DEMAND_PROGRAM_ID

Please sign in to comment.