Fix Solidity linter errors

pull/1844/head
Nicolás Venturo 6 years ago committed by Santiago Palladino
parent 544a56fcc4
commit 8b3377efac
  1. 4
      contracts/drafts/meta-tx/GSNContext.sol
  2. 8
      contracts/drafts/meta-tx/GSNRecipient.sol
  3. 4
      contracts/drafts/meta-tx/GSNRecipientERC20BuiltInCharge.sol
  4. 8
      contracts/drafts/meta-tx/GSNRecipientSignedData.sol
  5. 8
      contracts/mocks/GSNContextMock.sol
  6. 4
      contracts/mocks/GSNRecipientSignedDataMock.sol

@ -42,12 +42,14 @@ contract GSNContext is Context {
// require bit shifting. We therefore subtract 12 from the read index so the address lands on the lower 20
// bytes. This can always be done due to the 32-byte prefix.
// The final memory read index is msg.data.length - 20 + 32 - 12 = msg.data.length
// The final memory read index is msg.data.length - 20 + 32 - 12 = msg.data.length. Using inline assembly is the
// easiest/most-efficient way to perform this operation.
// These fields are not accessible from assembly
bytes memory array = msg.data;
uint256 index = msg.data.length;
// solhint-disable-next-line no-inline-assembly
assembly {
// Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
result := and(mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff)

@ -8,14 +8,14 @@ import "./GSNContext.sol";
* GSN support. Derived contracts must implement all interface methods.
*/
contract GSNRecipient is IRelayRecipient, GSNContext {
uint256 constant private RelayedCallAccepted = 0;
uint256 constant private RelayedCallRejected = 11;
uint256 constant private RELAYED_CALL_ACCEPTED = 0;
uint256 constant private RELAYED_CALL_REJECTED = 11;
function _acceptRelayedCall() internal pure returns (uint256) {
return RelayedCallAccepted;
return RELAYED_CALL_ACCEPTED;
}
function _declineRelayedCall(uint256 errorCode) internal pure returns (uint256) {
return RelayedCallRejected + errorCode;
return RELAYED_CALL_REJECTED + errorCode;
}
}

@ -30,7 +30,9 @@ contract GSNRecipientERC20BuiltInCharge is GSNRecipientERC20Charge {
contract __unstable__ERC20PrimaryAdmin is ERC20, ERC20Detailed, Secondary {
uint256 private constant UINT256_MAX = 2**256 - 1;
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
}
// The primary account (GSNRecipientERC20BuiltInCharge) can mint tokens
function mint(address account, uint256 amount) public onlyPrimary {

@ -49,7 +49,11 @@ contract GSNRecipientSignedData is GSNRecipient {
}
}
function preRelayedCall(bytes calldata) external returns (bytes32) { }
function preRelayedCall(bytes calldata) external returns (bytes32) {
// solhint-disable-previous-line no-empty-blocks
}
function postRelayedCall(bytes calldata, bool, uint256, bytes32) external { }
function postRelayedCall(bytes calldata, bool, uint256, bytes32) external {
// solhint-disable-previous-line no-empty-blocks
}
}

@ -24,7 +24,11 @@ contract GSNContextMock is ContextMock, GSNContext, IRelayRecipient {
return (0, "");
}
function preRelayedCall(bytes calldata) external returns (bytes32) {}
function preRelayedCall(bytes calldata) external returns (bytes32) {
// solhint-disable-previous-line no-empty-blocks
}
function postRelayedCall(bytes calldata, bool, uint256, bytes32) external {}
function postRelayedCall(bytes calldata, bool, uint256, bytes32) external {
// solhint-disable-previous-line no-empty-blocks
}
}

@ -3,7 +3,9 @@ pragma solidity ^0.5.0;
import "../drafts/meta-tx/GSNRecipientSignedData.sol";
contract GSNRecipientSignedDataMock is GSNRecipientSignedData {
constructor(address trustedSigner) public GSNRecipientSignedData(trustedSigner) { }
constructor(address trustedSigner) public GSNRecipientSignedData(trustedSigner) {
// solhint-disable-previous-line no-empty-blocks
}
event MockFunctionCalled();

Loading…
Cancel
Save