Documentation ¶
Index ¶
- Variables
- type Block
- type Claim
- type Client
- func (etherMan *Client) EthBlockByNumber(ctx context.Context, blockNumber uint64) (*types.Block, error)
- func (etherMan *Client) GetNetworkID(ctx context.Context) (uint, error)
- func (etherMan *Client) GetRollupInfoByBlockRange(ctx context.Context, fromBlock uint64, toBlock *uint64) ([]Block, map[common.Hash][]Order, error)
- func (etherMan *Client) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- type Config
- type Deposit
- type EventOrder
- type GlobalExitRoot
- type Order
- type TokenMetadata
- type TokenWrapped
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is used when the object is not found ErrNotFound = errors.New("Not found") )
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { ID uint64 BlockNumber uint64 BlockHash common.Hash ParentHash common.Hash NetworkID uint GlobalExitRoots []GlobalExitRoot Deposits []Deposit Claims []Claim Tokens []TokenWrapped ReceivedAt time.Time }
Block struct
type Claim ¶
type Claim struct { Index uint OriginalNetwork uint OriginalAddress common.Address Amount *big.Int DestinationAddress common.Address BlockID uint64 BlockNumber uint64 NetworkID uint TxHash common.Hash }
Claim struct
type Client ¶
type Client struct { EtherClient ethClienter PolygonBridge *polygonzkevmbridge.Polygonzkevmbridge PolygonZkEVMGlobalExitRoot *polygonzkevmglobalexitroot.Polygonzkevmglobalexitroot SCAddresses []common.Address }
Client is a simple implementation of EtherMan.
func NewClient ¶
func NewClient(cfg Config, polygonBridgeAddr, polygonZkEVMGlobalExitRootAddress common.Address) (*Client, error)
NewClient creates a new etherman.
func NewL2Client ¶
NewL2Client creates a new etherman for L2.
func NewSimulatedEtherman ¶
func NewSimulatedEtherman(cfg Config, auth *bind.TransactOpts) (etherman *Client, ethBackend *backends.SimulatedBackend, maticAddr common.Address, mockBridge *mockbridge.Polygonzkevmbridge, err error)
NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth must be 1337. The address that holds the auth will have an initial balance of 10 ETH
func (*Client) EthBlockByNumber ¶
func (etherMan *Client) EthBlockByNumber(ctx context.Context, blockNumber uint64) (*types.Block, error)
EthBlockByNumber function retrieves the ethereum block information by ethereum block number.
func (*Client) GetNetworkID ¶
GetNetworkID gets the network ID of the dedicated chain.
func (*Client) GetRollupInfoByBlockRange ¶
func (etherMan *Client) GetRollupInfoByBlockRange(ctx context.Context, fromBlock uint64, toBlock *uint64) ([]Block, map[common.Hash][]Order, error)
GetRollupInfoByBlockRange function retrieves the Rollup information that are included in all this ethereum blocks from block x to block y.
type Deposit ¶
type Deposit struct { LeafType uint8 OriginalNetwork uint OriginalAddress common.Address Amount *big.Int DestinationNetwork uint DestinationAddress common.Address DepositCount uint BlockID uint64 BlockNumber uint64 NetworkID uint TxHash common.Hash Metadata []byte // it is only used for the bridge service ReadyForClaim bool }
Deposit struct
type EventOrder ¶
type EventOrder string
EventOrder is the the type used to identify the events order
const ( // GlobalExitRootsOrder identifies a GlobalExitRoot event GlobalExitRootsOrder EventOrder = "GlobalExitRoot" // DepositsOrder identifies a Deposits event DepositsOrder EventOrder = "Deposit" // ClaimsOrder identifies a Claims event ClaimsOrder EventOrder = "Claim" // TokensOrder identifies a TokenWrapped event TokensOrder EventOrder = "TokenWrapped" )
type GlobalExitRoot ¶
type GlobalExitRoot struct { BlockID uint64 BlockNumber uint64 ExitRoots []common.Hash GlobalExitRoot common.Hash }
GlobalExitRoot struct
type Order ¶
type Order struct { Name EventOrder Pos int }
Order contains the event order to let the synchronizer store the information following this order.
type TokenMetadata ¶
TokenMetadata is a metadata of ERC20 token.