Skip to content
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

Switch pull oracles #231

Merged
merged 11 commits into from
Aug 15, 2024
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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,10 @@ 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`
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
6 changes: 6 additions & 0 deletions programs/marginfi/src/state/marginfi_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,12 @@ impl<'info> RiskEngine<'_, 'info> {
a.balance.bank_pk, assets, liabilities
);

// TODO remove
msg!(
"BALS Balance {}, assets: {}, liabilities: {}",
a.balance.bank_pk, assets, liabilities
);

jgur-psyops marked this conversation as resolved.
Show resolved Hide resolved
total_assets = total_assets.checked_add(assets).ok_or_else(math_error!())?;
total_liabilities = total_liabilities
.checked_add(liabilities)
Expand Down
Loading
Loading