From 2596aab29e9f6fbef705c4ace95dafefc1567107 Mon Sep 17 00:00:00 2001 From: 0xshitake <0xshitake@proton.me> Date: Wed, 15 Oct 2025 13:00:07 -0300 Subject: [PATCH 1/3] feat: add `transaction` to IEscrow --- contracts/src/interfaces/IEscrow.sol | 39 +++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/contracts/src/interfaces/IEscrow.sol b/contracts/src/interfaces/IEscrow.sol index 856c1f8a..c738b02f 100644 --- a/contracts/src/interfaces/IEscrow.sol +++ b/contracts/src/interfaces/IEscrow.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.24; -import "./Types.sol"; +import {IERC20, Party, Status, Resolution, Transaction} from "./Types.sol"; interface IEscrow { // ************************************* // @@ -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 * // // ************************************* // From 18dae17df21fc824c318535eb855480033f460b8 Mon Sep 17 00:00:00 2001 From: 0xshitake <0xshitake@proton.me> Date: Wed, 15 Oct 2025 13:04:14 -0300 Subject: [PATCH 2/3] chore: update imports also run linter --- contracts/src/EscrowUniversal.sol | 1 + contracts/src/EscrowView.sol | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/contracts/src/EscrowUniversal.sol b/contracts/src/EscrowUniversal.sol index 9f92e47d..cd0ab2cd 100644 --- a/contracts/src/EscrowUniversal.sol +++ b/contracts/src/EscrowUniversal.sol @@ -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. diff --git a/contracts/src/EscrowView.sol b/contracts/src/EscrowView.sol index 54a1ed95..27cf79a0 100644 --- a/contracts/src/EscrowView.sol +++ b/contracts/src/EscrowView.sol @@ -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. @@ -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); From f8354ba20c49977f9959e4fc99edc1b720fe3a13 Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Tue, 21 Oct 2025 16:18:12 +0100 Subject: [PATCH 3/3] chore: styling change reverted --- contracts/src/EscrowView.sol | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/contracts/src/EscrowView.sol b/contracts/src/EscrowView.sol index 27cf79a0..d51ba2a0 100644 --- a/contracts/src/EscrowView.sol +++ b/contracts/src/EscrowView.sol @@ -27,20 +27,9 @@ 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);