Skip to content

Commit

Permalink
Refactor type definition
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloMansanet committed Jan 9, 2025
1 parent 341f747 commit fdf9c63
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use solana_program::{program::invoke_signed, system_instruction};

use crate::{
utils::{Exponential, Usd18Decimals},
BillingTokenConfig, CcipRouterError, DestChain, PerChainPerTokenConfig, Solana2AnyMessage,
SolanaTokenAmount, UnpackedDoubleU224, FEE_BILLING_SIGNER_SEEDS,
BillingTokenConfig, CcipRouterError, DestChain, PackedPrice, PerChainPerTokenConfig,
Solana2AnyMessage, SolanaTokenAmount, UnpackedDoubleU224, FEE_BILLING_SIGNER_SEEDS,
};

use super::pools::CCIP_LOCK_OR_BURN_V1_RET_BYTES;
Expand Down Expand Up @@ -212,15 +212,6 @@ fn global_network_fees(dest_chain: &DestChain) -> NetworkFee {
}
}

#[allow(dead_code)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct PackedPrice {
// L1 gas price (encoded in the lower 112 bits)
pub execution_gas_price: Usd18Decimals,
// L2 gas price (encoded in the higher 112 bits)
pub data_availability_gas_price: Usd18Decimals,
}

impl From<UnpackedDoubleU224> for PackedPrice {
fn from(value: UnpackedDoubleU224) -> Self {
Self {
Expand Down
13 changes: 11 additions & 2 deletions chains/solana/contracts/programs/ccip-router/src/messages.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{BillingTokenConfig, CcipRouterError, DestChain, ReportContext};
use crate::{utils::Usd18Decimals, BillingTokenConfig, CcipRouterError, DestChain, ReportContext};
use anchor_lang::prelude::*;
use ethnum::U256;

Expand Down Expand Up @@ -356,9 +356,18 @@ impl Solana2AnyMessage {
}
}

#[allow(dead_code)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct PackedPrice {
// L1 gas price (encoded in the lower 112 bits)
pub execution_gas_price: Usd18Decimals,
// L2 gas price (encoded in the higher 112 bits)
pub data_availability_gas_price: Usd18Decimals,
}

#[cfg(test)]
pub(crate) mod tests {
use crate::{utils::Usd18Decimals, PackedPrice, UnpackedDoubleU224};
use crate::{utils::Usd18Decimals, UnpackedDoubleU224};

use super::*;
use anchor_lang::solana_program::pubkey::Pubkey;
Expand Down

0 comments on commit fdf9c63

Please sign in to comment.