Skip to content

Instantly share code, notes, and snippets.

## Queue Data
publicKey A43DyUGA7s8eXPxqEjJY6EBu1KKbNgfxF8h17VAHn13w
authority 31Sof5r1xi7dfcaz4x9Kuwm8J9ueAdDduMcme59sP8gc
mrEnclavesLen 1
mrEnclaves
mrEnclave-0 0x0000000000000000000000000000000000000000000000000000000000000000
queueSolBalance 4.131500000
queueSwitchBalance 961863551.599331786
## Queue Data
publicKey A43DyUGA7s8eXPxqEjJY6EBu1KKbNgfxF8h17VAHn13w
authority 31Sof5r1xi7dfcaz4x9Kuwm8J9ueAdDduMcme59sP8gc
mrEnclavesLen 1
mrEnclaves
mrEnclave-0 0x0000000000000000000000000000000000000000000000000000000000000000
queueSolBalance 2.234500000
queueSwitchBalance 961863551.599331786
.section .text
.globl assert_pubkey_eq_ed25519_sysvar_asm
.type assert_pubkey_eq_ed25519_sysvar_asm, @function
assert_pubkey_eq_ed25519_sysvar_asm:
// r1 = pubkey_ptr
// Load and compare first 8 bytes with ED25519_PROGRAM_ID[0]
ldxdw r3, [r1+0]
jne r3, 0xbefb937cd6467d03, fail
.section .text
.globl assert_pubkey_eq_u64_asm
.type assert_pubkey_eq_u64_asm, @function
assert_pubkey_eq_u64_asm:
// r1 = lhs_ptr, r2 = rhs_ptr
// Load and compare first 8 bytes
ldxdw r3, [r1+0]
ldxdw r4, [r2+0]
impl Instructions {
#[inline(always)]
pub fn write_instruction_0_data(data: &[u8], dst: &mut [u8]) -> u16 {
unsafe {
let base = data.as_ptr();
let p = base.add((base.add(2) as *const u16).read_unaligned() as usize);
let _ = 1u8 / (*p | *p.add(1) == 0) as u8; // trap if non-zero (ensures no accounts are passed to the ed25519 verify ix)
let len = min_branchless((p.add(34) as *const u16).read_unaligned(), dst.len() as u16);
solana_define_syscall::definitions::sol_memcpy_(dst.as_mut_ptr(), p.add(36), len as u64);
import * as sb from "@switchboard-xyz/on-demand";
import {
Connection,
Transaction,
sendAndConfirmTransaction,
Keypair,
PublicKey,
} from "@solana/web3.js";
import { TX_CONFIG } from "./utils";
@mgild
mgild / x.rs
Last active August 14, 2025 18:50
use sb_on_demand_schemas::{FeedRequestV2};
/// Creates the exact BTC v2 feed structure for testing
pub fn create_btc_v2_feed() -> Result<OracleFeed> {
use protos::oracle_job::oracle_job::{Task, HttpTask, JsonParseTask, http_task, json_parse_task};
// Create HTTP task
let http_task = Task {
task: Some(protos::oracle_job::oracle_job::task::Task::HttpTask(HttpTask {
url: Some("https://www.binance.com/api/v3/ticker/price?symbol=BTCUSDT".to_string()),
#!/usr/bin/env ts-node
import { normalizeOracleFeed, serializeOracleFeed } from './lib/utils/oracle-feed.js';
import { FeedHash } from './lib/FeedHash.js';
async function createBtcFeedDemo() {
console.log('🚀 Creating BTC v2 Oracle Feed...\n');
// Create the exact feed structure as provided
const feedDefinition = {
use anyhow::{anyhow, Context};
use rust_decimal::Decimal;
use solana_sdk::{pubkey, pubkey::Pubkey};
use spl_token_2022::{
extension::{
interest_bearing_mint::InterestBearingConfig, BaseStateWithExtensions,
StateWithExtensionsOwned,
},
state::Mint as Mint2022,
};
version: '3.8'
services:
crossbar:
image: switchboardlabs/crossbar:latest
depends_on:
- ipfs
ports:
- "8080:8080"
environment: