aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/2.0.0/utils
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-07-07 00:51:23 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-07-07 01:58:28 +0800
commitd2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd (patch)
tree978dd0a5132eee644d2163a33e25a24fdd4a3f14 /packages/contracts/src/2.0.0/utils
parente796734659ddea76622d81b4416e0b36d5e7c0ed (diff)
downloaddexon-0x-contracts-d2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd.tar.gz
dexon-0x-contracts-d2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd.tar.zst
dexon-0x-contracts-d2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd.zip
Apply new linter rules
Diffstat (limited to 'packages/contracts/src/2.0.0/utils')
-rw-r--r--packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol25
-rw-r--r--packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol2
-rw-r--r--packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol2
-rw-r--r--packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol2
4 files changed, 22 insertions, 9 deletions
diff --git a/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol b/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol
index c2fff5efb..01d34fa8f 100644
--- a/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol
+++ b/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol
@@ -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)
@@ -157,13 +159,17 @@ library LibBytes {
}
}
}
-
+
/// @dev Returns a slices from a byte array.
/// @param b The byte array to take a slice from.
/// @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"
);
diff --git a/packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol b/packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol
index e77680903..36563d837 100644
--- a/packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol
+++ b/packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol
@@ -1,4 +1,4 @@
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
/*
diff --git a/packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol b/packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol
index 489793a95..81a14a447 100644
--- a/packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol
+++ b/packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol
@@ -1,4 +1,4 @@
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
/*
diff --git a/packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol b/packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol
index ec0a3fe76..8cbb8e526 100644
--- a/packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol
+++ b/packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol
@@ -1,4 +1,4 @@
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;