spl_token_2022::extension::confidential_transfer_fee::instruction

Enum 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:

  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_elgamal_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. [] (Optional) Record account if the accompanying proof is to be read from a record account.
  5. [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. [] (Optional) Record account if the accompanying proof is to be read from a record account.
  5. [] The mint’s multisig withdraw_withheld_authority.
  6. ..5+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_elgamal_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. [] (Optional) Record account if the accompanying proof is to be read from a record account.
  5. [signer] The mint’s withdraw_withheld_authority.
  6. ..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. [] (Optional) Record account if the accompanying proof is to be read from a record account.
  5. [] The mint’s multisig withdraw_withheld_authority.
  6. ..5+M [signer] M signer accounts.
  7. 5+M+1..5+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

Source§

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

Source§

const NAME: &'static str = "ConfidentialTransferFeeInstruction"

Source§

type Primitive = u8

Source§

type Error = TryFromPrimitiveError<ConfidentialTransferFeeInstruction>

Source§

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

Source§

impl Copy for ConfidentialTransferFeeInstruction

Auto Trait Implementations§

Blanket Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V