Skip to content

Commit

Permalink
Remove the copy-pasted reality.eth fork of reality.eth v3, replace it…
Browse files Browse the repository at this point in the history
… with reality.eth v4 via npm
  • Loading branch information
edmundedgar committed Mar 5, 2024
1 parent f5e967b commit 55daeac
Show file tree
Hide file tree
Showing 22 changed files with 68 additions and 2,660 deletions.
40 changes: 29 additions & 11 deletions contracts/AdjudicationFramework/MinimalAdjudicationFramework.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ pragma solidity ^0.8.20;
/* solhint-disable quotes */
/* solhint-disable not-rely-on-time */

import {IRealityETH} from "./../lib/reality-eth/interfaces/IRealityETH.sol";
import {IRealityETH} from "@reality.eth/contracts/development/contracts/IRealityETH.sol";
import {IRealityETHHistoryVerification} from "@reality.eth/contracts/development/contracts/IRealityETHHistoryVerification.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {IMinimalAdjudicationFramework} from "./interface/IMinimalAdjudicationFramework.sol";
Expand All @@ -19,6 +20,8 @@ Also, arbitrators who are challenged by a removal question, can be temporarily f
contract MinimalAdjudicationFramework is IMinimalAdjudicationFramework {
using EnumerableSet for EnumerableSet.AddressSet;

event LogWithdraw(address indexed user, uint256 amount);

// Question delimiter for arbitrator modification questions for reality.eth
string internal constant _QUESTION_DELIM = "\u241f";

Expand All @@ -27,6 +30,8 @@ contract MinimalAdjudicationFramework is IMinimalAdjudicationFramework {
error OnlyAllowlistedActor();
/// @dev Error thrown when multiple modifications are requested at once
error NoMultipleModificationsAtOnce();
/// @dev Invalid history supplied for unfinalized question
error InvalidHistorySupplied();

// Iterable list contains list of allowlisted arbitrators
uint256 public constant ARB_DISPUTE_TIMEOUT = 86400;
Expand Down Expand Up @@ -56,6 +61,8 @@ contract MinimalAdjudicationFramework is IMinimalAdjudicationFramework {
uint256 public forkActivationDelay;
IRealityETH public realityETH;

mapping(address => uint256) public balanceOf;

modifier onlyArbitrator() {
if (!_arbitrators.contains(msg.sender)) {
revert OnlyAllowlistedActor();
Expand Down Expand Up @@ -216,20 +223,24 @@ contract MinimalAdjudicationFramework is IMinimalAdjudicationFramework {

bytes32 answer;
uint256 bond;
// Normally you call this right after posting your answer so your final answer will be the current answer
// If someone has since submitted a different answer, you need to pass in the history from now until yours
// Normally you call this right after posting your answer so your final answer will be the current best answer
// If someone has since submitted a different answer, you need to pass in the history from now back to yours
if (historyHashes.length == 0) {
answer = realityETH.getBestAnswer(questionId);
bond = realityETH.getBond(questionId);
} else {
(answer, bond) = realityETH
.getEarliestAnswerFromSuppliedHistoryOrRevert(
questionId,
historyHashes,
addrs,
bonds,
answers
);
if (
!IRealityETHHistoryVerification(address(realityETH))
.isHistoryOfUnfinalizedQuestionValid(
questionId,
historyHashes,
addrs,
bonds,
answers
)
) revert InvalidHistorySupplied();
answer = answers[answers.length - 1];
bond = bonds[bonds.length - 1];
}

if (answer != bytes32(uint256(1))) {
Expand Down Expand Up @@ -285,4 +296,11 @@ contract MinimalAdjudicationFramework is IMinimalAdjudicationFramework {
function getInvestigationDelay() external view returns (uint256) {
return forkActivationDelay;
}

function withdraw() public {
uint256 bal = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
payable(msg.sender).transfer(bal);
emit LogWithdraw(msg.sender, bal);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pragma solidity ^0.8.20;
/* solhint-disable quotes */
/* solhint-disable not-rely-on-time */

import {BalanceHolder} from "./../../lib/reality-eth/BalanceHolder.sol";
import {MinimalAdjudicationFramework} from "../MinimalAdjudicationFramework.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

Expand All @@ -19,10 +18,7 @@ To Reality.eth it looks like a normal arbitrator, implementing the Arbitrator in
To the normal Arbitrator contracts that does its arbitration jobs, it looks like Reality.eth.
*/

contract AdjudicationFrameworkRequests is
MinimalAdjudicationFramework,
BalanceHolder
{
contract AdjudicationFrameworkRequests is MinimalAdjudicationFramework {
using EnumerableSet for EnumerableSet.AddressSet;
/// @dev Error thrown when challenge deadline has not passed
error ChallengeDeadlineNotPassed();
Expand Down
2 changes: 1 addition & 1 deletion contracts/L2ForkArbitrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pragma solidity ^0.8.20;
/* solhint-disable var-name-mixedcase */
import {L2ChainInfo} from "./L2ChainInfo.sol";
import {L1GlobalForkRequester} from "./L1GlobalForkRequester.sol";
import {IRealityETH} from "./lib/reality-eth/interfaces/IRealityETH.sol";
import {IRealityETH} from "@reality.eth/contracts/development/contracts/IRealityETH.sol";
import {CalculateMoneyBoxAddress} from "./lib/CalculateMoneyBoxAddress.sol";

import {IPolygonZkEVMBridge} from "@RealityETH/zkevm-contracts/contracts/interfaces/IPolygonZkEVMBridge.sol";
Expand Down
206 changes: 0 additions & 206 deletions contracts/lib/reality-eth/Arbitrator.sol

This file was deleted.

18 changes: 0 additions & 18 deletions contracts/lib/reality-eth/BalanceHolder.sol

This file was deleted.

23 changes: 0 additions & 23 deletions contracts/lib/reality-eth/BalanceHolder_ERC20.sol

This file was deleted.

20 changes: 0 additions & 20 deletions contracts/lib/reality-eth/Owned.sol

This file was deleted.

Loading

0 comments on commit 55daeac

Please sign in to comment.