aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-06-01 05:06:47 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-06-08 06:38:48 +0800
commite042e0ad32cd2ac9e707cb8e52961957f58314ce (patch)
tree70183e915072dc90b7b5cb1597f022368e9a0c79 /packages
parent5db15ca54cd7e1fd90bf318d2975750dcd31cddc (diff)
downloaddexon-sol-tools-e042e0ad32cd2ac9e707cb8e52961957f58314ce.tar
dexon-sol-tools-e042e0ad32cd2ac9e707cb8e52961957f58314ce.tar.gz
dexon-sol-tools-e042e0ad32cd2ac9e707cb8e52961957f58314ce.tar.bz2
dexon-sol-tools-e042e0ad32cd2ac9e707cb8e52961957f58314ce.tar.lz
dexon-sol-tools-e042e0ad32cd2ac9e707cb8e52961957f58314ce.tar.xz
dexon-sol-tools-e042e0ad32cd2ac9e707cb8e52961957f58314ce.tar.zst
dexon-sol-tools-e042e0ad32cd2ac9e707cb8e52961957f58314ce.zip
Converged on naming scheme for asset data: renamed all instances of assetMetadata, proxyData, proxyMetadata to assetData
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol6
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol6
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAssetProxy.sol14
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxy/interfaces/IAssetProxy.sol8
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxy/mixins/MAssetProxy.sol4
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol4
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol10
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol10
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol32
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/mixins/MAssetProxyDispatcher.sol4
-rw-r--r--packages/contracts/src/contracts/current/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol4
-rw-r--r--packages/contracts/src/contracts/current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol8
-rw-r--r--packages/contracts/src/utils/match_order_tester.ts24
-rw-r--r--packages/contracts/test/asset_proxy/decoder.ts40
-rw-r--r--packages/contracts/test/asset_proxy/proxies.ts117
-rw-r--r--packages/contracts/test/exchange/core.ts42
-rw-r--r--packages/contracts/test/exchange/dispatcher.ts8
-rw-r--r--packages/contracts/test/exchange/libs.ts4
-rw-r--r--packages/contracts/test/exchange/match_orders.ts166
-rw-r--r--packages/contracts/test/exchange/signature_validator.ts4
-rw-r--r--packages/contracts/test/exchange/transactions.ts6
-rw-r--r--packages/contracts/test/exchange/wrapper.ts26
-rw-r--r--packages/order-utils/src/asset_proxy_utils.ts66
23 files changed, 290 insertions, 323 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol
index 017f94b1a..5b4367fd9 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol
@@ -36,12 +36,12 @@ contract ERC20Proxy is
uint8 constant PROXY_ID = 1;
/// @dev Internal version of `transferFrom`.
- /// @param proxyData Encoded byte array.
+ /// @param assetData Encoded byte array.
/// @param from Address to transfer asset from.
/// @param to Address to transfer asset to.
/// @param amount Amount of asset to transfer.
function transferFromInternal(
- bytes memory proxyData,
+ bytes memory assetData,
address from,
address to,
uint256 amount
@@ -52,7 +52,7 @@ contract ERC20Proxy is
(
uint8 proxyId,
address token
- ) = decodeERC20Data(proxyData);
+ ) = decodeERC20Data(assetData);
// Data must be intended for this proxy.
uint256 length = assetMetadata.length;
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol
index f35e48eee..e2c445463 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol
@@ -38,12 +38,12 @@ contract ERC721Proxy is
string constant PROXY_ID_MISMATCH = "Proxy id in metadata does not match this proxy id.";
/// @dev Internal version of `transferFrom`.
- /// @param proxyData Encoded byte array.
+ /// @param assetData Encoded byte array.
/// @param from Address to transfer asset from.
/// @param to Address to transfer asset to.
/// @param amount Amount of asset to transfer.
function transferFromInternal(
- bytes memory proxyData,
+ bytes memory assetData,
address from,
address to,
uint256 amount
@@ -56,7 +56,7 @@ contract ERC721Proxy is
address token,
uint256 tokenId,
bytes memory data
- ) = decodeERC721Data(proxyData);
+ ) = decodeERC721Data(assetData);
// Data must be intended for this proxy.
uint256 length = assetMetadata.length;
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAssetProxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAssetProxy.sol
index 5fa33cbef..9032658e7 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAssetProxy.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAssetProxy.sol
@@ -28,12 +28,12 @@ contract MixinAssetProxy is
{
/// @dev Transfers assets. Either succeeds or throws.
- /// @param assetMetadata Encoded byte array.
+ /// @param assetData Encoded byte array.
/// @param from Address to transfer asset from.
/// @param to Address to transfer asset to.
/// @param amount Amount of asset to transfer.
function transferFrom(
- bytes assetMetadata,
+ bytes assetData,
address from,
address to,
uint256 amount
@@ -42,7 +42,7 @@ contract MixinAssetProxy is
onlyAuthorized
{
transferFromInternal(
- assetMetadata,
+ assetData,
from,
to,
amount
@@ -50,12 +50,12 @@ contract MixinAssetProxy is
}
/// @dev Makes multiple transfers of assets. Either succeeds or throws.
- /// @param assetMetadata Array of byte arrays encoded for the respective asset proxy.
+ /// @param assetData Array of byte arrays encoded for the respective asset proxy.
/// @param from Array of addresses to transfer assets from.
/// @param to Array of addresses to transfer assets to.
/// @param amounts Array of amounts of assets to transfer.
function batchTransferFrom(
- bytes[] memory assetMetadata,
+ bytes[] memory assetData,
address[] memory from,
address[] memory to,
uint256[] memory amounts
@@ -63,9 +63,9 @@ contract MixinAssetProxy is
public
onlyAuthorized
{
- for (uint256 i = 0; i < assetMetadata.length; i++) {
+ for (uint256 i = 0; i < assetData.length; i++) {
transferFromInternal(
- assetMetadata[i],
+ assetData[i],
from[i],
to[i],
amounts[i]
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/interfaces/IAssetProxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/interfaces/IAssetProxy.sol
index 7e1848889..22f43b12f 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxy/interfaces/IAssetProxy.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/interfaces/IAssetProxy.sol
@@ -26,12 +26,12 @@ contract IAssetProxy is
{
/// @dev Transfers assets. Either succeeds or throws.
- /// @param assetMetadata Byte array encoded for the respective asset proxy.
+ /// @param assetData Byte array encoded for the respective asset proxy.
/// @param from Address to transfer asset from.
/// @param to Address to transfer asset to.
/// @param amount Amount of asset to transfer.
function transferFrom(
- bytes assetMetadata,
+ bytes assetData,
address from,
address to,
uint256 amount
@@ -39,12 +39,12 @@ contract IAssetProxy is
external;
/// @dev Makes multiple transfers of assets. Either succeeds or throws.
- /// @param assetMetadata Array of byte arrays encoded for the respective asset proxy.
+ /// @param assetData Array of byte arrays encoded for the respective asset proxy.
/// @param from Array of addresses to transfer assets from.
/// @param to Array of addresses to transfer assets to.
/// @param amounts Array of amounts of assets to transfer.
function batchTransferFrom(
- bytes[] memory assetMetadata,
+ bytes[] memory assetData,
address[] memory from,
address[] memory to,
uint256[] memory amounts
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/mixins/MAssetProxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/mixins/MAssetProxy.sol
index de9d65a53..a52cb56f9 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxy/mixins/MAssetProxy.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/mixins/MAssetProxy.sol
@@ -26,12 +26,12 @@ contract MAssetProxy is
{
/// @dev Internal version of `transferFrom`.
- /// @param assetMetadata Encoded byte array.
+ /// @param assetData Encoded byte array.
/// @param from Address to transfer asset from.
/// @param to Address to transfer asset to.
/// @param amount Amount of asset to transfer.
function transferFromInternal(
- bytes memory assetMetadata,
+ bytes memory assetData,
address from,
address to,
uint256 amount
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol b/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol
index b7b308069..51f99bafa 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol
@@ -40,11 +40,11 @@ contract Exchange is
string constant public VERSION = "2.0.1-alpha";
// Mixins are instantiated in the order they are inherited
- constructor (bytes memory _zrxProxyData)
+ constructor (bytes memory _zrxAssetData)
public
MixinExchangeCore()
MixinMatchOrders()
- MixinSettlement(_zrxProxyData)
+ MixinSettlement(_zrxAssetData)
MixinSignatureValidator()
MixinTransactions()
MixinAssetProxyDispatcher()
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol
index 8f9342739..e77d81c06 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol
@@ -80,12 +80,12 @@ contract MixinAssetProxyDispatcher is
}
/// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.
- /// @param assetMetadata Byte array encoded for the respective asset proxy.
+ /// @param assetData Byte array encoded for the respective asset proxy.
/// @param from Address to transfer token from.
/// @param to Address to transfer token to.
/// @param amount Amount of token to transfer.
function dispatchTransferFrom(
- bytes memory assetMetadata,
+ bytes memory assetData,
address from,
address to,
uint256 amount
@@ -96,16 +96,16 @@ contract MixinAssetProxyDispatcher is
if (amount > 0) {
// Lookup asset proxy
- uint256 length = assetMetadata.length;
+ uint256 length = assetData.length;
require(
length > 0,
LENGTH_GREATER_THAN_0_REQUIRED
);
- uint8 assetProxyId = uint8(assetMetadata[length - 1]);
+ uint8 assetProxyId = uint8(assetData[length - 1]);
IAssetProxy assetProxy = assetProxies[assetProxyId];
// transferFrom will either succeed or throw.
- assetProxy.transferFrom(assetMetadata, from, to, amount);
+ assetProxy.transferFrom(assetData, from, to, amount);
}
}
}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol
index 646d3ed58..83e9dfdf4 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol
@@ -40,7 +40,7 @@ contract MixinSettlement is
bytes internal ZRX_PROXY_DATA;
/// @dev Gets the ZRX metadata used for fee transfers.
- function zrxProxyData()
+ function zrxAssetData()
external
view
returns (bytes memory)
@@ -48,13 +48,13 @@ contract MixinSettlement is
return ZRX_PROXY_DATA;
}
- /// TODO: _zrxProxyData should be a constant in production.
+ /// TODO: _zrxAssetData should be a constant in production.
/// @dev Constructor sets the metadata that will be used for paying ZRX fees.
- /// @param _zrxProxyData Byte array containing ERC20 proxy id concatenated with address of ZRX.
- constructor (bytes memory _zrxProxyData)
+ /// @param _zrxAssetData Byte array containing ERC20 proxy id concatenated with address of ZRX.
+ constructor (bytes memory _zrxAssetData)
public
{
- ZRX_PROXY_DATA = _zrxProxyData;
+ ZRX_PROXY_DATA = _zrxAssetData;
}
/// @dev Settles an order by transferring assets between counterparties.
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
index 0ad0710ce..0d9888703 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
@@ -91,12 +91,12 @@ contract MixinWrapperFunctions is
// | | 0x0E0 | | 8. takerFeeAmount |
// | | 0x100 | | 9. expirationTimeSeconds |
// | | 0x120 | | 10. salt |
- // | | 0x140 | | 11. Offset to makerAssetProxyMetadata (*) |
- // | | 0x160 | | 12. Offset to takerAssetProxyMetadata (*) |
- // | | 0x180 | 32 | makerAssetProxyMetadata Length |
- // | | 0x1A0 | ** | makerAssetProxyMetadata Contents |
- // | | 0x1C0 | 32 | takerAssetProxyMetadata Length |
- // | | 0x1E0 | ** | takerAssetProxyMetadata Contents |
+ // | | 0x140 | | 11. Offset to makerAssetData (*) |
+ // | | 0x160 | | 12. Offset to takerAssetData (*) |
+ // | | 0x180 | 32 | makerAssetData Length |
+ // | | 0x1A0 | ** | makerAssetData Contents |
+ // | | 0x1C0 | 32 | takerAssetData Length |
+ // | | 0x1E0 | ** | takerAssetData Contents |
// | | 0x200 | 32 | signature Length |
// | | 0x220 | ** | signature Contents |
@@ -163,43 +163,43 @@ contract MixinWrapperFunctions is
mstore(add(dataAreaEnd, 0xE0), mload(add(sourceOffset, 0xE0))) // takerFeeAmount
mstore(add(dataAreaEnd, 0x100), mload(add(sourceOffset, 0x100))) // expirationTimeSeconds
mstore(add(dataAreaEnd, 0x120), mload(add(sourceOffset, 0x120))) // salt
- mstore(add(dataAreaEnd, 0x140), mload(add(sourceOffset, 0x140))) // Offset to makerAssetProxyMetadata
- mstore(add(dataAreaEnd, 0x160), mload(add(sourceOffset, 0x160))) // Offset to takerAssetProxyMetadata
+ mstore(add(dataAreaEnd, 0x140), mload(add(sourceOffset, 0x140))) // Offset to makerAssetData
+ mstore(add(dataAreaEnd, 0x160), mload(add(sourceOffset, 0x160))) // Offset to takerAssetData
dataAreaEnd := add(dataAreaEnd, 0x180)
sourceOffset := add(sourceOffset, 0x180)
- // Write offset to <order.makerAssetProxyMetadata>
+ // Write offset to <order.makerAssetData>
mstore(add(dataAreaStart, mul(10, 0x20)), sub(dataAreaEnd, dataAreaStart))
- // Calculate length of <order.makerAssetProxyMetadata>
+ // Calculate length of <order.makerAssetData>
arrayLenBytes := mload(sourceOffset)
sourceOffset := add(sourceOffset, 0x20)
arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)
- // Write length of <order.makerAssetProxyMetadata>
+ // Write length of <order.makerAssetData>
mstore(dataAreaEnd, arrayLenBytes)
dataAreaEnd := add(dataAreaEnd, 0x20)
- // Write contents of <order.makerAssetProxyMetadata>
+ // Write contents of <order.makerAssetData>
for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {
mstore(dataAreaEnd, mload(sourceOffset))
dataAreaEnd := add(dataAreaEnd, 0x20)
sourceOffset := add(sourceOffset, 0x20)
}
- // Write offset to <order.takerAssetProxyMetadata>
+ // Write offset to <order.takerAssetData>
mstore(add(dataAreaStart, mul(11, 0x20)), sub(dataAreaEnd, dataAreaStart))
- // Calculate length of <order.takerAssetProxyMetadata>
+ // Calculate length of <order.takerAssetData>
arrayLenBytes := mload(sourceOffset)
sourceOffset := add(sourceOffset, 0x20)
arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)
- // Write length of <order.takerAssetProxyMetadata>
+ // Write length of <order.takerAssetData>
mstore(dataAreaEnd, arrayLenBytes)
dataAreaEnd := add(dataAreaEnd, 0x20)
- // Write contents of <order.takerAssetProxyMetadata>
+ // Write contents of <order.takerAssetData>
for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {
mstore(dataAreaEnd, mload(sourceOffset))
dataAreaEnd := add(dataAreaEnd, 0x20)
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MAssetProxyDispatcher.sol b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
index 87c5f6361..82eafb529 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
@@ -33,12 +33,12 @@ contract MAssetProxyDispatcher is
);
/// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.
- /// @param assetMetadata Byte array encoded for the respective asset proxy.
+ /// @param assetData Byte array encoded for the respective asset proxy.
/// @param from Address to transfer token from.
/// @param to Address to transfer token to.
/// @param amount Amount of token to transfer.
function dispatchTransferFrom(
- bytes memory assetMetadata,
+ bytes memory assetData,
address from,
address to,
uint256 amount
diff --git a/packages/contracts/src/contracts/current/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol b/packages/contracts/src/contracts/current/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
index 11ca0617d..2ae69e0ef 100644
--- a/packages/contracts/src/contracts/current/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
+++ b/packages/contracts/src/contracts/current/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
@@ -23,12 +23,12 @@ import "../../protocol/Exchange/MixinAssetProxyDispatcher.sol";
contract TestAssetProxyDispatcher is MixinAssetProxyDispatcher {
function publicDispatchTransferFrom(
- bytes memory assetMetadata,
+ bytes memory assetData,
address from,
address to,
uint256 amount)
public
{
- dispatchTransferFrom(assetMetadata, from, to, amount);
+ dispatchTransferFrom(assetData, from, to, amount);
}
}
diff --git a/packages/contracts/src/contracts/current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol b/packages/contracts/src/contracts/current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol
index e4a7de71d..6d2866656 100644
--- a/packages/contracts/src/contracts/current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol
+++ b/packages/contracts/src/contracts/current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol
@@ -26,16 +26,16 @@ contract TestLibAssetProxyDecoder is
{
/// @dev Decodes ERC721 Asset Proxy data
- function publicDecodeERC20Data(bytes memory proxyData)
+ function publicDecodeERC20Data(bytes memory assetData)
public
pure
returns (uint8, address)
{
- return decodeERC20Data(proxyData);
+ return decodeERC20Data(assetData);
}
/// @dev Decodes ERC721 Asset Proxy data
- function publicDecodeERC721Data(bytes memory proxyData)
+ function publicDecodeERC721Data(bytes memory assetData)
public
pure
returns (
@@ -45,6 +45,6 @@ contract TestLibAssetProxyDecoder is
bytes memory
)
{
- return decodeERC721Data(proxyData);
+ return decodeERC721Data(assetData);
}
}
diff --git a/packages/contracts/src/utils/match_order_tester.ts b/packages/contracts/src/utils/match_order_tester.ts
index f4f7f965b..fbb1b99db 100644
--- a/packages/contracts/src/utils/match_order_tester.ts
+++ b/packages/contracts/src/utils/match_order_tester.ts
@@ -237,11 +237,11 @@ export class MatchOrderTester {
const expectedNewERC20BalancesByOwner = _.cloneDeep(erc20BalancesByOwner);
const expectedNewERC721TokenIdsByOwner = _.cloneDeep(erc721TokenIdsByOwner);
// Left Maker Asset (Right Taker Asset)
- const makerAssetProxyIdLeft = assetProxyUtils.decodeProxyDataId(signedOrderLeft.makerAssetData);
+ const makerAssetProxyIdLeft = assetProxyUtils.decodeAssetDataId(signedOrderLeft.makerAssetData);
if (makerAssetProxyIdLeft === AssetProxyId.ERC20) {
// Decode asset data
- const erc20ProxyData = assetProxyUtils.decodeERC20ProxyData(signedOrderLeft.makerAssetData);
- const makerAssetAddressLeft = erc20ProxyData.tokenAddress;
+ const erc20AssetData = assetProxyUtils.decodeERC20AssetData(signedOrderLeft.makerAssetData);
+ const makerAssetAddressLeft = erc20AssetData.tokenAddress;
const takerAssetAddressRight = makerAssetAddressLeft;
// Left Maker
expectedNewERC20BalancesByOwner[makerAddressLeft][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
@@ -259,9 +259,9 @@ export class MatchOrderTester {
][makerAssetAddressLeft].add(expectedTransferAmounts.amountReceivedByTaker);
} else if (makerAssetProxyIdLeft === AssetProxyId.ERC721) {
// Decode asset data
- const erc721ProxyData = assetProxyUtils.decodeERC721ProxyData(signedOrderLeft.makerAssetData);
- const makerAssetAddressLeft = erc721ProxyData.tokenAddress;
- const makerAssetIdLeft = erc721ProxyData.tokenId;
+ const erc721AssetData = assetProxyUtils.decodeERC721AssetData(signedOrderLeft.makerAssetData);
+ const makerAssetAddressLeft = erc721AssetData.tokenAddress;
+ const makerAssetIdLeft = erc721AssetData.tokenId;
const takerAssetAddressRight = makerAssetAddressLeft;
const takerAssetIdRight = makerAssetIdLeft;
// Left Maker
@@ -272,11 +272,11 @@ export class MatchOrderTester {
}
// Left Taker Asset (Right Maker Asset)
// Note: This exchange is only between the order makers: the Taker does not receive any of the left taker asset.
- const takerAssetProxyIdLeft = assetProxyUtils.decodeProxyDataId(signedOrderLeft.takerAssetData);
+ const takerAssetProxyIdLeft = assetProxyUtils.decodeAssetDataId(signedOrderLeft.takerAssetData);
if (takerAssetProxyIdLeft === AssetProxyId.ERC20) {
// Decode asset data
- const erc20ProxyData = assetProxyUtils.decodeERC20ProxyData(signedOrderLeft.takerAssetData);
- const takerAssetAddressLeft = erc20ProxyData.tokenAddress;
+ const erc20AssetData = assetProxyUtils.decodeERC20AssetData(signedOrderLeft.takerAssetData);
+ const takerAssetAddressLeft = erc20AssetData.tokenAddress;
const makerAssetAddressRight = takerAssetAddressLeft;
// Left Maker
expectedNewERC20BalancesByOwner[makerAddressLeft][takerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
@@ -290,9 +290,9 @@ export class MatchOrderTester {
);
} else if (takerAssetProxyIdLeft === AssetProxyId.ERC721) {
// Decode asset data
- const erc721ProxyData = assetProxyUtils.decodeERC721ProxyData(signedOrderRight.makerAssetData);
- const makerAssetAddressRight = erc721ProxyData.tokenAddress;
- const makerAssetIdRight = erc721ProxyData.tokenId;
+ const erc721AssetData = assetProxyUtils.decodeERC721AssetData(signedOrderRight.makerAssetData);
+ const makerAssetAddressRight = erc721AssetData.tokenAddress;
+ const makerAssetIdRight = erc721AssetData.tokenId;
const takerAssetAddressLeft = makerAssetAddressRight;
const takerAssetIdLeft = makerAssetIdRight;
// Right Maker
diff --git a/packages/contracts/test/asset_proxy/decoder.ts b/packages/contracts/test/asset_proxy/decoder.ts
index 0f1413ff1..712ef8656 100644
--- a/packages/contracts/test/asset_proxy/decoder.ts
+++ b/packages/contracts/test/asset_proxy/decoder.ts
@@ -12,7 +12,7 @@ import { artifacts } from '../../src/utils/artifacts';
import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
-import { AssetProxyId, ERC20ProxyData, ERC721ProxyData, ProxyData } from '../../src/utils/types';
+import { AssetProxyId, ERC20AssetData, ERC721AssetData, AssetData } from '../../src/utils/types';
import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
@@ -45,21 +45,21 @@ describe('LibAssetProxyDecoder', () => {
describe('LibAssetProxyDecoder', () => {
it('should correctly decode ERC20 proxy data)', async () => {
- const encodedProxyData = assetProxyUtils.encodeERC20ProxyData(testAddress);
- const expectedDecodedProxyData = assetProxyUtils.decodeERC20ProxyData(encodedProxyData);
+ const encodedAssetData = assetProxyUtils.encodeERC20AssetData(testAddress);
+ const expectedDecodedAssetData = assetProxyUtils.decodeERC20AssetData(encodedAssetData);
let decodedAssetProxyId: number;
let decodedTokenAddress: string;
[decodedAssetProxyId, decodedTokenAddress] = await testAssetProxyDecoder.publicDecodeERC20Data.callAsync(
- encodedProxyData,
+ encodedAssetData,
);
- expect(decodedAssetProxyId).to.be.equal(expectedDecodedProxyData.assetProxyId);
- expect(decodedTokenAddress).to.be.equal(expectedDecodedProxyData.tokenAddress);
+ expect(decodedAssetProxyId).to.be.equal(expectedDecodedAssetData.assetProxyId);
+ expect(decodedTokenAddress).to.be.equal(expectedDecodedAssetData.tokenAddress);
});
it('should correctly decode ERC721 proxy data', async () => {
const tokenId = ZeroEx.generatePseudoRandomSalt();
- const encodedProxyData = assetProxyUtils.encodeERC721ProxyData(testAddress, tokenId);
- const expectedDecodedProxyData = assetProxyUtils.decodeERC721ProxyData(encodedProxyData);
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(testAddress, tokenId);
+ const expectedDecodedAssetData = assetProxyUtils.decodeERC721AssetData(encodedAssetData);
let decodedAssetProxyId: number;
let decodedTokenAddress: string;
let decodedTokenId: BigNumber;
@@ -69,18 +69,18 @@ describe('LibAssetProxyDecoder', () => {
decodedTokenAddress,
decodedTokenId,
decodedData,
- ] = await testAssetProxyDecoder.publicDecodeERC721Data.callAsync(encodedProxyData);
- expect(decodedAssetProxyId).to.be.equal(expectedDecodedProxyData.assetProxyId);
- expect(decodedTokenAddress).to.be.equal(expectedDecodedProxyData.tokenAddress);
- expect(decodedTokenId).to.be.bignumber.equal(expectedDecodedProxyData.tokenId);
- expect(decodedData).to.be.equal(expectedDecodedProxyData.data);
+ ] = await testAssetProxyDecoder.publicDecodeERC721Data.callAsync(encodedAssetData);
+ expect(decodedAssetProxyId).to.be.equal(expectedDecodedAssetData.assetProxyId);
+ expect(decodedTokenAddress).to.be.equal(expectedDecodedAssetData.tokenAddress);
+ expect(decodedTokenId).to.be.bignumber.equal(expectedDecodedAssetData.tokenId);
+ expect(decodedData).to.be.equal(expectedDecodedAssetData.data);
});
it('should correctly decode ERC721 proxy data with receiver data', async () => {
const tokenId = ZeroEx.generatePseudoRandomSalt();
const data = ethUtil.bufferToHex(assetProxyUtils.encodeUint256(ZeroEx.generatePseudoRandomSalt())) + 'FFFF';
- const encodedProxyData = assetProxyUtils.encodeERC721ProxyData(testAddress, tokenId, data);
- const expectedDecodedProxyData = assetProxyUtils.decodeERC721ProxyData(encodedProxyData);
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(testAddress, tokenId, data);
+ const expectedDecodedAssetData = assetProxyUtils.decodeERC721AssetData(encodedAssetData);
let decodedAssetProxyId: number;
let decodedTokenAddress: string;
let decodedTokenId: BigNumber;
@@ -90,11 +90,11 @@ describe('LibAssetProxyDecoder', () => {
decodedTokenAddress,
decodedTokenId,
decodedData,
- ] = await testAssetProxyDecoder.publicDecodeERC721Data.callAsync(encodedProxyData);
- expect(decodedAssetProxyId).to.be.equal(expectedDecodedProxyData.assetProxyId);
- expect(decodedTokenAddress).to.be.equal(expectedDecodedProxyData.tokenAddress);
- expect(decodedTokenId).to.be.bignumber.equal(expectedDecodedProxyData.tokenId);
- expect(decodedData).to.be.equal(expectedDecodedProxyData.data);
+ ] = await testAssetProxyDecoder.publicDecodeERC721Data.callAsync(encodedAssetData);
+ expect(decodedAssetProxyId).to.be.equal(expectedDecodedAssetData.assetProxyId);
+ expect(decodedTokenAddress).to.be.equal(expectedDecodedAssetData.tokenAddress);
+ expect(decodedTokenId).to.be.bignumber.equal(expectedDecodedAssetData.tokenId);
+ expect(decodedData).to.be.equal(expectedDecodedAssetData.data);
});
});
});
diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts
index 4995e95a0..d6bc8163b 100644
--- a/packages/contracts/test/asset_proxy/proxies.ts
+++ b/packages/contracts/test/asset_proxy/proxies.ts
@@ -107,13 +107,13 @@ describe('Asset Transfer Proxies', () => {
describe('transferFrom', () => {
it('should successfully transfer tokens', async () => {
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address);
+ const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
// Perform a transfer from makerAddress to takerAddress
const erc20Balances = await erc20Wrapper.getBalancesAsync();
const amount = new BigNumber(10);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc20Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
takerAddress,
amount,
@@ -133,13 +133,13 @@ describe('Asset Transfer Proxies', () => {
it('should do nothing if transferring 0 amount of a token', async () => {
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address);
+ const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
// Perform a transfer from makerAddress to takerAddress
const erc20Balances = await erc20Wrapper.getBalancesAsync();
const amount = new BigNumber(0);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc20Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
takerAddress,
amount,
@@ -159,7 +159,7 @@ describe('Asset Transfer Proxies', () => {
it('should throw if allowances are too low', async () => {
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address);
+ const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
// Create allowance less than transfer amount. Set allowance on proxy.
const allowance = new BigNumber(0);
const transferAmount = new BigNumber(10);
@@ -172,7 +172,7 @@ describe('Asset Transfer Proxies', () => {
// Perform a transfer; expect this to fail.
return expectRevertOrAlwaysFailingTransactionAsync(
erc20Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
takerAddress,
transferAmount,
@@ -183,19 +183,13 @@ describe('Asset Transfer Proxies', () => {
it('should throw if requesting address is not authorized', async () => {
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address);
+ const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(10);
return expectRevertOrAlwaysFailingTransactionAsync(
- erc20Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
- makerAddress,
- takerAddress,
- amount,
- {
- from: notAuthorized,
- },
- ),
+ erc20Proxy.transferFrom.sendTransactionAsync(encodedAssetData, makerAddress, takerAddress, amount, {
+ from: notAuthorized,
+ }),
);
});
});
@@ -204,16 +198,16 @@ describe('Asset Transfer Proxies', () => {
it('should succesfully make multiple token transfers', async () => {
const erc20Balances = await erc20Wrapper.getBalancesAsync();
- const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address);
+ const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
const amount = new BigNumber(10);
const numTransfers = 2;
- const assetMetadata = _.times(numTransfers, () => encodedProxyMetadata);
+ const assetData = _.times(numTransfers, () => encodedAssetData);
const fromAddresses = _.times(numTransfers, () => makerAddress);
const toAddresses = _.times(numTransfers, () => takerAddress);
const amounts = _.times(numTransfers, () => amount);
const txHash = await erc20Proxy.batchTransferFrom.sendTransactionAsync(
- assetMetadata,
+ assetData,
fromAddresses,
toAddresses,
amounts,
@@ -235,17 +229,17 @@ describe('Asset Transfer Proxies', () => {
});
it('should throw if not called by an authorized address', async () => {
- const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address);
+ const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
const amount = new BigNumber(10);
const numTransfers = 2;
- const assetMetadata = _.times(numTransfers, () => encodedProxyMetadata);
+ const assetData = _.times(numTransfers, () => encodedAssetData);
const fromAddresses = _.times(numTransfers, () => makerAddress);
const toAddresses = _.times(numTransfers, () => takerAddress);
const amounts = _.times(numTransfers, () => amount);
return expectRevertOrAlwaysFailingTransactionAsync(
erc20Proxy.batchTransferFrom.sendTransactionAsync(
- assetMetadata,
+ encodedAssetData,
fromAddresses,
toAddresses,
amounts,
@@ -265,10 +259,7 @@ describe('Asset Transfer Proxies', () => {
describe('transferFrom', () => {
it('should successfully transfer tokens', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(
- erc721Token.address,
- erc721MakerTokenId,
- );
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
// Verify pre-condition
const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
@@ -276,7 +267,7 @@ describe('Asset Transfer Proxies', () => {
const amount = new BigNumber(1);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
takerAddress,
amount,
@@ -291,10 +282,7 @@ describe('Asset Transfer Proxies', () => {
it('should call onERC721Received when transferring to a smart contract', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(
- erc721Token.address,
- erc721MakerTokenId,
- );
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
// Verify pre-condition
const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
@@ -302,7 +290,7 @@ describe('Asset Transfer Proxies', () => {
const erc20Balances = await erc20Wrapper.getBalancesAsync();
const amount = new BigNumber(1);
const txHash = await erc721Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
erc721Receiver.address,
amount,
@@ -327,7 +315,7 @@ describe('Asset Transfer Proxies', () => {
it('should call onERC721Received when transferring to a smart contract and receive extra data', async () => {
// Construct metadata for ERC721 proxy
const data = ethUtil.bufferToHex(assetProxyUtils.encodeUint256(ZeroEx.generatePseudoRandomSalt()));
- const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(
erc721Token.address,
erc721MakerTokenId,
data,
@@ -339,7 +327,7 @@ describe('Asset Transfer Proxies', () => {
const erc20Balances = await erc20Wrapper.getBalancesAsync();
const amount = new BigNumber(1);
const txHash = await erc721Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
erc721Receiver.address,
amount,
@@ -363,10 +351,7 @@ describe('Asset Transfer Proxies', () => {
it('should throw if receiving contract does not have onERC721Received', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(
- erc721Token.address,
- erc721MakerTokenId,
- );
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
// Verify pre-condition
const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
@@ -375,7 +360,7 @@ describe('Asset Transfer Proxies', () => {
const amount = new BigNumber(1);
return expect(
erc721Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
erc20Proxy.address, // the ERC20 proxy does not have an ERC721 receiver
amount,
@@ -386,10 +371,7 @@ describe('Asset Transfer Proxies', () => {
it('should throw if transferring 0 amount of a token', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(
- erc721Token.address,
- erc721MakerTokenId,
- );
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
// Verify pre-condition
const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
@@ -397,7 +379,7 @@ describe('Asset Transfer Proxies', () => {
const amount = new BigNumber(0);
return expectRevertOrAlwaysFailingTransactionAsync(
erc721Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
takerAddress,
amount,
@@ -408,10 +390,7 @@ describe('Asset Transfer Proxies', () => {
it('should throw if transferring > 1 amount of a token', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(
- erc721Token.address,
- erc721MakerTokenId,
- );
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
// Verify pre-condition
const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
@@ -419,7 +398,7 @@ describe('Asset Transfer Proxies', () => {
const amount = new BigNumber(500);
return expectRevertOrAlwaysFailingTransactionAsync(
erc721Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
takerAddress,
amount,
@@ -430,10 +409,7 @@ describe('Asset Transfer Proxies', () => {
it('should throw if allowances are too low', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(
- erc721Token.address,
- erc721MakerTokenId,
- );
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
// Remove transfer approval for makerAddress.
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, false, {
@@ -444,29 +420,20 @@ describe('Asset Transfer Proxies', () => {
// Perform a transfer; expect this to fail.
const amount = new BigNumber(1);
return expectRevertOrAlwaysFailingTransactionAsync(
- erc20Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
- makerAddress,
- takerAddress,
- amount,
- {
- from: notAuthorized,
- },
- ),
+ erc20Proxy.transferFrom.sendTransactionAsync(encodedAssetData, makerAddress, takerAddress, amount, {
+ from: notAuthorized,
+ }),
);
});
it('should throw if requesting address is not authorized', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(
- erc721Token.address,
- erc721MakerTokenId,
- );
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(1);
return expectRevertOrAlwaysFailingTransactionAsync(
erc721Proxy.transferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
takerAddress,
amount,
@@ -482,16 +449,16 @@ describe('Asset Transfer Proxies', () => {
const [makerTokenIdA, makerTokenIdB] = erc721TokensById[makerAddress][erc721Token.address];
const numTransfers = 2;
- const assetMetadata = [
- assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerTokenIdA),
- assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerTokenIdB),
+ const assetData = [
+ assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerTokenIdA),
+ assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerTokenIdB),
];
const fromAddresses = _.times(numTransfers, () => makerAddress);
const toAddresses = _.times(numTransfers, () => takerAddress);
const amounts = _.times(numTransfers, () => new BigNumber(1));
const txHash = await erc721Proxy.batchTransferFrom.sendTransactionAsync(
- assetMetadata,
+ assetData,
fromAddresses,
toAddresses,
amounts,
@@ -514,9 +481,9 @@ describe('Asset Transfer Proxies', () => {
const [makerTokenIdA, makerTokenIdB] = erc721TokensById[makerAddress][erc721Token.address];
const numTransfers = 2;
- const assetMetadata = [
- assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerTokenIdA),
- assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerTokenIdB),
+ const assetData = [
+ assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerTokenIdA),
+ assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerTokenIdB),
];
const fromAddresses = _.times(numTransfers, () => makerAddress);
const toAddresses = _.times(numTransfers, () => takerAddress);
@@ -524,7 +491,7 @@ describe('Asset Transfer Proxies', () => {
return expectRevertOrAlwaysFailingTransactionAsync(
erc721Proxy.batchTransferFrom.sendTransactionAsync(
- assetMetadata,
+ encodedAssetData,
fromAddresses,
toAddresses,
amounts,
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index bee74cca8..8d3c3a940 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -87,7 +87,7 @@ describe('Exchange core', () => {
artifacts.Exchange,
provider,
txDefaults,
- assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ assetProxyUtils.encodeERC20AssetData(zrxToken.address),
);
exchangeWrapper = new ExchangeWrapper(exchange, provider);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
@@ -114,8 +114,8 @@ describe('Exchange core', () => {
exchangeAddress: exchange.address,
makerAddress,
feeRecipientAddress,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultMakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultTakerAssetAddress),
};
const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
@@ -711,8 +711,8 @@ describe('Exchange core', () => {
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(1),
- makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
- takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
+ makerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
@@ -737,8 +737,8 @@ describe('Exchange core', () => {
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(1),
- makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
- takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
+ makerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
@@ -759,8 +759,8 @@ describe('Exchange core', () => {
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(1),
- makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
- takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
+ makerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
@@ -781,8 +781,8 @@ describe('Exchange core', () => {
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(2),
takerAssetAmount: new BigNumber(1),
- makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
- takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
+ makerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
@@ -803,8 +803,8 @@ describe('Exchange core', () => {
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(500),
- makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
- takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
+ makerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
@@ -825,8 +825,8 @@ describe('Exchange core', () => {
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(0),
- makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
- takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
+ makerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
@@ -845,9 +845,9 @@ describe('Exchange core', () => {
const makerAssetId = erc721MakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultTakerAssetAddress),
});
// Verify pre-conditions
const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
@@ -885,9 +885,9 @@ describe('Exchange core', () => {
const takerAssetId = erc721TakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
takerAssetAmount: new BigNumber(1),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultMakerAssetAddress),
});
// Verify pre-conditions
const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts
index 02d43a132..9e113e47d 100644
--- a/packages/contracts/test/exchange/dispatcher.ts
+++ b/packages/contracts/test/exchange/dispatcher.ts
@@ -275,13 +275,13 @@ describe('AssetProxyDispatcher', () => {
constants.AWAIT_TRANSACTION_MINED_MS,
);
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address);
+ const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
// Perform a transfer from makerAddress to takerAddress
const erc20Balances = await erc20Wrapper.getBalancesAsync();
const amount = new BigNumber(10);
await web3Wrapper.awaitTransactionSuccessAsync(
await assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
takerAddress,
amount,
@@ -301,12 +301,12 @@ describe('AssetProxyDispatcher', () => {
it('should throw if dispatching to unregistered proxy', async () => {
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address);
+ const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(10);
return expectRevertOrAlwaysFailingTransactionAsync(
assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
- encodedProxyMetadata,
+ encodedAssetData,
makerAddress,
takerAddress,
amount,
diff --git a/packages/contracts/test/exchange/libs.ts b/packages/contracts/test/exchange/libs.ts
index b12934014..eff05981d 100644
--- a/packages/contracts/test/exchange/libs.ts
+++ b/packages/contracts/test/exchange/libs.ts
@@ -38,8 +38,8 @@ describe('Exchange libs', () => {
exchangeAddress: libs.address,
makerAddress,
feeRecipientAddress: addressUtils.generatePseudoRandomAddress(),
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(addressUtils.generatePseudoRandomAddress()),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(addressUtils.generatePseudoRandomAddress()),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
};
const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts
index aab3308ae..f34cbee1b 100644
--- a/packages/contracts/test/exchange/match_orders.ts
+++ b/packages/contracts/test/exchange/match_orders.ts
@@ -96,7 +96,7 @@ describe('matchOrders', () => {
artifacts.Exchange,
provider,
txDefaults,
- assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ assetProxyUtils.encodeERC20AssetData(zrxToken.address),
);
exchangeWrapper = new ExchangeWrapper(exchange, provider);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
@@ -122,8 +122,8 @@ describe('matchOrders', () => {
const defaultOrderParams = {
...constants.STATIC_ORDER_PARAMS,
exchangeAddress: exchange.address,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
};
const privateKeyLeft = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressLeft)];
orderFactoryLeft = new OrderFactory(privateKeyLeft, defaultOrderParams);
@@ -148,16 +148,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -182,16 +182,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -227,16 +227,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -261,16 +261,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -295,16 +295,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -334,8 +334,8 @@ describe('matchOrders', () => {
// branch in the contract twice for this test.
const signedOrderRight2 = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -364,8 +364,8 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressLeft,
@@ -373,8 +373,8 @@ describe('matchOrders', () => {
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -404,8 +404,8 @@ describe('matchOrders', () => {
// branch in the contract twice for this test.
const signedOrderLeft2 = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
feeRecipientAddress: feeRecipientAddressLeft,
@@ -437,16 +437,16 @@ describe('matchOrders', () => {
const feeRecipientAddress = feeRecipientAddressLeft;
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress,
@@ -465,16 +465,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -494,16 +494,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -523,16 +523,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -552,16 +552,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -581,16 +581,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: makerAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: makerAddressRight,
@@ -609,16 +609,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -635,16 +635,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -661,16 +661,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -691,16 +691,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -721,16 +721,16 @@ describe('matchOrders', () => {
// Create orders to match
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
@@ -752,16 +752,16 @@ describe('matchOrders', () => {
const erc721TokenToTransfer = erc721LeftMakerAssetIds[0];
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
makerAssetAmount: new BigNumber(1),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: new BigNumber(1),
feeRecipientAddress: feeRecipientAddressRight,
@@ -787,16 +787,16 @@ describe('matchOrders', () => {
const erc721TokenToTransfer = erc721RightMakerAssetIds[0];
const signedOrderLeft = orderFactoryLeft.newSignedOrder({
makerAddress: makerAddressLeft,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: new BigNumber(1),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
- makerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
makerAssetAmount: new BigNumber(1),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressRight,
diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts
index 79db620b4..c39fd6ee4 100644
--- a/packages/contracts/test/exchange/signature_validator.ts
+++ b/packages/contracts/test/exchange/signature_validator.ts
@@ -42,8 +42,8 @@ describe('MixinSignatureValidator', () => {
exchangeAddress: signatureValidator.address,
makerAddress,
feeRecipientAddress: addressUtils.generatePseudoRandomAddress(),
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(addressUtils.generatePseudoRandomAddress()),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(addressUtils.generatePseudoRandomAddress()),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
};
const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts
index 7897fa558..8c5bc7bec 100644
--- a/packages/contracts/test/exchange/transactions.ts
+++ b/packages/contracts/test/exchange/transactions.ts
@@ -72,7 +72,7 @@ describe('Exchange transactions', () => {
artifacts.Exchange,
provider,
txDefaults,
- assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ assetProxyUtils.encodeERC20AssetData(zrxToken.address),
);
exchangeWrapper = new ExchangeWrapper(exchange, provider);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
@@ -91,8 +91,8 @@ describe('Exchange transactions', () => {
exchangeAddress: exchange.address,
makerAddress,
feeRecipientAddress,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultMakerTokenAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultTakerTokenAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultMakerTokenAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultTakerTokenAddress),
};
makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index 258e1ff81..b66cff90a 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -81,7 +81,7 @@ describe('Exchange wrappers', () => {
artifacts.Exchange,
provider,
txDefaults,
- assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ assetProxyUtils.encodeERC20AssetData(zrxToken.address),
);
exchangeWrapper = new ExchangeWrapper(exchange, provider);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
@@ -108,8 +108,8 @@ describe('Exchange wrappers', () => {
exchangeAddress: exchange.address,
makerAddress,
feeRecipientAddress,
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultMakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultTakerAssetAddress),
};
const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
@@ -304,7 +304,7 @@ describe('Exchange wrappers', () => {
const signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: makerZRXBalance,
makerFee: new BigNumber(1),
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(zrxToken.address),
});
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
@@ -316,7 +316,7 @@ describe('Exchange wrappers', () => {
const signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(makerZRXAllowance),
makerFee: new BigNumber(1),
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(zrxToken.address),
});
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
@@ -328,7 +328,7 @@ describe('Exchange wrappers', () => {
const signedOrder = orderFactory.newSignedOrder({
takerAssetAmount: takerZRXBalance,
takerFee: new BigNumber(1),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(zrxToken.address),
});
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
@@ -340,7 +340,7 @@ describe('Exchange wrappers', () => {
const signedOrder = orderFactory.newSignedOrder({
takerAssetAmount: new BigNumber(takerZRXAllowance),
takerFee: new BigNumber(1),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(zrxToken.address),
});
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
@@ -354,8 +354,8 @@ describe('Exchange wrappers', () => {
const signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(1),
- makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
- takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
+ makerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
@@ -692,7 +692,7 @@ describe('Exchange wrappers', () => {
signedOrders = [
orderFactory.newSignedOrder(),
orderFactory.newSignedOrder({
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(zrxToken.address),
}),
orderFactory.newSignedOrder(),
];
@@ -785,7 +785,7 @@ describe('Exchange wrappers', () => {
signedOrders = [
orderFactory.newSignedOrder(),
orderFactory.newSignedOrder({
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ takerAssetData: assetProxyUtils.encodeERC20AssetData(zrxToken.address),
}),
orderFactory.newSignedOrder(),
];
@@ -874,7 +874,7 @@ describe('Exchange wrappers', () => {
signedOrders = [
orderFactory.newSignedOrder(),
orderFactory.newSignedOrder({
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(zrxToken.address),
}),
orderFactory.newSignedOrder(),
];
@@ -967,7 +967,7 @@ describe('Exchange wrappers', () => {
signedOrders = [
orderFactory.newSignedOrder(),
orderFactory.newSignedOrder({
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ makerAssetData: assetProxyUtils.encodeERC20AssetData(zrxToken.address),
}),
orderFactory.newSignedOrder(),
];
diff --git a/packages/order-utils/src/asset_proxy_utils.ts b/packages/order-utils/src/asset_proxy_utils.ts
index 8255376a1..1f1e49f0f 100644
--- a/packages/order-utils/src/asset_proxy_utils.ts
+++ b/packages/order-utils/src/asset_proxy_utils.ts
@@ -41,7 +41,7 @@ export const assetProxyUtils = {
const value = new BigNumber(formattedValue, 16);
return value;
},
- encodeERC20ProxyData(tokenAddress: string): string {
+ encodeERC20AssetData(tokenAddress: string): string {
const encodedAssetProxyId = assetProxyUtils.encodeAssetProxyId(AssetProxyId.ERC20);
const encodedAddress = assetProxyUtils.encodeAddress(tokenAddress);
const encodedMetadata = Buffer.concat([encodedAddress, encodedAssetProxyId]);
@@ -53,11 +53,11 @@ export const assetProxyUtils = {
if (encodedProxyMetadata.byteLength !== ERC20_PROXY_METADATA_BYTE_LENGTH) {
throw new Error(
`Could not decode ERC20 Proxy Data. Expected length of encoded data to be 21. Got ${
- encodedProxyMetadata.byteLength
+ encodedAssetData.byteLength
}`,
);
}
- const encodedAssetProxyId = encodedProxyMetadata.slice(-1);
+ const encodedAssetProxyId = encodedAssetData.slice(-1);
const assetProxyId = assetProxyUtils.decodeAssetProxyId(encodedAssetProxyId);
if (assetProxyId !== AssetProxyId.ERC20) {
throw new Error(
@@ -69,13 +69,13 @@ export const assetProxyUtils = {
const addressOffset = ERC20_PROXY_METADATA_BYTE_LENGTH - 1;
const encodedTokenAddress = encodedProxyMetadata.slice(0, addressOffset);
const tokenAddress = assetProxyUtils.decodeAddress(encodedTokenAddress);
- const erc20ProxyData = {
+ const erc20AssetData = {
assetProxyId,
tokenAddress,
};
- return erc20ProxyData;
+ return erc20AssetData;
},
- encodeERC721ProxyData(tokenAddress: string, tokenId: BigNumber, data?: string): string {
+ encodeERC721AssetData(tokenAddress: string, tokenId: BigNumber, data?: string): string {
const encodedAssetProxyId = assetProxyUtils.encodeAssetProxyId(AssetProxyId.ERC721);
const encodedAddress = assetProxyUtils.encodeAddress(tokenAddress);
const encodedTokenId = assetProxyUtils.encodeUint256(tokenId);
@@ -89,16 +89,16 @@ export const assetProxyUtils = {
const encodedMetadataHex = ethUtil.bufferToHex(encodedMetadata);
return encodedMetadataHex;
},
- decodeERC721ProxyData(proxyData: string): ERC721ProxyData {
- const encodedProxyMetadata = ethUtil.toBuffer(proxyData);
- if (encodedProxyMetadata.byteLength < ERC721_PROXY_METADATA_BYTE_LENGTH) {
+ decodeERC721AssetData(assetData: string): ERC721AssetData {
+ const encodedAssetData = ethUtil.toBuffer(assetData);
+ if (encodedAssetData.byteLength < ERC721_PROXY_METADATA_BYTE_LENGTH) {
throw new Error(
`Could not decode ERC20 Proxy Data. Expected length of encoded data to be at least 53. Got ${
- encodedProxyMetadata.byteLength
+ encodedAssetData.byteLength
}`,
);
}
- const encodedAssetProxyId = encodedProxyMetadata.slice(-1);
+ const encodedAssetProxyId = encodedAssetData.slice(-1);
const assetProxyId = assetProxyUtils.decodeAssetProxyId(encodedAssetProxyId);
if (assetProxyId !== AssetProxyId.ERC721) {
throw new Error(
@@ -115,57 +115,57 @@ export const assetProxyUtils = {
const tokenId = assetProxyUtils.decodeUint256(encodedTokenId);
const nullData = '0x';
let data = nullData;
- if (encodedProxyMetadata.byteLength > 53) {
- const encodedDataLength = encodedProxyMetadata.slice(53, 85);
+ if (encodedAssetData.byteLength > 53) {
+ const encodedDataLength = encodedAssetData.slice(53, 85);
const dataLength = assetProxyUtils.decodeUint256(encodedDataLength);
- const expectedDataLength = new BigNumber(encodedProxyMetadata.byteLength - 85);
+ const expectedDataLength = new BigNumber(encodedAssetData.byteLength - 85);
if (!dataLength.equals(expectedDataLength)) {
throw new Error(
`Data length (${dataLength}) does not match actual length of data (${expectedDataLength})`,
);
}
- const encodedData = encodedProxyMetadata.slice(85);
+ const encodedData = encodedAssetData.slice(85);
data = ethUtil.bufferToHex(encodedData);
}
- const erc721ProxyData: ERC721ProxyData = {
+ const erc721AssetData: ERC721AssetData = {
assetProxyId,
tokenAddress,
tokenId,
data,
};
- return erc721ProxyData;
+ return erc721AssetData;
},
- decodeProxyDataId(proxyData: string): AssetProxyId {
- const encodedProxyMetadata = ethUtil.toBuffer(proxyData);
- if (encodedProxyMetadata.byteLength < 1) {
+ decodeAssetDataId(assetData: string): AssetProxyId {
+ const encodedAssetData = ethUtil.toBuffer(assetData);
+ if (encodedAssetData.byteLength < 1) {
throw new Error(
`Could not decode Proxy Data. Expected length of encoded data to be at least 1. Got ${
- encodedProxyMetadata.byteLength
+ encodedAssetData.byteLength
}`,
);
}
- const encodedAssetProxyId = encodedProxyMetadata.slice(-1);
+ const encodedAssetProxyId = encodedAssetData.slice(-1);
const assetProxyId = assetProxyUtils.decodeAssetProxyId(encodedAssetProxyId);
return assetProxyId;
},
- decodeProxyData(proxyData: string): ProxyData {
- const assetProxyId = assetProxyUtils.decodeProxyDataId(proxyData);
+ decodeAssetData(assetData: string): AssetData {
+ const assetProxyId = assetProxyUtils.decodeAssetDataId(assetData);
switch (assetProxyId) {
case AssetProxyId.ERC20:
- const erc20ProxyData = assetProxyUtils.decodeERC20ProxyData(proxyData);
- const generalizedERC20ProxyData = {
+ const erc20AssetData = assetProxyUtils.decodeERC20AssetData(assetData);
+ const generalizedERC20AssetData = {
assetProxyId,
- tokenAddress: erc20ProxyData.tokenAddress,
+ tokenAddress: erc20AssetData.tokenAddress,
};
- return generalizedERC20ProxyData;
+ return generalizedERC20AssetData;
case AssetProxyId.ERC721:
- const erc721ProxyData = assetProxyUtils.decodeERC721ProxyData(proxyData);
- const generaliedERC721ProxyData = {
+ const erc721AssetData = assetProxyUtils.decodeERC721AssetData(assetData);
+ const generaliedERC721AssetData = {
assetProxyId,
- tokenAddress: erc721ProxyData.tokenAddress,
- data: erc721ProxyData.tokenId,
+ tokenAddress: erc721AssetData.tokenAddress,
+ data: erc721AssetData.tokenId,
};
- return generaliedERC721ProxyData;
+ return generaliedERC721AssetData;
default:
throw new Error(`Unrecognized asset proxy id: ${assetProxyId}`);
}