Browse Source

Updates API to new changes

feature/sql-semaphore1
laisolizq 3 years ago
parent
commit
75c6d8f14e
5 changed files with 20 additions and 23 deletions
  1. +1
    -0
      api/api_test.go
  2. +13
    -20
      api/swagger.yml
  3. +1
    -2
      common/ethauction.go
  4. +1
    -1
      db/migrations/0001.sql
  5. +4
    -0
      eth/auction.go

+ 1
- 0
api/api_test.go

@ -369,6 +369,7 @@ func TestMain(m *testing.M) {
Outbidding: uint16(1),
SlotDeadline: uint8(20),
BootCoordinator: ethCommon.HexToAddress("0x1111111111111111111111111111111111111111"),
BootCoordinatorURL: "https://boot.coordinator.io",
ClosedAuctionSlots: uint16(2),
OpenAuctionSlots: uint16(5),
}

+ 13
- 20
api/swagger.yml

@ -2697,6 +2697,10 @@ components:
- $ref: '#/components/schemas/EthereumAddress'
- description: Ethereum address of the boot coordinator.
- example: "0x997dc4262BCDbf85190C01c996b4C06a461d2430"
bootCoordinatorUrl:
type: string
description: Boot Coordinator URL
example: "https://boot.coordinator.io"
slotDeadline:
type: integer
description: Number of blocks after the beginning of a slot after which any coordinator can forge if the winner has not forged any batch in that slot.
@ -2733,6 +2737,7 @@ components:
required:
- ethereumBlockNum
- bootCoordinator
- bootCoordinatorUrl
- slotDeadline
- closedAuctionSlots
- openAuctionSlots
@ -2804,21 +2809,16 @@ components:
properties:
ethereumBlockNum:
$ref: '#/components/schemas/EthBlockNum'
hermezGovernanceDAOAddress:
hermezGovernanceAddress:
allOf:
- $ref: '#/components/schemas/EthereumAddress'
- description: Ethereum address of the governance DAO.
- description: Ethereum address of the governance.
- example: "0x667dc4262BCDbf85190C01c996b4C06a461d2430"
whiteHackGroupAddress:
emergencyCouncilAddress:
allOf:
- $ref: '#/components/schemas/EthereumAddress'
- description: Ethereum Address that can claim the funds in an emergency when the maximum emergency mode time is exceeded.
- example: "0x557dc4262BCDbf85190C01c996b4C06a461d2430"
hermezKeeperAddress:
allOf:
- $ref: '#/components/schemas/EthereumAddress'
- description: Ethereum Address that can enable emergency mode and modify the delay to make a withdrawal.
- example: "0x557dc4262BCDbf85190C01c996b4C06a461d2430"
withdrawalDelay:
allOf:
- $ref: '#/components/schemas/EthBlockNum'
@ -2835,9 +2835,8 @@ components:
additionalProperties: false
required:
- ethereumBlockNum
- hermezGovernanceDAOAddress
- whiteHackGroupAddress
- hermezKeeperAddress
- hermezGovernanceAddress
- emergencyCouncilAddress
- withdrawalDelay
- emergencyModeStartingTime
- emergencyMode
@ -2925,16 +2924,11 @@ components:
- $ref: '#/components/schemas/EthereumAddress'
- description: Ethereum address of the auction smart contract.
- example: "0x111dc4262BCDbf85190C01c996b4C06a461d2430"
hermezGovernanceDAOAddress:
hermezGovernanceAddress:
allOf:
- $ref: '#/components/schemas/EthereumAddress'
- description: Ethereum address of the governanceDAO.
- description: Ethereum address of the governance.
- example: "0x222dc4262BCDbf85190C01c996b4C06a461d2430"
safetyAddress:
allOf:
- $ref: '#/components/schemas/EthereumAddress'
- description: Ethereum address of the safety.
- example: "0x333dc4262BCDbf85190C01c996b4C06a461d2430"
withdrawDelayerContract:
allOf:
- $ref: '#/components/schemas/EthereumAddress'
@ -2945,8 +2939,7 @@ components:
- absoluteMaxL1L2BatchTimeout
- verifiers
- hermezAuctionContract
- hermezGovernanceDAOAddress
- safetyAddress
- hermezGovernanceAddress
- withdrawDelayerContract
additionalProperties: false
maxFeeIdxCoordinator:

+ 1
- 2
common/ethauction.go

@ -25,7 +25,6 @@ type AuctionConstants struct {
// HermezRollup smartcontract address
HermezRollup ethCommon.Address `json:"hermezRollup"`
// Hermez Governanze Token smartcontract address who controls some parameters and collects HEZ fee
// Only for test
GovernanceAddress ethCommon.Address `json:"governanceAddress"`
}
@ -54,7 +53,7 @@ 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"`
// Boot Coordinator Address
// Donation Address
DonationAddress ethCommon.Address `json:"donationAddress" meddler:"donation_address" validate:"required"`
// Boot Coordinator Address
BootCoordinator ethCommon.Address `json:"bootCoordinator" meddler:"boot_coordinator" validate:"required"`

+ 1
- 1
db/migrations/0001.sql

@ -12,7 +12,7 @@ CREATE TABLE coordinator (
bidder_addr BYTEA NOT NULL,
forger_addr BYTEA NOT NULL,
eth_block_num BIGINT NOT NULL REFERENCES block (eth_block_num) ON DELETE CASCADE,
url VARCHAR(200) NOT NULL
url BYTEA NOT NULL
);
CREATE TABLE batch (

+ 4
- 0
eth/auction.go

@ -669,6 +669,10 @@ func (c *AuctionClient) AuctionVariables() (auctionVariables *common.AuctionVari
return tracerr.Wrap(err)
}
auctionVariables.BootCoordinator = *bootCoordinator
auctionVariables.BootCoordinatorURL, err = c.auction.BootCoordinatorURL(nil)
if err != nil {
return tracerr.Wrap(err)
}
auctionVariables.ClosedAuctionSlots, err = c.AuctionGetClosedAuctionSlots()
if err != nil {
return tracerr.Wrap(err)

Loading…
Cancel
Save