mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-17 23:16:48 +00:00
cleanup imports
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
use ore_api::{consts::*, error::OreError, instruction::Stake};
|
||||
use solana_program::{
|
||||
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
|
||||
program_pack::Pack,
|
||||
};
|
||||
use spl_token::state::Mint;
|
||||
use steel::*;
|
||||
|
||||
/// Upgrade allows a user to migrate a v1 token to a v2 token at a 1:1 exchange rate.
|
||||
@@ -24,7 +19,7 @@ pub fn process_upgrade(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResu
|
||||
.to_token_account()?
|
||||
.check(|t| t.owner == *signer_info.key)?
|
||||
.check(|t| t.mint == MINT_ADDRESS)?;
|
||||
mint_info
|
||||
let mint = mint_info
|
||||
.is_writable()?
|
||||
.has_address(&MINT_ADDRESS)?
|
||||
.to_mint()?;
|
||||
@@ -62,14 +57,11 @@ pub fn process_upgrade(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResu
|
||||
let amount_to_mint = amount.saturating_mul(100);
|
||||
|
||||
// Cap at max supply.
|
||||
let mint_data = mint_info.data.borrow();
|
||||
let mint = Mint::unpack(&mint_data)?;
|
||||
if mint.supply.saturating_add(amount_to_mint).gt(&MAX_SUPPLY) {
|
||||
return Err(OreError::MaxSupply.into());
|
||||
}
|
||||
|
||||
// Mint to the beneficiary account
|
||||
drop(mint_data);
|
||||
mint_to_signed(
|
||||
mint_info,
|
||||
beneficiary_info,
|
||||
|
||||
Reference in New Issue
Block a user