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:
@@ -10,17 +10,16 @@ pub fn process_close(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
|
||||
signer_info.is_signer()?;
|
||||
proof_info
|
||||
.is_writable()?
|
||||
.to_account::<Proof>(&ore_api::ID)?
|
||||
.check(|p| p.authority == *signer_info.key)?
|
||||
.check(|p| p.balance == 0)?;
|
||||
.as_account::<Proof>(&ore_api::ID)?
|
||||
.assert_err(
|
||||
|p| p.authority == *signer_info.key,
|
||||
ProgramError::MissingRequiredSignature,
|
||||
)?
|
||||
.assert(|p| p.balance == 0)?;
|
||||
system_program.is_program(&system_program::ID)?;
|
||||
|
||||
// Realloc data to zero.
|
||||
proof_info.realloc(0, true)?;
|
||||
|
||||
// Send remaining lamports to signer.
|
||||
**signer_info.lamports.borrow_mut() += proof_info.lamports();
|
||||
**proof_info.lamports.borrow_mut() = 0;
|
||||
// Return rent to signer.
|
||||
proof_info.close(signer_info)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user