Enum spl_token_2022::extension::confidential_transfer_fee::instruction::ConfidentialTransferFeeInstruction
source · #[repr(u8)]pub enum ConfidentialTransferFeeInstruction {
InitializeConfidentialTransferFeeConfig = 0,
WithdrawWithheldTokensFromMint = 1,
WithdrawWithheldTokensFromAccounts = 2,
HarvestWithheldTokensToMint = 3,
EnableHarvestToMint = 4,
DisableHarvestToMint = 5,
}
Expand description
Confidential Transfer extension instructions
Variants§
InitializeConfidentialTransferFeeConfig = 0
Initializes confidential transfer fees for a mint.
The ConfidentialTransferFeeInstruction::InitializeConfidentialTransferFeeConfig
instruction requires no signers and MUST be included within the same
Transaction as TokenInstruction::InitializeMint
. Otherwise another
party can initialize the configuration.
The instruction fails if the TokenInstruction::InitializeMint
instruction has already executed for the mint.
Accounts expected by this instruction:
[writable]
The SPL Token mint.
Data expected by this instruction:
InitializeConfidentialTransferFeeConfigData
WithdrawWithheldTokensFromMint = 1
Transfer all withheld confidential tokens in the mint to an account. Signed by the mint’s withdraw withheld tokens authority.
The withheld confidential tokens are aggregated directly into the destination available balance.
In order for this instruction to be successfully processed, it must be
accompanied by the VerifyCiphertextCiphertextEquality
instruction
of the zk_token_proof
program in the same transaction or the
address of a context state account for the proof must be provided.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The fee receiver account. Must include theTransferFeeAmount
andConfidentialTransferAccount
extensions.[]
Instructions sysvar ifVerifyCiphertextCiphertextEquality
is included in the same transaction or context state account ifVerifyCiphertextCiphertextEquality
is pre-verified into a context state account.[signer]
The mint’swithdraw_withheld_authority
.
- Multisignature owner/delegate
[writable]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The fee receiver account. Must include theTransferFeeAmount
andConfidentialTransferAccount
extensions.[]
Instructions sysvar ifVerifyCiphertextCiphertextEquality
is included in the same transaction or context state account ifVerifyCiphertextCiphertextEquality
is pre-verified into a context state account.[]
The mint’s multisigwithdraw_withheld_authority
.- ..3+M
[signer]
M signer accounts.
Data expected by this instruction: WithdrawWithheldTokensFromMintData
WithdrawWithheldTokensFromAccounts = 2
Transfer all withheld tokens to an account. Signed by the mint’s
withdraw withheld tokens authority. This instruction is susceptible
to front-running. Use HarvestWithheldTokensToMint
and
WithdrawWithheldTokensFromMint
as an alternative.
The withheld confidential tokens are aggregated directly into the destination available balance.
Note on front-running: This instruction requires a zero-knowledge proof
verification instruction that is checked with respect to the account
state (the currently withheld fees). Suppose that a withdraw
withheld authority generates the
WithdrawWithheldTokensFromAccounts
instruction along with a
corresponding zero-knowledge proof for a specified set of accounts,
and submits it on chain. If the withheld fees at any
of the specified accounts change before the
WithdrawWithheldTokensFromAccounts
is executed on chain, the
zero-knowledge proof will not verify with respect to the new state,
forcing the transaction to fail.
If front-running occurs, then users can look up the updated states of
the accounts, generate a new zero-knowledge proof and try again.
Alternatively, withdraw withheld authority can first move the
withheld amount to the mint using HarvestWithheldTokensToMint
and
then move the withheld fees from mint to a specified destination
account using WithdrawWithheldTokensFromMint
.
In order for this instruction to be successfully processed, it must be
accompanied by the VerifyWithdrawWithheldTokens
instruction of the
zk_token_proof
program in the same transaction or the address of a
context state account for the proof must be provided.
Accounts expected by this instruction:
- Single owner/delegate
[]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The fee receiver account. Must include theTransferFeeAmount
andConfidentialTransferAccount
extensions.[]
Instructions sysvar ifVerifyCiphertextCiphertextEquality
is included in the same transaction or context state account ifVerifyCiphertextCiphertextEquality
is pre-verified into a context state account.[signer]
The mint’swithdraw_withheld_authority
.- ..3+N
[writable]
The source accounts to withdraw from.
- Multisignature owner/delegate
[]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The fee receiver account. Must include theTransferFeeAmount
andConfidentialTransferAccount
extensions.[]
Instructions sysvar ifVerifyCiphertextCiphertextEquality
is included in the same transaction or context state account ifVerifyCiphertextCiphertextEquality
is pre-verified into a context state account.[]
The mint’s multisigwithdraw_withheld_authority
.- ..4+M
[signer]
M signer accounts. 4+M+1. ..4+M+N[writable]
The source accounts to withdraw from.
Data expected by this instruction: WithdrawWithheldTokensFromAccountsData
HarvestWithheldTokensToMint = 3
Permissionless instruction to transfer all withheld confidential tokens to the mint.
Succeeds for frozen accounts.
Accounts provided should include both the TransferFeeAmount
and
ConfidentialTransferAccount
extension. If not, the account is skipped.
Accounts expected by this instruction:
[writable]
The mint.- ..1+N
[writable]
The source accounts to harvest from.
Data expected by this instruction: None
EnableHarvestToMint = 4
Configure a confidential transfer fee mint to accept harvested confidential fees.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The token mint.[signer]
The confidential transfer fee authority.
*Multisignature owner/delegate
0. [writable]
The token mint.
[]
The confidential transfer fee multisig authority,[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction: None
DisableHarvestToMint = 5
Configure a confidential transfer fee mint to reject any harvested confidential fees.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The token mint.[signer]
The confidential transfer fee authority.
*Multisignature owner/delegate
0. [writable]
The token mint.
[]
The confidential transfer fee multisig authority,[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction: None
Trait Implementations§
source§impl Clone for ConfidentialTransferFeeInstruction
impl Clone for ConfidentialTransferFeeInstruction
source§fn clone(&self) -> ConfidentialTransferFeeInstruction
fn clone(&self) -> ConfidentialTransferFeeInstruction
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl From<ConfidentialTransferFeeInstruction> for u8
impl From<ConfidentialTransferFeeInstruction> for u8
source§fn from(enum_value: ConfidentialTransferFeeInstruction) -> Self
fn from(enum_value: ConfidentialTransferFeeInstruction) -> Self
source§impl TryFrom<u8> for ConfidentialTransferFeeInstruction
impl TryFrom<u8> for ConfidentialTransferFeeInstruction
§type Error = TryFromPrimitiveError<ConfidentialTransferFeeInstruction>
type Error = TryFromPrimitiveError<ConfidentialTransferFeeInstruction>
source§impl TryFromPrimitive for ConfidentialTransferFeeInstruction
impl TryFromPrimitive for ConfidentialTransferFeeInstruction
type Primitive = u8
type Error = TryFromPrimitiveError<ConfidentialTransferFeeInstruction>
const NAME: &'static str = "ConfidentialTransferFeeInstruction"
fn try_from_primitive( number: Self::Primitive, ) -> Result<Self, TryFromPrimitiveError<Self>>
impl Copy for ConfidentialTransferFeeInstruction
Auto Trait Implementations§
impl Freeze for ConfidentialTransferFeeInstruction
impl RefUnwindSafe for ConfidentialTransferFeeInstruction
impl Send for ConfidentialTransferFeeInstruction
impl Sync for ConfidentialTransferFeeInstruction
impl Unpin for ConfidentialTransferFeeInstruction
impl UnwindSafe for ConfidentialTransferFeeInstruction
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more