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:
Hardhat Chad
2024-10-25 17:22:41 -05:00
committed by GitHub
parent ac31c75201
commit cb24b65133
13 changed files with 165 additions and 190 deletions

View File

@@ -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(())
}