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 base64::{engine::general_purpose::STANDARD as base64, Engine as _}; | |
use wormhole_vaas::GuardianSetSig; | |
use wormhole_vaas::Vaa; | |
use libsecp256k1; | |
use hex; | |
use sha2::{Sha256, Digest}; | |
use wormhole_vaas::Readable; | |
pub const DUMMY_VAA: &str = "UE5BVQEAAAADuAEAAAADDQH2RWm2Z8mKR0pI+MW+n7QQz/rfif2tRO/L6b+eVhIR9GHc2MwpL+NYVcsBhkhAg0hx18C5eVD+dCYLwey5EHYlAAJfsE584lX5cPZ2Of9IE2xaMMD88L70IOlTB2XkFbbrcR4PTS7+OeSJvHubUrzggYK3lhyEwJ00wtfZcdUmHMwoAAOjCCNZSw/UDoT7Xvcb9dfQy9BnnvFlnfih0qlQuSErc3kKrGkGLpYaaErVPNHZ3R4BY605Bsvp2kBKammsPwKrAQQJEzvF0E1gpLPn97YnZdyL+yDao4osiMlGS2YDYQFg5XLBuhbFcscSY9nj2PN54KR7OzkDafNBNHMN0Xl7aydcAAZlE4aG6Zf1Pf4lPx2gbQgPCc9wyICVXFhvbYdOvIafDnlN+MmKBuQUCt3YWZybtA4CTKlbKGjG3BkXVPvxTQu8AQdGn1M5uWJwNMoqg842mEWy7XeU6ZAfZVPo3Q0gGhHtahWMfOHZ0TnXmhrJjGw6oO7pDGKqSUEr3Gm+rIO0e/fZAQiVdsBtWxfKhhZKZKCAtrZZHonKTHu91bYm9RvoJRY93gEUFgSzKbyUJpYEb7DO6aBHwclVtYYlr5M2L7l/ufshAAqasa+PaMyZLLSbCkbgSaATkxVe1y2Ze8TdtMpRaCwcQyTCEFUDmo6LUc5088ykvCrB50l7VDsslautlgrr+TUfAQvDQiBFP6NKV/g38NivyNAXzIcoCAVLUn6H1IlgCyVQBhIIjehwad5 |
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
import { Connection, PublicKey } from "@solana/web3.js"; | |
import { | |
BorshCoder, | |
BorshEventCoder, | |
EventParser, | |
Program, | |
web3, | |
} from "@coral-xyz/anchor"; | |
import { IDL } from "./idl"; |
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
import { Connection, PublicKey } from "@solana/web3.js"; | |
// Assuming you have initialized a connection to a Solana node | |
const connection = new Connection( | |
"https://switchboard.rpcpool.com/XXX" | |
); | |
// Public key of the program you want to get instructions for | |
const programId = new PublicKey("FFxRNZyzkQacQnkBD96ksKid4HScE5Bd33gKdyJ4aJyW"); |
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
import type { AccountInfo } from "@solana/web3.js"; | |
import { Connection, PublicKey } from "@solana/web3.js"; | |
import { Big, BigUtils, bs58 } from "@switchboard-xyz/common"; | |
import { OracleJob } from "@switchboard-xyz/common"; | |
async function fetchLatestSlotHash( | |
connection: Connection | |
): Promise<[bigint, string]> { | |
const slotHashesSysvarKey = new PublicKey( | |
"SysvarS1otHashes111111111111111111111111111" |
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
import type { AccountInfo } from "@solana/web3.js"; | |
import { Connection, PublicKey } from "@solana/web3.js"; | |
import { Big, BigUtils, bs58 } from "@switchboard-xyz/common"; | |
import { OracleJob } from "@switchboard-xyz/common"; | |
async function fetchLatestSlotHash( | |
connection: Connection | |
): Promise<[bigint, string]> { | |
const slotHashesSysvarKey = new PublicKey( | |
"SysvarS1otHashes111111111111111111111111111" |
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
import { | |
AptosAccount, | |
AptosClient, | |
BCS, | |
HexString, | |
TxnBuilderTypes, | |
} from "aptos"; | |
import type { EntryFunctionId, MoveStructTag } from "aptos/src/generated"; | |
import * as YAML from "yaml"; | |
import * as fs from "fs"; |
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
async pop(account: AptosAccount, pop_idx?: number): Promise<string> { | |
return await sendAptosTx( | |
this.client, | |
account, | |
`${this.switchboardAddress}::crank_pop_action::run`, | |
[HexString.ensure(this.address).hex(), pop_idx ?? 0], | |
[this.coinType] | |
); | |
} |
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
{% set arch_libdir = "/lib/x86_64-linux-gnu" %} | |
{% set log_level = "error" %} | |
sys.stack.size = "2048K" | |
sys.brk.max_size = "1024K" | |
loader.entrypoint = "file:{{ gramine.libos }}" | |
libos.entrypoint = "/sgx/app" | |
loader.log_level = "{{ log_level }}" |
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 v: Vec<Pin<Box<dyn Future<Output = Result<Decimal, SbError>>>>> = vec![ | |
Box::pin(switchboard_utils::exchanges::BitfinexApi::fetch_ticker("tETHUSD", None).map_ok(|x| x.last_price)), | |
Box::pin(switchboard_utils::exchanges::CoinbaseApi::fetch_ticker("ETH-USD", None).map_ok(|x| x.price)), | |
Box::pin(switchboard_utils::exchanges::HuobiApi::fetch_ticker("ethusdt", None).map_ok(|x| Decimal::from_f64(x.close).unwrap())), | |
Box::pin(switchboard_utils::exchanges::KrakenApi::fetch_ticker("ETHUSD", None).map_ok(|x| x.close[0])) | |
]; | |
let eth_prices: Vec<Decimal> = join_all(v).await.into_iter().filter_map(|x| x.ok()).collect(); |
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 tokio; | |
use balancer_sdk; | |
use balancer_sdk::Web3; | |
use web3; | |
use ethcontract; | |
use balancer_sdk::helpers::build_web3; | |
use balancer_sdk::helpers::*; | |
use balancer_sdk::*; | |
use balancer_sdk::{Address, U256}; | |
use balancer_sdk::helpers::*; |