Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing docs #71

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"postinstall": "husky",
"lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt --check",
"lint:fix": "sort-package-json && forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix",
"lint:natspec": "npx @defi-wonderland/natspec-smells --config natspec-smells.config.js",
"lint:sol-logic": "solhint 'solidity/contracts/**/*.sol' 'solidity/interfaces/**/*.sol'",
"lint:sol-tests": "solhint -c .solhint.tests.json 'solidity/test/**/*.sol'",
"prepare": "husky",
Expand Down
4 changes: 4 additions & 0 deletions solidity/contracts/Module.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import {IOracle} from '../interfaces/IOracle.sol';

import {Validator} from './Validator.sol';

/**
* @title Module
* @notice abstract contract implemented by all Modules
*/
abstract contract Module is Validator, IModule {
constructor(IOracle _oracle) Validator(_oracle) {}

Expand Down
4 changes: 4 additions & 0 deletions solidity/contracts/Oracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import {ValidatorLib} from '../libraries/ValidatorLib.sol';
import {OracleAccessController} from './access/OracleAccessController.sol';
import {OracleTypehash} from './utils/OracleTypehash.sol';

/**
* @title Oracle
* @notice Source of truth for applications built on top of Prophet
*/
contract Oracle is IOracle, OracleAccessController {
using ValidatorLib for *;

Expand Down
4 changes: 4 additions & 0 deletions solidity/contracts/access/CommonAccessController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ pragma solidity ^0.8.19;
import {IAccessController} from '../../interfaces/access/IAccessController.sol';
import {IAccessModule} from '../../interfaces/modules/access/IAccessModule.sol';

/**
* @title CommonAccessController
* @notice abstract contract implemented by AccessControllers
*/
abstract contract CommonAccessController is IAccessController {
/**
* @notice Check whether the caller is authorized for the given parameters.
Expand Down
11 changes: 11 additions & 0 deletions solidity/contracts/access/ModuleAccessController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import {IModuleAccessController} from '../../interfaces/access/IModuleAccessCont
import {Module} from '../Module.sol';
import {CommonAccessController} from './CommonAccessController.sol';

/**
* @title ModuleAccessController
* @notice abstract contract to manage access control at the Modules level
*/
abstract contract ModuleAccessController is IModuleAccessController, CommonAccessController, Module {
constructor(IOracle _oracle) Module(_oracle) {}

Expand All @@ -29,6 +33,13 @@ abstract contract ModuleAccessController is IModuleAccessController, CommonAcces
_accessControl = _defaultAccessControl(bytes(''));
}

/**
* @dev Modifier to check if the caller is authorized to operate on behalf of a user
* @param _accessModule The address of the access module
* @param _typehash The typehash of the called function
* @param _params The typehash function parameters
* @param _accessControl The access control struct
*/
modifier hasAccess(
address _accessModule,
bytes32 _typehash,
Expand Down
11 changes: 11 additions & 0 deletions solidity/contracts/access/OracleAccessController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,21 @@ pragma solidity ^0.8.19;
import {IOracleAccessController} from '../../interfaces/access/IOracleAccessController.sol';
import {CommonAccessController} from './CommonAccessController.sol';

/**
* @title OracleAccessController
* @notice abstract contract to manage access control at the Oracle level
*/
abstract contract OracleAccessController is IOracleAccessController, CommonAccessController {
/// @inheritdoc IOracleAccessController
mapping(address _user => mapping(address _accessModule => bool _approved)) public isAccessModuleApproved;

/**
* @dev Modifier to check if the caller is authorized to operate on behalf of a user
* @param _accessModule The address of the access module
* @param _typehash The typehash of the called function
* @param _params The typehash function parameters
* @param _accessControl The access control struct
*/
modifier hasAccess(
address _accessModule,
bytes32 _typehash,
Expand Down
3 changes: 3 additions & 0 deletions solidity/contracts/utils/OracleTypehash.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

/**
* @title OracleTypehash
*/
library OracleTypehash {
bytes32 public constant CREATE_TYPEHASH =
keccak256('createRequest(Request _request,bytes32 _ipfsHash,AccessControl _accessControl');
Expand Down
1 change: 1 addition & 0 deletions solidity/interfaces/IValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface IValidator {

/**
* @notice The oracle contract
* @return _oracle The oracle contract
*/
function ORACLE() external view returns (IOracle _oracle);
}
2 changes: 1 addition & 1 deletion solidity/interfaces/modules/access/IAccessModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ interface IAccessModule is IModule {
/**
* @notice Access control parameters
* @param sender The address of the sender
* @param accessControl The access control struct
* @param typehash The typehash of the access control
* @param data The data for access control validation
* @param typehashParams The parameters for access control validation
*/
struct AccessControlParameters {
Expand Down
4 changes: 4 additions & 0 deletions solidity/interfaces/modules/dispute/IDisputeModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ pragma solidity ^0.8.19;
import {IModule} from '../../IModule.sol';
import {IOracle} from '../../IOracle.sol';

/**
* @title DisputeModule
* @notice Common interface for all dispute modules
*/
interface IDisputeModule is IModule {
/*///////////////////////////////////////////////////////////////
EVENTS
Expand Down
4 changes: 4 additions & 0 deletions solidity/interfaces/modules/finality/IFinalityModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ pragma solidity ^0.8.19;

import {IModule} from '../../IModule.sol';

/**
* @title FinalityModule
* @notice Common interface for all finality modules
*/
interface IFinalityModule is IModule {}
4 changes: 4 additions & 0 deletions solidity/interfaces/modules/request/IRequestModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ pragma solidity ^0.8.19;

import {IModule} from '../../IModule.sol';

/**
* @title RequestModule
* @notice Common interface for all request modules
*/
interface IRequestModule is IModule {
/**
* @notice Called by the oracle when a request has been made
Expand Down
3 changes: 3 additions & 0 deletions solidity/libraries/ValidatorLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ pragma solidity ^0.8.19;

import {IOracle} from '../interfaces/IOracle.sol';

/**
* @title ValidatorLib
*/
library ValidatorLib {
/**
* @notice Thrown when the response provided does not match the request
Expand Down
Loading