Gas-Price Priority Auction
gas-price-priority-auction · auction-allocation · 486 B runtime · funds-movement
scores
- usefulness: 20
- safety: 70
- liveness: 60
- authenticity: 20
- extensibility: 30
- bytecodeDiscipline: 80
- practical: 46
source
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract GasPricePriorityAuction {
mapping(uint256 => uint256) public highestBid;
mapping(uint256 => address) public leader;
event BidPlaced(uint256 indexed blockNumber, address indexed bidder, uint256 gasPrice);
function bid() external {
uint256 blockNum = block.number;
uint256 gasPrice = tx.gasprice;
require(gasPrice > highestBid[blockNum], 'GasPricePriorityAuction: bid too low');
highestBid[blockNum] = gasPrice;
leader[blockNum] = msg.sender;
emit BidPlaced(blockNum, msg.sender, gasPrice);
}
}