mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
upgrade instruction builder
This commit is contained in:
@@ -10,7 +10,7 @@ use solana_program::{
|
||||
|
||||
use crate::{
|
||||
impl_instruction_from_bytes, impl_to_bytes, BUS, BUS_ADDRESSES, CONFIG, CONFIG_ADDRESS,
|
||||
METADATA, MINT, MINT_ADDRESS, MINT_NOISE, PROOF, TREASURY, TREASURY_ADDRESS,
|
||||
METADATA, MINT, MINT_ADDRESS, MINT_NOISE, MINT_V1_ADDRESS, PROOF, TREASURY, TREASURY_ADDRESS,
|
||||
};
|
||||
|
||||
#[repr(u8)]
|
||||
@@ -358,6 +358,31 @@ pub fn stake(signer: Pubkey, sender: Pubkey, amount: u64) -> Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
// build an upgrade instruction.
|
||||
pub fn upgrade(signer: Pubkey, beneficiary: Pubkey, sender: Pubkey, amount: u64) -> Instruction {
|
||||
Instruction {
|
||||
program_id: crate::id(),
|
||||
accounts: vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new(beneficiary, false),
|
||||
AccountMeta::new(MINT_ADDRESS, false),
|
||||
AccountMeta::new(MINT_V1_ADDRESS, false),
|
||||
AccountMeta::new(sender, false),
|
||||
AccountMeta::new(TREASURY_ADDRESS, false),
|
||||
AccountMeta::new_readonly(spl_token::id(), false),
|
||||
],
|
||||
data: [
|
||||
OreInstruction::Upgrade.to_vec(),
|
||||
UpgradeArgs {
|
||||
amount: amount.to_le_bytes(),
|
||||
}
|
||||
.to_bytes()
|
||||
.to_vec(),
|
||||
]
|
||||
.concat(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds an initialize instruction.
|
||||
pub fn initialize(signer: Pubkey) -> Instruction {
|
||||
let bus_pdas = [
|
||||
|
||||
Reference in New Issue
Block a user