aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-06-11 07:09:07 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-06-13 02:45:02 +0800
commit764b1c35cb7bf763deeb5db34ebe36d6e973b409 (patch)
tree62c5aa72c3ca48c9ae6e4df15204c9e9c031cb32 /packages/contracts/src
parentee8c9b764d0ee153efa91075b35f3192b72be119 (diff)
downloaddexon-0x-contracts-764b1c35cb7bf763deeb5db34ebe36d6e973b409.tar.gz
dexon-0x-contracts-764b1c35cb7bf763deeb5db34ebe36d6e973b409.tar.zst
dexon-0x-contracts-764b1c35cb7bf763deeb5db34ebe36d6e973b409.zip
Add tests for deepCopyBytes and missing write methods from LibBytes
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/contracts/current/test/TestLibBytes/TestLibBytes.sol15
-rw-r--r--packages/contracts/src/utils/constants.ts1
2 files changed, 16 insertions, 0 deletions
diff --git a/packages/contracts/src/contracts/current/test/TestLibBytes/TestLibBytes.sol b/packages/contracts/src/contracts/current/test/TestLibBytes/TestLibBytes.sol
index 22c84504c..abce0cb22 100644
--- a/packages/contracts/src/contracts/current/test/TestLibBytes/TestLibBytes.sol
+++ b/packages/contracts/src/contracts/current/test/TestLibBytes/TestLibBytes.sol
@@ -62,6 +62,21 @@ contract TestLibBytes is
return equal;
}
+ /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.
+ /// @param dest Byte array that will be overwritten with source bytes.
+ /// @param source Byte array to copy onto dest bytes.
+ function publicDeepCopyBytes(
+ bytes memory dest,
+ bytes memory source
+ )
+ public
+ pure
+ returns (bytes memory)
+ {
+ deepCopyBytes(dest, source);
+ return dest;
+ }
+
/// @dev Reads an address from a position in a byte array.
/// @param b Byte array containing an address.
/// @param index Index in byte array of address.
diff --git a/packages/contracts/src/utils/constants.ts b/packages/contracts/src/utils/constants.ts
index 5e336589f..ec3c8fd36 100644
--- a/packages/contracts/src/utils/constants.ts
+++ b/packages/contracts/src/utils/constants.ts
@@ -24,6 +24,7 @@ export const constants = {
LIB_BYTES_GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED: 'GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED',
LIB_BYTES_GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED: 'GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED',
LIB_BYTES_GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED: 'GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED',
+ LIB_BYTES_GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED: 'GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED',
ERC20_INSUFFICIENT_BALANCE: 'Insufficient balance to complete transfer.',
ERC20_INSUFFICIENT_ALLOWANCE: 'Insufficient allowance to complete transfer.',
TESTRPC_NETWORK_ID: 50,