Skip to content
This repository has been archived by the owner on Mar 20, 2020. It is now read-only.

Add linting rules #29

Merged
merged 1 commit into from Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -5,6 +5,7 @@ notifications:
node_js:
- '8'
env:
- TASK=lint
- TASK=test
before_script:
- npm prune
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"postinstall": "npm run bootstrap",
"bootstrap": "lerna bootstrap",
"lint": "lerna run --scope=@aragon/ppf-contracts lint",
"test": "lerna run --scope=@aragon/ppf-contracts --concurrency=1 --stream test"
},
"repository": {
Expand Down
22 changes: 22 additions & 0 deletions packages/ppf-contracts/.soliumrc.json
@@ -0,0 +1,22 @@
{
"extends": "solium:all",
"rules": {
"imports-on-top": ["error"],
"variable-declarations": ["error"],
"array-declarations": ["error"],
"operator-whitespace": ["error"],
"lbrace": ["error"],
"mixedcase": 0,
"camelcase": ["error"],
"uppercase": 0,
"no-empty-blocks": ["error"],
"no-unused-vars": ["error"],
"quotes": ["error"],
"indentation": 0,
"whitespace": ["error"],
"deprecated-suicide": ["error"],
"arg-overflow": ["error", 8],
"pragma-on-top": ["error"],
"security/enforce-explicit-visibility": ["error"]
}
}
18 changes: 9 additions & 9 deletions packages/ppf-contracts/contracts/PPF.sol
Expand Up @@ -67,20 +67,12 @@ contract PPF is IFeed, TimeHelpers {
_setOperatorOwner(_operatorOwner);
}

/**

* @return The minimum rate precision used for the exchange rates
*/
function ratePrecision() external pure returns (uint256) {
return ONE;
}

/**
* @param base Address for the base token in the feed
* @param quote Address for the quote token the base is denominated in
* @return XRT for base:quote and the timestamp when it was updated
*/
function get(address base, address quote) public view returns (uint128, uint64) {
function get(address base, address quote) external view returns (uint128, uint64) {
if (base == quote) {
return (uint128(ONE), getTimestamp64());
}
Expand All @@ -95,6 +87,14 @@ contract PPF is IFeed, TimeHelpers {
return (_pairXRT(base, quote, price.xrt), price.when);
}

/**

* @return The minimum rate precision used for the exchange rates
*/
function ratePrecision() external pure returns (uint256) {
return ONE;
}

/**
* @notice Update the price for the `base + ':' + quote` feed with an exchange rate of `xrt / ONE` for time `when`
* @dev If the number representation of base is lower than the one for quote, and update is cheaper, as less manipulation is required.
Expand Down
5 changes: 4 additions & 1 deletion packages/ppf-contracts/contracts/misc/Migrations.sol
@@ -1,5 +1,6 @@
pragma solidity ^0.4.23;


contract Migrations {
address public owner;
uint public last_completed_migration;
Expand All @@ -9,7 +10,9 @@ contract Migrations {
}

modifier restricted() {
if (msg.sender == owner) _;
if (msg.sender == owner) {
_;
}
}

function setCompleted(uint completed) public restricted {
Expand Down
Expand Up @@ -3,6 +3,7 @@ pragma solidity 0.4.24;
// Using ECRecovery from open-zeppelin@ad12381549c4c0711c2f3310e9fb1f65d51c299c + added personalRecover function
// See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/ad12381549c4c0711c2f3310e9fb1f65d51c299c/contracts/ECRecovery.sol


library ECRecovery {
/**
* @dev Recover signer address from a personal signed message by using his signature
Expand Down
2 changes: 2 additions & 0 deletions packages/ppf-contracts/package.json
Expand Up @@ -7,6 +7,7 @@
"compile": "truffle compile --all",
"test": "npm run compile && truffle test",
"coverage": "solidity-coverage",
"lint": "solium --dir ./contracts",
"abi:extract": "truffle-extract --output abi/ --keys abi",
"prepublishOnly": "npm run compile && npm run abi:extract -- --no-compile"
},
Expand All @@ -31,6 +32,7 @@
"@aragon/ppf.js": "^1.0.0",
"@aragon/test-helpers": "^1.0.1",
"solidity-coverage": "^0.5.4",
"solium": "^1.2.3",
"truffle": "4.1.14",
"truffle-extract": "^1.2.1"
}
Expand Down