git.delta.rocks / unique-network / refs/commits / eb158df7b647

difftreelog

feat evm helpers method to set rate limit

Yaroslav Bolyukin2021-07-28parent: #a386d99.patch.diff
in: master

2 files changed

modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
37 Ok(())37 Ok(())
38 }38 }
39
40 fn set_sponsoring_rate_limit(
41 &mut self,
42 caller: caller,
43 contract: address,
44 rate_limit: uint32,
45 ) -> Result<void> {
46 self.0.consume_sload()?;
47 <Pallet<T>>::ensure_owner(contract, caller)?;
48 self.0.consume_sstore()?;
49 <Pallet<T>>::set_sponsoring_rate_limit(contract, rate_limit.into());
50 Ok(())
51 }
3952
40 fn allowed(&self, contract: address, user: address) -> Result<bool> {53 fn allowed(&self, contract: address, user: address) -> Result<bool> {
41 self.0.consume_sload()?;54 self.0.consume_sload()?;
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
66 <SelfSponsoring<T>>::insert(contract, enabled);66 <SelfSponsoring<T>>::insert(contract, enabled);
67 }67 }
68
69 pub fn set_sponsoring_rate_limit(contract: H160, rate_limit: T::BlockNumber) {
70 <SponsoringRateLimit<T>>::insert(contract, rate_limit);
71 }
6872
69 pub fn allowed(contract: H160, user: H160) -> bool {73 pub fn allowed(contract: H160, user: H160) -> bool {
70 if !<AllowlistEnabled<T>>::get(contract) {74 if !<AllowlistEnabled<T>>::get(contract) {