contractdeployer

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

README

Contract deployer

Deploys contracts to both the ten network (L2) and eth network (L1)

Usage

All commands are executed by running contractdeployer/main/main().

Contract is a string value to select the contract bytecode to deploy, currently ERC20, and MGMT are supported:

  • ERC20: a standard ERC20 contract
  • MGMT: the Ten L1 management contract
  • Example arguments to deploy an L2 contract:

    --nodeHost=<x> --nodePort=<x> --privateKey=<x> --contract=ERC20

  • Example arguments to deploy an L1 contract:

    --nodeHost=<x> --nodePort=<x> --privateKey=<x> --contract=MGMT

Documentation

Index

Constants

View Source
const (
	Layer2Erc20Contract = "Layer2ERC20"
)

The types of contracts supported by the deployer

View Source
const (
	Prealloc = 2_050_000_000_000_000_000 // The amount preallocated to the contract deployer wallet.
)

Variables

This section is empty.

Functions

func Deploy

func Deploy(config *Config, logger gethlog.Logger) (string, error)

Deploy deploys the contract specified in the config, and returns its deployed address.

Types

type Config

type Config struct {
	NodeHost          string   // host for the client connection
	NodePort          uint     // port for client connection
	IsL1Deployment    bool     // flag for L1/Eth contract deployment (rather than Obscuro/L2 deployment)
	PrivateKey        string   // private key to be used for the contract deployer address
	ChainID           *big.Int // chain ID we're deploying too
	ContractName      string   // the name of the contract to deploy (e.g. ERC20 or MGMT)
	ConstructorParams []string // parameters sent to the constructor
}

Config is the structure that a contract deployer config is parsed into.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig stores the contract client default config

func ParseConfig

func ParseConfig() *Config

ParseConfig returns a Config after parsing all available flags

type EthDeployer

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

func (*EthDeployer) Nonce

func (e *EthDeployer) Nonce(address common.Address) (uint64, error)

func (*EthDeployer) SendTransaction

func (e *EthDeployer) SendTransaction(tx *types.Transaction) error

func (*EthDeployer) TransactionReceipt

func (e *EthDeployer) TransactionReceipt(hash common.Hash) (*types.Receipt, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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