From b550f6ff93bce67b572fd9979ac07b32f81a14b5 Mon Sep 17 00:00:00 2001 From: Milosz Muszynski Date: Mon, 20 May 2024 15:20:36 +0200 Subject: [PATCH] charlie-contract: charge and allowance in gas points --- contracts/charlie/src/state.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contracts/charlie/src/state.rs b/contracts/charlie/src/state.rs index ee2944753c..5f12929e13 100644 --- a/contracts/charlie/src/state.rs +++ b/contracts/charlie/src/state.rs @@ -19,8 +19,8 @@ impl Charlie { /// calling this method will be paid by the contract pub fn pay(&mut self) { - const ALLOWANCE: u64 = 10_000_000; - let allowance = ALLOWANCE * Self::gas_price(); + const ALLOWANCE: u64 = 40_000_000; + let allowance = ALLOWANCE / Self::gas_price(); // this call is paid for by the contract, up to 'allowance' rusk_abi::set_allowance(allowance); } @@ -30,8 +30,8 @@ impl Charlie { /// the execution cost, transaction will fail /// and contract balance won't be affected pub fn pay_and_fail(&mut self) { - const ALLOWANCE: u64 = 2_000_000; - let allowance = ALLOWANCE * Self::gas_price(); + const ALLOWANCE: u64 = 8_000_000; + let allowance = ALLOWANCE / Self::gas_price(); // this call is paid for by the contract, up to 'allowance' rusk_abi::set_allowance(allowance); } @@ -40,8 +40,8 @@ impl Charlie { /// increased so that contract can earn the difference between /// the contract's charge and the cost of gas actually spent pub fn earn(&mut self) { - const CHARGE: u64 = 20_000_000; - let charge = CHARGE * Self::gas_price(); + const CHARGE: u64 = 80_000_000; + let charge = CHARGE / Self::gas_price(); // charging 'charge' for the call rusk_abi::set_charge(charge); } @@ -51,8 +51,8 @@ impl Charlie { /// the actual execution cost, as a result the transaction will fail /// and contract balance won't be affected pub fn earn_and_fail(&mut self) { - const CHARGE: u64 = 2_000_000; - let charge = CHARGE * Self::gas_price(); + const CHARGE: u64 = 8_000_000; + let charge = CHARGE / Self::gas_price(); // charging 'charge' for the call rusk_abi::set_charge(charge); }