utils

package
v0.0.0-...-1a342eb Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DepositEventSignatureHash  = crypto.Keccak256Hash([]byte("BridgeEvent(uint8,uint32,address,uint32,address,uint256,bytes,uint32)")) // Used in oldBridge as well
	WithdrawEventSignatureHash = crypto.Keccak256Hash([]byte("BridgeEvent(uint8,uint32,address,uint32,address,uint256,bytes,uint32)")) // Used in oldBridge as well
	OldClaimEventSignatureHash = crypto.Keccak256Hash([]byte("ClaimEvent(uint32,uint32,address,address,uint256)"))
	ClaimEventSignatureHash    = crypto.Keccak256Hash([]byte("ClaimEvent(uint256,uint32,address,address,uint256)"))
	TokenTransferSignatureHash = common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")
	L1Eth                      = "0x0000000000000000000000000000000000000000"
	L1PolygonZKEVMBridgeAddr   = common.HexToAddress("0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe")
	L2PolygonZKEVMBridgeAddr   = common.HexToAddress("0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe")
)

Functions

func DecodeGlobalIndex

func DecodeGlobalIndex(globalIndex *big.Int) (bool, *big.Int, *big.Int, error)

func DecodeLog

func DecodeLog(contactAbi *eth_abi.ABI, eventName string, rlpLog types.Log) (map[string]interface{}, error)

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
	VerifiedBatches []VerifiedBatch
	ReceivedAt      time.Time
}

Block struct

type Claim

type Claim struct {
	MainnetFlag        bool
	RollupIndex        uint64
	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 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 GlobalExitRoot

type GlobalExitRoot struct {
	BlockID        uint64
	BlockNumber    uint64
	ExitRoots      []common.Hash
	GlobalExitRoot common.Hash
}

GlobalExitRoot struct

type RollupExitLeaf

type RollupExitLeaf struct {
	ID       uint64
	BlockID  uint64
	Leaf     common.Hash
	RollupId uint
	Root     common.Hash
}

RollupExitLeaf struct

type TokenMetadata

type TokenMetadata struct {
	Name     string
	Symbol   string
	Decimals uint8
}

TokenMetadata is a metadata of ERC20 token.

type TokenWrapped

type TokenWrapped struct {
	TokenMetadata
	OriginalNetwork      uint
	OriginalTokenAddress common.Address
	WrappedTokenAddress  common.Address
	BlockID              uint64
	BlockNumber          uint64
	NetworkID            uint
}

TokenWrapped struct

type VerifiedBatch

type VerifiedBatch struct {
	BlockNumber   uint64
	BatchNumber   uint64
	RollupID      uint
	LocalExitRoot common.Hash
	TxHash        common.Hash
	StateRoot     common.Hash
	Aggregator    common.Address
}

type Withdraw

type Withdraw 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
}

Jump to

Keyboard shortcuts

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