pub fn add_dapp(deps: DepsMut, msg_info: MessageInfo, dapp: String) -> TreasuryResult {
    ADMIN.assert_admin(deps.as_ref(), &msg_info.sender)?;

    let mut state = STATE.load(deps.storage)?;
    if state.dapps.contains(&deps.api.addr_validate(&dapp)?) {
        return Err(TreasuryError::AlreadyInList {});
    }

    // This is a limit to prevent potentially running out of gas when doing lookups on the dapps list
    if state.dapps.len() >= LIST_SIZE_LIMIT {
        return Err(TreasuryError::DAppsLimitReached {});
    }

    // Add contract to whitelist.
    state.dapps.push(deps.api.addr_validate(&dapp)?);
    STATE.save(deps.storage, &state)?;

    // Respond and note the change
    Ok(Response::new().add_attribute("Added contract to whitelist: ", dapp))
}
/// Add a contract to the whitelist
Add a contract to the whitelist
Add a contract to the whitelist
pub fn add_dapp(deps: DepsMut, msg_info: MessageInfo, dapp: String) -> TreasuryResult {
    ADMIN.assert_admin(deps.as_ref(), &msg_info.sender)?;
    let mut state = STATE.load(deps.storage)?;
    if state.dapps.contains(&deps.api.addr_validate(&dapp)?) {
        return Err(TreasuryError::AlreadyInList {});
    }
    // This is a limit to prevent potentially running out of gas when doing lookups on the dapps list
    if state.dapps.len() >= LIST_SIZE_LIMIT {
        return Err(TreasuryError::DAppsLimitReached {});
    }
    // Add contract to whitelist.
    state.dapps.push(deps.api.addr_validate(&dapp)?);
    STATE.save(deps.storage, &state)?;
    // Respond and note the change
    Ok(Response::new().add_attribute("Added contract to whitelist: ", dapp))
}
pub fn add_dapp ( deps : DepsMut , msg_info : MessageInfo , dapp : String ) -> TreasuryResult { ADMIN . assert_admin ( deps . as_ref ( ) , & msg_info . sender ) ? ; let mut state = STATE . load ( deps . storage ) ? ; if state . dapps . contains ( & deps . api . addr_validate ( & dapp ) ? ) { return Err ( TreasuryError :: AlreadyInList { } ) ; } // This is a limit to prevent potentially running out of gas when doing lookups on the dapps list if state . dapps . len ( ) >= LIST_SIZE_LIMIT { return Err ( TreasuryError :: DAppsLimitReached { } ) ; } // Add contract to whitelist. state . dapps . push ( deps . api . addr_validate ( & dapp ) ? ) ; STATE . save ( deps . storage , & state ) ? ; // Respond and note the change Ok ( Response :: new ( ) . add_attribute ( " " , dapp ) ) }
Add a contract to the whitelist
Add a contract to the whitelist
deps
DepsMut
msg_info
MessageInfo
dapp
String
deps
DepsMut
msg_info
MessageInfo
dapp
String