Trait pallet_contracts::AddressGenerator
source · pub trait AddressGenerator<T: Config> {
// Required methods
fn contract_address(
deploying_address: &T::AccountId,
code_hash: &<T as Config>::Hash,
input_data: &[u8],
salt: &[u8]
) -> T::AccountId;
fn deposit_address(contract_addr: &T::AccountId) -> T::AccountId;
}
Expand description
Provides the contract address generation method.
See DefaultAddressGenerator
for the default implementation.
Note for implementors
- Make sure that there are no collisions, different inputs never lead to the same output.
- Make sure that the same inputs lead to the same output.
Required Methods§
sourcefn contract_address(
deploying_address: &T::AccountId,
code_hash: &<T as Config>::Hash,
input_data: &[u8],
salt: &[u8]
) -> T::AccountId
fn contract_address( deploying_address: &T::AccountId, code_hash: &<T as Config>::Hash, input_data: &[u8], salt: &[u8] ) -> T::AccountId
The address of a contract based on the given instantiate parameters.
Changing the formular for an already deployed chain is fine as long as no collisions with the old formular. Changes only affect existing contracts.
sourcefn deposit_address(contract_addr: &T::AccountId) -> T::AccountId
fn deposit_address(contract_addr: &T::AccountId) -> T::AccountId
The address of the deposit account of contract_addr
.
The address is generated once on instantiation and then stored in the contracts metadata. Hence changes do only affect newly created contracts.