-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsecure_the_mint_launcher.clsp
101 lines (94 loc) · 3.29 KB
/
secure_the_mint_launcher.clsp
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
(mod (SINGLETON_MOD_HASH SINGLETON_LAUNCHER_PUZHASH
NFT_STATE_LAYER_MOD_HASH METADATA_HASH METADATA_UPDATER_PUZZLE_HASH
NFT_OWNERSHIP_LAYER_MOD_HASH
NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH ROYALTY_ADDRESS TRADE_PRICE_PERCENTAGE
P2_PUZZLE_HASH
MELT_PUBLIC_KEY
mode ; 1 for mint, 0 for melt
my_id)
(include condition_codes.clib)
(include curry-and-treehash.clib)
(defun-inline nft_ownership_transfer_program_puzzle_hash (NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH SINGLETON_STRUCT ROYALTY_ADDRESS TRADE_PRICE_PERCENTAGE)
(puzzle-hash-of-curried-function NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH
(sha256 ONE TRADE_PRICE_PERCENTAGE)
(sha256 ONE ROYALTY_ADDRESS)
(sha256tree SINGLETON_STRUCT)
)
)
(defun-inline nft_ownership_layer_puzzle_hash (NFT_OWNERSHIP_LAYER_MOD_HASH CURRENT_OWNER TRANSFER_PROGRAM_HASH inner_puzzle_hash)
(puzzle-hash-of-curried-function NFT_OWNERSHIP_LAYER_MOD_HASH
inner_puzzle_hash
TRANSFER_PROGRAM_HASH
(sha256 ONE CURRENT_OWNER)
(sha256 ONE NFT_OWNERSHIP_LAYER_MOD_HASH)
)
)
(defun-inline nft_state_layer_puzzle_hash (NFT_STATE_LAYER_MOD_HASH METADATA_HASH METADATA_UPDATER_PUZZLE_HASH inner_puzzle_hash)
(puzzle-hash-of-curried-function NFT_STATE_LAYER_MOD_HASH
inner_puzzle_hash
(sha256 ONE METADATA_UPDATER_PUZZLE_HASH)
METADATA_HASH
(sha256 ONE NFT_STATE_LAYER_MOD_HASH)
)
)
(defun-inline calculate_singleton_puzzle_hash (SINGLETON_STRUCT inner_puzzle_hash)
(puzzle-hash-of-curried-function (f SINGLETON_STRUCT)
inner_puzzle_hash
(sha256tree SINGLETON_STRUCT)
)
)
(defun-inline calculate_full_puzzle_hash
(SINGLETON_STRUCT
NFT_STATE_LAYER_MOD_HASH METADATA_HASH METADATA_UPDATER_PUZZLE_HASH
NFT_OWNERSHIP_LAYER_MOD_HASH
NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH ROYALTY_ADDRESS TRADE_PRICE_PERCENTAGE
inner_puzzle_hash
)
(calculate_singleton_puzzle_hash
SINGLETON_STRUCT
(nft_state_layer_puzzle_hash
NFT_STATE_LAYER_MOD_HASH
METADATA_HASH
METADATA_UPDATER_PUZZLE_HASH
(nft_ownership_layer_puzzle_hash
NFT_OWNERSHIP_LAYER_MOD_HASH
()
(nft_ownership_transfer_program_puzzle_hash
NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH
SINGLETON_STRUCT
ROYALTY_ADDRESS
TRADE_PRICE_PERCENTAGE
)
inner_puzzle_hash
)
)
)
)
(if mode
(list ; mint
(list ASSERT_MY_COIN_ID my_id)
(list CREATE_COIN SINGLETON_LAUNCHER_PUZHASH 1)
(list ASSERT_COIN_ANNOUNCEMENT
(sha256
(calculate_coin_id my_id SINGLETON_LAUNCHER_PUZHASH 1)
(sha256tree
(list
(calculate_full_puzzle_hash
(c SINGLETON_MOD_HASH (c (calculate_coin_id my_id SINGLETON_LAUNCHER_PUZHASH 1) SINGLETON_LAUNCHER_PUZHASH))
NFT_STATE_LAYER_MOD_HASH METADATA_HASH METADATA_UPDATER_PUZZLE_HASH
NFT_OWNERSHIP_LAYER_MOD_HASH
NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH ROYALTY_ADDRESS TRADE_PRICE_PERCENTAGE
P2_PUZZLE_HASH
)
1
()
)
)
)
)
)
(list ; melt
(list AGG_SIG_ME MELT_PUBLIC_KEY 1)
)
)
)