Skip to content

Commit

Permalink
add initial steps to deploy and initialize mcm contracts in solana
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavogama-cll committed Jan 31, 2025
1 parent f7cd53e commit d8ce2f7
Show file tree
Hide file tree
Showing 3 changed files with 274 additions and 73 deletions.
22 changes: 9 additions & 13 deletions deployment/common/changeset/mcmsnew/deploy_mcms_with_timelock.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,30 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/gagliardetto/solana-go"
chain_selectors "github.com/smartcontractkit/chain-selectors"
"github.com/smartcontractkit/chainlink-common/pkg/logger"

"github.com/smartcontractkit/chainlink/deployment"
commonChangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset"
"github.com/smartcontractkit/chainlink/deployment/common/changeset/internal"
mcmEvm "github.com/smartcontractkit/chainlink/deployment/common/changeset/mcmsnew/evm"
mcmSolana "github.com/smartcontractkit/chainlink/deployment/common/changeset/mcmsnew/solana"
mcmsNewTypes "github.com/smartcontractkit/chainlink/deployment/common/changeset/mcmsnew/types"
"github.com/smartcontractkit/chainlink/deployment/common/types"
)

var _ deployment.ChangeSet[map[uint64]types.MCMSWithTimelockConfig] = DeployMCMSWithTimelock
var _ deployment.ChangeSet[map[uint64]mcmsNewTypes.MCMSWithTimelockConfig] = DeployMCMSWithTimelock

func DeployMCMSWithTimelock(e deployment.Environment, cfgByChain map[uint64]types.MCMSWithTimelockConfig) (deployment.ChangesetOutput, error) {
func DeployMCMSWithTimelock(e deployment.Environment, cfgByChain map[uint64]mcmsNewTypes.MCMSWithTimelockConfig) (deployment.ChangesetOutput, error) {
newAddresses := deployment.NewMemoryAddressBook()
err := internal.DeployMCMSWithTimelockContractsBatch(
e.Logger, e.Chains, newAddresses, cfgByChain,
)
err := DeployMCMSWithTimelockContractsBatch(e, newAddresses, cfgByChain)
if err != nil {
return deployment.ChangesetOutput{AddressBook: newAddresses}, err
}

return deployment.ChangesetOutput{AddressBook: newAddresses}, nil
}

// DeployMCMSWithTimelockContractsBatch is a helper function to deploy MCMS contracts with timelock
// on multiple chains provided on the chains parameter.
func DeployMCMSWithTimelockContractsBatch(
lggr logger.Logger,
chains deployment.MultiFamilyChains,
e deployment.Environment,
ab deployment.AddressBook,
cfgByChain map[uint64]mcmsNewTypes.MCMSWithTimelockConfig,
) error {
Expand All @@ -45,19 +40,20 @@ func DeployMCMSWithTimelockContractsBatch(
if err != nil {
return err
}

switch family {
case chain_selectors.FamilyEVM:
_, err := mcmEvm.DeployMCMSWithTimelockContractsEVM(lggr, chains.EVMChains[chainSel], ab, cfg)
_, err := mcmEvm.DeployMCMSWithTimelockContractsEVM(e.Logger, e.Chains[chainSel], ab, cfg)
if err != nil {
return err
}

case chain_selectors.FamilySolana:
_, err := mcmSolana.DeployMCMSWithTimelockProgramsSolana(lggr, chains.SolChains[chainSel], ab, cfg)
_, err := mcmSolana.DeployMCMSWithTimelockProgramsSolana(e, e.SolChains[chainSel], ab, cfg)
if err != nil {
return err
}
}

}

return nil
Expand Down
Loading

0 comments on commit d8ce2f7

Please sign in to comment.