Documentation ¶
Overview ¶
Package manager manages deployers to make them as simple as possible
Index ¶
- func AssertDependenciesCorrect(ctx context.Context, t *testing.T, deployManagerFactory DeployManagerFactory)
- func GetContract[T any](ctx context.Context, tb testing.TB, deployManager IDeployManager, ...) (contracts.DeployedContract, T)
- type DeployManagerFactory
- type DeployerFunc
- type DeployerManager
- func (d *DeployerManager) BulkDeploy(ctx context.Context, testBackends []backends.SimulatedTestBackend, ...)
- func (d *DeployerManager) Get(ctx context.Context, backend backends.SimulatedTestBackend, ...) contracts.DeployedContract
- func (d *DeployerManager) GetContractRegistry(backend backends.SimulatedTestBackend) deployer.ContractRegistry
- func (d *DeployerManager) GetDeployedContracts() (res map[uint32][]contracts.DeployedContract)
- func (d *DeployerManager) SetT(t *testing.T)
- func (d *DeployerManager) T() *testing.T
- type IDeployManager
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 func(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer
DeployerFunc defines a deployer we can use.
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.19 supports generics, this can be improved.
func NewDeployerManager ¶
func NewDeployerManager(t *testing.T, deployers ...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 ¶
func (d *DeployerManager) Get(ctx context.Context, backend backends.SimulatedTestBackend, contractType contracts.ContractType) contracts.DeployedContract
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.
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.