Skip to content

feat: auto-resolve external token refs during evm pool deployment#2106

Draft
chris-de-leon-cll wants to merge 5 commits into
mainfrom
fix/handle-external-tokens-in-evm-deploy-tp-for-token
Draft

feat: auto-resolve external token refs during evm pool deployment#2106
chris-de-leon-cll wants to merge 5 commits into
mainfrom
fix/handle-external-tokens-in-evm-deploy-tp-for-token

Conversation

@chris-de-leon-cll
Copy link
Copy Markdown
Collaborator

@chris-de-leon-cll chris-de-leon-cll commented Jun 1, 2026

During EVM pool deployments, we can get cases where we want to deploy a pool that's backed by a token which has already been deployed by the customer

In these situations, the token ref does not exist in the datastore, but that shouldn't be a blocker for token pool deployment

This PR allows 3rd party token refs to be fully populated from on-chain data allowing pool deployments to properly succeed

The resolution strategy for the token ref works as follows - suppose we are given an arbitrary token ref that may or may not be populated in the DeployTokenPoolForToken sequemnce:

  1. First, check if the token ref is already fully populated (if it is, then use it as-is)
  2. If the ref is missing any field, use the datastore to fully resolve it (i.e. try to avoid RPC calls if possible)
  3. If the datastore does not contain the ref, then fallback to resolving the token info from the chain

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the EVM pool deployment flow to allow token refs that are not present in the datastore (e.g., customer-deployed tokens) to be auto-populated via on-chain reads, so pool deployments can proceed without requiring prior datastore entries.

Changes:

  • Add fallback token-ref resolution during DeployTokenPoolForToken: datastore lookup first, then on-chain resolution when missing.
  • Minor formatting changes to sequence construction / invocation for consistency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread chains/evm/deployment/v1_0_0/adapters/pool_adapter.go
Comment thread chains/evm/deployment/v1_0_0/adapters/pool_adapter.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread chains/evm/deployment/v1_0_0/adapters/pool_adapter.go
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread integration-tests/deployment/token_expansion_scenarios_test.go
Comment thread integration-tests/deployment/token_expansion_scenarios_test.go Outdated
Comment on lines +314 to +318
fallbackRef, err := a.ResolveTokenRef(b, chains, input.ExistingDataStore, input.ChainSelector, tokenRef.Address)
if err != nil {
return sequences.OnChainOutput{}, fmt.Errorf("failed to resolve token ref from on-chain data for token address %s: %w", tokenRef.Address, err)
}
tokenRef = fallbackRef
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

Metric fix/handle-external-tokens-in-evm-deploy-tp-for-token main
Coverage 69.9% 69.6%

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