Documentation ¶
Index ¶
- Variables
- type Bridge
- func (bridge *Bridge) BatchPostProcessingWithdrawals(newHeadBatch *core.Batch, state *state.StateDB, ...) []common.Withdrawal
- func (bridge *Bridge) ExtractDeposits(fromBlock *types.Block, toBlock *types.Block, blockResolver db.BlockResolver, ...) []*common.L2Tx
- func (bridge *Bridge) ExtractRollups(b *types.Block, blockResolver db.BlockResolver) []*core.Rollup
- func (bridge *Bridge) GetMapping(l1ContractAddress *gethcommon.Address) *ERC20Mapping
- func (bridge *Bridge) IsWithdrawal(address gethcommon.Address) bool
- func (bridge *Bridge) L1Address(l2Address *gethcommon.Address) *gethcommon.Address
- func (bridge *Bridge) NewDepositTx(contract *gethcommon.Address, address gethcommon.Address, amount *big.Int, ...) *common.L2Tx
- type ERC20
- type ERC20Mapping
Constants ¶
This section is empty.
Variables ¶
var BridgeAddress = gethcommon.BytesToAddress(gethcommon.Hex2Bytes(bridgeAddr))
BridgeAddress - address of the virtual bridge
var HOCContract = gethcommon.BytesToAddress(gethcommon.Hex2Bytes(HOCAddr))
HOCContract - address of the deployed "hocus" erc20 on the L2
var HOCOwner, _ = crypto.HexToECDSA(hocOwnerKeyHex)
var POCContract = gethcommon.BytesToAddress(gethcommon.Hex2Bytes(pocAddr))
POCContract - address of the deployed "pocus" erc20 on the L2
var POCOwner, _ = crypto.HexToECDSA(pocOwnerKeyHex)
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct { SupportedTokens map[ERC20]*ERC20Mapping // BridgeAddress The address the bridge on the L2 BridgeAddress gethcommon.Address MgmtContractLib mgmtcontractlib.MgmtContractLib Erc20ContractLib erc20contractlib.ERC20ContractLib TransactionBlobCrypto crypto2.TransactionBlobCrypto ObscuroChainID int64 EthereumChainID int64 // contains filtered or unexported fields }
Bridge encapsulates all logic around processing the interactions with an L1
func New ¶
func New( hocAddress *gethcommon.Address, pocAddress *gethcommon.Address, mgmtContractLib mgmtcontractlib.MgmtContractLib, erc20ContractLib erc20contractlib.ERC20ContractLib, transactionBlobCrypto crypto2.TransactionBlobCrypto, obscuroChainID int64, ethereumChainID int64, logger gethlog.Logger, ) *Bridge
func (*Bridge) BatchPostProcessingWithdrawals ¶ added in v0.8.0
func (bridge *Bridge) BatchPostProcessingWithdrawals(newHeadBatch *core.Batch, state *state.StateDB, receiptsMap map[gethcommon.Hash]*types.Receipt) []common.Withdrawal
Todo - this has to be implemented differently based on how we define the ObsERC20
func (*Bridge) ExtractDeposits ¶
func (bridge *Bridge) ExtractDeposits( fromBlock *types.Block, toBlock *types.Block, blockResolver db.BlockResolver, rollupState *state.StateDB, ) []*common.L2Tx
ExtractDeposits returns a list of L2 deposit transactions generated from the L1 deposit transactions starting with the proof of the parent rollup(exclusive) to the proof of the current rollup
func (*Bridge) ExtractRollups ¶
ExtractRollups - returns a list of the rollups published in this block
func (*Bridge) GetMapping ¶
func (bridge *Bridge) GetMapping(l1ContractAddress *gethcommon.Address) *ERC20Mapping
GetMapping - finds the mapping based on the address that was called in an L1 transaction
func (*Bridge) IsWithdrawal ¶
func (bridge *Bridge) IsWithdrawal(address gethcommon.Address) bool
func (*Bridge) L1Address ¶
func (bridge *Bridge) L1Address(l2Address *gethcommon.Address) *gethcommon.Address
L1Address - returns the L1 address of a token based on the mapping
func (*Bridge) NewDepositTx ¶
func (bridge *Bridge) NewDepositTx(contract *gethcommon.Address, address gethcommon.Address, amount *big.Int, rollupState *state.StateDB, adjustNonce uint64) *common.L2Tx
NewDepositTx creates a synthetic Obscuro transfer transaction based on deposits into the L1 bridge. Todo - has to go through a few more iterations
type ERC20 ¶
type ERC20 string
ERC20 - the supported ERC20 tokens. A list of made-up tokens used for testing. Todo - this will be removed together will all the keys and addresses.
type ERC20Mapping ¶
type ERC20Mapping struct { Name ERC20 // L1Owner wallet.Wallet L1Address *gethcommon.Address Owner wallet.Wallet // for now the wrapped L2 version is owned by a wallet, but this will change L2Address *gethcommon.Address }
ERC20Mapping - maps an L1 Erc20 to an L2 Erc20 address