Description
Deploying a fresh WASM instance per invoice is gas-intensive. A clone factory pattern should deploy minimal-proxy or thin-init clones pointing to a single canonical WASM blob, reducing deployment cost while maintaining per-invoice state isolation.
Technical Context
Add a SplitFactory contract in contracts/factory/src/lib.rs (new crate in the workspace Cargo.toml). Implement deploy_invoice_contract(wasm_hash: BytesN<32>, salt: BytesN<32>, init_args: Vec<Val>) using env.deployer().with_current_contract(salt). Register each deployed address under DeployedContracts(creator) in factory storage.
Acceptance Criteria
Description
Deploying a fresh WASM instance per invoice is gas-intensive. A clone factory pattern should deploy minimal-proxy or thin-init clones pointing to a single canonical WASM blob, reducing deployment cost while maintaining per-invoice state isolation.
Technical Context
Add a
SplitFactorycontract incontracts/factory/src/lib.rs(new crate in the workspaceCargo.toml). Implementdeploy_invoice_contract(wasm_hash: BytesN<32>, salt: BytesN<32>, init_args: Vec<Val>)usingenv.deployer().with_current_contract(salt). Register each deployed address underDeployedContracts(creator)in factory storage.Acceptance Criteria
(creator, salt)pairContractDeployed(creator, contract_address)event is emitted by the factoryCargo.tomlas a new memberiniton the deployed contract