hermez-node/db/historydb/views.go
db/historydb/views.goRaw
1package historydb
2
3import (
4 "encoding/json"
5 "math/big"
6 "time"
7
8 ethCommon "github.com/ethereum/go-ethereum/common"
9 "github.com/hermeznetwork/hermez-node/api/apitypes"
10 "github.com/hermeznetwork/hermez-node/common"
11 "github.com/iden3/go-iden3-crypto/babyjub"
12 "github.com/iden3/go-merkletree"
13)
14
15// TxAPI is a representation of a generic Tx with additional information
16// required by the API, and extracted by joining block and token tables
17type TxAPI struct {
18 // Generic
19 IsL1 bool `meddler:"is_l1"`
20 TxID common.TxID `meddler:"id"`
21 ItemID uint64 `meddler:"item_id"`
22 Type common.TxType `meddler:"type"`
23 Position int `meddler:"position"`
24 FromIdx *apitypes.HezIdx `meddler:"from_idx"`
25 FromEthAddr *apitypes.HezEthAddr `meddler:"from_eth_addr"`
26 FromBJJ *apitypes.HezBJJ `meddler:"from_bjj"`
27 ToIdx apitypes.HezIdx `meddler:"to_idx"`
28 ToEthAddr *apitypes.HezEthAddr `meddler:"to_eth_addr"`
29 ToBJJ *apitypes.HezBJJ `meddler:"to_bjj"`
30 Amount apitypes.BigIntStr `meddler:"amount"`
31 HistoricUSD *float64 `meddler:"amount_usd"`
32 BatchNum *common.BatchNum `meddler:"batch_num"` // batchNum in which this tx was forged. If the tx is L2, this must be != 0
33 EthBlockNum int64 `meddler:"eth_block_num"` // Ethereum Block Number in which this L1Tx was added to the queue
34 // L1
35 ToForgeL1TxsNum *int64 `meddler:"to_forge_l1_txs_num"` // toForgeL1TxsNum in which the tx was forged / will be forged
36 UserOrigin *bool `meddler:"user_origin"` // true if the tx was originated by a user, false if it was aoriginated by a coordinator. Note that this differ from the spec for implementation simplification purpposes
37 DepositAmount *apitypes.BigIntStr `meddler:"deposit_amount"`
38 HistoricDepositAmountUSD *float64 `meddler:"deposit_amount_usd"`
39 AmountSuccess bool `meddler:"amount_success"`
40 DepositAmountSuccess bool `meddler:"deposit_amount_success"`
41 // L2
42 Fee *common.FeeSelector `meddler:"fee"`
43 HistoricFeeUSD *float64 `meddler:"fee_usd"`
44 Nonce *common.Nonce `meddler:"nonce"`
45 // API extras
46 Timestamp time.Time `meddler:"timestamp,utctime"`
47 TotalItems uint64 `meddler:"total_items"`
48 FirstItem uint64 `meddler:"first_item"`
49 LastItem uint64 `meddler:"last_item"`
50 TokenID common.TokenID `meddler:"token_id"`
51 TokenItemID uint64 `meddler:"token_item_id"`
52 TokenEthBlockNum int64 `meddler:"token_block"`
53 TokenEthAddr ethCommon.Address `meddler:"eth_addr"`
54 TokenName string `meddler:"name"`
55 TokenSymbol string `meddler:"symbol"`
56 TokenDecimals uint64 `meddler:"decimals"`
57 TokenUSD *float64 `meddler:"usd"`
58 TokenUSDUpdate *time.Time `meddler:"usd_update"`
59}
60
61// MarshalJSON is used to neast some of the fields of TxAPI
62// without the need of auxiliar structs
63func (tx TxAPI) MarshalJSON() ([]byte, error) {
64 jsonTx := map[string]interface{}{
65 "id": tx.TxID,
66 "itemId": tx.ItemID,
67 "type": tx.Type,
68 "position": tx.Position,
69 "fromAccountIndex": tx.FromIdx,
70 "fromHezEthereumAddress": tx.FromEthAddr,
71 "fromBJJ": tx.FromBJJ,
72 "toAccountIndex": tx.ToIdx,
73 "toHezEthereumAddress": tx.ToEthAddr,
74 "toBJJ": tx.ToBJJ,
75 "amount": tx.Amount,
76 "batchNum": tx.BatchNum,
77 "historicUSD": tx.HistoricUSD,
78 "timestamp": tx.Timestamp,
79 "L1Info": nil,
80 "L2Info": nil,
81 "token": map[string]interface{}{
82 "id": tx.TokenID,
83 "itemId": tx.TokenItemID,
84 "ethereumBlockNum": tx.TokenEthBlockNum,
85 "ethereumAddress": tx.TokenEthAddr,
86 "name": tx.TokenName,
87 "symbol": tx.TokenSymbol,
88 "decimals": tx.TokenDecimals,
89 "USD": tx.TokenUSD,
90 "fiatUpdate": tx.TokenUSDUpdate,
91 },
92 }
93 if tx.IsL1 {
94 jsonTx["L1orL2"] = "L1"
95 amountSuccess := tx.AmountSuccess
96 depositAmountSuccess := tx.DepositAmountSuccess
97 if tx.BatchNum == nil {
98 amountSuccess = false
99 depositAmountSuccess = false
100 }
101 jsonTx["L1Info"] = map[string]interface{}{
102 "toForgeL1TransactionsNum": tx.ToForgeL1TxsNum,
103 "userOrigin": tx.UserOrigin,
104 "depositAmount": tx.DepositAmount,
105 "amountSuccess": amountSuccess,
106 "depositAmountSuccess": depositAmountSuccess,
107 "historicDepositAmountUSD": tx.HistoricDepositAmountUSD,
108 "ethereumBlockNum": tx.EthBlockNum,
109 }
110 } else {
111 jsonTx["L1orL2"] = "L2"
112 jsonTx["L2Info"] = map[string]interface{}{
113 "fee": tx.Fee,
114 "historicFeeUSD": tx.HistoricFeeUSD,
115 "nonce": tx.Nonce,
116 }
117 }
118 return json.Marshal(jsonTx)
119}
120
121// txWrite is an representatiion that merges common.L1Tx and common.L2Tx
122// in order to perform inserts into tx table
123// EffectiveAmount and EffectiveDepositAmount are not set since they have default values in the DB
124type txWrite struct {
125 // Generic
126 IsL1 bool `meddler:"is_l1"`
127 TxID common.TxID `meddler:"id"`
128 Type common.TxType `meddler:"type"`
129 Position int `meddler:"position"`
130 FromIdx *common.Idx `meddler:"from_idx"`
131 EffectiveFromIdx *common.Idx `meddler:"effective_from_idx"`
132 ToIdx common.Idx `meddler:"to_idx"`
133 Amount *big.Int `meddler:"amount,bigint"`
134 AmountFloat float64 `meddler:"amount_f"`
135 TokenID common.TokenID `meddler:"token_id"`
136 BatchNum *common.BatchNum `meddler:"batch_num"` // batchNum in which this tx was forged. If the tx is L2, this must be != 0
137 EthBlockNum int64 `meddler:"eth_block_num"` // Ethereum Block Number in which this L1Tx was added to the queue
138 // L1
139 ToForgeL1TxsNum *int64 `meddler:"to_forge_l1_txs_num"` // toForgeL1TxsNum in which the tx was forged / will be forged
140 UserOrigin *bool `meddler:"user_origin"` // true if the tx was originated by a user, false if it was aoriginated by a coordinator. Note that this differ from the spec for implementation simplification purpposes
141 FromEthAddr *ethCommon.Address `meddler:"from_eth_addr"`
142 FromBJJ *babyjub.PublicKeyComp `meddler:"from_bjj"`
143 DepositAmount *big.Int `meddler:"deposit_amount,bigintnull"`
144 DepositAmountFloat *float64 `meddler:"deposit_amount_f"`
145 // L2
146 Fee *common.FeeSelector `meddler:"fee"`
147 Nonce *common.Nonce `meddler:"nonce"`
148}
149
150// TokenSymbolAndAddr token representation with only Eth addr and symbol
151type TokenSymbolAndAddr struct {
152 Symbol string `meddler:"symbol"`
153 Addr ethCommon.Address `meddler:"eth_addr"`
154}
155
156// TokenWithUSD add USD info to common.Token
157type TokenWithUSD struct {
158 ItemID uint64 `json:"itemId" meddler:"item_id"`
159 TokenID common.TokenID `json:"id" meddler:"token_id"`
160 EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"` // Ethereum block number in which this token was registered
161 EthAddr ethCommon.Address `json:"ethereumAddress" meddler:"eth_addr"`
162 Name string `json:"name" meddler:"name"`
163 Symbol string `json:"symbol" meddler:"symbol"`
164 Decimals uint64 `json:"decimals" meddler:"decimals"`
165 USD *float64 `json:"USD" meddler:"usd"`
166 USDUpdate *time.Time `json:"fiatUpdate" meddler:"usd_update,utctime"`
167 TotalItems uint64 `json:"-" meddler:"total_items"`
168 FirstItem uint64 `json:"-" meddler:"first_item"`
169 LastItem uint64 `json:"-" meddler:"last_item"`
170}
171
172// ExitAPI is a representation of a exit with additional information
173// required by the API, and extracted by joining token table
174type ExitAPI struct {
175 ItemID uint64 `meddler:"item_id"`
176 BatchNum common.BatchNum `meddler:"batch_num"`
177 AccountIdx apitypes.HezIdx `meddler:"account_idx"`
178 EthAddr *apitypes.HezEthAddr `meddler:"eth_addr"`
179 BJJ *apitypes.HezBJJ `meddler:"bjj"`
180 MerkleProof *merkletree.CircomVerifierProof `meddler:"merkle_proof,json"`
181 Balance apitypes.BigIntStr `meddler:"balance"`
182 InstantWithdrawn *int64 `meddler:"instant_withdrawn"`
183 DelayedWithdrawRequest *int64 `meddler:"delayed_withdraw_request"`
184 DelayedWithdrawn *int64 `meddler:"delayed_withdrawn"`
185 TotalItems uint64 `meddler:"total_items"`
186 FirstItem uint64 `meddler:"first_item"`
187 LastItem uint64 `meddler:"last_item"`
188 TokenID common.TokenID `meddler:"token_id"`
189 TokenItemID uint64 `meddler:"token_item_id"`
190 TokenEthBlockNum int64 `meddler:"token_block"`
191 TokenEthAddr ethCommon.Address `meddler:"token_eth_addr"`
192 TokenName string `meddler:"name"`
193 TokenSymbol string `meddler:"symbol"`
194 TokenDecimals uint64 `meddler:"decimals"`
195 TokenUSD *float64 `meddler:"usd"`
196 TokenUSDUpdate *time.Time `meddler:"usd_update"`
197}
198
199// MarshalJSON is used to neast some of the fields of ExitAPI
200// without the need of auxiliar structs
201func (e ExitAPI) MarshalJSON() ([]byte, error) {
202 return json.Marshal(map[string]interface{}{
203 "itemId": e.ItemID,
204 "batchNum": e.BatchNum,
205 "accountIndex": e.AccountIdx,
206 "bjj": e.BJJ,
207 "hezEthereumAddress": e.EthAddr,
208 "merkleProof": e.MerkleProof,
209 "balance": e.Balance,
210 "instantWithdraw": e.InstantWithdrawn,
211 "delayedWithdrawRequest": e.DelayedWithdrawRequest,
212 "delayedWithdraw": e.DelayedWithdrawn,
213 "token": map[string]interface{}{
214 "id": e.TokenID,
215 "itemId": e.TokenItemID,
216 "ethereumBlockNum": e.TokenEthBlockNum,
217 "ethereumAddress": e.TokenEthAddr,
218 "name": e.TokenName,
219 "symbol": e.TokenSymbol,
220 "decimals": e.TokenDecimals,
221 "USD": e.TokenUSD,
222 "fiatUpdate": e.TokenUSDUpdate,
223 },
224 })
225}
226
227// CoordinatorAPI is a representation of a coordinator with additional information
228// required by the API
229type CoordinatorAPI struct {
230 ItemID uint64 `json:"itemId" meddler:"item_id"`
231 Bidder ethCommon.Address `json:"bidderAddr" meddler:"bidder_addr"`
232 Forger ethCommon.Address `json:"forgerAddr" meddler:"forger_addr"`
233 EthBlockNum int64 `json:"ethereumBlock" meddler:"eth_block_num"`
234 URL string `json:"URL" meddler:"url"`
235 TotalItems uint64 `json:"-" meddler:"total_items"`
236 FirstItem uint64 `json:"-" meddler:"first_item"`
237 LastItem uint64 `json:"-" meddler:"last_item"`
238}
239
240// AccountAPI is a representation of a account with additional information
241// required by the API
242type AccountAPI struct {
243 ItemID uint64 `meddler:"item_id"`
244 Idx apitypes.HezIdx `meddler:"idx"`
245 BatchNum common.BatchNum `meddler:"batch_num"`
246 PublicKey apitypes.HezBJJ `meddler:"bjj"`
247 EthAddr apitypes.HezEthAddr `meddler:"eth_addr"`
248 Nonce common.Nonce `meddler:"nonce"` // max of 40 bits used
249 Balance *apitypes.BigIntStr `meddler:"balance"` // max of 192 bits used
250 TotalItems uint64 `meddler:"total_items"`
251 FirstItem uint64 `meddler:"first_item"`
252 LastItem uint64 `meddler:"last_item"`
253 TokenID common.TokenID `meddler:"token_id"`
254 TokenItemID int `meddler:"token_item_id"`
255 TokenEthBlockNum int64 `meddler:"token_block"`
256 TokenEthAddr ethCommon.Address `meddler:"token_eth_addr"`
257 TokenName string `meddler:"name"`
258 TokenSymbol string `meddler:"symbol"`
259 TokenDecimals uint64 `meddler:"decimals"`
260 TokenUSD *float64 `meddler:"usd"`
261 TokenUSDUpdate *time.Time `meddler:"usd_update"`
262}
263
264// MarshalJSON is used to neast some of the fields of AccountAPI
265// without the need of auxiliar structs
266func (account AccountAPI) MarshalJSON() ([]byte, error) {
267 jsonAccount := map[string]interface{}{
268 "itemId": account.ItemID,
269 "accountIndex": account.Idx,
270 "nonce": account.Nonce,
271 "balance": account.Balance,
272 "bjj": account.PublicKey,
273 "hezEthereumAddress": account.EthAddr,
274 "token": map[string]interface{}{
275 "id": account.TokenID,
276 "itemId": account.TokenItemID,
277 "ethereumBlockNum": account.TokenEthBlockNum,
278 "ethereumAddress": account.TokenEthAddr,
279 "name": account.TokenName,
280 "symbol": account.TokenSymbol,
281 "decimals": account.TokenDecimals,
282 "USD": account.TokenUSD,
283 "fiatUpdate": account.TokenUSDUpdate,
284 },
285 }
286 return json.Marshal(jsonAccount)
287}
288
289// BatchAPI is a representation of a batch with additional information
290// required by the API, and extracted by joining block table
291type BatchAPI struct {
292 ItemID uint64 `json:"itemId" meddler:"item_id"`
293 BatchNum common.BatchNum `json:"batchNum" meddler:"batch_num"`
294 EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
295 EthBlockHash ethCommon.Hash `json:"ethereumBlockHash" meddler:"hash"`
296 Timestamp time.Time `json:"timestamp" meddler:"timestamp,utctime"`
297 ForgerAddr ethCommon.Address `json:"forgerAddr" meddler:"forger_addr"`
298 CollectedFeesDB map[common.TokenID]*big.Int `json:"-" meddler:"fees_collected,json"`
299 CollectedFeesAPI apitypes.CollectedFeesAPI `json:"collectedFees" meddler:"-"`
300 TotalFeesUSD *float64 `json:"historicTotalCollectedFeesUSD" meddler:"total_fees_usd"`
301 StateRoot apitypes.BigIntStr `json:"stateRoot" meddler:"state_root"`
302 NumAccounts int `json:"numAccounts" meddler:"num_accounts"`
303 ExitRoot apitypes.BigIntStr `json:"exitRoot" meddler:"exit_root"`
304 ForgeL1TxsNum *int64 `json:"forgeL1TransactionsNum" meddler:"forge_l1_txs_num"`
305 SlotNum int64 `json:"slotNum" meddler:"slot_num"`
306 ForgedTxs int `json:"forgedTransactions" meddler:"forged_txs"`
307 TotalItems uint64 `json:"-" meddler:"total_items"`
308 FirstItem uint64 `json:"-" meddler:"first_item"`
309 LastItem uint64 `json:"-" meddler:"last_item"`
310}
311
312// MetricsAPI define metrics of the network
313type MetricsAPI struct {
314 TransactionsPerBatch float64 `json:"transactionsPerBatch"`
315 BatchFrequency float64 `json:"batchFrequency"`
316 TransactionsPerSecond float64 `json:"transactionsPerSecond"`
317 TokenAccounts int64 `json:"tokenAccounts"`
318 Wallets int64 `json:"wallets"`
319 AvgTransactionFee float64 `json:"avgTransactionFee"`
320 EstimatedTimeToForgeL1 float64 `json:"estimatedTimeToForgeL1" meddler:"estimated_time_to_forge_l1"`
321}
322
323// BidAPI is a representation of a bid with additional information
324// required by the API
325type BidAPI struct {
326 ItemID uint64 `json:"itemId" meddler:"item_id"`
327 SlotNum int64 `json:"slotNum" meddler:"slot_num"`
328 BidValue apitypes.BigIntStr `json:"bidValue" meddler:"bid_value"`
329 EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
330 Bidder ethCommon.Address `json:"bidderAddr" meddler:"bidder_addr"`
331 Forger ethCommon.Address `json:"forgerAddr" meddler:"forger_addr"`
332 URL string `json:"URL" meddler:"url"`
333 Timestamp time.Time `json:"timestamp" meddler:"timestamp,utctime"`
334 TotalItems uint64 `json:"-" meddler:"total_items"`
335 FirstItem uint64 `json:"-" meddler:"first_item"`
336 LastItem uint64 `json:"-" meddler:"last_item"`
337}
338
339// MinBidInfo gives information of the minum bid for specific slot(s)
340type MinBidInfo struct {
341 DefaultSlotSetBid [6]*big.Int `json:"defaultSlotSetBid" meddler:"default_slot_set_bid,json" validate:"required"`
342 DefaultSlotSetBidSlotNum int64 `json:"-" meddler:"default_slot_set_bid_slot_num"`
343}
344
345// BucketUpdateAPI are the bucket updates (tracking the withdrawals value changes)
346// in Rollup Smart Contract
347type BucketUpdateAPI struct {
348 EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
349 NumBucket int `json:"numBucket" meddler:"num_bucket"`
350 BlockStamp int64 `json:"blockStamp" meddler:"block_stamp"`
351 Withdrawals *apitypes.BigIntStr `json:"withdrawals" meddler:"withdrawals"`
352}
353
354// BucketParamsAPI are the parameter variables of each Bucket of Rollup Smart
355// Contract
356type BucketParamsAPI struct {
357 CeilUSD *apitypes.BigIntStr `json:"ceilUSD"`
358 Withdrawals *apitypes.BigIntStr `json:"withdrawals"`
359 BlockWithdrawalRate *apitypes.BigIntStr `json:"blockWithdrawalRate"`
360 MaxWithdrawals *apitypes.BigIntStr `json:"maxWithdrawals"`
361}
362
363// RollupVariablesAPI are the variables of the Rollup Smart Contract
364type RollupVariablesAPI struct {
365 EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
366 FeeAddToken *apitypes.BigIntStr `json:"feeAddToken" meddler:"fee_add_token" validate:"required"`
367 ForgeL1L2BatchTimeout int64 `json:"forgeL1L2BatchTimeout" meddler:"forge_l1_timeout" validate:"required"`
368 WithdrawalDelay uint64 `json:"withdrawalDelay" meddler:"withdrawal_delay" validate:"required"`
369 Buckets [common.RollupConstNumBuckets]BucketParamsAPI `json:"buckets" meddler:"buckets,json"`
370 SafeMode bool `json:"safeMode" meddler:"safe_mode"`
371}
372
373// NewRollupVariablesAPI creates a RollupVariablesAPI from common.RollupVariables
374func NewRollupVariablesAPI(rollupVariables *common.RollupVariables) *RollupVariablesAPI {
375 rollupVars := RollupVariablesAPI{
376 EthBlockNum: rollupVariables.EthBlockNum,
377 FeeAddToken: apitypes.NewBigIntStr(rollupVariables.FeeAddToken),
378 ForgeL1L2BatchTimeout: rollupVariables.ForgeL1L2BatchTimeout,
379 WithdrawalDelay: rollupVariables.WithdrawalDelay,
380 SafeMode: rollupVariables.SafeMode,
381 }
382
383 for i, bucket := range rollupVariables.Buckets {
384 rollupVars.Buckets[i] = BucketParamsAPI{
385 CeilUSD: apitypes.NewBigIntStr(bucket.CeilUSD),
386 Withdrawals: apitypes.NewBigIntStr(bucket.Withdrawals),
387 BlockWithdrawalRate: apitypes.NewBigIntStr(bucket.BlockWithdrawalRate),
388 MaxWithdrawals: apitypes.NewBigIntStr(bucket.MaxWithdrawals),
389 }
390 }
391 return &rollupVars
392}
393
394// AuctionVariablesAPI are the variables of the Auction Smart Contract
395type AuctionVariablesAPI struct {
396 EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
397 // DonationAddress Address where the donations will be sent
398 DonationAddress ethCommon.Address `json:"donationAddress" meddler:"donation_address" validate:"required"`
399 // BootCoordinator Address of the boot coordinator
400 BootCoordinator ethCommon.Address `json:"bootCoordinator" meddler:"boot_coordinator" validate:"required"`
401 // BootCoordinatorURL URL of the boot coordinator
402 BootCoordinatorURL string `json:"bootCoordinatorUrl" meddler:"boot_coordinator_url" validate:"required"`
403 // DefaultSlotSetBid The minimum bid value in a series of 6 slots
404 DefaultSlotSetBid [6]*apitypes.BigIntStr `json:"defaultSlotSetBid" meddler:"default_slot_set_bid,json" validate:"required"`
405 // DefaultSlotSetBidSlotNum SlotNum at which the new default_slot_set_bid applies
406 DefaultSlotSetBidSlotNum int64 `json:"defaultSlotSetBidSlotNum" meddler:"default_slot_set_bid_slot_num"`
407 // ClosedAuctionSlots Distance (#slots) to the closest slot to which you can bid ( 2 Slots = 2 * 40 Blocks = 20 min )
408 ClosedAuctionSlots uint16 `json:"closedAuctionSlots" meddler:"closed_auction_slots" validate:"required"`
409 // OpenAuctionSlots Distance (#slots) to the farthest slot to which you can bid (30 days = 4320 slots )
410 OpenAuctionSlots uint16 `json:"openAuctionSlots" meddler:"open_auction_slots" validate:"required"`
411 // AllocationRatio How the HEZ tokens deposited by the slot winner are distributed (Burn: 40% - Donation: 40% - HGT: 20%)
412 AllocationRatio [3]uint16 `json:"allocationRatio" meddler:"allocation_ratio,json" validate:"required"`
413 // Outbidding Minimum outbid (percentage) over the previous one to consider it valid
414 Outbidding uint16 `json:"outbidding" meddler:"outbidding" validate:"required"`
415 // SlotDeadline Number of blocks at the end of a slot in which any coordinator can forge if the winner has not forged one before
416 SlotDeadline uint8 `json:"slotDeadline" meddler:"slot_deadline" validate:"required"`
417}
418
419// NewAuctionVariablesAPI creates a AuctionVariablesAPI from common.AuctionVariables
420func NewAuctionVariablesAPI(auctionVariables *common.AuctionVariables) *AuctionVariablesAPI {
421 auctionVars := AuctionVariablesAPI{
422 EthBlockNum: auctionVariables.EthBlockNum,
423 DonationAddress: auctionVariables.DonationAddress,
424 BootCoordinator: auctionVariables.BootCoordinator,
425 BootCoordinatorURL: auctionVariables.BootCoordinatorURL,
426 DefaultSlotSetBidSlotNum: auctionVariables.DefaultSlotSetBidSlotNum,
427 ClosedAuctionSlots: auctionVariables.ClosedAuctionSlots,
428 OpenAuctionSlots: auctionVariables.OpenAuctionSlots,
429 Outbidding: auctionVariables.Outbidding,
430 SlotDeadline: auctionVariables.SlotDeadline,
431 }
432
433 for i, slot := range auctionVariables.DefaultSlotSetBid {
434 auctionVars.DefaultSlotSetBid[i] = apitypes.NewBigIntStr(slot)
435 }
436
437 for i, ratio := range auctionVariables.AllocationRatio {
438 auctionVars.AllocationRatio[i] = ratio
439 }
440
441 return &auctionVars
442}