ERC-7764:买方链上议价理念
eip: 7764
title: Buyer-Seller Negotiable Pricing
description: Allows buyers and sellers to freely negotiate and determine prices.
author: S7iter (@admi-n)
discussions-to: https://ethereum-magicians.org/t/erc-7764-buyer-seller-negotiable-pricing/20973
status: Draft
type: Standards Track
category: ERC
created: 2024-09-05
PR: Add ERC: Buyer-Seller Negotiable Pricing by admi-n · Pull Request #618 · ethereum/ERCs (github.com)
Abstract
This proposal introduces a new smart contract mechanism that allows buyers and sellers to freely negotiate and determine transaction prices on the Ethereum network. A new trading mode is added, where goods can be negotiated rather than only priced. This mechanism allows the seller to set an initial price, and the buyer can propose a new price through negotiation with the seller. Ultimately, both parties can reach an agreement and complete the transaction.
Motivation
Current smart contracts and decentralized applications (DApps) typically use a fixed-price model, where prices are set rather than negotiated. This model has many disadvantages, which may limit market flexibility and liquidity. A free price negotiation mechanism between buyers and sellers can better reflect market demand. This proposal introduces the most critical party in the transaction: the buyer’s personal needs and pricing intentions. It can promote more transaction functionalities and models, expand markets, facilitate transactions, and increase user participation and satisfaction.
Specification
Structure
The contract consists of the following main structures:
- Offer: Represents the item or token listed by the seller and its initial price.
- Negotiation: Represents the new price proposed by the buyer and whether it is accepted by the seller.
State Variables
mapping(uint256 => Offer) public offers;
: Stores detailed information on all listed items or tokens.mapping(uint256 => Negotiation) public negotiations;
: Stores detailed information on all price negotiations.uint256 public nextOfferId;
: Used to generate newofferId
.
Functions
function createOffer(uint256 price) external returns (uint256)
:
The seller creates a new listing for an item or token and sets an initial price. Returns theofferId
.function proposePrice(uint256 offerId, uint256 proposedPrice) external
:
The buyer proposes a new price for a specificofferId
. The new price is stored in thenegotiations
mapping.function acceptProposedPrice(uint256 offerId) external
:
The seller accepts the new price proposed by the buyer. The transaction is completed, and the new price becomes the final transaction price.
Events
event OfferCreated(uint256 offerId, address indexed seller, uint256 price)
:
Triggered when the seller creates a new listing for an item or token.event PriceProposed(uint256 offerId, address indexed buyer, uint256 proposedPrice)
:
Triggered when the buyer proposes a new price.event PriceAccepted(uint256 offerId, address indexed seller, uint256 acceptedPrice)
:
Triggered when the seller accepts the price proposed by the buyer.
Rationale
This proposal adopts a simple and flexible structure that enables buyers and sellers to negotiate prices at low cost and high efficiency. This mechanism can be applied to various scenarios, such as decentralized marketplaces and auction platforms.
Backwards Compatibility
This EIP introduces new functionality without affecting existing smart contract standards. It can be seamlessly integrated as an extension to existing markets and DApps.
Reference Implementation
Below is a sample Solidity smart contract that implements the core functionality of this proposal:
1 | // SPDX-License-Identifier: MIT |
Security Considerations
- Reentrancy attack: In contract functions, especially those involving fund transfer, the nonReentrant modifier or similar protection measures should be used to prevent reentrancy attacks.
- Malicious behavior: Ensure that the interests of both parties are protected during the price negotiation process, such as limiting the number of price negotiations or setting a timeout mechanism.
Copyright
Copyright and related rights waived via CC0.