tokenRegistry bindings and deployment#767
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds TokenRegistry contract support across the TON CCIP stack by introducing new Go bindings, registering the contract type in the bindings registry, wiring TokenRegistry into CCIP deployment/state, and updating the generated TS wrapper + e2e test to reflect the updated ABI/storage layout.
Changes:
- Added Go TL-B bindings for the CCIP TokenRegistry contract and registered it in the global bindings registry.
- Extended CCIP deployment/state/config to deploy TokenRegistry and pass its address into OnRamp storage.
- Updated Tolk/TS artifacts (storage includes
id, newSetTokenInfomessage) and adjusted the e2e token transfer test to initialize TokenRegistry storage correctly.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/ccip/bindings/tokenregistry/tokenregistry.go | New Go TL-B bindings for TokenRegistry messages/storage. |
| pkg/ccip/bindings/onramp/onramp.go | Updated OnRamp storage comment around TokenRegistry field. |
| pkg/bindings/index.go | Registered TokenRegistry contract type + TLBs in bindings registry. |
| deployment/state/state.go | Added TokenRegistry to CCIPChainState and contract type list. |
| deployment/ccip/sequence/deploy_ccip.go | Deploy TokenRegistry before ramps and inject address into OnRamp storage. |
| deployment/ccip/cs_test_helpers.go | Added TokenRegistryParams to deployment test config. |
| deployment/ccip/config/deploy.go | Added TokenRegistryParams to chain deployment config + validation hook. |
| deployment/ccip/1_6_0/sequences/deploy_chain_contracts.go | Persist/extract TokenRegistry address in chain state and set default params. |
| contracts/wrappers/TokenRegistry.compile.ts | New blueprint compile config for TokenRegistry. |
| contracts/wrappers/gen/ccip/TokenRegistry.ts | Updated generated wrapper for new storage/id + SetTokenInfo message. |
| contracts/tests/ccip/e2e/CCIPSendWithTokenTransfer.spec.ts | Updated test to provide TokenRegistry storage id. |
| contracts/scripts/generateContractsPkg.ts | Added TokenRegistry to contracts package generation list. |
| contracts/contracts/ccip/token_registry/storage.tolk | Storage now includes id and store() persists it. |
| contracts/contracts/ccip/token_registry/messages.tolk | Added SetTokenInfo message and included in incoming union. |
| contracts/contracts/ccip/token_registry/contract.tolk | Added handler for SetTokenInfo; adjusted metadata/version constants. |
| contracts/contracts/ccip/onramp/storage.tolk | Comment formatting tweak around tokenRegistry field. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… vv/token-registry-bindings-and-deployment
…ddress Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
fix typo Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| struct OnRamp_TokenRegistryDeployment { | ||
| //TODO: deployableCode: cell; | ||
| // tokenRegistryCode: cell; | ||
| tokenRegistry: address; |
There was a problem hiding this comment.
Not sure why don't we immediately start using this as a sharded TR and put code here instead of a single address.
Think it's not a big pull to just replace this address with code and implement calculateTRAddr from code/token. and send it a get info message.
There was a problem hiding this comment.
Agree here. Deployment becomes simpler because OnRamp can then be configured before deploying the tokenRegistry and knowing its address
There was a problem hiding this comment.
Moved to a sharded implementation under the router, please take another look @patricios-space @krebernisak
|
|
||
| fun onSetTokenInfo(msg: TokenRegistry_SetTokenInfo, sender: address) { | ||
| //TODO access control | ||
| var st = TokenRegistry_Storage.load(); |
There was a problem hiding this comment.
We should not be able to change the minter address.
There was a problem hiding this comment.
for now this is a convenient way to set the info on the registry, I'll move to the correct interface in a follow up
| val msg = lazy CCIPSendExecutor_InMessage.fromSlice(in.body); | ||
| match (msg) { | ||
| // Sender must be this contract (called when initializing the contract) | ||
| CCIPSendExecutor_ExecuteV2 => { |
There was a problem hiding this comment.
I removed this V2 version of Execute and just updated the original type and functions. It was causing friction to iterate.
We'll change how we get the executor code so that it's inlined in the onramp in the future.
Besides that, we should think about compatibility issues between all the other contracts in an upgreade path
| var tokenRegistry: address? = null; | ||
| if (!msg.tokenAmounts.empty()) { | ||
| val tokenAmount = msg.tokenAmounts.iter().next(); // Only one tokenAmount per msg is supported | ||
| //TODO should we assert that there is only one token in the tokenAmounts? Or do we just ignore after the first one? |
There was a problem hiding this comment.
I would assert here. I'm doing that in the offramp flow
patricios-space
left a comment
There was a problem hiding this comment.
Let's get this merged and continue iterating on a follow up PR
| info: msg.tokenInfo | ||
| } | ||
| }); | ||
| setTokenInfoMsg.send(SEND_MODE_REGULAR); //TODO check send_mode |
There was a problem hiding this comment.
You can use Deployable_InitializeAndSend instead
|
|
||
| onCCIPSend(sendMsg, msg.sender, in.valueCoins); | ||
| } | ||
| Router_TokenRegistrySetTokenInfo => { |
There was a problem hiding this comment.
I agree with @krebernisak on having a separate TokenAdminRegistryManager contract here
| @@ -1,8 +1,8 @@ | |||
| import "types" | |||
|
|
|||
| struct TokenRegistry_Storage { | |||
There was a problem hiding this comment.
We should remember renaming all TokenRegistry appearances to TokenAdminRegistry
There was a problem hiding this comment.
We will need a deploy_token_registry.go sequence
There was a problem hiding this comment.
If we add a TokenAdminRegistryManager we will be deploying it in deploy_ccip.go I guess
There was a problem hiding this comment.
Yeah, when we move to a separate contract. For now we can just rely on the Router deploying the individual registers
Uh oh!
There was an error while loading. Please reload this page.