Replies: 4 comments 11 replies
-
you can use the https://docs.hedera.com/hedera/sdks-and-apis/hedera-api/token-service/tokenwipeaccount |
Beta Was this translation helpful? Give feedback.
-
one potential issue with Fungible tokens will encounter a similar token association issue which again I expect to see a high degree of transfer failure due to TOKEN_NOT_ASSOCIATED_TO_ACCOUNT |
Beta Was this translation helpful? Give feedback.
-
ok, i will create an issue to add |
Beta Was this translation helpful? Give feedback.
-
@mshakeg @Ashe-Oro
It's important to note that we check the response code after every step, and if an error occurs, we revert. You can find the
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This proposal aims to extend the mint and burn functionality of Hedera Token Service (HTS) tokens to allow specifying the recipient account to which tokens are minted and the account whose tokens are to be burnt directly without having to first mint tokens to the treasury account and then transfer to the recipient or transfer tokens that are to be burnt to the treasury account before burning those tokens newly held by the treasury. This will make the minting and burning process more flexible and efficient, similar to the ERC20/721 token standards.
Motivation
Currently, the mint and burn functionality in HTS tokens involves the treasury account. The treasury account receives the initial token supply and any additional tokens that are minted. When tokens are burned, the supply is decreased from the treasury account. The
ERC20
andERC721
token standards typically have the followinginternal
mint and burn functions that allow theERC20/721
token contract to mint a fungible or non-fungible token directly to a specified account or burn a token from a specified account[1][2]:By allowing direct minting to the recipient account and direct burning from a specified account, the overall number of transactions required is reduced. This results in lower transaction fees as it avoids having to first transfer tokens to the treasury.
Specification
Extend the
mint
function:Add an optional "recipient" parameter to the
TokenMintTransaction
. When specified, the newly minted tokens will be credited directly to the recipient's account instead of the treasury account. If the "recipient" parameter is not provided, the minted tokens will be credited to the treasury account, as per the current functionality.Extend the
burn
function:Add an optional "burnFrom" parameter to the
TokenBurnTransaction
. This parameter will specify the account from which the tokens will be burnt. If the "burnFrom" parameter is not provided, the tokens will be burnt from the treasury account, as per the current functionality.The
IHederaTokenService
interface can be extended as follows to enable this functionality via the HTS precompile contract provided the calling account(i.e.msg.sender
) has the required "supplyKey" authorization to perform the mint or burn operation.Backwards Compatibility
This proposal introduces new optional
recipient
andburnFrom
parameters to the "mint" and "burn" functions respectively. Existing implementations using the current mint and burn functions will continue to work as expected. If these optional parameters are omitted it can be assumed that therecipient
andburnFrom
is effectively the treasury account as is the existing behaviour.Considerations
One of the concerns with extending the burn functionality to allow burning tokens from any account is the potential abuse of privileges associated with the
supplyKey
. Currently, thesupplyKey
has the authorization to burn tokens only from the treasury account, and granting it the ability to burn tokens from other accounts may lead to security risks.To address this concern and maintain a balance between the extended functionality and security, I propose two possibilities while preferring the latter:
Approach 1: Constraint on the
supplyKey
privilegesThe
supplyKey
should only be allowed to specify theburnFrom
account if it is the same as the key associated with the treasury account. This ensures that the extended burn functionality doesn't unintentionally grant excessive privileges to thesupplyKey
while still offering more flexibility in burning tokens. In this approach, developers are expected to limit this constraint within a smart contract where both thesupplyKey
and the treasury account belong to the contract that created the token. This allows arbitrary validation internal to the contract and, if implemented correctly, ensures that the contract does not burn tokens from an account other than the intended one.Approach 2: Require signatures from both
burnFrom
account andsupplyKey
Alternatively, to not increase any security risks on existing HTS tokens, a transaction that specifies the
burnFrom
parameter should be signed by both theburnFrom
account and thesupplyKey
. This approach ensures that the owner of theburnFrom
account consents to burning tokens from their account, adding an extra layer of security. In the case of a contract transaction, theburnFrom
parameter to theburnToken
precompile call should either betx.origin
ormsg.sender
(ortx.origin
/msg.sender
should at least have a sufficient token allowance forburnFrom
), maintaining consistency and ensuring that the transaction originator or the current contract (in case of nested calls) is the one providing consent for the burn operation.By adopting either of these approaches, the proposal maintains a balance between providing extended functionality and ensuring the security of token holders.
References
1. OpenZeppelin ERC20 Contract
2. OpenZeppelin ERC721 Contract
Beta Was this translation helpful? Give feedback.
All reactions