deploy
fn deploy(prepared_contract: PreparedContract) -> Result::<felt252, RevertedTransaction> nopanic;
Deploys a prepared contract.
prepared_contract
- an object of the structPreparedContract
that consists of the following fields:contract_address
- the address of the contract calculated during contract preparationclass_hash
- class hash calculated during contract declarationconstructor_calldata
- calldata for the constructor. If the constructor exists, it is called bydeploy
.
Example
use array::ArrayTrait;
use result::ResultTrait;
#[test]
fn test_deploy() {
let class_hash = declare('minimal').unwrap();
assert(class_hash != 0, 'class_hash != 0');
let prepare_result = prepare(class_hash, @ArrayTrait::new()).unwrap();
assert(prepare_result.contract_address != 0, 'prepared contract_address != 0');
assert(prepare_result.class_hash != 0, 'prepared class_hash != 0');
let deployed_contract_address = deploy(prepare_result).unwrap();
assert(deployed_contract_address != 0, 'deployed_contract_address != 0');
}
You can find more examples here.