Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCIP-4566 token pool views #16116

Merged
merged 6 commits into from
Jan 31, 2025
Merged

CCIP-4566 token pool views #16116

merged 6 commits into from
Jan 31, 2025

Conversation

bukata-sa
Copy link
Contributor

CCIP 1.5/1.6 Token pool views

Copy link
Contributor

github-actions bot commented Jan 29, 2025

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

Copy link
Contributor

@kylesmartin kylesmartin left a comment

Choose a reason for hiding this comment

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

There are some additional fields that we should capture for USDC and LockRelease:

LockRelease: acceptLiquidity, rebalancer
USDC: domains, messageTransmitter, tokenMessenger

Maybe worth having three separate views?

  • All burn mint types (burn mint, burn from mint, burn with from mint, etc.)
  • Lock release
  • USDC

"github.com/smartcontractkit/chainlink/deployment/common/view/types"
)

type TokenPoolContract interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is technically the interface for v1_5_1, package name should be updated as there are breaking changes between v1_5 and v1_5_1

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, add comment for interface & maybe link here: https://github.com/smartcontractkit/chainlink/blob/develop/core/gethwrappers/ccip/generated/token_pool/token_pool.go

So it is clear where these methods are coming from.

Comment on lines 23 to 28
type RemoteChainConfig struct {
// RemoteTokenAddress is a hex representation of byte arrays
RemoteTokenAddress string
// RemotePoolAddresses are a hex representations of byte arrays
RemotePoolAddresses []string
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type RemoteChainConfig struct {
// RemoteTokenAddress is a hex representation of byte arrays
RemoteTokenAddress string
// RemotePoolAddresses are a hex representations of byte arrays
RemotePoolAddresses []string
}
type RemoteChainConfig struct {
// RemoteTokenAddress is the address of the token on the remote chain.
RemoteTokenAddress []common.Address
// RemotePoolAddresses are the addresses of valid token pools on the remote chain.
RemotePoolAddresses []common.Address
// InboundRateLimiterConfig is the rate limiter config for inbound transfers from the remote chain.
InboundRateLimterConfig token_pool.RateLimiterConfig
// OutboundRateLimiterConfig is the rate limiter config for outbound transfers to the remote chain.
OutboundRateLimiterConfig token_pool.RateLimiterConfig
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't put common.Address here intentionally, as we don't know what length will be these byte arrays
Switched back from hex to []byte

type TokenPoolView struct {
types.ContractMetaData
Token common.Address `json:"token"`
RemoteChainConfigs map[uint64]RemoteChainConfig `json:"remoteChainConfigs"`
Copy link
Contributor

Choose a reason for hiding this comment

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

"SupportedChains" aligns with convention of the contract

Suggested change
RemoteChainConfigs map[uint64]RemoteChainConfig `json:"remoteChainConfigs"`
SupportedChains map[uint64]RemoteChainConfig `json:"supportedChains"`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, SupportedChains is another methods+field on the contract
remoteChainConfigs doesn't have public method, but corresponds to s_remoteChainConfigs internal field

}
remotePoolsHex := make([]string, len(remotePools))
for i, remotePool := range remotePools {
remotePoolsHex[i] = hex.EncodeToString(remotePool)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can just use common.BytesToAddress() if you change the remote address fields to use common.Address

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't put common.Address here intentionally, as we don't know what length will be these byte arrays
Switched back from hex to []byte

Copy link
Contributor

@AnieeG AnieeG left a comment

Choose a reason for hiding this comment

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

Generic comments -
Do we need any specific info for USDC pool?
Are we including RateLimiter details here?
It will help if we create a map of pool views keyed by the token symbol.
Let's have all error messages formatted with pool/token address

@bukata-sa bukata-sa added this pull request to the merge queue Jan 31, 2025
Merged via the queue into develop with commit fe48a3a Jan 31, 2025
205 of 206 checks passed
@bukata-sa bukata-sa deleted the feature/pool-views branch January 31, 2025 10:04
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