You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.6 KiB

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