forked from storyprotocol/protocol-core
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new Dispute Arbitration Policy (#263)
* add draft new arbitration policy interfaces * add new arbitration policy errors * add new arbitration policy skeleton * add base integration unit tests * update deploy helper * fix DisputeResolved event * fix DisputeResolve unit tests * update Errors.sol * add new arbitration policy updates * interface update * solhint fix * update Errors.sol * format fixes * add new disputeAssertion function - contracts and unit tests * DeployHelper.sol fix * add dispute timestamp to DisputeModule.sol * add ipOwner dispute assertion priority time window * interface fixes * error naming fix * deploy helper naming fix * add interface function * ArbitrationPolicyUMA contract adjustments and unit tests * comment fix * enhance error message * format fix
- Loading branch information
Showing
15 changed files
with
1,314 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
contracts/interfaces/modules/dispute/policies/UMA/IArbitrationPolicyUMA.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.26; | ||
|
||
import { IArbitrationPolicy } from "../IArbitrationPolicy.sol"; | ||
import { IOOV3Callbacks } from "./IOOV3Callbacks.sol"; | ||
|
||
/// @title Arbitration Policy UMA Interface | ||
interface IArbitrationPolicyUMA is IArbitrationPolicy, IOOV3Callbacks { | ||
/// @notice Emitted when liveness is set | ||
/// @param minLiveness The minimum liveness value | ||
/// @param maxLiveness The maximum liveness value | ||
/// @param ipOwnerTimePercent The percentage of liveness time the IP owner has priority to respond to a dispute | ||
event LivenessSet(uint64 minLiveness, uint64 maxLiveness, uint32 ipOwnerTimePercent); | ||
|
||
/// @notice Emitted when max bond is set | ||
/// @param token The token address | ||
/// @param maxBond The maximum bond value | ||
event MaxBondSet(address token, uint256 maxBond); | ||
|
||
/// @notice Emitted when a dispute is raised | ||
/// @param disputeId The dispute id | ||
/// @param caller The caller address that raised the dispute | ||
/// @param claim The asserted claim | ||
/// @param liveness The liveness time | ||
/// @param currency The bond currency | ||
/// @param bond The bond size | ||
/// @param identifier The UMA specific identifier | ||
event DisputeRaisedUMA( | ||
uint256 disputeId, | ||
address caller, | ||
bytes claim, | ||
uint64 liveness, | ||
address currency, | ||
uint256 bond, | ||
bytes32 identifier | ||
); | ||
|
||
/// @notice Emitted when an assertion is disputed | ||
/// @param assertionId The assertion id | ||
/// @param counterEvidenceHash The counter evidence hash | ||
event AssertionDisputed(bytes32 assertionId, bytes32 counterEvidenceHash); | ||
|
||
/// @notice Sets the liveness for UMA disputes | ||
/// @param minLiveness The minimum liveness value | ||
/// @param maxLiveness The maximum liveness value | ||
/// @param ipOwnerTimePercent The percentage of liveness time the IP owner has priority to respond to a dispute | ||
function setLiveness(uint64 minLiveness, uint64 maxLiveness, uint32 ipOwnerTimePercent) external; | ||
|
||
/// @notice Sets the max bond for UMA disputes | ||
/// @param token The token address | ||
/// @param maxBond The maximum bond value | ||
function setMaxBond(address token, uint256 maxBond) external; | ||
|
||
/// @notice Allows the IP that was targeted with a dispute to dispute the assertion while providing counter evidence | ||
/// @param assertionId The identifier of the assertion that was disputed | ||
/// @param counterEvidenceHash The hash of the counter evidence | ||
function disputeAssertion(bytes32 assertionId, bytes32 counterEvidenceHash) external; | ||
|
||
/// @notice Returns the maximum percentage - represents 100% | ||
function maxPercent() external view returns (uint32); | ||
|
||
/// @notice Returns the minimum liveness for UMA disputes | ||
function minLiveness() external view returns (uint64); | ||
|
||
/// @notice Returns the maximum liveness for UMA disputes | ||
function maxLiveness() external view returns (uint64); | ||
|
||
/// @notice Returns the percentage of liveness time the IP owner has priority to respond to a dispute | ||
function ipOwnerTimePercent() external view returns (uint32); | ||
|
||
/// @notice Returns the maximum bond for a given token for UMA disputes | ||
/// @param token The token address | ||
function maxBonds(address token) external view returns (uint256); | ||
|
||
/// @notice Returns the assertion id for a given dispute id | ||
/// @param disputeId The dispute id | ||
function disputeIdToAssertionId(uint256 disputeId) external view returns (bytes32); | ||
|
||
/// @notice Returns the dispute id for a given assertion id | ||
/// @param assertionId The assertion id | ||
function assertionIdToDisputeId(bytes32 assertionId) external view returns (uint256); | ||
} |
52 changes: 52 additions & 0 deletions
52
contracts/interfaces/modules/dispute/policies/UMA/IOOV3.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.26; | ||
|
||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
|
||
/// @title IOOV3 Interface | ||
interface IOOV3 { | ||
struct EscalationManagerSettings { | ||
bool arbitrateViaEscalationManager; | ||
bool discardOracle; | ||
bool validateDisputers; | ||
address assertingCaller; | ||
address escalationManager; | ||
} | ||
|
||
struct Assertion { | ||
EscalationManagerSettings escalationManagerSettings; | ||
address asserter; | ||
uint64 assertionTime; | ||
bool settled; | ||
IERC20 currency; | ||
uint64 expirationTime; | ||
bool settlementResolution; | ||
bytes32 domainId; | ||
bytes32 identifier; | ||
uint256 bond; | ||
address callbackRecipient; | ||
address disputer; | ||
} | ||
|
||
function assertTruth( | ||
bytes memory claim, | ||
address asserter, | ||
address callbackRecipient, | ||
address escalationManager, | ||
uint64 liveness, | ||
IERC20 currency, | ||
uint256 bond, | ||
bytes32 identifier, | ||
bytes32 domainId | ||
) external returns (bytes32 assertionId); | ||
|
||
function disputeAssertion(bytes32 assertionId, address disputer) external; | ||
|
||
function settleAssertion(bytes32 assertionId) external; | ||
|
||
function getAssertion(bytes32 assertionId) external view returns (Assertion memory); | ||
|
||
function stampAssertion(bytes32 assertionId) external view returns (bytes memory); | ||
|
||
function burnedBondPercentage() external view returns (uint256); | ||
} |
9 changes: 9 additions & 0 deletions
9
contracts/interfaces/modules/dispute/policies/UMA/IOOV3Callbacks.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.26; | ||
|
||
/// @title IOOV3 Callbacks Interface | ||
interface IOOV3Callbacks { | ||
function assertionResolvedCallback(bytes32 assertionId, bool assertedTruthfully) external; | ||
|
||
function assertionDisputedCallback(bytes32 assertionId) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.