Skip to content

Commit 20ca1c6

Browse files
author
hurstelm
committed
fix(arbitration): add of KlerosGovernor.sol
1 parent 3715b78 commit 20ca1c6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

contracts/src/arbitration/KlerosGovernor.sol

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
pragma solidity 0.8.24;
44

55
import {IArbitrableV2, IArbitratorV2} from "./interfaces/IArbitrableV2.sol";
6+
import {WethLike, SafeSend} from "../libraries/SafeSend.sol";
67
import "./interfaces/IDisputeTemplateRegistry.sol";
78

89
/// @title KlerosGovernor for V2. Note that appeal functionality and evidence submission will be handled by the court.
910
contract KlerosGovernor is IArbitrableV2 {
11+
using SafeSend for address payable;
1012
// ************************************* //
1113
// * Enums / Structs * //
1214
// ************************************* //
@@ -48,6 +50,7 @@ contract KlerosGovernor is IArbitrableV2 {
4850
bytes public arbitratorExtraData; // Extra data for arbitrator.
4951
IDisputeTemplateRegistry public templateRegistry; // The dispute template registry.
5052
uint256 public templateId; // The current dispute template identifier.
53+
address public wNative; // The address for WETH tranfers.
5154

5255
uint256 public submissionBaseDeposit; // The base deposit in wei that needs to be paid in order to submit the list.
5356
uint256 public submissionTimeout; // Time in seconds allowed for submitting the lists. Once it's passed the contract enters the approval period.
@@ -111,6 +114,7 @@ contract KlerosGovernor is IArbitrableV2 {
111114
/// @param _submissionTimeout Time in seconds allocated for submitting transaction list.
112115
/// @param _executionTimeout Time in seconds after approval that allows to execute transactions of the approved list.
113116
/// @param _withdrawTimeout Time in seconds after submission that allows to withdraw submitted list.
117+
/// @param _wNative The address of the WETH used by SafeSend for fallback transfers.
114118
constructor(
115119
IArbitratorV2 _arbitrator,
116120
bytes memory _arbitratorExtraData,
@@ -119,10 +123,12 @@ contract KlerosGovernor is IArbitrableV2 {
119123
uint256 _submissionBaseDeposit,
120124
uint256 _submissionTimeout,
121125
uint256 _executionTimeout,
122-
uint256 _withdrawTimeout
126+
uint256 _withdrawTimeout,
127+
address _wNative
123128
) {
124129
arbitrator = _arbitrator;
125130
arbitratorExtraData = _arbitratorExtraData;
131+
wNative = _wNative;
126132

127133
lastApprovalTime = block.timestamp;
128134
submissionBaseDeposit = _submissionBaseDeposit;
@@ -237,7 +243,7 @@ contract KlerosGovernor is IArbitrableV2 {
237243
emit ListSubmitted(submissions.length - 1, msg.sender, sessions.length - 1, _description);
238244

239245
uint256 remainder = msg.value - submission.deposit;
240-
if (remainder > 0) payable(msg.sender).send(remainder);
246+
if (remainder > 0) SafeSend.safeSend(payable(msg.sender), remainder, wNative);
241247

242248
reservedETH += submission.deposit;
243249
}
@@ -277,7 +283,7 @@ contract KlerosGovernor is IArbitrableV2 {
277283
submission.approvalTime = block.timestamp;
278284
uint256 sumDeposit = session.sumDeposit;
279285
session.sumDeposit = 0;
280-
submission.submitter.send(sumDeposit);
286+
SafeSend.safeSend(submission.submitter, sumDeposit, wNative);
281287
lastApprovalTime = block.timestamp;
282288
session.status = Status.Resolved;
283289
sessions.push();
@@ -311,7 +317,7 @@ contract KlerosGovernor is IArbitrableV2 {
311317
Submission storage submission = submissions[session.submittedLists[_ruling - 1]];
312318
submission.approved = true;
313319
submission.approvalTime = block.timestamp;
314-
submission.submitter.send(session.sumDeposit);
320+
SafeSend.safeSend(submission.submitter, session.sumDeposit, wNative);
315321
}
316322
// If the ruling is "0" the reserved funds of this session become expendable.
317323
reservedETH -= session.sumDeposit;

0 commit comments

Comments
 (0)