This file contains 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
pub fn update_latest_value(&mut self, clock: &Clock) -> Result<()> { | |
self.last_update_timestamp = clock.unix_timestamp; | |
let mut max_staleness = self.max_staleness as u64; | |
if max_staleness == 0 { | |
max_staleness = clock.slot; | |
} | |
let submissions = self | |
.submissions | |
.iter() | |
.enumerate() |
This file contains 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
#!/bin/bash | |
WATCH_DIR="$HOME/mnt/workspaces" | |
mkdir -p "$WATCH_DIR" | |
DEFAULT_IMAGE="ubuntu-dev" | |
_create_or_start_container() { | |
local folder_name="$(basename "$1")" | |
if [[ -z "$folder_name" ]]; then |
This file contains 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
function collectSignerAddresses(obj: any, addresses = new Set()) { | |
if (Array.isArray(obj)) { | |
// Iterate over each element if it's an array. | |
for (const item of obj) { | |
collectSignerAddresses(item, addresses); | |
} | |
} else if (obj !== null && typeof obj === "object") { | |
// Iterate over object keys. | |
for (const key in obj) { | |
if (key === "signerAddress") { |
This file contains 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
let queue = QueueAccountData::load(&client, &queue_key).await.unwrap(); | |
let gw = &queue.fetch_gateways(&client).await.unwrap()[0]; | |
let crossbar = CrossbarClient::default(); | |
let (ix, _, _, luts) = PullFeed::fetch_update_ix(ctx, &client, FetchUpdateParams { | |
feed: feed, | |
payer: kp.pubkey(), | |
gateway: gw.clone(), | |
crossbar: Some(crossbar), | |
num_signatures: Some(3), | |
debug: Some(true), |
This file contains 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
#![allow(dead_code)] | |
use solana_sdk::pubkey::Pubkey; | |
use anchor_lang::{zero_copy, AnchorDeserialize}; | |
#[derive(AnchorDeserialize, Clone, Debug)] | |
pub enum Asset { | |
SOL(u64), | |
Token(Pubkey, Option<[u8; 33]>, u64), | |
} | |
#[derive(AnchorDeserialize, Clone, Debug)] |
This file contains 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
mod idl; | |
use idl::*; | |
use anchor_lang::{AnchorDeserialize}; | |
use anyhow::Result; | |
use anyhow_ext::Context; | |
use rust_decimal::Decimal; | |
use sanctum_lst_list::SanctumLstList; | |
use solana_client::nonblocking::rpc_client::RpcClient; | |
use solana_sdk::{program_pack::Pack, pubkey, pubkey::Pubkey}; | |
use spl_token::state::Mint; |
This file contains 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
use anyhow_ext::Context; | |
use std::sync::Arc; | |
use switchboard_on_demand_client::FetchUpdateBatchParams; | |
use serde_json; | |
use solana_client::nonblocking::rpc_client::RpcClient; | |
use solana_client::rpc_response::Response; | |
use solana_client::rpc_response::RpcSimulateTransactionResult; | |
use solana_sdk::compute_budget::ComputeBudgetInstruction; | |
use solana_sdk::message::VersionedMessage::V0; | |
use solana_sdk::message::v0::Message; |
This file contains 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
#[assert_size(128)] | |
#[zero_copy] | |
#[repr(C)] | |
#[derive(Default, Debug)] | |
pub struct CurrentResult { | |
/// The median value of the submissions needed for quorom size | |
pub value: i128, | |
/// The standard deviation of the submissions needed for quorom size | |
pub std_dev: i128, | |
/// The mean of the submissions needed for quorom size |
This file contains 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
use anchor_lang::zero_copy; | |
use anchor_lang::Discriminator; | |
use anchor_lang::account; | |
use anchor_lang::{AnchorDeserialize, AnchorSerialize}; | |
use anyhow::Result; | |
use anyhow_ext::Context; | |
use crate::calc_from_lst; | |
use crate::to_lst; | |
use rust_decimal::Decimal; | |
use sanctum_lst_list::SanctumLstList; |
This file contains 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
use anchor_lang::Discriminator; | |
use anchor_lang::account; | |
use anchor_lang::{AnchorDeserialize, AnchorSerialize}; | |
use anyhow::Result; | |
use anyhow_ext::Context; | |
use crate::calc_from_lst; | |
use crate::to_lst; | |
use rust_decimal::Decimal; | |
use sanctum_lst_list::SanctumLstList; | |
use solana_client::nonblocking::rpc_client::RpcClient; |
NewerOlder