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
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -37,6 +37,19 @@
 		Ok(())
 	}
 
+	fn set_sponsoring_rate_limit(
+		&mut self,
+		caller: caller,
+		contract: address,
+		rate_limit: uint32,
+	) -> Result<void> {
+		self.0.consume_sload()?;
+		<Pallet<T>>::ensure_owner(contract, caller)?;
+		self.0.consume_sstore()?;
+		<Pallet<T>>::set_sponsoring_rate_limit(contract, rate_limit.into());
+		Ok(())
+	}
+
 	fn allowed(&self, contract: address, user: address) -> Result<bool> {
 		self.0.consume_sload()?;
 		Ok(<Pallet<T>>::allowed(contract, user))
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) {