generated from defi-wonderland/solidity-foundry-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
433 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
forge-std/=node_modules/forge-std/src | ||
halmos-cheatcodes=node_modules/halmos-cheatcodes | ||
@defi-wonderland/prophet-core-contracts/=node_modules/@defi-wonderland/prophet-core-contracts | ||
@defi-wonderland/prophet-modules-contracts/=node_modules/@defi-wonderland/prophet-modules-contracts | ||
|
||
contracts/=src/contracts | ||
interfaces/=src/interfaces |
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,106 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {IArbitrable} from 'interfaces/IArbitrable.sol'; | ||
|
||
/** | ||
* @title Arbitrable | ||
* @notice Makes a contract subject to arbitration by The Graph | ||
*/ | ||
abstract contract Arbitrable is IArbitrable { | ||
address private _arbitrator; | ||
address private _council; | ||
address private _pendingCouncil; | ||
|
||
/** | ||
* @notice Checks that the caller is The Graph's Arbitrator | ||
*/ | ||
modifier onlyArbitrator() { | ||
if (msg.sender != _arbitrator) revert Arbitrable_OnlyArbitrator(); | ||
_; | ||
} | ||
|
||
/** | ||
* @notice Checks that the caller is The Graph's Council | ||
*/ | ||
modifier onlyCouncil() { | ||
if (msg.sender != _council) revert Arbitrable_OnlyCouncil(); | ||
_; | ||
} | ||
|
||
/** | ||
* @notice Checks that the caller is the pending The Graph's Council | ||
*/ | ||
modifier onlyPendingCouncil() { | ||
if (msg.sender != _pendingCouncil) revert Arbitrable_OnlyPendingCouncil(); | ||
_; | ||
} | ||
|
||
/** | ||
* @notice Constructor | ||
* @param __arbitrator The address of The Graph's Arbitrator | ||
* @param __council The address of The Graph's Council | ||
*/ | ||
constructor(address __arbitrator, address __council) { | ||
_setArbitrator(__arbitrator); | ||
_setCouncil(__council); | ||
} | ||
|
||
/// @inheritdoc IArbitrable | ||
function arbitrator() public view returns (address __arbitrator) { | ||
__arbitrator = _arbitrator; | ||
} | ||
|
||
/// @inheritdoc IArbitrable | ||
function council() public view returns (address __council) { | ||
__council = _council; | ||
} | ||
|
||
/// @inheritdoc IArbitrable | ||
function pendingCouncil() public view returns (address __pendingCouncil) { | ||
__pendingCouncil = _pendingCouncil; | ||
} | ||
|
||
/// @inheritdoc IArbitrable | ||
function setArbitrator(address __arbitrator) external onlyCouncil { | ||
_setArbitrator(__arbitrator); | ||
} | ||
|
||
/// @inheritdoc IArbitrable | ||
function setPendingCouncil(address __pendingCouncil) external onlyCouncil { | ||
_setPendingCouncil(__pendingCouncil); | ||
} | ||
|
||
/// @inheritdoc IArbitrable | ||
function confirmCouncil() external onlyPendingCouncil { | ||
_setCouncil(_pendingCouncil); | ||
delete _pendingCouncil; | ||
} | ||
|
||
/** | ||
* @notice Sets the address of The Graph's Arbitrator | ||
* @param __arbitrator The address of The Graph's Arbitrator | ||
*/ | ||
function _setArbitrator(address __arbitrator) private { | ||
_arbitrator = __arbitrator; | ||
emit SetArbitrator(__arbitrator); | ||
} | ||
|
||
/** | ||
* @notice Sets the address of The Graph's Council | ||
* @param __council The address of The Graph's Council | ||
*/ | ||
function _setCouncil(address __council) private { | ||
_council = __council; | ||
emit SetCouncil(__council); | ||
} | ||
|
||
/** | ||
* @notice Sets the address of the pending The Graph's Council | ||
* @param __pendingCouncil The address of the pending The Graph's Council | ||
*/ | ||
function _setPendingCouncil(address __pendingCouncil) private { | ||
_pendingCouncil = __pendingCouncil; | ||
emit SetPendingCouncil(__pendingCouncil); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
/** | ||
* @title Arbitrable | ||
* @notice Makes a contract subject to arbitration by The Graph | ||
*/ | ||
interface IArbitrable { | ||
/*/////////////////////////////////////////////////////////////// | ||
EVENTS | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
/** | ||
* @notice Emitted when The Graph's Arbitrator is set | ||
* @param _arbitrator The address of The Graph's Arbitrator | ||
*/ | ||
event SetArbitrator(address _arbitrator); | ||
|
||
/** | ||
* @notice Emitted when The Graph's Council is set | ||
* @param _council The address of The Graph's Council | ||
*/ | ||
event SetCouncil(address _council); | ||
|
||
/** | ||
* @notice Emitted when the pending The Graph's Council is set | ||
* @param _pendingCouncil The address of the pending The Graph's Council | ||
*/ | ||
event SetPendingCouncil(address _pendingCouncil); | ||
|
||
/*/////////////////////////////////////////////////////////////// | ||
ERRORS | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
/** | ||
* @notice Thrown when the caller is not The Graph's Arbitrator | ||
*/ | ||
error Arbitrable_OnlyArbitrator(); | ||
|
||
/** | ||
* @notice Thrown when the caller is not The Graph's Council | ||
*/ | ||
error Arbitrable_OnlyCouncil(); | ||
|
||
/** | ||
* @notice Thrown when the caller is not the pending The Graph's Council | ||
*/ | ||
error Arbitrable_OnlyPendingCouncil(); | ||
|
||
/*/////////////////////////////////////////////////////////////// | ||
VARIABLES | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
/** | ||
* @notice Returns the address of The Graph's Arbitrator | ||
* @return _arbitrator The address of The Graph's Arbitrator | ||
*/ | ||
function arbitrator() external view returns (address _arbitrator); | ||
|
||
/** | ||
* @notice Returns the address of The Graph's Council | ||
* @return _council The address of The Graph's Council | ||
*/ | ||
function council() external view returns (address _council); | ||
|
||
/** | ||
* @notice Returns the address of the pending The Graph's Council | ||
* @return _pendingCouncil The address of the pending The Graph's Council | ||
*/ | ||
function pendingCouncil() external view returns (address _pendingCouncil); | ||
|
||
/*/////////////////////////////////////////////////////////////// | ||
LOGIC | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
/** | ||
* @notice Changes the address of The Graph's Arbitrator | ||
* @dev Callable only by The Graph's Council | ||
* @param _arbitrator The address of The Graph's Arbitrator | ||
*/ | ||
function setArbitrator(address _arbitrator) external; | ||
|
||
/** | ||
* @notice Sets the address of the pending The Graph's Council | ||
* @dev Callable only by The Graph's Council | ||
* @param _pendingCouncil The address of the pending The Graph's Council | ||
*/ | ||
function setPendingCouncil(address _pendingCouncil) external; | ||
|
||
/** | ||
* @notice Changes the address of The Graph's Council to the pending one | ||
* @dev Callable only by the pending The Graph's Council | ||
*/ | ||
function confirmCouncil() 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
Oops, something went wrong.