3
3
pragma solidity 0.8.24 ;
4
4
5
5
import {IArbitrableV2, IArbitratorV2} from "./interfaces/IArbitrableV2.sol " ;
6
+ import {WethLike, SafeSend} from "../libraries/SafeSend.sol " ;
6
7
import "./interfaces/IDisputeTemplateRegistry.sol " ;
7
8
8
9
/// @title KlerosGovernor for V2. Note that appeal functionality and evidence submission will be handled by the court.
9
10
contract KlerosGovernor is IArbitrableV2 {
11
+ using SafeSend for address payable ;
10
12
// ************************************* //
11
13
// * Enums / Structs * //
12
14
// ************************************* //
@@ -48,6 +50,7 @@ contract KlerosGovernor is IArbitrableV2 {
48
50
bytes public arbitratorExtraData; // Extra data for arbitrator.
49
51
IDisputeTemplateRegistry public templateRegistry; // The dispute template registry.
50
52
uint256 public templateId; // The current dispute template identifier.
53
+ address public wNative; // The address for WETH tranfers.
51
54
52
55
uint256 public submissionBaseDeposit; // The base deposit in wei that needs to be paid in order to submit the list.
53
56
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 {
111
114
/// @param _submissionTimeout Time in seconds allocated for submitting transaction list.
112
115
/// @param _executionTimeout Time in seconds after approval that allows to execute transactions of the approved list.
113
116
/// @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.
114
118
constructor (
115
119
IArbitratorV2 _arbitrator ,
116
120
bytes memory _arbitratorExtraData ,
@@ -119,10 +123,12 @@ contract KlerosGovernor is IArbitrableV2 {
119
123
uint256 _submissionBaseDeposit ,
120
124
uint256 _submissionTimeout ,
121
125
uint256 _executionTimeout ,
122
- uint256 _withdrawTimeout
126
+ uint256 _withdrawTimeout ,
127
+ address _wNative
123
128
) {
124
129
arbitrator = _arbitrator;
125
130
arbitratorExtraData = _arbitratorExtraData;
131
+ wNative = _wNative;
126
132
127
133
lastApprovalTime = block .timestamp ;
128
134
submissionBaseDeposit = _submissionBaseDeposit;
@@ -237,7 +243,7 @@ contract KlerosGovernor is IArbitrableV2 {
237
243
emit ListSubmitted (submissions.length - 1 , msg .sender , sessions.length - 1 , _description);
238
244
239
245
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 );
241
247
242
248
reservedETH += submission.deposit;
243
249
}
@@ -277,7 +283,7 @@ contract KlerosGovernor is IArbitrableV2 {
277
283
submission.approvalTime = block .timestamp ;
278
284
uint256 sumDeposit = session.sumDeposit;
279
285
session.sumDeposit = 0 ;
280
- submission.submitter. send ( sumDeposit);
286
+ SafeSend. safeSend ( submission.submitter, sumDeposit, wNative );
281
287
lastApprovalTime = block .timestamp ;
282
288
session.status = Status.Resolved;
283
289
sessions.push ();
@@ -311,7 +317,7 @@ contract KlerosGovernor is IArbitrableV2 {
311
317
Submission storage submission = submissions[session.submittedLists[_ruling - 1 ]];
312
318
submission.approved = true ;
313
319
submission.approvalTime = block .timestamp ;
314
- submission.submitter. send ( session.sumDeposit);
320
+ SafeSend. safeSend ( submission.submitter, session.sumDeposit, wNative );
315
321
}
316
322
// If the ruling is "0" the reserved funds of this session become expendable.
317
323
reservedETH -= session.sumDeposit;
0 commit comments