zk-token-sdk: add verify transfer with fee instruction (#22924)
This commit is contained in:
parent
f73b470ec0
commit
a47b76afcc
|
@ -53,5 +53,9 @@ pub fn process_instruction(
|
|||
ic_msg!(invoke_context, "VerifyTransfer");
|
||||
verify::<TransferData>(input, invoke_context)
|
||||
}
|
||||
ProofInstruction::VerifyTransferWithFee => {
|
||||
ic_msg!(invoke_context, "VerifyTransferWithFee");
|
||||
verify::<TransferWithFeeData>(input, invoke_context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,10 @@ use {
|
|||
},
|
||||
curve25519_dalek::scalar::Scalar,
|
||||
};
|
||||
pub use {close_account::CloseAccountData, transfer::TransferData, withdraw::WithdrawData};
|
||||
pub use {
|
||||
close_account::CloseAccountData, transfer::TransferData,
|
||||
transfer_with_fee::TransferWithFeeData, withdraw::WithdrawData,
|
||||
};
|
||||
|
||||
/// Constant for 2^32
|
||||
#[cfg(not(target_arch = "bpf"))]
|
||||
|
|
|
@ -39,6 +39,16 @@ pub enum ProofInstruction {
|
|||
/// `TransferData`
|
||||
///
|
||||
VerifyTransfer,
|
||||
|
||||
/// Verify a `TransferWithFeeData` struct
|
||||
///
|
||||
/// Accounts expected by this instruction:
|
||||
/// None
|
||||
///
|
||||
/// Data expected by this instruction:
|
||||
/// `TransferWithFeeData`
|
||||
///
|
||||
VerifyTransferWithFee,
|
||||
}
|
||||
|
||||
impl ProofInstruction {
|
||||
|
@ -76,3 +86,7 @@ pub fn verify_withdraw(proof_data: &WithdrawData) -> Instruction {
|
|||
pub fn verify_transfer(proof_data: &TransferData) -> Instruction {
|
||||
ProofInstruction::VerifyTransfer.encode(proof_data)
|
||||
}
|
||||
|
||||
pub fn verify_transfer_with_fee(proof_data: &TransferWithFeeData) -> Instruction {
|
||||
ProofInstruction::VerifyTransferWithFee.encode(proof_data)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue