Skip to content

Commit

Permalink
Apply review recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
orkunkl committed Jul 30, 2021
1 parent f62727f commit eb753c4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions contracts/cw20-merkle-airdrop/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ pub fn execute_register_merkle_root(
let mut root_buf: [u8; 32] = [0; 32];
hex::decode_to_slice(merkle_root.to_string(), &mut root_buf)?;

let latest_stage: u8 = STAGE.load(deps.storage)?;
let stage = latest_stage + 1;
let stage = STAGE.update(deps.storage, |stage| Ok(stage + 1))?;

MERKLE_ROOT.save(deps.storage, U8Key::from(stage), &merkle_root)?;
STAGE.save(deps.storage, &stage)?;
Expand Down Expand Up @@ -140,7 +139,7 @@ pub fn execute_claim(
let config = CONFIG.load(deps.storage)?;
let merkle_root = MERKLE_ROOT.load(deps.storage, stage.into())?;

let user_input: String = info.sender.to_string() + &amount.to_string();
let user_input = format!("{}{}", info.sender, amount);
let hash = sha3::Keccak256::digest(user_input.as_bytes())
.as_slice()
.try_into()
Expand Down

0 comments on commit eb753c4

Please sign in to comment.