This file contains hidden or 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 anchor_lang::AnchorDeserialize; | |
use anyhow::Result; | |
use anyhow_ext::Context; | |
use idl::*; | |
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 hidden or 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
➜ rust-feeds-oracle $ sb solana on-demand queue print $QUEUE -u $RPC_URL | |
(node:91138) Warning: Mismatched version in @switchboard-xyz/cli plugin manifest. Expected: 3.5.11 Received: 3.5.10 | |
This usually means you have an oclif.manifest.json file that should be deleted in development. This file should be automatically generated when publishing. | |
(Use `node --trace-warnings ...` to show where the warning was created) | |
bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?) | |
## Queue A43DyUGA7s8eXPxqEjJY6EBu1KKbNgfxF8h17VAHn13w | |
authority 31Sof5r1xi7dfcaz4x9Kuwm8J9ueAdDduMcme59sP8gc | |
mrEnclavesLen 1 | |
mrEnclaves | |
mrEnclave-0 0000000000000000000000000000000000000000000000000000000000000000 |
This file contains hidden or 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
#[derive(Clone)] | |
pub struct RemainingAccounts<'info> { | |
pub feeds: Vec<AccountLoader<'info, PullFeedAccountData>>, | |
pub oracles: Vec<AccountLoader<'info, OracleAccountData>>, | |
pub oracle_stats: Vec<AccountLoader<'info, OracleStatsAccountData>>, | |
} | |
#[derive(Accounts)] | |
#[instruction(params: PullFeedSubmitResponseConsensusParams)] | |
pub struct PullFeedSubmitResponseConsensus<'info> { |
This file contains hidden or 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
docker run -it --rm \ | |
-v "$(pwd)/.cache:/app/.cache" \ | |
-v "/tmp/raydium.log:/tmp/raydium.log" \ | |
-v "$KP:/tmp/payer.json" \ | |
--entrypoint /app/trader \ | |
docker.io/mgild/r-aggregator:latest \ | |
--payer_path /tmp/payer.json --swap_mode true --swap_in "$SOL" --trade_size 10 --swap_out "$JUP" --loop_count 4 |
This file contains hidden or 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 in_token_account = get_associated_token_address(&user, &in_mint); | |
let out_token_account = get_associated_token_address(&user, &out_mint); | |
let atlas_in_token_account = get_associated_token_address(&ATLAS, &in_mint); | |
let atlas_out_token_account = get_associated_token_address(&ATLAS, &out_mint); | |
let swap_params = SwapParams { | |
swap_mode: jupiter_amm_interface::SwapMode::ExactIn, | |
in_amount: amount_in, | |
out_amount: 0, | |
source_mint: in_mint, | |
destination_mint: out_mint, |
This file contains hidden or 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
SENDING_SUBSCRIBE_REQUEST:SubscribeRequest { accounts: {"account_sub_924": SubscribeRequestFilterAccounts { account: ["44nPpmHyLzS5jpuJ9BZ129EtCKdFxUMnvX7hGpTF3u4S", "66pm9h8BPxadUAQArNQ15C4y6EuWgucBLe6SFKgbuyGQ", "uLnPghNvCampRPgr7CDNZCwcZusFG6Y65k4rnaTAA3M", "BE9KiJrZc349rWrYG8xQbXkdnet9LNm35FyAqHs2HkyR", "8DhDN2bUTiNzAFZbXbGxmpbVQc8QhHCboRmPjzarhKyh", "6sVrqxfM1FMdJL7vFeHdYjHQfGZ35dzfREPrNPuiFpXP", "6P5Z8Rn29LoKZmTAhDbztNhj2onK3muNjmnQhTGjjVCN", "BF329Vt6ReKFwM7Vou8j9EaQFkZfTcRpuKUgYeoFssJM", "6harUp8h8gyT9EbTkqbhGrLw31n39WuMVqvsaug65jtF", "2oekW3FMBBpDJCr282Kt2gaykNcnc5SsP1y6hCP9Qshe", "7F58cEqtR5To5DdrHAvcXH7Dcstxi7LVU9Kxtr5jZjCc", "4HZ4B3BTGmq9hGzkNWNjU82bvBzQrQv1wUav7mvYEJZd", "955dsQBS7Wa8TaDzwDBp4Cbh4SdezV5xZssdBdmUdE8e", "GSzJiohbe7hqRHmtigxXuVbet5EniwrfZm8wtqs4CHEF", "Er9nwygk6PASPSxWCWLRACQ6qmFhYPPP3YysoT9c6Jsq", "75GGH4VT3hmtV84B9hq6JhN27qTkDz9AZgHPtfdUwikV", "FJTSp43XbwNDktF1D9rg8D6zZjmsqmmauJSp6creTDzC", "F1dPedH4kFoagsFcAnR3F9kgxduY6GXVeLdjqg8qrt1s", "8tbznmK9HV58bmqBTEdxfCrAAquQLnKAedntdYnJxi |
This file contains hidden or 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 std::{collections::HashMap, str::FromStr}; | |
use anchor_lang::prelude::*; | |
use anyhow::{anyhow, Context, Result}; | |
use maplit::hashmap; | |
use num_traits::FromPrimitive; | |
use once_cell::sync::Lazy; | |
use rand::seq::SliceRandom; | |
use rust_decimal::Decimal; | |
use solana_client::nonblocking::rpc_client::RpcClient; |
This file contains hidden or 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 async fn swap_ix( | |
&self, | |
accounts: &HashMap<Pubkey, Vec<u8>>, | |
user: &Pubkey, | |
in_mint: &Pubkey, | |
out_mint: &Pubkey, | |
amount: u64) -> Result<Instruction, anyhow::Error> { | |
let reference_accounts = self.parse_all_accounts(accounts).await?; | |
let protocol_fee_recipients = reference_accounts.global_config.protocol_fee_recipients | |
.into_iter() |
This file contains hidden or 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
{ | |
"address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", | |
"metadata": { | |
"name": "pump_amm", | |
"version": "0.1.0", | |
"spec": "0.1.0", | |
"description": "Created with Anchor" | |
}, | |
"instructions": [ | |
{ |
This file contains hidden or 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 async fn calc_from_calculator( | |
client: &RpcClient, | |
mut calc: KnownLstSolValCalc, | |
) -> Result<Decimal> { | |
let accounts = calc.get_accounts_to_update(); | |
let account_datas: Vec<Account> = client | |
.get_multiple_accounts(&accounts.clone()) | |
.await | |
.map_err(|_| anyhow!("Failed to get accounts"))? | |
.into_iter() |