manager

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 9 Imported by: 8

Documentation

Overview

Package manager manages deployers to make them as simple as possible

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertDependenciesCorrect added in v0.0.49

func AssertDependenciesCorrect(ctx context.Context, t *testing.T, deployManagerFactory DeployManagerFactory)

AssertDependenciesCorrect asserts that all dependencies of contracts are correct.

func GetContract added in v0.0.54

func GetContract[T any](ctx context.Context, tb testing.TB, deployManager IDeployManager, backend backends.SimulatedTestBackend, contractType contracts.ContractType) (contracts.DeployedContract, T)

GetContract gets a contract from the registry and casts it to the correct type.

Types

type DeployManagerFactory added in v0.0.49

type DeployManagerFactory func() IDeployManager

DeployManagerFactory is a factory for a deploy manager.

type DeployerFunc

type DeployerFunc = deployer.DeployerFunc

DeployerFunc defines a deployer we can use. Deprecated: use deployer.DeployerFunc instead.

type DeployerManager

type DeployerManager struct {
	// contains filtered or unexported fields
}

DeployerManager is responsible for wrapping contract registry with easy to use getters that correctly cast the handles. since ContractRegistry is meant to be kept pure and go does not support generics, the sole function is to provide handler wrappers around the registry. This will no longer be required when go supports generics: https://blog.golang.org/generics-proposal TODO: go 1.20 supports generics, this can be improved.

func NewDeployerManager

func NewDeployerManager(t *testing.T, deployers ...deployer.DeployerFunc) (d *DeployerManager)

NewDeployerManager creates a new deployment helper.

func (*DeployerManager) BulkDeploy

func (d *DeployerManager) BulkDeploy(ctx context.Context, testBackends []backends.SimulatedTestBackend, contracts ...contracts.ContractType)

BulkDeploy synchronously deploys a bunch of contracts as quickly as possible to speed up tests. in a future version this will utilize dependency trees. Returns nothing when complete.

func (*DeployerManager) Get

Get gets the contract from the registry.

func (*DeployerManager) GetContractRegistry

func (d *DeployerManager) GetContractRegistry(backend backends.SimulatedTestBackend) deployer.ContractRegistry

GetContractRegistry gets a contract registry for a backend and creates it if it does not exist.

func (*DeployerManager) GetDeployedContracts added in v0.0.42

func (d *DeployerManager) GetDeployedContracts() (res map[uint32][]contracts.DeployedContract)

GetDeployedContracts gets all deployed contracts by domain.

func (*DeployerManager) SetT

func (d *DeployerManager) SetT(t *testing.T)

SetT sets the testing object.

func (*DeployerManager) T

func (d *DeployerManager) T() *testing.T

T is the testing object.

type IDeployManager added in v0.0.49

type IDeployManager interface {
	// T returns the testing object.
	T() *testing.T
	// SetT sets the testing object.
	SetT(t *testing.T)
	// BulkDeploy deploys all contracts.
	BulkDeploy(ctx context.Context, testBackends []backends.SimulatedTestBackend, contracts ...contracts.ContractType)
	// GetContractRegistry returns the contract registry for the given backend.
	GetContractRegistry(backend backends.SimulatedTestBackend) deployer.ContractRegistry
	// Get returns the deployed contract for the given contract type.
	Get(ctx context.Context, backend backends.SimulatedTestBackend, contractType contracts.ContractType) contracts.DeployedContract
	// GetDeployedContracts returns all deployed contracts.
	GetDeployedContracts() (res map[uint32][]contracts.DeployedContract)
}

IDeployManager is responsible for deploying contracts.

Jump to

Keyboard shortcuts

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