mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 15:10:13 +00:00
config
This commit is contained in:
@@ -3,6 +3,7 @@ use steel::*;
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
|
||||
pub enum OreInstruction {
|
||||
// User
|
||||
Open = 0,
|
||||
Close = 1,
|
||||
Commit = 2,
|
||||
@@ -11,6 +12,11 @@ pub enum OreInstruction {
|
||||
Swap = 5,
|
||||
Uncommit = 6,
|
||||
Withdraw = 7,
|
||||
|
||||
// Admin
|
||||
SetAdmin = 10,
|
||||
SetFeeCollector = 9,
|
||||
SetFeeRate = 8,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
@@ -64,6 +70,24 @@ pub struct Withdraw {
|
||||
pub amount: [u8; 8],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct SetAdmin {
|
||||
pub admin: [u8; 32],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct SetFeeCollector {
|
||||
pub fee_collector: [u8; 32],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct SetFeeRate {
|
||||
pub fee_rate: [u8; 8],
|
||||
}
|
||||
|
||||
instruction!(OreInstruction, Open);
|
||||
instruction!(OreInstruction, Close);
|
||||
instruction!(OreInstruction, Commit);
|
||||
@@ -72,3 +96,6 @@ instruction!(OreInstruction, Mine);
|
||||
instruction!(OreInstruction, Swap);
|
||||
instruction!(OreInstruction, Uncommit);
|
||||
instruction!(OreInstruction, Withdraw);
|
||||
instruction!(OreInstruction, SetAdmin);
|
||||
instruction!(OreInstruction, SetFeeCollector);
|
||||
instruction!(OreInstruction, SetFeeRate);
|
||||
|
||||
@@ -4,11 +4,13 @@ use crate::state::config_pda;
|
||||
|
||||
use super::OreAccount;
|
||||
|
||||
// TODO Config stuff
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
||||
pub struct Config {}
|
||||
pub struct Config {
|
||||
pub admin: Pubkey,
|
||||
pub fee_collector: Pubkey,
|
||||
pub fee_rate: u64,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn pda() -> (Pubkey, u8) {
|
||||
|
||||
Reference in New Issue
Block a user