-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a coins_to_string
helper
#1359
Comments
I'm not super convinced we need this or should implement it here. In Cosmos SDK there is a dedicated But I see two ways to improve the situation in the linked code:
For this reason I think this is the more pragmatic and maybe even better solution: diff --git a/contracts/tg4-stake/src/contract.rs b/contracts/tg4-stake/src/contract.rs
index 848f6b8..2f44b2a 100644
--- a/contracts/tg4-stake/src/contract.rs
+++ b/contracts/tg4-stake/src/contract.rs
@@ -461,29 +461,20 @@ pub fn execute_claim<Q: CustomQuery>(
}
let config = CONFIG.load(deps.storage)?;
- let amount = coins(release.into(), config.denom);
+ let amount = coin(release.into(), config.denom);
let res = Response::new()
.add_attribute("action", "claim")
- .add_attribute("tokens", coins_to_string(&amount))
+ .add_attribute("tokens", amount.to_string())
.add_attribute("sender", &info.sender)
.add_message(BankMsg::Send {
to_address: info.sender.into(),
- amount,
+ amount: vec![amount],
});
Ok(res)
}
-// TODO: put in cosmwasm-std (https://github.com/CosmWasm/cosmwasm/issues/1359)
-fn coins_to_string(coins: &[Coin]) -> String {
- let strings: Vec<_> = coins
- .iter()
- .map(|c| format!("{}{}", c.amount, c.denom))
- .collect();
- strings.join(",")
-}
-
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn sudo(
deps: DepsMut<TgradeQuery>, |
Closing in favour of #1377 |
Move
coins_to_string
https://github.com/confio/poe-contracts/blob/ab1b1b21d235ee08419a158e2f7b26be8057ec9d/contracts/tg4-stake/src/contract.rs#L478-L485
to cosmwasm-std (src/coins.rs).
The text was updated successfully, but these errors were encountered: