blockchainmanager

package
v0.6.0-RC6 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LeafTypeAsset represents a bridge asset
	LeafTypeAsset uint32 = 0
	// LeafTypeMessage represents a bridge message
	LeafTypeMessage uint32 = 1

	MtHeight = 32
	KeyLen   = 32
)

Variables

This section is empty.

Functions

func GetSignerFromKeystore

func GetSignerFromKeystore(ctx context.Context, ethClient *ethclient.Client, ks zkevmtypes.KeystoreFileConfig) (*bind.TransactOpts, error)

GetSignerFromKeystore returns a transaction signer from the keystore file.

Types

type Client

type Client struct {
	EtherClient     *ethclient.Client
	PolygonBridge   *polygonzkevmbridgev2.Polygonzkevmbridgev2
	ClaimCompressor *claimcompressor.Claimcompressor
	NetworkID       uint32
	// contains filtered or unexported fields
}

Client is a simple implementation of EtherMan.

func NewClient

func NewClient(ctx context.Context, cfg *Config) (*Client, error)

NewClient creates a new etherman for L2.

func (*Client) CompressClaimCall

func (bm *Client) CompressClaimCall(mainnetExitRoot, rollupExitRoot common.Hash, claimData []claimcompressor.ClaimCompressorCompressClaimCallData) ([]byte, error)

func (*Client) EstimateGasClaim

func (bm *Client) EstimateGasClaim(metadata []byte, amount *big.Int, originalAddress, destinationAddress common.Address, originalNetwork, destinationNetwork uint32, mainnetExitRoot, rollupExitRoot common.Hash, leafType uint32, globalIndex *big.Int, smtProof [MtHeight][KeyLen]byte, smtRollupProof [MtHeight][KeyLen]byte) (*types.Transaction, error)

func (*Client) SendClaim

func (bm *Client) SendClaim(leafType, origNet uint32,
	origAddr common.Address,
	amount *big.Int,
	destNet uint32,
	destAddr common.Address,
	networkId uint32,
	metadata []byte,
	globalIndex *big.Int,
	smtProof [MtHeight][KeyLen]byte,
	smtRollupProof [MtHeight][KeyLen]byte,
	mainnetExitRoot, rollupExitRoot common.Hash,
) (*types.Transaction, error)

SendClaim sends a claim transaction.

func (*Client) SendCompressedClaims

func (bm *Client) SendCompressedClaims(compressedTxData []byte) (*types.Transaction, error)

type Config

type Config struct {
	// L2RPC is the URL of the L2 node
	L2RPC string `mapstructure:"L2RPC"`
	// PrivateKey defines the key store file that is going
	// to be read in order to provide the private key to sign the claim txs
	PrivateKey types.KeystoreFileConfig `mapstructure:"PrivateKey"`
	// PolygonBridgeAddress is the l2 bridge smc address
	PolygonBridgeAddress common.Address `mapstructure:"PolygonBridgeAddress"`
	// ClaimCompressorAddress is the l2 claim compressor smc address. If it's not set, then group claims is disabled
	ClaimCompressorAddress common.Address `mapstructure:"ClaimCompressorAddress"`
}

Config is the configuration struct for the different environments.

Jump to

Keyboard shortcuts

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