-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathsrc3.sw
54 lines (52 loc) · 1.66 KB
/
src3.sw
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
library;
abi SRC3 {
/// Mints new assets using the `sub_id` sub-identifier.
///
/// # Arguments
///
/// * `recipient`: [Identity] - The user to which the newly minted asset is transferred to.
/// * `sub_id`: [Option<SubId>] - The sub-identifier of the newly minted asset.
/// * `amount`: [u64] - The quantity of coins to mint.
///
/// # Examples
///
/// ```sway
/// use standards::src3::SRC3;
///
/// fn foo(contract_id: ContractId) {
/// let contract_abi = abi(SRC3, contract_id.bits());
/// contract_abi.mint(Identity::ContractId(contract_id), SubId::zero(), 100);
/// }
/// ```
#[storage(read, write)]
fn mint(recipient: Identity, sub_id: Option<SubId>, amount: u64);
/// Burns assets sent with the given `sub_id`.
///
/// # Additional Information
///
/// NOTE: The sha-256 hash of `(ContractId, SubId)` must match the `AssetId` where `ContractId` is the id of
/// the implementing contract and `SubId` is the given `sub_id` argument.
///
/// # Arguments
///
/// * `sub_id`: [SubId] - The sub-identifier of the asset to burn.
/// * `amount`: [u64] - The quantity of coins to burn.
///
/// # Examples
///
/// ```sway
/// use standards::src3::SRC3;
///
/// fn foo(contract_id: ContractId, asset_id: AssetId) {
/// let contract_abi = abi(SRC3, contract_id.bits());
/// contract_abi {
/// gas: 10000,
/// coins: 100,
/// asset_id: asset_id,
/// }.burn(SubId::zero(), 100);
/// }
/// ```
#[payable]
#[storage(read, write)]
fn burn(sub_id: SubId, amount: u64);
}