Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EIP: Buyer-Seller Negotiable Pricing Mechanism #8852

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions EIPS/eip-xxx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---

Check failure on line 1 in EIPS/eip-xxx.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble is missing header(s): `eip`

error[preamble-req]: preamble is missing header(s): `eip` --> EIPS/eip-xxx.md | | = help: see https://ethereum.github.io/eipw/preamble-req/

Check failure on line 1 in EIPS/eip-xxx.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble is missing header(s): `eip`

error[preamble-req]: preamble is missing header(s): `eip` --> EIPS/eip-xxx.md | | = help: see https://ethereum.github.io/eipw/preamble-req/
title: Buyer-Seller Negotiable Pricing Mechanism
description: Allows buyers and sellers to freely negotiate and determine transaction prices on the Ethereum network.

Check failure on line 3 in EIPS/eip-xxx.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble header `description` has extra whitespace

error[preamble-trim]: preamble header `description` has extra whitespace --> EIPS/eip-xxx.md:3:13 | 3 | description: Allows buyers and sellers to freely negotiate and determine transaction prices on the Ethereum network. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ value has extra whitespace | = help: see https://ethereum.github.io/eipw/preamble-trim/

Check failure on line 3 in EIPS/eip-xxx.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble header `description` has extra whitespace

error[preamble-trim]: preamble header `description` has extra whitespace --> EIPS/eip-xxx.md:3:13 | 3 | description: Allows buyers and sellers to freely negotiate and determine transaction prices on the Ethereum network. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ value has extra whitespace | = help: see https://ethereum.github.io/eipw/preamble-trim/
author: S7iter (@admi-n)
discussions-to:

Check failure on line 5 in EIPS/eip-xxx.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble header `discussions-to` is not a valid URL

error[preamble-discussions-to]: preamble header `discussions-to` is not a valid URL --> EIPS/eip-xxx.md:5:16 | 5 | discussions-to: | ^ relative URL without a base | = help: see https://ethereum.github.io/eipw/preamble-discussions-to/

Check failure on line 5 in EIPS/eip-xxx.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble header `discussions-to` should point to a thread on ethereum-magicians.org

error[preamble-re-discussions-to]: preamble header `discussions-to` should point to a thread on ethereum-magicians.org --> EIPS/eip-xxx.md:5:16 | 5 | discussions-to: | ^ required pattern was not matched | = info: the pattern in question: `^https://ethereum-magicians.org/t/[^/]+/[0-9]+$` = help: see https://ethereum.github.io/eipw/preamble-re-discussions-to/

Check failure on line 5 in EIPS/eip-xxx.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble header `discussions-to` is not a valid URL

error[preamble-discussions-to]: preamble header `discussions-to` is not a valid URL --> EIPS/eip-xxx.md:5:16 | 5 | discussions-to: | ^ relative URL without a base | = help: see https://ethereum.github.io/eipw/preamble-discussions-to/

Check failure on line 5 in EIPS/eip-xxx.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble header `discussions-to` should point to a thread on ethereum-magicians.org

error[preamble-re-discussions-to]: preamble header `discussions-to` should point to a thread on ethereum-magicians.org --> EIPS/eip-xxx.md:5:16 | 5 | discussions-to: | ^ required pattern was not matched | = info: the pattern in question: `^https://ethereum-magicians.org/t/[^/]+/[0-9]+$` = help: see https://ethereum.github.io/eipw/preamble-re-discussions-to/
status: Draft
type: Standards Track
category: Core
created: 2024-09-04
---

## 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 new `offerId`.

### 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 the `offerId`.
- `function proposePrice(uint256 offerId, uint256 proposedPrice) external`:
The buyer proposes a new price for a specific `offerId`. The new price is stored in the `negotiations` 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:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract NegotiablePricing {

struct Offer {
address seller;
uint256 price;
bool isActive;
}

struct Negotiation {
address buyer;
uint256 proposedPrice;
bool isAccepted;
}

mapping(uint256 => Offer) public offers;
mapping(uint256 => Negotiation) public negotiations;
uint256 public nextOfferId;

event OfferCreated(uint256 offerId, address indexed seller, uint256 price);
event PriceProposed(uint256 offerId, address indexed buyer, uint256 proposedPrice);
event PriceAccepted(uint256 offerId, address indexed seller, uint256 acceptedPrice);

function createOffer(uint256 price) external returns (uint256) {
uint256 offerId = nextOfferId++;
offers[offerId] = Offer({
seller: msg.sender,
price: price,
isActive: true
});
emit OfferCreated(offerId, msg.sender, price);
return offerId;
}

function proposePrice(uint256 offerId, uint256 proposedPrice) external {
require(offers[offerId].isActive, "Offer is not active");
require(proposedPrice > 0, "Price must be greater than 0");

negotiations[offerId] = Negotiation({
buyer: msg.sender,
proposedPrice: proposedPrice,
isAccepted: false
});

emit PriceProposed(offerId, msg.sender, proposedPrice);
}

function acceptProposedPrice(uint256 offerId) external {
require(offers[offerId].isActive, "Offer is not active");
require(offers[offerId].seller == msg.sender, "Only the seller can accept a price");

negotiations[offerId].isAccepted = true;
offers[offerId].price = negotiations[offerId].proposedPrice;
offers[offerId].isActive = false;

emit PriceAccepted(offerId, msg.sender, offers[offerId].price);
}
}
```

## 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](../LICENSE.md).
Loading