diff --git a/EIPS/eip-1815.md b/EIPS/eip-1815.md new file mode 100644 index 0000000000000..e9c2bf1517604 --- /dev/null +++ b/EIPS/eip-1815.md @@ -0,0 +1,75 @@ +--- +eip: 1815 +title: Interface for blind auctions +author: Albert Acebrón (@corollari) +discussions-to: https://github.com/ethereum/EIPs/issues/1745 +status: Draft +type: Standards Track +category: ERC +created: 2019-03-04 +requires: 165 +--- + + +## Simple Summary +Standard interface for contracts implementing blind auctions. + +## Abstract +Currently there doesn't exist any standard interface/contract for blind auctions, creating a void that has been filled with many de-facto standards such as the one used by ENS[1] or the one used in the blind auction contract present in Solidity's documentation[2]. This ERC aims to remove this fragmentation by proposing a standard interface for blind auction contracts. + +## Motivation +Many different implementations of blind auctions [1][2][3][4][5] have appeared in the last years, each one reinventing the wheel and implementing blind auctions in ways that are conceptually similar but with special quirks and different interfaces, thus making it impossible for a system to interact with all of these without accommodating all these differences. This ERC aims to solve that by standarizing an interface for blind auctions contracts, which will enable the creation of systems that can interact with any blind auctions without requiring specialized code. + +## Specification +```solidity +pragma solidity ^0.5.0; + +/// @title ERC-1815 Interface for blind auctions +/// @dev See https://eips.ethereum.org/EIPS/eip-1815 +/// Note: the ERC-165 identifier for this interface is 0xe3594b02. +interface ERC1815 /* is ERC165 */ { + enum Mode { Open, Auction, Owned, Forbidden, Reveal, NotYetAvailable } + + event AuctionStarted(bytes32 indexed hash, uint registrationDate); + event NewBid(bytes32 indexed hash, address indexed bidder, uint deposit); + event BidRevealed(bytes32 indexed hash, address indexed owner, uint value, uint8 status); + event HashRegistered(bytes32 indexed hash, address indexed owner, uint value, uint registrationDate); + + function startAuction(bytes32 _hash) external; + function startAuctions(bytes32[] calldata _hashes) external; + function newBid(bytes32 sealedBid) external payable; + function startAuctionsAndBid(bytes32[] calldata hashes, bytes32 sealedBid) external payable; + function unsealBid(bytes32 _hash, uint _value, bytes32 _salt) external; + function cancelBid(address bidder, bytes32 seal) external; + function finalizeAuction(bytes32 _hash) external; + function entries(bytes32 _hash) external view returns (Mode, address, uint, uint, uint); +} + +/// @dev See https://eips.ethereum.org/EIPS/eip-165 +interface ERC165 { + function supportsInterface(bytes4 interfaceID) external view returns (bool); +} +``` + +## Rationale +The interface proposed has been chosen because it is the one used by the Ethereum Name System, which is the most popular project among the ones that use blind auctions, therefore being the one that has the most systems that integrate with it. By picking this interface we aim at minimizing the total amount of work that will be needed to migrate existing systems to the interface proposed, while maximizing the number of systems that will already be compatible with a contract implementing the interface described. + +## Backwards Compatibility +This EIP is backwards compatible with the Ethereum Name Service's blind auctions, the blind auction contract in the ETH community that has gained more traction and has the most systems interacting with it. + +## Test Cases +Not needed. + +## Implementation +[ENS' implementation](https://github.com/ensdomains/ens/blob/94f4861a7783d8986e81b976e823caa81a16f285/contracts/HashRegistrar.sol) +[corollari's clean room implementation](https://github.com/corollari/BlindAuction) + +## References +[1] [ENS](https://ens.domains/) +[2] [Blind auction in solidity's documentation](https://solidity.readthedocs.io/en/develop/solidity-by-example.html#blind-auction) +[3] [WaifuChain](https://waifuchain.moe) +[4] [Implementation using a FSM](https://arxiv.org/abs/1711.09327) +[5] [Implementation in a Solidity tutorial](https://programtheblockchain.com/posts/2018/03/27/writing-a-sealed-bid-auction-contract/) + +## Copyright +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).