operations

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OpEVMDeployBypasserMCM = NewEVMDeployOperation(
	"evm-bypasser-mcm-deploy",
	semver.MustParse("1.0.0"),
	"Deploys Bypasser MCM contract",
	mcmscontracts.BypasserManyChainMultisig,
	bindings.ManyChainMultiSigMetaData,
	&ContractOpts{
		Version:          &cldchangesetscommon.Version1_0_0,
		EVMBytecode:      common.FromHex(bindings.ManyChainMultiSigBin),
		ZkSyncVMBytecode: zkbindings.ManyChainMultiSigZkBytecode,
	},
	func(input any) []any {
		return []any{}
	},
)
View Source
var OpEVMDeployCallProxy = NewEVMDeployOperation(
	"evm-call-proxy-deploy",
	semver.MustParse("1.0.0"),
	"Deploys CallProxy contract on the specified EVM chains",
	mcmscontracts.CallProxy,
	bindings.CallProxyMetaData,
	&ContractOpts{
		Version:          &cldchangesetscommon.Version1_0_0,
		EVMBytecode:      common.FromHex(bindings.CallProxyBin),
		ZkSyncVMBytecode: zkbindings.CallProxyZkBytecode,
	},
	func(input OpEVMDeployCallProxyInput) []any {
		return []any{
			input.Timelock,
		}
	},
)
View Source
var OpEVMDeployCancellerMCM = NewEVMDeployOperation(
	"evm-canceller-mcm-deploy",
	semver.MustParse("1.0.0"),
	"Deploys Canceller MCM contract",
	mcmscontracts.CancellerManyChainMultisig,
	bindings.ManyChainMultiSigMetaData,
	&ContractOpts{
		Version:          &cldchangesetscommon.Version1_0_0,
		EVMBytecode:      common.FromHex(bindings.ManyChainMultiSigBin),
		ZkSyncVMBytecode: zkbindings.ManyChainMultiSigZkBytecode,
	},
	func(input any) []any {
		return []any{}
	},
)
View Source
var OpEVMDeployProposerMCM = NewEVMDeployOperation(
	"evm-proposer-mcm-deploy",
	semver.MustParse("1.0.0"),
	"Deploys Proposer MCM contract",
	mcmscontracts.ProposerManyChainMultisig,
	bindings.ManyChainMultiSigMetaData,
	&ContractOpts{
		Version:          &cldchangesetscommon.Version1_0_0,
		EVMBytecode:      common.FromHex(bindings.ManyChainMultiSigBin),
		ZkSyncVMBytecode: zkbindings.ManyChainMultiSigZkBytecode,
	},
	func(input any) []any {
		return []any{}
	},
)
View Source
var OpEVMDeployTimelock = NewEVMDeployOperation(
	"evm-timelock-deploy",
	semver.MustParse("1.0.0"),
	"Deploys Timelock contract on the specified EVM chains",
	mcmscontracts.RBACTimelock,
	bindings.RBACTimelockMetaData,
	&ContractOpts{
		Version:          &cldchangesetscommon.Version1_0_0,
		EVMBytecode:      common.FromHex(bindings.RBACTimelockBin),
		ZkSyncVMBytecode: zkbindings.RBACTimelockZkBytecode,
	},
	func(input OpEVMDeployTimelockInput) []any {
		return []any{
			input.TimelockMinDelay,
			input.Admin,
			input.Proposers,
			input.Executors,
			input.Cancellers,
			input.Bypassers,
		}
	},
)
View Source
var OpEVMGrantRole = NewEVMCallOperation(
	"evm-timelock-grant-role",
	semver.MustParse("1.0.0"),
	"Grants specified role to the ManyChainMultiSig contract on the EVM Timelock contract",
	bindings.RBACTimelockABI,
	mcmscontracts.RBACTimelock,
	bindings.NewRBACTimelock,
	func(timelock *bindings.RBACTimelock, opts *bind.TransactOpts, input OpEVMGrantRoleInput) (*types.Transaction, error) {
		return timelock.GrantRole(opts, input.RoleID, input.Account)
	},
)
View Source
var OpEVMSetConfigMCM = NewEVMCallOperation(
	"evm-mcm-set-config",
	semver.MustParse("1.0.0"),
	"Sets Config on the deployed MCM contract",
	bindings.ManyChainMultiSigABI,
	mcmscontracts.ManyChainMultisig,
	bindings.NewManyChainMultiSig,
	func(mcm *bindings.ManyChainMultiSig, opts *bind.TransactOpts, input OpEVMSetConfigMCMInput) (*types.Transaction, error) {
		return mcm.SetConfig(
			opts,
			input.SignerAddresses,
			input.SignerGroups,
			input.GroupQuorums,
			input.GroupParents,
			false,
		)
	})

Functions

func AddEVMCallSequenceToCSOutput

func AddEVMCallSequenceToCSOutput[IN any](
	e cldf.Environment,
	csOutput cldf.ChangesetOutput,
	seqReport operations.SequenceReport[IN, map[uint64][]EVMCallOutput],
	seqErr error,
	mcmsStateByChain map[uint64]evmstate.MCMSWithTimelockState,
	mcmsCfg *cldfproposalutils.TimelockConfig,
	mcmsDescription string,
) (cldf.ChangesetOutput, error)

AddEVMCallSequenceToCSOutput updates the ChangesetOutput with the results of an EVM call sequence. It appends the execution reports from the sequence report to the ChangesetOutput's reports. If the sequence execution was successful and MCMS configuration is provided, it adds a proposal to the output.

func CloneTransactOptsWithGas

func CloneTransactOptsWithGas(opts *bind.TransactOpts, gasLimit uint64, gasPrice uint64) *bind.TransactOpts

cloneTransactOptsWithGas ensures that we don't impact the transact opts used by other operations.

func GasBoostConfigsForChainMap

func GasBoostConfigsForChainMap[T any](chainMap map[uint64]T, gasBoostConfigs map[uint64]cldfproposalutils.GasBoostConfig) map[uint64]*cldfproposalutils.GasBoostConfig

GasBoostConfigsForChainMap creates a map of GasBoostConfig pointers for each chain in the provided chainMap. If a chain selector exists in gasBoostConfigs, it uses that config; otherwise, it sets nil.

func GetBoostedGasForAttempt

func GetBoostedGasForAttempt(cfg cldfproposalutils.GasBoostConfig, attempt uint) (gasLimit uint64, gasPrice uint64)

func NewEVMCallOperation

func NewEVMCallOperation[IN any, C any](
	name string,
	version *semver.Version,
	description string,
	abi string,
	contractType cldf.ContractType,
	constructor func(address common.Address, backend bind.ContractBackend) (C, error),
	call func(contract C, opts *bind.TransactOpts, input IN) (*types.Transaction, error),
) *operations.Operation[EVMCallInput[IN], EVMCallOutput, cldf_evm.Chain]

NewEVMCallOperation creates a new operation that performs an EVM call. Any interfacing with gethwrappers should happen in the call function.

func NewEVMDeployOperation

func NewEVMDeployOperation[IN any](
	name string,
	version *semver.Version,
	description string,
	contractType cldf.ContractType,
	contractMetadata *bind.MetaData,
	defaultContractOpts *ContractOpts,
	makeArgs func(IN) []any,
) *operations.Operation[EVMDeployInput[IN], EVMDeployOutput, cldf_evm.Chain]

NewEVMDeployOperation creates a new operation that deploys an EVM contract. Any interfacing with gethwrappers should happen in the deploy function.

func RetryCallWithGasBoost

RetryCallWithGasBoost is an ExecuteOption that retries EVM calls with gas boosting. It uses the provided GasBoostConfig to adjust the gas limit and gas price on each retry attempt. If NoSend is true, it will not apply gas boosting since the transaction is never sent.

func RetryDeploymentWithGasBoost

func RetryDeploymentWithGasBoost[IN any](cfg *cldfproposalutils.GasBoostConfig) operations.ExecuteOption[EVMDeployInput[IN], cldf_evm.Chain]

RetryDeploymentWithGasBoost is an ExecuteOption that retries EVM deployments with gas boosting. It uses the provided GasBoostConfig to adjust the gas limit and gas price on each retry attempt.

Types

type ContractOpts

type ContractOpts struct {
	Version          *semver.Version
	EVMBytecode      []byte
	ZkSyncVMBytecode []byte
}

ContractOpts specify the exact bytecode and version of the contract to deploy. Deployment operations must define defaults for these options in case users do not provide them. These options allow operators to deploy new bytecodes for the same ABI.

func (*ContractOpts) Validate

func (c *ContractOpts) Validate(isZkSyncVM bool) error

type EVMCallInput

type EVMCallInput[IN any] struct {
	// Address is the address of the contract to call.
	Address common.Address `json:"address"`
	// ChainSelector is the selector for the chain on which the contract resides.
	ChainSelector uint64 `json:"chainSelector"`
	// CallInput is the input data for the call.
	CallInput IN `json:"callInput"`
	// NoSend indicates whether or not the transaction should be sent.
	// If true, the transaction data be prepared and returned but not sent.
	NoSend bool `json:"noSend"`
	// GasPrice is a custom gas price to set for the transaction.
	GasPrice uint64 `json:"gasPrice"`
	// GasLimit is a custom gas limit to set for the transaction.
	GasLimit uint64 `json:"gasLimit"`
}

EVMCallInput is the input structure for an EVM call operation. Why not pull the chain selector from the chain dependency? Because addresses might be the same across chains and we need to differentiate them. This ensures no false report matches between operation runs that have the same call input and address but a different target chain.

type EVMCallOutput

type EVMCallOutput struct {
	// To is the address that initiated the transaction.
	To common.Address `json:"to"`
	// Data is the transaction data
	Data []byte `json:"data"`
	// ContractType is the type of contract that is being called.
	ContractType cldf.ContractType `json:"contractType"`
	// Confirmed indicates whether or not the transaction was confirmed.
	Confirmed bool `json:"confirmed"`
}

EVMCallOutput is the output structure for an EVM call operation. It contains the transaction and the type of contract that is being called.

type EVMDeployInput

type EVMDeployInput[IN any] struct {
	// ChainSelector is the selector for the chain on which the contract will be deployed.
	ChainSelector uint64 `json:"chainSelector"`
	// DeployInput is the input data for the call.
	DeployInput IN `json:"deployInput"`
	// GasPrice is a custom gas price to set for the transaction.
	GasPrice uint64 `json:"gasPrice"`
	// GasLimit is a custom gas limit to set for the transaction.
	GasLimit uint64 `json:"gasLimit"`
	// Qualifier is an optional qualifier for the deployment.
	Qualifier *string `json:"qualifier"`
	// ContractOpts (optional) further configure the deployment with a specific bytecode and version.
	ContractOpts *ContractOpts `json:"contractOpts"`
}

EVMDeployInput is the input structure for an EVM deploy operation.

type EVMDeployOutput

type EVMDeployOutput struct {
	// Address is the address of the deployed contract.
	Address common.Address `json:"address"`
	// TypeAndVersion is the type and version of the contract that was deployed.
	TypeAndVersion string `json:"typeAndVersion"`
	// Qualifier is an optional qualifier for the deployment.
	Qualifier *string `json:"qualifier"`
}

EVMDeployOutput is the output structure for an EVM deploy operation. It contains the new address, the deployment transaction, and the type and version of the contract that was deployed.

type OpEVMDeployCallProxyInput

type OpEVMDeployCallProxyInput struct {
	Timelock common.Address `json:"timelock"`
}

type OpEVMDeployMCMOutput

type OpEVMDeployMCMOutput struct {
	Address common.Address `json:"address"`
}

type OpEVMDeployTimelockInput

type OpEVMDeployTimelockInput struct {
	TimelockMinDelay *big.Int         `json:"timelockMinDelay"`
	Admin            common.Address   `json:"admin"`      // Admin of the timelock contract, usually the deployer key
	Proposers        []common.Address `json:"proposers"`  // Proposer of the timelock contract, usually the deployer key
	Executors        []common.Address `json:"executors"`  // Executor of the timelock contract, usually the call proxy
	Cancellers       []common.Address `json:"cancellers"` // Canceller of the timelock contract, usually the deployer key
	Bypassers        []common.Address `json:"bypassers"`  // Bypasser of the timelock contract, usually the deployer key
}

type OpEVMGrantRoleInput

type OpEVMGrantRoleInput struct {
	Account common.Address `json:"account"`
	RoleID  [32]byte       `json:"roleID"`
}

type OpEVMSetConfigMCMInput

type OpEVMSetConfigMCMInput struct {
	SignerAddresses []common.Address `json:"signerAddresses"`
	SignerGroups    []uint8          `json:"signerGroups"` // Signer 1 is int group 0 (root group) with quorum 1.
	GroupQuorums    [32]uint8        `json:"groupQuorums"`
	GroupParents    [32]uint8        `json:"groupParents"`
}

Jump to

Keyboard shortcuts

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