Skip to content

Commit

Permalink
fix: [W12-228] audit (#82)
Browse files Browse the repository at this point in the history
* chore: add sollint

* style: fix lint warns/errors

* refactor(PurchaseProcessing): change function type

* fix(RatesGuard): shadowed variable name
  • Loading branch information
Hokid authored Jan 16, 2019
1 parent 7464bfd commit a87fb76
Show file tree
Hide file tree
Showing 62 changed files with 929 additions and 644 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
- run: git submodule update --init --recursive
- run: sudo npm i -g npm && npm -v
- run: sudo npm i -g truffle
- run: cp example.config.js config.js
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package-lock.json" }}-{{ checksum "ethpm.json" }}
Expand All @@ -35,6 +34,7 @@ jobs:
keys:
- v1-dependencies-{{ checksum "package-lock.json" }}-{{ checksum "ethpm.json" }}
- v1-dependencies-
- run: npm run lint -- --formatter=unix
- run: npm run ci-test
deploy_alpha_release:
<<: *defaults
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,5 @@ typings/
.idea/
config.js
flats/
build/
.MIGRATE_*

18 changes: 18 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "default",
"rules": {
"indent": ["warn", 4],
"quotes": ["warn", "double"],
"max-line-length": ["warn", 120],
"func-order": "warn",
"statement-indent": "warn",
"var-name-mixedcase": "warn",
"func-name-mixedcase": "warn",
"space-after-comma": "warn",
"expression-indent": "warn",
"separate-by-one-line-in-contract": "warn",
"bracket-align": false,
"function-max-lines": false,
"not-rely-on-time": false
}
}
3 changes: 2 additions & 1 deletion contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;

import "./versioning/Versionable.sol";


contract Migrations is Versionable {
address public owner;
uint public last_completed_migration;
Expand Down
2 changes: 1 addition & 1 deletion contracts/W12Lister.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Secondary.sol";
Expand Down
3 changes: 2 additions & 1 deletion contracts/W12ListerStub.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;

import "./W12Lister.sol";
import "./crowdsale/factories/IW12CrowdsaleFactory.sol";
import "./wallets/IWallets.sol";
import "./token/exchanger/ITokenExchanger.sol";


contract W12ListerStub is W12Lister {

/**
Expand Down
3 changes: 2 additions & 1 deletion contracts/access/roles/AdminRole.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;

import "openzeppelin-solidity/contracts/access/Roles.sol";


contract AdminRole {
using Roles for Roles.Role;

Expand Down
3 changes: 2 additions & 1 deletion contracts/access/roles/IAdminRole.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;


contract IAdminRole {
function isAdmin(address account) public view returns (bool);
Expand Down
3 changes: 2 additions & 1 deletion contracts/access/roles/IPricerRole.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;


contract IPricerRole {
function isPricer(address account) public view returns (bool);
Expand Down
3 changes: 2 additions & 1 deletion contracts/access/roles/IProjectOwnerRole.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;


contract IProjectOwnerRole {
function isProjectOwner(address account) public view returns (bool);
Expand Down
3 changes: 2 additions & 1 deletion contracts/access/roles/ISuggestorRole.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;


contract ISuggestorRole {
function isSuggestor(address account) public view returns (bool);
Expand Down
3 changes: 2 additions & 1 deletion contracts/access/roles/PricerRole.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;

import "openzeppelin-solidity/contracts/access/Roles.sol";


contract PricerRole {
using Roles for Roles.Role;

Expand Down
3 changes: 2 additions & 1 deletion contracts/access/roles/ProjectOwnerRole.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;

import "openzeppelin-solidity/contracts/access/Roles.sol";


contract ProjectOwnerRole {
using Roles for Roles.Role;

Expand Down
3 changes: 2 additions & 1 deletion contracts/access/roles/SuggestorRole.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;

import "openzeppelin-solidity/contracts/access/Roles.sol";


contract SuggestorRole {
using Roles for Roles.Role;

Expand Down
9 changes: 5 additions & 4 deletions contracts/crowdsale/IW12Crowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;

import "../token/IWToken.sol";
import "./IW12Fund.sol";
import "../access/roles/IAdminRole.sol";
import "../access/roles/IProjectOwnerRole.sol";


contract IW12Crowdsale is IAdminRole, IProjectOwnerRole {
function setParameters(uint price) external;

Expand All @@ -21,6 +22,8 @@ contract IW12Crowdsale is IAdminRole, IProjectOwnerRole {

function getFund() external view returns(IW12Fund);

function milestonesLength() external view returns (uint);

function getMilestone(uint index) public view returns (uint32, uint, uint32, uint32, bytes, bytes);

function getStage(uint index) public view returns (uint32, uint32, uint, uint32, uint[], uint[]);
Expand All @@ -29,8 +32,6 @@ contract IW12Crowdsale is IAdminRole, IProjectOwnerRole {

function getLastMilestoneIndex() public view returns (uint index, bool found);

function milestonesLength() external view returns (uint);

function getCurrentStageIndex() public view returns (uint index, bool found);

function getSaleVolumeBonus(uint value) public view returns (uint bonus);
Expand All @@ -45,7 +46,7 @@ contract IW12Crowdsale is IAdminRole, IProjectOwnerRole {

function getPurchaseFeeForPaymentMethod(bytes32 method) public view returns (uint);

function buyTokens(bytes32 method, uint amount) payable public;
function buyTokens(bytes32 method, uint amount) public payable;

function transferPrimary(address _address) public;
}
7 changes: 4 additions & 3 deletions contracts/crowdsale/IW12Fund.sol
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;

import "./IW12Crowdsale.sol";
import "../access/roles/IAdminRole.sol";
import "../access/roles/IProjectOwnerRole.sol";


contract IW12Fund is IAdminRole, IProjectOwnerRole {
function setCrowdsale(IW12Crowdsale _crowdsale) external;

function setServiceWallet(address _serviceWallet) external;

function setSwap(address _swap) external;

function transferPrimary(address _address) public;

function recordPurchase(
address investor,
uint tokenAmount,
bytes32 symbol,
uint cost,
uint costUSD
) external payable;

function transferPrimary(address _address) public;
}
Loading

0 comments on commit a87fb76

Please sign in to comment.