Replies: 5 comments 12 replies
-
Question:
|
Beta Was this translation helpful? Give feedback.
-
Thanks @mshakeg. Need to read over it one or two more times to get a clear understanding but to help could you please clarify the following
Also can you elaborate on the below. It's unclear to me how and when this testing is occurring. Is it at deployment time or ahead?
|
Beta Was this translation helpful? Give feedback.
-
I find this discussion quite interesting, and I would like to learn more about the integration process. Could you provide a flow diagram of how this integration would work with our existing services? Additionally, you mentioned potential throughput reduction for HTS tokens that specify an HERC20 contract that implements modifiers, but the HTS is capable of 10k TPS. Can you explain how we could maintain this high throughput while integrating smart contracts with the HTS? |
Beta Was this translation helpful? Give feedback.
-
Lots of error handling questions:
Also, I think the design can be simplified. For the contract it has only one function On the hedera side perhaps we register handler addresses per functionality, so every operation doesn't have to go through the EVM. there would be a quick null check and if not null a check against registered function types (with various tricks based on size). |
Beta Was this translation helpful? Give feedback.
-
Specifically, what's the mechanism? Based on what I know about EVM there is no way to guarantee this. EIC-820 is collaborative at best and throw in proxy/upgradable contracts in the mix and the introspection becomes worse. We can do a best effort but there will always be ways the contracts become or start off as irreparably broken and can pass whatever first-pass check we do. So the process needs to keep this in mind. Specifically if a contract is set for an action only a ABI encoded SUCCESS result will be required, and any other result is rejectec, this makes it anti-fragile to these setup failures.
We need to be resilient to these presumptions handling. Error cases may arise where there is not a one-to-one relationship between HTS and HERC. (a) bugs will happen and (b) it's an inefficient model. Supporting a many-to-many model will result in cost savings for users. Consider a "bankers hours" approval contract. Not only do they need to handle the hours of the day, they may need to alter holidays for things like the death of a Monarch or their coronation (a bank holiday that is not predictable), or hours may need to be adjusted for daylight savings time. Having to update every single bankers hours contract is (a) expensive and (b) presents multiple points of failure, what if one gets missed and allows transactions that were not permitted per regulatory closings?
I'm thinking pre-modifier, but would be open to adding post with a good use case. We could write in that the side effects of a success validation will only commit if the approved functionality commits, so you would do your post implicitly. And we could guarantee all rejects will commit their side effects. But it gets complicated if we allow multiple hooks per functionality, which is a strong argument for only one hook per functionality, and the users can aggregate in their own deployed contract. So one to many, one contract can service may hooks but each hedera object+functionality has only one hook. |
Beta Was this translation helpful? Give feedback.
-
Introduction
This discussion aims to propose an integration of the Hedera Token Service (HTS) with the Hedera Smart Contract Service (HSCS) to allow for arbitrary programmability of HTS tokens. This integration will allow developers to build unique functionality into their HTS tokens that can be triggered before and after various native HTS actions on tokens such as transfers, mints, burns, etc.
Problem Statement
Currently, HTS tokens are limited in their programmability as they only allow for certain constraints to be configured and managed, such as freezing/unfreezing accounts, granting/revoking KYC, and token fees. This limits the potential use cases for HTS tokens and prevents developers from building applications that require custom programmability on the Hedera network. By integrating the HTS with the HSCS, developers will be able to build custom functionality into their HTS tokens, expanding the potential use cases for HTS and the Hedera network as a whole.
Proposed Solution
The proposed solution is to add a new solidity interface called
IHERC20
that will allow developers to define custom pre and post modifier functions for their HTS tokens. These modifier functions can be triggered before and after various actions on a given token, such as transfers, mints, burns, etc provided the token has a setHERC20
contract that implements theIHERC20
interface. The modifier functions will receive anactionCode
that indicates the type of action that triggered the function(e.g. transfer, mint, burn) and a second parameteractionParams
that encodes information about the action, such as the account that initiated the action, the amount transferred, minted, or burned, etc.A developer can implement a contract that inherits the
IHERC20
interface and must implement at least one function either thepreModifier
orpostModifier
, they can then deploy the contract and when creating or updating an HTS token can set/overwrite that token'sHERC20
contractId.When a token's
HERC20
contractId is set or updated thepreModifier
andpostModifier
functions on theHERC20
should be pre-tested for validation on the interface in addition to confirming what actions theHERC20
contract's modifers support to prevent unnecessary execution for actions that are not supported, this can be done by defining a range of actionCodes for the initial test. For example ifactionCode
255
is for testing support on transfers andactionCode
1
is the corresponding actualactionCode
for transfers. If{pre|post}Modifier(255, ...)
returnstrue
in the pre-test then{pre|post}Modifier()
should be executed accordingly on any transfer i.e.actionCode
1
.Benefits
Drawbacks
HERC20
contract that implements modifiers at least for actions that require{pre|post}Modifier
execution.Conclusion
The proposed integration of the HTS with the HSCS to allow for arbitrary programmability of HTS tokens has the potential to greatly expand the use cases for HTS tokens and the Hedera network as a whole.
Beta Was this translation helpful? Give feedback.
All reactions