From 5350eae0b0362d653aee719178b3e38b8e1e6523 Mon Sep 17 00:00:00 2001 From: Hardhat Chad Date: Tue, 10 Jun 2025 07:59:45 -0700 Subject: [PATCH] uncommit --- api/src/instruction.rs | 22 +++++++++++----------- program/src/lib.rs | 6 +++--- program/src/{decommit.rs => uncommit.rs} | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) rename program/src/{decommit.rs => uncommit.rs} (93%) diff --git a/api/src/instruction.rs b/api/src/instruction.rs index 845f83e..e5e8574 100644 --- a/api/src/instruction.rs +++ b/api/src/instruction.rs @@ -6,10 +6,10 @@ pub enum OreInstruction { Open = 0, Close = 1, Commit = 2, - Decommit = 3, - Deposit = 4, - Mine = 5, - Swap = 6, + Deposit = 3, + Mine = 4, + Swap = 5, + Uncommit = 6, Withdraw = 7, } @@ -31,12 +31,6 @@ pub struct Commit { pub fee: [u8; 8], } -#[repr(C)] -#[derive(Clone, Copy, Debug, Pod, Zeroable)] -pub struct Decommit { - pub amount: [u8; 8], -} - #[repr(C)] #[derive(Clone, Copy, Debug, Pod, Zeroable)] pub struct Deposit { @@ -57,6 +51,12 @@ pub struct Swap { pub precision: u8, } +#[repr(C)] +#[derive(Clone, Copy, Debug, Pod, Zeroable)] +pub struct Uncommit { + pub amount: [u8; 8], +} + #[repr(C)] #[derive(Clone, Copy, Debug, Pod, Zeroable)] pub struct Withdraw { @@ -66,8 +66,8 @@ pub struct Withdraw { instruction!(OreInstruction, Open); instruction!(OreInstruction, Close); instruction!(OreInstruction, Commit); -instruction!(OreInstruction, Decommit); instruction!(OreInstruction, Deposit); instruction!(OreInstruction, Mine); instruction!(OreInstruction, Swap); +instruction!(OreInstruction, Uncommit); instruction!(OreInstruction, Withdraw); diff --git a/program/src/lib.rs b/program/src/lib.rs index 0e8a72e..7b29b83 100644 --- a/program/src/lib.rs +++ b/program/src/lib.rs @@ -1,19 +1,19 @@ mod close; mod commit; -mod decommit; mod deposit; mod mine; mod open; mod swap; +mod uncommit; mod withdraw; use close::*; use commit::*; -use decommit::*; use deposit::*; use mine::*; use open::*; use swap::*; +use uncommit::*; use withdraw::*; use ore_api::instruction::*; @@ -30,10 +30,10 @@ pub fn process_instruction( OreInstruction::Open => process_open(accounts, data)?, OreInstruction::Close => process_close(accounts, data)?, OreInstruction::Commit => process_commit(accounts, data)?, - OreInstruction::Decommit => process_decommit(accounts, data)?, OreInstruction::Deposit => process_deposit(accounts, data)?, OreInstruction::Mine => process_mine(accounts, data)?, OreInstruction::Swap => process_swap(accounts, data)?, + OreInstruction::Uncommit => process_uncommit(accounts, data)?, OreInstruction::Withdraw => process_withdraw(accounts, data)?, } diff --git a/program/src/decommit.rs b/program/src/uncommit.rs similarity index 93% rename from program/src/decommit.rs rename to program/src/uncommit.rs index 8d45ed3..8fc3644 100644 --- a/program/src/decommit.rs +++ b/program/src/uncommit.rs @@ -1,10 +1,10 @@ use ore_api::prelude::*; use steel::*; -/// Decommit from a block. -pub fn process_decommit(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult { +/// Uncommit from a block. +pub fn process_uncommit(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult { // Parse data. - let args = Decommit::try_from_bytes(data)?; + let args = Uncommit::try_from_bytes(data)?; let amount = u64::from_le_bytes(args.amount); // Load accounts.