Remove big.Int from state API

This commit is contained in:
ToniRamirezM
2021-01-12 17:27:30 +01:00
parent a5643c16f6
commit 170da500db
7 changed files with 135 additions and 49 deletions

View File

@@ -52,27 +52,27 @@ func (c *AuctionConstants) RelativeBlock(blockNum int64) int64 {
// AuctionVariables are the variables of the Auction Smart Contract
type AuctionVariables struct {
EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
EthBlockNum int64 `meddler:"eth_block_num"`
// Donation Address
DonationAddress ethCommon.Address `json:"donationAddress" meddler:"donation_address" validate:"required"`
DonationAddress ethCommon.Address `meddler:"donation_address" validate:"required"`
// Boot Coordinator Address
BootCoordinator ethCommon.Address `json:"bootCoordinator" meddler:"boot_coordinator" validate:"required"`
BootCoordinator ethCommon.Address `meddler:"boot_coordinator" validate:"required"`
// Boot Coordinator URL
BootCoordinatorURL string `json:"bootCoordinatorUrl" meddler:"boot_coordinator_url" validate:"required"`
BootCoordinatorURL string `meddler:"boot_coordinator_url" validate:"required"`
// The minimum bid value in a series of 6 slots
DefaultSlotSetBid [6]*big.Int `json:"defaultSlotSetBid" meddler:"default_slot_set_bid,json" validate:"required"`
DefaultSlotSetBid [6]*big.Int `meddler:"default_slot_set_bid,json" validate:"required"`
// SlotNum at which the new default_slot_set_bid applies
DefaultSlotSetBidSlotNum int64 `json:"defaultSlotSetBidSlotNum" meddler:"default_slot_set_bid_slot_num"`
DefaultSlotSetBidSlotNum int64 `meddler:"default_slot_set_bid_slot_num"`
// Distance (#slots) to the closest slot to which you can bid ( 2 Slots = 2 * 40 Blocks = 20 min )
ClosedAuctionSlots uint16 `json:"closedAuctionSlots" meddler:"closed_auction_slots" validate:"required"`
ClosedAuctionSlots uint16 `meddler:"closed_auction_slots" validate:"required"`
// Distance (#slots) to the farthest slot to which you can bid (30 days = 4320 slots )
OpenAuctionSlots uint16 `json:"openAuctionSlots" meddler:"open_auction_slots" validate:"required"`
OpenAuctionSlots uint16 `meddler:"open_auction_slots" validate:"required"`
// How the HEZ tokens deposited by the slot winner are distributed (Burn: 40% - Donation: 40% - HGT: 20%)
AllocationRatio [3]uint16 `json:"allocationRatio" meddler:"allocation_ratio,json" validate:"required"`
AllocationRatio [3]uint16 `meddler:"allocation_ratio,json" validate:"required"`
// Minimum outbid (percentage) over the previous one to consider it valid
Outbidding uint16 `json:"outbidding" meddler:"outbidding" validate:"required"`
Outbidding uint16 `meddler:"outbidding" validate:"required"`
// 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 `json:"slotDeadline" meddler:"slot_deadline" validate:"required"`
SlotDeadline uint8 `meddler:"slot_deadline" validate:"required"`
}
// Copy returns a deep copy of the Variables

View File

@@ -119,19 +119,19 @@ func (c *RollupConstants) FindVerifierIdx(MaxTx, NLevels int64) (int, error) {
// BucketParams are the parameter variables of each Bucket of Rollup Smart
// Contract
type BucketParams struct {
CeilUSD *big.Int `json:"ceilUSD"`
Withdrawals *big.Int `json:"withdrawals"`
BlockWithdrawalRate *big.Int `json:"blockWithdrawalRate"`
MaxWithdrawals *big.Int `json:"maxWithdrawals"`
CeilUSD *big.Int
Withdrawals *big.Int
BlockWithdrawalRate *big.Int
MaxWithdrawals *big.Int
}
// BucketUpdate are the bucket updates (tracking the withdrawals value changes)
// in Rollup Smart Contract
type BucketUpdate struct {
EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
NumBucket int `json:"numBucket" meddler:"num_bucket"`
BlockStamp int64 `json:"blockStamp" meddler:"block_stamp"`
Withdrawals *big.Int `json:"withdrawals" meddler:"withdrawals,bigint"`
EthBlockNum int64 `meddler:"eth_block_num"`
NumBucket int `meddler:"num_bucket"`
BlockStamp int64 `meddler:"block_stamp"`
Withdrawals *big.Int `meddler:"withdrawals,bigint"`
}
// TokenExchange are the exchange value for tokens registered in the Rollup
@@ -144,12 +144,12 @@ type TokenExchange struct {
// RollupVariables are the variables of the Rollup Smart Contract
type RollupVariables struct {
EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
FeeAddToken *big.Int `json:"feeAddToken" meddler:"fee_add_token,bigint" validate:"required"`
ForgeL1L2BatchTimeout int64 `json:"forgeL1L2BatchTimeout" meddler:"forge_l1_timeout" validate:"required"`
WithdrawalDelay uint64 `json:"withdrawalDelay" meddler:"withdrawal_delay" validate:"required"`
Buckets [RollupConstNumBuckets]BucketParams `json:"buckets" meddler:"buckets,json"`
SafeMode bool `json:"safeMode" meddler:"safe_mode"`
EthBlockNum int64 `meddler:"eth_block_num"`
FeeAddToken *big.Int `meddler:"fee_add_token,bigint" validate:"required"`
ForgeL1L2BatchTimeout int64 `meddler:"forge_l1_timeout" validate:"required"`
WithdrawalDelay uint64 `meddler:"withdrawal_delay" validate:"required"`
Buckets [RollupConstNumBuckets]BucketParams `meddler:"buckets,json"`
SafeMode bool `meddler:"safe_mode"`
}
// Copy returns a deep copy of the Variables