From 781ae2a84f7703695872da9a0fcc069efc67096c Mon Sep 17 00:00:00 2001 From: Grigoriy Simonov Date: Tue, 13 Sep 2022 13:17:42 +0000 Subject: [PATCH] chore: add sload/sstore and doucumentation --- --- a/pallets/evm-contract-helpers/src/eth.rs +++ b/pallets/evm-contract-helpers/src/eth.rs @@ -223,9 +223,11 @@ } /// Get current contract sponsoring rate limit - /// @param contractAddress Contract to get sponsoring mode of + /// @param contractAddress Contract to get sponsoring rate limit of /// @return uint32 Amount of blocks between two sponsored transactions fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result { + self.recorder().consume_sload()?; + Ok(>::get(contract_address) .try_into() .map_err(|_| "rate limit > u32::MAX")?) @@ -251,19 +253,34 @@ Ok(()) } + /// Set contract sponsoring fee limit + /// @dev Sponsoring fee limit - is maximum fee that could be spent by + /// single transaction + /// @param contractAddress Contract to change sponsoring fee limit of + /// @param feeLimit Fee limit + /// @dev Only contract owner can change this setting fn set_sponsoring_fee_limit( &mut self, caller: caller, contract_address: address, fee_limit: uint256, ) -> Result { + self.recorder().consume_sload()?; + self.recorder().consume_sstore()?; + >::ensure_owner(contract_address, caller).map_err(dispatch_to_evm::)?; >::set_sponsoring_fee_limit(contract_address, fee_limit.into()) .map_err(dispatch_to_evm::)?; Ok(()) } + /// Get current contract sponsoring fee limit + /// @param contractAddress Contract to get sponsoring fee limit of + /// @return uint256 Maximum amount of fee that could be spent by single + /// transaction fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result { + self.recorder().consume_sload()?; + Ok(get_sponsoring_fee_limit::(contract_address)) } -- gitstuff