From 7814e28847880ddd8a153c148d8042c8e0ed5400 Mon Sep 17 00:00:00 2001 From: Hardhat Chad Date: Wed, 25 Sep 2024 06:45:37 +0000 Subject: [PATCH] migrate to steel --- Cargo.lock | 16 ++++++++++++++-- Cargo.toml | 2 +- api/Cargo.toml | 2 +- api/src/error.rs | 2 +- api/src/event.rs | 2 +- api/src/instruction.rs | 2 +- api/src/loaders.rs | 2 +- api/src/state/bus.rs | 2 +- api/src/state/config.rs | 2 +- api/src/state/proof.rs | 2 +- api/src/state/treasury.rs | 2 +- program/Cargo.toml | 2 +- program/src/claim.rs | 2 +- program/src/close.rs | 2 +- program/src/initialize.rs | 2 +- program/src/mine.rs | 2 +- program/src/open.rs | 2 +- program/src/reset.rs | 2 +- program/src/stake.rs | 2 +- program/src/update.rs | 2 +- program/src/upgrade.rs | 2 +- 21 files changed, 34 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de7049f..d6efac7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml index 6d4b8d8..de4d323 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/api/Cargo.toml b/api/Cargo.toml index aad2498..d11cc5a 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -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 diff --git a/api/src/error.rs b/api/src/error.rs index b0653ba..408681d 100644 --- a/api/src/error.rs +++ b/api/src/error.rs @@ -1,5 +1,5 @@ use num_enum::IntoPrimitive; -use ore_utils::*; +use steel::*; use thiserror::Error; #[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)] diff --git a/api/src/event.rs b/api/src/event.rs index 9f41f25..b7068b3 100644 --- a/api/src/event.rs +++ b/api/src/event.rs @@ -1,5 +1,5 @@ use bytemuck::{Pod, Zeroable}; -use ore_utils::*; +use steel::*; #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] diff --git a/api/src/instruction.rs b/api/src/instruction.rs index 7010646..923b2c5 100644 --- a/api/src/instruction.rs +++ b/api/src/instruction.rs @@ -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)] diff --git a/api/src/loaders.rs b/api/src/loaders.rs index 881ca5d..925335d 100644 --- a/api/src/loaders.rs +++ b/api/src/loaders.rs @@ -1,5 +1,5 @@ -use ore_utils::*; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; +use steel::*; use crate::{ consts::*, diff --git a/api/src/state/bus.rs b/api/src/state/bus.rs index 0d07296..2c12776 100644 --- a/api/src/state/bus.rs +++ b/api/src/state/bus.rs @@ -1,6 +1,6 @@ use bytemuck::{Pod, Zeroable}; -use ore_utils::*; use solana_program::pubkey::Pubkey; +use steel::*; use crate::consts::BUS; diff --git a/api/src/state/config.rs b/api/src/state/config.rs index 35dded5..e35216c 100644 --- a/api/src/state/config.rs +++ b/api/src/state/config.rs @@ -1,6 +1,6 @@ use bytemuck::{Pod, Zeroable}; -use ore_utils::*; use solana_program::pubkey::Pubkey; +use steel::*; use crate::consts::CONFIG; diff --git a/api/src/state/proof.rs b/api/src/state/proof.rs index ba68660..33c0f4a 100644 --- a/api/src/state/proof.rs +++ b/api/src/state/proof.rs @@ -1,6 +1,6 @@ use bytemuck::{Pod, Zeroable}; -use ore_utils::*; use solana_program::pubkey::Pubkey; +use steel::*; use crate::consts::PROOF; diff --git a/api/src/state/treasury.rs b/api/src/state/treasury.rs index 20c34fc..289fc35 100644 --- a/api/src/state/treasury.rs +++ b/api/src/state/treasury.rs @@ -1,6 +1,6 @@ use bytemuck::{Pod, Zeroable}; -use ore_utils::*; use solana_program::pubkey::Pubkey; +use steel::*; use crate::consts::TREASURY; diff --git a/program/Cargo.toml b/program/Cargo.toml index 70af79c..1bf4718 100644 --- a/program/Cargo.toml +++ b/program/Cargo.toml @@ -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" diff --git a/program/src/claim.rs b/program/src/claim.rs index aedf620..7cf33cc 100644 --- a/program/src/claim.rs +++ b/program/src/claim.rs @@ -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 { diff --git a/program/src/close.rs b/program/src/close.rs index c12150c..4529e39 100644 --- a/program/src/close.rs +++ b/program/src/close.rs @@ -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 { diff --git a/program/src/initialize.rs b/program/src/initialize.rs index 6759876..b4255d0 100644 --- a/program/src/initialize.rs +++ b/program/src/initialize.rs @@ -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 { diff --git a/program/src/mine.rs b/program/src/mine.rs index 9efd3dc..40aa1ee 100644 --- a/program/src/mine.rs +++ b/program/src/mine.rs @@ -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 { diff --git a/program/src/open.rs b/program/src/open.rs index 4ded87c..f914af8 100644 --- a/program/src/open.rs +++ b/program/src/open.rs @@ -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 { diff --git a/program/src/reset.rs b/program/src/reset.rs index eda9489..a3abcfa 100644 --- a/program/src/reset.rs +++ b/program/src/reset.rs @@ -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 { diff --git a/program/src/stake.rs b/program/src/stake.rs index e64f5b3..08f33b5 100644 --- a/program/src/stake.rs +++ b/program/src/stake.rs @@ -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 { diff --git a/program/src/update.rs b/program/src/update.rs index c5a21e7..6ffdf3b 100644 --- a/program/src/update.rs +++ b/program/src/update.rs @@ -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 { diff --git a/program/src/upgrade.rs b/program/src/upgrade.rs index a167872..7530117 100644 --- a/program/src/upgrade.rs +++ b/program/src/upgrade.rs @@ -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 {