#[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:

  1. [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
  1. [writable] The token mint. Must include the TransferFeeConfig extension.
  2. [writable] The fee receiver account. Must include the TransferFeeAmount and ConfidentialTransferAccount extensions.
  3. [] Instructions sysvar if VerifyCiphertextCiphertextEquality is included in the same transaction or context state account if VerifyCiphertextCiphertextEquality is pre-verified into a context state account.
  4. [signer] The mint’s withdraw_withheld_authority.
  • Multisignature owner/delegate
  1. [writable] The token mint. Must include the TransferFeeConfig extension.
  2. [writable] The fee receiver account. Must include the TransferFeeAmount and ConfidentialTransferAccount extensions.
  3. [] Instructions sysvar if VerifyCiphertextCiphertextEquality is included in the same transaction or context state account if VerifyCiphertextCiphertextEquality is pre-verified into a context state account.
  4. [] The mint’s multisig withdraw_withheld_authority.
  5. ..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
  1. [] The token mint. Must include the TransferFeeConfig extension.
  2. [writable] The fee receiver account. Must include the TransferFeeAmount and ConfidentialTransferAccount extensions.
  3. [] Instructions sysvar if VerifyCiphertextCiphertextEquality is included in the same transaction or context state account if VerifyCiphertextCiphertextEquality is pre-verified into a context state account.
  4. [signer] The mint’s withdraw_withheld_authority.
  5. ..3+N [writable] The source accounts to withdraw from.
  • Multisignature owner/delegate
  1. [] The token mint. Must include the TransferFeeConfig extension.
  2. [writable] The fee receiver account. Must include the TransferFeeAmount and ConfidentialTransferAccount extensions.
  3. [] Instructions sysvar if VerifyCiphertextCiphertextEquality is included in the same transaction or context state account if VerifyCiphertextCiphertextEquality is pre-verified into a context state account.
  4. [] The mint’s multisig withdraw_withheld_authority.
  5. ..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:

  1. [writable] The mint.
  2. ..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
  1. [writable] The token mint.
  2. [signer] The confidential transfer fee authority.

*Multisignature owner/delegate 0. [writable] The token mint.

  1. [] The confidential transfer fee multisig authority,
  2. [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
  1. [writable] The token mint.
  2. [signer] The confidential transfer fee authority.

*Multisignature owner/delegate 0. [writable] The token mint.

  1. [] The confidential transfer fee multisig authority,
  2. [signer] Required M signer accounts for the SPL Token Multisig account.

Data expected by this instruction: None

Trait Implementations§

source§

impl Clone for ConfidentialTransferFeeInstruction

source§

fn clone(&self) -> ConfidentialTransferFeeInstruction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ConfidentialTransferFeeInstruction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<ConfidentialTransferFeeInstruction> for u8

source§

fn from(enum_value: ConfidentialTransferFeeInstruction) -> Self

Converts to this type from the input type.
source§

impl TryFrom<u8> for ConfidentialTransferFeeInstruction

§

type Error = TryFromPrimitiveError<ConfidentialTransferFeeInstruction>

The type returned in the event of a conversion error.
source§

fn try_from(number: u8) -> Result<Self, TryFromPrimitiveError<Self>>

Performs the conversion.
source§

impl TryFromPrimitive for ConfidentialTransferFeeInstruction

§

type Primitive = u8

§

type Error = TryFromPrimitiveError<ConfidentialTransferFeeInstruction>

source§

const NAME: &'static str = "ConfidentialTransferFeeInstruction"

source§

fn try_from_primitive( number: Self::Primitive ) -> Result<Self, TryFromPrimitiveError<Self>>

source§

impl Copy for ConfidentialTransferFeeInstruction

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AbiExample for T

§

default fn example() -> T

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V