Skip to content

Commit

Permalink
chore: pull monorepo changes (switchboard-xyz#173)
Browse files Browse the repository at this point in the history
* Project import generated by Copybara.

GitOrigin-RevId: 5aae5e514cbb815872967735716823f422a6316a

* chore: Update pnpm lockfile

---------

Co-authored-by: Copybara <[email protected]>
Co-authored-by: gallynaut <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2023
1 parent 7feef95 commit d049b53
Show file tree
Hide file tree
Showing 24 changed files with 1,684 additions and 1,021 deletions.
2 changes: 1 addition & 1 deletion examples/functions/01_basic_oracle/Cargo.lock

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

2 changes: 1 addition & 1 deletion examples/functions/01_basic_oracle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ cpi = ["no-entrypoint"]
default = []

[dependencies]
# switchboard-solana = { version = "0.28.43" }
# switchboard-solana = { version = "0.29.70" }
switchboard-solana = { path = "../../../rust/switchboard-solana" }
bytemuck = "^1"
2 changes: 1 addition & 1 deletion examples/functions/01_basic_oracle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@coral-xyz/anchor": "^0.28.0",
"@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.78.0",
"@switchboard-xyz/solana.js": "*"
"@switchboard-xyz/solana.js": "^3"
},
"devDependencies": {
"@types/bn.js": "^5.1.0",
Expand Down
17 changes: 10 additions & 7 deletions examples/functions/01_basic_oracle/src/actions/refresh_prices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ pub struct RefreshPrices<'info> {
pub oracle: AccountLoader<'info, MyOracleState>,

// We use this to verify the functions enclave state
pub switchboard_function: AccountLoader<'info, FunctionAccountData>,
#[account(
// constraint = switchboard_routine.validate_signer(
// switchboard_function.to_account_info().as_ref(),
// enclave_signer.to_account_info().as_ref()
// )?
constraint = function.load()?.validate_routine(
&routine,
&enclave_signer.to_account_info(),
)?
)]
pub switchboard_routine: Box<Account<'info, FunctionRoutineAccountData>>,
pub function: AccountLoader<'info, FunctionAccountData>,
#[account(
has_one = function,
)]
pub routine: Box<Account<'info, FunctionRoutineAccountData>>,
pub enclave_signer: Signer<'info>,
}

Expand All @@ -30,7 +33,7 @@ impl RefreshPrices<'_> {
pub fn validate(
&self,
_ctx: &Context<Self>,
_params: &RefreshPricesParams
_params: &RefreshPricesParams,
) -> anchor_lang::Result<()> {
Ok(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ pub struct SetFunction<'info> {
)]
pub program: AccountLoader<'info, MyProgramState>,

// Make sure the function has at least one MrEnclave measurement defined.
pub switchboard_function: AccountLoader<'info, FunctionAccountData>,
#[account(
constraint = switchboard_routine.function == switchboard_function.key()
)]
pub switchboard_routine: Box<Account<'info, FunctionRoutineAccountData>>,

pub authority: Signer<'info>,
Expand Down

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

Loading

0 comments on commit d049b53

Please sign in to comment.