mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 11:17:56 +00:00
contracts: Convert to framev2 macros (#8157)
* contracts: Convert to framev2 * Reduce the API surface of the crate * Remove unused import * Merge import block * Use pallet::metadata to reduce metadata diff * Remove the explicit "Null" from AccountCounter
This commit is contained in:
committed by
GitHub
parent
4f4a0c5b38
commit
b2f393945a
@@ -28,13 +28,13 @@
|
||||
//! Thus, before executing a contract it should be reinstrument with new schedule.
|
||||
|
||||
use crate::{
|
||||
CodeHash, CodeStorage, PristineCode, Schedule, Config, Error,
|
||||
wasm::{prepare, PrefabWasmModule}, Module as Contracts, RawEvent,
|
||||
gas::{Gas, GasMeter, Token},
|
||||
CodeHash, CodeStorage, PristineCode, Schedule, Config, Error, Weight,
|
||||
wasm::{prepare, PrefabWasmModule}, Module as Contracts, Event,
|
||||
gas::{GasMeter, Token},
|
||||
weights::WeightInfo,
|
||||
};
|
||||
use sp_core::crypto::UncheckedFrom;
|
||||
use frame_support::{StorageMap, dispatch::DispatchError};
|
||||
use frame_support::dispatch::DispatchError;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pub use self::private::reinstrument as reinstrument;
|
||||
|
||||
@@ -58,7 +58,7 @@ where
|
||||
Some(module) => increment_64(&mut module.refcount),
|
||||
None => {
|
||||
*existing = Some(prefab_module);
|
||||
Contracts::<T>::deposit_event(RawEvent::CodeStored(code_hash))
|
||||
Contracts::<T>::deposit_event(Event::CodeStored(code_hash))
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -170,7 +170,7 @@ where
|
||||
T::AccountId: UncheckedFrom<T::Hash> + AsRef<[u8]>
|
||||
{
|
||||
<PristineCode<T>>::remove(code_hash);
|
||||
Contracts::<T>::deposit_event(RawEvent::CodeRemoved(code_hash))
|
||||
Contracts::<T>::deposit_event(Event::CodeRemoved(code_hash))
|
||||
}
|
||||
|
||||
/// Increment the refcount panicking if it should ever overflow (which will not happen).
|
||||
@@ -196,7 +196,7 @@ struct InstrumentToken(u32);
|
||||
impl<T: Config> Token<T> for InstrumentToken {
|
||||
type Metadata = ();
|
||||
|
||||
fn calculate_amount(&self, _metadata: &Self::Metadata) -> Gas {
|
||||
fn calculate_amount(&self, _metadata: &Self::Metadata) -> Weight {
|
||||
T::WeightInfo::instrument(self.0 / 1024)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user