// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.5.0 <0.9.0; pragma experimental ABIEncoderV2; import "../../token-service/HederaTokenService.sol"; import "../../token-service/ExpiryHelper.sol"; import "../../token-service/KeyHelper.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract TokenManagementContract is HederaTokenService, ExpiryHelper, KeyHelper { event ResponseCode(int responseCode); event PausedToken(bool paused); event UnpausedToken(bool unpaused); function deleteTokenPublic(address token) public returns (int responseCode) { responseCode = HederaTokenService.deleteToken(token); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(); } } function freezeTokenPublic(address token, address account) public returns (int responseCode) { responseCode = HederaTokenService.freezeToken(token, account); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(); } } function unfreezeTokenPublic(address token, address account) public returns (int responseCode) { responseCode = HederaTokenService.unfreezeToken(token, account); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(); } } function revokeTokenKycPublic(address token, address account) external returns (int64 responseCode) { (responseCode) = HederaTokenService.revokeTokenKyc(token, account); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(); } } function pauseTokenPublic(address token) public returns (int responseCode) { responseCode = HederaTokenService.pauseToken(token); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(); } emit PausedToken(true); } function unpauseTokenPublic(address token) public returns (int responseCode) { responseCode = HederaTokenService.unpauseToken(token); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(); } emit UnpausedToken(true); } function wipeTokenAccountPublic(address token, address account, int64 amount) public returns (int responseCode) { responseCode = HederaTokenService.wipeTokenAccount(token, account, amount); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert (); } } function wipeTokenAccountNFTPublic(address token, address account, int64[] memory serialNumbers) public returns (int responseCode) { responseCode = HederaTokenService.wipeTokenAccountNFT(token, account, serialNumbers); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert (); } } function updateTokenInfoPublic(address token, IHederaTokenService.HederaToken memory tokenInfo)external returns (int responseCode) { (responseCode) = HederaTokenService.updateTokenInfo(token, tokenInfo); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(); } } function updateTokenExpiryInfoPublic(address token, IHederaTokenService.Expiry memory expiryInfo)external returns (int responseCode) { (responseCode) = HederaTokenService.updateTokenExpiryInfo(token, expiryInfo); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(); } } function updateTokenKeysPublic(address token, IHederaTokenService.TokenKey[] memory keys) public returns (int64 responseCode) { (responseCode) = HederaTokenService.updateTokenKeys(token, keys); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(); } } function burnTokenPublic(address token, int64 amount, int64[] memory serialNumbers) external returns (int256 responseCode, int64 newTotalSupply) { (responseCode, newTotalSupply) = HederaTokenService.burnToken(token, amount, serialNumbers); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert (); } } function dissociateTokensPublic(address account, address[] memory tokens) external returns (int256 responseCode) { (responseCode) = HederaTokenService.dissociateTokens(account, tokens); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert (); } } function dissociateTokenPublic(address account, address token) public returns (int responseCode) { responseCode = HederaTokenService.dissociateToken(account, token); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert (); } } function approvePublic(address token, address spender, uint256 amount) public returns (int responseCode) { responseCode = HederaTokenService.approve(token, spender, amount); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert (); } } function approveNFTPublic(address token, address approved, uint256 serialNumber) public returns (int responseCode) { responseCode = HederaTokenService.approveNFT(token, approved, serialNumber); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert (); } } function setApprovalForAllPublic(address token, address operator, bool approved) public returns (int responseCode) { responseCode = HederaTokenService.setApprovalForAll(token, operator, approved); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(); } } function updateFungibleTokenCustomFeesPublic( address token, IHederaTokenService.FixedFee[] memory fixedFees, IHederaTokenService.FractionalFee[] memory fractionalFees ) public returns (int responseCode) { responseCode = HederaTokenService.updateFungibleTokenCustomFees(token, fixedFees, fractionalFees); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(Strings.toString(uint(responseCode))); } } function updateNonFungibleTokenCustomFeesPublic( address token, IHederaTokenService.FixedFee[] memory fixedFees, IHederaTokenService.RoyaltyFee[] memory royaltyFees ) public returns (int responseCode) { responseCode = HederaTokenService.updateNonFungibleTokenCustomFees(token, fixedFees, royaltyFees); emit ResponseCode(responseCode); if (responseCode != HederaResponseCodes.SUCCESS) { revert(Strings.toString(uint(responseCode))); } } }