Skip to content

Commit b28846d

Browse files
committed
style: make code beautiful
1 parent fc31ebc commit b28846d

File tree

8 files changed

+67
-36
lines changed

8 files changed

+67
-36
lines changed

.solhint.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "solhint:recommended",
3+
"plugins": [
4+
"prettier"
5+
],
6+
"rules": {
7+
"prettier/prettier": "error",
8+
"max-line-length": "off",
9+
"check-send-result": "off",
10+
"not-rely-on-time": "off",
11+
"multiple-sends": "off",
12+
"compiler-version": "off",
13+
"func-visibility": ["warn", {
14+
"ignoreConstructors": true
15+
}]
16+
}
17+
}

contracts/Migrations.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import "@kleros/kleros-interaction/contracts/standard/arbitration/TwoPartyArbitr
77

88
contract Migrations {
99
address public owner;
10-
uint public last_completed_migration;
10+
uint256 public last_completed_migration;
1111

1212
modifier isOwner() {
1313
if (msg.sender == owner) _;
@@ -17,7 +17,7 @@ contract Migrations {
1717
owner = msg.sender;
1818
}
1919

20-
function setCompleted(uint completed) public isOwner {
20+
function setCompleted(uint256 completed) public isOwner {
2121
last_completed_migration = completed;
2222
}
2323

contracts/interfaces/IERC677.sol

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ pragma solidity ^0.4.24;
22

33
interface IERC677 {
44
function transfer(address _to, uint256 _value) external returns (bool);
5-
function transferFrom(address _from, address _to, uint256 _value) external returns (bool);
5+
6+
function transferFrom(
7+
address _from,
8+
address _to,
9+
uint256 _value
10+
) external returns (bool);
11+
612
function approve(address _spender, uint256 _value) external returns (bool);
7-
}
13+
}
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
pragma solidity ^0.4.24;
22

3-
43
///@dev See https://blockscout.com/poa/xdai/address/0x5870b0527DeDB1cFBD9534343Feda1a41Ce47766/contracts
54
///@dev Sokol testnet: https://blockscout.com/poa/sokol/address/0x8f2b78169B0970F11a762e56659Db52B59CBCf1B/contracts
65
interface IRandomAuRa {
7-
function currentSeed() external view returns(uint256);
8-
function isCommitPhase() external view returns(bool);
9-
function nextCommitPhaseStartBlock() external view returns(uint256);
10-
function collectRoundLength() external view returns(uint256);
11-
}
6+
function currentSeed() external view returns (uint256);
7+
8+
function isCommitPhase() external view returns (bool);
9+
10+
function nextCommitPhaseStartBlock() external view returns (uint256);
11+
12+
function collectRoundLength() external view returns (uint256);
13+
}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
pragma solidity ^0.4.24;
22

3-
import { IERC677 } from "../interfaces/IERC677.sol";
3+
import {IERC677} from "../interfaces/IERC677.sol";
44

55
interface ITokenBridge {
6-
function relayTokens(IERC677 token, address _receiver, uint256 _value) external;
7-
}
6+
function relayTokens(
7+
IERC677 token,
8+
address _receiver,
9+
uint256 _value
10+
) external;
11+
}

contracts/mocks/BridgedPinakionMock.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ pragma solidity ^0.4.24;
33
import "openzeppelin-eth/contracts/token/ERC20/ERC20.sol";
44

55
// mock class using ERC20
6-
contract BridgedPinakionMock is ERC20 {
7-
function initialize(
8-
address _initialAccount,
9-
uint _initialSupply
10-
) public initializer {
6+
contract BridgedPinakionMock is ERC20 {
7+
function initialize(address _initialAccount, uint256 _initialSupply)
8+
public
9+
initializer
10+
{
1111
_mint(_initialAccount, _initialSupply);
1212
}
13-
}
13+
}

contracts/mocks/MockRandomAuRa.sol

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
pragma solidity ^0.4.24;
22

3-
import { IRandomAuRa } from "../interfaces/IRandomAuRa.sol";
3+
import {IRandomAuRa} from "../interfaces/IRandomAuRa.sol";
44

55
contract MockRandomAuRa is IRandomAuRa {
66
uint256 private constant COLLECT_ROUND_LENGTH = 4;
77
uint256 public number;
88

99
/** @dev Constructor.
10-
* @param _number The constant number to always return.
11-
*/
10+
* @param _number The constant number to always return.
11+
*/
1212
constructor(uint256 _number) public {
1313
number = _number;
1414
}
1515

16-
17-
function currentSeed() external view returns(uint256) {
16+
function currentSeed() external view returns (uint256) {
1817
return number;
1918
}
2019

21-
function isCommitPhase() external view returns(bool) {
20+
function isCommitPhase() external view returns (bool) {
2221
uint256 commitPhaseLength = COLLECT_ROUND_LENGTH / 2;
2322
return (block.number - 1) % COLLECT_ROUND_LENGTH < commitPhaseLength;
2423
}
2524

26-
function nextCommitPhaseStartBlock() external view returns(uint256) {
27-
uint256 remainingBlocksToNextRound = COLLECT_ROUND_LENGTH - (block.number - 1) % COLLECT_ROUND_LENGTH;
25+
function nextCommitPhaseStartBlock() external view returns (uint256) {
26+
uint256 remainingBlocksToNextRound =
27+
COLLECT_ROUND_LENGTH - ((block.number - 1) % COLLECT_ROUND_LENGTH);
2828
return remainingBlocksToNextRound + block.number;
2929
}
3030

31-
function collectRoundLength() external view returns(uint256) {
31+
function collectRoundLength() external view returns (uint256) {
3232
return COLLECT_ROUND_LENGTH;
3333
}
34-
}
34+
}

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
"contracts"
1111
],
1212
"scripts": {
13-
"prettify": "kathari prettify",
14-
"lint:sol": "kathari lint:sol",
15-
"lint:js": "kathari lint:js",
1613
"lint": "yarn run lint:sol && yarn run lint:js",
14+
"lint:js": "eslint .",
15+
"lint:sol": "solhint 'contracts/**/*.sol'",
16+
"fix": "run-p -s fix:*",
17+
"fix:js": "eslint --fix '**/*.js'",
18+
"fix:sol": "prettier --write 'contracts/**/*.sol'",
1719
"test:ganache": "ganache-cli --gasLimit 8000000 --quiet &",
1820
"test": "truffle test",
1921
"cz": "kathari cz",
@@ -37,10 +39,10 @@
3739
"minimetoken": "^0.2.0",
3840
"mocha": "^8.1.1",
3941
"npm-run-all": "^4.1.5",
40-
"prettier": "^2.0.5",
41-
"prettier-plugin-solidity": "^1.0.0-alpha.56",
42-
"solhint": "^3.2.0",
43-
"solhint-plugin-prettier": "^0.0.4",
42+
"prettier": "2.3.0",
43+
"prettier-plugin-solidity": "^1.0.0-beta.10",
44+
"solhint": "^3.3.4",
45+
"solhint-plugin-prettier": "^0.0.5",
4446
"solidity-coverage": "^0.5.11",
4547
"standard-version": "^4.4.0",
4648
"truffle": "^5.2.6",

0 commit comments

Comments
 (0)