arnaucube
arnaucube/hermez-nodePublic Self-hosted repository
hermez-node/common/ethauction.go
common/ethauction.goRaw
 1package common
 2
 3import (
 4	"math/big"
 5
 6	ethCommon "github.com/ethereum/go-ethereum/common"
 7)
 8
 9// AuctionConstants are the constants of the Rollup Smart Contract
10type AuctionConstants struct {
11	// Blocks per slot
12	BlocksPerSlot uint8 `json:"blocksPerSlot"`
13	// Minimum bid when no one has bid yet
14	InitialMinimalBidding *big.Int `json:"initialMinimalBidding"`
15	// First block where the first slot begins
16	GenesisBlockNum int64 `json:"genesisBlockNum"`
17	// ERC777 token with which the bids will be made
18	TokenHEZ ethCommon.Address `json:"tokenHEZ"`
19	// HermezRollup smartcontract address
20	HermezRollup ethCommon.Address `json:"hermezRollup"`
21	// Hermez Governanze Token smartcontract address who controls some parameters and collects HEZ fee
22	// Only for test
23	GovernanceAddress ethCommon.Address `json:"governanceAddress"`
24}
25
26// AuctionVariables are the variables of the Auction Smart Contract
27type AuctionVariables struct {
28	EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
29	// Boot Coordinator Address
30	DonationAddress ethCommon.Address `json:"donationAddress" meddler:"donation_address" validate:"required"`
31	// Boot Coordinator Address
32	BootCoordinator ethCommon.Address `json:"bootCoordinator" meddler:"boot_coordinator" validate:"required"`
33	// The minimum bid value in a series of 6 slots
34	DefaultSlotSetBid [6]*big.Int `json:"defaultSlotSetBid" meddler:"default_slot_set_bid,json" validate:"required"`
35	// Distance (#slots) to the closest slot to which you can bid ( 2 Slots = 2 * 40 Blocks = 20 min )
36	ClosedAuctionSlots uint16 `json:"closedAuctionSlots" meddler:"closed_auction_slots" validate:"required"`
37	// Distance (#slots) to the farthest slot to which you can bid (30 days = 4320 slots )
38	OpenAuctionSlots uint16 `json:"openAuctionSlots" meddler:"open_auction_slots" validate:"required"`
39	// How the HEZ tokens deposited by the slot winner are distributed (Burn: 40% - Donation: 40% - HGT: 20%)
40	AllocationRatio [3]uint16 `json:"allocationRatio" meddler:"allocation_ratio,json" validate:"required"`
41	// Minimum outbid (percentage) over the previous one to consider it valid
42	Outbidding uint16 `json:"outbidding" meddler:"outbidding" validate:"required"`
43	// Number of blocks at the end of a slot in which any coordinator can forge if the winner has not forged one before
44	SlotDeadline uint8 `json:"slotDeadline" meddler:"slot_deadline" validate:"required"`
45}