Documentation ¶
Overview ¶
Package testutil is used for deploying test contracts and generic testing functions
Index ¶
- Constants
- Variables
- func NewBridgeConfigV3Deployer(registry deployer.GetOnlyContractRegistry, ...) deployer.ContractDeployer
- func NewMessageBusDeployer(registry deployer.GetOnlyContractRegistry, ...) deployer.ContractDeployer
- func NewSwapFlashLoanDeployer(registry deployer.GetOnlyContractRegistry, ...) deployer.ContractDeployer
- func NewSynapseBridgeDeployer(registry deployer.GetOnlyContractRegistry, ...) deployer.ContractDeployer
- func NewSynapseBridgeV1Deployer(registry deployer.GetOnlyContractRegistry, ...) deployer.ContractDeployer
- type BridgeConfigV3Deployer
- type DeployManager
- func (d *DeployManager) GetBridgeConfigV3(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *bridgeconfig.BridgeConfigRef)
- func (d *DeployManager) GetMessageBus(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *messagebus.MessageBusRef)
- func (d *DeployManager) GetSwapFlashLoan(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *swap.SwapRef)
- func (d *DeployManager) GetSynapseBridge(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *bridge.BridgeRef)
- func (d *DeployManager) GetSynapseBridgeV1(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *bridgev1.BridgeRef)
- type MessageBusDeployer
- type SwapFlashLoanDeployer
- type SynapseBridgeDeployer
- type SynapseBridgeV1Deployer
Constants ¶
const ( // BridgeConfigTypeV3 is the bridge config contract type. BridgeConfigTypeV3 contractTypeImpl = iota // SynapseBridgeType is the bridge contract type. SynapseBridgeType // SwapFlashLoanType is the swap contract type. SwapFlashLoanType // SynapseBridgeV1Type is the swap contract type. SynapseBridgeV1Type // MessageBusType is the messagebus contract type. MessageBusType )
Variables ¶
var AllContractTypes []contractTypeImpl
AllContractTypes is a list of all contract types. Since we use stringer and this is a testing library, instead of manually copying all these out we pull the names out of stringer. In order to make sure stringer is updated, we panic on any method called where the index is higher than the stringer array length.
Functions ¶
func NewBridgeConfigV3Deployer ¶
func NewBridgeConfigV3Deployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer
NewBridgeConfigV3Deployer creates a new bridge config v2 client.
func NewMessageBusDeployer ¶ added in v0.0.19
func NewMessageBusDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer
NewMessageBusDeployer creates a new message bus client.
func NewSwapFlashLoanDeployer ¶
func NewSwapFlashLoanDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer
NewSwapFlashLoanDeployer creates a new bridge config v2 client.
func NewSynapseBridgeDeployer ¶
func NewSynapseBridgeDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer
NewSynapseBridgeDeployer creates a new bridge config v2 client.
func NewSynapseBridgeV1Deployer ¶ added in v0.0.15
func NewSynapseBridgeV1Deployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer
NewSynapseBridgeV1Deployer creates a new bridge config v2 client.
Types ¶
type BridgeConfigV3Deployer ¶
type BridgeConfigV3Deployer struct {
*deployer.BaseDeployer
}
BridgeConfigV3Deployer is the type of the bridge config v3 deployer.
func (BridgeConfigV3Deployer) Deploy ¶
func (n BridgeConfigV3Deployer) Deploy(ctx context.Context) (contracts.DeployedContract, error)
Deploy deploys bridge config v3 contract
type DeployManager ¶
type DeployManager struct {
*manager.DeployerManager
}
DeployManager wraps DeployManager and allows typed contract handles to be returned.
func NewDeployManager ¶
func NewDeployManager(t *testing.T) *DeployManager
NewDeployManager creates a deploy manager.
func NewTestEnvDB ¶
func NewTestEnvDB(ctx context.Context, t *testing.T) (db db.ConsumerDB, eventDB scribedb.EventDB, gqlClient *client.Client, logIndex atomic.Int64, cleanup func(), testBackend backends.SimulatedTestBackend, deployManager *DeployManager)
NewTestEnvDB sets up the test env with a database.
func (*DeployManager) GetBridgeConfigV3 ¶
func (d *DeployManager) GetBridgeConfigV3(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *bridgeconfig.BridgeConfigRef)
GetBridgeConfigV3 gets a typecast bridgeconfig contract.
func (*DeployManager) GetMessageBus ¶ added in v0.0.19
func (d *DeployManager) GetMessageBus(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *messagebus.MessageBusRef)
GetMessageBus gets a typecast message bus contract.
func (*DeployManager) GetSwapFlashLoan ¶
func (d *DeployManager) GetSwapFlashLoan(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *swap.SwapRef)
GetSwapFlashLoan gets a typecast swap contract.
func (*DeployManager) GetSynapseBridge ¶
func (d *DeployManager) GetSynapseBridge(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *bridge.BridgeRef)
GetSynapseBridge gets a typecast bridge contract.
func (*DeployManager) GetSynapseBridgeV1 ¶ added in v0.0.15
func (d *DeployManager) GetSynapseBridgeV1(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *bridgev1.BridgeRef)
GetSynapseBridgeV1 gets a typecast bridge v1 contract.
type MessageBusDeployer ¶ added in v0.0.19
type MessageBusDeployer struct {
*deployer.BaseDeployer
}
MessageBusDeployer is the type of the message bus deployer.
func (MessageBusDeployer) Deploy ¶ added in v0.0.19
func (n MessageBusDeployer) Deploy(ctx context.Context) (contracts.DeployedContract, error)
Deploy deploys Message Bus contract
type SwapFlashLoanDeployer ¶
type SwapFlashLoanDeployer struct {
*deployer.BaseDeployer
}
SwapFlashLoanDeployer is the type of the swap flash loan deployer.
func (SwapFlashLoanDeployer) Deploy ¶
func (n SwapFlashLoanDeployer) Deploy(ctx context.Context) (contracts.DeployedContract, error)
Deploy deploys Swap Flash Loan contract
type SynapseBridgeDeployer ¶
type SynapseBridgeDeployer struct {
*deployer.BaseDeployer
}
SynapseBridgeDeployer is the type of the bridge deployer.
func (SynapseBridgeDeployer) Deploy ¶
func (n SynapseBridgeDeployer) Deploy(ctx context.Context) (contracts.DeployedContract, error)
Deploy deploys Synapse Bridge contract
type SynapseBridgeV1Deployer ¶ added in v0.0.15
type SynapseBridgeV1Deployer struct {
*deployer.BaseDeployer
}
SynapseBridgeV1Deployer is the type of the swap flash loan deployer.
func (SynapseBridgeV1Deployer) Deploy ¶ added in v0.0.15
func (n SynapseBridgeV1Deployer) Deploy(ctx context.Context) (contracts.DeployedContract, error)
Deploy deploys Synapse Bridge V1 contract
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package clickhouse spins up a temp clickhouse db with docker.
|
Package clickhouse spins up a temp clickhouse db with docker. |
Package testcontracts provides a set of test contracts for use in tests.
|
Package testcontracts provides a set of test contracts for use in tests. |