Skip to content

Commit

Permalink
fix: support mint_to_address in tokenfactory multitest module
Browse files Browse the repository at this point in the history
  • Loading branch information
apollo-sturdy committed Aug 2, 2024
1 parent 5bcc131 commit 331de15
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/multi_test/modules/token_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,16 @@ impl TokenFactory<'_> {
bail!("Invalid zero amount");
}

// Determine recipient
let recipient = if msg.mint_to_address.is_empty() {
msg.sender.clone()
} else {
msg.mint_to_address.clone()
};

// Mint through BankKeeper sudo method
let mint_msg = BankSudo::Mint {
to_address: sender.to_string(),
to_address: recipient.clone(),
amount: vec![Coin {
denom: denom.clone(),
amount,
Expand All @@ -175,7 +182,10 @@ impl TokenFactory<'_> {
res.data = Some(data.into());
res.events.push(
Event::new("tf_mint")
.add_attribute("mint_to_address", "sender")
.add_attribute("sender", msg.sender)
.add_attribute("mint_to_address", msg.mint_to_address)
.add_attribute("recipient", recipient)
.add_attribute("denom", denom)
.add_attribute("amount", amount.to_string()),
);
Ok(res)
Expand Down

0 comments on commit 331de15

Please sign in to comment.