Struct ContractDeployment
pub struct ContractDeployment<let N: u32> {
pub env: TestEnvironment,
pub path: str<N>,
pub secret: Field,
}
Fields
env: TestEnvironmentpath: str<N>secret: FieldImplementations
impl<let N: u32> ContractDeployment<N>
pub unconstrained fn with_private_initializer<T, let P: u32>(
self,
from: AztecAddress,
initializer_call: PrivateCallInterface<P, T>,
) -> AztecAddress
where
T: Deserialize
pub unconstrained fn with_public_initializer<let P: u32, T>(
self,
from: AztecAddress,
initializer_call: PublicCallInterface<P, T>,
) -> AztecAddress
where
T: Deserialize
Finalizes a contract deployment prepared via TestEnvironment::deploy by calling a public initializer function
from the from account.
The initializer_call is created by calling the intended public initializer function inside the contract's
interface() with its arguments:
contract MyContract {
#[public]
#[initializer]
fn init_fn(owner: AztecAddress) { ... }
}
#[test]
unconstrained fn test_deployment() {
let contract_address = TestEnvironment::new().deploy("MyContract").with_public_initializer(
MyContract::interface().init_fn(owner)
);
}
pub unconstrained fn without_initializer(self) -> AztecAddress
Finalizes a contract deployment prepared via TestEnvironment::deploy without calling any initializer function.
Note that initializers cannot be manually called once this function returns, since the contract address itself
contains a commitment to the lack of initialization arguments as per the protocol rules. Initializers can only
be invoked by using the with_private_initializer or with_public_initializer functions.
Finalizes a contract deployment prepared via
TestEnvironment::deployby calling a private initializer function from thefromaccount.The
initializer_callis created by calling the intended private initializer function inside the contract'sinterface()with its arguments: