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;
}
Name | Type | Description |
---|---|---|
dealId | uint256 | The deal ID. |
amount | uint256 | The amount in dispute. |
status | uint256 | The status of the dispute. |
disputeDate | uint256 | The date the dispute was created. |
disputeEndDate | uint256 | The date the dispute was resolved. |
State Variables
Name | Type | Description |
---|---|---|
disputeCounter | uint256 | Counter for disputes. |
disputes | mapping(uint256 => mapping(uint256 => Dispute)) | Mapping for disputes. |
disputesIdsByProvider | mapping(uint256 => mapping(address => uint256[])) | Mapping for disputes by provider. |
comments | mapping(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:
Name | Type | Description |
---|---|---|
marketplaceId | uint256 | The marketplace ID. |
_dealId | uint256 | The deal ID. |
_amount | uint256 | The amount in dispute. |
message | string | The 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:
Name | Type | Description |
---|---|---|
marketplaceId | uint256 | The marketplace ID. |
_dealId | uint256 | The deal ID. |
message | string | The 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:
Name | Type | Description |
---|---|---|
marketplaceId | uint256 | The marketplace ID. |
_dealId | uint256 | The deal ID. |
message | string | The 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:
Name | Type | Description |
---|---|---|
marketplaceId | uint256 | The marketplace ID. |
_dealId | uint256 | The deal ID. |
message | string | The 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:
Name | Type | Description |
---|---|---|
marketplaceId | uint256 | The marketplace ID. |
_dealId | uint256 | The deal ID. |
_amount | uint256 | The amount in dispute. |
message | string | The message to be added to the dispute. |
getDispute
Returns a dispute.
function getDispute(
uint256 marketplaceId,
uint256 _dealId
) external view returns (Dispute memory);
Parameters:
Name | Type | Description |
---|---|---|
marketplaceId | uint256 | The marketplace ID. |
_dealId | uint256 | The deal ID. |
Return:
Type | Description |
---|---|
Dispute memory | The dispute. |
isDisputeExpired
Checks whether a dispute is expired.
function isDisputeExpired(
uint256 marketplaceId,
uint256 _dealId
) external view returns (bool);
Parameters:
Name | Type | Description |
---|---|---|
marketplaceId | uint256 | The marketplace ID. |
_dealId | uint256 | The deal ID. |
Return:
Type | Description |
---|---|
bool | Whether 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:
Name | Type | Description |
---|---|---|
marketplaceId | uint256 | The marketplace ID. |
_provider | address | The provider's address. |
Return:
Type | Description |
---|---|
uint256[] | The disputes for the provider. |
setMaxDisputeDuration
Allows the contract owner to set the maximum dispute duration.
function setMaxDisputeDuration(uint256 _maxDisputeDuration) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters:
Name | Type | Description |
---|---|---|
_maxDisputeDuration | uint256 | The maximum dispute duration. |
getMarketplace
Returns the marketplace contract address.
function getMarketplace() public view returns(address);
Return:
Type | Description |
---|---|
address | The marketplace contract address. |
setMarketplace
Allows the contract owner to set the marketplace contract address.
function setMarketplace(Marketplace _marketplace) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters:
Name | Type | Description |
---|---|---|
_marketplace | Marketplace | The marketplace contract address. |