Various fixes and formatting chores (#885)

* fix: clean up solium linting errors

* fix: make various contracts natspec compliant

* fix: this.balance deprecated; convert to address(this).balance

* fix: contract.call deprecated and switch to gasleft()

* fix: ignore empty block rule project-wide

* fix: add ignore cases for the rest of the linting warnings
This commit is contained in:
Matt Condon
2018-04-10 20:31:29 -03:00
committed by GitHub
parent a7e91856f3
commit 9e1c934ffd
26 changed files with 248 additions and 208 deletions

View File

@ -21,6 +21,7 @@ contract ERC223TokenMock is BasicToken {
{
transfer(_to, _value);
bool isContract = false;
// solium-disable-next-line security/no-inline-assembly
assembly {
isContract := not(iszero(extcodesize(_to)))
}

View File

@ -14,9 +14,21 @@ contract ERC721ReceiverMock is ERC721Receiver {
reverts = _reverts;
}
function onERC721Received(address _address, uint256 _tokenId, bytes _data) public returns(bytes4) {
function onERC721Received(
address _address,
uint256 _tokenId,
bytes _data
)
public
returns(bytes4)
{
require(!reverts);
emit Received(_address, _tokenId, _data, msg.gas);
emit Received(
_address,
_tokenId,
_data,
gasleft() // msg.gas was deprecated in solidityv0.4.21
);
return retval;
}
}

View File

@ -15,6 +15,7 @@ contract MessageHelper {
}
function call(address to, bytes data) public returns (bool) {
// solium-disable-next-line security/no-low-level-calls
if (to.call(data))
return true;
else

View File

@ -4,6 +4,7 @@ pragma solidity ^0.4.21;
contract ReentrancyAttack {
function callSender(bytes4 data) public {
// solium-disable-next-line security/no-low-level-calls
require(msg.sender.call(data));
}

View File

@ -27,7 +27,8 @@ contract ReentrancyMock is ReentrancyGuard {
bytes4 func = bytes4(keccak256("countThisRecursive(uint256)"));
if (n > 0) {
count();
bool result = this.call(func, n - 1);
// solium-disable-next-line security/no-low-level-calls
bool result = address(this).call(func, n - 1);
require(result == true);
}
}