diff --git a/app-libs/stf/src/lib.rs b/app-libs/stf/src/lib.rs index 74405d07a..2a5979434 100644 --- a/app-libs/stf/src/lib.rs +++ b/app-libs/stf/src/lib.rs @@ -49,4 +49,6 @@ pub mod trusted_call; pub(crate) const ENCLAVE_ACCOUNT_KEY: &str = "Enclave_Account_Key"; pub const STF_SHIELDING_FEE_AMOUNT_DIVIDER: Balance = 571; // approx 0.175% pub const STF_TX_FEE_UNIT_DIVIDER: Balance = 100; // 0.01 tokens +pub const STF_BYTE_FEE_UNIT_DIVIDER: Balance = 10_000; // 0.0001 tokens per byte of certain payload + pub const STF_GUESS_FEE_UNIT_DIVIDER: Balance = 10; // 0.1 tokens diff --git a/app-libs/stf/src/trusted_call.rs b/app-libs/stf/src/trusted_call.rs index c143b44a8..e601f151f 100644 --- a/app-libs/stf/src/trusted_call.rs +++ b/app-libs/stf/src/trusted_call.rs @@ -641,9 +641,19 @@ fn get_fee_for(tc: &TrustedCallSigned) -> Balance { let one = MinimalChainSpec::one_unit(shielding_target_genesis_hash().unwrap_or_default()); match &tc.call { TrustedCall::balance_transfer(..) => one / crate::STF_TX_FEE_UNIT_DIVIDER, + TrustedCall::balance_transfer_with_note(_, _, _, note) => + one / crate::STF_TX_FEE_UNIT_DIVIDER + + (one.saturating_mul(Balance::from(note.len() as u32))) + / crate::STF_BYTE_FEE_UNIT_DIVIDER, TrustedCall::balance_unshield(..) => one / crate::STF_TX_FEE_UNIT_DIVIDER * 3, TrustedCall::guess_the_number(call) => crate::guess_the_number::get_fee_for(call), - _ => Balance::from(0u32), + TrustedCall::note_bloat(..) => Balance::from(0u32), + TrustedCall::waste_time(..) => Balance::from(0u32), + TrustedCall::timestamp_set(..) => Balance::from(0u32), + TrustedCall::balance_shield(..) => Balance::from(0u32), //will be charged on recipient, elsewhere + #[cfg(any(feature = "test", test))] + TrustedCall::balance_set_balance(..) => Balance::from(0u32), + _ => one / crate::STF_TX_FEE_UNIT_DIVIDER, } }