Skip to content

Commit

Permalink
Fix warnings (#1606)
Browse files Browse the repository at this point in the history
* Bump required compiler version to 0.5.2.

* Fix shadowed variable warning in ERC20Migrator.

* Rename Counter to Counters.

* Add dummy state variable to SafeERC20Helper.

* Update changelog entry.

* Fix CountersImpl name.

* Improve changelog entry.
  • Loading branch information
nventuro authored Jan 17, 2019
1 parent 7fb90a1 commit b7d60f2
Show file tree
Hide file tree
Showing 128 changed files with 164 additions and 141 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## 2.2.0 (unreleased)

### Improvements:
* Upgraded the minimum compiler version to v0.5.2: this removes many Solidity warnings that were false positives.
* Fixed variable shadowing issues.

### Bugfixes:

### Breaking changes:

## 2.1.1 (2019-04-01)
* Version bump to avoid conflict in the npm registry.

Expand Down
2 changes: 1 addition & 1 deletion contracts/access/Roles.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

/**
* @title Roles
Expand Down
2 changes: 1 addition & 1 deletion contracts/access/roles/CapperRole.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../Roles.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/access/roles/MinterRole.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../Roles.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/access/roles/PauserRole.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../Roles.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/access/roles/SignerRole.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../Roles.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/access/roles/WhitelistAdminRole.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../Roles.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/access/roles/WhitelistedRole.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../Roles.sol";
import "./WhitelistAdminRole.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/Crowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/IERC20.sol";
import "../math/SafeMath.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/distribution/FinalizableCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../../math/SafeMath.sol";
import "../validation/TimedCrowdsale.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../validation/TimedCrowdsale.sol";
import "../../math/SafeMath.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/distribution/RefundableCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../../math/SafeMath.sol";
import "./FinalizableCrowdsale.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "./RefundableCrowdsale.sol";
import "./PostDeliveryCrowdsale.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/emission/AllowanceCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../Crowdsale.sol";
import "../../token/ERC20/IERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/emission/MintedCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../Crowdsale.sol";
import "../../token/ERC20/ERC20Mintable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/price/IncreasingPriceCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../validation/TimedCrowdsale.sol";
import "../../math/SafeMath.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/validation/CappedCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/validation/PausableCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../Crowdsale.sol";
import "../../lifecycle/Pausable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/validation/TimedCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/validation/WhitelistCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;
import "../Crowdsale.sol";
import "../../access/roles/WhitelistedRole.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/cryptography/ECDSA.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

/**
* @title Elliptic curve signature operations
Expand Down
2 changes: 1 addition & 1 deletion contracts/cryptography/MerkleProof.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

/**
* @title MerkleProof
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

/**
* @title Counter
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides an incrementing uint256 id acquired by the `Counter#next` getter.
* Use this for issuing ERC721 ids or keeping track of request ids, anything you want, really.
*
* Include with `using Counter for Counter.Counter;`
* Include with `using Counters` for Counters.Counter;`
* @notice Does not allow an Id of 0, which is popularly used to signify a null state in solidity.
* Does not protect from overflows, but if you have 2^256 ids, you have other problems.
* (But actually, it's generally impossible to increment a counter this many times, energy wise
* so it's not something you have to worry about.)
*/
library Counter {
library Counters {
struct Counter {
uint256 current; // default: 0
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/drafts/ERC1046/TokenMetadata.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../../token/ERC20/IERC20.sol";

Expand Down
12 changes: 6 additions & 6 deletions contracts/drafts/ERC20Migrator.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/IERC20.sol";
import "../token/ERC20/ERC20Mintable.sol";
Expand Down Expand Up @@ -65,14 +65,14 @@ contract ERC20Migrator {
/**
* @dev Begins the migration by setting which is the new token that will be
* minted. This contract must be a minter for the new token.
* @param newToken the token that will be minted
* @param newToken_ the token that will be minted
*/
function beginMigration(ERC20Mintable newToken) public {
function beginMigration(ERC20Mintable newToken_) public {
require(address(_newToken) == address(0));
require(address(newToken) != address(0));
require(newToken.isMinter(address(this)));
require(address(newToken_) != address(0));
require(newToken_.isMinter(address(this)));

_newToken = newToken;
_newToken = newToken_;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/drafts/SignatureBouncer.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../access/roles/SignerRole.sol";
import "../cryptography/ECDSA.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/drafts/SignedSafeMath.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

/**
* @title SignedSafeMath
Expand Down
2 changes: 1 addition & 1 deletion contracts/drafts/TokenVesting.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/SafeERC20.sol";
import "../ownership/Ownable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/examples/SampleCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../crowdsale/validation/CappedCrowdsale.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/examples/SimpleToken.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Detailed.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/introspection/ERC165.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "./IERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/introspection/ERC165Checker.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

/**
* @title ERC165Checker
Expand Down
2 changes: 1 addition & 1 deletion contracts/introspection/IERC165.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

/**
* @title IERC165
Expand Down
2 changes: 1 addition & 1 deletion contracts/lifecycle/Pausable.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../access/roles/PauserRole.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/math/Math.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

/**
* @title Math
Expand Down
2 changes: 1 addition & 1 deletion contracts/math/SafeMath.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

/**
* @title SafeMath
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/Acknowledger.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

contract Acknowledger {
event AcknowledgeFoo(uint256 a);
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/AddressImpl.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../utils/Address.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/AllowanceCrowdsaleImpl.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/IERC20.sol";
import "../crowdsale/emission/AllowanceCrowdsale.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ArraysImpl.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../utils/Arrays.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/CappedCrowdsaleImpl.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/CappedCrowdsale.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/CapperRoleMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../access/roles/CapperRole.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ConditionalEscrowMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../payment/escrow/ConditionalEscrow.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../drafts/Counter.sol";
import "../drafts/Counters.sol";

contract CounterImpl {
using Counter for Counter.Counter;
contract CountersImpl {
using Counters for Counters.Counter;

uint256 public theId;

// use whatever key you want to track your counters
mapping(string => Counter.Counter) private _counters;
mapping(string => Counters.Counter) private _counters;

function doThing(string memory key) public returns (uint256) {
theId = _counters[key].next();
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/CrowdsaleMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../crowdsale/Crowdsale.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ECDSAMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../cryptography/ECDSA.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC165/ERC165InterfacesSupported.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../../introspection/IERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC165/ERC165NotSupported.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

contract ERC165NotSupported {
// solhint-disable-previous-line no-empty-blocks
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC165CheckerMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../introspection/ERC165Checker.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC165Mock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../introspection/ERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC20BurnableMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/ERC20Burnable.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC20DetailedMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Detailed.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC20MintableMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/ERC20Mintable.sol";
import "./MinterRoleMock.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC20Mock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/ERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC20PausableMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.5.2;

import "../token/ERC20/ERC20Pausable.sol";
import "./PauserRoleMock.sol";
Expand Down
Loading

0 comments on commit b7d60f2

Please sign in to comment.