diff --git a/zk-token-sdk/src/instruction/transfer/mod.rs b/zk-token-sdk/src/instruction/transfer/mod.rs index 70a6c9c716f833..736ba937b5ba16 100644 --- a/zk-token-sdk/src/instruction/transfer/mod.rs +++ b/zk-token-sdk/src/instruction/transfer/mod.rs @@ -8,7 +8,6 @@ use { elgamal::ElGamalCiphertext, pedersen::{PedersenCommitment, PedersenOpening}, }, - arrayref::{array_ref, array_refs}, curve25519_dalek::scalar::Scalar, }; #[cfg(not(target_os = "solana"))] @@ -92,24 +91,3 @@ pub struct FeeParameters { /// Maximum fee assessed on transfers, expressed as an amount of tokens pub maximum_fee: u64, } - -#[cfg(not(target_os = "solana"))] -impl FeeParameters { - pub fn to_bytes(&self) -> [u8; 10] { - let mut bytes = [0u8; 10]; - bytes[..2].copy_from_slice(&self.fee_rate_basis_points.to_le_bytes()); - bytes[2..10].copy_from_slice(&self.maximum_fee.to_le_bytes()); - - bytes - } - - pub fn from_bytes(bytes: &[u8]) -> Self { - let bytes = array_ref![bytes, 0, 10]; - let (fee_rate_basis_points, maximum_fee) = array_refs![bytes, 2, 8]; - - Self { - fee_rate_basis_points: u16::from_le_bytes(*fee_rate_basis_points), - maximum_fee: u64::from_le_bytes(*maximum_fee), - } - } -} diff --git a/zk-token-sdk/src/zk_token_elgamal/convert.rs b/zk-token-sdk/src/zk_token_elgamal/convert.rs index b892875251f96d..1303538b3f7fbc 100644 --- a/zk-token-sdk/src/zk_token_elgamal/convert.rs +++ b/zk-token-sdk/src/zk_token_elgamal/convert.rs @@ -53,7 +53,7 @@ mod target_arch { crate::{ curve25519::scalar::PodScalar, errors::ProofError, - instruction::transfer::{FeeParameters, TransferPubkeys, TransferWithFeePubkeys}, + instruction::transfer::{TransferPubkeys, TransferWithFeePubkeys}, }, curve25519_dalek::{ristretto::CompressedRistretto, scalar::Scalar}, std::convert::TryFrom, @@ -132,24 +132,6 @@ mod target_arch { }) } } - - impl From for pod::FeeParameters { - fn from(parameters: FeeParameters) -> Self { - Self { - fee_rate_basis_points: parameters.fee_rate_basis_points.into(), - maximum_fee: parameters.maximum_fee.into(), - } - } - } - - impl From for FeeParameters { - fn from(pod: pod::FeeParameters) -> Self { - Self { - fee_rate_basis_points: pod.fee_rate_basis_points.into(), - maximum_fee: pod.maximum_fee.into(), - } - } - } } #[cfg(target_os = "solana")] diff --git a/zk-token-sdk/src/zk_token_elgamal/pod/instruction.rs b/zk-token-sdk/src/zk_token_elgamal/pod/instruction.rs index 763c9f42ba85d4..ab9a9e82b5ff16 100644 --- a/zk-token-sdk/src/zk_token_elgamal/pod/instruction.rs +++ b/zk-token-sdk/src/zk_token_elgamal/pod/instruction.rs @@ -70,3 +70,23 @@ pub struct FeeParameters { /// Maximum fee assessed on transfers, expressed as an amount of tokens pub maximum_fee: PodU64, } + +#[cfg(not(target_os = "solana"))] +impl From for FeeParameters { + fn from(decoded_fee_parameters: decoded::FeeParameters) -> Self { + FeeParameters { + fee_rate_basis_points: decoded_fee_parameters.fee_rate_basis_points.into(), + maximum_fee: decoded_fee_parameters.maximum_fee.into(), + } + } +} + +#[cfg(not(target_os = "solana"))] +impl From for decoded::FeeParameters { + fn from(pod_fee_parameters: FeeParameters) -> Self { + decoded::FeeParameters { + fee_rate_basis_points: pod_fee_parameters.fee_rate_basis_points.into(), + maximum_fee: pod_fee_parameters.maximum_fee.into(), + } + } +}