{"modulePath":"github.com/smartcontractkit/cld-changesets","version":"v0.9.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package deploy\n\nPackage deploy provides the DeployMCMSWithTimelock changeset and a registry for per-chain-family deploy implementations.\n\n### Usage {#hdr-Usage}\n\nImport the changeset and at least one registered chain family, then execute with a per-chain MCMS+timelock config:\n\n\t\timport (\n\t\t\t\"github.com/smartcontractkit/cld-changesets/mcms/changesets/deploy\"\n\t\t\t_ \"github.com/smartcontractkit/cld-changesets/mcms/evm/deploy\" // registers EVM\n\t\t)\n\n\t Testing:\n\t\trt.Exec(runtime.ChangesetTask(deploy.Changeset{}, deploy.Input{\n\t\t\tConfigByChain: map[uint64]cldfproposalutils.MCMSWithTimelockConfig{\n\t\t\t\tselector: cfg,\n\t\t\t},\n\t\t}))\n\n\t CLD:\n\t registry.Add(\"deploy_mcms_with_timelock\", Configure(deploy.Changeset{}).WithEnvInput())\n\n[Changeset](#Changeset) groups input chains by chain-selectors family, runs each chain's deploy sequence sequentially, merges newly deployed addresses into the datastore, and returns operation reports.\n\n### Built-in EVM support {#hdr-Built_in_EVM_support}\n\nEVM registers itself via init when its package is imported (blank import is enough). No call to [RegisterFamilies](#RegisterFamilies) is required for EVM-only deployments.\n\n### Adding a new chain family {#hdr-Adding_a_new_chain_family}\n\nImplement a family under mcms/\\\u003cfamily\u003e/deploy (for example mcms/solana/deploy) and register it at process startup. Follow this layout:\n\n  - register.go — exports Registration() and calls deploy.Registry.Register in init()\n  - sequence.go — operations.Sequence that deploys contracts for one chain\n  - addresses.go  — helpers to load existing addresses from the datastore\n\nStep 1: implement Registration\n\nReturn a [Registration](#Registration) with the chain-selectors family string, a deploy sequence, and an optional Verify function:\n\n\tfunc Registration() deploy.Registration {\n\t\treturn deploy.Registration{\n\t\t\tFamily:   chainselectors.FamilySolana, // or FamilyAptos, etc.\n\t\t\tSequence: seqDeployMCMSWithTimelock,\n\t\t\tVerify:   verifySolanaChains,\n\t\t}\n\t}\n\nStep 2: implement the sequence\n\nThe sequence must match [Sequence](#Sequence): it receives [ChainInput](#ChainInput) and [Deps](#Deps), and returns [sequenceutils.OnChainOutput](/github.com/smartcontractkit/chainlink-deployments-framework/changeset/sequenceutils#OnChainOutput). Write newly deployed contract addresses to output.Metadata.Addresses (see mcms/evm/deploy for AddressRef conventions). Skip contracts already present in deps.DataStore for the chain and qualifier.\n\nStep 3: register at startup\n\nEither auto-register from init (recommended, mirrors EVM):\n\n\tfunc init() { deploy.Registry.Register(Registration()) }\n\nOr register explicitly from the caller's main/setup code:\n\n\tdeploy.RegisterFamilies(solanadeploy.Registration())\n\nEach family may only be registered once; duplicate registration panics.\n\n### Registration contract {#hdr-Registration_contract}\n\n  - Family — must match chainselectors.GetSelectorFamily for chains you support\n  - Sequence — required; one invocation per chain in ConfigByChain\n  - Verify — optional; called during VerifyPreconditions with all chains of that family in the input (use to assert chains exist in the environment)\n\nIf a chain's family has no registered sequence, Apply returns an error listing families that are registered. Use \\[Registry.RegisteredFamilies] to inspect the registry in tests.\n\n### Reference implementation {#hdr-Reference_implementation}\n\nSee mcms/evm/deploy for a complete EVM implementation: idempotent deploy from the datastore, timelock role grants, and address metadata output.\n\n## Variables\n\n```go\nvar Registry = familyregistry.New[Sequence, ChainInput](\"mcms deploy\")\n```\nRegistry holds per-family MCMS deploy sequences.\n\n## Functions\n\n```go\nfunc RegisterFamilies(regs ...Registration)\n```\nRegisterFamilies registers one or more chain-family deploy implementations. Each family may only be registered once; duplicate registration panics.\n\nExternal teams call this once at startup from their own module:\n\n\tdeploy.RegisterFamilies(aptosimpl.Registration())\n\nBuilt-in families (EVM) register themselves automatically via their package init function when imported:\n\n\timport _ \"github.com/smartcontractkit/cld-changesets/mcms/evm/deploy\"\n\n## Types\n\n```go\ntype ChainInput struct {\n\tChainSelector uint64\n\tConfig        cldfproposalutils.MCMSWithTimelockConfig\n}\n```\nChainInput is the per-chain input passed to every family sequence.\n\n```go\ntype Changeset struct{}\n```\nChangeset deploys MCMS with timelock across all configured chains.\n\nEach chain is dispatched sequentially to its family's registered sequence. New addresses are written to the datastore.\n\n```go\nfunc (Changeset) Apply(env cldf.Environment, input Input) (cldf.ChangesetOutput, error)\n```\n\n```go\nfunc (Changeset) VerifyPreconditions(env cldf.Environment, input Input) error\n```\n\n```go\ntype Deps struct {\n\tBlockChains chain.BlockChains\n\tDataStore   cldfdatastore.DataStore\n}\n```\nDeps is the read-only dependency bundle available to every family sequence. Logger and context come from the operations.Bundle passed at execution time.\n\n```go\ntype Input struct {\n\tConfigByChain map[uint64]cldfproposalutils.MCMSWithTimelockConfig\n}\n```\nInput configures MCMS with timelock deployment per chain selector.\n\n```go\ntype Registration = familyregistry.Registration[Sequence, ChainInput]\n```\nRegistration describes one chain family's MCMS deploy implementation. Its Sequence executes the per-chain deploy and returns newly deployed addresses via OnChainOutput.Metadata.Addresses.\n\n```go\ntype Sequence = operations.Sequence[ChainInput, sequenceutils.OnChainOutput, Deps]\n```\nSequence is the required operations sequence type for all family implementations.\n\n","path":"github.com/smartcontractkit/cld-changesets/mcms/changesets/deploy","name":"deploy","synopsis":"Package deploy provides the DeployMCMSWithTimelock changeset and a registry for per-chain-family deploy implementations.","isRedistributable":true}
