Skip to content

Commit

Permalink
Merge branch 'dev' into refactor/OPT-530-move-module-access-controller
Browse files Browse the repository at this point in the history
  • Loading branch information
gas1cent authored Nov 14, 2024
2 parents e0def92 + 8095a10 commit a1830e3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# 🤖 Linear

Closes OPO-XXX
Closes OPT-XXX
32 changes: 25 additions & 7 deletions solidity/contracts/Oracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {ValidatorLib} from '../libraries/ValidatorLib.sol';
import {OracleAccessController} from './access/OracleAccessController.sol';
import {OracleTypehash} from './utils/OracleTypehash.sol';

contract Oracle is IOracle, OracleAccessController, OracleTypehash {
contract Oracle is IOracle, OracleAccessController {
using ValidatorLib for *;

/// @inheritdoc IOracle
Expand Down Expand Up @@ -128,7 +128,7 @@ contract Oracle is IOracle, OracleAccessController, OracleTypehash {
AccessControl calldata _accessControl
)
external
hasAccess(_request.accessModule, PROPOSE_TYPEHASH, abi.encode(_request, _response), _accessControl)
hasAccess(_request.accessModule, OracleTypehash.PROPOSE_TYPEHASH, abi.encode(_request, _response), _accessControl)
returns (bytes32 _responseId)
{
_responseId = ValidatorLib._validateResponse(_request, _response);
Expand Down Expand Up @@ -168,7 +168,12 @@ contract Oracle is IOracle, OracleAccessController, OracleTypehash {
AccessControl calldata _accessControl
)
external
hasAccess(_request.accessModule, DISPUTE_TYPEHASH, abi.encode(_request, _response, _dispute), _accessControl)
hasAccess(
_request.accessModule,
OracleTypehash.DISPUTE_TYPEHASH,
abi.encode(_request, _response, _dispute),
_accessControl
)
returns (bytes32 _disputeId)
{
bytes32 _responseId;
Expand Down Expand Up @@ -213,7 +218,12 @@ contract Oracle is IOracle, OracleAccessController, OracleTypehash {
AccessControl calldata _accessControl
)
external
hasAccess(_request.accessModule, ESCALATE_TYPEHASH, abi.encode(_request, _response, _dispute), _accessControl)
hasAccess(
_request.accessModule,
OracleTypehash.ESCALATE_TYPEHASH,
abi.encode(_request, _response, _dispute),
_accessControl
)
{
(bytes32 _responseId, bytes32 _disputeId) = ValidatorLib._validateResponseAndDispute(_request, _response, _dispute);

Expand Down Expand Up @@ -251,7 +261,12 @@ contract Oracle is IOracle, OracleAccessController, OracleTypehash {
AccessControl calldata _accessControl
)
external
hasAccess(_request.accessModule, RESOLVE_TYPEHASH, abi.encode(_request, _response, _dispute), _accessControl)
hasAccess(
_request.accessModule,
OracleTypehash.RESOLVE_TYPEHASH,
abi.encode(_request, _response, _dispute),
_accessControl
)
{
(bytes32 _responseId, bytes32 _disputeId) = ValidatorLib._validateResponseAndDispute(_request, _response, _dispute);

Expand Down Expand Up @@ -309,7 +324,10 @@ contract Oracle is IOracle, OracleAccessController, OracleTypehash {
IOracle.Request calldata _request,
IOracle.Response calldata _response,
AccessControl calldata _accessControl
) external hasAccess(_request.accessModule, FINALIZE_TYPEHASH, abi.encode(_request, _response), _accessControl) {
)
external
hasAccess(_request.accessModule, OracleTypehash.FINALIZE_TYPEHASH, abi.encode(_request, _response), _accessControl)
{
bytes32 _requestId;
bytes32 _responseId;

Expand Down Expand Up @@ -422,7 +440,7 @@ contract Oracle is IOracle, OracleAccessController, OracleTypehash {
AccessControl calldata _accessControl
)
internal
hasAccess(_request.accessModule, CREATE_TYPEHASH, abi.encode(_request), _accessControl)
hasAccess(_request.accessModule, OracleTypehash.CREATE_TYPEHASH, abi.encode(_request), _accessControl)
returns (bytes32 _requestId)
{
uint256 _requestNonce = totalRequestCount++;
Expand Down
2 changes: 1 addition & 1 deletion solidity/contracts/utils/OracleTypehash.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

contract OracleTypehash {
library OracleTypehash {
bytes32 public constant CREATE_TYPEHASH =
keccak256('createRequest(Request _request,bytes32 _ipfsHash,AccessControl _accessControl');

Expand Down

0 comments on commit a1830e3

Please sign in to comment.