From 62c4d4b6015cd279ca2d60fe9f561ea0de594e19 Mon Sep 17 00:00:00 2001 From: Pablo La Greca Date: Tue, 26 Nov 2024 18:17:07 -0300 Subject: [PATCH] more changes to support solana --- deployment/ccip/changeset/deploy.go | 242 ++---------------- deployment/ccip/changeset/evm/deploy_evm.go | 232 +++++++++++++++++ .../changeset/internal/deploy_home_chain.go | 8 +- deployment/environment.go | 5 +- 4 files changed, 263 insertions(+), 224 deletions(-) create mode 100644 deployment/ccip/changeset/evm/deploy_evm.go diff --git a/deployment/ccip/changeset/deploy.go b/deployment/ccip/changeset/deploy.go index 05d4cbe59ac..2db8a90cd52 100644 --- a/deployment/ccip/changeset/deploy.go +++ b/deployment/ccip/changeset/deploy.go @@ -2,6 +2,8 @@ package changeset import ( "fmt" + chain_selectors "github.com/smartcontractkit/chain-selectors" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/evm" "math/big" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -16,19 +18,13 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/ccip_home" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/maybe_revert_message_receiver" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/mock_rmn_contract" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/nonce_manager" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/onramp" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/registry_module_owner_custom" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_home" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_proxy_contract" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_remote" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/token_admin_registry" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/weth9" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/shared/generated/burn_mint_erc677" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/shared/generated/multicall3" ) var ( @@ -119,218 +115,18 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address } } lggr := e.Logger - chainState, chainExists := state.EVMState.Chains[chain.Selector] - var weth9Contract *weth9.WETH9 - var linkTokenContract *burn_mint_erc677.BurnMintERC677 - var tokenAdminReg *token_admin_registry.TokenAdminRegistry - var registryModule *registry_module_owner_custom.RegistryModuleOwnerCustom - var rmnProxy *rmn_proxy_contract.RMNProxyContract - var r *router.Router - var mc3 *multicall3.Multicall3 - if chainExists { - weth9Contract = chainState.Weth9 - linkTokenContract = chainState.LinkToken - tokenAdminReg = chainState.TokenAdminRegistry - registryModule = chainState.RegistryModule - rmnProxy = chainState.RMNProxyExisting - r = chainState.Router - mc3 = chainState.Multicall3 - } - if rmnProxy == nil { - // we want to replicate the mainnet scenario where RMNProxy is already deployed with some existing RMN - // This will need us to use two different RMNProxy contracts - // 1. RMNProxyNew with RMNRemote - ( deployed later in chain contracts) - // 2. RMNProxyExisting with mockRMN - ( deployed here, replicating the behavior of existing RMNProxy with already set RMN) - rmn, err := deployment.DeployContract(lggr, chain, ab, - func(chain deployment.Chain) deployment.ContractDeploy[*mock_rmn_contract.MockRMNContract] { - rmnAddr, tx2, rmn, err2 := mock_rmn_contract.DeployMockRMNContract( - chain.EVMChain.DeployerKey, - chain.EVMChain.Client, - ) - return deployment.ContractDeploy[*mock_rmn_contract.MockRMNContract]{ - rmnAddr, rmn, tx2, deployment.NewTypeAndVersion(MockRMN, deployment.Version1_0_0), err2, - } - }) - if err != nil { - lggr.Errorw("Failed to deploy mock RMN", "err", err) - return err + switch chain.Family { + case chain_selectors.FamilyEVM: + { + return evm.DeployPrerequisitesEVM(e, ab, state, chain, lggr, deployOpts, isUSDC) } - lggr.Infow("deployed mock RMN", "addr", rmn.Address) - rmnProxyContract, err := deployment.DeployContract(lggr, chain, ab, - func(chain deployment.Chain) deployment.ContractDeploy[*rmn_proxy_contract.RMNProxyContract] { - rmnProxyAddr, tx2, rmnProxy, err2 := rmn_proxy_contract.DeployRMNProxyContract( - chain.EVMChain.DeployerKey, - chain.EVMChain.Client, - rmn.Address, - ) - return deployment.ContractDeploy[*rmn_proxy_contract.RMNProxyContract]{ - rmnProxyAddr, rmnProxy, tx2, deployment.NewTypeAndVersion(ARMProxy, deployment.Version1_0_0), err2, - } - }) - if err != nil { - lggr.Errorw("Failed to deploy RMNProxyNew", "err", err) - return err - } - lggr.Infow("deployed RMNProxyNew", "addr", rmnProxyContract.Address) - rmnProxy = rmnProxyContract.Contract - } - if tokenAdminReg == nil { - tokenAdminRegistry, err := deployment.DeployContract(e.Logger, chain, ab, - func(chain deployment.Chain) deployment.ContractDeploy[*token_admin_registry.TokenAdminRegistry] { - tokenAdminRegistryAddr, tx2, tokenAdminRegistry, err2 := token_admin_registry.DeployTokenAdminRegistry( - chain.EVMChain.DeployerKey, - chain.EVMChain.Client) - return deployment.ContractDeploy[*token_admin_registry.TokenAdminRegistry]{ - tokenAdminRegistryAddr, tokenAdminRegistry, tx2, deployment.NewTypeAndVersion(TokenAdminRegistry, deployment.Version1_5_0), err2, - } - }) - if err != nil { - e.Logger.Errorw("Failed to deploy token admin registry", "err", err) - return err + case chain_selectors.FamilySolana: + { + panic("Not implemented") } - e.Logger.Infow("deployed tokenAdminRegistry", "addr", tokenAdminRegistry) - tokenAdminReg = tokenAdminRegistry.Contract - } else { - e.Logger.Infow("tokenAdminRegistry already deployed", "addr", tokenAdminReg.Address) + default: + panic("Not implemented") } - if registryModule == nil { - customRegistryModule, err := deployment.DeployContract(e.Logger, chain, ab, - func(chain deployment.Chain) deployment.ContractDeploy[*registry_module_owner_custom.RegistryModuleOwnerCustom] { - regModAddr, tx2, regMod, err2 := registry_module_owner_custom.DeployRegistryModuleOwnerCustom( - chain.EVMChain.DeployerKey, - chain.EVMChain.Client, - tokenAdminReg.Address()) - return deployment.ContractDeploy[*registry_module_owner_custom.RegistryModuleOwnerCustom]{ - regModAddr, regMod, tx2, deployment.NewTypeAndVersion(RegistryModule, deployment.Version1_5_0), err2, - } - }) - if err != nil { - e.Logger.Errorw("Failed to deploy custom registry module", "err", err) - return err - } - e.Logger.Infow("deployed custom registry module", "addr", customRegistryModule) - registryModule = customRegistryModule.Contract - } else { - e.Logger.Infow("custom registry module already deployed", "addr", registryModule.Address) - } - isRegistryAdded, err := tokenAdminReg.IsRegistryModule(nil, registryModule.Address()) - if err != nil { - e.Logger.Errorw("Failed to check if registry module is added on token admin registry", "err", err) - return fmt.Errorf("failed to check if registry module is added on token admin registry: %w", err) - } - if !isRegistryAdded { - tx, err := tokenAdminReg.AddRegistryModule(chain.EVMChain.DeployerKey, registryModule.Address()) - if err != nil { - e.Logger.Errorw("Failed to assign registry module on token admin registry", "err", err) - return fmt.Errorf("failed to assign registry module on token admin registry: %w", err) - } - - _, err = chain.EVMChain.Confirm(tx) - if err != nil { - e.Logger.Errorw("Failed to confirm assign registry module on token admin registry", "err", err) - return fmt.Errorf("failed to confirm assign registry module on token admin registry: %w", err) - } - e.Logger.Infow("assigned registry module on token admin registry") - } - if weth9Contract == nil { - weth, err := deployment.DeployContract(lggr, chain, ab, - func(chain deployment.Chain) deployment.ContractDeploy[*weth9.WETH9] { - weth9Addr, tx2, weth9c, err2 := weth9.DeployWETH9( - chain.EVMChain.DeployerKey, - chain.EVMChain.Client, - ) - return deployment.ContractDeploy[*weth9.WETH9]{ - weth9Addr, weth9c, tx2, deployment.NewTypeAndVersion(WETH9, deployment.Version1_0_0), err2, - } - }) - if err != nil { - lggr.Errorw("Failed to deploy weth9", "err", err) - return err - } - lggr.Infow("deployed weth9", "addr", weth.Address) - weth9Contract = weth.Contract - } else { - lggr.Infow("weth9 already deployed", "addr", weth9Contract.Address) - } - if linkTokenContract == nil { - linkToken, err := deployment.DeployContract(lggr, chain, ab, - func(chain deployment.Chain) deployment.ContractDeploy[*burn_mint_erc677.BurnMintERC677] { - linkTokenAddr, tx2, linkToken, err2 := burn_mint_erc677.DeployBurnMintERC677( - chain.EVMChain.DeployerKey, - chain.EVMChain.Client, - "Link Token", - "LINK", - uint8(18), - big.NewInt(0).Mul(big.NewInt(1e9), big.NewInt(1e18)), - ) - return deployment.ContractDeploy[*burn_mint_erc677.BurnMintERC677]{ - linkTokenAddr, linkToken, tx2, deployment.NewTypeAndVersion(LinkToken, deployment.Version1_0_0), err2, - } - }) - if err != nil { - lggr.Errorw("Failed to deploy linkToken", "err", err) - return err - } - lggr.Infow("deployed linkToken", "addr", linkToken.Address) - } else { - lggr.Infow("linkToken already deployed", "addr", linkTokenContract.Address) - } - // if router is not already deployed, we deploy it - if r == nil { - routerContract, err := deployment.DeployContract(e.Logger, chain, ab, - func(chain deployment.Chain) deployment.ContractDeploy[*router.Router] { - routerAddr, tx2, routerC, err2 := router.DeployRouter( - chain.EVMChain.DeployerKey, - chain.EVMChain.Client, - weth9Contract.Address(), - rmnProxy.Address(), - ) - return deployment.ContractDeploy[*router.Router]{ - routerAddr, routerC, tx2, deployment.NewTypeAndVersion(Router, deployment.Version1_2_0), err2, - } - }) - if err != nil { - e.Logger.Errorw("Failed to deploy router", "err", err) - return err - } - e.Logger.Infow("deployed router", "addr", routerContract.Address) - r = routerContract.Contract - } else { - e.Logger.Infow("router already deployed", "addr", chainState.Router.Address) - } - if deployOpts.Multicall3Enabled && mc3 == nil { - multicall3Contract, err := deployment.DeployContract(e.Logger, chain, ab, - func(chain deployment.Chain) deployment.ContractDeploy[*multicall3.Multicall3] { - multicall3Addr, tx2, multicall3Wrapper, err2 := multicall3.DeployMulticall3( - chain.EVMChain.DeployerKey, - chain.EVMChain.Client, - ) - return deployment.ContractDeploy[*multicall3.Multicall3]{ - multicall3Addr, multicall3Wrapper, tx2, deployment.NewTypeAndVersion(Multicall3, deployment.Version1_0_0), err2, - } - }) - if err != nil { - e.Logger.Errorw("Failed to deploy ccip multicall", "err", err) - return err - } - e.Logger.Infow("deployed ccip multicall", "addr", multicall3Contract.Address) - } else { - e.Logger.Info("ccip multicall already deployed", "addr", mc3.Address) - } - if isUSDC { - token, pool, messenger, transmitter, err1 := DeployUSDC(e.Logger, chain, ab, rmnProxy.Address(), r.Address()) - if err1 != nil { - return err1 - } - e.Logger.Infow("Deployed USDC contracts", - "chainSelector", chain.Selector, - "token", token.Address(), - "pool", pool.Address(), - "transmitter", transmitter.Address(), - "messenger", messenger.Address(), - ) - } - return nil } // configureChain assumes the all the Home chain contracts and CCIP contracts are deployed @@ -373,6 +169,16 @@ func configureChain( for _, chainSel := range c.ChainsToDeploy { chain, _ := e.Chains[chainSel] + + switch chain.Family { + case chain_selectors.FamilyEVM: + { + + } + default: + panic("Not implemented") + } + chainState, ok := existingState.EVMState.Chains[chain.Selector] if !ok { return fmt.Errorf("chain state not found for chain %d", chain.Selector) @@ -432,7 +238,8 @@ func configureChain( func deployCCIPContracts( e deployment.Environment, ab deployment.AddressBook, - c NewChainsConfig) error { + c NewChainsConfig, +) error { err := deployChainContractsForChains(e, ab, c.HomeChainSel, c.ChainsToDeploy) if err != nil { e.Logger.Errorw("Failed to deploy chain contracts", "err", err) @@ -456,7 +263,8 @@ func deployChainContractsForChains( e deployment.Environment, ab deployment.AddressBook, homeChainSel uint64, - chainsToDeploy []uint64) error { + chainsToDeploy []uint64, +) error { existingState, err := LoadOnchainState(e) if err != nil { e.Logger.Errorw("Failed to load existing onchain state", "err") diff --git a/deployment/ccip/changeset/evm/deploy_evm.go b/deployment/ccip/changeset/evm/deploy_evm.go new file mode 100644 index 00000000000..1a8ec59a4e5 --- /dev/null +++ b/deployment/ccip/changeset/evm/deploy_evm.go @@ -0,0 +1,232 @@ +package evm + +import ( + "fmt" + "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink/deployment" + changeset2 "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/mock_rmn_contract" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/registry_module_owner_custom" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_proxy_contract" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/token_admin_registry" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/weth9" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/shared/generated/burn_mint_erc677" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/shared/generated/multicall3" + "math/big" +) + +func DeployPrerequisitesEVM(e deployment.Environment, ab deployment.AddressBook, state changeset2.CCIPOnChainState, chain deployment.Chain, lggr logger.Logger, deployOpts *changeset2.DeployPrerequisiteContractsOpts, isUSDC bool) error { + chainState, chainExists := state.EVMState.Chains[chain.Selector] + var weth9Contract *weth9.WETH9 + var linkTokenContract *burn_mint_erc677.BurnMintERC677 + var tokenAdminReg *token_admin_registry.TokenAdminRegistry + var registryModule *registry_module_owner_custom.RegistryModuleOwnerCustom + var rmnProxy *rmn_proxy_contract.RMNProxyContract + var r *router.Router + var mc3 *multicall3.Multicall3 + if chainExists { + weth9Contract = chainState.Weth9 + linkTokenContract = chainState.LinkToken + tokenAdminReg = chainState.TokenAdminRegistry + registryModule = chainState.RegistryModule + rmnProxy = chainState.RMNProxyExisting + r = chainState.Router + mc3 = chainState.Multicall3 + } + if rmnProxy == nil { + // we want to replicate the mainnet scenario where RMNProxy is already deployed with some existing RMN + // This will need us to use two different RMNProxy contracts + // 1. RMNProxyNew with RMNRemote - ( deployed later in chain contracts) + // 2. RMNProxyExisting with mockRMN - ( deployed here, replicating the behavior of existing RMNProxy with already set RMN) + rmn, err := deployment.DeployContract(lggr, chain, ab, + func(chain deployment.Chain) deployment.ContractDeploy[*mock_rmn_contract.MockRMNContract] { + rmnAddr, tx2, rmn, err2 := mock_rmn_contract.DeployMockRMNContract( + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, + ) + return deployment.ContractDeploy[*mock_rmn_contract.MockRMNContract]{ + rmnAddr, rmn, tx2, deployment.NewTypeAndVersion(changeset2.MockRMN, deployment.Version1_0_0), err2, + } + }) + if err != nil { + lggr.Errorw("Failed to deploy mock RMN", "err", err) + return err + } + lggr.Infow("deployed mock RMN", "addr", rmn.Address) + rmnProxyContract, err := deployment.DeployContract(lggr, chain, ab, + func(chain deployment.Chain) deployment.ContractDeploy[*rmn_proxy_contract.RMNProxyContract] { + rmnProxyAddr, tx2, rmnProxy, err2 := rmn_proxy_contract.DeployRMNProxyContract( + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, + rmn.Address, + ) + return deployment.ContractDeploy[*rmn_proxy_contract.RMNProxyContract]{ + rmnProxyAddr, rmnProxy, tx2, deployment.NewTypeAndVersion(changeset2.ARMProxy, deployment.Version1_0_0), err2, + } + }) + if err != nil { + lggr.Errorw("Failed to deploy RMNProxyNew", "err", err) + return err + } + lggr.Infow("deployed RMNProxyNew", "addr", rmnProxyContract.Address) + rmnProxy = rmnProxyContract.Contract + } + if tokenAdminReg == nil { + tokenAdminRegistry, err := deployment.DeployContract(e.Logger, chain, ab, + func(chain deployment.Chain) deployment.ContractDeploy[*token_admin_registry.TokenAdminRegistry] { + tokenAdminRegistryAddr, tx2, tokenAdminRegistry, err2 := token_admin_registry.DeployTokenAdminRegistry( + chain.EVMChain.DeployerKey, + chain.EVMChain.Client) + return deployment.ContractDeploy[*token_admin_registry.TokenAdminRegistry]{ + tokenAdminRegistryAddr, tokenAdminRegistry, tx2, deployment.NewTypeAndVersion(changeset2.TokenAdminRegistry, deployment.Version1_5_0), err2, + } + }) + if err != nil { + e.Logger.Errorw("Failed to deploy token admin registry", "err", err) + return err + } + e.Logger.Infow("deployed tokenAdminRegistry", "addr", tokenAdminRegistry) + tokenAdminReg = tokenAdminRegistry.Contract + } else { + e.Logger.Infow("tokenAdminRegistry already deployed", "addr", tokenAdminReg.Address) + } + if registryModule == nil { + customRegistryModule, err := deployment.DeployContract(e.Logger, chain, ab, + func(chain deployment.Chain) deployment.ContractDeploy[*registry_module_owner_custom.RegistryModuleOwnerCustom] { + regModAddr, tx2, regMod, err2 := registry_module_owner_custom.DeployRegistryModuleOwnerCustom( + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, + tokenAdminReg.Address()) + return deployment.ContractDeploy[*registry_module_owner_custom.RegistryModuleOwnerCustom]{ + regModAddr, regMod, tx2, deployment.NewTypeAndVersion(changeset2.RegistryModule, deployment.Version1_5_0), err2, + } + }) + if err != nil { + e.Logger.Errorw("Failed to deploy custom registry module", "err", err) + return err + } + e.Logger.Infow("deployed custom registry module", "addr", customRegistryModule) + registryModule = customRegistryModule.Contract + } else { + e.Logger.Infow("custom registry module already deployed", "addr", registryModule.Address) + } + isRegistryAdded, err := tokenAdminReg.IsRegistryModule(nil, registryModule.Address()) + if err != nil { + e.Logger.Errorw("Failed to check if registry module is added on token admin registry", "err", err) + return fmt.Errorf("failed to check if registry module is added on token admin registry: %w", err) + } + if !isRegistryAdded { + tx, err := tokenAdminReg.AddRegistryModule(chain.EVMChain.DeployerKey, registryModule.Address()) + if err != nil { + e.Logger.Errorw("Failed to assign registry module on token admin registry", "err", err) + return fmt.Errorf("failed to assign registry module on token admin registry: %w", err) + } + + _, err = chain.EVMChain.Confirm(tx) + if err != nil { + e.Logger.Errorw("Failed to confirm assign registry module on token admin registry", "err", err) + return fmt.Errorf("failed to confirm assign registry module on token admin registry: %w", err) + } + e.Logger.Infow("assigned registry module on token admin registry") + } + if weth9Contract == nil { + weth, err := deployment.DeployContract(lggr, chain, ab, + func(chain deployment.Chain) deployment.ContractDeploy[*weth9.WETH9] { + weth9Addr, tx2, weth9c, err2 := weth9.DeployWETH9( + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, + ) + return deployment.ContractDeploy[*weth9.WETH9]{ + weth9Addr, weth9c, tx2, deployment.NewTypeAndVersion(changeset2.WETH9, deployment.Version1_0_0), err2, + } + }) + if err != nil { + lggr.Errorw("Failed to deploy weth9", "err", err) + return err + } + lggr.Infow("deployed weth9", "addr", weth.Address) + weth9Contract = weth.Contract + } else { + lggr.Infow("weth9 already deployed", "addr", weth9Contract.Address) + } + if linkTokenContract == nil { + linkToken, err := deployment.DeployContract(lggr, chain, ab, + func(chain deployment.Chain) deployment.ContractDeploy[*burn_mint_erc677.BurnMintERC677] { + linkTokenAddr, tx2, linkToken, err2 := burn_mint_erc677.DeployBurnMintERC677( + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, + "Link Token", + "LINK", + uint8(18), + big.NewInt(0).Mul(big.NewInt(1e9), big.NewInt(1e18)), + ) + return deployment.ContractDeploy[*burn_mint_erc677.BurnMintERC677]{ + linkTokenAddr, linkToken, tx2, deployment.NewTypeAndVersion(changeset2.LinkToken, deployment.Version1_0_0), err2, + } + }) + if err != nil { + lggr.Errorw("Failed to deploy linkToken", "err", err) + return err + } + lggr.Infow("deployed linkToken", "addr", linkToken.Address) + } else { + lggr.Infow("linkToken already deployed", "addr", linkTokenContract.Address) + } + // if router is not already deployed, we deploy it + if r == nil { + routerContract, err := deployment.DeployContract(e.Logger, chain, ab, + func(chain deployment.Chain) deployment.ContractDeploy[*router.Router] { + routerAddr, tx2, routerC, err2 := router.DeployRouter( + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, + weth9Contract.Address(), + rmnProxy.Address(), + ) + return deployment.ContractDeploy[*router.Router]{ + routerAddr, routerC, tx2, deployment.NewTypeAndVersion(changeset2.Router, deployment.Version1_2_0), err2, + } + }) + if err != nil { + e.Logger.Errorw("Failed to deploy router", "err", err) + return err + } + e.Logger.Infow("deployed router", "addr", routerContract.Address) + r = routerContract.Contract + } else { + e.Logger.Infow("router already deployed", "addr", chainState.Router.Address) + } + if deployOpts.Multicall3Enabled && mc3 == nil { + multicall3Contract, err := deployment.DeployContract(e.Logger, chain, ab, + func(chain deployment.Chain) deployment.ContractDeploy[*multicall3.Multicall3] { + multicall3Addr, tx2, multicall3Wrapper, err2 := multicall3.DeployMulticall3( + chain.EVMChain.DeployerKey, + chain.EVMChain.Client, + ) + return deployment.ContractDeploy[*multicall3.Multicall3]{ + multicall3Addr, multicall3Wrapper, tx2, deployment.NewTypeAndVersion(changeset2.Multicall3, deployment.Version1_0_0), err2, + } + }) + if err != nil { + e.Logger.Errorw("Failed to deploy ccip multicall", "err", err) + return err + } + e.Logger.Infow("deployed ccip multicall", "addr", multicall3Contract.Address) + } else { + e.Logger.Info("ccip multicall already deployed", "addr", mc3.Address) + } + if isUSDC { + token, pool, messenger, transmitter, err1 := changeset2.DeployUSDC(e.Logger, chain, ab, rmnProxy.Address(), r.Address()) + if err1 != nil { + return err1 + } + e.Logger.Infow("Deployed USDC contracts", + "chainSelector", chain.Selector, + "token", token.Address(), + "pool", pool.Address(), + "transmitter", transmitter.Address(), + "messenger", messenger.Address(), + ) + } + return nil +} diff --git a/deployment/ccip/changeset/internal/deploy_home_chain.go b/deployment/ccip/changeset/internal/deploy_home_chain.go index 6a11b3e0525..f77b79a0f40 100644 --- a/deployment/ccip/changeset/internal/deploy_home_chain.go +++ b/deployment/ccip/changeset/internal/deploy_home_chain.go @@ -408,10 +408,10 @@ func SetupCommitDON( func BuildOCR3ConfigForCCIPHome( ocrSecrets deployment.OCRSecrets, - offRamp *offramp.OffRamp, + offRampAddress []byte, dest deployment.Chain, nodes deployment.Nodes, - rmnHomeAddress common.Address, + rmnHomeAddress []byte, ocrParams types2.OCRParameters, commitOffchainCfg pluginconfig.CommitOffchainConfig, execOffchainCfg pluginconfig.ExecuteOffchainConfig, @@ -527,10 +527,10 @@ func BuildOCR3ConfigForCCIPHome( ChainSelector: dest.Selector, FRoleDON: configF, OffchainConfigVersion: offchainConfigVersion, - OfframpAddress: offRamp.Address().Bytes(), + OfframpAddress: offRampAddress, Nodes: ocrNodes, OffchainConfig: offchainConfig, - RmnHomeAddress: rmnHomeAddress.Bytes(), + RmnHomeAddress: rmnHomeAddress, } } diff --git a/deployment/environment.go b/deployment/environment.go index f81a3af65b4..a68c97f26ab 100644 --- a/deployment/environment.go +++ b/deployment/environment.go @@ -53,12 +53,12 @@ type EVMChain struct { Confirm func(tx *types.Transaction) (uint64, error) } -type SolanaChain struct { -} +type SolanaChain struct{} // Chain represents an EVM chain. type Chain struct { // Selectors used as canonical chain identifier. + Family string Selector uint64 EVMChain EVMChain SolanaChain SolanaChain @@ -312,7 +312,6 @@ func NodeInfo(nodeIDs []string, oc NodeChainConfigsLister) (Nodes, error) { Enabled: 1, Ids: nodeIDs, } - } nodesFromJD, err := oc.ListNodes(context.Background(), &nodev1.ListNodesRequest{ Filter: filter,