Skip to content

Commit

Permalink
init NUM_MINTS_ATTEMPTED
Browse files Browse the repository at this point in the history
  • Loading branch information
dirtyshab committed May 30, 2024
1 parent ee31252 commit a6f965a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion cw-minter/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use crate::error::ContractError;
use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg, RelayerResp};
use crate::state::{MintAttempt, MINT_ATTEMPTS, RELAYER_ASSOCIATED_ADDR, RELAYER_POINTER_ADDR};
use crate::state::{
MintAttempt, MINT_ATTEMPTS, NUM_MINTS_ATTEMPTED, RELAYER_ASSOCIATED_ADDR, RELAYER_POINTER_ADDR,
};
use crate::SUPPORTED_DENOM;
use cosmwasm_std::{
coin, entry_point, to_json_binary, wasm_execute, BankMsg, Binary, CosmosMsg, Deps, DepsMut,
Expand All @@ -22,6 +24,9 @@ pub fn instantiate(
info.sender
};
initialize_owner(deps.storage, deps.api, Some(admin.as_str()))?;

NUM_MINTS_ATTEMPTED.save(deps.storage, &0u32)?;

Ok(Response::new().add_attributes(vec![
("action", "instantiate"),
("admin", &admin.to_string()),
Expand Down
4 changes: 2 additions & 2 deletions cw-minter/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ impl MintAttempt {
quantity: u32,
funds: u128,
) -> Result<Self, ContractError> {
let _ = NUM_MINTS_ATTEMPTED.update(deps.storage, |n| -> StdResult<_> { Ok(n + 1) })?;
let mint_attempt_id = NUM_MINTS_ATTEMPTED.load(deps.storage)?;
let mint_attempt_id =
NUM_MINTS_ATTEMPTED.update(deps.storage, |n| -> StdResult<_> { Ok(n + 1) })?;
let mint_attempt = Self {
id: mint_attempt_id,
minter: deps.api.addr_validate(&minter)?,
Expand Down

0 comments on commit a6f965a

Please sign in to comment.