arnaucube
arnaucube/hermez-nodePublic Self-hosted repository
hermez-node/common/ethwdelayer.go
common/ethwdelayer.goRaw
 1package common
 2
 3import (
 4	"math/big"
 5
 6	ethCommon "github.com/ethereum/go-ethereum/common"
 7)
 8
 9// WDelayerConstants are the constants of the Withdrawal Delayer Smart Contract
10type WDelayerConstants struct {
11	// Max Withdrawal Delay
12	MaxWithdrawalDelay uint64 `json:"maxWithdrawalDelay"`
13	// Max Emergency mode time
14	MaxEmergencyModeTime uint64 `json:"maxEmergencyModeTime"`
15	// HermezRollup smartcontract address
16	HermezRollup ethCommon.Address `json:"hermezRollup"`
17}
18
19// WDelayerEscapeHatchWithdrawal is an escape hatch withdrawal of the
20// Withdrawal Delayer Smart Contract
21type WDelayerEscapeHatchWithdrawal struct {
22	EthBlockNum int64             `json:"ethereumBlockNum" meddler:"eth_block_num"`
23	Who         ethCommon.Address `json:"who" meddler:"who_addr"`
24	To          ethCommon.Address `json:"to" meddler:"to_addr"`
25	TokenAddr   ethCommon.Address `json:"tokenAddr" meddler:"token_addr"`
26	Amount      *big.Int          `json:"amount" meddler:"amount,bigint"`
27}
28
29// WDelayerVariables are the variables of the Withdrawal Delayer Smart Contract
30type WDelayerVariables struct {
31	EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
32	// HermezRollupAddress        ethCommon.Address `json:"hermezRollupAddress" meddler:"rollup_address"`
33	HermezGovernanceAddress    ethCommon.Address `json:"hermezGovernanceAddress" meddler:"gov_address" validate:"required"`
34	EmergencyCouncilAddress    ethCommon.Address `json:"emergencyCouncilAddress" meddler:"emg_address" validate:"required"`
35	WithdrawalDelay            uint64            `json:"withdrawalDelay" meddler:"withdrawal_delay" validate:"required"`
36	EmergencyModeStartingBlock int64             `json:"emergencyModeStartingBlock" meddler:"emergency_start_block"`
37	EmergencyMode              bool              `json:"emergencyMode" meddler:"emergency_mode"`
38}
39
40// Copy returns a deep copy of the Variables
41func (v *WDelayerVariables) Copy() *WDelayerVariables {
42	vCpy := *v
43	return &vCpy
44}