@@ -12,7 +12,7 @@ status: Approved
1212last-call-date-time : 2025-06-06T07:00:00Z
1313created : 2025-02-19
1414discussions-to : https://github.com/hiero-ledger/hiero-improvement-proposals/discussions/1172
15- updated : 2025-09-02
15+ updated : 2025-09-17
1616---
1717
1818## Abstract
@@ -22,8 +22,8 @@ In principle, hooks could be programmed in any language, but we begin with **EVM
2222writing contracts in a language like Solidity that compiles to EVM bytecode. EVM hooks may have optimized variants in
2323the future, but we propose first a full-featured ** lambda** EVM hook. The name is chosen to evoke event-driven code
2424running in the cloud or call other external services. For any given entity, its user can create many hooks for that
25- entity with different 64-bit ** hook ids** . There is no limit on the number of hook ids than an entity can use; bu
26- tits storage footprint, and hence rent, will increase proportionally.
25+ entity with different 64-bit ** hook ids** . There is no limit on the number of hook ids than an entity can use; but
26+ its storage footprint, and hence rent, will increase proportionally.
2727
2828As a first Hiero extension point, we propose ** account allowance hooks** . Users can create these hooks on their
2929accounts, and a Hiero API (HAPI) ` CryptoTransfer ` transaction can then reference an allowance hook just as it does an
@@ -819,7 +819,7 @@ message NftTransfer {
819819Note that ` NftTransfer ` supports both sender and receiver transfer allowance hooks, since the transaction may
820820need to use the receiver hook to satisfy a ` receiver_sig_required=true ` setting.
821821
822- ### The transfer allowance ABI
822+ ### The account allowance ABI
823823
824824The account allowance EVM hook ABI is as follows,
825825
@@ -923,6 +923,29 @@ interface IHieroAccountAllowancePrePostHook {
923923}
924924```
925925
926+ ### Call order of ` ACCOUNT_ALLOWANCE_HOOK ` s
927+
928+ A ` CryptoTransferTransactionBody ` can execute multiple hooks, subject only to the global limit on the number of child
929+ records for a single transaction,
930+ ```
931+ consensus.handle.maxFollowingRecords=50
932+ ```
933+ The ` CryptoTransfer ` handler will execute hook calls in the following order:
934+ 1 . All ` pre_tx_allowance_hook ` and ` pre_post_tx_allowance_hook ` calls in the HBAR ` TransferList ` , in the order they
935+ appear in the ` CryptoTransferTransactionBody ` .
936+ 2 . All ` pre_tx_allowance_hook ` and ` pre_post_tx_allowance_hook ` calls in the fungible ` transfers ` of the ` tokenTransfers `
937+ list, in the order they appear in the ` CryptoTransferTransactionBody ` .
938+ 3 . All ` pre_tx_sender_allowance_hook ` , ` pre_post_sender_tx_allowance_hook ` , ` pre_tx_receiver_allowance_hook ` , and
939+ ` pre_post_tx_receiver_allowance_hook ` calls in the non-fungible ` nftTransfers ` of the ` tokenTransfers ` list, in the
940+ order they appear in the ` CryptoTransferTransactionBody ` . (_ Note:_ if both sender and receiver hooks are present, then
941+ the sender hook is executed first.)
942+ 4 . All ` pre_post ` hooks previously executed in steps (1) to (3), _ in the same order they were previously executed_ ;
943+ while the first call will be to the ` allowPre(HookContext, ProposedTransfers) ` method signature, the second call will
944+ be to the ` allowPost(HookContext, ProposedTransfers) ` signature.
945+
946+ A block stream or legacy record stream client can use this well-known ordering to identify which child ` ContractCall `
947+ to ` 0x16d ` corresponds to which ` HookCall ` in a ` CryptoTransferTransactionBody ` .
948+
926949### Examples
927950
928951Next we provide two examples of account allowance EVM hooks.
0 commit comments