mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-29 23:26:45 +00:00
misc
This commit is contained in:
@@ -23,14 +23,41 @@ pub fn process_claim_seeker(accounts: &[AccountInfo<'_>], _data: &[u8]) -> Progr
|
||||
signer_info.is_signer()?;
|
||||
miner_info.is_writable()?;
|
||||
mint_info.has_owner(&spl_token_2022::ID)?;
|
||||
seeker_info.is_writable()?.is_empty()?;
|
||||
seeker_info
|
||||
.is_writable()?
|
||||
.has_seeds(&[SEEKER, &mint_info.key.to_bytes()], &ore_api::ID)?;
|
||||
token_account_info
|
||||
.as_associated_token_account(signer_info.key, mint_info.key)?
|
||||
.assert(|t| t.amount() == 1)?;
|
||||
system_program.is_program(&system_program::ID)?;
|
||||
|
||||
// Load mint.
|
||||
let mint_data = mint_info.try_borrow_data()?;
|
||||
let mint = PodStateWithExtensions::<PodMint>::unpack(&mint_data)?;
|
||||
|
||||
// Check mint authority.
|
||||
assert!(
|
||||
mint.base.mint_authority
|
||||
== PodCOption::some(pubkey!("GT2zuHVaZQYZSyQMgJPLzvkmyztfyXg2NJunqFp4p3A4")),
|
||||
"mint authority mismatch"
|
||||
);
|
||||
|
||||
// Check metadata pointer.
|
||||
let ext = mint.get_extension::<MetadataPointer>()?;
|
||||
assert!(
|
||||
ext.authority.0 == pubkey!("GT2zuHVaZQYZSyQMgJPLzvkmyztfyXg2NJunqFp4p3A4"),
|
||||
"metadata authority mismatch"
|
||||
);
|
||||
assert!(
|
||||
ext.metadata_address.0 == pubkey!("GT22s89nU4iWFkNXj1Bw6uYhJJWDRPpShHt4Bk8f99Te"),
|
||||
"metadata address mismatch"
|
||||
);
|
||||
|
||||
// Open seeker account.
|
||||
// Each genesis token can only be claimed once.
|
||||
if !seeker_info.data_is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
create_program_account::<Seeker>(
|
||||
seeker_info,
|
||||
system_program,
|
||||
@@ -68,28 +95,6 @@ pub fn process_claim_seeker(accounts: &[AccountInfo<'_>], _data: &[u8]) -> Progr
|
||||
.assert_mut(|m| m.is_seeker == 0)?
|
||||
};
|
||||
|
||||
// Load mint.
|
||||
let mint_data = mint_info.try_borrow_data()?;
|
||||
let mint = PodStateWithExtensions::<PodMint>::unpack(&mint_data)?;
|
||||
|
||||
// Check mint authority.
|
||||
assert!(
|
||||
mint.base.mint_authority
|
||||
== PodCOption::some(pubkey!("GT2zuHVaZQYZSyQMgJPLzvkmyztfyXg2NJunqFp4p3A4")),
|
||||
"mint authority mismatch"
|
||||
);
|
||||
|
||||
// Check metadata pointer.
|
||||
let ext = mint.get_extension::<MetadataPointer>()?;
|
||||
assert!(
|
||||
ext.authority.0 == pubkey!("GT2zuHVaZQYZSyQMgJPLzvkmyztfyXg2NJunqFp4p3A4"),
|
||||
"metadata authority mismatch"
|
||||
);
|
||||
assert!(
|
||||
ext.metadata_address.0 == pubkey!("GT22s89nU4iWFkNXj1Bw6uYhJJWDRPpShHt4Bk8f99Te"),
|
||||
"metadata address mismatch"
|
||||
);
|
||||
|
||||
// Flag the miner as a Seeker.
|
||||
miner.is_seeker = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user