repo_id stringclasses 563
values | file_path stringlengths 40 166 | content stringlengths 1 2.94M | __index_level_0__ int64 0 0 |
|---|---|---|---|
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/ContributeWithVoteArgs.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
export type ContributeWithVoteArgs = {
am... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/VaultState.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
/**
* @category enums
* @category generat... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/VoteTicket.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as web3 from '@solana/web3.js'
import * as beet from '@metaplex-foundation/beet'
imp... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/CustomStrategy.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as web3 from '@solana/web3.js'
import * as beetSolana from '@metaplex-foundation/bee... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/PoolState.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
/**
* @category enums
* @category generat... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/CreatePoolArgs.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
import { Pool, poolBeet } from '../accounts... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/PoolAccess.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
import { TokenGateInfo, tokenGateInfoBeet }... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/AcceptanceStatus.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
/**
* @category enums
* @category generat... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/JoinPoolWithTokenArgs.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
import { Participant, participantBeet } fro... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/SybilStrategy.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as web3 from '@solana/web3.js'
import * as beet from '@metaplex-foundation/beet'
imp... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/index.ts | export * from './AcceptanceStatus'
export * from './ContributeWithVoteArgs'
export * from './CreatePoolArgs'
export * from './CreateVaultArgs'
export * from './CustomStrategy'
export * from './JoinPoolArgs'
export * from './JoinPoolWithTokenArgs'
export * from './PoolAccess'
export * from './PoolState'
export * from '.... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/VoteStatus.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
/**
* @category enums
* @category generat... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/RefreshArgs.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
import { Pool, poolBeet } from '../accounts... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/CreateVaultArgs.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
import { Vault, vaultBeet } from '../accoun... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/types/TokenGateInfo.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as web3 from '@solana/web3.js'
import * as beet from '@metaplex-foundation/beet'
imp... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/accounts/Pool.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
imp... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/accounts/Vault.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as web3 from '@solana/web3.js'
import * as beet from '@metaplex-foundation/beet'
imp... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/accounts/Participant.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as web3 from '@solana/web3.js'
import * as beet from '@metaplex-foundation/beet'
imp... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/accounts/VoteTable.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as web3 from '@solana/web3.js'
import * as beetSolana from '@metaplex-foundation/bee... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/accounts/index.ts | export * from './Participant'
export * from './Pool'
export * from './Vault'
export * from './VoteTable'
import { Participant } from './Participant'
import { Pool } from './Pool'
import { Vault } from './Vault'
import { VoteTable } from './VoteTable'
export const accountProviders = { Participant, Pool, Vault, VoteTab... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated | solana_public_repos/StockpileLabs/stockpile-lite/sdk/src/generated/errors/index.ts | /**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
type ErrorWithCode = Error & { code: number }
type MaybeErrorWithCode = ErrorWithCode | null ... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite | solana_public_repos/StockpileLabs/stockpile-lite/scripts/update-solana-dependencies.sh | #!/usr/bin/env bash
#
# Updates the solana version in all the SPL crates
#
here="$(dirname "$0")"
solana_ver=$1
if [[ -z $solana_ver ]]; then
echo "Usage: $0 <new-solana-version>"
exit 1
fi
if [[ $solana_ver =~ ^v ]]; then
# Drop `v` from v1.2.3...
solana_ver=${solana_ver:1}
fi
cd "$here"/..
echo "Updating... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite | solana_public_repos/StockpileLabs/stockpile-lite/src/processor.rs | use crate::instructions::*;
use shank::ShankInstruction;
use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
#[derive(BorshSerialize, BorshDeserialize, Debug, ShankInstruction)]
pub enum StockpileLite {
CreatePool(CreatePoolArgs... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite | solana_public_repos/StockpileLabs/stockpile-lite/src/error.rs | use thiserror::Error;
#[derive(Error, Debug)]
pub enum StockpileError {
#[error("I'm too lazy to write errors")]
DefaultError,
#[error("Pool is pending start")]
PendingStart,
#[error("Pool funds have been distributed")]
PoolDistributed,
#[error("This vault is closed")]
VaultClosed,
... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite | solana_public_repos/StockpileLabs/stockpile-lite/src/lib.rs | pub mod instructions;
pub mod processor;
pub mod utils;
pub mod state;
pub mod error;
use {
crate::processor::process_instruction,
solana_program::{entrypoint, declare_id}
};
declare_id!("BNsqbpyoGuh66NJh5tRw6DNqy6y6X9s6LgF6yunDGRKt");
entrypoint!(process_instruction); | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/instructions/join_pool_with_token.rs | use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
pubkey::Pubkey,
program::invoke_signed,
rent::Rent,
system_instruction,
sysvar::Sysvar,
program_error::ProgramError,
program_pack::Pack
};
... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/instructions/mod.rs | pub mod create_pool;
pub mod create_vault;
pub mod join_pool;
pub mod refresh;
pub mod join_pool_with_token;
pub mod contribute_with_vote;
pub mod accept_participant;
pub use create_pool::*;
pub use create_vault::*;
pub use join_pool::*;
pub use refresh::*;
pub use join_pool_with_token::*;
pub use contribute_with_vot... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/instructions/create_vault.rs | use borsh::{BorshSerialize, BorshDeserialize};
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
pubkey::Pubkey,
program::invoke_signed,
rent::Rent,
system_instruction,
sysvar::Sysvar,
};
use crate::{
state::Vault,
utils::validate_is_s... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/instructions/accept_participant.rs | use borsh::{BorshSerialize, BorshDeserialize};
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
program::invoke_signed,
pubkey::Pubkey,
program_error::ProgramError,
system_instruction,
rent::Rent,
sysvar::Sysvar
};
use crate::state::{
... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/instructions/join_pool.rs | use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
pubkey::Pubkey,
program::invoke_signed,
rent::Rent,
system_instruction,
sysvar::Sysvar,
program_error::ProgramError
};
use solana_program::msg;
... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/instructions/create_pool.rs | use borsh::{BorshSerialize, BorshDeserialize};
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
pubkey::Pubkey,
program::invoke_signed,
rent::Rent,
system_instruction,
sysvar::Sysvar,
};
use crate::{
state::Pool,
utils::validate_is_si... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/instructions/refresh.rs | use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{
account_info::AccountInfo,
entrypoint::ProgramResult,
pubkey::Pubkey,
};
use crate::state::{Participant, Pool};
#[derive(BorshSerialize, BorshDeserialize, Debug)]
pub struct RefreshArgs {
pub pool: Pool,
pub participants: Vec<Par... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/instructions/contribute_with_vote.rs | use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
program::{invoke, invoke_signed},
pubkey::Pubkey,
program_pack::Pack,
rent::Rent,
system_instruction,
sysvar::Sysvar,
program_error::Program... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/mod.rs | pub mod validation;
pub mod math;
pub use validation::*;
pub use math::*; | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src/utils | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/math/calc_pool_result.rs | use std::collections::BTreeMap;
use solana_program::{
program_error::ProgramError,
pubkey::Pubkey
};
// Calculates proportions given all
pub fn calc_pool_result(
vault_key: Pubkey,
votes: BTreeMap<Pubkey, f64>,
s_sq_all: f64,
) -> Result<f64, ProgramError> {
let final_proportion = match votes... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src/utils | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/math/mod.rs | // TODO: Benchmark compute usage
pub mod calc_sum_sqrt;
pub mod calc_pool_result;
pub mod calc_participant_result;
pub use calc_sum_sqrt::*;
pub use calc_pool_result::*;
pub use calc_participant_result::*; | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src/utils | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/math/calc_participant_result.rs | use solana_program::program_error::ProgramError;
// Calculates the final square, given chunks from each vote_table
pub fn calc_participant_result(
chunks: Vec<f64>
) -> Result<f64, ProgramError> {
let sum: f64 = chunks.iter().sum();
Ok(sum.powi(2))
} | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src/utils | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/math/calc_sum_sqrt.rs | use solana_program::program_error::ProgramError;
use crate::state::VoteTable;
// Calculates the sum of square roots for a single vote table account
pub fn calc_sum_sqrt(
vote_table: VoteTable
) -> Result<f64, ProgramError> {
let sum_of_square_roots: f64 = vote_table.table.values()
.map(|vote| (vote.am... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src/utils | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/validation/validate_indicies.rs | use solana_program::program_error::ProgramError;
// Validates two provided indicies match
pub fn validate_indicies(
index_one: u8,
index_two: u8,
) -> Result<(), ProgramError> {
assert_eq!(
index_one,
index_two,
"Provided indicies are mismatched"
);
Ok(())
} | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src/utils | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/validation/mod.rs | pub mod validate_ata;
pub mod validate_minimum_balance;
pub mod validate_is_signer;
pub mod validate_indicies;
pub mod validate_participant;
pub use validate_ata::*;
pub use validate_minimum_balance::*;
pub use validate_is_signer::*;
pub use validate_indicies::*;
pub use validate_participant::*; | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src/utils | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/validation/validate_ata.rs | use solana_program::{
pubkey::Pubkey,
program_error::ProgramError
};
use spl_token::state::Account;
// Validates a token account's owner and mint are as expected
pub fn validate_ata(
expected_owner: Pubkey,
expected_mint: Pubkey,
ata: Account
) -> Result<(), ProgramError> {
assert_eq!(
... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src/utils | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/validation/validate_participant.rs | use solana_program::{
program_error::ProgramError,
pubkey::Pubkey
};
use crate::state::{AcceptanceStatus, Participant};
// Validates a participant is bound to a pool & accepted
pub fn validate_participant(
participant: &Participant,
pool_account: &Pubkey
) -> Result<(), ProgramError> {
assert_eq!(... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src/utils | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/validation/validate_minimum_balance.rs | use solana_program::program_error::ProgramError;
use spl_token::state::Account;
use crate::state::TokenGateInfo;
// Validates a token account holds minimum pool balance
pub fn validate_minimum_balance(
info: &mut TokenGateInfo,
ata: Account
) -> Result<(), ProgramError> {
assert!(
ata.amount >= in... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src/utils | solana_public_repos/StockpileLabs/stockpile-lite/src/utils/validation/validate_is_signer.rs | use solana_program::{
account_info::AccountInfo,
program_error::ProgramError
};
// Validates an account is a signer
pub fn validate_is_signer(
account: &AccountInfo
) -> Result<(), ProgramError> {
assert!(
account.is_signer,
"Selected account must be a signer."
);
Ok(())
} | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/state/vote_table.rs | use std::collections::BTreeMap;
use borsh::{BorshDeserialize, BorshSerialize};
use shank::ShankAccount;
use solana_program::{sysvar::Sysvar, clock::Clock};
use solana_program::pubkey::Pubkey;
use crate::error::StockpileError;
#[derive(BorshDeserialize, BorshSerialize, Debug, Clone, ShankAccount)]
pub struct VoteTabl... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/state/mod.rs | pub mod pool;
pub mod vault;
pub mod participant;
pub mod vote_table;
pub mod pool_result;
pub use pool::*;
pub use vault::*;
pub use participant::*;
pub use vote_table::*;
pub use pool_result::*; | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/state/pool_result.rs | use std::collections::BTreeMap;
use borsh::{BorshDeserialize, BorshSerialize};
use shank::ShankAccount;
use solana_program::{
program_error::ProgramError,
pubkey::Pubkey
};
/// Stores pool result data. This account will continuously be written to in the process
/// of calculation results, which will likely ha... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/state/pool.rs | use borsh::{BorshDeserialize, BorshSerialize};
use shank::ShankAccount;
use solana_program::{sysvar::Sysvar, clock::Clock};
use solana_program::pubkey::Pubkey;
use crate::error::StockpileError;
#[derive(BorshDeserialize, BorshSerialize, Debug, Clone, ShankAccount)]
pub struct Pool {
pub name: String,
pub star... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/state/vault.rs | use borsh::{BorshDeserialize, BorshSerialize};
use shank::ShankAccount;
use solana_program::pubkey::Pubkey;
use crate::error::StockpileError;
#[derive(BorshDeserialize, BorshSerialize, Debug, ShankAccount)]
pub struct Vault {
pub name: String,
pub namespace: String,
pub authority: Pubkey,
pub vault_st... | 0 |
solana_public_repos/StockpileLabs/stockpile-lite/src | solana_public_repos/StockpileLabs/stockpile-lite/src/state/participant.rs | use borsh::{BorshDeserialize, BorshSerialize};
use shank::ShankAccount;
use solana_program::{sysvar::Sysvar, clock::Clock};
use solana_program::pubkey::Pubkey;
#[derive(BorshDeserialize, BorshSerialize, Debug, Default, ShankAccount)]
pub struct Participant {
pub pool_id: Pubkey,
pub vault_id: Pubkey,
pub t... | 0 |
solana_public_repos/StockpileLabs | solana_public_repos/StockpileLabs/stockpile-v2/Cargo.toml | [workspace]
members = [
"programs/*"
]
[profile.release]
overflow-checks = true
lto = "fat"
codegen-units = 1
[profile.release.build-override]
opt-level = 3
incremental = false
codegen-units = 1
| 0 |
solana_public_repos/StockpileLabs | solana_public_repos/StockpileLabs/stockpile-v2/LICENSE | GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Pream... | 0 |
solana_public_repos/StockpileLabs | solana_public_repos/StockpileLabs/stockpile-v2/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/StockpileLabs | solana_public_repos/StockpileLabs/stockpile-v2/.prettierignore |
.anchor
.DS_Store
target
node_modules
dist
build
test-ledger
| 0 |
solana_public_repos/StockpileLabs | solana_public_repos/StockpileLabs/stockpile-v2/Anchor.toml | [features]
seeds = false
skip-lint = false
[programs.localnet]
stockpile_v2 = "STKUaKniasuqrfer3XNbmrrc578pkL1XACdK8H3YPu8"
[programs.devnet]
stockpile_v2 = "STKUaKniasuqrfer3XNbmrrc578pkL1XACdK8H3YPu8"
[programs.mainnet]
stockpile_v2 = "STKUaKniasuqrfer3XNbmrrc578pkL1XACdK8H3YPu8"
[registry]
url = "https://api.apr.de... | 0 |
solana_public_repos/StockpileLabs | solana_public_repos/StockpileLabs/stockpile-v2/yarn.lock | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/runtime@^7.12.5", "@babel/runtime@^7.17.2":
version "7.21.0"
resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz"
integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaV... | 0 |
solana_public_repos/StockpileLabs | solana_public_repos/StockpileLabs/stockpile-v2/package-lock.json | {
"name": "stockpile-v2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"@project-serum/anchor": "^0.26.0",
"utf8": "^3.0.0"
},
"devDependencies": {
"@types/bn.js": "^5.1.0",
... | 0 |
solana_public_repos/StockpileLabs | solana_public_repos/StockpileLabs/stockpile-v2/package.json | {
"scripts": {
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
},
"dependencies": {
"@project-serum/anchor": "^0.26.0",
"utf8": "^3.0.0"
},
"devDependencies": {
"@types/bn.js": "^5.1.0",
"@typ... | 0 |
solana_public_repos/StockpileLabs | solana_public_repos/StockpileLabs/stockpile-v2/tsconfig.json | {
"compilerOptions": {
"types": ["mocha", "chai"],
"typeRoots": ["./node_modules/@types"],
"lib": ["es2015"],
"module": "commonjs",
"target": "es6",
"esModuleInterop": true
}
}
| 0 |
solana_public_repos/StockpileLabs/stockpile-v2 | solana_public_repos/StockpileLabs/stockpile-v2/migrations/deploy.ts | // Migrations are an early feature. Currently, they're nothing more than this
// single deploy script that's invoked from the CLI, injecting a provider
// configured from the workspace's Anchor.toml.
const anchor = require("@project-serum/anchor");
module.exports = async function (provider) {
// Configure client to... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2 | solana_public_repos/StockpileLabs/stockpile-v2/tests/stockpile-v2.ts | import * as anchor from "@project-serum/anchor";
import { Program } from "@project-serum/anchor";
import { StockpileV2 } from "../target/types/stockpile_v2";
import { utf8 } from "@project-serum/anchor/dist/cjs/utils/bytes";
/*
Localnet env works about half the time depending on version. These
tests are set to devnet ... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/Cargo.toml | [package]
name = "stockpile-trusts"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
name = "stockpile_trusts"
[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
[dependencies]
anchor-lang = { version = "0.28.0... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src/util.rs | use anchor_lang::prelude::*;
use anchor_lang::system_program;
use std::str::FromStr;
use crate::error::VaultError;
pub const MAX_NAME_LEN: usize = 100;
pub const MAX_ADMIN_LEN: usize = 4;
pub const STOCKPILE_PROGRAM_ID: &str = "STKUaKniasuqrfer3XNbmrrc578pkL1XACdK8H3YPu8";
pub const KAMINO_PROGRAM_ID: &str = "KLend2... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src/error.rs | use anchor_lang::prelude::*;
#[error_code]
pub enum VaultError {
#[msg("Attempting to withdraw from vault with account that is not the authority")]
WrongVaultAuthority,
#[msg("The project account provided is invalid")]
ProjectAccountInvalid,
#[msg("This mint is not current supported")]
M... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src/lib.rs | use anchor_lang::prelude::*;
pub mod instructions;
pub mod util;
pub mod state;
pub mod error;
pub use instructions::*;
use crate::state::vault::*;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod stockpile_trusts {
use super::*;
pub fn initialize_vault(ctx: Context<Initializ... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src/instructions/withdraw.rs | use anchor_lang::prelude::*;
use anchor_spl::{token, associated_token};
use stockpile_v2::{cpi::*, state::project::Project};
use klend::*;
use crate::{error::VaultError, util::{KLend, Stockpile}, YieldVault};
pub fn withdraw(
ctx: Context<Withdraw>,
_project_id: u64,
amount: u64
) -> Result<()> {
let ... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src/instructions/deposit.rs | use anchor_lang::prelude::*;
use anchor_spl::{token, associated_token};
use klend::*;
use crate::{error::VaultError, util::KLend};
pub fn deposit(
ctx: Context<Deposit>,
_project_id: u64,
amount: u64
) -> Result<()> {
// Check to make sure the token is supported
let cpi_ctx: CpiContext<'_, '_, '_,... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src/instructions/mod.rs | pub mod deposit;
pub mod withdraw;
pub mod init;
pub use deposit::*;
pub use withdraw::*;
pub use init::*; | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src/instructions/init.rs | use anchor_lang::prelude::*;
use crate::{Protocols, Intervals, YieldVault};
pub fn init(
ctx: Context<InitializeVault>,
_vault_id: u64,
protocol: Protocols,
interval: Intervals,
initial_amount: u64,
projects: Vec<Pubkey>,
mint: Pubkey,
) -> Result<()> {
ctx.accounts.vault.set_inner(
... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src/state/mod.rs | pub mod vault;
pub use vault::*; | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-trusts/src/state/vault.rs | use anchor_lang::prelude::*;
#[account]
pub struct YieldVault {
pub protocol: Protocols,
pub interval: Intervals,
pub initial_amount: u64,
pub vault_id: u64,
pub projects: Vec<Pubkey>,
pub mint: Pubkey,
pub bump: u8,
}
impl YieldVault {
pub const SEED_PREFIX: &'static str = "yield_vaul... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/Cargo.toml | [package]
name = "stockpile-v2"
version = "0.1.0"
description = "Funding Without Barriers."
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
name = "stockpile_v2"
[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
[dependencies]
anchor-lang = { version = "0.28.0",... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/Xargo.toml | [target.bpfel-unknown-unknown.dependencies.std]
features = []
| 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2 | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/util.rs | use anchor_lang::prelude::*;
use anchor_lang::system_program;
use std::str::FromStr;
use crate::error::ProtocolError;
pub const MAX_NAME_LEN: usize = 100;
pub const MAX_ADMIN_LEN: usize = 4;
pub const USDC_MINT: &str = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
pub const USDC_DEVNET_MINT: &str = "4zMMC9srt5Ri5X... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2 | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/error.rs | use anchor_lang::prelude::*;
#[error_code]
pub enum ProtocolError {
#[msg("The Pyth account provided is invalid")]
PythAccountInvalid,
#[msg("Failed to load price feed from Pyth account")]
PythPriceFeedLoadFailed,
#[msg("Failed to price from Pyth price feed. Perhaps price was too old")]
PythP... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2 | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/lib.rs | /*
ββββββββββββββββββ
ββββββββββββββββββ
βββββββββββββββββ βββββββ ββββββββββ ββββββββββ ββββββ ββββββββ
βββββββββββββββββββββββββββββββββββββ ββββββββββββββββββ ββββββββ
ββββββββ βββ βββ ββββββ βββββββ ββββββββββββββ ββββββ
ββββββββ βββ βββ ββββββ βββββββ βββββββ ββββββ βββββ... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2 | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/Xargo.toml | [target.bpfel-unknown-unknown.dependencies.std]
features = []
| 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/extend_pool_start.rs | use anchor_lang::prelude::*;
use crate::{state::pool::*, error::ProtocolError};
/// Extends the duration of the pool by
/// updating it's end field with a new timestamp.
/// This instruction can only extend a pool, not shorten.
pub fn extend_pool_start(
ctx: Context<ExtendPoolStart>,
_pool_id: u64,
new_st... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/resolve_milestone.rs | use anchor_lang::prelude::*;
use anchor_spl::{token, associated_token};
use crate::error::ProtocolError;
use crate::state::{
pool::*,
project::*,
};
/// Setup for milestone resolution. This sends the proportion of project funds
/// put up in the milestone to a Squads multisig for final resolution.
pub fn reso... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/extend_pool_duration.rs | use anchor_lang::prelude::*;
use crate::{state::pool::*, error::ProtocolError};
/// Extends the duration of the pool by
/// updating it's end field with a new timestamp.
/// This instruction can only extend a pool, not shorten.
pub fn extend_pool_duration(
ctx: Context<ExtendPool>,
_pool_id: u64,
new_end_... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/close_milestone.rs | use anchor_lang::prelude::*;
use crate::{state::{
milestone::*,
project::*,
}, error::ProtocolError};
/// Closes a 'Milestone'
pub fn close_milestone(
ctx: Context<CloseMilestone>,
) -> Result<()> {
let payer_key = &mut ctx.accounts.payer.key();
let project = &mut ctx.accounts.project;
let mil... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/withdraw.rs | use anchor_lang::prelude::*;
use anchor_spl::{token, associated_token};
use crate::error::ProtocolError;
use crate::state::project::*;
/// Withdraws a specified amount of USDC from the vault
/// and sends to the beneficiary. Requires that the payer
/// be a fundraiser admin.
pub fn withdraw(ctx: Context<Withdraw>, a... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/create_source.rs | use anchor_lang::prelude::*;
use crate::state::source::*;
pub fn create_source(
ctx: Context<CreateSource>,
name: String,
pool_id: u64,
amount: u64,
) -> Result<()> {
ctx.accounts.source.set_inner(
FundingSource::new(
name,
ctx.accounts.payer.key(),
pool... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/claim_payout.rs | use anchor_lang::prelude::*;
use anchor_spl::{token, associated_token};
use crate::error::ProtocolError;
use crate::state::{
pool::*,
project::*,
};
/// Claim's a project's payout from a pool
/// that has completed.
pub fn claim_payout(
ctx: Context<ClaimPayout>,
_project_id: u64,
_pool_id: u64,
)... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/add_project.rs | use anchor_lang::prelude::*;
use crate::error::ProtocolError;
use crate::state::{
pool::*,
project::*,
};
// Adds a fundraiser to a funding round
// This requires the instruction to be called
// by a registered admin of the pool
pub fn add_project(ctx: Context<AddProject>, _project_id: u64, _pool_id: u64) ->... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/update_pool.rs | use anchor_lang::prelude::*;
use crate::{state::pool::*, error::ProtocolError};
/// Updates a pool, given a specific field
pub fn update_pool(
ctx: Context<UpdatePool>,
_pool_id: u64,
update_field: UpdatePoolField,
) -> Result<()> {
let payer_key = &mut ctx.accounts.payer.key();
let pool = &mut ct... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/mod.rs | pub mod add_project;
pub mod close_milestone;
pub mod close_project;
pub mod contribute;
pub mod contribute_with_vote;
pub mod create_milestone;
pub mod create_pool;
pub mod create_project;
pub mod create_source;
pub mod deactivate_project;
pub mod fund_pool;
pub mod join_pool;
pub mod withdraw;
pub mod withdraw_all;
p... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/create_project.rs | use anchor_lang::prelude::*;
use crate::state::project::*;
/// Creates a `Project` for a project.
/// This project can be re-entered in funding rounds and
/// only needs to be created as a `Project` once.
pub fn create_project(
ctx: Context<CreateProject>,
project_id: u64,
name: String,
mut admins: Ve... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/join_pool.rs | use anchor_lang::prelude::*;
use crate::error::ProtocolError;
use crate::state::{
pool::*,
project::*,
};
// Adds a fundraiser into a funding round.
// This is subject to stipulations depending on the pool config.
// i.e: Some pools will require manual approval.
pub fn join_pool(ctx: Context<JoinPool>, _proj... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/fund_pool.rs | use anchor_lang::prelude::*;
use anchor_spl::{token, associated_token};
use crate::state::pool::*;
use crate::util::{mint_is_supported, set_and_maybe_realloc, to_pubkey, USDC_DEVNET_MINT};
/// Funds a pool from a `Source` with an SPL Token.
/// Pools can be funded at any time, they don't have to be active.
/// They j... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/contribute.rs | use anchor_lang::prelude::*;
use anchor_spl::{token, associated_token};
use crate::state::project::*;
use crate::util::mint_is_supported;
pub fn contribute(
ctx: Context<Contribute>,
_project_id: u64,
amount: u64,
) -> Result<()> {
// Check to make sure the token is supported
mint_is_supported(&ct... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/deactivate_project.rs | use anchor_lang::prelude::*;
use crate::error::ProtocolError;
use crate::state::project::*;
pub fn deactivate_project(ctx: Context<DeactivateProject>) -> Result<()> {
let project = &mut ctx.accounts.project;
let agent = ctx.accounts.payer.key();
if project.admins.contains(&agent) {
project.status... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/create_pool.rs | use anchor_lang::prelude::*;
use crate::state::pool::*;
pub fn create_pool(
ctx: Context<CreatePool>,
pool_id: u64,
name: String,
start: u64,
end: u64,
admins: Vec<Pubkey>,
access: PoolAccess,
) -> Result<()> {
ctx.accounts.pool.set_inner(
Pool::new(
pool_id,
... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/create_milestone.rs | use anchor_lang::prelude::*;
use crate::{state::{
milestone::*,
project::*,
}, error::ProtocolError};
/// Creates a `Milestone` for a project.
/// These can be added to accompany a fundraiser
pub fn create_milestone(
ctx: Context<CreateMilestone>,
milestone_id: u64,
name: String,
percentage: f... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/update_project.rs | use anchor_lang::prelude::*;
use crate::{state::project::*, error::ProtocolError};
/// Updates a project, given a specific field
pub fn update_project(
ctx: Context<UpdateProject>,
_project_id: u64,
update_field: UpdateField,
) -> Result<()> {
let payer_key = &mut ctx.accounts.payer.key();
let pro... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/withdraw_funds_from_round.rs | use anchor_lang::prelude::*;
use anchor_spl::{token, associated_token};
use crate::error::ProtocolError;
use crate::state::pool::*;
/// Withdraws all of the USDC from the round
/// and sends it back to the payer. Requires that the payer
/// be a fundraiser admin. This can only be called before a round begins,
/// or... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/realloc_pool.rs | use anchor_lang::prelude::*;
use crate::state::pool::*;
pub fn realloc_pool(
ctx: Context<ReallocPool>,
_pool_id: u64,
) -> Result<()> {
ctx.accounts.pool.to_account_info().realloc((ctx.accounts.pool.try_to_vec()?).len() + 9000, false)?;
Ok(())
}
#[derive(Accounts)]
#[instruction(
pool_id: u64,
... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/close_project.rs | use anchor_lang::prelude::*;
use crate::state::project::*;
use crate::error::ProtocolError;
/// Closes a 'Project'
pub fn close_project(
ctx: Context<CloseProject>,
) -> Result<()> {
let payer_key = &mut ctx.accounts.payer.key();
let project = &mut ctx.accounts.project;
project.is_active()?;
if ... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/contribute_with_vote.rs | use anchor_lang::prelude::*;
use anchor_spl::{token, associated_token};
use solana_gateway::Gateway;
use crate::error::ProtocolError;
use crate::state::{
pool::*,
project::*,
};
use crate::util::{
USDC_USD_PRICE_FEED_ID,
set_and_maybe_realloc,
mint_is_supported,
to_pubkey
};
// Makes a cont... | 0 |
solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src | solana_public_repos/StockpileLabs/stockpile-v2/programs/stockpile-v2/src/instructions/withdraw_all.rs | use anchor_lang::prelude::*;
use anchor_spl::{token, associated_token};
use crate::error::ProtocolError;
use crate::state::project::*;
/// Withdraws all of the USDC from the vault
/// and sends to the beneficiary. Requires that the payer
/// be a fundraiser admin.
pub fn withdraw_all(ctx: Context<WithdrawAll>) -> Re... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.