Skip to content

Test adapter support tokens - #792

Merged
vicentevieytes merged 84 commits into
mainfrom
vv/test-adapter-enable-token-transfer
Aug 7, 2026
Merged

Test adapter support tokens#792
vicentevieytes merged 84 commits into
mainfrom
vv/test-adapter-enable-token-transfer

Conversation

@vicentevieytes

Copy link
Copy Markdown
Collaborator

No description provided.

vicentevieytes and others added 30 commits June 18, 2026 19:32
…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>
Comment thread deployment/ccip/1_6_0/sequences/tokens.go Outdated
Comment thread deployment/ccip/1_6_0/sequences/tokens.go Outdated

// TODO: add TokenAmounts support for TON token transfers
return router.CCIPSend{
tokenAmounts := make(common.SnakedCell[router.TokenAmount], 0, len(components.TokenAmounts))

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.

This change makes the BuildMessage function return two different types depending on wether this is arbitrary messaging (returns CCIPSend) or if it's a TokenTransfer (returns a TokenTransferMessage struct with the CCIPSend payload as forwardNotification)

Then SendMessage changes it's behavior depending on the type that's passed to it, and it either sends the message to the router or to it's wallet.

This would be simpler with the escrow account entrypoint:

  1. AuthorizeRouterToWithdraw sends the tokens to the escrow account
  2. SendMessage sends CCIPSend to the router, the router will later withdraw the messages when it needs them.

A quick follow up to this should be to change to this model IMO

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 link this comment in the follow up ticket

@vicentevieytes
vicentevieytes marked this pull request as ready for review August 5, 2026 19:30
@vicentevieytes
vicentevieytes requested a review from a team as a code owner August 5, 2026 19:30

@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.

Great job! Only remoteTokenAddress: cca.codec.encode is a critical change, the rests are nit picks

remoteChainSelector: DestChainSelector,
remotePoolAddresses: [EVM_ADDRESS],
remoteTokenAddress: EVM_ADDRESS,
remoteTokenAddress: cca.codec.encode(DEST_TOKEN_ADDRESS).endCell().beginParse(),

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.

This is wrong. We expect just the slice here. The codec prefixes the slice with the buffer length, which is already done by the wrapper.

Suggested change
remoteTokenAddress: cca.codec.encode(DEST_TOKEN_ADDRESS).endCell().beginParse(),
remoteTokenAddress: FromBuffer(DEST_TOKEN_ADDRESS),

Comment on lines +381 to +387
var feeAdmin *address.Address
if input.FeeAggregator != "" {
feeAdmin, err = address.ParseAddr(input.FeeAggregator)
if err != nil {
return sequences.OnChainOutput{}, fmt.Errorf("failed to parse fee aggregator address %q: %w", input.FeeAggregator, err)
}
}

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.

This parsing logic should maybe go into a function?

Suggested change
var feeAdmin *address.Address
if input.FeeAggregator != "" {
feeAdmin, err = address.ParseAddr(input.FeeAggregator)
if err != nil {
return sequences.OnChainOutput{}, fmt.Errorf("failed to parse fee aggregator address %q: %w", input.FeeAggregator, err)
}
}
feeAdmin, err := parseAddr(input.FeeAggregator)
if err != nil {
return sequences.OnChainOutput{}, fmt.Errorf("failed to parse fee aggregator address: %w", err)
}

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.

done

}

stateCCIP, err := tonstate.LoadCCIPOnChainStateUsingDataStore(input.ExistingDataStore, input.ChainSelector)
if err != nil {

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.

Why is this necessary? stateCCIP is only used inside the else block

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 the else block


// TODO: add TokenAmounts support for TON token transfers
return router.CCIPSend{
tokenAmounts := make(common.SnakedCell[router.TokenAmount], 0, len(components.TokenAmounts))

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 link this comment in the follow up ticket

var eAny any
var err error
switch msg := m.(type) {
case router.CCIPSend:

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.

nice

@vicentevieytes
vicentevieytes enabled auto-merge (squash) August 7, 2026 17:24
@vicentevieytes
vicentevieytes merged commit 99f76ba into main Aug 7, 2026
37 checks passed
@vicentevieytes
vicentevieytes deleted the vv/test-adapter-enable-token-transfer branch August 7, 2026 18:08
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.

2 participants