Auction Contract in detail
This section walks you through the functions of the Auction contract: what arguments are expected, what are the requirements and what is returned.
Last updated
This section walks you through the functions of the Auction contract: what arguments are expected, what are the requirements and what is returned.
Last updated
File | Type | Proxy |
---|---|---|
getPriceToPay
Since the function bid
is payable, it is important to check the price to pay beforehand, hence the function getPriceToPay
.
Parameters:
_nodeOpAddr
: the address of the operator who will make the bid. The price to pay can vary depending on the whitelist. Whitelisted operators won't have to pay the 1ETH bond per bid. Join the Discord and get in touch the tech team to ask for a whitelisted access.
_discountRates
: as it is possible to make multiple bids in one transaction, an array of discount rates (in percentage from 0 (0%) to 10_000 (100%)) is expected.
_timesInDays
: as it is possible to make multiple bids in one transaction, an array of validation durations (in days) is expected.
Returns:
The price to pay for the specified bid(s) parameters. The 1ETH bond for each bid is included in the result.
Requirements:
The two entry arrays must have the same length.
Every discountRate
must be lower than the maxDiscountRate
authorized by Byzantine.
Every timeInDays
must be higher than the minDuration
authorized by Byzantine.
bid
Allows an operator to make one or several bids in a single transaction. If you only want to make one bid, just create an array of size 1.
Parameters:
msg.value
: bid
is a payable
function. The caller must send the corresponding amount of ETH to cover his bid(s) price(s). Check getPriceToPay
for more information.
If not enough ETH are sent, the transaction will revert. If to many ETH are sent, the surplus will be returned to the caller.
_discountRates
: as it is possible to make multiple bids, an array of discount rates (in percentage from 0 (0%) to 10000 (100%)) is expected, upscaled to accept up to two percentage decimal points.
_timesInDays
: as it is possible to make multiple bids, an array of validation durations (in days) is expected.
Returns:
The Auction Scores of each bid. The indexes are respected: the first Auction Score corresponds to the first bid, the second to the second bid, etc.
Requirements:
The ETH sent in the transaction (msg.value
) must be equal or greater than the price to pay for the bid(s).
The two entry arrays must have the same length.
Every discountRate
must be lower than the maxDiscountRate
authorized by Byzantine.
Every timeInDays
must be higher than the minDuration
authorized by Byzantine.
Bids can be updated only one by one. It not possible to update a batch of bids.
getUpdateOneBidPrice
If the operator decides to update his bid to a higher price, they will have to pay the difference between the new and the last bid price. Thus, it is advised to call this function before calling updateOneBid
. If the operator decides to update to a lower bid price, the function will return 0 and, upon calling updateOneBid
, the Escrow
contract will refund the difference between the last and the new bid price.
Parameters:
_nodeOpAddr
: the address of the operator who wishes to update their bid.
_oldAuctionScore
: the current Auction Score of the bid to update
_newDiscountRate
: the new discountRate (in percentage from 0 (0%) to 10000 (100%)), upscaled to accept up to two percentage decimal points
_newTimeInDays
: the new validavalidation duration (in days)
Returns:
The amount to add if the operator updates to a higher bid, zero if they update to a lower bid.
Requirements:
_nodeOpAddr
must have at least one bid with Auction Score _oldAuctionScore
.
_newDiscountRate
must be lower than the maxDiscountRate
authorized by Byzantine.
_newTimeInDays
must be higher than the minDuration
authorized by Byzantine.
updateOneBid
Allows an operator to update an existing bid (either by increasing or decreasing the bid).
Parameters:
msg.value
: updateOneBid
is a payable
function. The caller must send a positive amount of ETH if he outbids. Check getUpdateOneBidPrice
for more information.
If the caller wants to decrease their bid, msg.value
can be set at 0ETH. If too many ETH are sent, the surplus will be returned to the caller.
_oldAuctionScore
: the current Auction Score of the bid to update (this mechanism will change soon as it is difficult to retrieve the Auction Score of an existing bid).
_newDiscountRate
: the new discountRate (in percentage from 0 (0%) to 10_000 (100%))
_newTimeInDays
: the new validation duration (in days)
Returns:
The new Auction Score of the updated bid.
Requirements:
The ETH sent in the transation (msg.value
) must be equal or greater than the amount to add for the update.
The caller must have at least one bid with Auction Score _oldAuctionScore
.
_newDiscountRate
must be lower than the maxDiscountRate
authorized by Byzantine.
_newTimeInDays
must be higher than the minDuration
authorized by Byzantine.
withdrawBid
Allows an operator to withdraw a bid and be refunded of the bid price and the bond.
Entries:
_auctionScore
: the current Auction Score of the bid to withdraw. If several bids made by this operator have the same Auction Score, it refunds the price of the last one.
Requirements:
The caller must have at least one bid with Auction Score _auctionScore
.
getNodeOpBidNumber
Returns the number of pending bids of a node operator. If an operator win an auction, his number of pending bids is reduced by 1.
getNodeOpAuctionScoreBidPrices
Returns the price of all bids of a node operator associated to a specific Auction Score.
Entries:
_nodeOpAddr
: the address of the node operator
_auctionScore
: the Auction Score of the bid(s) to retrieve
Note: If _nodeOpAddr
doesn't have a bid with _auctionScore
, the function returns an empty array.
getNodeOpAuctionScoreVcs
Exact same function as getNodeOpAuctionScoreBidPrices
, but for the VCs associated to a node operator's bid.
It is possible to access the current Auction configuration parameters by calling the following functions:
numNodeOpsInAuction
Returns the number of different node operators that have made a bid and are waiting to join a DV.
expectedDailyReturnWei
Returns the expected daily PoS rewards of a full Ethereum validator used to calculate the VC price (in Wei).
maxDiscountRate
Returns the maximum operator discount rate authorized by Byzantine (in percentage upscaled by 10e2, so 20% would be returned as 2000).
minDuration
Returns the minimum validating duration authorized by Byzantine (in days).
clusterSize
Returns the number of operators in a DV cluster.
Singleton