token-2022: minor rename pod types with descriptive types (#2983)

This commit is contained in:
samkim-crypto 2022-03-04 12:26:28 -05:00 committed by GitHub
parent e17706c7be
commit 7ab4de6174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -102,7 +102,7 @@ pub struct ConfidentialTransferAccount {
pub actual_pending_balance_credit_counter: PodU64, pub actual_pending_balance_credit_counter: PodU64,
/// The withheld amount of fees. This will always be zero if fees are never enabled. /// The withheld amount of fees. This will always be zero if fees are never enabled.
pub withheld_amount: pod::ElGamalCiphertext, pub withheld_amount: EncryptedWithheldAmount,
} }
impl Extension for ConfidentialTransferAccount { impl Extension for ConfidentialTransferAccount {
@ -121,9 +121,9 @@ impl ConfidentialTransferAccount {
/// Check if a `ConfidentialTransferAccount` is in a closable state /// Check if a `ConfidentialTransferAccount` is in a closable state
pub fn closable(&self) -> ProgramResult { pub fn closable(&self) -> ProgramResult {
if self.pending_balance == pod::ElGamalCiphertext::zeroed() if self.pending_balance == EncryptedBalance::zeroed()
&& self.available_balance == pod::ElGamalCiphertext::zeroed() && self.available_balance == EncryptedBalance::zeroed()
&& self.withheld_amount == pod::ElGamalCiphertext::zeroed() && self.withheld_amount == EncryptedWithheldAmount::zeroed()
{ {
Ok(()) Ok(())
} else { } else {

View File

@ -159,7 +159,7 @@ fn process_configure_account(
confidential_transfer_account.pending_balance_credit_counter = 0.into(); confidential_transfer_account.pending_balance_credit_counter = 0.into();
confidential_transfer_account.expected_pending_balance_credit_counter = 0.into(); confidential_transfer_account.expected_pending_balance_credit_counter = 0.into();
confidential_transfer_account.actual_pending_balance_credit_counter = 0.into(); confidential_transfer_account.actual_pending_balance_credit_counter = 0.into();
confidential_transfer_account.withheld_amount = pod::ElGamalCiphertext::zeroed(); confidential_transfer_account.withheld_amount = EncryptedWithheldAmount::zeroed();
Ok(()) Ok(())
} }
@ -234,9 +234,9 @@ fn process_empty_account(
return Err(ProgramError::InvalidInstructionData); return Err(ProgramError::InvalidInstructionData);
} }
confidential_transfer_account.available_balance = pod::ElGamalCiphertext::zeroed(); confidential_transfer_account.available_balance = EncryptedBalance::zeroed();
if confidential_transfer_account.withheld_amount != pod::ElGamalCiphertext::zeroed() { if confidential_transfer_account.withheld_amount != EncryptedWithheldAmount::zeroed() {
msg!("Withheld amount is not zero"); msg!("Withheld amount is not zero");
return Err(ProgramError::InvalidAccountData); return Err(ProgramError::InvalidAccountData);
} }