Skip to content

Commit c2fafea

Browse files
committed
Refactor billing waiver variable names for clarity
1 parent 048de90 commit c2fafea

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

  • substrate-node/pallets/pallet-smart-contract/src

substrate-node/pallets/pallet-smart-contract/src/billing.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,15 @@ impl<T: Config> Pallet<T> {
198198
let seconds_elapsed =
199199
now.defensive_saturating_sub(contract_payment_state.last_updated_seconds);
200200

201-
let should_waive_payment = match &contract.contract_type {
201+
let should_waive_standby_rent = match &contract.contract_type {
202202
types::ContractData::RentContract(rc) => {
203203
let node_power = pallet_tfgrid::NodePower::<T>::get(rc.node_id);
204204
node_power.is_standby()
205205
}
206206
_ => false,
207207
};
208208

209-
let should_waive_v3_billing = match &contract.contract_type {
209+
let should_waive_migration_billing = match &contract.contract_type {
210210
types::ContractData::NodeContract(nc) => {
211211
pallet_tfgrid::NodeV3BillingOptOut::<T>::contains_key(nc.node_id)
212212
}
@@ -216,14 +216,14 @@ impl<T: Config> Pallet<T> {
216216
_ => false,
217217
};
218218

219-
// For Created contracts on opted-out nodes: early return (mirrors should_waive_payment).
220-
// early return is cleaner and consistent with the should_waive_payment pattern.
219+
// For Created contracts on opted-out nodes: early return (mirrors should_waive_standby_rent).
220+
// early return is cleaner and consistent with the should_waive_standby_rent pattern.
221221
// GracePeriod and Deleted fall through: zero new cost + manage_contract_state runs naturally.
222-
if should_waive_v3_billing && matches!(contract.state, types::ContractState::Created) {
222+
if should_waive_migration_billing && matches!(contract.state, types::ContractState::Created) {
223223
return Ok(().into());
224224
}
225225

226-
if should_waive_payment {
226+
if should_waive_standby_rent {
227227
log::info!("Waiving rent for contract_id: {:?}", contract.contract_id);
228228
Self::deposit_event(Event::RentWaived {
229229
contract_id: contract.contract_id,
@@ -236,7 +236,7 @@ impl<T: Config> Pallet<T> {
236236
}
237237

238238
// Calculate the due amount
239-
let (standard_amount_due, discount_received) = if should_waive_payment || should_waive_v3_billing {
239+
let (standard_amount_due, discount_received) = if should_waive_standby_rent || should_waive_migration_billing {
240240
(BalanceOf::<T>::zero(), types::DiscountLevel::None)
241241
} else {
242242
contract
@@ -253,7 +253,7 @@ impl<T: Config> Pallet<T> {
253253

254254
let additional_amount_due =
255255
if let types::ContractData::RentContract(rc) = &contract.contract_type {
256-
if should_waive_payment || should_waive_v3_billing {
256+
if should_waive_standby_rent || should_waive_migration_billing {
257257
BalanceOf::<T>::zero()
258258
} else {
259259
contract.calculate_extra_fee_cost_tft(rc.node_id, seconds_elapsed)

0 commit comments

Comments
 (0)