github.com/hashgraph/hedera-sdk-go/v2@v2.48.0/examples/precompile_example/IHederaTokenService.sol (about) 1 // SPDX-License-Identifier: Apache-2.0 2 pragma solidity >=0.4.9 <0.9.0; 3 pragma experimental ABIEncoderV2; 4 5 // This file was copied from github.com/hashgraph/hedera-smart-contracts on Sep 27 2023 6 7 interface IHederaTokenService { 8 9 /// Transfers cryptocurrency among two or more accounts by making the desired adjustments to their 10 /// balances. Each transfer list can specify up to 10 adjustments. Each negative amount is withdrawn 11 /// from the corresponding account (a sender), and each positive one is added to the corresponding 12 /// account (a receiver). The amounts list must sum to zero. Each amount is a number of tinybars 13 /// (there are 100,000,000 tinybars in one hbar). If any sender account fails to have sufficient 14 /// hbars, then the entire transaction fails, and none of those transfers occur, though the 15 /// transaction fee is still charged. This transaction must be signed by the keys for all the sending 16 /// accounts, and for any receiving accounts that have receiverSigRequired == true. The signatures 17 /// are in the same order as the accounts, skipping those accounts that don't need a signature. 18 /// @custom:version 0.3.0 previous version did not include isApproval 19 struct AccountAmount { 20 // The Account ID, as a solidity address, that sends/receives cryptocurrency or tokens 21 address accountID; 22 23 // The amount of the lowest denomination of the given token that 24 // the account sends(negative) or receives(positive) 25 int64 amount; 26 27 // If true then the transfer is expected to be an approved allowance and the 28 // accountID is expected to be the owner. The default is false (omitted). 29 bool isApproval; 30 } 31 32 /// A sender account, a receiver account, and the serial number of an NFT of a Token with 33 /// NON_FUNGIBLE_UNIQUE type. When minting NFTs the sender will be the default AccountID instance 34 /// (0.0.0 aka 0x0) and when burning NFTs, the receiver will be the default AccountID instance. 35 /// @custom:version 0.3.0 previous version did not include isApproval 36 struct NftTransfer { 37 // The solidity address of the sender 38 address senderAccountID; 39 40 // The solidity address of the receiver 41 address receiverAccountID; 42 43 // The serial number of the NFT 44 int64 serialNumber; 45 46 // If true then the transfer is expected to be an approved allowance and the 47 // accountID is expected to be the owner. The default is false (omitted). 48 bool isApproval; 49 } 50 51 struct TokenTransferList { 52 // The ID of the token as a solidity address 53 address token; 54 55 // Applicable to tokens of type FUNGIBLE_COMMON. Multiple list of AccountAmounts, each of which 56 // has an account and amount. 57 AccountAmount[] transfers; 58 59 // Applicable to tokens of type NON_FUNGIBLE_UNIQUE. Multiple list of NftTransfers, each of 60 // which has a sender and receiver account, including the serial number of the NFT 61 NftTransfer[] nftTransfers; 62 } 63 64 struct TransferList { 65 // Multiple list of AccountAmounts, each of which has an account and amount. 66 // Used to transfer hbars between the accounts in the list. 67 AccountAmount[] transfers; 68 } 69 70 /// Expiry properties of a Hedera token - second, autoRenewAccount, autoRenewPeriod 71 struct Expiry { 72 // The epoch second at which the token should expire; if an auto-renew account and period are 73 // specified, this is coerced to the current epoch second plus the autoRenewPeriod 74 int64 second; 75 76 // ID of an account which will be automatically charged to renew the token's expiration, at 77 // autoRenewPeriod interval, expressed as a solidity address 78 address autoRenewAccount; 79 80 // The interval at which the auto-renew account will be charged to extend the token's expiry 81 int64 autoRenewPeriod; 82 } 83 84 /// A Key can be a public key from either the Ed25519 or ECDSA(secp256k1) signature schemes, where 85 /// in the ECDSA(secp256k1) case we require the 33-byte compressed form of the public key. We call 86 /// these public keys <b>primitive keys</b>. 87 /// A Key can also be the ID of a smart contract instance, which is then authorized to perform any 88 /// precompiled contract action that requires this key to sign. 89 /// Note that when a Key is a smart contract ID, it <i>doesn't</i> mean the contract with that ID 90 /// will actually create a cryptographic signature. It only means that when the contract calls a 91 /// precompiled contract, the resulting "child transaction" will be authorized to perform any action 92 /// controlled by the Key. 93 /// Exactly one of the possible values should be populated in order for the Key to be valid. 94 struct KeyValue { 95 96 // if set to true, the key of the calling Hedera account will be inherited as the token key 97 bool inheritAccountKey; 98 99 // smart contract instance that is authorized as if it had signed with a key 100 address contractId; 101 102 // Ed25519 public key bytes 103 bytes ed25519; 104 105 // Compressed ECDSA(secp256k1) public key bytes 106 bytes ECDSA_secp256k1; 107 108 // A smart contract that, if the recipient of the active message frame, should be treated 109 // as having signed. (Note this does not mean the <i>code being executed in the frame</i> 110 // will belong to the given contract, since it could be running another contract's code via 111 // <tt>delegatecall</tt>. So setting this key is a more permissive version of setting the 112 // contractID key, which also requires the code in the active message frame belong to the 113 // the contract with the given id.) 114 address delegatableContractId; 115 } 116 117 /// A list of token key types the key should be applied to and the value of the key 118 struct TokenKey { 119 120 // bit field representing the key type. Keys of all types that have corresponding bits set to 1 121 // will be created for the token. 122 // 0th bit: adminKey 123 // 1st bit: kycKey 124 // 2nd bit: freezeKey 125 // 3rd bit: wipeKey 126 // 4th bit: supplyKey 127 // 5th bit: feeScheduleKey 128 // 6th bit: pauseKey 129 // 7th bit: ignored 130 uint keyType; 131 132 // the value that will be set to the key type 133 KeyValue key; 134 } 135 136 /// Basic properties of a Hedera Token - name, symbol, memo, tokenSupplyType, maxSupply, 137 /// treasury, freezeDefault. These properties are related both to Fungible and NFT token types. 138 struct HederaToken { 139 // The publicly visible name of the token. The token name is specified as a Unicode string. 140 // Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). 141 string name; 142 143 // The publicly visible token symbol. The token symbol is specified as a Unicode string. 144 // Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). 145 string symbol; 146 147 // The ID of the account which will act as a treasury for the token as a solidity address. 148 // This account will receive the specified initial supply or the newly minted NFTs in 149 // the case for NON_FUNGIBLE_UNIQUE Type 150 address treasury; 151 152 // The memo associated with the token (UTF-8 encoding max 100 bytes) 153 string memo; 154 155 // IWA compatibility. Specified the token supply type. Defaults to INFINITE 156 bool tokenSupplyType; 157 158 // IWA Compatibility. Depends on TokenSupplyType. For tokens of type FUNGIBLE_COMMON - the 159 // maximum number of tokens that can be in circulation. For tokens of type NON_FUNGIBLE_UNIQUE - 160 // the maximum number of NFTs (serial numbers) that can be minted. This field can never be changed! 161 int64 maxSupply; 162 163 // The default Freeze status (frozen or unfrozen) of Hedera accounts relative to this token. If 164 // true, an account must be unfrozen before it can receive the token 165 bool freezeDefault; 166 167 // list of keys to set to the token 168 TokenKey[] tokenKeys; 169 170 // expiry properties of a Hedera token - second, autoRenewAccount, autoRenewPeriod 171 Expiry expiry; 172 } 173 174 /// Additional post creation fungible and non fungible properties of a Hedera Token. 175 struct TokenInfo { 176 /// Basic properties of a Hedera Token 177 HederaToken token; 178 179 /// The number of tokens (fungible) or serials (non-fungible) of the token 180 int64 totalSupply; 181 182 /// Specifies whether the token is deleted or not 183 bool deleted; 184 185 /// Specifies whether the token kyc was defaulted with KycNotApplicable (true) or Revoked (false) 186 bool defaultKycStatus; 187 188 /// Specifies whether the token is currently paused or not 189 bool pauseStatus; 190 191 /// The fixed fees collected when transferring the token 192 FixedFee[] fixedFees; 193 194 /// The fractional fees collected when transferring the token 195 FractionalFee[] fractionalFees; 196 197 /// The royalty fees collected when transferring the token 198 RoyaltyFee[] royaltyFees; 199 200 /// The ID of the network ledger 201 string ledgerId; 202 } 203 204 /// Additional fungible properties of a Hedera Token. 205 struct FungibleTokenInfo { 206 /// The shared hedera token info 207 TokenInfo tokenInfo; 208 209 /// The number of decimal places a token is divisible by 210 int32 decimals; 211 } 212 213 /// Additional non fungible properties of a Hedera Token. 214 struct NonFungibleTokenInfo { 215 /// The shared hedera token info 216 TokenInfo tokenInfo; 217 218 /// The serial number of the nft 219 int64 serialNumber; 220 221 /// The account id specifying the owner of the non fungible token 222 address ownerId; 223 224 /// The epoch second at which the token was created. 225 int64 creationTime; 226 227 /// The unique metadata of the NFT 228 bytes metadata; 229 230 /// The account id specifying an account that has been granted spending permissions on this nft 231 address spenderId; 232 } 233 234 /// A fixed number of units (hbar or token) to assess as a fee during a transfer of 235 /// units of the token to which this fixed fee is attached. The denomination of 236 /// the fee depends on the values of tokenId, useHbarsForPayment and 237 /// useCurrentTokenForPayment. Exactly one of the values should be set. 238 struct FixedFee { 239 240 int64 amount; 241 242 // Specifies ID of token that should be used for fixed fee denomination 243 address tokenId; 244 245 // Specifies this fixed fee should be denominated in Hbar 246 bool useHbarsForPayment; 247 248 // Specifies this fixed fee should be denominated in the Token currently being created 249 bool useCurrentTokenForPayment; 250 251 // The ID of the account to receive the custom fee, expressed as a solidity address 252 address feeCollector; 253 } 254 255 /// A fraction of the transferred units of a token to assess as a fee. The amount assessed will never 256 /// be less than the given minimumAmount, and never greater than the given maximumAmount. The 257 /// denomination is always units of the token to which this fractional fee is attached. 258 struct FractionalFee { 259 // A rational number's numerator, used to set the amount of a value transfer to collect as a custom fee 260 int64 numerator; 261 262 // A rational number's denominator, used to set the amount of a value transfer to collect as a custom fee 263 int64 denominator; 264 265 // The minimum amount to assess 266 int64 minimumAmount; 267 268 // The maximum amount to assess (zero implies no maximum) 269 int64 maximumAmount; 270 bool netOfTransfers; 271 272 // The ID of the account to receive the custom fee, expressed as a solidity address 273 address feeCollector; 274 } 275 276 /// A fee to assess during a transfer that changes ownership of an NFT. Defines the fraction of 277 /// the fungible value exchanged for an NFT that the ledger should collect as a royalty. ("Fungible 278 /// value" includes both ℏ and units of fungible HTS tokens.) When the NFT sender does not receive 279 /// any fungible value, the ledger will assess the fallback fee, if present, to the new NFT owner. 280 /// Royalty fees can only be added to tokens of type type NON_FUNGIBLE_UNIQUE. 281 struct RoyaltyFee { 282 // A fraction's numerator of fungible value exchanged for an NFT to collect as royalty 283 int64 numerator; 284 285 // A fraction's denominator of fungible value exchanged for an NFT to collect as royalty 286 int64 denominator; 287 288 // If present, the fee to assess to the NFT receiver when no fungible value 289 // is exchanged with the sender. Consists of: 290 // amount: the amount to charge for the fee 291 // tokenId: Specifies ID of token that should be used for fixed fee denomination 292 // useHbarsForPayment: Specifies this fee should be denominated in Hbar 293 int64 amount; 294 address tokenId; 295 bool useHbarsForPayment; 296 297 // The ID of the account to receive the custom fee, expressed as a solidity address 298 address feeCollector; 299 } 300 301 /********************** 302 * Direct HTS Calls * 303 **********************/ 304 305 /// Performs transfers among combinations of tokens and hbars 306 /// @param transferList the list of hbar transfers to do 307 /// @param tokenTransfers the list of token transfers to do 308 /// @custom:version 0.3.0 the signature of the previous version was cryptoTransfer(TokenTransferList[] memory tokenTransfers) 309 function cryptoTransfer(TransferList memory transferList, TokenTransferList[] memory tokenTransfers) 310 external 311 returns (int64 responseCode); 312 313 /// Mints an amount of the token to the defined treasury account 314 /// @param token The token for which to mint tokens. If token does not exist, transaction results in 315 /// INVALID_TOKEN_ID 316 /// @param amount Applicable to tokens of type FUNGIBLE_COMMON. The amount to mint to the Treasury Account. 317 /// Amount must be a positive non-zero number represented in the lowest denomination of the 318 /// token. The new supply must be lower than 2^63. 319 /// @param metadata Applicable to tokens of type NON_FUNGIBLE_UNIQUE. A list of metadata that are being created. 320 /// Maximum allowed size of each metadata is 100 bytes 321 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 322 /// @return newTotalSupply The new supply of tokens. For NFTs it is the total count of NFTs 323 /// @return serialNumbers If the token is an NFT the newly generate serial numbers, othersise empty. 324 function mintToken( 325 address token, 326 int64 amount, 327 bytes[] memory metadata 328 ) 329 external 330 returns ( 331 int64 responseCode, 332 int64 newTotalSupply, 333 int64[] memory serialNumbers 334 ); 335 336 /// Burns an amount of the token from the defined treasury account 337 /// @param token The token for which to burn tokens. If token does not exist, transaction results in 338 /// INVALID_TOKEN_ID 339 /// @param amount Applicable to tokens of type FUNGIBLE_COMMON. The amount to burn from the Treasury Account. 340 /// Amount must be a positive non-zero number, not bigger than the token balance of the treasury 341 /// account (0; balance], represented in the lowest denomination. 342 /// @param serialNumbers Applicable to tokens of type NON_FUNGIBLE_UNIQUE. The list of serial numbers to be burned. 343 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 344 /// @return newTotalSupply The new supply of tokens. For NFTs it is the total count of NFTs 345 function burnToken( 346 address token, 347 int64 amount, 348 int64[] memory serialNumbers 349 ) external returns (int64 responseCode, int64 newTotalSupply); 350 351 /// Associates the provided account with the provided tokens. Must be signed by the provided 352 /// Account's key or called from the accounts contract key 353 /// If the provided account is not found, the transaction will resolve to INVALID_ACCOUNT_ID. 354 /// If the provided account has been deleted, the transaction will resolve to ACCOUNT_DELETED. 355 /// If any of the provided tokens is not found, the transaction will resolve to INVALID_TOKEN_REF. 356 /// If any of the provided tokens has been deleted, the transaction will resolve to TOKEN_WAS_DELETED. 357 /// If an association between the provided account and any of the tokens already exists, the 358 /// transaction will resolve to TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT. 359 /// If the provided account's associations count exceed the constraint of maximum token associations 360 /// per account, the transaction will resolve to TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED. 361 /// On success, associations between the provided account and tokens are made and the account is 362 /// ready to interact with the tokens. 363 /// @param account The account to be associated with the provided tokens 364 /// @param tokens The tokens to be associated with the provided account. In the case of NON_FUNGIBLE_UNIQUE 365 /// Type, once an account is associated, it can hold any number of NFTs (serial numbers) of that 366 /// token type 367 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 368 function associateTokens(address account, address[] memory tokens) 369 external 370 returns (int64 responseCode); 371 372 /// Single-token variant of associateTokens. Will be mapped to a single entry array call of associateTokens 373 /// @param account The account to be associated with the provided token 374 /// @param token The token to be associated with the provided account 375 function associateToken(address account, address token) 376 external 377 returns (int64 responseCode); 378 379 /// Dissociates the provided account with the provided tokens. Must be signed by the provided 380 /// Account's key. 381 /// If the provided account is not found, the transaction will resolve to INVALID_ACCOUNT_ID. 382 /// If the provided account has been deleted, the transaction will resolve to ACCOUNT_DELETED. 383 /// If any of the provided tokens is not found, the transaction will resolve to INVALID_TOKEN_REF. 384 /// If any of the provided tokens has been deleted, the transaction will resolve to TOKEN_WAS_DELETED. 385 /// If an association between the provided account and any of the tokens does not exist, the 386 /// transaction will resolve to TOKEN_NOT_ASSOCIATED_TO_ACCOUNT. 387 /// If a token has not been deleted and has not expired, and the user has a nonzero balance, the 388 /// transaction will resolve to TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES. 389 /// If a <b>fungible token</b> has expired, the user can disassociate even if their token balance is 390 /// not zero. 391 /// If a <b>non fungible token</b> has expired, the user can <b>not</b> disassociate if their token 392 /// balance is not zero. The transaction will resolve to TRANSACTION_REQUIRED_ZERO_TOKEN_BALANCES. 393 /// On success, associations between the provided account and tokens are removed. 394 /// @param account The account to be dissociated from the provided tokens 395 /// @param tokens The tokens to be dissociated from the provided account. 396 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 397 function dissociateTokens(address account, address[] memory tokens) 398 external 399 returns (int64 responseCode); 400 401 /// Single-token variant of dissociateTokens. Will be mapped to a single entry array call of dissociateTokens 402 /// @param account The account to be associated with the provided token 403 /// @param token The token to be associated with the provided account 404 function dissociateToken(address account, address token) 405 external 406 returns (int64 responseCode); 407 408 /// Creates a Fungible Token with the specified properties 409 /// @param token the basic properties of the token being created 410 /// @param initialTotalSupply Specifies the initial supply of tokens to be put in circulation. The 411 /// initial supply is sent to the Treasury Account. The supply is in the lowest denomination possible. 412 /// @param decimals the number of decimal places a token is divisible by 413 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 414 /// @return tokenAddress the created token's address 415 function createFungibleToken( 416 HederaToken memory token, 417 int64 initialTotalSupply, 418 int32 decimals 419 ) external payable returns (int64 responseCode, address tokenAddress); 420 421 /// Creates a Fungible Token with the specified properties 422 /// @param token the basic properties of the token being created 423 /// @param initialTotalSupply Specifies the initial supply of tokens to be put in circulation. The 424 /// initial supply is sent to the Treasury Account. The supply is in the lowest denomination possible. 425 /// @param decimals the number of decimal places a token is divisible by. 426 /// @param fixedFees list of fixed fees to apply to the token 427 /// @param fractionalFees list of fractional fees to apply to the token 428 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 429 /// @return tokenAddress the created token's address 430 function createFungibleTokenWithCustomFees( 431 HederaToken memory token, 432 int64 initialTotalSupply, 433 int32 decimals, 434 FixedFee[] memory fixedFees, 435 FractionalFee[] memory fractionalFees 436 ) external payable returns (int64 responseCode, address tokenAddress); 437 438 /// Creates an Non Fungible Unique Token with the specified properties 439 /// @param token the basic properties of the token being created 440 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 441 /// @return tokenAddress the created token's address 442 function createNonFungibleToken(HederaToken memory token) 443 external 444 payable 445 returns (int64 responseCode, address tokenAddress); 446 447 /// Creates an Non Fungible Unique Token with the specified properties 448 /// @param token the basic properties of the token being created 449 /// @param fixedFees list of fixed fees to apply to the token 450 /// @param royaltyFees list of royalty fees to apply to the token 451 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 452 /// @return tokenAddress the created token's address 453 function createNonFungibleTokenWithCustomFees( 454 HederaToken memory token, 455 FixedFee[] memory fixedFees, 456 RoyaltyFee[] memory royaltyFees 457 ) external payable returns (int64 responseCode, address tokenAddress); 458 459 /********************** 460 * ABIV1 calls * 461 **********************/ 462 463 /// Initiates a Fungible Token Transfer 464 /// @param token The ID of the token as a solidity address 465 /// @param accountId account to do a transfer to/from 466 /// @param amount The amount from the accountId at the same index 467 function transferTokens( 468 address token, 469 address[] memory accountId, 470 int64[] memory amount 471 ) external returns (int64 responseCode); 472 473 /// Initiates a Non-Fungable Token Transfer 474 /// @param token The ID of the token as a solidity address 475 /// @param sender the sender of an nft 476 /// @param receiver the receiver of the nft sent by the same index at sender 477 /// @param serialNumber the serial number of the nft sent by the same index at sender 478 function transferNFTs( 479 address token, 480 address[] memory sender, 481 address[] memory receiver, 482 int64[] memory serialNumber 483 ) external returns (int64 responseCode); 484 485 /// Transfers tokens where the calling account/contract is implicitly the first entry in the token transfer list, 486 /// where the amount is the value needed to zero balance the transfers. Regular signing rules apply for sending 487 /// (positive amount) or receiving (negative amount) 488 /// @param token The token to transfer to/from 489 /// @param sender The sender for the transaction 490 /// @param recipient The receiver of the transaction 491 /// @param amount Non-negative value to send. a negative value will result in a failure. 492 function transferToken( 493 address token, 494 address sender, 495 address recipient, 496 int64 amount 497 ) external returns (int64 responseCode); 498 499 /// Transfers tokens where the calling account/contract is implicitly the first entry in the token transfer list, 500 /// where the amount is the value needed to zero balance the transfers. Regular signing rules apply for sending 501 /// (positive amount) or receiving (negative amount) 502 /// @param token The token to transfer to/from 503 /// @param sender The sender for the transaction 504 /// @param recipient The receiver of the transaction 505 /// @param serialNumber The serial number of the NFT to transfer. 506 function transferNFT( 507 address token, 508 address sender, 509 address recipient, 510 int64 serialNumber 511 ) external returns (int64 responseCode); 512 513 /// Allows spender to withdraw from your account multiple times, up to the value amount. If this function is called 514 /// again it overwrites the current allowance with value. 515 /// Only Applicable to Fungible Tokens 516 /// @param token The hedera token address to approve 517 /// @param spender the account address authorized to spend 518 /// @param amount the amount of tokens authorized to spend. 519 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 520 function approve( 521 address token, 522 address spender, 523 uint256 amount 524 ) external returns (int64 responseCode); 525 526 /// Transfers `amount` tokens from `from` to `to` using the 527 // allowance mechanism. `amount` is then deducted from the caller's allowance. 528 /// Only applicable to fungible tokens 529 /// @param token The address of the fungible Hedera token to transfer 530 /// @param from The account address of the owner of the token, on the behalf of which to transfer `amount` tokens 531 /// @param to The account address of the receiver of the `amount` tokens 532 /// @param amount The amount of tokens to transfer from `from` to `to` 533 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 534 function transferFrom(address token, address from, address to, uint256 amount) external returns (int64 responseCode); 535 536 /// Returns the amount which spender is still allowed to withdraw from owner. 537 /// Only Applicable to Fungible Tokens 538 /// @param token The Hedera token address to check the allowance of 539 /// @param owner the owner of the tokens to be spent 540 /// @param spender the spender of the tokens 541 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 542 /// @return allowance The amount which spender is still allowed to withdraw from owner. 543 function allowance( 544 address token, 545 address owner, 546 address spender 547 ) external returns (int64 responseCode, uint256 allowance); 548 549 /// Allow or reaffirm the approved address to transfer an NFT the approved address does not own. 550 /// Only Applicable to NFT Tokens 551 /// @param token The Hedera NFT token address to approve 552 /// @param approved The new approved NFT controller. To revoke approvals pass in the zero address. 553 /// @param serialNumber The NFT serial number to approve 554 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 555 function approveNFT( 556 address token, 557 address approved, 558 uint256 serialNumber 559 ) external returns (int64 responseCode); 560 561 /// Transfers `serialNumber` of `token` from `from` to `to` using the allowance mechanism. 562 /// Only applicable to NFT tokens 563 /// @param token The address of the non-fungible Hedera token to transfer 564 /// @param from The account address of the owner of `serialNumber` of `token` 565 /// @param to The account address of the receiver of `serialNumber` 566 /// @param serialNumber The NFT serial number to transfer 567 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 568 function transferFromNFT(address token, address from, address to, uint256 serialNumber) external returns (int64 responseCode); 569 570 /// Get the approved address for a single NFT 571 /// Only Applicable to NFT Tokens 572 /// @param token The Hedera NFT token address to check approval 573 /// @param serialNumber The NFT to find the approved address for 574 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 575 /// @return approved The approved address for this NFT, or the zero address if there is none 576 function getApproved(address token, uint256 serialNumber) 577 external 578 returns (int64 responseCode, address approved); 579 580 /// Enable or disable approval for a third party ("operator") to manage 581 /// all of `msg.sender`'s assets 582 /// @param token The Hedera NFT token address to approve 583 /// @param operator Address to add to the set of authorized operators 584 /// @param approved True if the operator is approved, false to revoke approval 585 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 586 function setApprovalForAll( 587 address token, 588 address operator, 589 bool approved 590 ) external returns (int64 responseCode); 591 592 /// Query if an address is an authorized operator for another address 593 /// Only Applicable to NFT Tokens 594 /// @param token The Hedera NFT token address to approve 595 /// @param owner The address that owns the NFTs 596 /// @param operator The address that acts on behalf of the owner 597 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 598 /// @return approved True if `operator` is an approved operator for `owner`, false otherwise 599 function isApprovedForAll( 600 address token, 601 address owner, 602 address operator 603 ) external returns (int64 responseCode, bool approved); 604 605 /// Query if token account is frozen 606 /// @param token The token address to check 607 /// @param account The account address associated with the token 608 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 609 /// @return frozen True if `account` is frozen for `token` 610 function isFrozen(address token, address account) 611 external 612 returns (int64 responseCode, bool frozen); 613 614 /// Query if token account has kyc granted 615 /// @param token The token address to check 616 /// @param account The account address associated with the token 617 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 618 /// @return kycGranted True if `account` has kyc granted for `token` 619 function isKyc(address token, address account) 620 external 621 returns (int64 responseCode, bool kycGranted); 622 623 /// Operation to delete token 624 /// @param token The token address to be deleted 625 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 626 function deleteToken(address token) external returns (int64 responseCode); 627 628 /// Query token custom fees 629 /// @param token The token address to check 630 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 631 /// @return fixedFees Set of fixed fees for `token` 632 /// @return fractionalFees Set of fractional fees for `token` 633 /// @return royaltyFees Set of royalty fees for `token` 634 function getTokenCustomFees(address token) 635 external 636 returns (int64 responseCode, FixedFee[] memory fixedFees, FractionalFee[] memory fractionalFees, RoyaltyFee[] memory royaltyFees); 637 638 /// Query token default freeze status 639 /// @param token The token address to check 640 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 641 /// @return defaultFreezeStatus True if `token` default freeze status is frozen. 642 function getTokenDefaultFreezeStatus(address token) 643 external 644 returns (int64 responseCode, bool defaultFreezeStatus); 645 646 /// Query token default kyc status 647 /// @param token The token address to check 648 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 649 /// @return defaultKycStatus True if `token` default kyc status is KycNotApplicable and false if Revoked. 650 function getTokenDefaultKycStatus(address token) 651 external 652 returns (int64 responseCode, bool defaultKycStatus); 653 654 /// Query token expiry info 655 /// @param token The token address to check 656 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 657 /// @return expiry Expiry info for `token` 658 function getTokenExpiryInfo(address token) 659 external 660 returns (int64 responseCode, Expiry memory expiry); 661 662 /// Query fungible token info 663 /// @param token The token address to check 664 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 665 /// @return fungibleTokenInfo FungibleTokenInfo info for `token` 666 function getFungibleTokenInfo(address token) 667 external 668 returns (int64 responseCode, FungibleTokenInfo memory fungibleTokenInfo); 669 670 /// Query token info 671 /// @param token The token address to check 672 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 673 /// @return tokenInfo TokenInfo info for `token` 674 function getTokenInfo(address token) 675 external 676 returns (int64 responseCode, TokenInfo memory tokenInfo); 677 678 /// Query token KeyValue 679 /// @param token The token address to check 680 /// @param keyType The keyType of the desired KeyValue 681 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 682 /// @return key KeyValue info for key of type `keyType` 683 function getTokenKey(address token, uint keyType) 684 external 685 returns (int64 responseCode, KeyValue memory key); 686 687 /// Query non fungible token info 688 /// @param token The token address to check 689 /// @param serialNumber The NFT serialNumber to check 690 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 691 /// @return nonFungibleTokenInfo NonFungibleTokenInfo info for `token` `serialNumber` 692 function getNonFungibleTokenInfo(address token, int64 serialNumber) 693 external 694 returns (int64 responseCode, NonFungibleTokenInfo memory nonFungibleTokenInfo); 695 696 /// Operation to freeze token account 697 /// @param token The token address 698 /// @param account The account address to be frozen 699 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 700 function freezeToken(address token, address account) 701 external 702 returns (int64 responseCode); 703 704 /// Operation to unfreeze token account 705 /// @param token The token address 706 /// @param account The account address to be unfrozen 707 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 708 function unfreezeToken(address token, address account) 709 external 710 returns (int64 responseCode); 711 712 /// Operation to grant kyc to token account 713 /// @param token The token address 714 /// @param account The account address to grant kyc 715 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 716 function grantTokenKyc(address token, address account) 717 external 718 returns (int64 responseCode); 719 720 /// Operation to revoke kyc to token account 721 /// @param token The token address 722 /// @param account The account address to revoke kyc 723 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 724 function revokeTokenKyc(address token, address account) 725 external 726 returns (int64 responseCode); 727 728 /// Operation to pause token 729 /// @param token The token address to be paused 730 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 731 function pauseToken(address token) external returns (int64 responseCode); 732 733 /// Operation to unpause token 734 /// @param token The token address to be unpaused 735 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 736 function unpauseToken(address token) external returns (int64 responseCode); 737 738 /// Operation to wipe fungible tokens from account 739 /// @param token The token address 740 /// @param account The account address to revoke kyc 741 /// @param amount The number of tokens to wipe 742 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 743 function wipeTokenAccount( 744 address token, 745 address account, 746 int64 amount 747 ) external returns (int64 responseCode); 748 749 /// Operation to wipe non fungible tokens from account 750 /// @param token The token address 751 /// @param account The account address to revoke kyc 752 /// @param serialNumbers The serial numbers of token to wipe 753 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 754 function wipeTokenAccountNFT( 755 address token, 756 address account, 757 int64[] memory serialNumbers 758 ) external returns (int64 responseCode); 759 760 /// Operation to update token info 761 /// @param token The token address 762 /// @param tokenInfo The hedera token info to update token with 763 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 764 function updateTokenInfo(address token, HederaToken memory tokenInfo) 765 external 766 returns (int64 responseCode); 767 768 /// Operation to update token expiry info 769 /// @param token The token address 770 /// @param expiryInfo The hedera token expiry info 771 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 772 function updateTokenExpiryInfo(address token, Expiry memory expiryInfo) 773 external 774 returns (int64 responseCode); 775 776 /// Operation to update token expiry info 777 /// @param token The token address 778 /// @param keys The token keys 779 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 780 function updateTokenKeys(address token, TokenKey[] memory keys) 781 external 782 returns (int64 responseCode); 783 784 /// Query if valid token found for the given address 785 /// @param token The token address 786 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 787 /// @return isToken True if valid token found for the given address 788 function isToken(address token) 789 external returns 790 (int64 responseCode, bool isToken); 791 792 /// Query to return the token type for a given address 793 /// @param token The token address 794 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 795 /// @return tokenType the token type. 0 is FUNGIBLE_COMMON, 1 is NON_FUNGIBLE_UNIQUE, -1 is UNRECOGNIZED 796 function getTokenType(address token) 797 external returns 798 (int64 responseCode, int32 tokenType); 799 800 /// Initiates a Redirect For Token 801 /// @param token The token address 802 /// @param encodedFunctionSelector The function selector from the ERC20 interface + the bytes input for the function called 803 /// @return responseCode The response code for the status of the request. SUCCESS is 22. 804 /// @return response The result of the call that had been encoded and sent for execution. 805 function redirectForToken(address token, bytes memory encodedFunctionSelector) external returns (int64 responseCode, bytes memory response); 806 }