Skip to content

Commit 85ff669

Browse files
committed
Apply code formatting
1 parent 63c0c5c commit 85ff669

27 files changed

+2639
-1867
lines changed

.prettierrc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"arrowParens": "avoid",
6+
"overrides": [
7+
{
8+
"files": "*.sol",
9+
"options": {
10+
"singleQuote": false,
11+
"quoteProps": "consistent"
12+
}
13+
}
14+
],
15+
"plugins": ["prettier-plugin-solidity"]
16+
}

.solcover.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
skipFiles: ["common/ReentrancyGuard.sol", "sfc/Migrations.sol"],
2+
skipFiles: ['common/ReentrancyGuard.sol', 'sfc/Migrations.sol'],
33
};

contracts/common/Initializable.sol

+29-30
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,35 @@ pragma solidity ^0.8.9;
1414
* because this is not dealt with automatically as with constructors.
1515
*/
1616
contract Initializable {
17-
18-
/**
19-
* @dev Indicates that the contract has been initialized.
20-
*/
21-
bool private initialized;
22-
23-
/**
24-
* @dev Indicates that the contract is in the process of being initialized.
25-
*/
26-
bool private initializing;
27-
28-
/**
29-
* @dev Modifier to use in the initializer function of a contract.
30-
*/
31-
modifier initializer() {
32-
require(initializing || !initialized, "Contract instance has already been initialized");
33-
34-
bool isTopLevelCall = !initializing;
35-
if (isTopLevelCall) {
36-
initializing = true;
37-
initialized = true;
38-
}
39-
40-
_;
41-
42-
if (isTopLevelCall) {
43-
initializing = false;
17+
/**
18+
* @dev Indicates that the contract has been initialized.
19+
*/
20+
bool private initialized;
21+
22+
/**
23+
* @dev Indicates that the contract is in the process of being initialized.
24+
*/
25+
bool private initializing;
26+
27+
/**
28+
* @dev Modifier to use in the initializer function of a contract.
29+
*/
30+
modifier initializer() {
31+
require(initializing || !initialized, "Contract instance has already been initialized");
32+
33+
bool isTopLevelCall = !initializing;
34+
if (isTopLevelCall) {
35+
initializing = true;
36+
initialized = true;
37+
}
38+
39+
_;
40+
41+
if (isTopLevelCall) {
42+
initializing = false;
43+
}
4444
}
45-
}
4645

47-
// Reserved storage space to allow for layout changes in the future.
48-
uint256[50] private ______gap;
46+
// Reserved storage space to allow for layout changes in the future.
47+
uint256[50] private ______gap;
4948
}

contracts/erc20/base/ERC20Burnable.sol

-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ pragma solidity ^0.8.9;
33

44
import "./ERC20.sol";
55

6-
76
/**
87
* @title Burnable Token
98
* @dev Token that can be irreversibly burned (destroyed).
109
*/
1110
contract ERC20Burnable is ERC20 {
12-
1311
/**
1412
* @dev Burns a specific amount of tokens.
1513
* @param value The amount of token to be burned.

contracts/erc20/base/ERC20Mintable.sol

+2-16
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pragma solidity ^0.8.9;
44
import "./ERC20.sol";
55
import "./MinterRole.sol";
66

7-
87
/**
98
* @title ERC20Mintable
109
* @dev ERC20 minting logic
@@ -32,15 +31,7 @@ contract ERC20Mintable is ERC20, MinterRole {
3231
* @param amount The amount of tokens to mint.
3332
* @return A boolean that indicates if the operation was successful.
3433
*/
35-
function mint(
36-
address to,
37-
uint256 amount
38-
)
39-
public
40-
onlyMinter
41-
onlyBeforeMintingFinished
42-
returns (bool)
43-
{
34+
function mint(address to, uint256 amount) public onlyMinter onlyBeforeMintingFinished returns (bool) {
4435
_mint(to, amount);
4536
return true;
4637
}
@@ -49,12 +40,7 @@ contract ERC20Mintable is ERC20, MinterRole {
4940
* @dev Function to stop minting new tokens.
5041
* @return True if the operation was successful.
5142
*/
52-
function finishMinting()
53-
public
54-
onlyMinter
55-
onlyBeforeMintingFinished
56-
returns (bool)
57-
{
43+
function finishMinting() public onlyMinter onlyBeforeMintingFinished returns (bool) {
5844
_mintingFinished = true;
5945
emit MintingFinished();
6046
return true;

contracts/erc20/base/MinterRole.sol

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ pragma solidity ^0.8.9;
33

44
import "./Roles.sol";
55

6-
76
contract MinterRole {
87
using Roles for Roles.Role;
98

contracts/erc20/base/Roles.sol

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: UNLICENSED
22
pragma solidity ^0.8.9;
33

4-
54
/**
65
* @title Roles
76
* @dev Library for managing addresses assigned to a Role.
@@ -31,11 +30,7 @@ library Roles {
3130
* @dev check if an account has this role
3231
* @return bool
3332
*/
34-
function has(Role storage role, address account)
35-
internal
36-
view
37-
returns (bool)
38-
{
33+
function has(Role storage role, address account) internal view returns (bool) {
3934
require(account != address(0));
4035
return role.bearer[account];
4136
}

contracts/sfc/ConstantsManager.sol

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ contract ConstantsManager is Ownable {
3434

3535
address private secondaryOwner_erased;
3636

37-
// event SecondaryOwnershipTransferred(address indexed previousOwner, address indexed newOwner);
37+
// event SecondaryOwnershipTransferred(address indexed previousOwner, address indexed newOwner);
3838

3939
function initialize() external initializer {
4040
Ownable.initialize(msg.sender);
4141
}
4242

43-
// function setSecondaryOwner(address v) onlyOwner external {
44-
// emit SecondaryOwnershipTransferred(secondaryOwner, v);
45-
// secondaryOwner = v;
46-
// }
43+
// function setSecondaryOwner(address v) onlyOwner external {
44+
// emit SecondaryOwnershipTransferred(secondaryOwner, v);
45+
// secondaryOwner = v;
46+
// }
4747

4848
function updateMinSelfStake(uint256 v) external virtual onlyOwner {
4949
require(v >= 100000 * 1e18, "too small value");

contracts/sfc/GasPriceConstants.sol

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import "../common/Decimal.sol";
55

66
library GP {
77
function trimGasPriceChangeRatio(uint256 x) internal pure returns (uint256) {
8-
if (x > Decimal.unit() * 105 / 100) {
9-
return Decimal.unit() * 105 / 100;
8+
if (x > (Decimal.unit() * 105) / 100) {
9+
return (Decimal.unit() * 105) / 100;
1010
}
11-
if (x < Decimal.unit() * 95 / 100) {
12-
return Decimal.unit() * 95 / 100;
11+
if (x < (Decimal.unit() * 95) / 100) {
12+
return (Decimal.unit() * 95) / 100;
1313
}
1414
return x;
1515
}

contracts/sfc/Migrations.sol

+16-16
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
pragma solidity ^0.8.9;
33

44
contract Migrations {
5-
address public owner;
6-
uint public last_completed_migration;
5+
address public owner;
6+
uint public last_completed_migration;
77

8-
constructor(address contractOwner) {
9-
owner = contractOwner;
10-
}
8+
constructor(address contractOwner) {
9+
owner = contractOwner;
10+
}
1111

12-
modifier restricted() {
13-
require(msg.sender == owner, "Not the contract owner");
14-
_;
15-
}
12+
modifier restricted() {
13+
require(msg.sender == owner, "Not the contract owner");
14+
_;
15+
}
1616

17-
function setCompleted(uint completed) public restricted {
18-
last_completed_migration = completed;
19-
}
17+
function setCompleted(uint completed) public restricted {
18+
last_completed_migration = completed;
19+
}
2020

21-
function upgrade(address new_address) public restricted {
22-
Migrations upgraded = Migrations(new_address);
23-
upgraded.setCompleted(last_completed_migration);
24-
}
21+
function upgrade(address new_address) public restricted {
22+
Migrations upgraded = Migrations(new_address);
23+
upgraded.setCompleted(last_completed_migration);
24+
}
2525
}

contracts/sfc/NetworkInitializer.sol

+10-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ import "./ConstantsManager.sol";
88

99
contract NetworkInitializer {
1010
// Initialize NodeDriverAuth, NodeDriver and SFC in one call to allow fewer genesis transactions
11-
function initializeAll(uint256 sealedEpoch, uint256 totalSupply, address payable _sfc, address _lib, address _auth, address _driver, address _evmWriter, address _owner) external {
11+
function initializeAll(
12+
uint256 sealedEpoch,
13+
uint256 totalSupply,
14+
address payable _sfc,
15+
address _lib,
16+
address _auth,
17+
address _driver,
18+
address _evmWriter,
19+
address _owner
20+
) external {
1221
NodeDriver(_driver).initialize(_auth, _evmWriter);
1322
NodeDriverAuth(_auth).initialize(_sfc, _driver, _owner);
1423

0 commit comments

Comments
 (0)