Struct ContractDeployment
pub struct ContractDeployment<let O: u32> {
pub env: TestEnvironment,
pub path: str<O>,
pub secret: Field,
}
Fields
env: TestEnvironmentpath: str<O>secret: FieldImplementations
impl<let O: u32> ContractDeployment<O>
pub unconstrained fn with_private_initializer<let M: u32, let N: u32, T>(
self,
from: AztecAddress,
initializer_call: PrivateCall<M, N, T>,
) -> AztecAddress
where
T: Deserialize
pub unconstrained fn with_public_initializer<let M: u32, let N: u32, T>(
self,
from: AztecAddress,
initializer_call: PublicCall<M, N, 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 {
#[external("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: