feat(meta-hook): add Transfer Hook Solidity interfaces and KYCHook example#20
Open
skansal-rome wants to merge 2 commits into
Open
feat(meta-hook): add Transfer Hook Solidity interfaces and KYCHook example#20skansal-rome wants to merge 2 commits into
skansal-rome wants to merge 2 commits into
Conversation
…acts [RED] Add Solidity contracts and Hardhat tests for the Transfer Hook interface: Contracts: - ITransferHook.sol — Interface for EVM hook contracts (onTransfer) - TransferHookBase.sol — Abstract base with onlyRouter modifier - examples/KYCHook.sol — Example KYC compliance hook with allowlist Tests (16 total): - Deployment: router address, owner, zero-address rejection - Address management: approve, revoke, non-owner rejection - onTransfer approved: succeeds for KYC'd source + destination - onTransfer non-approved: reverts TransferBlocked for source/dest/both - onlyRouter modifier: rejects non-router, allows router - Edge cases: zero amount, max uint64, approve-then-revoke All 16 tests pass — contracts have real logic as leaf implementations. The RED phase applies to the integration path where DoEvmCallback and the Router program would invoke these contracts on-chain. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Deploy script derives the router EVM address from the Meta-Hook Router program ID using keccak256(program_id ++ "callback_authority")[12..], deploys KYCHook with the derived router address, and saves deployment metadata. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a632875 to
f26583c
Compare
Contributor
Author
KYCHook Deploy Script AddedAdded
Usage: META_HOOK_PROGRAM_ID=MetaHk1111111111111111111111111111111111111 \
npx hardhat run scripts/deploy_kyc_hook.ts --network local🤖 This response was generated by Claude Code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ITransferHookinterface for Solidity transfer hook contracts executed via Rome Meta-Hook RouterTransferHookBaseabstract contract withonlyRoutermodifier and helper methodsKYCHookexample compliance hook with address allowlist for KYC enforcementbytes32for Solana pubkeys,uint64for token amounts (matching SPL conventions)SPEC:
specs/SPEC-rome-meta-hook.md(Rome Meta-Hook Router)Part of: Multi-repo feature — Token-2022 Transfer Hook multiplexer with EVM bridge
Related PRs
Test plan
npx hardhat test)npx hardhat compilesucceeds (32 contracts)🤖 Generated with Claude Code