1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use cosmwasm_std::{Addr, Binary, Uint128};
use crate::AbstractOS;
use abstract_os::abstract_token::*;
use boot_core::{BootError, Contract, IndexResponse, TxHandler, TxResponse};
pub type Idea<Chain> = AbstractOS<Chain, ExecuteMsg, InstantiateMsg, QueryMsg, MigrateMsg>;
impl<Chain: TxHandler + Clone> Idea<Chain>
where
TxResponse<Chain>: IndexResponse,
{
pub fn new(name: &str, chain: &Chain) -> Self {
Self(
Contract::new(name, chain).with_wasm_path("abstract_token"), )
}
pub fn send(
&self,
msg: Binary,
amount: u128,
contract: String,
) -> Result<TxResponse<Chain>, BootError> {
let msg = ExecuteMsg::Send {
contract,
amount: Uint128::new(amount),
msg,
};
self.execute(&msg, None)
}
pub fn create_new<T: Into<Uint128>>(
&self,
minter: &Addr,
balance: T,
version_control_address: String,
symbol: &str,
) -> Result<TxResponse<Chain>, BootError> {
let msg = InstantiateMsg {
decimals: 6,
mint: Some(MinterResponse {
cap: None,
minter: minter.clone().into(),
}),
symbol: symbol.to_string(),
name: self.id.to_string(),
initial_balances: vec![Cw20Coin {
address: minter.clone().into(),
amount: balance.into(),
}],
version_control_address,
};
self.instantiate(&msg, Some(minter), None)
}
}