difftreelog
chore add sload/sstore and doucumentation
in: master
1 file changed
pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth223 }223 }224224225 /// Get current contract sponsoring rate limit225 /// Get current contract sponsoring rate limit226 /// @param contractAddress Contract to get sponsoring mode of226 /// @param contractAddress Contract to get sponsoring rate limit of227 /// @return uint32 Amount of blocks between two sponsored transactions227 /// @return uint32 Amount of blocks between two sponsored transactions228 fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {228 fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {229 self.recorder().consume_sload()?;230229 Ok(<SponsoringRateLimit<T>>::get(contract_address)231 Ok(<SponsoringRateLimit<T>>::get(contract_address)230 .try_into()232 .try_into()251 Ok(())253 Ok(())252 }254 }253255256 /// Set contract sponsoring fee limit257 /// @dev Sponsoring fee limit - is maximum fee that could be spent by258 /// single transaction259 /// @param contractAddress Contract to change sponsoring fee limit of260 /// @param feeLimit Fee limit261 /// @dev Only contract owner can change this setting254 fn set_sponsoring_fee_limit(262 fn set_sponsoring_fee_limit(255 &mut self,263 &mut self,256 caller: caller,264 caller: caller,257 contract_address: address,265 contract_address: address,258 fee_limit: uint256,266 fee_limit: uint256,259 ) -> Result<void> {267 ) -> Result<void> {268 self.recorder().consume_sload()?;269 self.recorder().consume_sstore()?;270260 <Pallet<T>>::ensure_owner(contract_address, caller).map_err(dispatch_to_evm::<T>)?;271 <Pallet<T>>::ensure_owner(contract_address, caller).map_err(dispatch_to_evm::<T>)?;261 <Pallet<T>>::set_sponsoring_fee_limit(contract_address, fee_limit.into())272 <Pallet<T>>::set_sponsoring_fee_limit(contract_address, fee_limit.into())262 .map_err(dispatch_to_evm::<T>)?;273 .map_err(dispatch_to_evm::<T>)?;263 Ok(())274 Ok(())264 }275 }265276277 /// Get current contract sponsoring fee limit278 /// @param contractAddress Contract to get sponsoring fee limit of279 /// @return uint256 Maximum amount of fee that could be spent by single280 /// transaction266 fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result<uint256> {281 fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result<uint256> {282 self.recorder().consume_sload()?;283267 Ok(get_sponsoring_fee_limit::<T>(contract_address))284 Ok(get_sponsoring_fee_limit::<T>(contract_address))268 }285 }