Skip to content

Commit 7ddf54d

Browse files
authored
Merge pull request #17 from public-awesome/shanev/helpers
Add coin and msg helpers
2 parents b754f72 + 7eb439e commit 7ddf54d

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/sg-std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "sg-std"
33
authors = ["Jorge Hernandez <[email protected]>"]
44
description = "Bindings for CosmWasm contracts to call into custom modules of Stargaze"
5-
version = "3.1.0"
5+
version = "3.2.0"
66
edition = { workspace = true }
77
homepage = { workspace = true }
88
repository = { workspace = true }

packages/sg-std/src/lib.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
pub mod math;
21
mod msg;
32
mod query;
43
mod route;
@@ -7,6 +6,7 @@ pub const NATIVE_DENOM: &str = "ustars";
76
// 3/11/2022 16:00:00 ET
87
pub const GENESIS_MINT_START_TIME: u64 = 1647032400000000000;
98

9+
use cosmwasm_std::{coin, coins, Addr, BankMsg, Coin};
1010
pub use msg::{
1111
create_claim_for_msg, create_fund_community_pool_msg, create_fund_fairburn_pool_msg,
1212
ClaimAction, StargazeMsg, StargazeMsgWrapper,
@@ -23,3 +23,18 @@ pub use route::StargazeRoute;
2323
// "stargaze" support on the chain they run on.
2424
#[no_mangle]
2525
extern "C" fn requires_stargaze() {}
26+
27+
pub fn stars(amount: impl Into<u128>) -> Vec<Coin> {
28+
coins(amount.into(), NATIVE_DENOM)
29+
}
30+
31+
pub fn star(amount: impl Into<u128>) -> Coin {
32+
coin(amount.into(), NATIVE_DENOM)
33+
}
34+
35+
pub fn send_msg(to_address: &Addr, amount: impl Into<u128>) -> BankMsg {
36+
BankMsg::Send {
37+
to_address: to_address.to_string(),
38+
amount: stars(amount),
39+
}
40+
}

packages/sg-std/src/math.rs

-11
This file was deleted.

0 commit comments

Comments
 (0)