diff --git a/core/primitives-core/src/runtime/fees.rs b/core/primitives-core/src/runtime/fees.rs index 5e01fcb8d4b..a2b7bf5acd5 100644 --- a/core/primitives-core/src/runtime/fees.rs +++ b/core/primitives-core/src/runtime/fees.rs @@ -212,9 +212,6 @@ pub fn transfer_exec_fee( receiver_account_type: AccountType, ) -> Gas { let transfer_fee = cfg.fee(ActionCosts::transfer).exec_fee(); - let create_account_fee = cfg.fee(ActionCosts::create_account).exec_fee(); - let add_access_key_fee = cfg.fee(ActionCosts::add_full_access_key).exec_fee(); - match (implicit_account_creation_allowed, receiver_account_type) { // Regular transfer to a named account. (_, AccountType::NamedAccount) => transfer_fee, @@ -223,7 +220,11 @@ pub fn transfer_exec_fee( // Currently, no account is created on transfer to ETH-implicit account, just a regular transfer. (true, AccountType::EthImplicitAccount) => transfer_fee, // Extra fees for the CreateAccount and AddFullAccessKey. - (true, AccountType::NearImplicitAccount) => transfer_fee + create_account_fee + add_access_key_fee, + (true, AccountType::NearImplicitAccount) => { + transfer_fee + + cfg.fee(ActionCosts::create_account).exec_fee() + + cfg.fee(ActionCosts::add_full_access_key).exec_fee() + } } } @@ -234,9 +235,6 @@ pub fn transfer_send_fee( receiver_account_type: AccountType, ) -> Gas { let transfer_fee = cfg.fee(ActionCosts::transfer).send_fee(sender_is_receiver); - let create_account_fee = cfg.fee(ActionCosts::create_account).send_fee(sender_is_receiver); - let add_access_key_fee = cfg.fee(ActionCosts::add_full_access_key).send_fee(sender_is_receiver); - match (implicit_account_creation_allowed, receiver_account_type) { // Regular transfer to a named account. (_, AccountType::NamedAccount) => transfer_fee, @@ -245,6 +243,10 @@ pub fn transfer_send_fee( // Currently, no account is created on transfer to ETH-implicit account, just a regular transfer. (true, AccountType::EthImplicitAccount) => transfer_fee, // Extra fees for the CreateAccount and AddFullAccessKey. - (true, AccountType::NearImplicitAccount) => transfer_fee + create_account_fee + add_access_key_fee, + (true, AccountType::NearImplicitAccount) => { + transfer_fee + + cfg.fee(ActionCosts::create_account).send_fee(sender_is_receiver) + + cfg.fee(ActionCosts::add_full_access_key).send_fee(sender_is_receiver) + } } }