-
Notifications
You must be signed in to change notification settings - Fork 1
/
6_contractAsTreasuryFT.sol
40 lines (29 loc) · 1.26 KB
/
6_contractAsTreasuryFT.sol
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
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
pragma experimental ABIEncoderV2;
import "./hip-206/HederaTokenService.sol";
import "./hip-206/HederaResponseCodes.sol";
contract contractAsTreasuryFT is HederaTokenService {
address tokenAddress;
constructor(address _tokenAddress) public {
tokenAddress = _tokenAddress;
}
function mintFungibleToken(uint64 _amount) external {
(int response, uint64 newTotalSupply, int64[] memory serialNumbers) = HederaTokenService.mintToken(tokenAddress, _amount, new bytes[](0));
if (response != HederaResponseCodes.SUCCESS) {
revert ("Mint Failed");
}
}
function tokenAssociate(address _account) external {
int response = HederaTokenService.associateToken(_account, tokenAddress);
if (response != HederaResponseCodes.SUCCESS) {
revert ("Associate Failed");
}
}
function tokenTransfer(address _sender, address _receiver, int64 _amount) external {
int response = HederaTokenService.transferToken(tokenAddress, _sender, _receiver, _amount);
if (response != HederaResponseCodes.SUCCESS) {
revert ("Transfer Failed");
}
}
}