File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -17,24 +17,27 @@ impl EscrowContract {
1717
1818 pub fn tw_new_multi_release_escrow (
1919 env : Env ,
20- deployer : Address ,
20+ signer : Address ,
2121 wasm_hash : BytesN < 32 > ,
2222 salt : BytesN < 32 > ,
2323 init_fn : Symbol ,
2424 init_args : Vec < Val > ,
2525 constructor_args : Vec < Val > ,
26- ) -> ( Address , Val ) {
27- if deployer != env. current_contract_address ( ) {
28- deployer . require_auth ( ) ;
26+ ) -> Result < ( Address , Val ) , ContractError > {
27+ if EscrowManager :: get_escrow ( & env) . is_ok ( ) {
28+ return Err ( ContractError :: EscrowAlreadyInitialized ) ;
2929 }
3030
31+ signer. require_auth ( ) ;
32+
33+ let deployer = env. current_contract_address ( ) ;
3134 let deployed_address = env
3235 . deployer ( )
3336 . with_address ( deployer, salt)
3437 . deploy_v2 ( wasm_hash, constructor_args) ;
3538
3639 let res: Val = env. invoke_contract ( & deployed_address, & init_fn, init_args) ;
37- ( deployed_address, res)
40+ Ok ( ( deployed_address, res) )
3841 }
3942
4043 ////////////////////////
You can’t perform that action at this time.
0 commit comments