types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MainNet = Network(1)
	TestNet = Network(5)
)
View Source
const (
	Root  = NetworkType(1)
	Child = NetworkType(2)
)
View Source
const (
	ERC20Transfer              = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
	ERC721Transfer             = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
	ERC1155Transfer            = "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62"
	ERC721BatchTransfer        = "0xf871896b17e9cb7a64941c62c188a4f5c621b86800e3d15452ece01ce56073df"
	ERC1155BatchTransfer       = "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb"
	ERC721TransferWithMetadata = "0xf94915c6d1fd521cee85359239227480c7e8776d7caf1fc3bacad5c269b66a14"
)
View Source
const (
	PanicLevel log.Level = iota
	FatalLevel
	ErrorLevel
	WarnLevel
	InfoLevel
	DebugLevel
	TraceLevel
)
View Source
const (
	ERC20   = TokenType(1)
	ERC721  = TokenType(2)
	ERC1155 = TokenType(3)
)
View Source
const (
	LegacyTxType = iota
	AccessListTxType
	DynamicFeeTxType
)
View Source
const MainNetContractURL = `https://static.matic.network/network/mainnet/v1/index.json`
View Source
const MaticAddress = "0x0000000000000000000000000000000000001010"
View Source
const TestNetContractURL = `https://static.matic.network/network/testnet/mumbai/index.json`

Variables

View Source
var (
	EmptyPrivateKey = fmt.Errorf("empty private key")
	EmptyTxOption   = fmt.Errorf("tx option is nil")
)

Functions

func ValidateTxOption added in v0.0.9

func ValidateTxOption(txOption *TxOption) error

Types

type ChildConfig

type ChildConfig struct {
	Rpc string
}

type ChildContracts added in v0.1.0

type ChildContracts struct {
	EIP1559Burn string `json:"EIP1559Burn"`
	ChildChain  string `json:"ChildChain"`
	Tokens      struct {
		MaticWeth  string `json:"MaticWeth"`
		MaticToken string `json:"MaticToken"`
		TestToken  string `json:"TestToken"`
		RootERC721 string `json:"RootERC721"`
		Wmatic     string `json:"WMATIC"`
	} `json:"Tokens"`
}

type Contract added in v0.1.0

type Contract struct {
	Main struct {
		NetworkName       string                `json:"NetworkName"`
		ChainID           int                   `json:"ChainId"`
		DaggerEndpoint    string                `json:"DaggerEndpoint"`
		WatcherAPI        string                `json:"WatcherAPI"`
		StakingAPI        string                `json:"StakingAPI"`
		Explorer          string                `json:"Explorer"`
		SubgraphURL       string                `json:"SubgraphUrl"`
		SupportsEIP1559   bool                  `json:"SupportsEIP1559"`
		Owner             string                `json:"Owner"`
		Contracts         RootContracts         `json:"Contracts"`
		POSContracts      POSRootContracts      `json:"POSContracts"`
		FxPortalContracts FxPortalRootContracts `json:"FxPortalContracts"`
	} `json:"Main"`
	Matic struct {
		NetworkName       string                 `json:"NetworkName"`
		ChainID           int                    `json:"ChainId"`
		RPC               string                 `json:"RPC"`
		DaggerEndpoint    string                 `json:"DaggerEndpoint"`
		Explorer          string                 `json:"Explorer"`
		NetworkAPI        string                 `json:"NetworkAPI"`
		SupportsEIP1559   bool                   `json:"SupportsEIP1559"`
		Contracts         ChildContracts         `json:"Contracts"`
		POSContracts      POSChildContracts      `json:"POSContracts"`
		FxPortalContracts FxPortalChildContracts `json:"FxPortalContracts"`
		GenesisContracts  GenesisChildContracts  `json:"GenesisContracts"`
	} `json:"Matic"`
	Heimdall struct {
		ChainID string `json:"ChainId"`
		API     string `json:"API"`
	} `json:"Heimdall"`
}

func (Contract) ChildConfig added in v0.1.0

func (c Contract) ChildConfig(rpc string) ChildConfig

func (Contract) RootConfig added in v0.1.0

func (c Contract) RootConfig(rpc string) RootConfig

type DebugConfig

type DebugConfig struct {
	Enable bool
	Level  log.Level
}

type FxPortalChildContracts added in v0.1.0

type FxPortalChildContracts struct {
	FxChild                      string `json:"FxChild"`
	FxERC20ChildTunnel           string `json:"FxERC20ChildTunnel"`
	FxERC721ChildTunnel          string `json:"FxERC721ChildTunnel"`
	FxERC1155ChildTunnel         string `json:"FxERC1155ChildTunnel"`
	FxMintableERC20ChildTunnel   string `json:"FxMintableERC20ChildTunnel"`
	FxMintableERC721ChildTunnel  string `json:"FxMintableERC721ChildTunnel"`
	FxMintableERC1155ChildTunnel string `json:"FxMintableERC1155ChildTunnel"`
}

type FxPortalRootContracts added in v0.1.0

type FxPortalRootContracts struct {
	FxRoot                      string `json:"FxRoot"`
	FxERC20RootTunnel           string `json:"FxERC20RootTunnel"`
	FxERC721RootTunnel          string `json:"FxERC721RootTunnel"`
	FxERC1155RootTunnel         string `json:"FxERC1155RootTunnel"`
	FxMintableERC20RootTunnel   string `json:"FxMintableERC20RootTunnel"`
	FxMintableERC721RootTunnel  string `json:"FxMintableERC721RootTunnel"`
	FxMintableERC1555RootTunnel string `json:"FxMintableERC1555RootTunnel"`
	Tokens                      struct {
		FxERC20Root   string `json:"FxERC20Root"`
		FxERC721Root  string `json:"FxERC721Root"`
		FxERC1155Root string `json:"FxERC1155Root"`
	} `json:"Tokens"`
}

type GenesisChildContracts added in v0.1.0

type GenesisChildContracts struct {
	BorValidatorSet string `json:"BorValidatorSet"`
	StateReceiver   string `json:"StateReceiver"`
}

type IClient

type IClient interface {
	Rpc() *rpc.Client
	Logger() *Logger

	ChainID(ctx context.Context) (*big.Int, error)
	NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
	PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	SuggestGasTipCap(ctx context.Context) (*big.Int, error)
	SendTransaction(ctx context.Context, tx *types.Transaction) error
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
}

type Logger

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

func NewLogger

func NewLogger(prefix string, config DebugConfig) *Logger

func (*Logger) Debug

func (logger *Logger) Debug(msg string, field map[string]interface{})

func (*Logger) Error

func (logger *Logger) Error(msg string, field map[string]interface{})

func (*Logger) Info

func (logger *Logger) Info(msg string, field map[string]interface{})

func (*Logger) Warn

func (logger *Logger) Warn(msg string, field map[string]interface{})

type Network

type Network int

type NetworkType

type NetworkType int

type POSChildContracts added in v0.1.0

type POSChildContracts struct {
	ChildChainManager      string `json:"ChildChainManager"`
	ChildChainManagerProxy string `json:"ChildChainManagerProxy"`
	Tokens                 struct {
		DummyERC20           string `json:"DummyERC20"`
		DummyERC721          string `json:"DummyERC721"`
		DummyERC1155         string `json:"DummyERC1155"`
		DummyMintableERC20   string `json:"DummyMintableERC20"`
		DummyMintableERC721  string `json:"DummyMintableERC721"`
		DummyMintableERC1155 string `json:"DummyMintableERC1155"`
		MaticWETH            string `json:"MaticWETH"`
	} `json:"Tokens"`
}

type POSClientConfig

type POSClientConfig struct {
	Child ChildConfig
	Root  RootConfig
	Debug DebugConfig
}

type POSRootContracts added in v0.1.0

type POSRootContracts struct {
	Merkle                        string `json:"Merkle"`
	MerklePatriciaProof           string `json:"MerklePatriciaProof"`
	RLPReader                     string `json:"RLPReader"`
	SafeERC20                     string `json:"SafeERC20"`
	RootChainManager              string `json:"RootChainManager"`
	RootChainManagerProxy         string `json:"RootChainManagerProxy"`
	DummyStateSender              string `json:"DummyStateSender"`
	ERC20Predicate                string `json:"ERC20Predicate"`
	ERC20PredicateProxy           string `json:"ERC20PredicateProxy"`
	ERC721Predicate               string `json:"ERC721Predicate"`
	ERC721PredicateProxy          string `json:"ERC721PredicateProxy"`
	ERC1155Predicate              string `json:"ERC1155Predicate"`
	ERC1155PredicateProxy         string `json:"ERC1155PredicateProxy"`
	EtherPredicate                string `json:"EtherPredicate"`
	EtherPredicateProxy           string `json:"EtherPredicateProxy"`
	MintableERC20Predicate        string `json:"MintableERC20Predicate"`
	MintableERC20PredicateProxy   string `json:"MintableERC20PredicateProxy"`
	MintableERC721Predicate       string `json:"MintableERC721Predicate"`
	MintableERC721PredicateProxy  string `json:"MintableERC721PredicateProxy"`
	MintableERC1155Predicate      string `json:"MintableERC1155Predicate"`
	MintableERC1155PredicateProxy string `json:"MintableERC1155PredicateProxy"`
	Tokens                        struct {
		DummyERC20           string `json:"DummyERC20"`
		DummyERC721          string `json:"DummyERC721"`
		DummyERC1155         string `json:"DummyERC1155"`
		DummyMintableERC20   string `json:"DummyMintableERC20"`
		DummyMintableERC721  string `json:"DummyMintableERC721"`
		DummyMintableERC1155 string `json:"DummyMintableERC1155"`
	} `json:"Tokens"`
}

type RootBlockInfo

type RootBlockInfo struct {
	HeaderBlockNumber *big.Int
	Start             *big.Int
	End               *big.Int
}

type RootConfig

type RootConfig struct {
	Rpc              string
	RootChain        common.Address
	RootChainManager common.Address
}

type RootContracts added in v0.1.0

type RootContracts struct {
	BytesLib              string `json:"BytesLib"`
	Common                string `json:"Common"`
	ECVerify              string `json:"ECVerify"`
	Merkle                string `json:"Merkle"`
	MerklePatriciaProof   string `json:"MerklePatriciaProof"`
	PriorityQueue         string `json:"PriorityQueue"`
	RLPEncode             string `json:"RLPEncode"`
	RLPReader             string `json:"RLPReader"`
	SafeMath              string `json:"SafeMath"`
	Governance            string `json:"Governance"`
	GovernanceProxy       string `json:"GovernanceProxy"`
	Registry              string `json:"Registry"`
	RootChain             string `json:"RootChain"`
	RootChainProxy        string `json:"RootChainProxy"`
	ValidatorShareFactory string `json:"ValidatorShareFactory"`
	StakingInfo           string `json:"StakingInfo"`
	StakingNFT            string `json:"StakingNFT"`
	StakeManager          string `json:"StakeManager"`
	StakeManagerProxy     string `json:"StakeManagerProxy"`
	SlashingManager       string `json:"SlashingManager"`
	ValidatorShare        string `json:"ValidatorShare"`
	StateSender           string `json:"StateSender"`
	DepositManager        string `json:"DepositManager"`
	DepositManagerProxy   string `json:"DepositManagerProxy"`
	WithdrawManager       string `json:"WithdrawManager"`
	WithdrawManagerProxy  string `json:"WithdrawManagerProxy"`
	ExitNFT               string `json:"ExitNFT"`
	ERC20Predicate        string `json:"ERC20Predicate"`
	ERC721Predicate       string `json:"ERC721Predicate"`
	EIP1559Burn           string `json:"EIP1559Burn"`
	Tokens                struct {
		MaticToken string `json:"MaticToken"`
		TestToken  string `json:"TestToken"`
		RootERC721 string `json:"RootERC721"`
		MaticWeth  string `json:"MaticWeth"`
	} `json:"Tokens"`
}

type TokenType added in v0.0.9

type TokenType int

func (TokenType) String added in v0.0.9

func (token TokenType) String() string

type TxOption added in v0.0.5

type TxOption struct {
	// PrivateKey required
	PrivateKey *ecdsa.PrivateKey

	// Optional Parameters
	TxType int

	// GasLimit : gas limit for tx
	GasLimit uint64

	// GasPrice : gas price for LegacyTxType
	GasPrice *big.Int

	// GasTipCap : maxPriorityFeePerGas for DynamicFeeTxType
	GasTipCap *big.Int

	// GasFeeCap : maxFeePerGas for DynamicFeeTxType
	GasFeeCap *big.Int

	ChainId *big.Int
	Nonce   uint64
	// contains filtered or unexported fields
}

func (*TxOption) Build added in v0.0.5

func (txOption *TxOption) Build(ctx context.Context, client IClient) (*ether.Transaction, error)

func (*TxOption) From added in v0.0.5

func (txOption *TxOption) From() common.Address

func (*TxOption) SetTxData added in v0.0.5

func (txOption *TxOption) SetTxData(to common.Address, data []byte, value *big.Int) *TxOption

func (*TxOption) Validate added in v0.0.5

func (txOption *TxOption) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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