Documentation ¶
Index ¶
- Variables
- func AssertUSD(t *testing.T, expected, actual *float64)
- func GenAccounts(totalAccounts, userAccounts int, tokens []common.Token, ...) []common.Account
- func GenAuths(nAuths int, chainID uint16, hermezContractAddr ethCommon.Address) []*common.AccountCreationAuth
- func GenBatches(nBatches int, blocks []common.Block) []common.Batch
- func GenBids(nBids int, blocks []common.Block, coords []common.Coordinator) []common.Bid
- func GenBlocks(from, to int64) []common.Block
- func GenCoordinators(nCoords int, blocks []common.Block) []common.Coordinator
- func GenExitTree(n int, batches []common.Batch, accounts []common.Account, ...) []common.ExitInfo
- func GenL1Txs(fromIdx int, totalTxs, nUserTxs int, userAddr *ethCommon.Address, ...) ([]common.L1Tx, []common.L1Tx)
- func GenL2Txs(fromIdx int, totalTxs, nUserTxs int, userAddr *ethCommon.Address, ...) ([]common.L2Tx, []common.L2Tx)
- func GenPoolTxs(n int, tokens []common.Token) []*common.PoolL2Tx
- func GenTokens(nTokens int, blocks []common.Block) (tokensToAddInDB []common.Token, ethToken common.Token)
- func GetNextToForgeNumAndBatch(batches []common.Batch) (common.BatchNum, int64)
- func WipeDB(db *sqlx.DB)
- type AuctionBlock
- type Block
- type Client
- func (c *Client) AuctionBid(amount *big.Int, slot int64, bidAmount *big.Int, deadline *big.Int) (tx *types.Transaction, err error)
- func (c *Client) AuctionBidSimple(slot int64, bidAmount *big.Int) (tx *types.Transaction, err error)
- func (c *Client) AuctionCanForge(forger ethCommon.Address, blockNum int64) (bool, error)
- func (c *Client) AuctionChangeDefaultSlotSetBid(slotSet int64, newInitialMinBid *big.Int) (tx *types.Transaction, err error)
- func (c *Client) AuctionClaimHEZ() (tx *types.Transaction, err error)
- func (c *Client) AuctionConstants() (*common.AuctionConstants, error)
- func (c *Client) AuctionEventInit(genesisBlockNum int64) (*eth.AuctionEventInitialize, int64, error)
- func (c *Client) AuctionEventsByBlock(blockNum int64, blockHash *ethCommon.Hash) (*eth.AuctionEvents, error)
- func (c *Client) AuctionForge(forger ethCommon.Address) (tx *types.Transaction, err error)
- func (c *Client) AuctionGetAllocationRatio() ([3]uint16, error)
- func (c *Client) AuctionGetBootCoordinator() (*ethCommon.Address, error)
- func (c *Client) AuctionGetClaimableHEZ(bidder ethCommon.Address) (*big.Int, error)
- func (c *Client) AuctionGetClosedAuctionSlots() (uint16, error)
- func (c *Client) AuctionGetCurrentSlotNumber() (int64, error)
- func (c *Client) AuctionGetDefaultSlotSetBid(slotSet uint8) (*big.Int, error)
- func (c *Client) AuctionGetDonationAddress() (*ethCommon.Address, error)
- func (c *Client) AuctionGetMinBidBySlot(slot int64) (*big.Int, error)
- func (c *Client) AuctionGetOpenAuctionSlots() (uint16, error)
- func (c *Client) AuctionGetOutbidding() (uint16, error)
- func (c *Client) AuctionGetSlotDeadline() (uint8, error)
- func (c *Client) AuctionGetSlotNumber(blockNum int64) (int64, error)
- func (c *Client) AuctionGetSlotSet(slot int64) (*big.Int, error)
- func (c *Client) AuctionIsRegisteredCoordinator(forgerAddress ethCommon.Address) (bool, error)
- func (c *Client) AuctionMultiBid(amount *big.Int, startingSlot int64, endingSlot int64, slotSet [6]bool, ...) (tx *types.Transaction, err error)
- func (c *Client) AuctionSetAllocationRatio(newAllocationRatio [3]uint16) (tx *types.Transaction, err error)
- func (c *Client) AuctionSetBootCoordinator(newBootCoordinator ethCommon.Address, newBootCoordinatorURL string) (tx *types.Transaction, err error)
- func (c *Client) AuctionSetClosedAuctionSlots(newClosedAuctionSlots uint16) (tx *types.Transaction, err error)
- func (c *Client) AuctionSetCoordinator(forger ethCommon.Address, URL string) (tx *types.Transaction, err error)
- func (c *Client) AuctionSetDonationAddress(newDonationAddress ethCommon.Address) (tx *types.Transaction, err error)
- func (c *Client) AuctionSetOpenAuctionSlots(newOpenAuctionSlots uint16) (tx *types.Transaction, err error)
- func (c *Client) AuctionSetOutbidding(newOutbidding uint16) (tx *types.Transaction, err error)
- func (c *Client) AuctionSetSlotDeadline(newDeadline uint8) (tx *types.Transaction, err error)
- func (c *Client) AuctionUpdateCoordinatorInfo(forgerAddress ethCommon.Address, newWithdrawAddress ethCommon.Address, ...) (tx *types.Transaction, err error)
- func (c *Client) CtlAddBatch(args *eth.RollupForgeBatchArgs)
- func (c *Client) CtlAddBlocks(blocks []common.BlockData) (err error)
- func (c *Client) CtlAddERC20(tokenAddr ethCommon.Address, constants eth.ERC20Consts)
- func (c *Client) CtlLastBlock() *common.Block
- func (c *Client) CtlLastForgedBatch() int64
- func (c *Client) CtlMineBlock()
- func (c *Client) CtlRollback()
- func (c *Client) CtlSetAddr(addr ethCommon.Address)
- func (c *Client) Debugf(template string, args ...interface{})
- func (c *Client) Debugw(template string, kv ...interface{})
- func (c *Client) EthAddress() (*ethCommon.Address, error)
- func (c *Client) EthBlockByNumber(ctx context.Context, blockNum int64) (*common.Block, error)
- func (c *Client) EthCall(ctx context.Context, tx *types.Transaction, blockNum *big.Int) ([]byte, error)
- func (c *Client) EthChainID() (*big.Int, error)
- func (c *Client) EthERC20Consts(tokenAddr ethCommon.Address) (*eth.ERC20Consts, error)
- func (c *Client) EthKeyStore() *ethKeystore.KeyStore
- func (c *Client) EthLastBlock() (int64, error)
- func (c *Client) EthNonceAt(ctx context.Context, account ethCommon.Address, blockNumber *big.Int) (uint64, error)
- func (c *Client) EthPendingNonceAt(ctx context.Context, account ethCommon.Address) (uint64, error)
- func (c *Client) EthSuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (c *Client) EthTransactionReceipt(ctx context.Context, txHash ethCommon.Hash) (*types.Receipt, error)
- func (c *Client) RollupAddToken(tokenAddress ethCommon.Address, feeAddToken *big.Int, deadline *big.Int) (tx *types.Transaction, err error)
- func (c *Client) RollupAddTokenSimple(tokenAddress ethCommon.Address, feeAddToken *big.Int) (tx *types.Transaction, err error)
- func (c *Client) RollupConstants() (*common.RollupConstants, error)
- func (c *Client) RollupEventInit(genesisBlockNum int64) (*eth.RollupEventInitialize, int64, error)
- func (c *Client) RollupEventsByBlock(blockNum int64, blockHash *ethCommon.Hash) (*eth.RollupEvents, error)
- func (c *Client) RollupForgeBatch(args *eth.RollupForgeBatchArgs, auth *bind.TransactOpts) (tx *types.Transaction, err error)
- func (c *Client) RollupForgeBatchArgs(ethTxHash ethCommon.Hash, l1UserTxsLen uint16) (*eth.RollupForgeBatchArgs, *ethCommon.Address, error)
- func (c *Client) RollupGetCurrentTokens() (*big.Int, error)
- func (c *Client) RollupL1UserTxERC20ETH(fromBJJ babyjub.PublicKeyComp, fromIdx int64, depositAmount *big.Int, ...) (tx *types.Transaction, err error)
- func (c *Client) RollupL1UserTxERC20Permit(fromBJJ babyjub.PublicKeyComp, fromIdx int64, depositAmount *big.Int, ...) (tx *types.Transaction, err error)
- func (c *Client) RollupLastForgedBatch() (int64, error)
- func (c *Client) RollupRegisterTokensCount() (*big.Int, error)
- func (c *Client) RollupUpdateFeeAddToken(newFeeAddToken *big.Int) (tx *types.Transaction, err error)
- func (c *Client) RollupUpdateForgeL1L2BatchTimeout(newForgeL1Timeout int64) (tx *types.Transaction, err error)
- func (c *Client) RollupWithdrawCircuit(proofA, proofC [2]*big.Int, proofB [2][2]*big.Int, tokenID uint32, ...) (*types.Transaction, error)
- func (c *Client) RollupWithdrawMerkleProof(babyPubKey babyjub.PublicKeyComp, tokenID uint32, numExitRoot, idx int64, ...) (tx *types.Transaction, err error)
- func (c *Client) WDelayerChangeWithdrawalDelay(newWithdrawalDelay uint64) (tx *types.Transaction, err error)
- func (c *Client) WDelayerClaimEmergencyCouncil() (tx *types.Transaction, err error)
- func (c *Client) WDelayerClaimGovernance() (tx *types.Transaction, err error)
- func (c *Client) WDelayerConstants() (*common.WDelayerConstants, error)
- func (c *Client) WDelayerDeposit(onwer, token ethCommon.Address, amount *big.Int) (tx *types.Transaction, err error)
- func (c *Client) WDelayerDepositInfo(owner, token ethCommon.Address) (eth.DepositState, error)
- func (c *Client) WDelayerEnableEmergencyMode() (tx *types.Transaction, err error)
- func (c *Client) WDelayerEscapeHatchWithdrawal(to, token ethCommon.Address, amount *big.Int) (tx *types.Transaction, err error)
- func (c *Client) WDelayerEventInit(genesisBlockNum int64) (*eth.WDelayerEventInitialize, int64, error)
- func (c *Client) WDelayerEventsByBlock(blockNum int64, blockHash *ethCommon.Hash) (*eth.WDelayerEvents, error)
- func (c *Client) WDelayerGetEmergencyCouncil() (*ethCommon.Address, error)
- func (c *Client) WDelayerGetEmergencyModeStartingTime() (int64, error)
- func (c *Client) WDelayerGetHermezGovernanceAddress() (*ethCommon.Address, error)
- func (c *Client) WDelayerGetWithdrawalDelay() (int64, error)
- func (c *Client) WDelayerIsEmergencyMode() (bool, error)
- func (c *Client) WDelayerTransferEmergencyCouncil(newAddress ethCommon.Address) (tx *types.Transaction, err error)
- func (c *Client) WDelayerTransferGovernance(newAddress ethCommon.Address) (tx *types.Transaction, err error)
- func (c *Client) WDelayerWithdrawal(owner, token ethCommon.Address) (tx *types.Transaction, err error)
- type ClientSetup
- type EthereumBlock
- type RollupBlock
- type Timer
- type WDelayerBlock
Constants ¶
This section is empty.
Variables ¶
var Block0 common.Block = common.Block{ Num: 0, Hash: ethCommon.Hash([32]byte{ 212, 229, 103, 64, 248, 118, 174, 248, 192, 16, 184, 106, 64, 213, 245, 103, 69, 161, 24, 208, 144, 106, 52, 230, 154, 236, 140, 13, 177, 203, 143, 163, }), Timestamp: time.Date(2015, time.July, 30, 3, 26, 13, 0, time.UTC), }
Block0 represents Ethereum's genesis block, which is stored by default at HistoryDB
var EthToken common.Token = common.Token{ TokenID: 0, Name: "Ether", Symbol: "ETH", Decimals: 18, EthBlockNum: 0, EthAddr: ethCommon.BigToAddress(big.NewInt(0)), }
EthToken represents the Ether coin, which is stored by default in the DB with TokenID = 0
Functions ¶
func AssertUSD ¶
AssertUSD asserts pointers to float64, and checks that they are equal with a tolerance of 0.01%. After that, the actual value is setted to the expected value in order to be able to perform further assertions using the standar assert functions.
func GenAccounts ¶
func GenAccounts(totalAccounts, userAccounts int, tokens []common.Token, userAddr *ethCommon.Address, userBjj *babyjub.PublicKey, batches []common.Batch) []common.Account
GenAccounts generates accounts. WARNING: This is meant for DB/API testing, and may not be fully consistent with the protocol.
func GenAuths ¶
func GenAuths(nAuths int, chainID uint16, hermezContractAddr ethCommon.Address) []*common.AccountCreationAuth
GenAuths generates account creation authorizations
func GenBatches ¶
GenBatches generates batches. WARNING: This is meant for DB/API testing, and may not be fully consistent with the protocol.
func GenBids ¶
GenBids generates bids. WARNING: This is meant for DB/API testing, and may not be fully consistent with the protocol.
func GenBlocks ¶
GenBlocks generates block from, to block numbers. WARNING: This is meant for DB/API testing, and may not be fully consistent with the protocol.
func GenCoordinators ¶
func GenCoordinators(nCoords int, blocks []common.Block) []common.Coordinator
GenCoordinators generates coordinators. WARNING: This is meant for DB/API testing, and may not be fully consistent with the protocol.
func GenExitTree ¶
func GenExitTree(n int, batches []common.Batch, accounts []common.Account, blocks []common.Block) []common.ExitInfo
GenExitTree generates an exitTree (as an array of Exits)
func GenL1Txs ¶
func GenL1Txs( fromIdx int, totalTxs, nUserTxs int, userAddr *ethCommon.Address, accounts []common.Account, tokens []common.Token, blocks []common.Block, batches []common.Batch, ) ([]common.L1Tx, []common.L1Tx)
GenL1Txs generates L1 txs. WARNING: This is meant for DB/API testing, and may not be fully consistent with the protocol.
func GenL2Txs ¶
func GenL2Txs( fromIdx int, totalTxs, nUserTxs int, userAddr *ethCommon.Address, accounts []common.Account, tokens []common.Token, blocks []common.Block, batches []common.Batch, ) ([]common.L2Tx, []common.L2Tx)
GenL2Txs generates L2 txs. WARNING: This is meant for DB/API testing, and may not be fully consistent with the protocol.
func GenPoolTxs ¶
GenPoolTxs generates L2 pool txs. WARNING: This tx doesn't follow the protocol (signature, txID, ...) it's just to test getting/setting from/to the DB.
func GenTokens ¶
func GenTokens(nTokens int, blocks []common.Block) (tokensToAddInDB []common.Token, ethToken common.Token)
GenTokens generates tokens. WARNING: This is meant for DB/API testing, and may not be fully consistent with the protocol.
func GetNextToForgeNumAndBatch ¶
GetNextToForgeNumAndBatch returns the next BatchNum and ForgeL1TxsNum to be added
Types ¶
type AuctionBlock ¶
type AuctionBlock struct { State eth.AuctionState Vars common.AuctionVariables Events eth.AuctionEvents Txs map[ethCommon.Hash]*types.Transaction Constants *common.AuctionConstants Eth *EthereumBlock }
AuctionBlock stores all the data related to the Auction SC from an ethereum block
type Block ¶
type Block struct { Rollup *RollupBlock Auction *AuctionBlock WDelayer *WDelayerBlock Eth *EthereumBlock }
Block represents a ethereum block
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the eth.ClientInterface interface, allowing to manipulate the values for testing, working with deterministic results.
func NewClient ¶
NewClient returns a new test Client that implements the eth.IClient interface, at the given initialBlockNumber.
func (*Client) AuctionBid ¶
func (c *Client) 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. This implementation behaves as if any address has infinite tokens.
func (*Client) AuctionBidSimple ¶
func (c *Client) AuctionBidSimple(slot int64, bidAmount *big.Int) (tx *types.Transaction, err error)
AuctionBidSimple is a wrapper around AuctionBid that automatically sets `amount` and `deadline`.
func (*Client) AuctionCanForge ¶
AuctionCanForge is the interface to call the smart contract function
func (*Client) AuctionChangeDefaultSlotSetBid ¶
func (c *Client) AuctionChangeDefaultSlotSetBid(slotSet int64, newInitialMinBid *big.Int) (tx *types.Transaction, err error)
AuctionChangeDefaultSlotSetBid is the interface to call the smart contract function
func (*Client) AuctionClaimHEZ ¶
func (c *Client) AuctionClaimHEZ() (tx *types.Transaction, err error)
AuctionClaimHEZ is the interface to call the smart contract function
func (*Client) AuctionConstants ¶
func (c *Client) AuctionConstants() (*common.AuctionConstants, error)
AuctionConstants returns the Constants of the Auction Smart Contract
func (*Client) AuctionEventInit ¶
func (c *Client) AuctionEventInit(genesisBlockNum int64) (*eth.AuctionEventInitialize, int64, error)
AuctionEventInit returns the initialize event with its corresponding block number
func (*Client) AuctionEventsByBlock ¶
func (c *Client) AuctionEventsByBlock(blockNum int64, blockHash *ethCommon.Hash) (*eth.AuctionEvents, error)
AuctionEventsByBlock returns the events in a block that happened in the Auction Smart Contract
func (*Client) AuctionForge ¶
AuctionForge is the interface to call the smart contract function
func (*Client) AuctionGetAllocationRatio ¶
AuctionGetAllocationRatio is the interface to call the smart contract function
func (*Client) AuctionGetBootCoordinator ¶
AuctionGetBootCoordinator is the interface to call the smart contract function
func (*Client) AuctionGetClaimableHEZ ¶
AuctionGetClaimableHEZ is the interface to call the smart contract function
func (*Client) AuctionGetClosedAuctionSlots ¶
AuctionGetClosedAuctionSlots is the interface to call the smart contract function
func (*Client) AuctionGetCurrentSlotNumber ¶
AuctionGetCurrentSlotNumber is the interface to call the smart contract function
func (*Client) AuctionGetDefaultSlotSetBid ¶
AuctionGetDefaultSlotSetBid is the interface to call the smart contract function
func (*Client) AuctionGetDonationAddress ¶
AuctionGetDonationAddress is the interface to call the smart contract function
func (*Client) AuctionGetMinBidBySlot ¶
AuctionGetMinBidBySlot is the interface to call the smart contract function
func (*Client) AuctionGetOpenAuctionSlots ¶
AuctionGetOpenAuctionSlots is the interface to call the smart contract function
func (*Client) AuctionGetOutbidding ¶
AuctionGetOutbidding is the interface to call the smart contract function
func (*Client) AuctionGetSlotDeadline ¶
AuctionGetSlotDeadline is the interface to call the smart contract function
func (*Client) AuctionGetSlotNumber ¶
AuctionGetSlotNumber is the interface to call the smart contract function
func (*Client) AuctionGetSlotSet ¶
AuctionGetSlotSet is the interface to call the smart contract function
func (*Client) AuctionIsRegisteredCoordinator ¶
AuctionIsRegisteredCoordinator is the interface to call the smart contract function
func (*Client) AuctionMultiBid ¶
func (c *Client) AuctionMultiBid(amount *big.Int, startingSlot int64, endingSlot int64, slotSet [6]bool, maxBid, closedMinBid, deadline *big.Int) (tx *types.Transaction, err error)
AuctionMultiBid is the interface to call the smart contract function. This implementation behaves as if any address has infinite tokens.
func (*Client) AuctionSetAllocationRatio ¶
func (c *Client) AuctionSetAllocationRatio(newAllocationRatio [3]uint16) (tx *types.Transaction, err error)
AuctionSetAllocationRatio is the interface to call the smart contract function
func (*Client) AuctionSetBootCoordinator ¶
func (c *Client) AuctionSetBootCoordinator(newBootCoordinator ethCommon.Address, newBootCoordinatorURL string) (tx *types.Transaction, err error)
AuctionSetBootCoordinator is the interface to call the smart contract function
func (*Client) AuctionSetClosedAuctionSlots ¶
func (c *Client) AuctionSetClosedAuctionSlots(newClosedAuctionSlots uint16) (tx *types.Transaction, err error)
AuctionSetClosedAuctionSlots is the interface to call the smart contract function
func (*Client) AuctionSetCoordinator ¶
func (c *Client) AuctionSetCoordinator(forger ethCommon.Address, URL string) (tx *types.Transaction, err error)
AuctionSetCoordinator is the interface to call the smart contract function
func (*Client) AuctionSetDonationAddress ¶
func (c *Client) AuctionSetDonationAddress( newDonationAddress ethCommon.Address) (tx *types.Transaction, err error)
AuctionSetDonationAddress is the interface to call the smart contract function
func (*Client) AuctionSetOpenAuctionSlots ¶
func (c *Client) AuctionSetOpenAuctionSlots(newOpenAuctionSlots uint16) (tx *types.Transaction, err error)
AuctionSetOpenAuctionSlots is the interface to call the smart contract function
func (*Client) AuctionSetOutbidding ¶
func (c *Client) AuctionSetOutbidding(newOutbidding uint16) (tx *types.Transaction, err error)
AuctionSetOutbidding is the interface to call the smart contract function
func (*Client) AuctionSetSlotDeadline ¶
func (c *Client) AuctionSetSlotDeadline(newDeadline uint8) (tx *types.Transaction, err error)
AuctionSetSlotDeadline is the interface to call the smart contract function
func (*Client) AuctionUpdateCoordinatorInfo ¶
func (c *Client) AuctionUpdateCoordinatorInfo(forgerAddress ethCommon.Address, newWithdrawAddress ethCommon.Address, newURL string) (tx *types.Transaction, err error)
AuctionUpdateCoordinatorInfo is the interface to call the smart contract function
func (*Client) CtlAddBatch ¶
func (c *Client) CtlAddBatch(args *eth.RollupForgeBatchArgs)
CtlAddBatch adds forged batch to the Rollup, without checking any ZKProof
func (*Client) CtlAddBlocks ¶
CtlAddBlocks adds block data to the smarts contracts. The added blocks will appear as mined. Not thread safe.
func (*Client) CtlAddERC20 ¶
func (c *Client) CtlAddERC20(tokenAddr ethCommon.Address, constants eth.ERC20Consts)
CtlAddERC20 adds an ERC20 token to the blockchain.
func (*Client) CtlLastBlock ¶
CtlLastBlock returns the last blockNum without checks
func (*Client) CtlLastForgedBatch ¶
CtlLastForgedBatch returns the last batchNum without checks
func (*Client) CtlRollback ¶
func (c *Client) CtlRollback()
CtlRollback discards the last mined block. Use this to replace a mined block to simulate reorgs.
func (*Client) CtlSetAddr ¶
CtlSetAddr sets the address of the client
func (*Client) EthAddress ¶
EthAddress returns the ethereum address of the account loaded into the Client
func (*Client) EthBlockByNumber ¶
EthBlockByNumber returns the *common.Block for the given block number in a deterministic way. If number == -1, the latests known block is returned.
func (*Client) EthCall ¶
func (c *Client) 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 (*Client) EthChainID ¶
EthChainID returns the ChainID of the ethereum network
func (*Client) EthERC20Consts ¶
EthERC20Consts returns the constants defined for a particular ERC20 Token instance.
func (*Client) EthKeyStore ¶
func (c *Client) EthKeyStore() *ethKeystore.KeyStore
EthKeyStore returns the keystore in the Client
func (*Client) EthLastBlock ¶
EthLastBlock returns the last blockNum
func (*Client) EthNonceAt ¶
func (c *Client) 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 (*Client) EthPendingNonceAt ¶
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 (*Client) EthSuggestGasPrice ¶
EthSuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.
func (*Client) EthTransactionReceipt ¶
func (c *Client) EthTransactionReceipt(ctx context.Context, txHash ethCommon.Hash) (*types.Receipt, error)
EthTransactionReceipt returns the transaction receipt of the given txHash
func (*Client) RollupAddToken ¶
func (c *Client) RollupAddToken(tokenAddress ethCommon.Address, feeAddToken *big.Int, deadline *big.Int) (tx *types.Transaction, err error)
RollupAddToken is the interface to call the smart contract function
func (*Client) RollupAddTokenSimple ¶
func (c *Client) RollupAddTokenSimple(tokenAddress ethCommon.Address, feeAddToken *big.Int) (tx *types.Transaction, err error)
RollupAddTokenSimple is a wrapper around RollupAddToken that automatically sets `deadlie`.
func (*Client) RollupConstants ¶
func (c *Client) RollupConstants() (*common.RollupConstants, error)
RollupConstants returns the Constants of the Rollup Smart Contract
func (*Client) RollupEventInit ¶
RollupEventInit returns the initialize event with its corresponding block number
func (*Client) RollupEventsByBlock ¶
func (c *Client) RollupEventsByBlock(blockNum int64, blockHash *ethCommon.Hash) (*eth.RollupEvents, error)
RollupEventsByBlock returns the events in a block that happened in the Rollup Smart Contract
func (*Client) RollupForgeBatch ¶
func (c *Client) RollupForgeBatch(args *eth.RollupForgeBatchArgs, auth *bind.TransactOpts) (tx *types.Transaction, err error)
RollupForgeBatch is the interface to call the smart contract function
func (*Client) RollupForgeBatchArgs ¶
func (c *Client) RollupForgeBatchArgs(ethTxHash ethCommon.Hash, l1UserTxsLen uint16) (*eth.RollupForgeBatchArgs, *ethCommon.Address, error)
RollupForgeBatchArgs returns the arguments used in a ForgeBatch call in the Rollup Smart Contract in the given transaction
func (*Client) RollupGetCurrentTokens ¶
RollupGetCurrentTokens is the interface to call the smart contract function
func (*Client) RollupL1UserTxERC20ETH ¶
func (c *Client) RollupL1UserTxERC20ETH( fromBJJ babyjub.PublicKeyComp, fromIdx int64, depositAmount *big.Int, amount *big.Int, tokenID uint32, toIdx int64, ) (tx *types.Transaction, err error)
RollupL1UserTxERC20ETH sends an L1UserTx to the Rollup.
func (*Client) RollupL1UserTxERC20Permit ¶
func (c *Client) 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 (*Client) RollupLastForgedBatch ¶
RollupLastForgedBatch is the interface to call the smart contract function
func (*Client) RollupRegisterTokensCount ¶
RollupRegisterTokensCount is the interface to call the smart contract function
func (*Client) RollupUpdateFeeAddToken ¶
func (c *Client) RollupUpdateFeeAddToken(newFeeAddToken *big.Int) (tx *types.Transaction, err error)
RollupUpdateFeeAddToken is the interface to call the smart contract function
func (*Client) RollupUpdateForgeL1L2BatchTimeout ¶
func (c *Client) RollupUpdateForgeL1L2BatchTimeout(newForgeL1Timeout int64) (tx *types.Transaction, err error)
RollupUpdateForgeL1L2BatchTimeout is the interface to call the smart contract function
func (*Client) RollupWithdrawCircuit ¶
func (c *Client) 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 (*Client) RollupWithdrawMerkleProof ¶
func (c *Client) RollupWithdrawMerkleProof(babyPubKey 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
func (*Client) WDelayerChangeWithdrawalDelay ¶
func (c *Client) WDelayerChangeWithdrawalDelay(newWithdrawalDelay uint64) (tx *types.Transaction, err error)
WDelayerChangeWithdrawalDelay is the interface to call the smart contract function
func (*Client) WDelayerClaimEmergencyCouncil ¶
func (c *Client) WDelayerClaimEmergencyCouncil() (tx *types.Transaction, err error)
WDelayerClaimEmergencyCouncil is the interface to call the smart contract function
func (*Client) WDelayerClaimGovernance ¶
func (c *Client) WDelayerClaimGovernance() (tx *types.Transaction, err error)
WDelayerClaimGovernance is the interface to call the smart contract function
func (*Client) WDelayerConstants ¶
func (c *Client) WDelayerConstants() (*common.WDelayerConstants, error)
WDelayerConstants returns the Constants of the WDelayer Contract
func (*Client) WDelayerDeposit ¶
func (c *Client) WDelayerDeposit(onwer, token ethCommon.Address, amount *big.Int) ( tx *types.Transaction, err error)
WDelayerDeposit is the interface to call the smart contract function
func (*Client) WDelayerDepositInfo ¶
WDelayerDepositInfo is the interface to call the smart contract function
func (*Client) WDelayerEnableEmergencyMode ¶
func (c *Client) WDelayerEnableEmergencyMode() (tx *types.Transaction, err error)
WDelayerEnableEmergencyMode is the interface to call the smart contract function
func (*Client) WDelayerEscapeHatchWithdrawal ¶
func (c *Client) WDelayerEscapeHatchWithdrawal(to, token ethCommon.Address, amount *big.Int) ( tx *types.Transaction, err error)
WDelayerEscapeHatchWithdrawal is the interface to call the smart contract function
func (*Client) WDelayerEventInit ¶
func (c *Client) WDelayerEventInit(genesisBlockNum int64) (*eth.WDelayerEventInitialize, int64, error)
WDelayerEventInit returns the initialize event with its corresponding block number
func (*Client) WDelayerEventsByBlock ¶
func (c *Client) WDelayerEventsByBlock(blockNum int64, blockHash *ethCommon.Hash) (*eth.WDelayerEvents, error)
WDelayerEventsByBlock returns the events in a block that happened in the WDelayer Contract
func (*Client) WDelayerGetEmergencyCouncil ¶
WDelayerGetEmergencyCouncil is the interface to call the smart contract function
func (*Client) WDelayerGetEmergencyModeStartingTime ¶
WDelayerGetEmergencyModeStartingTime is the interface to call the smart contract function
func (*Client) WDelayerGetHermezGovernanceAddress ¶
WDelayerGetHermezGovernanceAddress is the interface to call the smart contract function
func (*Client) WDelayerGetWithdrawalDelay ¶
WDelayerGetWithdrawalDelay is the interface to call the smart contract function
func (*Client) WDelayerIsEmergencyMode ¶
WDelayerIsEmergencyMode is the interface to call the smart contract function
func (*Client) WDelayerTransferEmergencyCouncil ¶
func (c *Client) WDelayerTransferEmergencyCouncil(newAddress ethCommon.Address) ( tx *types.Transaction, err error)
WDelayerTransferEmergencyCouncil is the interface to call the smart contract function
func (*Client) WDelayerTransferGovernance ¶
func (c *Client) WDelayerTransferGovernance(newAddress ethCommon.Address) (tx *types.Transaction, err error)
WDelayerTransferGovernance is the interface to call the smart contract function
func (*Client) WDelayerWithdrawal ¶
func (c *Client) WDelayerWithdrawal(owner, token ethCommon.Address) (tx *types.Transaction, err error)
WDelayerWithdrawal is the interface to call the smart contract function
type ClientSetup ¶
type ClientSetup struct { RollupConstants *common.RollupConstants RollupVariables *common.RollupVariables AuctionConstants *common.AuctionConstants AuctionVariables *common.AuctionVariables WDelayerConstants *common.WDelayerConstants WDelayerVariables *common.WDelayerVariables VerifyProof bool ChainID *big.Int }
ClientSetup is used to initialize the constants of the Smart Contracts and other details of the test Client
func NewClientSetupExample ¶
func NewClientSetupExample() *ClientSetup
NewClientSetupExample returns a ClientSetup example with hardcoded realistic values. With this setup, the rollup genesis will be block 1, and block 0 and 1 will be premined.
type EthereumBlock ¶
type EthereumBlock struct { BlockNum int64 Time int64 Hash ethCommon.Hash ParentHash ethCommon.Hash Tokens map[ethCommon.Address]eth.ERC20Consts Nonce uint64 }
EthereumBlock stores all the generic data related to the an ethereum block
type RollupBlock ¶
type RollupBlock struct { State eth.RollupState Vars common.RollupVariables Events eth.RollupEvents Txs map[ethCommon.Hash]*types.Transaction Constants *common.RollupConstants Eth *EthereumBlock }
RollupBlock stores all the data related to the Rollup SC from an ethereum block
type Timer ¶
type Timer interface {
Time() int64
}
Timer is an interface to simulate a source of time, useful to advance time virtually.
type WDelayerBlock ¶
type WDelayerBlock struct { // State eth.WDelayerState // TODO Vars common.WDelayerVariables Events eth.WDelayerEvents Txs map[ethCommon.Hash]*types.Transaction Constants *common.WDelayerConstants Eth *EthereumBlock }
WDelayerBlock stores all the data related to the WDelayer SC from an ethereum block
Directories ¶
Path | Synopsis |
---|---|
Package txsets contains Til sets of transactions & Transactions generation that are used at tests of other packages of hermez-node
|
Package txsets contains Til sets of transactions & Transactions generation that are used at tests of other packages of hermez-node |