Skip to content

tokenRegistry bindings and deployment#767

Merged
vicentevieytes merged 30 commits into
mainfrom
vv/token-registry-bindings-and-deployment
Jul 1, 2026
Merged

tokenRegistry bindings and deployment#767
vicentevieytes merged 30 commits into
mainfrom
vv/token-registry-bindings-and-deployment

Conversation

@vicentevieytes

@vicentevieytes vicentevieytes commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator
  • Adds a setter to the minimal TokenRegistry to be able to set TokenInfo
  • Modifies OnRamp dynamic config and storage to be able to fit the TokenRegistry address
  • Implementes token registry bindings and updates deployment sequence to include the token registry on the OnRamp

@vicentevieytes vicentevieytes marked this pull request as ready for review June 19, 2026 02:42
@vicentevieytes vicentevieytes requested a review from a team as a code owner June 19, 2026 02:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, new SetTokenInfo message) 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.

Comment thread pkg/ccip/bindings/tokenregistry/tokenregistry.go
Comment thread deployment/ccip/sequence/deploy_ccip.go Outdated
Comment thread deployment/ccip/sequence/deploy_ccip.go Outdated
Comment thread deployment/state/state.go Outdated
@vicentevieytes vicentevieytes marked this pull request as draft June 23, 2026 13:30
vicentevieytes and others added 7 commits June 23, 2026 16:34
…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>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@vicentevieytes vicentevieytes marked this pull request as ready for review June 23, 2026 19:54
krebernisak
krebernisak previously approved these changes Jun 26, 2026
Comment thread contracts/contracts/ccip/onramp/types.tolk Outdated
struct OnRamp_TokenRegistryDeployment {
//TODO: deployableCode: cell;
// tokenRegistryCode: cell;
tokenRegistry: address;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@patricios-space patricios-space Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree here. Deployment becomes simpler because OnRamp can then be configured before deploying the tokenRegistry and knowing its address

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to a sharded implementation under the router, please take another look @patricios-space @krebernisak

Comment thread contracts/tests/ccip/onramp/OnRamp.getFee.spec.ts Outdated
Comment thread contracts/contracts/ccip/token_registry/storage.tolk Outdated

fun onSetTokenInfo(msg: TokenRegistry_SetTokenInfo, sender: address) {
//TODO access control
var st = TokenRegistry_Storage.load();

@patricios-space patricios-space Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be able to change the minter address.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread contracts/contracts/ccip/onramp/messages.tolk Outdated
val msg = lazy CCIPSendExecutor_InMessage.fromSlice(in.body);
match (msg) {
// Sender must be this contract (called when initializing the contract)
CCIPSendExecutor_ExecuteV2 => {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assert here. I'm doing that in the offramp flow

@patricios-space patricios-space left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use Deployable_InitializeAndSend instead


onCCIPSend(sendMsg, msg.sender, in.valueCoins);
}
Router_TokenRegistrySetTokenInfo => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @krebernisak on having a separate TokenAdminRegistryManager contract here

@@ -1,8 +1,8 @@
import "types"

struct TokenRegistry_Storage {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remember renaming all TokenRegistry appearances to TokenAdminRegistry

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need a deploy_token_registry.go sequence

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add a TokenAdminRegistryManager we will be deploying it in deploy_ccip.go I guess

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, when we move to a separate contract. For now we can just rely on the Router deploying the individual registers

@vicentevieytes vicentevieytes merged commit dfd58a9 into main Jul 1, 2026
36 checks passed
@vicentevieytes vicentevieytes deleted the vv/token-registry-bindings-and-deployment branch July 1, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants