Skip to content

Commit bc79f07

Browse files
committed
refactor: format code using new linter
1 parent d8f5286 commit bc79f07

22 files changed

+245
-237
lines changed

contracts/curation/Curation.sol

+12-12
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
302302
* @param _subgraphDeploymentID SubgraphDeployment to check if curated
303303
* @return True if curated
304304
*/
305-
function isCurated(bytes32 _subgraphDeploymentID) public override view returns (bool) {
305+
function isCurated(bytes32 _subgraphDeploymentID) public view override returns (bool) {
306306
return pools[_subgraphDeploymentID].tokens > 0;
307307
}
308308

@@ -314,8 +314,8 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
314314
*/
315315
function getCuratorSignal(address _curator, bytes32 _subgraphDeploymentID)
316316
public
317-
override
318317
view
318+
override
319319
returns (uint256)
320320
{
321321
if (address(pools[_subgraphDeploymentID].gcs) == address(0)) {
@@ -331,8 +331,8 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
331331
*/
332332
function getCurationPoolSignal(bytes32 _subgraphDeploymentID)
333333
public
334-
override
335334
view
335+
override
336336
returns (uint256)
337337
{
338338
if (address(pools[_subgraphDeploymentID].gcs) == address(0)) {
@@ -348,8 +348,8 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
348348
*/
349349
function getCurationPoolTokens(bytes32 _subgraphDeploymentID)
350350
external
351-
override
352351
view
352+
override
353353
returns (uint256)
354354
{
355355
return pools[_subgraphDeploymentID].tokens;
@@ -359,7 +359,7 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
359359
* @dev Get curation tax percentage
360360
* @return Amount the curation tax percentage in PPM
361361
*/
362-
function curationTaxPercentage() external override view returns (uint32) {
362+
function curationTaxPercentage() external view override returns (uint32) {
363363
return _curationTaxPercentage;
364364
}
365365

@@ -372,8 +372,8 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
372372
*/
373373
function tokensToSignal(bytes32 _subgraphDeploymentID, uint256 _tokensIn)
374374
public
375-
override
376375
view
376+
override
377377
returns (uint256, uint256)
378378
{
379379
uint256 curationTax = _tokensIn.mul(uint256(_curationTaxPercentage)).div(MAX_PPM);
@@ -404,11 +404,11 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
404404
return
405405
BancorFormula(bondingCurve)
406406
.calculatePurchaseReturn(
407-
SIGNAL_PER_MINIMUM_DEPOSIT,
408-
minimumCurationDeposit,
409-
defaultReserveRatio,
410-
_tokensIn.sub(minimumCurationDeposit)
411-
)
407+
SIGNAL_PER_MINIMUM_DEPOSIT,
408+
minimumCurationDeposit,
409+
defaultReserveRatio,
410+
_tokensIn.sub(minimumCurationDeposit)
411+
)
412412
.add(SIGNAL_PER_MINIMUM_DEPOSIT);
413413
}
414414

@@ -429,8 +429,8 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
429429
*/
430430
function signalToTokens(bytes32 _subgraphDeploymentID, uint256 _signalIn)
431431
public
432-
override
433432
view
433+
override
434434
returns (uint256)
435435
{
436436
CurationPool memory curationPool = pools[_subgraphDeploymentID];

contracts/discovery/ServiceRegistry.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ contract ServiceRegistry is ServiceRegistryV1Storage, GraphUpgradeable, IService
107107
* @dev Return the registration status of an indexer service
108108
* @return True if the indexer service is registered
109109
*/
110-
function isRegistered(address _indexer) public override view returns (bool) {
110+
function isRegistered(address _indexer) public view override returns (bool) {
111111
return bytes(services[_indexer].url).length > 0;
112112
}
113113
}

contracts/disputes/DisputeManager.sol

+36-25
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
149149
/**
150150
* @dev Check if the caller is the arbitrator.
151151
*/
152-
modifier onlyArbitrator {
152+
modifier onlyArbitrator() {
153153
_onlyArbitrator();
154154
_;
155155
}
@@ -413,10 +413,18 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
413413

414414
// Create the disputes
415415
// The deposit is zero for conflicting attestations
416-
bytes32 dID1 =
417-
_createQueryDisputeWithAttestation(fisherman, 0, attestation1, _attestationData1);
418-
bytes32 dID2 =
419-
_createQueryDisputeWithAttestation(fisherman, 0, attestation2, _attestationData2);
416+
bytes32 dID1 = _createQueryDisputeWithAttestation(
417+
fisherman,
418+
0,
419+
attestation1,
420+
_attestationData1
421+
);
422+
bytes32 dID2 = _createQueryDisputeWithAttestation(
423+
fisherman,
424+
0,
425+
attestation2,
426+
_attestationData2
427+
);
420428

421429
// Store the linked disputes to be resolved
422430
disputes[dID1].relatedDisputeID = dID2;
@@ -452,16 +460,15 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
452460
require(staking().getIndexerStakedTokens(indexer) > 0, "Dispute indexer has no stake");
453461

454462
// Create a disputeID
455-
bytes32 disputeID =
456-
keccak256(
457-
abi.encodePacked(
458-
_attestation.requestCID,
459-
_attestation.responseCID,
460-
_attestation.subgraphDeploymentID,
461-
indexer,
462-
_fisherman
463-
)
464-
);
463+
bytes32 disputeID = keccak256(
464+
abi.encodePacked(
465+
_attestation.requestCID,
466+
_attestation.responseCID,
467+
_attestation.subgraphDeploymentID,
468+
indexer,
469+
_fisherman
470+
)
471+
);
465472

466473
// Only one dispute for a (indexer, subgraphDeploymentID) at a time
467474
require(!isDisputeCreated(disputeID), "Dispute already created");
@@ -559,8 +566,11 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
559566
Dispute memory dispute = _resolveDispute(_disputeID);
560567

561568
// Slash
562-
(, uint256 tokensToReward) =
563-
_slashIndexer(dispute.indexer, dispute.fisherman, dispute.disputeType);
569+
(, uint256 tokensToReward) = _slashIndexer(
570+
dispute.indexer,
571+
dispute.fisherman,
572+
dispute.disputeType
573+
);
564574

565575
// Give the fisherman their deposit back
566576
TokenUtils.pushTokens(graphToken(), dispute.fisherman, dispute.deposit);
@@ -723,12 +733,11 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
723733
returns (address)
724734
{
725735
// Obtain the hash of the fully-encoded message, per EIP-712 encoding
726-
Receipt memory receipt =
727-
Receipt(
728-
_attestation.requestCID,
729-
_attestation.responseCID,
730-
_attestation.subgraphDeploymentID
731-
);
736+
Receipt memory receipt = Receipt(
737+
_attestation.requestCID,
738+
_attestation.responseCID,
739+
_attestation.subgraphDeploymentID
740+
);
732741
bytes32 messageHash = encodeHashReceipt(receipt);
733742

734743
// Obtain the signer of the fully-encoded EIP-712 message hash
@@ -761,8 +770,10 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
761770
require(_data.length == ATTESTATION_SIZE_BYTES, "Attestation must be 161 bytes long");
762771

763772
// Decode receipt
764-
(bytes32 requestCID, bytes32 responseCID, bytes32 subgraphDeploymentID) =
765-
abi.decode(_data, (bytes32, bytes32, bytes32));
773+
(bytes32 requestCID, bytes32 responseCID, bytes32 subgraphDeploymentID) = abi.decode(
774+
_data,
775+
(bytes32, bytes32, bytes32)
776+
);
766777

767778
// Decode signature
768779
// Signature is expected to be in the order defined in the Attestation struct

contracts/disputes/IDisputeManager.sol

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ pragma experimental ABIEncoderV2;
66
interface IDisputeManager {
77
// -- Dispute --
88

9-
enum DisputeType { Null, IndexingDispute, QueryDispute }
9+
enum DisputeType {
10+
Null,
11+
IndexingDispute,
12+
QueryDispute
13+
}
1014

1115
// Disputes contain info necessary for the Arbitrator to verify and resolve
1216
struct Dispute {

contracts/epochs/EpochManager.sol

+8-8
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,23 @@ contract EpochManager is EpochManagerV1Storage, GraphUpgradeable, IEpochManager
7171
* @dev Return true if the current epoch has already run.
7272
* @return Return true if current epoch is the last epoch that has run
7373
*/
74-
function isCurrentEpochRun() public override view returns (bool) {
74+
function isCurrentEpochRun() public view override returns (bool) {
7575
return lastRunEpoch == currentEpoch();
7676
}
7777

7878
/**
7979
* @dev Return current block number.
8080
* @return Block number
8181
*/
82-
function blockNum() public override view returns (uint256) {
82+
function blockNum() public view override returns (uint256) {
8383
return block.number;
8484
}
8585

8686
/**
8787
* @dev Return blockhash for a block.
8888
* @return BlockHash for `_block` number
8989
*/
90-
function blockHash(uint256 _block) external override view returns (bytes32) {
90+
function blockHash(uint256 _block) external view override returns (bytes32) {
9191
uint256 currentBlock = blockNum();
9292

9393
require(_block < currentBlock, "Can only retrieve past block hashes");
@@ -103,23 +103,23 @@ contract EpochManager is EpochManagerV1Storage, GraphUpgradeable, IEpochManager
103103
* @dev Return the current epoch, it may have not been run yet.
104104
* @return The current epoch based on epoch length
105105
*/
106-
function currentEpoch() public override view returns (uint256) {
106+
function currentEpoch() public view override returns (uint256) {
107107
return lastLengthUpdateEpoch.add(epochsSinceUpdate());
108108
}
109109

110110
/**
111111
* @dev Return block where the current epoch started.
112112
* @return The block number when the current epoch started
113113
*/
114-
function currentEpochBlock() public override view returns (uint256) {
114+
function currentEpochBlock() public view override returns (uint256) {
115115
return lastLengthUpdateBlock.add(epochsSinceUpdate().mul(epochLength));
116116
}
117117

118118
/**
119119
* @dev Return the number of blocks that passed since current epoch started.
120120
* @return Blocks that passed since start of epoch
121121
*/
122-
function currentEpochBlockSinceStart() external override view returns (uint256) {
122+
function currentEpochBlockSinceStart() external view override returns (uint256) {
123123
return blockNum() - currentEpochBlock();
124124
}
125125

@@ -128,7 +128,7 @@ contract EpochManager is EpochManagerV1Storage, GraphUpgradeable, IEpochManager
128128
* @param _epoch Epoch to use as since epoch value
129129
* @return Number of epochs and current epoch
130130
*/
131-
function epochsSince(uint256 _epoch) external override view returns (uint256) {
131+
function epochsSince(uint256 _epoch) external view override returns (uint256) {
132132
uint256 epoch = currentEpoch();
133133
return _epoch < epoch ? epoch.sub(_epoch) : 0;
134134
}
@@ -137,7 +137,7 @@ contract EpochManager is EpochManagerV1Storage, GraphUpgradeable, IEpochManager
137137
* @dev Return number of epochs passed since last epoch length update.
138138
* @return The number of epoch that passed since last epoch length update
139139
*/
140-
function epochsSinceUpdate() public override view returns (uint256) {
140+
function epochsSinceUpdate() public view override returns (uint256) {
141141
return blockNum().sub(lastLengthUpdateBlock).div(epochLength);
142142
}
143143
}

contracts/governance/Controller.sol

+7-11
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ contract Controller is Governed, Pausable, IController {
1818

1919
event SetContractProxy(bytes32 indexed id, address contractAddress);
2020

21-
/**
21+
/**
2222
* @dev Contract constructor.
2323
*/
2424
constructor() {
@@ -30,7 +30,7 @@ contract Controller is Governed, Pausable, IController {
3030
/**
3131
* @dev Check if the caller is the governor or pause guardian.
3232
*/
33-
modifier onlyGovernorOrGuardian {
33+
modifier onlyGovernorOrGuardian() {
3434
require(
3535
msg.sender == governor || msg.sender == pauseGuardian,
3636
"Only Governor or Guardian can call"
@@ -41,7 +41,7 @@ contract Controller is Governed, Pausable, IController {
4141
/**
4242
* @notice Getter to access governor
4343
*/
44-
function getGovernor() external override view returns (address) {
44+
function getGovernor() external view override returns (address) {
4545
return governor;
4646
}
4747

@@ -66,11 +66,7 @@ contract Controller is Governed, Pausable, IController {
6666
* @notice Unregister a contract address
6767
* @param _id Contract id (keccak256 hash of contract name)
6868
*/
69-
function unsetContractProxy(bytes32 _id)
70-
external
71-
override
72-
onlyGovernor
73-
{
69+
function unsetContractProxy(bytes32 _id) external override onlyGovernor {
7470
registry[_id] = address(0);
7571
emit SetContractProxy(_id, address(0));
7672
}
@@ -79,7 +75,7 @@ contract Controller is Governed, Pausable, IController {
7975
* @notice Get contract proxy address by its id
8076
* @param _id Contract id
8177
*/
82-
function getContractProxy(bytes32 _id) public override view returns (address) {
78+
function getContractProxy(bytes32 _id) public view override returns (address) {
8379
return registry[_id];
8480
}
8581

@@ -123,14 +119,14 @@ contract Controller is Governed, Pausable, IController {
123119
/**
124120
* @notice Getter to access paused
125121
*/
126-
function paused() external override view returns (bool) {
122+
function paused() external view override returns (bool) {
127123
return _paused;
128124
}
129125

130126
/**
131127
* @notice Getter to access partial pause status
132128
*/
133-
function partialPaused() external override view returns (bool) {
129+
function partialPaused() external view override returns (bool) {
134130
return _partialPaused;
135131
}
136132
}

contracts/governance/Governed.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ contract Governed {
2020
/**
2121
* @dev Check if the caller is the governor.
2222
*/
23-
modifier onlyGovernor {
23+
modifier onlyGovernor() {
2424
require(msg.sender == governor, "Only Governor can call");
2525
_;
2626
}

contracts/governance/GraphGovernanceStorage.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import "./IGraphGovernance.sol";
88
contract GraphGovernanceV1Storage is Governed {
99
// Graph Governance Proposal storage struct (GGP)
1010
struct Proposal {
11-
bytes32 votes; // IPFS hash of signed votes
12-
bytes32 metadata; // Additional info that can be linked
11+
bytes32 votes; // IPFS hash of signed votes
12+
bytes32 metadata; // Additional info that can be linked
1313
IGraphGovernance.ProposalResolution resolution;
1414
}
1515

contracts/governance/IGraphGovernance.sol

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ interface IGraphGovernance {
66
/**
77
* @dev The three states of a Proposal. Null can never be set.
88
*/
9-
enum ProposalResolution { Null, Accepted, Rejected }
9+
enum ProposalResolution {
10+
Null,
11+
Accepted,
12+
Rejected
13+
}
1014

1115
// -- Proposals --
1216

contracts/governance/Managed.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ contract Managed {
5656
require(msg.sender == address(controller), "Caller must be Controller");
5757
}
5858

59-
modifier notPartialPaused {
59+
modifier notPartialPaused() {
6060
_notPartialPaused();
6161
_;
6262
}
6363

64-
modifier notPaused {
64+
modifier notPaused() {
6565
_notPaused();
6666
_;
6767
}

0 commit comments

Comments
 (0)