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.
This commit is contained in:
Nicolás Venturo
2019-01-04 17:01:52 -03:00
committed by GitHub
parent 35d70397b6
commit 76abd1a41e
64 changed files with 787 additions and 919 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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);

View File

@ -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));

View File

@ -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;
}

View File

@ -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);
}
/**

View File

@ -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
}
}

View File

@ -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);
}
/**

View File

@ -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
}

View File

@ -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);
}