mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-23 15:10:37 +00:00
5x5
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
mod block;
|
||||
mod board;
|
||||
mod config;
|
||||
mod market;
|
||||
mod miner;
|
||||
mod square;
|
||||
mod treasury;
|
||||
|
||||
pub use block::*;
|
||||
pub use board::*;
|
||||
pub use config::*;
|
||||
pub use market::*;
|
||||
pub use miner::*;
|
||||
pub use square::*;
|
||||
pub use treasury::*;
|
||||
|
||||
use crate::consts::*;
|
||||
@@ -17,38 +17,40 @@ use steel::*;
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
|
||||
pub enum OreAccount {
|
||||
Block = 100,
|
||||
Config = 101,
|
||||
Market = 102,
|
||||
Miner = 103,
|
||||
Treasury = 104,
|
||||
|
||||
//
|
||||
Board = 105,
|
||||
Square = 106,
|
||||
}
|
||||
|
||||
pub fn block_pda(id: u64) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[BLOCK, &id.to_le_bytes()], &crate::ID)
|
||||
pub fn board_pda() -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[BOARD], &crate::ID)
|
||||
}
|
||||
|
||||
pub fn config_pda() -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[CONFIG], &crate::ID)
|
||||
}
|
||||
|
||||
pub fn market_pda() -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[MARKET], &crate::ID)
|
||||
}
|
||||
|
||||
pub fn miner_pda(authority: Pubkey) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[MINER, &authority.to_bytes()], &crate::ID)
|
||||
}
|
||||
|
||||
pub fn square_pda(id: u64) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[SQUARE, &id.to_le_bytes()], &crate::ID)
|
||||
}
|
||||
|
||||
pub fn vault_address() -> Pubkey {
|
||||
let market_address = market_pda().0;
|
||||
spl_associated_token_account::get_associated_token_address(&market_address, &MINT_ADDRESS)
|
||||
let board_address = board_pda().0;
|
||||
spl_associated_token_account::get_associated_token_address(&board_address, &MINT_ADDRESS)
|
||||
}
|
||||
|
||||
pub fn treasury_pda() -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[TREASURY], &crate::ID)
|
||||
}
|
||||
|
||||
pub fn treasury_tokens_address() -> Pubkey {
|
||||
spl_associated_token_account::get_associated_token_address(&TREASURY_ADDRESS, &MINT_ADDRESS)
|
||||
}
|
||||
// pub fn treasury_tokens_address() -> Pubkey {
|
||||
// spl_associated_token_account::get_associated_token_address(&TREASURY_ADDRESS, &MINT_ADDRESS)
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user