Skip to content

Add TP 2.0 CCV and fees management - #836

Open
krebernisak wants to merge 2 commits into
feat/fee-withdrawfrom
feat/tp-get-ccvs-fees
Open

Add TP 2.0 CCV and fees management#836
krebernisak wants to merge 2 commits into
feat/fee-withdrawfrom
feat/tp-get-ccvs-fees

Conversation

@krebernisak

@krebernisak krebernisak commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Token Pool 2.0: async GetCCVs / GetCCVsAndFees

TON-native replacement for EVM getRequiredCCVs + getFee

What. Adds the missing V2 CCV-management surface to the TON TokenPool, closing the headline gap in the EVM-parity. EVM exposes two sync view calls — getRequiredCCVs(...) (delegates to AdvancedPoolHooks) and getFee(...). TON can't use sync cross-contract views, so this lands a message/req-res translation.

Design (one round-trip, minimal).

  • TokenPool_GetCCVs (0xc5476d2b) → TokenPool_CCVs (CCVs only; OffRamp).
  • TokenPool_GetCCVsAndFees (0xd22944d5) → TokenPool_CCVsAndFees (CCVs and the pool-computed fee params in one reply; OnRamp). This bundles EVM's two calls into a single async round-trip.
  • Both forward a shared TokenPool_GetCCVs to async advancedPoolHooks (replyTo=pool, context echoed back); the pool reassembles the correct reply variant from TokenPool_FeeContext (nullCCVs, else CCVsAndFees).
  • Hook bounce finalizes via TokenPool_GetCCVsFailed (added TokenPool_GetCCVs to each pool's BouncedMessage with the same RichBounce handling as the other bounce paths).

Parity with TokenPool.sol. Exact port of getRequiredCCVs amount logic (outbound subtracts bps fee; inbound _calculateLocalAmount via parseRemoteDecimals(extraData)) and getFee (disabled/missing config → feesProvided=false → FeeQuoter defaults). Exposed both as on-chain messages and as a getCCVAmount GET for off-chain tooling.

Bindings & tests. Go (TON-SDK) message structs + GetCCVAmount getter + TLB registration + round-trip tests; generated TS wrappers; shared TokenPool.ccvFees.behavior.ts wired into all three concrete pools (LockRelease, BurnMint, LockReleaseLockbox) covering: empty-CCV reply + fwdPayload echo, post-fee math (enabled fee config), feesProvided=false (disabled config), revert on unsupported token/un-configured chain/disallowed finality, and the async-hooks path.

Notes. This is the pool-side mechanism only. TON V2 OnRamp/OffRamp consumers (OnRamp→GetCCVsAndFees, OffRamp→GetCCVs) intentionally land separately. Deviation from EVM: on-chain CCV queries revert for un-configured lanes/tokens (EVM's pure-view returns empty) so the async path fails loudly; off-chain tooling should probe via GET getters.

@krebernisak
krebernisak requested a review from a team as a code owner August 19, 2026 12:30
@krebernisak
krebernisak changed the base branch from main to feat/fee-withdraw August 19, 2026 12:30
@krebernisak krebernisak changed the title Feat/tp get ccvs fees Add TP 2.0 CCV and fees management Aug 19, 2026
@krebernisak
krebernisak force-pushed the feat/tp-get-ccvs-fees branch from fa5afb0 to 94657e2 Compare August 19, 2026 13:30
@duck-types
duck-types self-requested a review August 21, 2026 14:32
@nicolasgnr nicolasgnr added the Flag label Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants