eth

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: AGPL-3.0 Imports: 25 Imported by: 0

README

Test Ethclient - Contracts

Contracts

The first step is to clone the github repository where the contracts are located:

git clone https://github.com/hermeznetwork/contracts.git

While the prepared deployment is not found to master, branch in repository must be changed:

git checkout feature/newDeploymentScript-eth-mik (tested with commit 0eccd237dda102a4ad788a6e11f98361d39d0d9c)

Now, install the dependencies:

cd contracts/
yarn install

Go to where the deployment scripts for the test are found:

cd scripts/ethclient-deployment/

Now, in a terminal start a local blockchain with ganache:

../../node_modules/.bin/ganache-cli -d -m "explain tackle mirror kit van hammer degree position ginger unfair soup bonus" -p 8545 -l 12500000 -a 20 -e 10000 --allowUnlimitedContractSize --chainId 31337

Once ganache is ready, in another terminal run the deployment in the local ganache network:

npx buidler run --network localhostMnemonic test-deployment.js

An output file necessary for the next step is obtained: deploy-output.

The files that appear in hermez-node/eth/contracts must be generated from the same contract that we deploy in this step

Ethclient Test

Different environment variables are necessary to run this test. They must be taken from the output file of the previous step.

They can be provided by file called .env:

GENESIS_BLOCK=98
AUCTION="0x317113D2593e3efF1FfAE0ba2fF7A61861Df7ae5"
AUCTION_TEST="0x2b7dEe2CF60484325716A1c6A193519c8c3b19F3"
TOKENHEZ="0x5D94e3e7aeC542aB0F9129B9a7BAdeb5B3Ca0f77"
HERMEZ="0x8EEaea23686c319133a7cC110b840d1591d9AeE0"
WDELAYER="0x5E0816F0f8bC560cB2B9e9C87187BeCac8c2021F"
WDELAYER_TEST="0xc8F466fFeF9E9788fb363c2F4fBDdF2cAe477805"

An example is found in hermez-node/eth/.env.example

And then run test from hermez-node/eth/:

INTEGRATION=1 go test

Or they can be provided as a parameter in the command that runs the test:

INTEGRATION=1 GENESIS_BLOCK=98 AUCTION="0x317113D2593e3efF1FfAE0ba2fF7A61861Df7ae5" AUCTION_TEST="0x2b7dEe2CF60484325716A1c6A193519c8c3b19F3" TOKENHEZ="0x5D94e3e7aeC542aB0F9129B9a7BAdeb5B3Ca0f77" HERMEZ="0x8EEaea23686c319133a7cC110b840d1591d9AeE0" WDELAYER="0x5E0816F0f8bC560cB2B9e9C87187BeCac8c2021F" WDELAYER_TEST="0xc8F466fFeF9E9788fb363c2F4fBDdF2cAe477805" go test

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAccountNil is used when the calls can not be made because the account is nil
	ErrAccountNil = fmt.Errorf("Authorized calls can't be made when the account is nil")
	// ErrBlockHashMismatchEvent is used when there's a block hash mismatch
	// beetween different events of the same block
	ErrBlockHashMismatchEvent = fmt.Errorf("block hash mismatch in event log")
)

Functions

This section is empty.

Types

type AuctionClient

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

AuctionClient is the implementation of the interface to the Auction Smart Contract in ethereum.

func NewAuctionClient

func NewAuctionClient(client *EthereumClient, address, tokenAddress ethCommon.Address) (*AuctionClient, error)

NewAuctionClient creates a new AuctionClient. `tokenAddress` is the address of the HEZ tokens.

func (*AuctionClient) AuctionBid

func (c *AuctionClient) AuctionBid(amount *big.Int, slot int64, bidAmount *big.Int,
	deadline *big.Int) (tx *types.Transaction, err error)

AuctionBid is the interface to call the smart contract function

func (*AuctionClient) AuctionCanForge

func (c *AuctionClient) AuctionCanForge(forger ethCommon.Address, blockNum int64) (canForge bool,
	err error)

AuctionCanForge is the interface to call the smart contract function

func (*AuctionClient) AuctionChangeDefaultSlotSetBid

func (c *AuctionClient) AuctionChangeDefaultSlotSetBid(slotSet int64,
	newInitialMinBid *big.Int) (tx *types.Transaction, err error)

AuctionChangeDefaultSlotSetBid is the interface to call the smart contract function

func (*AuctionClient) AuctionClaimHEZ

func (c *AuctionClient) AuctionClaimHEZ() (tx *types.Transaction, err error)

AuctionClaimHEZ is the interface to call the smart contract function

func (*AuctionClient) AuctionConstants

func (c *AuctionClient) AuctionConstants() (auctionConstants *common.AuctionConstants, err error)

AuctionConstants returns the Constants of the Auction Smart Contract

func (*AuctionClient) AuctionEventInit

func (c *AuctionClient) AuctionEventInit(genesisBlockNum int64) (*AuctionEventInitialize, int64, error)

AuctionEventInit returns the initialize event with its corresponding block number

func (*AuctionClient) AuctionEventsByBlock

func (c *AuctionClient) AuctionEventsByBlock(blockNum int64,
	blockHash *ethCommon.Hash) (*AuctionEvents, error)

AuctionEventsByBlock returns the events in a block that happened in the Auction Smart Contract. To query by blockNum, set blockNum >= 0 and blockHash == nil. To query by blockHash set blockHash != nil, and blockNum will be ignored. If there are no events in that block the result is nil.

func (*AuctionClient) AuctionForge

func (c *AuctionClient) AuctionForge(forger ethCommon.Address) (tx *types.Transaction, err error)

AuctionForge is the interface to call the smart contract function

func (*AuctionClient) AuctionGetAllocationRatio

func (c *AuctionClient) AuctionGetAllocationRatio() (allocationRation [3]uint16, err error)

AuctionGetAllocationRatio is the interface to call the smart contract function

func (*AuctionClient) AuctionGetBootCoordinator

func (c *AuctionClient) AuctionGetBootCoordinator() (bootCoordinator *ethCommon.Address,
	err error)

AuctionGetBootCoordinator is the interface to call the smart contract function

func (*AuctionClient) AuctionGetClaimableHEZ

func (c *AuctionClient) AuctionGetClaimableHEZ(
	claimAddress ethCommon.Address) (claimableHEZ *big.Int, err error)

AuctionGetClaimableHEZ is the interface to call the smart contract function

func (*AuctionClient) AuctionGetClosedAuctionSlots

func (c *AuctionClient) AuctionGetClosedAuctionSlots() (closedAuctionSlots uint16, err error)

AuctionGetClosedAuctionSlots is the interface to call the smart contract function

func (*AuctionClient) AuctionGetCurrentSlotNumber

func (c *AuctionClient) AuctionGetCurrentSlotNumber() (currentSlotNumber int64, err error)

AuctionGetCurrentSlotNumber is the interface to call the smart contract function

func (*AuctionClient) AuctionGetDefaultSlotSetBid

func (c *AuctionClient) AuctionGetDefaultSlotSetBid(slotSet uint8) (minBidSlotSet *big.Int,
	err error)

AuctionGetDefaultSlotSetBid is the interface to call the smart contract function

func (*AuctionClient) AuctionGetDonationAddress

func (c *AuctionClient) AuctionGetDonationAddress() (donationAddress *ethCommon.Address,
	err error)

AuctionGetDonationAddress is the interface to call the smart contract function

func (*AuctionClient) AuctionGetMinBidBySlot

func (c *AuctionClient) AuctionGetMinBidBySlot(slot int64) (minBid *big.Int, err error)

AuctionGetMinBidBySlot is the interface to call the smart contract function

func (*AuctionClient) AuctionGetOpenAuctionSlots

func (c *AuctionClient) AuctionGetOpenAuctionSlots() (openAuctionSlots uint16, err error)

AuctionGetOpenAuctionSlots is the interface to call the smart contract function

func (*AuctionClient) AuctionGetOutbidding

func (c *AuctionClient) AuctionGetOutbidding() (outbidding uint16, err error)

AuctionGetOutbidding is the interface to call the smart contract function

func (*AuctionClient) AuctionGetSlotDeadline

func (c *AuctionClient) AuctionGetSlotDeadline() (slotDeadline uint8, err error)

AuctionGetSlotDeadline is the interface to call the smart contract function

func (*AuctionClient) AuctionGetSlotNumber

func (c *AuctionClient) AuctionGetSlotNumber(blockNum int64) (slot int64, err error)

AuctionGetSlotNumber is the interface to call the smart contract function

func (*AuctionClient) AuctionGetSlotSet

func (c *AuctionClient) AuctionGetSlotSet(slot int64) (slotSet *big.Int, err error)

AuctionGetSlotSet is the interface to call the smart contract function

func (*AuctionClient) AuctionMultiBid

func (c *AuctionClient) AuctionMultiBid(amount *big.Int, startingSlot, endingSlot int64,
	slotSets [6]bool, maxBid, minBid, deadline *big.Int) (tx *types.Transaction, err error)

AuctionMultiBid is the interface to call the smart contract function

func (*AuctionClient) AuctionSetAllocationRatio

func (c *AuctionClient) AuctionSetAllocationRatio(
	newAllocationRatio [3]uint16) (tx *types.Transaction, err error)

AuctionSetAllocationRatio is the interface to call the smart contract function

func (*AuctionClient) AuctionSetBootCoordinator

func (c *AuctionClient) AuctionSetBootCoordinator(newBootCoordinator ethCommon.Address,
	newBootCoordinatorURL string) (tx *types.Transaction, err error)

AuctionSetBootCoordinator is the interface to call the smart contract function

func (*AuctionClient) AuctionSetClosedAuctionSlots

func (c *AuctionClient) AuctionSetClosedAuctionSlots(
	newClosedAuctionSlots uint16) (tx *types.Transaction, err error)

AuctionSetClosedAuctionSlots is the interface to call the smart contract function

func (*AuctionClient) AuctionSetCoordinator

func (c *AuctionClient) AuctionSetCoordinator(forger ethCommon.Address,
	coordinatorURL string) (tx *types.Transaction, err error)

AuctionSetCoordinator is the interface to call the smart contract function

func (*AuctionClient) AuctionSetDonationAddress

func (c *AuctionClient) AuctionSetDonationAddress(
	newDonationAddress ethCommon.Address) (tx *types.Transaction, err error)

AuctionSetDonationAddress is the interface to call the smart contract function

func (*AuctionClient) AuctionSetOpenAuctionSlots

func (c *AuctionClient) AuctionSetOpenAuctionSlots(
	newOpenAuctionSlots uint16) (tx *types.Transaction, err error)

AuctionSetOpenAuctionSlots is the interface to call the smart contract function

func (*AuctionClient) AuctionSetOutbidding

func (c *AuctionClient) AuctionSetOutbidding(newOutbidding uint16) (tx *types.Transaction,
	err error)

AuctionSetOutbidding is the interface to call the smart contract function

func (*AuctionClient) AuctionSetSlotDeadline

func (c *AuctionClient) AuctionSetSlotDeadline(newDeadline uint8) (*types.Transaction, error)

AuctionSetSlotDeadline is the interface to call the smart contract function

func (*AuctionClient) AuctionVariables

func (c *AuctionClient) AuctionVariables() (auctionVariables *common.AuctionVariables, err error)

AuctionVariables returns the variables of the Auction Smart Contract

type AuctionEventHEZClaimed

type AuctionEventHEZClaimed struct {
	Owner  ethCommon.Address
	Amount *big.Int
}

AuctionEventHEZClaimed is an event of the Auction Smart Contract

type AuctionEventInitialize

type AuctionEventInitialize struct {
	DonationAddress        ethCommon.Address
	BootCoordinatorAddress ethCommon.Address
	BootCoordinatorURL     string
	Outbidding             uint16
	SlotDeadline           uint8
	ClosedAuctionSlots     uint16
	OpenAuctionSlots       uint16
	AllocationRatio        [3]uint16
}

AuctionEventInitialize is the InitializeHermezAuctionProtocolEvent event of the Smart Contract

func (*AuctionEventInitialize) AuctionVariables

func (ei *AuctionEventInitialize) AuctionVariables(
	InitialMinimalBidding *big.Int) *common.AuctionVariables

AuctionVariables returns the AuctionVariables from the initialize event

type AuctionEventNewAllocationRatio

type AuctionEventNewAllocationRatio struct {
	NewAllocationRatio [3]uint16
}

AuctionEventNewAllocationRatio is an event of the Auction Smart Contract

type AuctionEventNewBid

type AuctionEventNewBid struct {
	Slot      int64
	BidAmount *big.Int
	Bidder    ethCommon.Address
}

AuctionEventNewBid is an event of the Auction Smart Contract

type AuctionEventNewBootCoordinator

type AuctionEventNewBootCoordinator struct {
	NewBootCoordinator    ethCommon.Address
	NewBootCoordinatorURL string
}

AuctionEventNewBootCoordinator is an event of the Auction Smart Contract

type AuctionEventNewClosedAuctionSlots

type AuctionEventNewClosedAuctionSlots struct {
	NewClosedAuctionSlots uint16
}

AuctionEventNewClosedAuctionSlots is an event of the Auction Smart Contract

type AuctionEventNewDefaultSlotSetBid

type AuctionEventNewDefaultSlotSetBid struct {
	SlotSet          int64
	NewInitialMinBid *big.Int
}

AuctionEventNewDefaultSlotSetBid is an event of the Auction Smart Contract

type AuctionEventNewDonationAddress

type AuctionEventNewDonationAddress struct {
	NewDonationAddress ethCommon.Address
}

AuctionEventNewDonationAddress is an event of the Auction Smart Contract

type AuctionEventNewForge

type AuctionEventNewForge struct {
	Forger      ethCommon.Address
	SlotToForge int64
}

AuctionEventNewForge is an event of the Auction Smart Contract

type AuctionEventNewForgeAllocated

type AuctionEventNewForgeAllocated struct {
	Bidder           ethCommon.Address
	Forger           ethCommon.Address
	SlotToForge      int64
	BurnAmount       *big.Int
	DonationAmount   *big.Int
	GovernanceAmount *big.Int
}

AuctionEventNewForgeAllocated is an event of the Auction Smart Contract

type AuctionEventNewOpenAuctionSlots

type AuctionEventNewOpenAuctionSlots struct {
	NewOpenAuctionSlots uint16
}

AuctionEventNewOpenAuctionSlots is an event of the Auction Smart Contract

type AuctionEventNewOutbidding

type AuctionEventNewOutbidding struct {
	NewOutbidding uint16
}

AuctionEventNewOutbidding is an event of the Auction Smart Contract

type AuctionEventNewSlotDeadline

type AuctionEventNewSlotDeadline struct {
	NewSlotDeadline uint8
}

AuctionEventNewSlotDeadline is an event of the Auction Smart Contract

type AuctionEventSetCoordinator

type AuctionEventSetCoordinator struct {
	BidderAddress  ethCommon.Address
	ForgerAddress  ethCommon.Address
	CoordinatorURL string
}

AuctionEventSetCoordinator is an event of the Auction Smart Contract

type AuctionEvents

type AuctionEvents struct {
	NewBid                []AuctionEventNewBid
	NewSlotDeadline       []AuctionEventNewSlotDeadline
	NewClosedAuctionSlots []AuctionEventNewClosedAuctionSlots
	NewOutbidding         []AuctionEventNewOutbidding
	NewDonationAddress    []AuctionEventNewDonationAddress
	NewBootCoordinator    []AuctionEventNewBootCoordinator
	NewOpenAuctionSlots   []AuctionEventNewOpenAuctionSlots
	NewAllocationRatio    []AuctionEventNewAllocationRatio
	SetCoordinator        []AuctionEventSetCoordinator
	NewForgeAllocated     []AuctionEventNewForgeAllocated
	NewDefaultSlotSetBid  []AuctionEventNewDefaultSlotSetBid
	NewForge              []AuctionEventNewForge
	HEZClaimed            []AuctionEventHEZClaimed
}

AuctionEvents is the list of events in a block of the Auction Smart Contract

func NewAuctionEvents

func NewAuctionEvents() AuctionEvents

NewAuctionEvents creates an empty AuctionEvents with the slices initialized.

type AuctionInterface

type AuctionInterface interface {

	// Getter/Setter, where Setter is onlyOwner
	AuctionSetSlotDeadline(newDeadline uint8) (*types.Transaction, error)
	AuctionGetSlotDeadline() (uint8, error)
	AuctionSetOpenAuctionSlots(newOpenAuctionSlots uint16) (*types.Transaction, error)
	AuctionGetOpenAuctionSlots() (uint16, error)
	AuctionSetClosedAuctionSlots(newClosedAuctionSlots uint16) (*types.Transaction, error)
	AuctionGetClosedAuctionSlots() (uint16, error)
	AuctionSetOutbidding(newOutbidding uint16) (*types.Transaction, error)
	AuctionGetOutbidding() (uint16, error)
	AuctionSetAllocationRatio(newAllocationRatio [3]uint16) (*types.Transaction, error)
	AuctionGetAllocationRatio() ([3]uint16, error)
	AuctionSetDonationAddress(newDonationAddress ethCommon.Address) (*types.Transaction, error)
	AuctionGetDonationAddress() (*ethCommon.Address, error)
	AuctionSetBootCoordinator(newBootCoordinator ethCommon.Address,
		newBootCoordinatorURL string) (*types.Transaction, error)
	AuctionGetBootCoordinator() (*ethCommon.Address, error)
	AuctionChangeDefaultSlotSetBid(slotSet int64,
		newInitialMinBid *big.Int) (*types.Transaction, error)

	// Coordinator Management
	AuctionSetCoordinator(forger ethCommon.Address, coordinatorURL string) (*types.Transaction,
		error)

	// Slot Info
	AuctionGetSlotNumber(blockNum int64) (int64, error)
	AuctionGetCurrentSlotNumber() (int64, error)
	AuctionGetMinBidBySlot(slot int64) (*big.Int, error)
	AuctionGetDefaultSlotSetBid(slotSet uint8) (*big.Int, error)
	AuctionGetSlotSet(slot int64) (*big.Int, error)

	// Bidding
	AuctionBid(amount *big.Int, slot int64, bidAmount *big.Int, deadline *big.Int) (
		tx *types.Transaction, err error)
	AuctionMultiBid(amount *big.Int, startingSlot, endingSlot int64, slotSets [6]bool,
		maxBid, minBid, deadline *big.Int) (tx *types.Transaction, err error)

	// Forge
	AuctionCanForge(forger ethCommon.Address, blockNum int64) (bool, error)
	AuctionForge(forger ethCommon.Address) (*types.Transaction, error)

	// Fees
	AuctionClaimHEZ() (*types.Transaction, error)
	AuctionGetClaimableHEZ(bidder ethCommon.Address) (*big.Int, error)

	AuctionConstants() (*common.AuctionConstants, error)
	AuctionEventsByBlock(blockNum int64, blockHash *ethCommon.Hash) (*AuctionEvents, error)
	AuctionEventInit(genesisBlockNum int64) (*AuctionEventInitialize, int64, error)
}

AuctionInterface is the inteface to to Auction Smart Contract

type AuctionState

type AuctionState struct {
	// Mapping to control slot state
	Slots map[int64]*SlotState
	// Mapping to control balances pending to claim
	PendingBalances map[ethCommon.Address]*big.Int
	// Mapping to register all the coordinators. The address used for the mapping is the forger address
	Coordinators map[ethCommon.Address]*Coordinator
}

AuctionState represents the state of the Rollup in the Smart Contract

type Client

Client is used to interact with Ethereum and the Hermez smart contracts.

func NewClient

func NewClient(client *ethclient.Client, account *accounts.Account, ks *ethKeystore.KeyStore,
	cfg *ClientConfig) (*Client, error)

NewClient creates a new Client to interact with Ethereum and the Hermez smart contracts.

type ClientConfig

type ClientConfig struct {
	Ethereum EthereumConfig
	Rollup   RollupConfig
}

ClientConfig is the configuration of the Client

type ClientInterface

ClientInterface is the eth Client interface used by hermez-node modules to interact with Ethereum Blockchain and smart contracts.

type ContractData

type ContractData struct {
	Address ethCommon.Address
	Tx      *types.Transaction
	Receipt *types.Receipt
}

ContractData contains the contract data

type Coordinator

type Coordinator struct {
	Forger ethCommon.Address
	URL    string
}

Coordinator is the details of the Coordinator identified by the forger address

type DepositState

type DepositState struct {
	Amount           *big.Int
	DepositTimestamp uint64
}

DepositState is the state of Deposit

type ERC20Consts

type ERC20Consts struct {
	Name     string
	Symbol   string
	Decimals uint64
}

ERC20Consts are the constants defined in a particular ERC20 Token instance

type EthereumClient

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

EthereumClient is an ethereum client to call Smart Contract methods and check blockchain information.

func NewEthereumClient

func NewEthereumClient(client *ethclient.Client, account *accounts.Account,
	ks *ethKeystore.KeyStore, config *EthereumConfig) (*EthereumClient, error)

NewEthereumClient creates a EthereumClient instance. The account is not mandatory (it can be nil). If the account is nil, CallAuth will fail with ErrAccountNil.

func (*EthereumClient) Account

func (c *EthereumClient) Account() *accounts.Account

Account returns the underlying ethereum account

func (*EthereumClient) BalanceAt

func (c *EthereumClient) BalanceAt(addr ethCommon.Address) (*big.Int, error)

BalanceAt retieves information about the default account

func (*EthereumClient) Call

func (c *EthereumClient) Call(fn func(*ethclient.Client) error) error

Call performs a read only Smart Contract method call.

func (*EthereumClient) CallAuth

func (c *EthereumClient) CallAuth(gasLimit uint64, fn func(*ethclient.Client, *bind.TransactOpts) (*types.Transaction, error)) (*types.Transaction,
	error)

CallAuth performs a Smart Contract method call that requires authorization. This call requires a valid account with Ether that can be spend during the call.

func (*EthereumClient) Client

func (c *EthereumClient) Client() *ethclient.Client

Client returns the internal ethclient.Client

func (*EthereumClient) EthAddress

func (c *EthereumClient) EthAddress() (*ethCommon.Address, error)

EthAddress returns the ethereum address of the account loaded into the EthereumClient

func (*EthereumClient) EthBlockByNumber

func (c *EthereumClient) EthBlockByNumber(ctx context.Context, number int64) (*common.Block,
	error)

EthBlockByNumber internally calls ethclient.Client BlockByNumber and returns *common.Block. If number == -1, the latests known block is returned.

func (*EthereumClient) EthCall

func (c *EthereumClient) EthCall(ctx context.Context, tx *types.Transaction,
	blockNum *big.Int) ([]byte, error)

EthCall runs the transaction as a call (without paying) in the local node at blockNum.

func (*EthereumClient) EthChainID

func (c *EthereumClient) EthChainID() (*big.Int, error)

EthChainID returns the ChainID of the ethereum network

func (*EthereumClient) EthERC20Consts

func (c *EthereumClient) EthERC20Consts(tokenAddress ethCommon.Address) (*ERC20Consts, error)

EthERC20Consts returns the constants defined for a particular ERC20 Token instance.

func (*EthereumClient) EthKeyStore

func (c *EthereumClient) EthKeyStore() *ethKeystore.KeyStore

EthKeyStore returns the keystore in the EthereumClient

func (*EthereumClient) EthLastBlock

func (c *EthereumClient) EthLastBlock() (int64, error)

EthLastBlock returns the last block number in the blockchain

func (*EthereumClient) EthNonceAt

func (c *EthereumClient) EthNonceAt(ctx context.Context,
	account ethCommon.Address, blockNumber *big.Int) (uint64, error)

EthNonceAt returns the account nonce of the given account. The block number can be nil, in which case the nonce is taken from the latest known block.

func (*EthereumClient) EthPendingNonceAt

func (c *EthereumClient) EthPendingNonceAt(ctx context.Context,
	account ethCommon.Address) (uint64, error)

EthPendingNonceAt returns the account nonce of the given account in the pending state. This is the nonce that should be used for the next transaction.

func (*EthereumClient) EthSuggestGasPrice

func (c *EthereumClient) EthSuggestGasPrice(ctx context.Context) (*big.Int, error)

EthSuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.

func (*EthereumClient) EthTransactionReceipt

func (c *EthereumClient) EthTransactionReceipt(ctx context.Context,
	txHash ethCommon.Hash) (*types.Receipt, error)

EthTransactionReceipt returns the transaction receipt of the given txHash

func (*EthereumClient) NewAuth

func (c *EthereumClient) NewAuth() (*bind.TransactOpts, error)

NewAuth builds a new auth object to make a transaction

type EthereumConfig

type EthereumConfig struct {
	CallGasLimit uint64
	GasPriceDiv  uint64
}

EthereumConfig defines the configuration parameters of the EthereumClient

type EthereumInterface

type EthereumInterface interface {
	EthLastBlock() (int64, error)
	// EthHeaderByNumber(context.Context, *big.Int) (*types.Header, error)
	EthBlockByNumber(context.Context, int64) (*common.Block, error)
	EthAddress() (*ethCommon.Address, error)
	EthTransactionReceipt(context.Context, ethCommon.Hash) (*types.Receipt, error)

	EthERC20Consts(ethCommon.Address) (*ERC20Consts, error)
	EthChainID() (*big.Int, error)

	EthPendingNonceAt(ctx context.Context, account ethCommon.Address) (uint64, error)
	EthNonceAt(ctx context.Context, account ethCommon.Address, blockNumber *big.Int) (uint64, error)
	EthSuggestGasPrice(ctx context.Context) (*big.Int, error)
	EthKeyStore() *ethKeystore.KeyStore
	EthCall(ctx context.Context, tx *types.Transaction, blockNum *big.Int) ([]byte, error)
}

EthereumInterface is the interface to Ethereum

type QueueStruct

type QueueStruct struct {
	L1TxQueue    []common.L1Tx
	TotalL1TxFee *big.Int
}

QueueStruct is the queue of L1Txs for a batch

func NewQueueStruct

func NewQueueStruct() *QueueStruct

NewQueueStruct creates a new clear QueueStruct.

type RollupClient

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

RollupClient is the implementation of the interface to the Rollup Smart Contract in ethereum.

func NewRollupClient

func NewRollupClient(client *EthereumClient, address ethCommon.Address) (*RollupClient, error)

NewRollupClient creates a new RollupClient

func (*RollupClient) RollupAddToken

func (c *RollupClient) RollupAddToken(tokenAddress ethCommon.Address, feeAddToken,
	deadline *big.Int) (tx *types.Transaction, err error)

RollupAddToken is the interface to call the smart contract function. `feeAddToken` is the amount of HEZ tokens that will be paid to add the token. `feeAddToken` must match the public value of the smart contract.

func (*RollupClient) RollupConstants

func (c *RollupClient) RollupConstants() (rollupConstants *common.RollupConstants, err error)

RollupConstants returns the Constants of the Rollup Smart Contract

func (*RollupClient) RollupEventInit

func (c *RollupClient) RollupEventInit(genesisBlockNum int64) (*RollupEventInitialize, int64, error)

RollupEventInit returns the initialize event with its corresponding block number

func (*RollupClient) RollupEventsByBlock

func (c *RollupClient) RollupEventsByBlock(blockNum int64,
	blockHash *ethCommon.Hash) (*RollupEvents, error)

RollupEventsByBlock returns the events in a block that happened in the Rollup Smart Contract. To query by blockNum, set blockNum >= 0 and blockHash == nil. To query by blockHash set blockHash != nil, and blockNum will be ignored. If there are no events in that block the result is nil.

func (*RollupClient) RollupForgeBatch

func (c *RollupClient) RollupForgeBatch(args *RollupForgeBatchArgs, auth *bind.TransactOpts) (tx *types.Transaction, err error)

RollupForgeBatch is the interface to call the smart contract function

func (*RollupClient) RollupForgeBatchArgs

func (c *RollupClient) RollupForgeBatchArgs(ethTxHash ethCommon.Hash,
	l1UserTxsLen uint16) (*RollupForgeBatchArgs, *ethCommon.Address, error)

RollupForgeBatchArgs returns the arguments used in a ForgeBatch call in the Rollup Smart Contract in the given transaction, and the sender address.

func (*RollupClient) RollupInstantWithdrawalViewer

func (c *RollupClient) RollupInstantWithdrawalViewer(tokenAddress ethCommon.Address,
	amount *big.Int) (instantAllowed bool, err error)

RollupInstantWithdrawalViewer is the interface to call the smart contract function

func (*RollupClient) RollupL1UserTxERC20ETH

func (c *RollupClient) RollupL1UserTxERC20ETH(fromBJJ babyjub.PublicKeyComp, fromIdx int64,
	depositAmount *big.Int, amount *big.Int, tokenID uint32, toIdx int64) (tx *types.Transaction,
	err error)

RollupL1UserTxERC20ETH is the interface to call the smart contract function

func (*RollupClient) RollupL1UserTxERC20Permit

func (c *RollupClient) RollupL1UserTxERC20Permit(fromBJJ babyjub.PublicKeyComp, fromIdx int64,
	depositAmount *big.Int, amount *big.Int, tokenID uint32, toIdx int64,
	deadline *big.Int) (tx *types.Transaction, err error)

RollupL1UserTxERC20Permit is the interface to call the smart contract function

func (*RollupClient) RollupLastForgedBatch

func (c *RollupClient) RollupLastForgedBatch() (lastForgedBatch int64, err error)

RollupLastForgedBatch is the interface to call the smart contract function

func (*RollupClient) RollupRegisterTokensCount

func (c *RollupClient) RollupRegisterTokensCount() (registerTokensCount *big.Int, err error)

RollupRegisterTokensCount is the interface to call the smart contract function

func (*RollupClient) RollupSafeMode

func (c *RollupClient) RollupSafeMode() (tx *types.Transaction, err error)

RollupSafeMode is the interface to call the smart contract function

func (*RollupClient) RollupUpdateBucketsParameters

func (c *RollupClient) RollupUpdateBucketsParameters(
	arrayBuckets []RollupUpdateBucketsParameters,
) (tx *types.Transaction, err error)

RollupUpdateBucketsParameters is the interface to call the smart contract function

func (*RollupClient) RollupUpdateFeeAddToken

func (c *RollupClient) RollupUpdateFeeAddToken(newFeeAddToken *big.Int) (tx *types.Transaction,
	err error)

RollupUpdateFeeAddToken is the interface to call the smart contract function

func (*RollupClient) RollupUpdateForgeL1L2BatchTimeout

func (c *RollupClient) RollupUpdateForgeL1L2BatchTimeout(
	newForgeL1L2BatchTimeout int64) (tx *types.Transaction, err error)

RollupUpdateForgeL1L2BatchTimeout is the interface to call the smart contract function

func (*RollupClient) RollupUpdateTokenExchange

func (c *RollupClient) RollupUpdateTokenExchange(addressArray []ethCommon.Address,
	valueArray []uint64) (tx *types.Transaction, err error)

RollupUpdateTokenExchange is the interface to call the smart contract function

func (*RollupClient) RollupUpdateWithdrawalDelay

func (c *RollupClient) RollupUpdateWithdrawalDelay(newWithdrawalDelay int64) (tx *types.Transaction,
	err error)

RollupUpdateWithdrawalDelay is the interface to call the smart contract function

func (*RollupClient) RollupWithdrawCircuit

func (c *RollupClient) RollupWithdrawCircuit(proofA, proofC [2]*big.Int, proofB [2][2]*big.Int,
	tokenID uint32, numExitRoot, idx int64, amount *big.Int, instantWithdraw bool) (*types.Transaction,
	error)

RollupWithdrawCircuit is the interface to call the smart contract function

func (*RollupClient) RollupWithdrawMerkleProof

func (c *RollupClient) RollupWithdrawMerkleProof(fromBJJ babyjub.PublicKeyComp, tokenID uint32,
	numExitRoot, idx int64, amount *big.Int, siblings []*big.Int,
	instantWithdraw bool) (tx *types.Transaction, err error)

RollupWithdrawMerkleProof is the interface to call the smart contract function

type RollupConfig

type RollupConfig struct {
	Address ethCommon.Address
}

RollupConfig is the configuration for the Rollup smart contract interface

type RollupEventAddToken

type RollupEventAddToken struct {
	TokenAddress ethCommon.Address
	TokenID      uint32
}

RollupEventAddToken is an event of the Rollup Smart Contract

type RollupEventForgeBatch

type RollupEventForgeBatch struct {
	BatchNum int64
	// Sender    ethCommon.Address
	EthTxHash    ethCommon.Hash
	L1UserTxsLen uint16
}

RollupEventForgeBatch is an event of the Rollup Smart Contract

type RollupEventInitialize

type RollupEventInitialize struct {
	ForgeL1L2BatchTimeout uint8
	FeeAddToken           *big.Int
	WithdrawalDelay       uint64
}

RollupEventInitialize is the InitializeHermezEvent event of the Smart Contract

func (*RollupEventInitialize) RollupVariables

func (ei *RollupEventInitialize) RollupVariables() *common.RollupVariables

RollupVariables returns the RollupVariables from the initialize event

type RollupEventL1UserTx

type RollupEventL1UserTx struct {
	// ToForgeL1TxsNum int64 // QueueIndex       *big.Int
	// Position        int   // TransactionIndex *big.Int
	L1UserTx common.L1Tx
}

RollupEventL1UserTx is an event of the Rollup Smart Contract

type RollupEventSafeMode

type RollupEventSafeMode struct{}

RollupEventSafeMode is an event of the Rollup Smart Contract

type RollupEventUpdateBucketWithdraw

type RollupEventUpdateBucketWithdraw struct {
	NumBucket   int
	BlockStamp  int64 // blockNum
	Withdrawals *big.Int
}

RollupEventUpdateBucketWithdraw is an event of the Rollup Smart Contract

type RollupEventUpdateBucketsParameters

type RollupEventUpdateBucketsParameters struct {
	ArrayBuckets []RollupUpdateBucketsParameters
	SafeMode     bool
}

RollupEventUpdateBucketsParameters is an event of the Rollup Smart Contract

type RollupEventUpdateFeeAddToken

type RollupEventUpdateFeeAddToken struct {
	NewFeeAddToken *big.Int
}

RollupEventUpdateFeeAddToken is an event of the Rollup Smart Contract

type RollupEventUpdateForgeL1L2BatchTimeout

type RollupEventUpdateForgeL1L2BatchTimeout struct {
	NewForgeL1L2BatchTimeout int64
}

RollupEventUpdateForgeL1L2BatchTimeout is an event of the Rollup Smart Contract

type RollupEventUpdateTokenExchange

type RollupEventUpdateTokenExchange struct {
	AddressArray []ethCommon.Address
	ValueArray   []uint64
}

RollupEventUpdateTokenExchange is an event of the Rollup Smart Contract

type RollupEventUpdateWithdrawalDelay

type RollupEventUpdateWithdrawalDelay struct {
	NewWithdrawalDelay uint64
}

RollupEventUpdateWithdrawalDelay is an event of the Rollup Smart Contract

type RollupEventWithdraw

type RollupEventWithdraw struct {
	Idx             uint64
	NumExitRoot     uint64
	InstantWithdraw bool
	TxHash          ethCommon.Hash // Hash of the transaction that generated this event
}

RollupEventWithdraw is an event of the Rollup Smart Contract

type RollupEvents

type RollupEvents struct {
	L1UserTx                    []RollupEventL1UserTx
	AddToken                    []RollupEventAddToken
	ForgeBatch                  []RollupEventForgeBatch
	UpdateForgeL1L2BatchTimeout []RollupEventUpdateForgeL1L2BatchTimeout
	UpdateFeeAddToken           []RollupEventUpdateFeeAddToken
	Withdraw                    []RollupEventWithdraw
	UpdateWithdrawalDelay       []RollupEventUpdateWithdrawalDelay
	UpdateBucketWithdraw        []RollupEventUpdateBucketWithdraw
	UpdateBucketsParameters     []RollupEventUpdateBucketsParameters
	UpdateTokenExchange         []RollupEventUpdateTokenExchange
	SafeMode                    []RollupEventSafeMode
}

RollupEvents is the list of events in a block of the Rollup Smart Contract

func NewRollupEvents

func NewRollupEvents() RollupEvents

NewRollupEvents creates an empty RollupEvents with the slices initialized.

type RollupForgeBatchArgs

type RollupForgeBatchArgs struct {
	NewLastIdx            int64
	NewStRoot             *big.Int
	NewExitRoot           *big.Int
	L1UserTxs             []common.L1Tx
	L1CoordinatorTxs      []common.L1Tx
	L1CoordinatorTxsAuths [][]byte // Authorization for accountCreations for each L1CoordinatorTx
	L2TxsData             []common.L2Tx
	FeeIdxCoordinator     []common.Idx
	// Circuit selector
	VerifierIdx uint8
	L1Batch     bool
	ProofA      [2]*big.Int
	ProofB      [2][2]*big.Int
	ProofC      [2]*big.Int
}

RollupForgeBatchArgs are the arguments to the ForgeBatch function in the Rollup Smart Contract

type RollupInterface

type RollupInterface interface {
	RollupForgeBatch(*RollupForgeBatchArgs, *bind.TransactOpts) (*types.Transaction, error)
	RollupAddToken(tokenAddress ethCommon.Address, feeAddToken,
		deadline *big.Int) (*types.Transaction, error)

	RollupWithdrawMerkleProof(babyPubKey babyjub.PublicKeyComp, tokenID uint32, numExitRoot,
		idx int64, amount *big.Int, siblings []*big.Int, instantWithdraw bool) (*types.Transaction,
		error)
	RollupWithdrawCircuit(proofA, proofC [2]*big.Int, proofB [2][2]*big.Int, tokenID uint32,
		numExitRoot, idx int64, amount *big.Int, instantWithdraw bool) (*types.Transaction, error)

	RollupL1UserTxERC20ETH(fromBJJ babyjub.PublicKeyComp, fromIdx int64, depositAmount *big.Int,
		amount *big.Int, tokenID uint32, toIdx int64) (*types.Transaction, error)
	RollupL1UserTxERC20Permit(fromBJJ babyjub.PublicKeyComp, fromIdx int64,
		depositAmount *big.Int, amount *big.Int, tokenID uint32, toIdx int64,
		deadline *big.Int) (tx *types.Transaction, err error)

	// Governance Public Functions
	RollupUpdateForgeL1L2BatchTimeout(newForgeL1L2BatchTimeout int64) (*types.Transaction, error)
	RollupUpdateFeeAddToken(newFeeAddToken *big.Int) (*types.Transaction, error)

	// Viewers
	RollupRegisterTokensCount() (*big.Int, error)
	RollupLastForgedBatch() (int64, error)

	RollupConstants() (*common.RollupConstants, error)
	RollupEventsByBlock(blockNum int64, blockHash *ethCommon.Hash) (*RollupEvents, error)
	RollupForgeBatchArgs(ethCommon.Hash, uint16) (*RollupForgeBatchArgs, *ethCommon.Address, error)
	RollupEventInit(genesisBlockNum int64) (*RollupEventInitialize, int64, error)
}

RollupInterface is the inteface to to Rollup Smart Contract

type RollupState

type RollupState struct {
	StateRoot *big.Int
	ExitRoots []*big.Int
	// ExitNullifierMap       map[[256 / 8]byte]bool
	ExitNullifierMap       map[int64]map[int64]bool // batchNum -> idx -> bool
	TokenList              []ethCommon.Address
	TokenMap               map[ethCommon.Address]bool
	MapL1TxQueue           map[int64]*QueueStruct
	LastL1L2Batch          int64
	CurrentToForgeL1TxsNum int64
	LastToForgeL1TxsNum    int64
	CurrentIdx             int64
}

RollupState represents the state of the Rollup in the Smart Contract

type RollupUpdateBucketsParameters

type RollupUpdateBucketsParameters struct {
	CeilUSD         *big.Int
	BlockStamp      *big.Int
	Withdrawals     *big.Int
	RateBlocks      *big.Int
	RateWithdrawals *big.Int
	MaxWithdrawals  *big.Int
}

RollupUpdateBucketsParameters are the bucket parameters used in an update

type SlotState

type SlotState struct {
	Bidder           ethCommon.Address
	ForgerCommitment bool
	Fulfilled        bool
	BidAmount        *big.Int
	ClosedMinBid     *big.Int
}

SlotState is the state of a slot

func NewSlotState

func NewSlotState() *SlotState

NewSlotState returns an empty SlotState

type TokenClient added in v1.2.0

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

TokenClient is the implementation of the interface to the Hez Token Smart Contract in ethereum.

func NewTokenClient added in v1.2.0

func NewTokenClient(client *EthereumClient, address ethCommon.Address) (*TokenClient, error)

NewTokenClient creates a new TokenClient

type WDelayerClient

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

WDelayerClient is the implementation of the interface to the WithdrawDelayer Smart Contract in ethereum.

func NewWDelayerClient

func NewWDelayerClient(client *EthereumClient, address ethCommon.Address) (*WDelayerClient, error)

NewWDelayerClient creates a new WDelayerClient

func (*WDelayerClient) WDelayerChangeWithdrawalDelay

func (c *WDelayerClient) WDelayerChangeWithdrawalDelay(newWithdrawalDelay uint64) (
	tx *types.Transaction, err error)

WDelayerChangeWithdrawalDelay is the interface to call the smart contract function

func (*WDelayerClient) WDelayerClaimEmergencyCouncil

func (c *WDelayerClient) WDelayerClaimEmergencyCouncil() (tx *types.Transaction, err error)

WDelayerClaimEmergencyCouncil is the interface to call the smart contract function

func (*WDelayerClient) WDelayerClaimGovernance

func (c *WDelayerClient) WDelayerClaimGovernance() (tx *types.Transaction, err error)

WDelayerClaimGovernance is the interface to call the smart contract function

func (*WDelayerClient) WDelayerConstants

func (c *WDelayerClient) WDelayerConstants() (constants *common.WDelayerConstants, err error)

WDelayerConstants returns the Constants of the WDelayer Smart Contract

func (*WDelayerClient) WDelayerDeposit

func (c *WDelayerClient) WDelayerDeposit(owner, token ethCommon.Address, amount *big.Int) (
	tx *types.Transaction, err error)

WDelayerDeposit is the interface to call the smart contract function

func (*WDelayerClient) WDelayerDepositInfo

func (c *WDelayerClient) WDelayerDepositInfo(owner, token ethCommon.Address) (
	depositInfo DepositState, err error)

WDelayerDepositInfo is the interface to call the smart contract function

func (*WDelayerClient) WDelayerEnableEmergencyMode

func (c *WDelayerClient) WDelayerEnableEmergencyMode() (tx *types.Transaction, err error)

WDelayerEnableEmergencyMode is the interface to call the smart contract function

func (*WDelayerClient) WDelayerEscapeHatchWithdrawal

func (c *WDelayerClient) WDelayerEscapeHatchWithdrawal(to, token ethCommon.Address,
	amount *big.Int) (tx *types.Transaction, err error)

WDelayerEscapeHatchWithdrawal is the interface to call the smart contract function

func (*WDelayerClient) WDelayerEventInit

func (c *WDelayerClient) WDelayerEventInit(genesisBlockNum int64) (*WDelayerEventInitialize, int64, error)

WDelayerEventInit returns the initialize event with its corresponding block number

func (*WDelayerClient) WDelayerEventsByBlock

func (c *WDelayerClient) WDelayerEventsByBlock(blockNum int64,
	blockHash *ethCommon.Hash) (*WDelayerEvents, error)

WDelayerEventsByBlock returns the events in a block that happened in the WDelayer Smart Contract. To query by blockNum, set blockNum >= 0 and blockHash == nil. To query by blockHash set blockHash != nil, and blockNum will be ignored. If there are no events in that block the result is nil.

func (*WDelayerClient) WDelayerGetEmergencyCouncil

func (c *WDelayerClient) WDelayerGetEmergencyCouncil() (emergencyCouncilAddress *ethCommon.Address,
	err error)

WDelayerGetEmergencyCouncil is the interface to call the smart contract function

func (*WDelayerClient) WDelayerGetEmergencyModeStartingTime

func (c *WDelayerClient) WDelayerGetEmergencyModeStartingTime() (emergencyModeStartingTime int64,
	err error)

WDelayerGetEmergencyModeStartingTime is the interface to call the smart contract function

func (*WDelayerClient) WDelayerGetHermezGovernanceAddress

func (c *WDelayerClient) WDelayerGetHermezGovernanceAddress() (
	hermezGovernanceAddress *ethCommon.Address, err error)

WDelayerGetHermezGovernanceAddress is the interface to call the smart contract function

func (*WDelayerClient) WDelayerGetWithdrawalDelay

func (c *WDelayerClient) WDelayerGetWithdrawalDelay() (withdrawalDelay int64, err error)

WDelayerGetWithdrawalDelay is the interface to call the smart contract function

func (*WDelayerClient) WDelayerIsEmergencyMode

func (c *WDelayerClient) WDelayerIsEmergencyMode() (ermergencyMode bool, err error)

WDelayerIsEmergencyMode is the interface to call the smart contract function

func (*WDelayerClient) WDelayerTransferEmergencyCouncil

func (c *WDelayerClient) WDelayerTransferEmergencyCouncil(newAddress ethCommon.Address) (
	tx *types.Transaction, err error)

WDelayerTransferEmergencyCouncil is the interface to call the smart contract function

func (*WDelayerClient) WDelayerTransferGovernance

func (c *WDelayerClient) WDelayerTransferGovernance(newAddress ethCommon.Address) (
	tx *types.Transaction, err error)

WDelayerTransferGovernance is the interface to call the smart contract function

func (*WDelayerClient) WDelayerWithdrawal

func (c *WDelayerClient) WDelayerWithdrawal(owner, token ethCommon.Address) (tx *types.Transaction,
	err error)

WDelayerWithdrawal is the interface to call the smart contract function

type WDelayerEventDeposit

type WDelayerEventDeposit struct {
	Owner            ethCommon.Address
	Token            ethCommon.Address
	Amount           *big.Int
	DepositTimestamp uint64
	TxHash           ethCommon.Hash // Hash of the transaction that generated this event
}

WDelayerEventDeposit is an event of the WithdrawalDelayer Smart Contract

type WDelayerEventEmergencyModeEnabled

type WDelayerEventEmergencyModeEnabled struct {
}

WDelayerEventEmergencyModeEnabled an event of the WithdrawalDelayer Smart Contract

type WDelayerEventEscapeHatchWithdrawal

type WDelayerEventEscapeHatchWithdrawal struct {
	Who    ethCommon.Address
	To     ethCommon.Address
	Token  ethCommon.Address
	Amount *big.Int
}

WDelayerEventEscapeHatchWithdrawal an event of the WithdrawalDelayer Smart Contract

type WDelayerEventInitialize

type WDelayerEventInitialize struct {
	InitialWithdrawalDelay         uint64
	InitialHermezGovernanceAddress ethCommon.Address
	InitialEmergencyCouncil        ethCommon.Address
}

WDelayerEventInitialize is the InitializeWithdrawalDelayerEvent event of the Smart Contract

func (*WDelayerEventInitialize) WDelayerVariables

func (ei *WDelayerEventInitialize) WDelayerVariables() *common.WDelayerVariables

WDelayerVariables returns the WDelayerVariables from the initialize event

type WDelayerEventNewEmergencyCouncil

type WDelayerEventNewEmergencyCouncil struct {
	NewEmergencyCouncil ethCommon.Address
}

WDelayerEventNewEmergencyCouncil an event of the WithdrawalDelayer Smart Contract

type WDelayerEventNewHermezGovernanceAddress

type WDelayerEventNewHermezGovernanceAddress struct {
	NewHermezGovernanceAddress ethCommon.Address
}

WDelayerEventNewHermezGovernanceAddress an event of the WithdrawalDelayer Smart Contract

type WDelayerEventNewWithdrawalDelay

type WDelayerEventNewWithdrawalDelay struct {
	WithdrawalDelay uint64
}

WDelayerEventNewWithdrawalDelay an event of the WithdrawalDelayer Smart Contract

type WDelayerEventWithdraw

type WDelayerEventWithdraw struct {
	Owner  ethCommon.Address
	Token  ethCommon.Address
	Amount *big.Int
}

WDelayerEventWithdraw is an event of the WithdrawalDelayer Smart Contract

type WDelayerEvents

type WDelayerEvents struct {
	Deposit                    []WDelayerEventDeposit
	Withdraw                   []WDelayerEventWithdraw
	EmergencyModeEnabled       []WDelayerEventEmergencyModeEnabled
	NewWithdrawalDelay         []WDelayerEventNewWithdrawalDelay
	EscapeHatchWithdrawal      []WDelayerEventEscapeHatchWithdrawal
	NewEmergencyCouncil        []WDelayerEventNewEmergencyCouncil
	NewHermezGovernanceAddress []WDelayerEventNewHermezGovernanceAddress
}

WDelayerEvents is the lis of events in a block of the WithdrawalDelayer Smart Contract

func NewWDelayerEvents

func NewWDelayerEvents() WDelayerEvents

NewWDelayerEvents creates an empty WDelayerEvents with the slices initialized.

type WDelayerInterface

type WDelayerInterface interface {
	WDelayerGetHermezGovernanceAddress() (*ethCommon.Address, error)
	WDelayerTransferGovernance(newAddress ethCommon.Address) (*types.Transaction, error)
	WDelayerClaimGovernance() (*types.Transaction, error)
	WDelayerGetEmergencyCouncil() (*ethCommon.Address, error)
	WDelayerTransferEmergencyCouncil(newAddress ethCommon.Address) (*types.Transaction, error)
	WDelayerClaimEmergencyCouncil() (*types.Transaction, error)
	WDelayerIsEmergencyMode() (bool, error)
	WDelayerGetWithdrawalDelay() (int64, error)
	WDelayerGetEmergencyModeStartingTime() (int64, error)
	WDelayerEnableEmergencyMode() (*types.Transaction, error)
	WDelayerChangeWithdrawalDelay(newWithdrawalDelay uint64) (*types.Transaction, error)
	WDelayerDepositInfo(owner, token ethCommon.Address) (depositInfo DepositState, err error)
	WDelayerDeposit(onwer, token ethCommon.Address, amount *big.Int) (*types.Transaction, error)
	WDelayerWithdrawal(owner, token ethCommon.Address) (*types.Transaction, error)
	WDelayerEscapeHatchWithdrawal(to, token ethCommon.Address,
		amount *big.Int) (*types.Transaction, error)

	WDelayerEventsByBlock(blockNum int64, blockHash *ethCommon.Hash) (*WDelayerEvents, error)
	WDelayerConstants() (*common.WDelayerConstants, error)
	WDelayerEventInit(genesisBlockNum int64) (*WDelayerEventInitialize, int64, error)
}

WDelayerInterface is the inteface to WithdrawalDelayer Smart Contract

Directories

Path Synopsis
contracts

Jump to

Keyboard shortcuts

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