Unverified Commit 76abd1a4 by Nicolás Venturo Committed by GitHub

Replaced Solium in favor of Solhint (#1575)

* Adding solhint, working on style fixes.

* Upgraded to solhint 1.5.0.

* Removed all references to Solium

* Updated mocks to make the pass the new linter rules.

* Reformatted the .solhint.json file a bit.

* Removed Solium configuration files.

* Remove Solium dependency.

* Add comment explaing disabled time rule in TokenVesting.

* Revert to the old (ugly?) style.

* Revert SignatureBouncerMock style.

* Fix ERC165InterfacesSupported interface.
parent 35d70397
{
"extends": "default",
"rules": {
"indent": ["error", 4],
"bracket-align": false,
"compiler-fixed": false,
"no-simple-event-func-name": false,
"two-lines-top-level-separator": false
}
}
{
"extends": "solium:all",
"plugins": ["security"],
"rules": {
"arg-overflow": "off",
"blank-lines": "off",
"error-reason": "off",
"indentation": ["error", 4],
"lbrace": "off",
"linebreak-style": ["error", "unix"],
"max-len": ["error", 120],
"no-constant": ["error"],
"no-empty-blocks": "off",
"quotes": ["error", "double"],
"uppercase": "off",
"visibility-first": "error",
"security/enforce-explicit-visibility": ["error"],
"security/no-block-members": ["warning"],
"security/no-inline-assembly": ["warning"]
}
}
......@@ -63,10 +63,6 @@ contract Crowdsale is ReentrancyGuard {
_token = token;
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
/**
* @dev fallback function ***DO NOT OVERRIDE***
* Note that other contracts will transfer fund with a base gas stipend
......@@ -130,12 +126,9 @@ contract Crowdsale is ReentrancyGuard {
_postValidatePurchase(beneficiary, weiAmount);
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations.
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met.
* Use `super` in contracts that inherit from Crowdsale to extend their validations.
* Example from CappedCrowdsale.sol's _preValidatePurchase method:
* super._preValidatePurchase(beneficiary, weiAmount);
* require(weiRaised().add(weiAmount) <= cap);
......@@ -148,16 +141,18 @@ contract Crowdsale is ReentrancyGuard {
}
/**
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met.
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid
* conditions are not met.
* @param beneficiary Address performing the token purchase
* @param weiAmount Value in wei involved in the purchase
*/
function _postValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
// optional override
// solhint-disable-previous-line no-empty-blocks
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends
* its tokens.
* @param beneficiary Address performing the token purchase
* @param tokenAmount Number of tokens to be emitted
*/
......@@ -166,7 +161,8 @@ contract Crowdsale is ReentrancyGuard {
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Doesn't necessarily emit/send tokens.
* @dev Executed when a purchase has been validated and is ready to be executed. Doesn't necessarily emit/send
* tokens.
* @param beneficiary Address receiving the tokens
* @param tokenAmount Number of tokens to be purchased
*/
......@@ -175,12 +171,13 @@ contract Crowdsale is ReentrancyGuard {
}
/**
* @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.)
* @dev Override for extensions that require an internal state to check for validity (current user contributions,
* etc.)
* @param beneficiary Address receiving the tokens
* @param weiAmount Value in wei involved in the purchase
*/
function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal {
// optional override
// solhint-disable-previous-line no-empty-blocks
}
/**
......
......@@ -45,5 +45,7 @@ contract FinalizableCrowdsale is TimedCrowdsale {
* should call super._finalization() to ensure the chain of finalization is
* executed entirely.
*/
function _finalization() internal {}
function _finalization() internal {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -59,7 +59,7 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
return 0;
}
// solium-disable-next-line security/no-block-members
// solhint-disable-next-line not-rely-on-time
uint256 elapsedTime = block.timestamp.sub(openingTime());
uint256 timeRange = closingTime().sub(openingTime());
uint256 rateRange = _initialRate.sub(_finalRate);
......
......@@ -8,9 +8,9 @@ import "../../lifecycle/Pausable.sol";
* @dev Extension of Crowdsale contract where purchases can be paused and unpaused by the pauser role.
*/
contract PausableCrowdsale is Crowdsale, Pausable {
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations.
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met.
* Use super to concatenate validations.
* Adds the validation that the crowdsale must not be paused.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
......
......@@ -27,7 +27,7 @@ contract TimedCrowdsale is Crowdsale {
* @param closingTime Crowdsale closing time
*/
constructor (uint256 openingTime, uint256 closingTime) public {
// solium-disable-next-line security/no-block-members
// solhint-disable-next-line not-rely-on-time
require(openingTime >= block.timestamp);
require(closingTime > openingTime);
......@@ -53,7 +53,7 @@ contract TimedCrowdsale is Crowdsale {
* @return true if the crowdsale is open, false otherwise.
*/
function isOpen() public view returns (bool) {
// solium-disable-next-line security/no-block-members
// solhint-disable-next-line not-rely-on-time
return block.timestamp >= _openingTime && block.timestamp <= _closingTime;
}
......@@ -62,7 +62,7 @@ contract TimedCrowdsale is Crowdsale {
* @return Whether crowdsale period has elapsed
*/
function hasClosed() public view returns (bool) {
// solium-disable-next-line security/no-block-members
// solhint-disable-next-line not-rely-on-time
return block.timestamp > _closingTime;
}
......
......@@ -26,7 +26,7 @@ library ECDSA {
// Divide the signature in r, s and v variables
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
// solium-disable-next-line security/no-inline-assembly
// solhint-disable-next-line no-inline-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
......@@ -42,7 +42,6 @@ library ECDSA {
if (v != 27 && v != 28) {
return (address(0));
} else {
// solium-disable-next-line arg-overflow
return ecrecover(hash, v, r, s);
}
}
......
......@@ -6,7 +6,6 @@ import "../../token/ERC20/IERC20.sol";
* @title ERC-1047 Token Metadata
* @dev See https://eips.ethereum.org/EIPS/eip-1046
* @dev tokenURI must respond with a URI that implements https://eips.ethereum.org/EIPS/eip-1047
* @dev TODO - update https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC721/IERC721.sol#L17 when 1046 is finalized
*/
contract ERC20TokenMetadata is IERC20 {
function tokenURI() external view returns (string memory);
......
......@@ -43,7 +43,9 @@ contract SignatureBouncer is SignerRole {
// Signature size is 65 bytes (tightly packed v + r + s), but gets padded to 96 bytes
uint256 private constant _SIGNATURE_SIZE = 96;
constructor () internal {}
constructor () internal {
// solhint-disable-previous-line no-empty-blocks
}
/**
* @dev requires that a valid signature of a signer was provided
......
/* solium-disable security/no-block-members */
pragma solidity ^0.5.0;
import "../token/ERC20/SafeERC20.sol";
......@@ -13,6 +11,12 @@ import "../math/SafeMath.sol";
* owner.
*/
contract TokenVesting is Ownable {
// The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is
// therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore,
// it is recommended to avoid using short time durations (less than a minute). Typical vesting schemes, with a cliff
// period of a year and a duration of four years, are safe to use.
// solhint-disable not-rely-on-time
using SafeMath for uint256;
using SafeERC20 for IERC20;
......@@ -22,6 +26,7 @@ contract TokenVesting is Ownable {
// beneficiary of tokens after they are released
address private _beneficiary;
// Durations and timestamps are expressed in UNIX time, the same units as block.timestamp.
uint256 private _cliff;
uint256 private _start;
uint256 private _duration;
......
......@@ -12,7 +12,9 @@ import "../token/ERC20/ERC20Detailed.sol";
* It is meant to be used in a crowdsale contract.
*/
contract SampleCrowdsaleToken is ERC20Mintable, ERC20Detailed {
constructor () public ERC20Detailed("Sample Crowdsale Token", "SCT", 18) {}
constructor () public ERC20Detailed("Sample Crowdsale Token", "SCT", 18) {
// solhint-disable-previous-line no-empty-blocks
}
}
/**
......@@ -28,11 +30,6 @@ contract SampleCrowdsaleToken is ERC20Mintable, ERC20Detailed {
* After adding multiple features it's good practice to run integration tests
* to ensure that subcontracts works together as intended.
*/
// XXX There doesn't seem to be a way to split this line that keeps solium
// happy. See:
// https://github.com/duaraghav8/Solium/issues/205
// --elopio - 2018-05-10
// solium-disable-next-line max-len
contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
constructor (
uint256 openingTime,
......
......@@ -8,7 +8,7 @@ import "./IERC165.sol";
* @dev Implements ERC165 using a lookup table.
*/
contract ERC165 is IERC165 {
bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(bytes4)'))
......@@ -24,7 +24,7 @@ contract ERC165 is IERC165 {
* implement ERC165 itself
*/
constructor () internal {
_registerInterface(_InterfaceId_ERC165);
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
......
......@@ -7,9 +7,9 @@ pragma solidity ^0.5.0;
*/
library ERC165Checker {
// As per the EIP-165 spec, no interface should ever match 0xffffffff
bytes4 private constant _InterfaceId_Invalid = 0xffffffff;
bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(bytes4)'))
......@@ -23,8 +23,8 @@ library ERC165Checker {
function _supportsERC165(address account) internal view returns (bool) {
// Any contract that implements ERC165 must explicitly indicate support of
// InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
return _supportsERC165Interface(account, _InterfaceId_ERC165) &&
!_supportsERC165Interface(account, _InterfaceId_Invalid);
return _supportsERC165Interface(account, _INTERFACE_ID_ERC165) &&
!_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
}
/**
......@@ -98,9 +98,9 @@ library ERC165Checker {
view
returns (bool success, bool result)
{
bytes memory encodedParams = abi.encodeWithSelector(_InterfaceId_ERC165,interfaceId);
bytes memory encodedParams = abi.encodeWithSelector(_INTERFACE_ID_ERC165, interfaceId);
// solium-disable-next-line security/no-inline-assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let encodedParams_data := add(0x20, encodedParams)
let encodedParams_size := mload(encodedParams)
......
......@@ -8,5 +8,7 @@ contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
public
Crowdsale(rate, wallet, token)
AllowanceCrowdsale(tokenWallet)
{}
{
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -8,5 +8,7 @@ contract CappedCrowdsaleImpl is CappedCrowdsale {
public
Crowdsale(rate, wallet, token)
CappedCrowdsale(cap)
{}
{
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -8,6 +8,7 @@ contract CapperRoleMock is CapperRole {
}
function onlyCapperMock() public view onlyCapper {
// solhint-disable-previous-line no-empty-blocks
}
// Causes a compilation error if super._removeCapper is not internal
......
......@@ -3,5 +3,7 @@ pragma solidity ^0.5.0;
import "../crowdsale/Crowdsale.sol";
contract CrowdsaleMock is Crowdsale {
constructor (uint256 rate, address payable wallet, IERC20 token) public Crowdsale(rate, wallet, token) {}
constructor (uint256 rate, address payable wallet, IERC20 token) public Crowdsale(rate, wallet, token) {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -4,5 +4,10 @@ import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Detailed.sol";
contract ERC20DetailedMock is ERC20, ERC20Detailed {
constructor (string memory name, string memory symbol, uint8 decimals) ERC20Detailed(name, symbol, decimals) public {}
constructor (string memory name, string memory symbol, uint8 decimals)
public
ERC20Detailed(name, symbol, decimals)
{
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -4,14 +4,15 @@ import "../../introspection/IERC165.sol";
/**
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-214.md#specification
* > Any attempts to make state-changing operations inside an execution instance with STATIC set to true will instead throw an exception.
* > Any attempts to make state-changing operations inside an execution instance with STATIC set to true will instead
* throw an exception.
* > These operations include [...], LOG0, LOG1, LOG2, [...]
*
* therefore, because this contract is staticcall'd we need to not emit events (which is how solidity-coverage works)
* solidity-coverage ignores the /mocks folder, so we duplicate its implementation here to avoid instrumenting it
*/
contract SupportsInterfaceWithLookupMock is IERC165 {
bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7;
bytes4 public constant INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(bytes4)'))
......@@ -27,7 +28,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
* implement ERC165 itself
*/
constructor () public {
_registerInterface(InterfaceId_ERC165);
_registerInterface(INTERFACE_ID_ERC165);
}
/**
......
pragma solidity ^0.5.0;
contract ERC165NotSupported {}
contract ERC165NotSupported {
// solhint-disable-previous-line no-empty-blocks
}
......@@ -4,4 +4,5 @@ import "../token/ERC20/ERC20Mintable.sol";
import "./MinterRoleMock.sol";
contract ERC20MintableMock is ERC20Mintable, MinterRoleMock {
// solhint-disable-previous-line no-empty-blocks
}
......@@ -4,5 +4,7 @@ import "../token/ERC20/ERC20.sol";
import "../drafts/ERC1046/TokenMetadata.sol";
contract ERC20WithMetadataMock is ERC20, ERC20WithMetadata {
constructor (string memory tokenURI) public ERC20WithMetadata(tokenURI) {}
constructor (string memory tokenURI) public ERC20WithMetadata(tokenURI) {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -11,7 +11,9 @@ import "../token/ERC721/ERC721Burnable.sol";
* checking token existence, removal of a token from an address
*/
contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor (string memory name, string memory symbol) public ERC721Mintable() ERC721Full(name, symbol) {}
constructor (string memory name, string memory symbol) public ERC721Mintable() ERC721Full(name, symbol) {
// solhint-disable-previous-line no-empty-blocks
}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
......
......@@ -9,5 +9,7 @@ import "../token/ERC721/ERC721Burnable.sol";
* @title ERC721MintableBurnableImpl
*/
contract ERC721MintableBurnableImpl is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor () ERC721Mintable() ERC721Full("Test", "TEST") public {}
constructor () public ERC721Mintable() ERC721Full("Test", "TEST") {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -13,7 +13,9 @@ contract ERC721ReceiverMock is IERC721Receiver {
_reverts = reverts;
}
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) public returns (bytes4) {
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public returns (bytes4)
{
require(!_reverts);
emit Received(operator, from, tokenId, data, gasleft());
return _retval;
......
......@@ -4,6 +4,7 @@ contract Failer {
uint256[] private array;
function dontFail() public pure {
// solhint-disable-previous-line no-empty-blocks
}
function failWithRevert() public pure {
......
......@@ -4,10 +4,11 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/distribution/FinalizableCrowdsale.sol";
contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address payable wallet, IERC20 token)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
{}
{
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -16,5 +16,7 @@ contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
Crowdsale(initialRate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
IncreasingPriceCrowdsale(initialRate, finalRate)
{}
{
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -5,6 +5,7 @@ import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol";
import "./CapperRoleMock.sol";
contract IndividuallyCappedCrowdsaleImpl is IndividuallyCappedCrowdsale, CapperRoleMock {
constructor (uint256 rate, address payable wallet, IERC20 token) public Crowdsale(rate, wallet, token)
{}
constructor (uint256 rate, address payable wallet, IERC20 token) public Crowdsale(rate, wallet, token) {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -4,5 +4,7 @@ import "../token/ERC20/ERC20Mintable.sol";
import "../crowdsale/emission/MintedCrowdsale.sol";
contract MintedCrowdsaleImpl is MintedCrowdsale {
constructor (uint256 rate, address payable wallet, ERC20Mintable token) public Crowdsale(rate, wallet, token) {}
constructor (uint256 rate, address payable wallet, ERC20Mintable token) public Crowdsale(rate, wallet, token) {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -8,6 +8,7 @@ contract MinterRoleMock is MinterRole {
}
function onlyMinterMock() public view onlyMinter {
// solhint-disable-previous-line no-empty-blocks
}
// Causes a compilation error if super._removeMinter is not internal
......
......@@ -2,4 +2,6 @@ pragma solidity ^0.5.0;
import "../ownership/Ownable.sol";
contract OwnableMock is Ownable {}
contract OwnableMock is Ownable {
// solhint-disable-previous-line no-empty-blocks
}
......@@ -5,5 +5,6 @@ import "../crowdsale/validation/PausableCrowdsale.sol";
contract PausableCrowdsaleImpl is PausableCrowdsale {
constructor (uint256 _rate, address payable _wallet, ERC20 _token) public Crowdsale(_rate, _wallet, _token) {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -8,6 +8,7 @@ contract PauserRoleMock is PauserRole {
}
function onlyPauserMock() public view onlyPauser {
// solhint-disable-previous-line no-empty-blocks
}
// Causes a compilation error if super._removePauser is not internal
......
......@@ -8,5 +8,7 @@ contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale {
public
TimedCrowdsale(openingTime, closingTime)
Crowdsale(rate, wallet, token)
{}
{
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -4,7 +4,9 @@ import "../payment/PullPayment.sol";
// mock class using PullPayment
contract PullPaymentMock is PullPayment {
constructor () public payable { }
constructor () public payable {
// solhint-disable-previous-line no-empty-blocks
}
// test helper function to call asyncTransfer
function callTransfer(address dest, uint256 amount) public {
......
pragma solidity ^0.5.0;
contract ReentrancyAttack {
function callSender(bytes4 data) public {
// solium-disable-next-line security/no-low-level-calls
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = msg.sender.call(abi.encodeWithSelector(data));
require(success);
}
}
......@@ -24,7 +24,7 @@ contract ReentrancyMock is ReentrancyGuard {
function countThisRecursive(uint256 n) public nonReentrant {
if (n > 0) {
count();
// solium-disable-next-line security/no-low-level-calls
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = address(this).call(abi.encodeWithSignature("countThisRecursive(uint256)", n - 1));
require(success);
}
......
......@@ -16,5 +16,7 @@ contract RefundableCrowdsaleImpl is RefundableCrowdsale {
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(goal)
{}
{
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -16,5 +16,7 @@ contract RefundablePostDeliveryCrowdsaleImpl is RefundablePostDeliveryCrowdsale
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(goal)
{}
{
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -58,8 +58,6 @@ contract SafeERC20Helper {
_succeeding = IERC20(address(new ERC20SucceedingMock()));
}
// Using _failing
function doFailingTransfer() public {
_failing.safeTransfer(address(0), 0);
}
......@@ -80,8 +78,6 @@ contract SafeERC20Helper {
_failing.safeDecreaseAllowance(address(0), 0);
}
// Using _succeeding
function doSucceedingTransfer() public {
_succeeding.safeTransfer(address(0), 0);
}
......
......@@ -3,5 +3,7 @@ pragma solidity ^0.5.0;
import "../ownership/Secondary.sol";
contract SecondaryMock is Secondary {
function onlyPrimaryMock() public view onlyPrimary {}
function onlyPrimaryMock() public view onlyPrimary {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -4,25 +4,47 @@ import "../drafts/SignatureBouncer.sol";
import "./SignerRoleMock.sol";
contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock {
function checkValidSignature(address account, bytes memory signature) public view returns (bool) {
function checkValidSignature(address account, bytes memory signature)
public view returns (bool)
{
return _isValidSignature(account, signature);
}
function onlyWithValidSignature(bytes memory signature) public onlyValidSignature(signature) view {}
function onlyWithValidSignature(bytes memory signature)
public onlyValidSignature(signature) view
{
// solhint-disable-previous-line no-empty-blocks
}
function checkValidSignatureAndMethod(address account, bytes memory signature) public view returns (bool) {
function checkValidSignatureAndMethod(address account, bytes memory signature)
public view returns (bool)
{
return _isValidSignatureAndMethod(account, signature);
}
function onlyWithValidSignatureAndMethod(bytes memory signature) public onlyValidSignatureAndMethod(signature) view {}
function onlyWithValidSignatureAndMethod(bytes memory signature)
public onlyValidSignatureAndMethod(signature) view
{
// solhint-disable-previous-line no-empty-blocks
}
function checkValidSignatureAndData(address account, bytes memory, uint, bytes memory signature) public view returns (bool) {
function checkValidSignatureAndData(address account, bytes memory, uint, bytes memory signature)
public view returns (bool)
{
return _isValidSignatureAndData(account, signature);
}
function onlyWithValidSignatureAndData(uint, bytes memory signature) public onlyValidSignatureAndData(signature) view {}
function onlyWithValidSignatureAndData(uint, bytes memory signature)
public onlyValidSignatureAndData(signature) view
{
// solhint-disable-previous-line no-empty-blocks
}
function theWrongMethod(bytes memory) public pure {}
function theWrongMethod(bytes memory) public pure {
// solhint-disable-previous-line no-empty-blocks
}
function tooShortMsgData() public onlyValidSignatureAndData("") view {}
function tooShortMsgData() public onlyValidSignatureAndData("") view {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -8,6 +8,7 @@ contract SignerRoleMock is SignerRole {
}
function onlySignerMock() public view onlySigner {
// solhint-disable-previous-line no-empty-blocks
}
// Causes a compilation error if super._removeSigner is not internal
......
......@@ -8,5 +8,7 @@ contract TimedCrowdsaleImpl is TimedCrowdsale {
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
{}
{
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -8,6 +8,7 @@ contract WhitelistAdminRoleMock is WhitelistAdminRole {
}
function onlyWhitelistAdminMock() public view onlyWhitelistAdmin {
// solhint-disable-previous-line no-empty-blocks
}
// Causes a compilation error if super._removeWhitelistAdmin is not internal
......
......@@ -6,5 +6,7 @@ import "../crowdsale/Crowdsale.sol";
contract WhitelistCrowdsaleImpl is Crowdsale, WhitelistCrowdsale {
constructor (uint256 _rate, address payable _wallet, IERC20 _token) Crowdsale(_rate, _wallet, _token) public {}
constructor (uint256 _rate, address payable _wallet, IERC20 _token) public Crowdsale(_rate, _wallet, _token) {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -4,5 +4,6 @@ import "../access/roles/WhitelistedRole.sol";
contract WhitelistedRoleMock is WhitelistedRole {
function onlyWhitelistedMock() public view onlyWhitelisted {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -83,9 +83,10 @@ contract RefundEscrow is ConditionalEscrow {
}
/**
* @dev Returns whether refundees can withdraw their deposits (be refunded).
* @dev Returns whether refundees can withdraw their deposits (be refunded). The overriden function receives a
* 'payee' argument, but we ignore it here since the condition is global, not per-payee.
*/
function withdrawalAllowed(address payee) public view returns (bool) {
function withdrawalAllowed(address) public view returns (bool) {
return _state == State.Refunding;
}
}
......@@ -8,7 +8,8 @@ import "../../math/SafeMath.sol";
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
......
......@@ -12,7 +12,7 @@ contract ERC20Pausable is ERC20, Pausable {
return super.transfer(to, value);
}
function transferFrom(address from,address to, uint256 value) public whenNotPaused returns (bool) {
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
......
......@@ -5,18 +5,18 @@ pragma solidity ^0.5.0;
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
......
......@@ -20,7 +20,7 @@ contract TokenTimelock {
uint256 private _releaseTime;
constructor (IERC20 token, address beneficiary, uint256 releaseTime) public {
// solium-disable-next-line security/no-block-members
// solhint-disable-next-line not-rely-on-time
require(releaseTime > block.timestamp);
_token = token;
_beneficiary = beneficiary;
......@@ -52,7 +52,7 @@ contract TokenTimelock {
* @notice Transfers tokens held by timelock to beneficiary.
*/
function release() public {
// solium-disable-next-line security/no-block-members
// solhint-disable-next-line not-rely-on-time
require(block.timestamp >= _releaseTime);
uint256 amount = _token.balanceOf(address(this));
......
......@@ -30,7 +30,7 @@ contract ERC721 is ERC165, IERC721 {
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) private _operatorApprovals;
bytes4 private constant _InterfaceId_ERC721 = 0x80ac58cd;
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
/*
* 0x80ac58cd ===
* bytes4(keccak256('balanceOf(address)')) ^
......@@ -46,7 +46,7 @@ contract ERC721 is ERC165, IERC721 {
constructor () public {
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_InterfaceId_ERC721);
_registerInterface(_INTERFACE_ID_ERC721);
}
/**
......@@ -147,7 +147,6 @@ contract ERC721 is ERC165, IERC721 {
* @param tokenId uint256 ID of the token to be transferred
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public {
// solium-disable-next-line arg-overflow
safeTransferFrom(from, to, tokenId, "");
}
......@@ -165,7 +164,6 @@ contract ERC721 is ERC165, IERC721 {
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public {
transferFrom(from, to, tokenId);
// solium-disable-next-line arg-overflow
require(_checkOnERC721Received(from, to, tokenId, _data));
}
......@@ -188,9 +186,6 @@ contract ERC721 is ERC165, IERC721 {
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
address owner = ownerOf(tokenId);
// Disable solium check because of
// https://github.com/duaraghav8/Solium/issues/175
// solium-disable-next-line operator-whitespace
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
......@@ -267,7 +262,9 @@ contract ERC721 is ERC165, IERC721 {
* @param _data bytes optional data to send along with the call
* @return whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) internal returns (bool) {
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
internal returns (bool)
{
if (!to.isContract()) {
return true;
}
......
......@@ -21,7 +21,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
bytes4 private constant _InterfaceId_ERC721Enumerable = 0x780e9d63;
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
/**
* 0x780e9d63 ===
* bytes4(keccak256('totalSupply()')) ^
......@@ -34,7 +34,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
*/
constructor () public {
// register the supported interface to conform to ERC721 via ERC165
_registerInterface(_InterfaceId_ERC721Enumerable);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
/**
......
......@@ -11,5 +11,7 @@ import "./ERC721Metadata.sol";
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
constructor (string memory name, string memory symbol) ERC721Metadata(name, symbol) public {}
constructor (string memory name, string memory symbol) public ERC721Metadata(name, symbol) {
// solhint-disable-previous-line no-empty-blocks
}
}
......@@ -14,7 +14,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURIs;
bytes4 private constant InterfaceId_ERC721Metadata = 0x5b5e139f;
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
/**
* 0x5b5e139f ===
* bytes4(keccak256('name()')) ^
......@@ -30,7 +30,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
_symbol = symbol;
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(InterfaceId_ERC721Metadata);
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
}
/**
......
......@@ -9,4 +9,5 @@ import "./IERC721Metadata.sol";
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract IERC721Full is IERC721, IERC721Enumerable, IERC721Metadata {
// solhint-disable-previous-line no-empty-blocks
}
......@@ -20,5 +20,6 @@ contract IERC721Receiver {
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) public returns (bytes4);
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public returns (bytes4);
}
......@@ -19,7 +19,7 @@ library Address {
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solium-disable-next-line security/no-inline-assembly
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -13,14 +13,13 @@
"console": "truffle console",
"coverage": "scripts/coverage.sh",
"lint": "npm run lint:js && npm run lint:sol",
"lint:fix": "npm run lint:js:fix && npm run lint:sol:fix",
"lint:fix": "npm run lint:js:fix",
"lint:js": "eslint .",
"lint:js:fix": "eslint . --fix",
"lint:sol": "solium -d .",
"lint:sol:fix": "solium -d . --fix",
"lint:sol": "solhint --max-warnings 0 \"contracts/**/*.sol\"",
"prepack": "npm run build",
"test": "npm run compile && scripts/test.sh",
"version": "scripts/version.js"
"version": "scripts/version.js",
"test": "npm run compile && scripts/test.sh"
},
"repository": {
"type": "git",
......@@ -55,8 +54,8 @@
"ethjs-abi": "^0.2.1",
"ganache-cli": "6.1.8",
"pify": "^4.0.1",
"solhint": "^1.5.0",
"solidity-coverage": "^0.5.4",
"solium": "^1.1.8",
"truffle": "^4.1.13",
"web3-utils": "^1.0.0-beta.34"
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment