repo_id stringclasses 563
values | file_path stringlengths 40 166 | content stringlengths 1 2.94M | __index_level_0__ int64 0 0 |
|---|---|---|---|
solana_public_repos/openbook-dex/openbook-v2/programs/openbook-v2/src/state | solana_public_repos/openbook-dex/openbook-v2/programs/openbook-v2/src/state/orderbook/ordertree_iterator.rs | use super::*;
/// Iterate over orders in order (bids=descending, asks=ascending)
pub struct OrderTreeIter<'a> {
order_tree: &'a OrderTreeNodes,
/// InnerNodes where the right side still needs to be iterated on
stack: Vec<&'a InnerNode>,
/// To be returned on `next()`
next_leaf: Option<(NodeHandle, ... | 0 |
solana_public_repos/openbook-dex/openbook-v2/programs/openbook-v2/src/state | solana_public_repos/openbook-dex/openbook-v2/programs/openbook-v2/src/state/orderbook/mod.rs | pub use book::*;
pub use bookside::*;
pub use bookside_iterator::*;
pub use heap::*;
pub use nodes::*;
pub use order::*;
pub use order_type::*;
pub use ordertree::*;
pub use ordertree_iterator::*;
mod book;
mod bookside;
mod bookside_iterator;
mod heap;
mod nodes;
mod order;
mod order_type;
mod ordertree;
mod ordertre... | 0 |
solana_public_repos/openbook-dex/openbook-v2/programs/openbook-v2/src/state | solana_public_repos/openbook-dex/openbook-v2/programs/openbook-v2/src/state/orderbook/nodes.rs | use std::mem::{align_of, size_of};
use anchor_lang::prelude::*;
use bytemuck::{cast_mut, cast_ref};
use num_enum::{IntoPrimitive, TryFromPrimitive};
use static_assertions::const_assert_eq;
use super::order_type::Side;
pub type NodeHandle = u32;
const NODE_SIZE: usize = 88;
#[derive(IntoPrimitive, TryFromPrimitive)]... | 0 |
solana_public_repos/openbook-dex/openbook-v2/programs/openbook-v2/src/state | solana_public_repos/openbook-dex/openbook-v2/programs/openbook-v2/src/state/orderbook/book.rs | use crate::logs::*;
use crate::state::MAX_OPEN_ORDERS;
use crate::{
error::*,
state::{orderbook::bookside::*, EventHeap, Market, OpenOrdersAccount},
};
use anchor_lang::prelude::*;
use bytemuck::cast;
use std::cell::RefMut;
use super::*;
/// Drop at most this many expired orders from a BookSide when trying to... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib | solana_public_repos/openbook-dex/openbook-v2/lib/client/Cargo.toml | cargo-features = ["workspace-inheritance"]
[package]
edition = "2021"
name = "openbook-v2-client"
version = "0.3.0"
[lib]
doctest = false
[features]
default = ["openbook-v2/client"]
enable-gpl = ["openbook-v2/enable-gpl"]
[dependencies]
anchor-client = {workspace = true}
anchor-lang = {workspace = true}
anchor-spl ... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/gpa.rs | use anchor_lang::{AccountDeserialize, Discriminator};
use openbook_v2::state::OpenOrdersAccount;
use solana_account_decoder::UiAccountEncoding;
use solana_client::nonblocking::rpc_client::RpcClient as RpcClientAsync;
use solana_client::rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig};
use solana_client::r... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/util.rs | use anchor_lang::{error::Error, AccountDeserialize, ZeroCopy};
use solana_client::{
client_error::Result as ClientResult, rpc_client::RpcClient, rpc_request::RpcError,
};
use solana_sdk::transaction::Transaction;
use solana_sdk::{
clock::Slot, commitment_config::CommitmentConfig, signature::Signature,
trans... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/client.rs | use std::str::FromStr;
use std::sync::Arc;
use std::time::Duration;
use anchor_client::Cluster;
use anchor_lang::prelude::System;
use anchor_lang::{AccountDeserialize, Id};
use anchor_spl::associated_token::AssociatedToken;
use anchor_spl::token::Token;
use itertools::Itertools;
use openbook_v2::state::OracleConfig... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/lib.rs | pub use account_fetcher::*;
pub use book::*;
pub use client::*;
pub use context::*;
pub use jup::*;
pub use util::*;
mod account_fetcher;
pub mod account_update_stream;
mod book;
pub mod chain_data;
mod chain_data_fetcher;
mod client;
mod context;
mod gpa;
mod jup;
pub mod snapshot_source;
mod util;
| 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/jup.rs | use anchor_lang::__private::bytemuck::Zeroable;
use anchor_lang::prelude::*;
use anchor_spl::token::Token;
use anyhow::Result;
use fixed::types::I80F48;
use openbook_v2::{
accounts::PlaceTakeOrder,
accounts_zerocopy,
pubkey_option::NonZeroPubkeyOption,
state::{BookSide, EventHeap, Market, Orderbook, Sid... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/chain_data.rs | use {
solana_sdk::account::AccountSharedData, solana_sdk::pubkey::Pubkey, std::collections::HashMap,
};
pub use crate::chain_data_fetcher::AccountFetcher;
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SlotStatus {
Rooted,
Confirmed,
Processed,
}
#[derive(Clone, Debug)]
pub struct SlotData {
p... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/chain_data_fetcher.rs | use std::sync::{Arc, RwLock};
use std::thread;
use std::time::{Duration, Instant};
use crate::chain_data::*;
use anchor_lang::Discriminator;
use anchor_lang::AccountDeserialize;
use openbook_v2::accounts_zerocopy::LoadZeroCopy;
use openbook_v2::state::OpenOrdersAccount;
use anyhow::Context;
use solana_client::nonb... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/account_update_stream.rs | use solana_client::rpc_response::{Response, RpcKeyedAccount};
use solana_sdk::{account::AccountSharedData, pubkey::Pubkey};
use log::*;
use std::{str::FromStr, sync::Arc};
use crate::chain_data;
#[derive(Clone)]
pub struct AccountUpdate {
pub pubkey: Pubkey,
pub slot: u64,
pub account: AccountSharedData,... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/book.rs | use anchor_lang::prelude::Pubkey;
use anyhow::Result;
use fixed::types::I80F48;
use itertools::Itertools;
use openbook_v2::state::{
Market, Orderbook, Side, DROP_EXPIRED_ORDER_LIMIT, FILL_EVENT_REMAINING_LIMIT,
};
use std::collections::HashSet;
pub const MAXIMUM_TAKEN_ORDERS: u8 = 45;
const MAXIMUM_REMAINING_ACCOU... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/snapshot_source.rs | use jsonrpc_core_client::transports::http;
use serde_json::json;
use solana_account_decoder::{UiAccount, UiAccountEncoding};
use solana_client::{
rpc_config::{RpcAccountInfoConfig, RpcContextConfig, RpcProgramAccountsConfig},
rpc_request::RpcRequest,
rpc_response::{OptionalContext, Response, RpcKeyedAccoun... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/account_fetcher.rs | use std::collections::HashMap;
use std::sync::Arc;
use std::sync::Mutex;
use async_once_cell::unpin::Lazy;
use anyhow::Context;
use anchor_client::ClientError;
use anchor_lang::AccountDeserialize;
use solana_client::nonblocking::rpc_client::RpcClient as RpcClientAsync;
use solana_sdk::account::{AccountSharedData, R... | 0 |
solana_public_repos/openbook-dex/openbook-v2/lib/client | solana_public_repos/openbook-dex/openbook-v2/lib/client/src/context.rs | use openbook_v2::state::{Market, FEES_SCALE_FACTOR};
use solana_sdk::pubkey::Pubkey;
use std::convert::TryInto;
pub struct MarketContext {
pub address: Pubkey,
pub market: Market,
}
impl MarketContext {
pub fn max_quote_lots_including_taker_fees_from_usd(&self, quote_size_usd: u64) -> u64 {
self.m... | 0 |
solana_public_repos/openbook-dex/openbook-v2 | solana_public_repos/openbook-dex/openbook-v2/.vscode/settings.json | {
"rust-analyzer.cargo.features": ["enable-gpl", "test-bpf"]
}
| 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/client.ts | import {
type AnchorProvider,
BN,
Program,
type IdlTypes,
type IdlAccounts,
} from '@coral-xyz/anchor';
import { utf8 } from '@coral-xyz/anchor/dist/cjs/utils/bytes';
import {
NATIVE_MINT,
ASSOCIATED_TOKEN_PROGRAM_ID,
TOKEN_PROGRAM_ID,
createCloseAccountInstruction,
createInitializeAccount3Instructi... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/market.ts | import {
PublicKey,
type Connection,
type AccountInfo,
type Message,
} from '@solana/web3.js';
import {
type MarketAccount,
OPENBOOK_PROGRAM_ID,
getFilteredProgramAccounts,
nameToString,
} from './client';
import {
utils,
Program,
type Provider,
getProvider,
BN,
} from '@coral-xyz/anchor';
imp... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/index.ts | import { IDL, type OpenbookV2 } from './openbook_v2';
export * from './client';
export * from './accounts/bookSide';
export * from './accounts/eventHeap';
export * from './accounts/market';
export * from './accounts/openOrders';
export * from './accounts/openOrdersIndexer';
export * from './market';
export * from './s... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/openbook_v2.ts | export type OpenbookV2 = {
version: '0.1.0';
name: 'openbook_v2';
instructions: [
{
name: 'createMarket';
docs: [
'Create a [`Market`](crate::state::Market) for a given token pair.',
];
accounts: [
{
name: 'market';
isMut: true;
isSigner: t... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/test/openOrders.ts | import { PublicKey } from '@solana/web3.js';
import { Market, OpenOrders, SideUtils } from '..';
import { OpenOrdersIndexer } from '../accounts/openOrdersIndexer';
import { initOpenbookClient, initReadOnlyOpenbookClient } from './util';
async function testLoadIndexerNonExistent(): Promise<void> {
const client = init... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/test/util.ts | import { Connection, Keypair } from '@solana/web3.js';
import { OpenBookV2Client } from '..';
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
export function initReadOnlyOpenbookClient(): OpenBookV2Client {
const conn = new Connection(process.env.SOL_RPC_URL!);
const stubWallet = new Wallet(Keypair.gen... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/test/market.ts | import { PublicKey } from '@solana/web3.js';
import {
Market,
OPENBOOK_PROGRAM_ID,
findAccountsByMints,
findAllMarkets,
Watcher,
sleep,
BookSide,
} from '..';
import { initReadOnlyOpenbookClient } from './util';
async function testFindAccountsByMints(): Promise<void> {
const client = initReadOnlyOpenbo... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/utils/watcher.ts | import { Connection } from '@solana/web3.js';
import { BookSide, EventHeap, Market, OpenOrders } from '..';
export class Watcher {
accountSubs: { [pk: string]: number } = {};
constructor(public connection: Connection) {}
addMarket(market: Market, includeBook = true, includeEvents = true): this {
const { cl... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/utils/utils.ts | import {
PublicKey,
SystemProgram,
TransactionInstruction,
} from '@solana/web3.js';
import BN from 'bn.js';
import {
ASSOCIATED_TOKEN_PROGRAM_ID,
TOKEN_PROGRAM_ID,
} from '@solana/spl-token';
export const SideUtils = {
Bid: { bid: {} },
Ask: { ask: {} },
};
export const PlaceOrderTypeUtils = {
Limit:... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/utils/rpc.ts | import { type AnchorProvider } from '@coral-xyz/anchor';
import NodeWallet from '@coral-xyz/anchor/dist/cjs/nodewallet';
import {
type AddressLookupTableAccount,
ComputeBudgetProgram,
MessageV0,
type Signer,
type TransactionInstruction,
VersionedTransaction,
Transaction,
} from '@solana/web3.js';
export ... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/accounts/eventHeap.ts | import { PublicKey } from '@solana/web3.js';
import { AnyEvent, EventHeapAccount, FillEvent, Market, OutEvent } from '..';
export enum EventType {
Fill = 0,
Out = 1,
}
export class EventHeap {
constructor(
public pubkey: PublicKey,
public account: EventHeapAccount,
public market: Market,
) {}
p... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/accounts/openOrders.ts | import {
Keypair,
PublicKey,
Signer,
TransactionInstruction,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import { createAssociatedTokenAccountIdempotentInstruction } from '@solana/spl-token';
import {
FillEvent,
OpenBookV2Client,
OpenOrdersAccount,
OutEvent,
PlaceOrderType,
Sel... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/accounts/openOrdersIndexer.ts | import { PublicKey } from '@solana/web3.js';
import {
OpenBookV2Client,
OpenOrdersIndexerAccount,
OpenOrders,
Market,
BookSide,
SideUtils,
} from '..';
export class OpenOrdersIndexer {
constructor(
public client: OpenBookV2Client,
public pubkey: PublicKey,
public account: OpenOrdersIndexerAcc... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/accounts/market.ts | import Big from 'big.js';
import { BN } from '@coral-xyz/anchor';
import { PublicKey } from '@solana/web3.js';
import {
toNative,
MarketAccount,
OpenBookV2Client,
BookSide,
SideUtils,
nameToString,
EventHeapAccount,
EventHeap,
EventType,
} from '..';
const FEES_SCALE_FACTOR = new BN(1_000_000);
expo... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/accounts/bookSide.ts | import { PublicKey } from '@solana/web3.js';
import {
Market,
BookSideAccount,
SideUtils,
Side,
OpenBookV2Client,
LeafNode,
InnerNode,
U64_MAX_BN,
AnyNode,
} from '..';
import { BN } from '@coral-xyz/anchor';
import { Order } from '../structs/order';
function decodeOrderTreeRootStruct(data: Buffer) {... | 0 |
solana_public_repos/openbook-dex/openbook-v2/ts/client/src | solana_public_repos/openbook-dex/openbook-v2/ts/client/src/structs/order.ts | import { BN } from '@coral-xyz/anchor';
import { LeafNode, Market, Side, SideUtils, U64_MAX_BN } from '..';
export class Order {
public seqNum: BN;
public priceLots: BN;
constructor(
public market: Market,
public leafNode: LeafNode,
public side: Side,
public isExpired = false,
public isOracl... | 0 |
solana_public_repos/regolith-labs | solana_public_repos/regolith-labs/ore/Cargo.toml | [workspace]
resolver = "2"
members = ["api", "program"]
[workspace.package]
version = "2.7.0"
edition = "2021"
license = "Apache-2.0"
homepage = "https://ore.supply"
documentation = "https://docs.rs/ore-api/latest/ore_api/"
repository = "https://github.com/regolith-labs/ore"
readme = "./README.md"
keywords = ["solana"... | 0 |
solana_public_repos/regolith-labs | solana_public_repos/regolith-labs/ore/Cargo.lock | # This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "adler2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
[[package]]
name = "aead"
... | 0 |
solana_public_repos/regolith-labs | solana_public_repos/regolith-labs/ore/rust-toolchain.toml | [toolchain]
channel = "1.79.0"
components = [ "rustfmt", "rust-analyzer" ]
targets = [ "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin"]
profile = "minimal"
| 0 |
solana_public_repos/regolith-labs/ore | solana_public_repos/regolith-labs/ore/program/Cargo.toml | [package]
name = "ore-program"
description = "ORE is a proof-of-work token everyone can mine"
version.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
readme.workspace = true
keywords.workspace = true
build = "build.r... | 0 |
solana_public_repos/regolith-labs/ore | solana_public_repos/regolith-labs/ore/program/build.rs | use std::env;
use std::path::PathBuf;
use solana_include_idl::compress_idl;
/// Build script to compress the IDL file to a zip file when building the program.
///
/// The compressed IDL is then included in a separate ELF section on the program binary
/// when the program is built.
fn main() {
// Get the IDL path.... | 0 |
solana_public_repos/regolith-labs/ore/program | solana_public_repos/regolith-labs/ore/program/src/upgrade.rs | use steel::*;
/// Upgrade allows a user to migrate a v1 token to a v2 token at a 1:1 exchange rate.
pub fn process_upgrade(_accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
panic!("This instruction has been deprecated. v1 tokens are no longer eligable to upgrade.");
}
| 0 |
solana_public_repos/regolith-labs/ore/program | solana_public_repos/regolith-labs/ore/program/src/reset.rs | use ore_api::prelude::*;
use steel::*;
/// Reset tops up the bus balances, updates the base reward rate, and sets up the ORE program for the next epoch.
pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
// Load accounts.
let [signer_info, bus_0_info, bus_1_info, bus_2_info, bu... | 0 |
solana_public_repos/regolith-labs/ore/program | solana_public_repos/regolith-labs/ore/program/src/close.rs | use ore_api::prelude::*;
use steel::*;
/// Close closes a proof account and returns the rent to the owner.
pub fn process_close(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
// Load accounts.
let [signer_info, proof_info, system_program] = accounts else {
return Err(ProgramError::NotEn... | 0 |
solana_public_repos/regolith-labs/ore/program | solana_public_repos/regolith-labs/ore/program/src/stake.rs | use steel::*;
/// Stake deposits ORE into a proof account to earn multiplier.
pub fn process_stake(_accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
panic!("This instruction has been deprecated. Please stake with the boost program instead.");
}
| 0 |
solana_public_repos/regolith-labs/ore/program | solana_public_repos/regolith-labs/ore/program/src/lib.rs | mod claim;
mod close;
mod initialize;
mod mine;
mod open;
mod reset;
mod stake;
mod update;
mod upgrade;
use claim::*;
use close::*;
use initialize::*;
use mine::*;
use open::*;
use reset::*;
use stake::*;
use update::*;
use upgrade::*;
use ore_api::instruction::*;
// use solana_include_idl::{include_idl, parse::IdlT... | 0 |
solana_public_repos/regolith-labs/ore/program | solana_public_repos/regolith-labs/ore/program/src/initialize.rs | use ore_api::prelude::*;
use solana_program::program_pack::Pack;
use spl_token::state::Mint;
use steel::*;
/// Initialize sets up the ORE program to begin mining.
pub fn process_initialize(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
// Load accounts.
let [signer_info, bus_0_info, bus_1_info,... | 0 |
solana_public_repos/regolith-labs/ore/program | solana_public_repos/regolith-labs/ore/program/src/mine.rs | use std::mem::size_of;
use drillx::Solution;
use ore_api::prelude::*;
use ore_boost_api::state::{Boost, Stake};
#[allow(deprecated)]
use solana_program::{
keccak::hashv,
sanitize::SanitizeError,
serialize_utils::{read_pubkey, read_u16},
slot_hashes::SlotHash,
};
use steel::*;
/// Mine validates hashes... | 0 |
solana_public_repos/regolith-labs/ore/program | solana_public_repos/regolith-labs/ore/program/src/update.rs | use ore_api::prelude::*;
use steel::*;
/// Update changes the miner authority on a proof account.
pub fn process_update(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
// Load accounts.
let [signer_info, miner_info, proof_info] = accounts else {
return Err(ProgramError::NotEnoughAccountK... | 0 |
solana_public_repos/regolith-labs/ore/program | solana_public_repos/regolith-labs/ore/program/src/open.rs | use std::mem::size_of;
use ore_api::prelude::*;
use solana_program::{keccak::hashv, slot_hashes::SlotHash};
use steel::*;
/// Open creates a new proof account to track a miner's state.
pub fn process_open(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
// Load accounts.
let [signer_info, miner_... | 0 |
solana_public_repos/regolith-labs/ore/program | solana_public_repos/regolith-labs/ore/program/src/claim.rs | use ore_api::prelude::*;
use steel::*;
/// Claim distributes claimable ORE from the treasury to a miner.
pub fn process_claim(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {
// Parse args.
let args = Claim::try_from_bytes(data)?;
let amount = u64::from_le_bytes(args.amount);
// Load acco... | 0 |
solana_public_repos/regolith-labs/ore | solana_public_repos/regolith-labs/ore/api/Cargo.toml | [package]
name = "ore-api"
description = "API for interacting with the ORE program"
version.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
keywords.workspace = true
[dependencies]
array-const-fn-init.workspace = tr... | 0 |
solana_public_repos/regolith-labs/ore | solana_public_repos/regolith-labs/ore/api/idl.json | {
"kind": "rootNode",
"standard": "codama",
"version": "1.0.0",
"program": {
"kind": "programNode",
"name": "ore",
"publicKey": "oreV2ZymfyeXgNgBdqMkumTqqAprVqgBWQfoYkrtKWQ",
"version": "2.3.0",
"origin": "shank",
"docs": [],
"accounts": [
{
"k... | 0 |
solana_public_repos/regolith-labs/ore/api | solana_public_repos/regolith-labs/ore/api/src/consts.rs | use array_const_fn_init::array_const_fn_init;
use const_crypto::ed25519;
use solana_program::{pubkey, pubkey::Pubkey};
/// The authority allowed to initialize the program.
pub const INITIALIZER_ADDRESS: Pubkey = pubkey!("HBUh9g46wk2X89CvaNN15UmsznP59rh6od1h8JwYAopk");
/// The base reward rate to intialize the program... | 0 |
solana_public_repos/regolith-labs/ore/api | solana_public_repos/regolith-labs/ore/api/src/loaders.rs | use steel::*;
use crate::{
consts::*,
state::{Config, Treasury},
};
pub trait OreAccountInfoValidation {
fn is_bus(&self) -> Result<&Self, ProgramError>;
fn is_config(&self) -> Result<&Self, ProgramError>;
fn is_treasury(&self) -> Result<&Self, ProgramError>;
fn is_treasury_tokens(&self) -> Re... | 0 |
solana_public_repos/regolith-labs/ore/api | solana_public_repos/regolith-labs/ore/api/src/error.rs | use steel::*;
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
#[repr(u32)]
pub enum OreError {
#[error("The epoch has ended and needs reset")]
NeedsReset = 0,
#[error("The provided hash is invalid")]
HashInvalid = 1,
#[error("The provided hash did not satisfy the minimum required... | 0 |
solana_public_repos/regolith-labs/ore/api | solana_public_repos/regolith-labs/ore/api/src/sdk.rs | use drillx::Solution;
use steel::*;
use crate::{
consts::*,
instruction::*,
state::{bus_pda, config_pda, proof_pda, treasury_pda},
};
/// Builds an auth instruction.
pub fn auth(proof: Pubkey) -> Instruction {
Instruction {
program_id: NOOP_PROGRAM_ID,
accounts: vec![],
data: p... | 0 |
solana_public_repos/regolith-labs/ore/api | solana_public_repos/regolith-labs/ore/api/src/lib.rs | pub mod consts;
pub mod error;
pub mod event;
#[allow(deprecated)]
pub mod instruction;
pub mod loaders;
pub mod sdk;
pub mod state;
pub mod prelude {
pub use crate::consts::*;
pub use crate::error::*;
pub use crate::event::*;
pub use crate::instruction::*;
pub use crate::loaders::*;
pub use cr... | 0 |
solana_public_repos/regolith-labs/ore/api | solana_public_repos/regolith-labs/ore/api/src/event.rs | use steel::*;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct MineEvent {
pub balance: u64,
pub difficulty: u64,
pub last_hash_at: i64,
pub timing: i64,
pub reward: u64,
pub boost_1: u64,
pub boost_2: u64,
pub boost_3: u64,
}
event!(MineEvent);
| 0 |
solana_public_repos/regolith-labs/ore/api | solana_public_repos/regolith-labs/ore/api/src/instruction.rs | use steel::*;
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
pub enum OreInstruction {
// User
Claim = 0,
Close = 1,
Mine = 2,
Open = 3,
Reset = 4,
#[deprecated(since = "2.4.0", note = "Please stake with the boost program")]
Stake = 5,
Update = 6,
#[d... | 0 |
solana_public_repos/regolith-labs/ore/api/src | solana_public_repos/regolith-labs/ore/api/src/state/config.rs | use steel::*;
use super::OreAccount;
/// Config is a singleton account which manages program global variables.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Config {
/// The base reward rate paid out for a hash of minimum difficulty.
pub base_reward_rate: u64,
/// The time... | 0 |
solana_public_repos/regolith-labs/ore/api/src | solana_public_repos/regolith-labs/ore/api/src/state/mod.rs | mod bus;
mod config;
mod proof;
mod treasury;
pub use bus::*;
pub use config::*;
pub use proof::*;
pub use treasury::*;
use steel::*;
use crate::consts::*;
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
pub enum OreAccount {
Bus = 100,
Config = 101,
Proof = 102... | 0 |
solana_public_repos/regolith-labs/ore/api/src | solana_public_repos/regolith-labs/ore/api/src/state/treasury.rs | use steel::*;
use super::OreAccount;
/// Treasury is a singleton account which is the mint authority for the ORE token and the authority of
/// the program's global token account.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Treasury {}
account!(OreAccount, Treasury);
| 0 |
solana_public_repos/regolith-labs/ore/api/src | solana_public_repos/regolith-labs/ore/api/src/state/proof.rs | use steel::*;
use super::OreAccount;
/// Proof accounts track a miner's current hash, claimable rewards, and lifetime stats.
/// Every miner is allowed one proof account which is required by the program to mine or claim rewards.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Proof {
... | 0 |
solana_public_repos/regolith-labs/ore/api/src | solana_public_repos/regolith-labs/ore/api/src/state/bus.rs | use steel::*;
use super::OreAccount;
/// Bus accounts are responsible for distributing mining rewards. There are 8 busses total
/// to minimize write-lock contention and allow Solana to process mine instructions in parallel.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Bus {
/// T... | 0 |
solana_public_repos/orca-so | solana_public_repos/orca-so/whirlpools/Cargo.toml | [workspace]
resolver = "2"
members = [
"programs/*"
]
exclude = [
"rust-sdk",
"ts-sdk",
"docs",
"examples"
]
| 0 |
solana_public_repos/orca-so | solana_public_repos/orca-so/whirlpools/nx.json | {
"extends": "nx/presets/npm.json",
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"cache": true
},
"start": {
"dependsOn": ["^build"]
},
"test": {
"dependsOn": ["build"]
},
"lint": {
"dependsOn": ["build"]
}
},
"$schema": "./node_modules/nx... | 0 |
solana_public_repos/orca-so | solana_public_repos/orca-so/whirlpools/LICENSE | Copyright 2022 Orca Foundation
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, softwar... | 0 |
solana_public_repos/orca-so | solana_public_repos/orca-so/whirlpools/.yarnrc.yml | changesetBaseRefs:
- HEAD
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.5.1.cjs
| 0 |
solana_public_repos/orca-so | solana_public_repos/orca-so/whirlpools/Cargo.lock | # This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aead"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877"
dependencies = [
"generic-ar... | 0 |
solana_public_repos/orca-so | solana_public_repos/orca-so/whirlpools/Anchor.toml | [programs.localnet]
whirlpool = "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
[registry]
url = "https://anchor.projectserum.com"
[provider]
cluster = "localnet"
wallet = "~/.config/solana/id.json"
[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests"
[t... | 0 |
solana_public_repos/orca-so | solana_public_repos/orca-so/whirlpools/yarn.lock | # This file is generated by running "yarn install" inside your project.
# Manual changes might be lost - proceed with caution!
__metadata:
version: 8
cacheKey: 10c0
"@algolia/autocomplete-core@npm:1.17.7":
version: 1.17.7
resolution: "@algolia/autocomplete-core@npm:1.17.7"
dependencies:
"@algolia/autoco... | 0 |
solana_public_repos/orca-so | solana_public_repos/orca-so/whirlpools/package.json | {
"name": "@orca-so/whirlpools-monorepo",
"private": true,
"packageManager": "yarn@4.5.1",
"type": "module",
"scripts": {
"build": "nx run-many --target build --projects",
"start": "nx run-many --target start --projects",
"test": "nx run-many --target test --projects",
"format": "nx run-many -... | 0 |
solana_public_repos/orca-so | solana_public_repos/orca-so/whirlpools/tsconfig.json | {
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"module": "CommonJS",
"moduleResolution": "Node",
"jsx": "preserve",
"strict": true,
"removeComments": true,
"esModuleInterop": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,... | 0 |
solana_public_repos/orca-so/whirlpools/.yarn | solana_public_repos/orca-so/whirlpools/.yarn/releases/yarn-4.5.1.cjs | #!/usr/bin/env node
/* eslint-disable */
//prettier-ignore
(()=>{var j3e=Object.create;var gT=Object.defineProperty;var G3e=Object.getOwnPropertyDescriptor;var Y3e=Object.getOwnPropertyNames;var W3e=Object.getPrototypeOf,K3e=Object.prototype.hasOwnProperty;var ve=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Prox... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/lint/package.json | {
"name": "@orca-so/whirlpools-lint",
"private": true,
"type": "module",
"scripts": {
"format": "cd ../.. && prettier './**/*.{js,jsx,ts,tsx,json}' --write && eslint -c ts-sdk/lint/eslint.config.js --fix",
"lint": "cd ../.. && prettier --check './**/*.{js,jsx,ts,tsx,json}' && eslint -c ts-sdk/lint/eslin... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/lint/eslint.config.js | import typescript from "@typescript-eslint/eslint-plugin";
import parser from "@typescript-eslint/parser";
export default [
{
ignores: [
"**/dist",
"**/node_modules",
"**/.yarn",
"**/target",
"**/.nx",
"**/.anchor",
"**/artifacts",
"**/generated",
"**/.docusa... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/core/Cargo.toml | [package]
name = "orca_whirlpools_core_js_bindings"
version = "0.1.0"
publish = false
edition = "2021"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
orca_whirlpools_core = { path = "../../rust-sdk/core", features = ["wasm", "floats"] }
[profile.release]
opt-level = "s"
strip = true
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/core/package.json | {
"name": "@orca-so/whirlpools-core",
"description": "Orca's core typescript package.",
"version": "0.0.1",
"main": "./dist/nodejs/orca_whirlpools_core_js_bindings.js",
"types": "./dist/nodejs/orca_whirlpools_core_js_bindings.d.ts",
"browser": "./dist/browser/orca_whirlpools_core_js_bindings.js",
"type": ... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/core/typedoc.json | {
"entryPoints": ["./dist/nodejs/orca_whirlpools_core_js_bindings.d.ts"]
}
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/core/tsconfig.json | {
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["./tests/**/*.ts"]
}
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/core | solana_public_repos/orca-so/whirlpools/ts-sdk/core/tests/size.test.ts | import { execSync } from "child_process";
import { describe, it } from "vitest";
// FIXME: Renable this test when we remove stdlib from the wasm binary.
const WASM_SIZE_LIMIT = 25000; // 25KB
describe("Bundle size", () => {
it.skip("nodejs", () => {
const output = execSync(
"gzip -c dist/nodejs/orca_whir... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/core | solana_public_repos/orca-so/whirlpools/ts-sdk/core/tests/smoke.test.ts | import { describe, it } from "vitest";
import type {
PositionFacade,
TickArrayFacade,
TickFacade,
WhirlpoolFacade,
} from "../dist/nodejs/orca_whirlpools_core_js_bindings";
import {
collectFeesQuote,
collectRewardsQuote,
decreaseLiquidityQuote,
increaseLiquidityQuote,
swapQuoteByInputToken,
swapQuot... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/core | solana_public_repos/orca-so/whirlpools/ts-sdk/core/tests/types.test.ts | import { describe, it } from "vitest";
import type { Position, TickArray, Whirlpool } from "../../client/src";
import type {
PositionFacade,
TickArrayFacade,
WhirlpoolFacade,
} from "../dist/nodejs/orca_whirlpools_core_js_bindings";
// Since these tests are only for type checking, nothing actually happens at run... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/core | solana_public_repos/orca-so/whirlpools/ts-sdk/core/src/lib.rs | pub use orca_whirlpools_core::*;
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/integration/index.test.ts | import assert from "assert";
import { execSync } from "child_process";
import { readdirSync } from "fs";
import { describe, it } from "vitest";
const commandTemplates = [
"tsx --tsconfig {} ./index.ts",
"tsc --project {} --outDir ./dist && node ./dist/index.js",
// FIXME: ts-node does not play nice with ESM sinc... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/integration/package.json | {
"name": "@orca-so/whirlpools-integration",
"private": true,
"type": "module",
"scripts": {
"build": "tsc --noEmit",
"test": "vitest run index.test.ts"
},
"dependencies": {
"@orca-so/whirlpools": "*"
},
"devDependencies": {
"tsx": "^4.19.0",
"typescript": "^5.7.2"
}
}
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/integration/tsconfig.json | {
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["index.ts"]
}
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/integration/index.ts | import { DEFAULT_WHIRLPOOLS_CONFIG_ADDRESSES } from "@orca-so/whirlpools";
import { _POSITION_BUNDLE_SIZE } from "@orca-so/whirlpools-core";
import { WHIRLPOOL_PROGRAM_ADDRESS } from "@orca-so/whirlpools-client";
console.info(
DEFAULT_WHIRLPOOLS_CONFIG_ADDRESSES.solanaMainnet,
_POSITION_BUNDLE_SIZE(),
WHIRLPOOL_... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/integration | solana_public_repos/orca-so/whirlpools/ts-sdk/integration/configs/es6.json | {
"compilerOptions": {
"target": "ES6",
"module": "ES6",
"moduleResolution": "Node",
"skipLibCheck": true
},
"include": ["../index.ts"]
}
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/integration | solana_public_repos/orca-so/whirlpools/ts-sdk/integration/configs/nodenext.json | {
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"skipLibCheck": true
},
"include": ["../index.ts"]
}
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/integration | solana_public_repos/orca-so/whirlpools/ts-sdk/integration/configs/esnext.json | {
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"skipLibCheck": true
},
"include": ["../index.ts"]
}
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/package.json | {
"name": "@orca-so/whirlpools",
"version": "0.0.1",
"description": "Orca's high-level typescript sdk to interact with Orca's on-chain Whirlpool program.",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
"import": {
"types":... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/typedoc.json | {
"entryPoints": ["./src/index.ts"]
}
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk | solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tsconfig.json | {
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["./src/**/*.ts"]
}
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool | solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/e2e.test.ts | import { describe, it, beforeAll } from "vitest";
import {
createConcentratedLiquidityPoolInstructions,
createSplashPoolInstructions,
} from "../src/createPool";
import {
openFullRangePositionInstructions,
increaseLiquidityInstructions,
} from "../src/increaseLiquidity";
import { sendTransaction, rpc } from "./... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool | solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/openPosition.test.ts | import { describe, it, beforeAll } from "vitest";
import type { Address } from "@solana/web3.js";
import { assertAccountExists } from "@solana/web3.js";
import { setupAta, setupMint } from "./utils/token";
import {
setupAtaTE,
setupMintTE,
setupMintTEFee,
} from "./utils/tokenExtensions";
import { setupWhirlpool ... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool | solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/decreaseLiquidity.test.ts | import { describe } from "vitest";
describe.skip("Decrease Liquidity", () => {
// TODO: <-
});
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool | solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/harvest.test.ts | import { describe } from "vitest";
describe.skip("Harvest", () => {
// TODO: <-
});
| 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool | solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/position.test.ts | import type { Address } from "@solana/web3.js";
import { generateKeyPairSigner } from "@solana/web3.js";
import { assert, beforeAll, describe, it } from "vitest";
import { setupAta, setupMint } from "./utils/token";
import {
setupPosition,
setupPositionBundle,
setupTEPosition,
setupWhirlpool,
} from "./utils/pr... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool | solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/token.test.ts | import { describe, it, afterEach, vi, beforeAll, afterAll } from "vitest";
import { deleteAccount, rpc, sendTransaction, signer } from "./utils/mockRpc";
import {
fetchMaybeToken,
findAssociatedTokenPda,
TOKEN_PROGRAM_ADDRESS,
} from "@solana-program/token";
import {
fetchMint,
TOKEN_2022_PROGRAM_ADDRESS,
} f... | 0 |
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool | solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/createPool.test.ts | import { describe, it, beforeAll } from "vitest";
import {
createSplashPoolInstructions,
createConcentratedLiquidityPoolInstructions,
} from "../src/createPool";
import {
DEFAULT_FUNDER,
setDefaultFunder,
SPLASH_POOL_TICK_SPACING,
} from "../src/config";
import { setupMint } from "./utils/token";
import { set... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.