I’m struggling to store multiples index map inside my smart contract.
Here my code:
Edit: Found the issue, I needed to type my closure.
// state.rs
pub const BETLIST: Map<(&Addr, String), u8> = Map::new("votelist");
//contract.rs
pub fn try_make_bet(deps: DepsMut, info: MessageInfo, bet: String) -> Result<Response, ContractError> {
let api = deps.api;
BETLIST.update(deps.storage, (bet, &info.sender), |may_count| { Ok(may_count.unwrap_or_default() + 1) })?;
Ok(Response::new()
.add_attribute("method", "try_make_bet"))
}
The console return the following error and I’m note sure how to solve it:
Also on Terra Discord, someone suggested to use IndexedMap for multiple indexes but the documentations is not very explicite and I did not find any example for IndexedMap usage.
Edit: Someone on Discord send me a more comprehensive guide
Thanks a lot !