Merge pull request #229 from hermeznetwork/feature/api-getstate

Add struct get state endpoint
This commit is contained in:
a_bennassar
2020-10-27 12:30:40 +01:00
committed by GitHub
7 changed files with 292 additions and 151 deletions

View File

@@ -61,21 +61,21 @@ type Coordinator struct {
// AuctionVariables are the variables of the Auction Smart Contract
type AuctionVariables struct {
// Boot Coordinator Address
DonationAddress ethCommon.Address
DonationAddress ethCommon.Address `json:"donationAddress" meddler:"donation_address"`
// Boot Coordinator Address
BootCoordinator ethCommon.Address
BootCoordinator ethCommon.Address `json:"bootCoordinator" meddler:"boot_coordinator"`
// The minimum bid value in a series of 6 slots
DefaultSlotSetBid [6]*big.Int
DefaultSlotSetBid [6]*big.Int `json:"defaultSlotSetBid" meddler:"default_slot_set_bid,json"`
// Distance (#slots) to the closest slot to which you can bid ( 2 Slots = 2 * 40 Blocks = 20 min )
ClosedAuctionSlots uint16
ClosedAuctionSlots uint16 `json:"closedAuctionSlots" meddler:"closed_auction_slots"`
// Distance (#slots) to the farthest slot to which you can bid (30 days = 4320 slots )
OpenAuctionSlots uint16
OpenAuctionSlots uint16 `json:"openAuctionSlots" meddler:"open_auction_slots"`
// How the HEZ tokens deposited by the slot winner are distributed (Burn: 40% - Donation: 40% - HGT: 20%)
AllocationRatio [3]uint16
AllocationRatio [3]uint16 `json:"allocationRatio" meddler:"allocation_ratio,json"`
// Minimum outbid (percentage) over the previous one to consider it valid
Outbidding uint16
Outbidding uint16 `json:"outbidding" meddler:"outbidding"`
// Number of blocks at the end of a slot in which any coordinator can forge if the winner has not forged one before
SlotDeadline uint8
SlotDeadline uint8 `json:"slotDeadline" meddler:"slot_deadline"`
}
// AuctionState represents the state of the Rollup in the Smart Contract

View File

@@ -109,11 +109,21 @@ type RollupPublicConstants struct {
WithdrawDelayerContract ethCommon.Address `json:"withdrawDelayerContract"`
}
// Bucket are the variables of each Bucket of Rollup Smart Contract
type Bucket struct {
CeilUSD uint64 `json:"ceilUSD"`
BlockStamp uint64 `json:"blockStamp"`
Withdrawals uint64 `json:"withdrawals"`
BlockWithdrawalRate uint64 `json:"blockWithdrawalRate"`
MaxWithdrawals uint64 `json:"maxWithdrawals"`
}
// RollupVariables are the variables of the Rollup Smart Contract
type RollupVariables struct {
FeeAddToken *big.Int
ForgeL1L2BatchTimeout int64
WithdrawalDelay uint64
FeeAddToken *big.Int `json:"feeAddToken" meddler:"fee_addtoken"`
ForgeL1L2BatchTimeout int64 `json:"forgeL1L2BatchTimeout" meddler:"forge_l1l2_timeout"`
WithdrawalDelay uint64 `json:"withdrawalDelay" meddler:"withdrawal_delay"`
Buckets [RollupConstNumBuckets]Bucket `json:"buckets" meddler:"buckets,json"`
}
// QueueStruct is the queue of L1Txs for a batch

View File

@@ -16,7 +16,7 @@ import (
WithdrawalDelayer "github.com/hermeznetwork/hermez-node/eth/contracts/withdrawdelayer"
)
// WDelayerConstants are the constants of the Rollup Smart Contract
// WDelayerConstants are the constants of the Withdrawal Delayer Smart Contract
type WDelayerConstants struct {
// Max Withdrawal Delay
MaxWithdrawalDelay uint64 `json:"maxWithdrawalDelay"`
@@ -26,6 +26,17 @@ type WDelayerConstants struct {
HermezRollup ethCommon.Address `json:"hermezRollup"`
}
// WDelayerVariables are the variables of the Withdrawal Delayer Smart Contract
type WDelayerVariables struct {
HermezRollupAddress ethCommon.Address `json:"hermezRollupAddress" meddler:"rollup_address"`
HermezGovernanceDAOAddress ethCommon.Address `json:"hermezGovernanceDAOAddress" meddler:"govdao_address"`
WhiteHackGroupAddress ethCommon.Address `json:"whiteHackGroupAddress" meddler:"whg_address"`
HermezKeeperAddress ethCommon.Address `json:"hermezKeeperAddress" meddler:"keeper_address"`
WithdrawalDelay uint64 `json:"withdrawalDelay" meddler:"withdrawal_delay"`
EmergencyModeStartingTime uint64 `json:"emergencyModeStartingTime" meddler:"emergency_start_time"`
EmergencyMode bool `json:"emergencyMode" meddler:"emergency_mode"`
}
// DepositState is the state of Deposit
type DepositState struct {
Amount *big.Int