mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
Migrate to steel v2 (#102)
* migrate to steel v2 * migrate to steel v2 * assert with err * args ordering * new close * logging * bump deps * bump ore-boost-api version * deprecate bumps in sdk * remove msg * remove comment * remove unused import * bump version
This commit is contained in:
@@ -5,10 +5,7 @@ use solana_program::{keccak::hashv, slot_hashes::SlotHash};
|
||||
use steel::*;
|
||||
|
||||
/// Open creates a new proof account to track a miner's state.
|
||||
pub fn process_open(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {
|
||||
// Parse args.
|
||||
let args = Open::try_from_bytes(data)?;
|
||||
|
||||
pub fn process_open(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
|
||||
// Load accounts.
|
||||
let [signer_info, miner_info, payer_info, proof_info, system_program, slot_hashes_info] =
|
||||
accounts
|
||||
@@ -17,24 +14,23 @@ pub fn process_open(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult
|
||||
};
|
||||
signer_info.is_signer()?;
|
||||
payer_info.is_signer()?;
|
||||
proof_info.is_empty()?.is_writable()?.has_seeds(
|
||||
&[PROOF, signer_info.key.as_ref()],
|
||||
args.bump,
|
||||
&ore_api::ID,
|
||||
)?;
|
||||
proof_info
|
||||
.is_empty()?
|
||||
.is_writable()?
|
||||
.has_seeds(&[PROOF, signer_info.key.as_ref()], &ore_api::ID)?;
|
||||
system_program.is_program(&system_program::ID)?;
|
||||
slot_hashes_info.is_sysvar(&sysvar::slot_hashes::ID)?;
|
||||
|
||||
// Initialize proof.
|
||||
create_account::<Proof>(
|
||||
proof_info,
|
||||
&ore_api::ID,
|
||||
&[PROOF, signer_info.key.as_ref(), &[args.bump]],
|
||||
system_program,
|
||||
payer_info,
|
||||
&ore_api::ID,
|
||||
&[PROOF, signer_info.key.as_ref()],
|
||||
)?;
|
||||
let clock = Clock::get()?;
|
||||
let proof = proof_info.to_account_mut::<Proof>(&ore_api::ID)?;
|
||||
let proof = proof_info.as_account_mut::<Proof>(&ore_api::ID)?;
|
||||
proof.authority = *signer_info.key;
|
||||
proof.balance = 0;
|
||||
proof.challenge = hashv(&[
|
||||
|
||||
Reference in New Issue
Block a user