Apply new linter rules

This commit is contained in:
Amir Bandeali 2018-07-06 09:51:23 -07:00
parent e796734659
commit d2e422cd5e
74 changed files with 351 additions and 299 deletions

View File

@ -4,7 +4,7 @@
"avoid-low-level-calls": false,
"avoid-tx-origin": "warn",
"bracket-align": false,
"code-complexity": "false",
"code-complexity": false,
"const-name-snakecase": "error",
"expression-indent": "error",
"function-max-lines": false,

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "./MixinWethFees.sol";
@ -25,6 +25,7 @@ import "./MixinMarketBuyTokens.sol";
import "./MixinConstants.sol";
import "../utils/Ownable/Ownable.sol";
contract Forwarder is
Ownable,
MixinConstants,
@ -33,7 +34,7 @@ contract Forwarder is
MixinMarketBuyTokens,
MixinMarketSellTokens
{
uint256 MAX_UINT = 2**256 - 1;
uint256 constant internal MAX_UINT = 2**256 - 1;
constructor (
address _exchange,

View File

@ -16,19 +16,22 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../protocol/Exchange/Exchange.sol";
import { WETH9 as EtherToken } from "../tokens/WETH9/WETH9.sol";
import "../tokens/ERC20Token/IERC20Token.sol";
contract MixinConstants {
Exchange EXCHANGE;
EtherToken ETHER_TOKEN;
IERC20Token ZRX_TOKEN;
bytes ZRX_ASSET_DATA;
bytes WETH_ASSET_DATA;
// solhint-disable var-name-mixedcase
Exchange internal EXCHANGE;
EtherToken internal ETHER_TOKEN;
IERC20Token internal ZRX_TOKEN;
bytes internal ZRX_ASSET_DATA;
bytes internal WETH_ASSET_DATA;
// solhint-enable var-name-mixedcase
constructor (
address _exchange,

View File

@ -16,13 +16,13 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
contract MixinERC20 {
string constant ERROR_TRANSFER_FAILED = "TRANSFER_FAILED";
bytes4 constant ERC20_TRANSFER_SELECTOR = bytes4(keccak256("transfer(address,uint256)"));
bytes4 constant internal ERC20_TRANSFER_SELECTOR = bytes4(keccak256("transfer(address,uint256)"));
function transferToken(
address token,

View File

@ -16,17 +16,19 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../utils/LibBytes/LibBytes.sol";
import "../tokens/ERC721Token/IERC721Token.sol";
contract MixinERC721 {
using LibBytes for bytes;
bytes4 constant ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,uint256,bytes)"));
bytes4 constant ERC721_RECEIVED_OPERATOR = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
bytes4 constant internal ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,uint256,bytes)"));
bytes4 constant internal ERC721_RECEIVED_OPERATOR = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
function onERC721Received(address, uint256, bytes memory)
public

View File

@ -16,7 +16,9 @@
*/
pragma solidity ^0.4.24;
// solhint-disable
pragma solidity 0.4.24;
/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.
contract MixinErrorMessages {

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../utils/LibBytes/LibBytes.sol";
@ -25,74 +25,13 @@ import "../protocol/Exchange/libs/LibMath.sol";
import "../protocol/Exchange/libs/LibOrder.sol";
import "./MixinConstants.sol";
contract MixinExpectedResults is
LibMath,
LibFillResults,
MixinConstants
{
/// @dev Simulates the 0x Exchange fillOrder validation and calculations, without performing any state changes.
/// @param order An Order struct containing order specifications.
/// @param takerAssetFillAmount A number representing the amount of this order to fill.
/// @return fillResults Amounts filled and fees paid by maker and taker.
function calculateFillResults(
LibOrder.Order memory order,
uint256 takerAssetFillAmount
)
internal
view
returns (FillResults memory fillResults)
{
LibOrder.OrderInfo memory orderInfo = EXCHANGE.getOrderInfo(order);
if (orderInfo.orderStatus != uint8(LibOrder.OrderStatus.FILLABLE)) {
return fillResults;
}
uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderInfo.orderTakerAssetFilledAmount);
uint256 takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetAmount);
fillResults.takerAssetFilledAmount = takerAssetFilledAmount;
fillResults.makerAssetFilledAmount = getPartialAmount(
takerAssetFilledAmount,
order.takerAssetAmount,
order.makerAssetAmount
);
fillResults.makerFeePaid = getPartialAmount(
takerAssetFilledAmount,
order.takerAssetAmount,
order.makerFee
);
fillResults.takerFeePaid = getPartialAmount(
takerAssetFilledAmount,
order.takerAssetAmount,
order.takerFee
);
return fillResults;
}
/// @dev Calculates a FillResults total for selling takerAssetFillAmount over all orders.
/// Including the fees required to be paid.
/// @param orders An array of Order struct containing order specifications.
/// @param takerAssetFillAmount A number representing the amount of this order to fill.
/// @return totalFillResults Amounts filled and fees paid by maker and taker.
function calculateMarketSellResults(
LibOrder.Order[] memory orders,
uint256 takerAssetFillAmount
)
internal
view
returns (FillResults memory totalFillResults)
{
for (uint256 i = 0; i < orders.length; i++) {
uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
FillResults memory singleFillResult = calculateFillResults(orders[i], remainingTakerAssetFillAmount);
addFillResults(totalFillResults, singleFillResult);
if (totalFillResults.takerAssetFilledAmount == takerAssetFillAmount) {
break;
}
}
return totalFillResults;
}
/// @dev Calculates a total FillResults for buying makerAssetFillAmount over all orders.
/// Including the fees required to be paid.
/// @param orders An array of Order struct containing order specifications.
@ -155,4 +94,66 @@ contract MixinExpectedResults is
}
return totalFillResults;
}
/// @dev Simulates the 0x Exchange fillOrder validation and calculations, without performing any state changes.
/// @param order An Order struct containing order specifications.
/// @param takerAssetFillAmount A number representing the amount of this order to fill.
/// @return fillResults Amounts filled and fees paid by maker and taker.
function calculateFillResults(
LibOrder.Order memory order,
uint256 takerAssetFillAmount
)
internal
view
returns (FillResults memory fillResults)
{
LibOrder.OrderInfo memory orderInfo = EXCHANGE.getOrderInfo(order);
if (orderInfo.orderStatus != uint8(LibOrder.OrderStatus.FILLABLE)) {
return fillResults;
}
uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderInfo.orderTakerAssetFilledAmount);
uint256 takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetAmount);
fillResults.takerAssetFilledAmount = takerAssetFilledAmount;
fillResults.makerAssetFilledAmount = getPartialAmount(
takerAssetFilledAmount,
order.takerAssetAmount,
order.makerAssetAmount
);
fillResults.makerFeePaid = getPartialAmount(
takerAssetFilledAmount,
order.takerAssetAmount,
order.makerFee
);
fillResults.takerFeePaid = getPartialAmount(
takerAssetFilledAmount,
order.takerAssetAmount,
order.takerFee
);
return fillResults;
}
/// @dev Calculates a FillResults total for selling takerAssetFillAmount over all orders.
/// Including the fees required to be paid.
/// @param orders An array of Order struct containing order specifications.
/// @param takerAssetFillAmount A number representing the amount of this order to fill.
/// @return totalFillResults Amounts filled and fees paid by maker and taker.
function calculateMarketSellResults(
LibOrder.Order[] memory orders,
uint256 takerAssetFillAmount
)
internal
view
returns (FillResults memory totalFillResults)
{
for (uint256 i = 0; i < orders.length; i++) {
uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
FillResults memory singleFillResult = calculateFillResults(orders[i], remainingTakerAssetFillAmount);
addFillResults(totalFillResults, singleFillResult);
if (totalFillResults.takerAssetFilledAmount == takerAssetFillAmount) {
break;
}
}
return totalFillResults;
}
}

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../utils/LibBytes/LibBytes.sol";
@ -28,6 +28,7 @@ import "./MixinERC721.sol";
import "./MixinConstants.sol";
import "../protocol/Exchange/libs/LibOrder.sol";
contract MixinMarketBuyTokens is
MixinConstants,
MixinWethFees,
@ -62,8 +63,8 @@ contract MixinMarketBuyTokens is
uint16 feeProportion,
address feeRecipient
)
payable
public
payable
returns (FillResults memory totalFillResults)
{
uint256 takerEthAmount = msg.value;

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../protocol/Exchange/Exchange.sol";
@ -25,11 +25,13 @@ import "../protocol/Exchange/libs/LibOrder.sol";
import "../protocol/Exchange/libs/LibMath.sol";
import "./MixinConstants.sol";
contract MixinMarketBuyZrx is
LibMath,
LibFillResults,
MixinConstants
{
/// @dev Buys zrxBuyAmount of ZRX fee tokens, taking into account the fees on buying fee tokens. This will guarantee
/// At least zrxBuyAmount of ZRX fee tokens are purchased (sometimes slightly over due to rounding issues).
/// It is possible that a request to buy 200 ZRX fee tokens will require purchasing 202 ZRX tokens

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../protocol/Exchange/libs/LibOrder.sol";
@ -27,6 +27,7 @@ import "./MixinERC20.sol";
import "./MixinConstants.sol";
import "./MixinMarketBuyZrx.sol";
contract MixinMarketSellTokens is
MixinConstants,
MixinWethFees,
@ -55,8 +56,8 @@ contract MixinMarketSellTokens is
uint16 feeProportion,
address feeRecipient
)
payable
public
payable
returns (FillResults memory totalFillResults)
{
uint256 takerEthAmount = msg.value;

View File

@ -16,13 +16,14 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import { WETH9 as EtherToken } from "../tokens/WETH9/WETH9.sol";
import "../protocol/Exchange/libs/LibMath.sol";
import "./MixinConstants.sol";
contract MixinWethFees is
LibMath,
MixinConstants

View File

@ -1,6 +1,6 @@
// solhint-disable
pragma solidity ^0.4.10;
// solhint-disable
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>

View File

@ -16,11 +16,11 @@
*/
// solhint-disable
pragma solidity ^0.4.10;
import "./MultiSigWallet.sol";
// solhint-disable
/// @title Multisignature wallet with time lock- Allows multiple parties to execute a transaction after a time lock has passed.
/// @author Amir Bandeali - <amir@0xProject.com>

View File

@ -16,18 +16,20 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../utils/LibBytes/LibBytes.sol";
import "./MixinAuthorizable.sol";
contract ERC20Proxy is
MixinAuthorizable
{
// Id of this proxy.
bytes4 constant PROXY_ID = bytes4(keccak256("ERC20Token(address)"));
bytes4 constant internal PROXY_ID = bytes4(keccak256("ERC20Token(address)"));
// solhint-disable-next-line payable-fallback
function ()
external
{

View File

@ -16,18 +16,20 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../utils/LibBytes/LibBytes.sol";
import "./MixinAuthorizable.sol";
contract ERC721Proxy is
MixinAuthorizable
{
// Id of this proxy.
bytes4 constant PROXY_ID = bytes4(keccak256("ERC721Token(address,uint256,bytes)"));
bytes4 constant internal PROXY_ID = bytes4(keccak256("ERC721Token(address,uint256,bytes)"));
// solhint-disable-next-line payable-fallback
function ()
external
{

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../utils/Ownable/Ownable.sol";

View File

@ -16,7 +16,8 @@
*/
pragma solidity ^0.4.23;
// solhint-disable
pragma solidity 0.4.24;
// @dev Interface of the asset proxy's assetData.
@ -24,12 +25,10 @@ pragma solidity ^0.4.23;
// This argument is ABI encoded as one of the methods of this interface.
interface IAssetData {
// solhint-disable-next-line func-name-mixedcase
function ERC20Token(address tokenContract)
external
pure;
// solhint-disable-next-line func-name-mixedcase
function ERC721Token(
address tokenContract,
uint256 tokenId,

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "./IAuthorizable.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../../utils/Ownable/IOwnable.sol";
@ -26,13 +26,6 @@ contract IAuthorizable is
IOwnable
{
/// @dev Gets all authorized addresses.
/// @return Array of authorized addresses.
function getAuthorizedAddresses()
external
view
returns (address[]);
/// @dev Authorizes an address.
/// @param target Address to authorize.
function addAuthorizedAddress(address target)
@ -51,4 +44,11 @@ contract IAuthorizable is
uint256 index
)
external;
/// @dev Gets all authorized addresses.
/// @return Array of authorized addresses.
function getAuthorizedAddresses()
external
view
returns (address[] memory);
}

View File

@ -16,7 +16,8 @@
*/
pragma solidity ^0.4.24;
// solhint-disable
pragma solidity 0.4.24;
/// @dev This contract documents the revert reasons used in the AssetProxy contracts.

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../interfaces/IAuthorizable.sol";

View File

@ -33,7 +33,7 @@ contract AssetProxyOwner is
// if this contract is allowed to call the AssetProxy's `removeAuthorizedAddressAtIndex` method without a time lock.
mapping (address => bool) public isAssetProxyRegistered;
bytes4 constant REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR = bytes4(keccak256("removeAuthorizedAddressAtIndex(address,uint256)"));
bytes4 constant internal REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR = bytes4(keccak256("removeAuthorizedAddressAtIndex(address,uint256)"));
/// @dev Function will revert if the transaction does not call `removeAuthorizedAddressAtIndex`
/// on an approved AssetProxy contract.
@ -89,6 +89,7 @@ contract AssetProxyOwner is
{
Transaction storage tx = transactions[transactionId];
tx.executed = true;
// solhint-disable-next-line avoid-call-value
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "./libs/LibConstants.sol";
@ -28,6 +28,7 @@ import "./MixinTransactions.sol";
import "./MixinMatchOrders.sol";
// solhint-disable no-empty-blocks
contract Exchange is
MixinExchangeCore,
MixinMatchOrders,

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../../utils/Ownable/Ownable.sol";
import "../../utils/LibBytes/LibBytes.sol";
@ -151,6 +151,7 @@ contract MixinAssetProxyDispatcher is
/////// Setup Data Area ///////
// This area holds `assetData`.
let dataArea := add(cdStart, 132)
// solhint-disable-next-line no-empty-blocks
for {} lt(dataArea, cdEnd) {} {
mstore(dataArea, mload(assetData))
dataArea := add(dataArea, 32)

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "./libs/LibConstants.sol";
@ -49,8 +49,6 @@ contract MixinExchangeCore is
// Orders with specified senderAddress and with a salt less than their epoch to are considered cancelled
mapping (address => mapping (address => uint256)) public orderEpoch;
////// Core exchange functions //////
/// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch
/// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).
/// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
@ -175,6 +173,7 @@ contract MixinExchangeCore is
}
// Validate order expiration
// solhint-disable-next-line not-rely-on-time
if (block.timestamp >= order.expirationTimeSeconds) {
orderInfo.orderStatus = uint8(OrderStatus.EXPIRED);
return orderInfo;

View File

@ -11,7 +11,7 @@
limitations under the License.
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "./libs/LibConstants.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../../utils/LibBytes/LibBytes.sol";
import "./mixins/MSignatureValidator.sol";

View File

@ -15,7 +15,7 @@
limitations under the License.
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "./libs/LibExchangeErrors.sol";
import "./mixins/MSignatureValidator.sol";
@ -37,7 +37,7 @@ contract MixinTransactions is
address public currentContextAddress;
// Hash for the EIP712 ZeroEx Transaction Schema
bytes32 constant EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked(
bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked(
"ZeroExTransaction(",
"uint256 salt,",
"address signerAddress,",
@ -45,41 +45,6 @@ contract MixinTransactions is
")"
));
/// @dev Calculates EIP712 hash of the Transaction.
/// @param salt Arbitrary number to ensure uniqueness of transaction hash.
/// @param signerAddress Address of transaction signer.
/// @param data AbiV2 encoded calldata.
/// @return EIP712 hash of the Transaction.
function hashZeroExTransaction(
uint256 salt,
address signerAddress,
bytes memory data
)
internal
pure
returns (bytes32 result)
{
bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH;
bytes32 dataHash = keccak256(data);
// Assembly for more efficiently computing:
// keccak256(abi.encode(
// EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH,
// salt,
// signerAddress,
// keccak256(data)
// ));
assembly {
let memPtr := mload(64)
mstore(memPtr, schemaHash)
mstore(add(memPtr, 32), salt)
mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(memPtr, 96), dataHash)
result := keccak256(memPtr, 128)
}
return result;
}
/// @dev Executes an exchange method call in the context of signer.
/// @param salt Arbitrary number to ensure uniqueness of transaction hash.
/// @param signerAddress Address of transaction signer.
@ -139,6 +104,41 @@ contract MixinTransactions is
currentContextAddress = address(0);
}
/// @dev Calculates EIP712 hash of the Transaction.
/// @param salt Arbitrary number to ensure uniqueness of transaction hash.
/// @param signerAddress Address of transaction signer.
/// @param data AbiV2 encoded calldata.
/// @return EIP712 hash of the Transaction.
function hashZeroExTransaction(
uint256 salt,
address signerAddress,
bytes memory data
)
internal
pure
returns (bytes32 result)
{
bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH;
bytes32 dataHash = keccak256(data);
// Assembly for more efficiently computing:
// keccak256(abi.encode(
// EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH,
// salt,
// signerAddress,
// keccak256(data)
// ));
assembly {
let memPtr := mload(64)
mstore(memPtr, schemaHash)
mstore(add(memPtr, 32), salt)
mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(memPtr, 96), dataHash)
result := keccak256(memPtr, 128)
}
return result;
}
/// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).
/// If calling a fill function, this address will represent the taker.
/// If calling a cancel function, this address will represent the maker.

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "./libs/LibMath.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
contract IAssetProxyDispatcher {

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "./IExchangeCore.sol";
@ -27,6 +27,7 @@ import "./IAssetProxyDispatcher.sol";
import "./IWrapperFunctions.sol";
// solhint-disable no-empty-blocks
contract IExchange is
IExchangeCore,
IMatchOrders,

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../libs/LibOrder.sol";

View File

@ -15,7 +15,7 @@
limitations under the License.
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../libs/LibOrder.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
contract ISignatureValidator {

View File

@ -15,7 +15,7 @@
limitations under the License.
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
contract ITransactions {

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.23;
pragma solidity 0.4.24;
contract IValidator {

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
contract IWallet {

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../libs/LibOrder.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
contract LibConstants {

View File

@ -16,18 +16,18 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
contract LibEIP712 {
// EIP191 header for EIP712 prefix
string constant EIP191_HEADER = "\x19\x01";
string constant internal EIP191_HEADER = "\x19\x01";
// EIP712 Domain Name value
string constant EIP712_DOMAIN_NAME = "0x Protocol";
string constant internal EIP712_DOMAIN_NAME = "0x Protocol";
// EIP712 Domain Version value
string constant EIP712_DOMAIN_VERSION = "2";
string constant internal EIP712_DOMAIN_VERSION = "2";
// Hash of the EIP712 Domain Separator Schema
bytes32 public constant EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(

View File

@ -16,7 +16,8 @@
*/
pragma solidity ^0.4.24;
// solhint-disable
pragma solidity 0.4.24;
/// @dev This contract documents the revert reasons used in the Exchange contract.

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../../../utils/SafeMath/SafeMath.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../../../utils/SafeMath/SafeMath.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "./LibEIP712.sol";
@ -26,7 +26,7 @@ contract LibOrder is
{
// Hash for the EIP712 Order Schema
bytes32 constant EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(
bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(
"Order(",
"address makerAddress,",
"address takerAddress,",
@ -55,6 +55,7 @@ contract LibOrder is
CANCELLED // Order has been cancelled
}
// solhint-disable max-line-length
struct Order {
address makerAddress; // Address that created the order.
address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order.
@ -69,6 +70,7 @@ contract LibOrder is
bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.
bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.
}
// solhint-enable max-line-length
struct OrderInfo {
uint8 orderStatus; // Status that describes order's validity and fillability.

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../interfaces/IAssetProxyDispatcher.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../libs/LibOrder.sol";
@ -102,7 +102,6 @@ contract MExchangeCore is
internal
view;
/// @dev Validates context for cancelOrder. Succeeds or throws.
/// @param order to be cancelled.
/// @param orderInfo OrderStatus, orderHash, and amount already filled of order.

View File

@ -15,7 +15,7 @@
limitations under the License.
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../libs/LibOrder.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../interfaces/ISignatureValidator.sol";

View File

@ -15,7 +15,7 @@
limitations under the License.
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../interfaces/ITransactions.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../Mintable/Mintable.sol";

View File

@ -23,7 +23,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../../tokens/ERC721Token/IERC721Receiver.sol";

View File

@ -16,13 +16,14 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../tokens/ERC721Token/ERC721Token.sol";
import "../../utils/Ownable/Ownable.sol";
// solhint-disable no-empty-blocks
contract DummyERC721Token is
Ownable,
ERC721Token

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/interfaces/IExchange.sol";
@ -27,7 +27,7 @@ contract ExchangeWrapper {
// Exchange contract.
// solhint-disable-next-line var-name-mixedcase
IExchange EXCHANGE;
IExchange internal EXCHANGE;
constructor (address _exchange)
public
@ -35,6 +35,35 @@ contract ExchangeWrapper {
EXCHANGE = IExchange(_exchange);
}
/// @dev Cancels all orders created by sender with a salt less than or equal to the targetOrderEpoch
/// and senderAddress equal to this contract.
/// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
/// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.
/// @param makerSignature Proof that maker wishes to call this function with given params.
function cancelOrdersUpTo(
uint256 targetOrderEpoch,
uint256 salt,
bytes makerSignature
)
external
{
address makerAddress = msg.sender;
// Encode arguments into byte array.
bytes memory data = abi.encodeWithSelector(
EXCHANGE.cancelOrdersUpTo.selector,
targetOrderEpoch
);
// Call `cancelOrdersUpTo` via `executeTransaction`.
EXCHANGE.executeTransaction(
salt,
makerAddress,
data,
makerSignature
);
}
/// @dev Fills an order using `msg.sender` as the taker.
/// @param order Order struct containing order specifications.
/// @param takerAssetFillAmount Desired amount of takerAsset to sell.
@ -68,33 +97,4 @@ contract ExchangeWrapper {
takerSignature
);
}
/// @dev Cancels all orders created by sender with a salt less than or equal to the targetOrderEpoch
/// and senderAddress equal to this contract.
/// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
/// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.
/// @param makerSignature Proof that maker wishes to call this function with given params.
function cancelOrdersUpTo(
uint256 targetOrderEpoch,
uint256 salt,
bytes makerSignature
)
external
{
address makerAddress = msg.sender;
// Encode arguments into byte array.
bytes memory data = abi.encodeWithSelector(
EXCHANGE.cancelOrdersUpTo.selector,
targetOrderEpoch
);
// Call `cancelOrdersUpTo` via `executeTransaction`.
EXCHANGE.executeTransaction(
salt,
makerAddress,
data,
makerSignature
);
}
}

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/MixinAssetProxyDispatcher.sol";

View File

@ -16,14 +16,16 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../../protocol/AssetProxyOwner/AssetProxyOwner.sol";
// solhint-disable no-empty-blocks
contract TestAssetProxyOwner is
AssetProxyOwner
{
constructor(
address[] memory _owners,
address[] memory _assetProxyContracts,
@ -32,11 +34,11 @@ contract TestAssetProxyOwner is
)
public
AssetProxyOwner(_owners, _assetProxyContracts, _required, _secondsTimeLocked)
{
}
{}
function testValidRemoveAuthorizedAddressAtIndexTx(uint256 id)
public
view
validRemoveAuthorizedAddressAtIndexTx(id)
returns (bool)
{

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../utils/LibBytes/LibBytes.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/libs/LibMath.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/MixinSignatureValidator.sol";

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../../protocol/Exchange/interfaces/IValidator.sol";
@ -27,7 +27,7 @@ contract TestValidator is
// The single valid signer for this wallet.
// solhint-disable-next-line var-name-mixedcase
address VALID_SIGNER;
address internal VALID_SIGNER;
/// @dev constructs a new `TestValidator` with a single valid signer.
/// @param validSigner The sole, valid signer.
@ -40,6 +40,7 @@ contract TestValidator is
/// @param signerAddress Address that should have signed the given hash.
/// @param signature Proof of signing.
/// @return Validity of signature.
// solhint-disable no-unused-vars
function isValidSignature(
bytes32 hash,
address signerAddress,
@ -51,4 +52,5 @@ contract TestValidator is
{
return (signerAddress == VALID_SIGNER);
}
// solhint-enable no-unused-vars
}

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "../../protocol/Exchange/interfaces/IWallet.sol";
import "../../utils/LibBytes/LibBytes.sol";
@ -27,11 +27,9 @@ contract TestWallet is
{
using LibBytes for bytes;
string constant LENGTH_65_REQUIRED = "LENGTH_65_REQUIRED";
// The owner of this wallet.
// solhint-disable-next-line var-name-mixedcase
address WALLET_OWNER;
address internal WALLET_OWNER;
/// @dev constructs a new `TestWallet` with a single owner.
/// @param walletOwner The owner of this wallet.
@ -54,7 +52,7 @@ contract TestWallet is
{
require(
eip712Signature.length == 65,
LENGTH_65_REQUIRED
"LENGTH_65_REQUIRED"
);
uint8 v = uint8(eip712Signature[0]);

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/interfaces/IExchange.sol";
@ -27,28 +27,22 @@ import "../../utils/Ownable/Ownable.sol";
contract Whitelist is
Ownable
{
// Revert reasons
string constant MAKER_NOT_WHITELISTED = "MAKER_NOT_WHITELISTED"; // Maker address not whitelisted.
string constant TAKER_NOT_WHITELISTED = "TAKER_NOT_WHITELISTED"; // Taker address not whitelisted.
string constant INVALID_SENDER = "INVALID_SENDER"; // Sender must equal transaction origin.
// Mapping of address => whitelist status.
mapping (address => bool) public isWhitelisted;
// Exchange contract.
// solhint-disable-next-line var-name-mixedcase
IExchange EXCHANGE;
// solhint-disable var-name-mixedcase
IExchange internal EXCHANGE;
bytes internal TX_ORIGIN_SIGNATURE;
// solhint-enable var-name-mixedcase
byte constant VALIDATOR_SIGNATURE_BYTE = "\x06";
// solhint-disable-next-line var-name-mixedcase
bytes TX_ORIGIN_SIGNATURE;
byte constant internal VALIDATOR_SIGNATURE_BYTE = "\x06";
constructor (address _exchange)
public
{
// solhint-disable-next-line var-name-mixedcase
EXCHANGE = IExchange(_exchange);
// solhint-disable-next-line var-name-mixedcase
TX_ORIGIN_SIGNATURE = abi.encodePacked(address(this), VALIDATOR_SIGNATURE_BYTE);
}
@ -65,6 +59,27 @@ contract Whitelist is
isWhitelisted[target] = isApproved;
}
/// @dev Verifies signer is same as signer of current Ethereum transaction.
/// NOTE: This function can currently be used to validate signatures coming from outside of this contract.
/// Extra safety checks can be added for a production contract.
/// @param signerAddress Address that should have signed the given hash.
/// @param signature Proof of signing.
/// @return Validity of order signature.
// solhint-disable no-unused-vars
function isValidSignature(
bytes32 hash,
address signerAddress,
bytes signature
)
external
view
returns (bool isValid)
{
// solhint-disable-next-line avoid-tx-origin
return signerAddress == tx.origin;
}
// solhint-enable no-unused-vars
/// @dev Fills an order using `msg.sender` as the taker.
/// The transaction will revert if both the maker and taker are not whitelisted.
/// Orders should specify this contract as the `senderAddress` in order to gaurantee
@ -85,20 +100,21 @@ contract Whitelist is
// This contract must be the entry point for the transaction.
require(
// solhint-disable-next-line avoid-tx-origin
takerAddress == tx.origin,
INVALID_SENDER
"INVALID_SENDER"
);
// Check if maker is on the whitelist.
require(
isWhitelisted[order.makerAddress],
MAKER_NOT_WHITELISTED
"MAKER_NOT_WHITELISTED"
);
// Check if taker is on the whitelist.
require(
isWhitelisted[takerAddress],
TAKER_NOT_WHITELISTED
"TAKER_NOT_WHITELISTED"
);
// Encode arguments into byte array.
@ -117,22 +133,4 @@ contract Whitelist is
TX_ORIGIN_SIGNATURE
);
}
/// @dev Verifies signer is same as signer of current Ethereum transaction.
/// NOTE: This function can currently be used to validate signatures coming from outside of this contract.
/// Extra safety checks can be added for a production contract.
/// @param signerAddress Address that should have signed the given hash.
/// @param signature Proof of signing.
/// @return Validity of order signature.
function isValidSignature(
bytes32 hash,
address signerAddress,
bytes signature
)
external
view
returns (bool isValid)
{
return signerAddress == tx.origin;
}
}

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "./IERC20Token.sol";
@ -24,12 +24,8 @@ import "./IERC20Token.sol";
contract ERC20Token is IERC20Token {
string constant INSUFFICIENT_BALANCE = "ERC20_INSUFFICIENT_BALANCE";
string constant INSUFFICIENT_ALLOWANCE = "ERC20_INSUFFICIENT_ALLOWANCE";
string constant OVERFLOW = "Transfer would result in an overflow.";
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 public totalSupply;
@ -39,11 +35,11 @@ contract ERC20Token is IERC20Token {
{
require(
balances[msg.sender] >= _value,
INSUFFICIENT_BALANCE
"ERC20_INSUFFICIENT_BALANCE"
);
require(
balances[_to] + _value >= balances[_to],
OVERFLOW
"OVERFLOW"
);
balances[msg.sender] -= _value;
balances[_to] += _value;
@ -57,15 +53,15 @@ contract ERC20Token is IERC20Token {
{
require(
balances[_from] >= _value,
INSUFFICIENT_BALANCE
"ERC20_INSUFFICIENT_BALANCE"
);
require(
allowed[_from][msg.sender] >= _value,
INSUFFICIENT_ALLOWANCE
"ERC20_INSUFFICIENT_ALLOWANCE"
);
require(
balances[_to] + _value >= balances[_to],
OVERFLOW
"OVERFLOW"
);
balances[_to] += _value;
balances[_from] -= _value;
@ -84,7 +80,8 @@ contract ERC20Token is IERC20Token {
}
function balanceOf(address _owner)
public view
public
view
returns (uint256)
{
return balances[_owner];

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
@ -60,6 +60,7 @@ contract IERC20Token {
public view
returns (uint256);
// solhint-disable-next-line no-simple-event-func-name
event Transfer(
address indexed _from,
address indexed _to,

View File

@ -23,7 +23,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
import "./IERC721Token.sol";
import "./IERC721Receiver.sol";
@ -41,7 +41,7 @@ contract ERC721Token is
{
// Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`
// which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;
bytes4 constant internal ERC721_RECEIVED = 0xf0b9e5ba;
// Mapping from token ID to owner
mapping (uint256 => address) internal tokenOwner;
@ -73,7 +73,7 @@ contract ERC721Token is
_;
}
function ERC721Token(
constructor (
string _name,
string _symbol)
public

View File

@ -23,7 +23,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
/**
@ -38,7 +38,7 @@ contract IERC721Receiver {
* Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`,
* which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
*/
bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;
bytes4 constant internal ERC721_RECEIVED = 0xf0b9e5ba;
/**
* @notice Handle the receipt of an NFT

View File

@ -23,7 +23,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
/**
@ -40,11 +40,13 @@ contract IERC721Token {
address indexed _to,
uint256 _tokenId
);
event Approval(
address indexed _owner,
address indexed _approved,
uint256 _tokenId
);
event ApprovalForAll(
address indexed _owner,
address indexed _operator,
@ -55,6 +57,7 @@ contract IERC721Token {
public
view
returns (string);
function symbol()
public
view
@ -64,10 +67,12 @@ contract IERC721Token {
public
view
returns (uint256 _balance);
function ownerOf(uint256 _tokenId)
public
view
returns (address _owner);
function exists(uint256 _tokenId)
public
view
@ -75,6 +80,7 @@ contract IERC721Token {
function approve(address _to, uint256 _tokenId)
public;
function getApproved(uint256 _tokenId)
public
view
@ -82,6 +88,7 @@ contract IERC721Token {
function setApprovalForAll(address _operator, bool _approved)
public;
function isApprovedForAll(address _owner, address _operator)
public
view
@ -90,17 +97,22 @@ contract IERC721Token {
function transferFrom(
address _from,
address _to,
uint256 _tokenId)
uint256 _tokenId
)
public;
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId)
uint256 _tokenId
)
public;
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes _data)
bytes _data
)
public;
}

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../ERC20Token/ERC20Token.sol";
@ -24,7 +24,7 @@ import "../ERC20Token/ERC20Token.sol";
contract UnlimitedAllowanceToken is ERC20Token {
uint256 constant MAX_UINT = 2**256 - 1;
uint256 constant internal MAX_UINT = 2**256 - 1;
/// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717
/// @param _from Address to transfer from.
@ -38,15 +38,15 @@ contract UnlimitedAllowanceToken is ERC20Token {
uint256 allowance = allowed[_from][msg.sender];
require(
balances[_from] >= _value,
INSUFFICIENT_BALANCE
"ERC20_INSUFFICIENT_BALANCE"
);
require(
allowance >= _value,
INSUFFICIENT_ALLOWANCE
"ERC20_INSUFFICIENT_ALLOWANCE"
);
require(
balances[_to] + _value >= balances[_to],
OVERFLOW
"OVERFLOW"
);
balances[_to] += _value;
balances[_from] -= _value;

View File

@ -13,6 +13,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// solhint-disable
pragma solidity ^0.4.18;

View File

@ -16,20 +16,24 @@
*/
pragma solidity ^0.4.11;
pragma solidity 0.4.11;
// solhint-disable-next-line max-line-length
import { UnlimitedAllowanceToken_v1 as UnlimitedAllowanceToken } from "../../../1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol";
contract ZRXToken is UnlimitedAllowanceToken {
// solhint-disable const-name-snakecase
uint8 constant public decimals = 18;
uint public totalSupply = 10**27; // 1 billion tokens, 18 decimal places
string constant public name = "0x Protocol Token";
string constant public symbol = "ZRX";
// solhint-enableconst-name-snakecase
function ZRXToken() {
function ZRXToken()
public
{
balances[msg.sender] = totalSupply;
}
}

View File

@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
library LibBytes {
@ -115,6 +115,7 @@ library LibBytes {
// Copy whole words front to back
// Note: the first check is always true,
// this could have been a do-while loop.
// solhint-disable-next-line no-empty-blocks
for {} lt(source, sEnd) {} {
mstore(dest, mload(source))
source := add(source, 32)
@ -145,6 +146,7 @@ library LibBytes {
// 2**255, so they can be safely re-interpreted as signed.
// Note: the first check is always true,
// this could have been a do-while loop.
// solhint-disable-next-line no-empty-blocks
for {} slt(dest, dEnd) {} {
mstore(dEnd, mload(sEnd))
sEnd := sub(sEnd, 32)
@ -163,7 +165,11 @@ library LibBytes {
/// @param from The starting index for the slice (inclusive).
/// @param to The final index for the slice (exclusive).
/// @return result The slice containing bytes at indices [from, to)
function slice(bytes memory b, uint256 from, uint256 to)
function slice(
bytes memory b,
uint256 from,
uint256 to
)
internal
pure
returns (bytes memory result)
@ -192,7 +198,11 @@ library LibBytes {
/// @param to The final index for the slice (exclusive).
/// @return result The slice containing bytes at indices [from, to)
/// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.
function sliceDestructive(bytes memory b, uint256 from, uint256 to)
function sliceDestructive(
bytes memory b,
uint256 from,
uint256 to
)
internal
pure
returns (bytes memory result)
@ -344,7 +354,10 @@ library LibBytes {
// 1. Add index to address of bytes array
// 2. Load 32-byte word from memory
// 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address
let neighbors := and(mload(add(b, index)), 0xffffffffffffffffffffffff0000000000000000000000000000000000000000)
let neighbors := and(
mload(add(b, index)),
0xffffffffffffffffffffffff0000000000000000000000000000000000000000
)
// Make sure input address is clean.
// (Solidity does not guarantee this)
@ -509,7 +522,7 @@ library LibBytes {
// Assert length of <b> is valid, given
// length of input
require(
b.length >= index + 32 /* 32 bytes to store length */ + input.length,
b.length >= index + 32 + input.length, // 32 bytes to store length
"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED"
);

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
/*

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
/*

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;