evmsetconfig

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OpEVMSetConfigMCM = operations.NewOperation(
	"evm-mcm-set-config",
	semver.MustParse("1.0.0"),
	"Sets MCMS config on an EVM MCM contract",
	func(b operations.Bundle, deps cldf_evm.Chain, in OpEVMSetConfigInput) (opscontract.WriteOutput, error) {
		if !in.NoSend && deps.DeployerKey == nil {
			return opscontract.WriteOutput{}, fmt.Errorf("missing deployer key for chain %d", deps.Selector)
		}

		var opts *bind.TransactOpts
		if in.NoSend {
			opts = cldf.SimTransactOpts()
		} else {
			opts = gasboost.CloneTransactOptsWithGas(deps.DeployerKey, in.GasLimit, in.GasPrice)
		}
		if opts == nil {
			return opscontract.WriteOutput{}, fmt.Errorf("failed to build transact opts for chain %d", deps.Selector)
		}
		opts.Context = b.GetContext()

		configurer := mcmsevm.NewConfigurer(deps.Client, opts)
		res, err := configurer.SetConfig(b.GetContext(), in.Target.Address.Hex(), &in.Target.Config, false)
		if err != nil {
			return opscontract.WriteOutput{}, fmt.Errorf("failed to set config on %s: %w", in.Target.Address, err)
		}

		tx, ok := res.RawData.(*types.Transaction)
		if !ok {
			return opscontract.WriteOutput{}, fmt.Errorf("unexpected raw data type %T from SetConfig", res.RawData)
		}

		out := writeOutputFromSetConfig(deps.Selector, in.Target, tx)
		if in.NoSend {
			return out, nil
		}

		if _, err = cldf.ConfirmIfNoErrorWithABI(deps, tx, mcmsbindings.ManyChainMultiSigABI, err); err != nil {
			return opscontract.WriteOutput{}, fmt.Errorf("failed to confirm set config tx against %s: %w", in.Target.Address, err)
		}
		b.Logger.Infow("SetConfig tx confirmed", "txHash", res.Hash, "address", in.Target.Address.Hex())

		out.ExecInfo = &opscontract.ExecInfo{Hash: res.Hash}

		return out, nil
	},
)

OpEVMSetConfigMCM sets MCMS config on an EVM MCM contract via the MCMS SDK configurer.

Functions

func Registration

func Registration() setconfig.Registration

Registration returns the EVM chain-family set-config registration.

Types

type MCMSetConfigTarget

type MCMSetConfigTarget struct {
	Address      common.Address    `json:"address"`
	Config       mcmstypes.Config  `json:"config"`
	ContractType cldf.ContractType `json:"contractType"`
}

MCMSetConfigTarget identifies one MCM contract and the config to apply.

type OpEVMSetConfigInput

type OpEVMSetConfigInput struct {
	Target   MCMSetConfigTarget `json:"target"`
	NoSend   bool               `json:"noSend"`
	GasPrice uint64             `json:"gasPrice"`
	GasLimit uint64             `json:"gasLimit"`
}

OpEVMSetConfigInput is the input for setting config on a single EVM MCM contract.

func (OpEVMSetConfigInput) GasBoostValues

func (in OpEVMSetConfigInput) GasBoostValues() (gasLimit, gasPrice uint64)

func (OpEVMSetConfigInput) WithGasBoost

func (in OpEVMSetConfigInput) WithGasBoost(gasLimit, gasPrice uint64) OpEVMSetConfigInput

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL