mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-20 23:16:46 +00:00
cleanup
This commit is contained in:
@@ -2,16 +2,12 @@ mod block;
|
||||
mod config;
|
||||
mod market;
|
||||
mod miner;
|
||||
mod permit;
|
||||
mod stake;
|
||||
mod treasury;
|
||||
|
||||
pub use block::*;
|
||||
pub use config::*;
|
||||
pub use market::*;
|
||||
pub use miner::*;
|
||||
pub use permit::*;
|
||||
pub use stake::*;
|
||||
pub use treasury::*;
|
||||
|
||||
use crate::consts::*;
|
||||
@@ -25,9 +21,7 @@ pub enum OreAccount {
|
||||
Config = 101,
|
||||
Market = 102,
|
||||
Miner = 103,
|
||||
Permit = 104,
|
||||
Stake = 105,
|
||||
Treasury = 106,
|
||||
Treasury = 104,
|
||||
}
|
||||
|
||||
pub fn block_pda(id: u64) -> (Pubkey, u8) {
|
||||
@@ -38,58 +32,16 @@ pub fn config_pda() -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[CONFIG], &crate::ID)
|
||||
}
|
||||
|
||||
pub fn market_pda(id: u64) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[MARKET, &id.to_le_bytes()], &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 mint_pda(id: u64) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[MINT, &id.to_le_bytes()], &crate::ID)
|
||||
}
|
||||
|
||||
pub fn collateral_pda(block_id: u64) -> (Pubkey, u8) {
|
||||
let block_address = block_pda(block_id).0;
|
||||
Pubkey::find_program_address(
|
||||
&[
|
||||
&block_address.to_bytes(),
|
||||
&spl_token::ID.to_bytes(),
|
||||
&MINT_ADDRESS.to_bytes(),
|
||||
],
|
||||
&crate::ID,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn commitment_pda(block_id: u64) -> (Pubkey, u8) {
|
||||
let block_address = block_pda(block_id).0;
|
||||
let mint_address = mint_pda(block_id).0;
|
||||
Pubkey::find_program_address(
|
||||
&[
|
||||
&block_address.to_bytes(),
|
||||
&spl_token::ID.to_bytes(),
|
||||
&mint_address.to_bytes(),
|
||||
],
|
||||
&crate::ID,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn vault_base_pda(block_id: u64) -> (Pubkey, u8) {
|
||||
let market_address = market_pda(block_id).0;
|
||||
let mint_address = mint_pda(block_id).0;
|
||||
Pubkey::find_program_address(
|
||||
&[
|
||||
&market_address.to_bytes(),
|
||||
&spl_token::ID.to_bytes(),
|
||||
&mint_address.to_bytes(),
|
||||
],
|
||||
&crate::ID,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn vault_quote_pda(block_id: u64) -> (Pubkey, u8) {
|
||||
let market_address = market_pda(block_id).0;
|
||||
pub fn vault_pda() -> (Pubkey, u8) {
|
||||
let market_address = market_pda().0;
|
||||
Pubkey::find_program_address(
|
||||
&[
|
||||
&market_address.to_bytes(),
|
||||
@@ -100,20 +52,6 @@ pub fn vault_quote_pda(block_id: u64) -> (Pubkey, u8) {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn permit_pda(authority: Pubkey, block_id: u64) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(
|
||||
&[PERMIT, &authority.to_bytes(), &block_id.to_le_bytes()],
|
||||
&crate::ID,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn stake_pda(authority: Pubkey, block_id: u64) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(
|
||||
&[STAKE, &authority.to_bytes(), &block_id.to_le_bytes()],
|
||||
&crate::ID,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn treasury_pda() -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[TREASURY], &crate::ID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user