fn try_join(
    deps: DepsMut,
    env: Env,
    info: MessageInfo,
    denom: String,
    max_supply: Uint128,
    name: Option<String>,
) -> Result<Response<ProvenanceMsg>, ContractError> {
    // Validate params.
    if !info.funds.is_empty() {
        return Err(contract_err("no funds should be sent during join"));
    }
    if denom.len() < MIN_DENOM_LEN {
        return Err(contract_err("invalid proposal denom"));
    }
    if max_supply.is_zero() {
        return Err(contract_err("max_supply must be greater than zero"));
    }

    // Read state
    let state = config_read(deps.storage).load()?;

    // Check for existing join request
    let key = info.sender.as_bytes();
    let mut proposals = join_proposals(deps.storage);
    if proposals.may_load(key)?.is_some() {
        return Err(contract_err("duplicate proposal"));
    }

    // Persist a join proposal.
    proposals.save(
        key,
        &JoinProposal {
            id: info.sender.clone(),
            max_supply,
            denom: denom.clone(),
            created: Uint128::from(env.block.height),
            expires: Uint128::from(env.block.height) + state.vote_duration,
            no: Uint128::zero(),
            yes: Uint128::zero(),
            voters: vec![],
            name,
            admin_vote: None,
        },
    )?;

    // Propose the member restricted marker and grant this contract exclusive access.
    let res = Response::new()
        .add_message(create_marker(0, &denom, MarkerType::Restricted)?)
        .add_message(grant_marker_access(
            &denom,
            env.contract.address,
            MarkerAccess::all(),
        )?)
        .add_attribute("action", "join")
        .add_attribute("join_proposal_id", info.sender.to_string());
    Ok(res)
}
// Add a proposal to join the consortium that must be voted on by existing members.
Add a proposal to join the consortium that must be voted on by existing members.
Add a proposal to join the consortium that must be voted on by existing members .
fn try_join(
    deps: DepsMut,
    env: Env,
    info: MessageInfo,
    denom: String,
    max_supply: Uint128,
    name: Option<String>,
) -> Result<Response<ProvenanceMsg>, ContractError> {
    // Validate params.
    if !info.funds.is_empty() {
        return Err(contract_err("no funds should be sent during join"));
    }
    if denom.len() < MIN_DENOM_LEN {
        return Err(contract_err("invalid proposal denom"));
    }
    if max_supply.is_zero() {
        return Err(contract_err("max_supply must be greater than zero"));
    }
    // Read state
    let state = config_read(deps.storage).load()?;
    // Check for existing join request
    let key = info.sender.as_bytes();
    let mut proposals = join_proposals(deps.storage);
    if proposals.may_load(key)?.is_some() {
        return Err(contract_err("duplicate proposal"));
    }
    // Persist a join proposal.
    proposals.save(
        key,
        &JoinProposal {
            id: info.sender.clone(),
            max_supply,
            denom: denom.clone(),
            created: Uint128::from(env.block.height),
            expires: Uint128::from(env.block.height) + state.vote_duration,
            no: Uint128::zero(),
            yes: Uint128::zero(),
            voters: vec![],
            name,
            admin_vote: None,
        },
    )?;
    // Propose the member restricted marker and grant this contract exclusive access.
    let res = Response::new()
        .add_message(create_marker(0, &denom, MarkerType::Restricted)?)
        .add_message(grant_marker_access(
            &denom,
            env.contract.address,
            MarkerAccess::all(),
        )?)
        .add_attribute("action", "join")
        .add_attribute("join_proposal_id", info.sender.to_string());
    Ok(res)
}
fn try_join ( deps : DepsMut , env : Env , info : MessageInfo , denom : String , max_supply : Uint128 , name : Option < String > , ) -> Result < Response < ProvenanceMsg > , ContractError > { // Validate params. if ! info . funds . is_empty ( ) { return Err ( contract_err ( " " ) ) ; } if denom . len ( ) < MIN_DENOM_LEN { return Err ( contract_err ( " " ) ) ; } if max_supply . is_zero ( ) { return Err ( contract_err ( " " ) ) ; } // Read state let state = config_read ( deps . storage ) . load ( ) ? ; // Check for existing join request let key = info . sender . as_bytes ( ) ; let mut proposals = join_proposals ( deps . storage ) ; if proposals . may_load ( key ) ? . is_some ( ) { return Err ( contract_err ( " " ) ) ; } // Persist a join proposal. proposals . save ( key , & JoinProposal { id : info . sender . clone ( ) , max_supply , denom : denom . clone ( ) , created : Uint128 :: from ( env . block . height ) , expires : Uint128 :: from ( env . block . height ) + state . vote_duration , no : Uint128 :: zero ( ) , yes : Uint128 :: zero ( ) , voters : vec ! [ ] , name , admin_vote : None , } , ) ? ; // Propose the member restricted marker and grant this contract exclusive access. let res = Response :: new ( ) . add_message ( create_marker ( 0 , & denom , MarkerType :: Restricted ) ? ) . add_message ( grant_marker_access ( & denom , env . contract . address , MarkerAccess :: all ( ) , ) ? ) . add_attribute ( " " , " " ) . add_attribute ( " " , info . sender . to_string ( ) ) ; Ok ( res ) }
Add a proposal to join the consortium that must be voted on by existing members.
Add a proposal to join the consortium that must be voted on by existing members .
deps
DepsMut
env
Env
info
MessageInfo
denom
String
max_supply
Uint128
name
Option<String>
deps
DepsMut
env
Env
info
MessageInfo
denom
String
max_supply
Uint128
name
Option<String>