-
Notifications
You must be signed in to change notification settings - Fork 12
/
MintAssociateTransferHTS.sol
36 lines (29 loc) · 1.23 KB
/
MintAssociateTransferHTS.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
// 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 MintAssoTransHTS is HederaTokenService {
address tokenAddress;
constructor(address _tokenAddress) {
tokenAddress = _tokenAddress;
}
function mintFungibleToken(int64 _amount) external {
(int response, int64 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");
}
}
}