pub fn try_activate_by_init_code_hash(&mut self, state_init: &StateInit, init_code_hash: bool) -> Result<()> {
        if let Some(stuff) = self.stuff_mut() {
            let new_state = match &stuff.storage.state {
                AccountState::AccountUninit => {
                    if state_init.hash()? == stuff.addr.get_address() {
                        let init_code_hash = match init_code_hash {
                            true => state_init.code().map(|code| code.repr_hash()),
                            false => None
                        };
                        let state_init = state_init.clone();
                        AccountState::AccountActive {init_code_hash, state_init}
                    } else {
                        fail!("StateInit doesn't correspond to uninit account address")
                    }
                }
                AccountState::AccountFrozen { init_code_hash, state_init_hash } => {
                    if state_init_hash == &state_init.hash()? {
                        let init_code_hash =  init_code_hash.clone();
                        let state_init = state_init.clone();
                        AccountState::AccountActive { init_code_hash, state_init }
                    } else {
                        fail!("StateInit doesn't correspond to frozen hash")
                    }
                }
                _ => stuff.storage.state.clone()
            };
            stuff.storage.state = new_state;
            Ok(())
        } else {
            fail!("Cannot activate not existing account")
        }
    }
/// Try to activate account with new StateInit
Try to activate account with new StateInit
Try to activate account with new StateInit
pub fn try_activate_by_init_code_hash(&mut self, state_init: &StateInit, init_code_hash: bool) -> Result<()> {
        if let Some(stuff) = self.stuff_mut() {
            let new_state = match &stuff.storage.state {
                AccountState::AccountUninit => {
                    if state_init.hash()? == stuff.addr.get_address() {
                        let init_code_hash = match init_code_hash {
                            true => state_init.code().map(|code| code.repr_hash()),
                            false => None
                        };
                        let state_init = state_init.clone();
                        AccountState::AccountActive {init_code_hash, state_init}
                    } else {
                        fail!("StateInit doesn't correspond to uninit account address")
                    }
                }
                AccountState::AccountFrozen { init_code_hash, state_init_hash } => {
                    if state_init_hash == &state_init.hash()? {
                        let init_code_hash =  init_code_hash.clone();
                        let state_init = state_init.clone();
                        AccountState::AccountActive { init_code_hash, state_init }
                    } else {
                        fail!("StateInit doesn't correspond to frozen hash")
                    }
                }
                _ => stuff.storage.state.clone()
            };
            stuff.storage.state = new_state;
            Ok(())
        } else {
            fail!("Cannot activate not existing account")
        }
    }
pub fn try_activate_by_init_code_hash ( & mut self , state_init : & StateInit , init_code_hash : bool ) -> Result < ( ) > { if let Some ( stuff ) = self . stuff_mut ( ) { let new_state = match & stuff . storage . state { AccountState :: AccountUninit => { if state_init . hash ( ) ? == stuff . addr . get_address ( ) { let init_code_hash = match init_code_hash { true => state_init . code ( ) . map ( | code | code . repr_hash ( ) ) , false => None } ; let state_init = state_init . clone ( ) ; AccountState :: AccountActive { init_code_hash , state_init } } else { fail ! ( " " ) } } AccountState :: AccountFrozen { init_code_hash , state_init_hash } => { if state_init_hash == & state_init . hash ( ) ? { let init_code_hash = init_code_hash . clone ( ) ; let state_init = state_init . clone ( ) ; AccountState :: AccountActive { init_code_hash , state_init } } else { fail ! ( " " ) } } _ => stuff . storage . state . clone ( ) } ; stuff . storage . state = new_state ; Ok ( ( ) ) } else { fail ! ( " " ) } }
Try to activate account with new StateInit
Try to activate account with new StateInit
&mut self
state_init
&StateInit
init_code_hash
bool
&mut self
state_init
&StateInit
init_code_hash
bool