func (c *factory) Deploy(ctx context.Context, issuer common.Address, defaultHardDepositTimeoutDuration *big.Int, nonce common.Hash) (common.Hash, error) {
	callData, err := factoryABI.Pack("deploySimpleSwap", issuer, big.NewInt(0).Set(defaultHardDepositTimeoutDuration), nonce)
	if err != nil {
		return common.Hash{}, err
	}
	request := &transaction.TxRequest{
		To:          &c.address,
		Data:        callData,
		GasPrice:    sctx.GetGasPrice(ctx),
		GasLimit:    175000,
		Value:       big.NewInt(0),
		Description: "chequebook deployment",
	}
	txHash, err := c.transactionService.Send(ctx, request)
	if err != nil {
		return common.Hash{}, err
	}
	return txHash, nil
}
Deploy deploys a new chequebook and returns once the transaction has been submitted.
package chequebook
import (
	"bytes"
	"errors"
	"fmt"
	"math/big"
	"github.com/ethereum/go-ethereum/accounts/abi"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethersphere/go-sw3-abi/sw3abi"
	"github.com/ethsana/sana/pkg/sctx"
	"github.com/ethsana/sana/pkg/transaction"
	"golang.org/x/net/context"
)
var (
	ErrInvalidFactory       = errors.New("not a valid factory contract")
	ErrNotDeployedByFactory = errors.New("chequebook not deployed by factory")
	errDecodeABI            = errors.New("could not decode abi data")
	factoryABI                  = transaction.ParseABIUnchecked(sw3abi.SimpleSwapFactoryABIv0_4_0)
	simpleSwapDeployedEventType = factoryABI.Events["SimpleSwapDeployed"]
)
type Factory interface {
	ERC20Address(ctx context.Context) (common.Address, error)
	Deploy(ctx context.Context, issuer common.Address, defaultHardDepositTimeoutDuration *big.Int, nonce common.Hash) (common.Hash, error)
	WaitDeployed(ctx context.Context, txHash common.Hash) (common.Address, error)
	VerifyBytecode(ctx context.Context) error
	VerifyChequebook(ctx context.Context, chequebook common.Address) error
}
type factory struct {
	backend            transaction.Backend
	transactionService transaction.Service
	address            common.Address    
	legacyAddresses    []common.Address  
}
type simpleSwapDeployedEvent struct {
	ContractAddress common.Address
}
var currentDeployVersion []byte = common.FromHex(sw3abi.SimpleSwapFactoryDeployedBinv0_4_0)
var supportedVersions = [][]byte{
	currentDeployVersion,
	common.FromHex(sw3abi.SimpleSwapFactoryDeployedBinv0_3_1),
}
func NewFactory(backend transaction.Backend, transactionService transaction.Service, address common.Address, legacyAddresses []common.Address) Factory {
	return &factory{
		backend:            backend,
		transactionService: transactionService,
		address:            address,
		legacyAddresses:    legacyAddresses,
	}
}