Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions contracts/src/EscrowUniversal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pragma solidity 0.8.24;
import {IArbitrableV2, IArbitratorV2} from "@kleros/kleros-v2-contracts/arbitration/interfaces/IArbitrableV2.sol";
import "@kleros/kleros-v2-contracts/arbitration/interfaces/IDisputeTemplateRegistry.sol";
import {SafeERC20, IERC20} from "./libraries/SafeERC20.sol";
import {NATIVE, Status, Party, Transaction, Resolution} from "./interfaces/Types.sol";
import "./interfaces/IEscrow.sol";

/// @title EscrowUniversal for a sale paid in native currency or ERC20 tokens without platform fees.
Expand Down
20 changes: 16 additions & 4 deletions contracts/src/EscrowView.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ pragma solidity 0.8.24;

import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {EscrowUniversal, Transaction, NATIVE, Party, Status, IERC20} from "./EscrowUniversal.sol";
import {EscrowUniversal} from "./EscrowUniversal.sol";
import {Transaction, NATIVE, Party, Status, IERC20} from "./interfaces/Types.sol";

/// @title EscrowView
/// @notice A view contract for EscrowUniversal to facilitate the display of ruling options.
Expand All @@ -26,9 +27,20 @@ contract EscrowView {
function getPayoutMessages(
uint256 _transactionID
) external view returns (string memory noWinner, string memory buyerWins, string memory sellerWins) {
(, , uint256 amount, , , , , uint256 buyerFee, uint256 sellerFee, , , IERC20 token) = escrow.transactions(
_transactionID
);
(
,
,
uint256 amount,
,
,
,
,
uint256 buyerFee,
uint256 sellerFee,
,
,
IERC20 token
) = escrow.transactions(_transactionID);

(uint256 noWinnerPayout, uint256 noWinnerPayoutToken, , ) = escrow.getPayouts(_transactionID, Party.None);
(, , uint256 buyerWinsCost, uint256 buyerWinsCostToken) = escrow.getPayouts(_transactionID, Party.Buyer);
Expand Down
39 changes: 38 additions & 1 deletion contracts/src/interfaces/IEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity 0.8.24;

import "./Types.sol";
import {IERC20, Party, Status, Resolution, Transaction} from "./Types.sol";

interface IEscrow {
// ************************************* //
Expand Down Expand Up @@ -157,6 +157,43 @@ interface IEscrow {
/// @return The count of transactions.
function getTransactionCount() external view returns (uint256);

/// @dev Getter for transaction details.
/// @param _transactionID The index of the transaction.
/// @return buyer The buyer address.
/// @return seller The seller address.
/// @return amount The escrowed amount.
/// @return settlementBuyer Settlement amount proposed by the buyer.
/// @return settlementSeller Settlement amount proposed by the seller.
/// @return deadline The deadline timestamp.
/// @return disputeID The dispute ID if any.
/// @return buyerFee Total fees paid by the buyer.
/// @return sellerFee Total fees paid by the seller.
/// @return lastFeePaymentTime Timestamp of last fee payment or settlement proposal.
/// @return status Current status.
/// @return token Payment token (zero address for native).
function transactions(uint256 _transactionID)
external
view
returns (
address payable buyer,
address payable seller,
uint256 amount,
uint256 settlementBuyer,
uint256 settlementSeller,
uint256 deadline,
uint256 disputeID,
uint256 buyerFee,
uint256 sellerFee,
uint256 lastFeePaymentTime,
Status status,
IERC20 token
);

/// @dev Getter to map a dispute ID to its transaction ID.
/// @param _disputeID The dispute identifier from the arbitrator.
/// @return The corresponding transaction ID.
function disputeIDtoTransactionID(uint256 _disputeID) external view returns (uint256);

// ************************************* //
// * Errors * //
// ************************************* //
Expand Down