Skip to main content

Disputes Contract Technical Reference

The Disputes contract enables the management of disputes in any initialized marketplace. It allows clients to create disputes and providers to resolve them. The contract allows providers to easily pay back the disputed amount of MEDIA Tokens to the clients.

Structs

Dispute

struct Dispute {
uint256 dealId;
uint256 amount;
uint256 status;
uint256 disputeDate;
uint256 disputeEndDate;
}
NameTypeDescription
dealIduint256The deal ID.
amountuint256The amount in dispute.
statusuint256The status of the dispute.
disputeDateuint256The date the dispute was created.
disputeEndDateuint256The date the dispute was resolved.

State Variables

NameTypeDescription
disputeCounteruint256Counter for disputes.
disputesmapping(uint256 => mapping(uint256 => Dispute))Mapping for disputes.
disputesIdsByProvidermapping(uint256 => mapping(address => uint256[]))Mapping for disputes by provider.
commentsmapping(uint256 => mapping(uint256 => string[]))Mapping for comments to disputes.

Functions

createDispute

Allows the client to create a dispute.

function createDispute(
uint256 marketplaceId,
uint256 _dealId,
uint256 _amount,
string calldata message
) external nonReentrant;

Parameters:

NameTypeDescription
marketplaceIduint256The marketplace ID.
_dealIduint256The deal ID.
_amountuint256The amount in dispute.
messagestringThe message to be added to the dispute.

resolveDisputeByProvider

Allows the provider to resolve a dispute.

function resolveDisputeByProvider(
uint256 marketplaceId,
uint256 _dealId,
string calldata message
) external nonReentrant;

Parameters:

NameTypeDescription
marketplaceIduint256The marketplace ID.
_dealIduint256The deal ID.
messagestringThe message to be added to the dispute.

appealDisputeByProvider

Allows the provider to appeal a dispute.

function appealDisputeByProvider(
uint256 marketplaceId,
uint256 _dealId,
string calldata message
) external nonReentrant;

Parameters:

NameTypeDescription
marketplaceIduint256The marketplace ID.
_dealIduint256The deal ID.
messagestringThe message to be added to the dispute.

revokeDisputeByProvider

Allows the provider to revoke a dispute.

function revokeDisputeByProvider(
uint256 marketplaceId,
uint256 _dealId,
string calldata message
) external nonReentrant;

Parameters:

NameTypeDescription
marketplaceIduint256The marketplace ID.
_dealIduint256The deal ID.
messagestringThe message to be added to the dispute.

appealDisputeByClient

Allows the client to appeal a dispute and modify the amount.

function appealDisputeByClient(
uint256 marketplaceId,
uint256 _dealId,
uint256 _amount,
string calldata message
) external nonReentrant;

Parameters:

NameTypeDescription
marketplaceIduint256The marketplace ID.
_dealIduint256The deal ID.
_amountuint256The amount in dispute.
messagestringThe message to be added to the dispute.

getDispute

Returns a dispute.

function getDispute(
uint256 marketplaceId,
uint256 _dealId
) external view returns (Dispute memory);

Parameters:

NameTypeDescription
marketplaceIduint256The marketplace ID.
_dealIduint256The deal ID.

Return:

TypeDescription
Dispute memoryThe dispute.

isDisputeExpired

Checks whether a dispute is expired.

function isDisputeExpired(
uint256 marketplaceId,
uint256 _dealId
) external view returns (bool);

Parameters:

NameTypeDescription
marketplaceIduint256The marketplace ID.
_dealIduint256The deal ID.

Return:

TypeDescription
boolWhether the dispute is expired or not.

getDisputesByProvider

Returns all disputes for a provider.

function getDisputesByProvider(
uint256 marketplaceId,
address _provider
) external view returns (uint256[] memory);

Parameters:

NameTypeDescription
marketplaceIduint256The marketplace ID.
_provideraddressThe provider's address.

Return:

TypeDescription
uint256[]The disputes for the provider.

setMaxDisputeDuration

Allows the contract owner to set the maximum dispute duration.

function setMaxDisputeDuration(uint256 _maxDisputeDuration) external onlyOwner;

Parameters:

NameTypeDescription
_maxDisputeDurationuint256The maximum dispute duration.

getMarketplace

Returns the marketplace contract address.

function getMarketplace() public view returns(address);

Return:

TypeDescription
addressThe marketplace contract address.

setMarketplace

Allows the contract owner to set the marketplace contract address.

function setMarketplace(Marketplace _marketplace) external onlyOwner;

Parameters:

NameTypeDescription
_marketplaceMarketplaceThe marketplace contract address.

receive

Allows the contract to receive native coins.

receive() external payable;

recoverTokens

Allows the contract owner to recover tokens sent unintentionally to the contract.

function recoverTokens(IERC20 _token) external onlyOwner returns (bool);

Parameters:

NameType
_tokenIERC20The token you want to recover.

Return:

Type
boolWhether the recovery was successful or not.

note

This is a high-level technical breakdown. For a deep understanding of each function's inner workings and logic, refer to the smart contract's actual implementation.