git.delta.rocks / unique-network / refs/commits / 8a7066aa5b01

difftreelog

feat default sponsoring rate limit

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

2 files changed

modifiedpallets/contract-helpers/src/lib.rsdiffbeforeafterboth
2323
24 #[pallet::config]24 #[pallet::config]
25 pub trait Config: frame_system::Config + pallet_contracts::Config {}25 pub trait Config: frame_system::Config + pallet_contracts::Config {
26 type DefaultSponsoringRateLimit: Get<Self::BlockNumber>;
27 }
2628
27 #[pallet::pallet]29 #[pallet::pallet]
60 Key = T::AccountId,62 Key = T::AccountId,
61 Value = T::BlockNumber,63 Value = T::BlockNumber,
62 QueryKind = ValueQuery,64 QueryKind = ValueQuery,
65 OnEmpty = T::DefaultSponsoringRateLimit,
63 >;66 >;
6467
65 #[pallet::storage]68 #[pallet::storage]
69 Hasher2 = Twox128,72 Hasher2 = Twox128,
70 Key2 = T::AccountId,73 Key2 = T::AccountId,
71 Value = T::BlockNumber,74 Value = T::BlockNumber,
72 QueryKind = ValueQuery,75 QueryKind = OptionQuery,
73 >;76 >;
7477
75 #[pallet::call]78 #[pallet::call]
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/lib.rs
+++ b/pallets/evm-contract-helpers/src/lib.rs
@@ -13,6 +13,7 @@
 	#[pallet::config]
 	pub trait Config: frame_system::Config + pallet_evm_coder_substrate::Config {
 		type ContractAddress: Get<H160>;
+		type DefaultSponsoringRateLimit: Get<Self::BlockNumber>;
 	}
 
 	#[pallet::error]
@@ -34,8 +35,13 @@
 		StorageMap<Hasher = Twox128, Key = H160, Value = bool, QueryKind = ValueQuery>;
 
 	#[pallet::storage]
-	pub(super) type SponsoringRateLimit<T: Config> =
-		StorageMap<Hasher = Twox128, Key = H160, Value = T::BlockNumber, QueryKind = ValueQuery>;
+	pub(super) type SponsoringRateLimit<T: Config> = StorageMap<
+		Hasher = Twox128,
+		Key = H160,
+		Value = T::BlockNumber,
+		QueryKind = ValueQuery,
+		OnEmpty = T::DefaultSponsoringRateLimit,
+	>;
 
 	#[pallet::storage]
 	pub(super) type SponsorBasket<T: Config> = StorageDoubleMap<