git.delta.rocks / unique-network / refs/commits / 781ae2a84f77

difftreelog

chore add sload/sstore and doucumentation

Grigoriy Simonov2022-09-13parent: #d78c2fe.patch.diff
in: master

1 file changed

modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
223 }223 }
224224
225 /// Get current contract sponsoring rate limit225 /// Get current contract sponsoring rate limit
226 /// @param contractAddress Contract to get sponsoring mode of226 /// @param contractAddress Contract to get sponsoring rate limit of
227 /// @return uint32 Amount of blocks between two sponsored transactions227 /// @return uint32 Amount of blocks between two sponsored transactions
228 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()?;
230
229 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 }
253255
256 /// Set contract sponsoring fee limit
257 /// @dev Sponsoring fee limit - is maximum fee that could be spent by
258 /// single transaction
259 /// @param contractAddress Contract to change sponsoring fee limit of
260 /// @param feeLimit Fee limit
261 /// @dev Only contract owner can change this setting
254 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()?;
270
260 <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 }
265276
277 /// Get current contract sponsoring fee limit
278 /// @param contractAddress Contract to get sponsoring fee limit of
279 /// @return uint256 Maximum amount of fee that could be spent by single
280 /// transaction
266 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()?;
283
267 Ok(get_sponsoring_fee_limit::<T>(contract_address))284 Ok(get_sponsoring_fee_limit::<T>(contract_address))
268 }285 }