pub fn update_state(
    deps: DepsMut,
    msg_info: MessageInfo,
    owner: Option<String>,
    expiration_time: Option<u64>,
    memory_contract: Option<String>,
) -> UnbondHandlerResult {
    // Only the admin should be able to call this
    ADMIN.assert_admin(deps.as_ref(), &msg_info.sender)?;

    let mut state = STATE.load(deps.storage)?;

    let mut attrs = vec![];

    if let Some(owner) = owner {
        state.owner = Some(deps.api.addr_validate(&owner)?);
        attrs.push(("new_owner", owner));
    }

    if let Some(expiration_time) = expiration_time {
        state.expiration_time = Some(expiration_time);
        attrs.push(("new_expiration_time", expiration_time.to_string()));
    }

    if let Some(memory_contract) = memory_contract {
        state.memory_contract = deps.api.addr_validate(&memory_contract)?;
        attrs.push(("new_memory_contract", memory_contract));
    }

    STATE.save(deps.storage, &state)?;
    Ok(Response::new().add_attributes(attrs))
}
/// Updates the state of the contract
Updates the state of the contract
Updates the state of the contract
pub fn update_state(
    deps: DepsMut,
    msg_info: MessageInfo,
    owner: Option<String>,
    expiration_time: Option<u64>,
    memory_contract: Option<String>,
) -> UnbondHandlerResult {
    // Only the admin should be able to call this
    ADMIN.assert_admin(deps.as_ref(), &msg_info.sender)?;
    let mut state = STATE.load(deps.storage)?;
    let mut attrs = vec![];
    if let Some(owner) = owner {
        state.owner = Some(deps.api.addr_validate(&owner)?);
        attrs.push(("new_owner", owner));
    }
    if let Some(expiration_time) = expiration_time {
        state.expiration_time = Some(expiration_time);
        attrs.push(("new_expiration_time", expiration_time.to_string()));
    }
    if let Some(memory_contract) = memory_contract {
        state.memory_contract = deps.api.addr_validate(&memory_contract)?;
        attrs.push(("new_memory_contract", memory_contract));
    }
    STATE.save(deps.storage, &state)?;
    Ok(Response::new().add_attributes(attrs))
}
pub fn update_state ( deps : DepsMut , msg_info : MessageInfo , owner : Option < String > , expiration_time : Option < u64 > , memory_contract : Option < String > , ) -> UnbondHandlerResult { // Only the admin should be able to call this ADMIN . assert_admin ( deps . as_ref ( ) , & msg_info . sender ) ? ; let mut state = STATE . load ( deps . storage ) ? ; let mut attrs = vec ! [ ] ; if let Some ( owner ) = owner { state . owner = Some ( deps . api . addr_validate ( & owner ) ? ) ; attrs . push ( ( " " , owner ) ) ; } if let Some ( expiration_time ) = expiration_time { state . expiration_time = Some ( expiration_time ) ; attrs . push ( ( " " , expiration_time . to_string ( ) ) ) ; } if let Some ( memory_contract ) = memory_contract { state . memory_contract = deps . api . addr_validate ( & memory_contract ) ? ; attrs . push ( ( " " , memory_contract ) ) ; } STATE . save ( deps . storage , & state ) ? ; Ok ( Response :: new ( ) . add_attributes ( attrs ) ) }
Updates the state of the contract
Updates the state of the contract
deps
DepsMut
msg_info
MessageInfo
owner
Option<String>
expiration_time
Option<u64>
memory_contract
Option<String>
deps
DepsMut
msg_info
MessageInfo
owner
Option<String>
expiration_time
Option<u64>
memory_contract
Option<String>