migrate to steel

This commit is contained in:
Hardhat Chad
2024-09-25 06:45:37 +00:00
parent e8f0721fca
commit 7814e28847
21 changed files with 34 additions and 22 deletions

16
Cargo.lock generated
View File

@@ -1294,11 +1294,11 @@ dependencies = [
"drillx",
"mpl-token-metadata",
"num_enum",
"ore-utils",
"solana-program",
"spl-associated-token-account",
"spl-token",
"static_assertions",
"steel",
"thiserror",
]
@@ -1309,11 +1309,11 @@ dependencies = [
"drillx",
"mpl-token-metadata",
"ore-api",
"ore-utils",
"rand 0.8.5",
"solana-program",
"spl-associated-token-account",
"spl-token",
"steel",
]
[[package]]
@@ -2219,6 +2219,18 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "steel"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b09eae425248a8afcef3cf3300dfa548791194fa9fe519dadd5c57d7964dbc"
dependencies = [
"bytemuck",
"solana-program",
"spl-associated-token-account",
"spl-token",
]
[[package]]
name = "strsim"
version = "0.11.1"

View File

@@ -20,11 +20,11 @@ drillx = { version = "2.0.0", features = ["solana"] }
mpl-token-metadata = "4.1.2"
num_enum = "0.7.2"
ore-api = { path = "api", version = "2.1.9" }
ore-utils = { path = "utils", features = ["spl"], version = "2.1.9" }
solana-program = "^1.18"
spl-token = { version = "^4", features = ["no-entrypoint"] }
spl-associated-token-account = { version = "^2.3", features = [ "no-entrypoint" ] }
static_assertions = "1.1.0"
steel = { features = ["spl"], version = "0.1.0" }
thiserror = "1.0.57"

View File

@@ -16,9 +16,9 @@ const-crypto.workspace = true
drillx.workspace = true
mpl-token-metadata.workspace = true
num_enum.workspace = true
ore-utils.workspace = true
solana-program.workspace = true
spl-token.workspace = true
spl-associated-token-account.workspace = true
static_assertions.workspace = true
steel.workspace = true
thiserror.workspace = true

View File

@@ -1,5 +1,5 @@
use num_enum::IntoPrimitive;
use ore_utils::*;
use steel::*;
use thiserror::Error;
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]

View File

@@ -1,5 +1,5 @@
use bytemuck::{Pod, Zeroable};
use ore_utils::*;
use steel::*;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]

View File

@@ -1,6 +1,6 @@
use bytemuck::{Pod, Zeroable};
use num_enum::TryFromPrimitive;
use ore_utils::*;
use steel::*;
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]

View File

@@ -1,5 +1,5 @@
use ore_utils::*;
use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey};
use steel::*;
use crate::{
consts::*,

View File

@@ -1,6 +1,6 @@
use bytemuck::{Pod, Zeroable};
use ore_utils::*;
use solana_program::pubkey::Pubkey;
use steel::*;
use crate::consts::BUS;

View File

@@ -1,6 +1,6 @@
use bytemuck::{Pod, Zeroable};
use ore_utils::*;
use solana_program::pubkey::Pubkey;
use steel::*;
use crate::consts::CONFIG;

View File

@@ -1,6 +1,6 @@
use bytemuck::{Pod, Zeroable};
use ore_utils::*;
use solana_program::pubkey::Pubkey;
use steel::*;
use crate::consts::PROOF;

View File

@@ -1,6 +1,6 @@
use bytemuck::{Pod, Zeroable};
use ore_utils::*;
use solana_program::pubkey::Pubkey;
use steel::*;
use crate::consts::TREASURY;

View File

@@ -21,10 +21,10 @@ default = []
drillx.workspace = true
mpl-token-metadata.workspace = true
ore-api.workspace = true
ore-utils.workspace = true
solana-program.workspace = true
spl-token.workspace = true
spl-associated-token-account.workspace = true
steel.workspace = true
[dev-dependencies]
rand = "0.8.5"

View File

@@ -1,8 +1,8 @@
use ore_api::{consts::*, error::OreError, instruction::*, loaders::*, state::Proof};
use ore_utils::*;
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
};
use steel::*;
/// Claim distributes claimable ORE from the treasury to a miner.
pub fn process_claim(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {

View File

@@ -1,9 +1,9 @@
use ore_api::{loaders::*, state::Proof};
use ore_utils::*;
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
system_program,
};
use steel::*;
/// Close closes a proof account and returns the rent to the owner.
pub fn process_close(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {

View File

@@ -5,12 +5,12 @@ use ore_api::{
instruction::*,
state::{Bus, Config, Treasury},
};
use ore_utils::*;
use solana_program::{
self, account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
program_pack::Pack, system_program, sysvar,
};
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 {

View File

@@ -9,7 +9,6 @@ use ore_api::{
loaders::*,
state::{Bus, Config, Proof},
};
use ore_utils::*;
use solana_program::program::set_return_data;
#[allow(deprecated)]
use solana_program::{
@@ -24,6 +23,7 @@ use solana_program::{
slot_hashes::SlotHash,
sysvar::{self, Sysvar},
};
use steel::*;
/// Mine validates hashes and increments a miner's collectable balance.
pub fn process_mine(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {

View File

@@ -1,7 +1,6 @@
use std::mem::size_of;
use ore_api::{consts::*, instruction::Open, state::Proof};
use ore_utils::*;
use solana_program::{
account_info::AccountInfo,
clock::Clock,
@@ -12,6 +11,7 @@ use solana_program::{
system_program,
sysvar::{self, Sysvar},
};
use steel::*;
/// Open creates a new proof account to track a miner's state.
pub fn process_open(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {

View File

@@ -4,12 +4,12 @@ use ore_api::{
loaders::*,
state::{Bus, Config},
};
use ore_utils::*;
use solana_program::{
account_info::AccountInfo, clock::Clock, entrypoint::ProgramResult,
program_error::ProgramError, program_pack::Pack, sysvar::Sysvar,
};
use spl_token::state::Mint;
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 {

View File

@@ -1,9 +1,9 @@
use ore_api::{consts::*, instruction::Stake, loaders::*, state::Proof};
use ore_utils::*;
use solana_program::{
account_info::AccountInfo, clock::Clock, entrypoint::ProgramResult,
program_error::ProgramError, sysvar::Sysvar,
};
use steel::*;
/// Stake deposits ORE into a proof account to earn multiplier.
pub fn process_stake(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {

View File

@@ -1,8 +1,8 @@
use ore_api::{loaders::*, state::Proof};
use ore_utils::*;
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
};
use steel::*;
/// Update changes the miner authority on a proof account.
pub fn process_update(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {

View File

@@ -1,10 +1,10 @@
use ore_api::{consts::*, error::OreError, instruction::Stake};
use ore_utils::*;
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
program_pack::Pack,
};
use spl_token::state::Mint;
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 {