-
Notifications
You must be signed in to change notification settings - Fork 0
/
trellis_token.move
42 lines (32 loc) · 1.15 KB
/
trellis_token.move
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
module trellis_token::trellis_token {
use std::signer;
use std::string;
use aptos_framework::managed_coin;
use aptos_framework::coin;
struct TrellisToken {}
const MODULE_OWNER: address = @trellis_token;
const INVALID_ADMIN: u64 = 1;
const DECIMAL: u8 = 6;
const SUPPLY: u64 = 100000000 * 1000000;
public entry fun init_token(
admin: &signer
){
let admin_addr = signer::address_of(admin);
assert!(admin_addr == MODULE_OWNER, INVALID_ADMIN);
let (burn_cap, freeze_cap, mint_cap) = coin::initialize<TrellisToken>(
admin,
string::utf8(b"Trellis Token"),
string::utf8(b"TRELLIS"),
DECIMAL,
true,
);
let coins_minted = coin::mint(SUPPLY, &mint_cap);
coin::destroy_mint_cap<TrellisToken>(mint_cap);
coin::destroy_burn_cap<TrellisToken>(burn_cap);
coin::destroy_freeze_cap<TrellisToken>(freeze_cap);
if(!coin::is_account_registered<TrellisToken>(admin_addr)){
managed_coin::register<TrellisToken>(admin);
};
coin::deposit(admin_addr, coins_minted);
}
}