Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions contracts/ccip/ccip/sources/fee_quoter.move
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ const VAL_1E14: u256 = 100_000_000_000_000;
const VAL_1E16: u256 = 10_000_000_000_000_000;
const VAL_1E18: u256 = 1_000_000_000_000_000_000;

// Link has 8 decimals on Sui and 18 decimals on it's native chain, Ethereum. We want to emit
// Link has 9 decimals on Sui and 18 decimals on its native chain, Ethereum. We want to emit
// the fee in juels (1e18) denomination for consistency across chains. This means we multiply
// the fee by 1e10 on Sui before we emit it in the event.
const LOCAL_8_TO_18_DECIMALS_LINK_MULTIPLIER: u256 = 10_000_000_000;
// the fee by 1e9 on Sui before we emit it in the event.
const LOCAL_9_TO_18_DECIMALS_LINK_MULTIPLIER: u256 = 1_000_000_000;

public struct FeeQuoterState has key, store {
id: UID,
Expand Down Expand Up @@ -1240,7 +1240,7 @@ public fun process_message_args(
// get a consistent juels amount regardless of the token denomination on the chain.
let msg_fee_juels =
(msg_fee_link_local_denomination as u256)
* LOCAL_8_TO_18_DECIMALS_LINK_MULTIPLIER;
* LOCAL_9_TO_18_DECIMALS_LINK_MULTIPLIER;

// max_fee_juels_per_msg is in juels denomination for consistency across chains.
assert!(msg_fee_juels <= state.max_fee_juels_per_msg, EMessageFeeTooHigh);
Expand Down
6 changes: 3 additions & 3 deletions contracts/ccip/ccip/tests/fee_quoter_tests.move
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public fun test_process_message_args_evm() {
vector[bcs::to_bytes(&MOCK_ADDRESS_3)], // dest_pool_datas
);

assert!(msg_fee_juels == 10000000000000);
assert!(msg_fee_juels == 1000000000000);
assert!(is_out_of_order_execution == true);
assert!(converted_extra_args == evm_extra_args);
// This is the dest gas overhead. hex(02bc) = 700
Expand Down Expand Up @@ -496,7 +496,7 @@ public fun test_process_message_args_svm() {
vector[bcs::to_bytes(&MOCK_ADDRESS_3)], // dest_pool_datas
);

assert!(msg_fee_juels == 10000000000000);
assert!(msg_fee_juels == 1000000000000);
assert!(is_out_of_order_execution == true);
assert!(converted_extra_args == svm_extra_args);
// This is the dest gas overhead. hex(02bc) = 700
Expand Down Expand Up @@ -557,7 +557,7 @@ public fun test_process_message_args_sui() {
vector[bcs::to_bytes(&MOCK_ADDRESS_3)], // dest_pool_datas
);

assert!(msg_fee_juels == 10000000000000);
assert!(msg_fee_juels == 1000000000000);
assert!(is_out_of_order_execution == true);
assert!(converted_extra_args == sui_extra_args);
// This is the dest gas overhead. hex(02bc) = 700
Expand Down
8 changes: 4 additions & 4 deletions contracts/ccip/mock_ccip_v2/fee_quoter.move
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ const VAL_1E14: u256 = 100_000_000_000_000;
const VAL_1E16: u256 = 10_000_000_000_000_000;
const VAL_1E18: u256 = 1_000_000_000_000_000_000;

// Link has 8 decimals on Sui and 18 decimals on it's native chain, Ethereum. We want to emit
// Link has 9 decimals on Sui and 18 decimals on its native chain, Ethereum. We want to emit
// the fee in juels (1e18) denomination for consistency across chains. This means we multiply
// the fee by 1e10 on Sui before we emit it in the event.
const LOCAL_8_TO_18_DECIMALS_LINK_MULTIPLIER: u256 = 10_000_000_000;
// the fee by 1e9 on Sui before we emit it in the event.
const LOCAL_9_TO_18_DECIMALS_LINK_MULTIPLIER: u256 = 1_000_000_000;

public struct FeeQuoterState has key, store {
id: UID,
Expand Down Expand Up @@ -1241,7 +1241,7 @@ public fun process_message_args(
// get a consistent juels amount regardless of the token denomination on the chain.
let msg_fee_juels =
(msg_fee_link_local_denomination as u256)
* LOCAL_8_TO_18_DECIMALS_LINK_MULTIPLIER;
* LOCAL_9_TO_18_DECIMALS_LINK_MULTIPLIER;

// max_fee_juels_per_msg is in juels denomination for consistency across chains.
assert!(msg_fee_juels <= state.max_fee_juels_per_msg, EMessageFeeTooHigh);
Expand Down
Loading