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

  1. Make sure that there are no collisions, different inputs never lead to the same output.
  2. Make sure that the same inputs lead to the same output.

Required Methods§

source

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.

source

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.

Implementors§