@@ -9,8 +9,11 @@ use cosmwasm_std::{
99use cw0:: { maybe_canonical, Expiration } ;
1010use cw1:: CanExecuteResponse ;
1111use cw1_whitelist:: {
12- contract:: { execute_freeze, execute_update_admins, init as whitelist_init, query_admin_list} ,
13- msg:: InitMsg ,
12+ contract:: {
13+ execute_freeze, execute_update_admins, instantiate as whitelist_instantiate,
14+ query_admin_list,
15+ } ,
16+ msg:: InstantiateMsg ,
1417 state:: ADMIN_LIST ,
1518} ;
1619use cw2:: set_contract_version;
@@ -27,8 +30,13 @@ use cw_storage_plus::Bound;
2730const CONTRACT_NAME : & str = "crates.io:cw1-subkeys" ;
2831const CONTRACT_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
2932
30- pub fn init ( mut deps : DepsMut , env : Env , info : MessageInfo , msg : InitMsg ) -> StdResult < Response > {
31- let result = whitelist_init ( deps. branch ( ) , env, info, msg) ?;
33+ pub fn instantiate (
34+ mut deps : DepsMut ,
35+ env : Env ,
36+ info : MessageInfo ,
37+ msg : InstantiateMsg ,
38+ ) -> StdResult < Response > {
39+ let result = whitelist_instantiate ( deps. branch ( ) , env, info, msg) ?;
3240 set_contract_version ( deps. storage , CONTRACT_NAME , CONTRACT_VERSION ) ?;
3341 Ok ( result)
3442}
@@ -419,7 +427,7 @@ mod tests {
419427
420428 use super :: * ;
421429
422- // this will set up the init for other tests
430+ // this will set up instantiation for other tests
423431 fn setup_test_case (
424432 mut deps : DepsMut ,
425433 info : & MessageInfo ,
@@ -428,12 +436,12 @@ mod tests {
428436 allowances : & [ Coin ] ,
429437 expirations : & [ Expiration ] ,
430438 ) {
431- // Init a contract with admins
432- let init_msg = InitMsg {
439+ // Instantiate a contract with admins
440+ let instantiate_msg = InstantiateMsg {
433441 admins : admins. to_vec ( ) ,
434442 mutable : true ,
435443 } ;
436- init ( deps. branch ( ) , mock_env ( ) , info. clone ( ) , init_msg ) . unwrap ( ) ;
444+ instantiate ( deps. branch ( ) , mock_env ( ) , info. clone ( ) , instantiate_msg ) . unwrap ( ) ;
437445
438446 // Add subkeys with initial allowances
439447 for ( spender, expiration) in spenders. iter ( ) . zip ( expirations) {
@@ -633,12 +641,12 @@ mod tests {
633641 } ;
634642
635643 let info = mock_info ( owner. clone ( ) , & [ ] ) ;
636- // Init a contract with admins
637- let init_msg = InitMsg {
644+ // Instantiate a contract with admins
645+ let instantiate_msg = InstantiateMsg {
638646 admins : admins. clone ( ) ,
639647 mutable : true ,
640648 } ;
641- init ( deps. as_mut ( ) , mock_env ( ) , info. clone ( ) , init_msg ) . unwrap ( ) ;
649+ instantiate ( deps. as_mut ( ) , mock_env ( ) , info. clone ( ) , instantiate_msg ) . unwrap ( ) ;
642650
643651 let setup_perm_msg1 = HandleMsg :: SetPermissions {
644652 spender : spender1. clone ( ) ,
@@ -709,12 +717,12 @@ mod tests {
709717
710718 let info = mock_info ( owner, & [ ] ) ;
711719
712- // Init a contract with admins
713- let init_msg = InitMsg {
720+ // Instantiate a contract with admins
721+ let instantiate_msg = InstantiateMsg {
714722 admins : admins. clone ( ) ,
715723 mutable : true ,
716724 } ;
717- init ( deps. as_mut ( ) , mock_env ( ) , info. clone ( ) , init_msg ) . unwrap ( ) ;
725+ instantiate ( deps. as_mut ( ) , mock_env ( ) , info. clone ( ) , instantiate_msg ) . unwrap ( ) ;
718726
719727 let setup_perm_msg1 = HandleMsg :: SetPermissions {
720728 spender : spender1. clone ( ) ,
@@ -1234,12 +1242,12 @@ mod tests {
12341242 } ;
12351243
12361244 let info = mock_info ( owner. clone ( ) , & [ ] ) ;
1237- // Init a contract with admins
1238- let init_msg = InitMsg {
1245+ // Instantiate a contract with admins
1246+ let instantiate_msg = InstantiateMsg {
12391247 admins : admins. clone ( ) ,
12401248 mutable : true ,
12411249 } ;
1242- init ( deps. as_mut ( ) , mock_env ( ) , info. clone ( ) , init_msg ) . unwrap ( ) ;
1250+ instantiate ( deps. as_mut ( ) , mock_env ( ) , info. clone ( ) , instantiate_msg ) . unwrap ( ) ;
12431251
12441252 let setup_perm_msg1 = HandleMsg :: SetPermissions {
12451253 spender : spender1. clone ( ) ,
@@ -1387,12 +1395,12 @@ mod tests {
13871395 } ;
13881396
13891397 let info = mock_info ( owner. clone ( ) , & [ ] ) ;
1390- // Init a contract with admins
1391- let init_msg = InitMsg {
1398+ // Instantiate a contract with admins
1399+ let instantiate_msg = InstantiateMsg {
13921400 admins : admins. clone ( ) ,
13931401 mutable : true ,
13941402 } ;
1395- init ( deps. as_mut ( ) , mock_env ( ) , info. clone ( ) , init_msg ) . unwrap ( ) ;
1403+ instantiate ( deps. as_mut ( ) , mock_env ( ) , info. clone ( ) , instantiate_msg ) . unwrap ( ) ;
13961404
13971405 // setup permission and then allowance and check if changed
13981406 let setup_perm_msg = HandleMsg :: SetPermissions {
0 commit comments