aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/contracts/package.json15
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/AssetProxyDispatcher.sol18
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/IAssetProxyDispatcher.sol14
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy.sol4
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol8
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol96
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/LibOrder.sol12
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol60
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlementProxy.sol53
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol144
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol6
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/mixins/MSettlement.sol4
-rw-r--r--packages/contracts/src/contracts/current/test/DummyERC20Token/DummyERC20Token.sol (renamed from packages/contracts/src/contracts/current/test/DummyToken/DummyToken.sol)14
-rw-r--r--packages/contracts/src/contracts/current/test/MaliciousToken/MaliciousToken.sol49
-rw-r--r--packages/contracts/src/contracts/current/test/Mintable/Mintable.sol2
-rw-r--r--packages/contracts/src/contracts/current/tokens/ERC20Token/ERC20Token.sol29
-rw-r--r--packages/contracts/src/contracts/current/tokens/ERC20Token/IERC20Token.sol (renamed from packages/contracts/src/contracts/current/tokens/Token/Token.sol)37
-rw-r--r--packages/contracts/src/contracts/current/tokens/Token/IToken.sol70
-rw-r--r--packages/contracts/src/contracts/current/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol8
-rw-r--r--packages/contracts/src/contracts/current/utils/Authorizable/Authorizable.sol5
-rw-r--r--packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol2
-rw-r--r--packages/contracts/src/contracts/previous/Token/IToken_v1.sol52
-rw-r--r--packages/contracts/src/utils/artifacts.ts8
-rw-r--r--packages/contracts/src/utils/asset_proxy_utils.ts66
-rw-r--r--packages/contracts/src/utils/balances.ts6
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts62
-rw-r--r--packages/contracts/src/utils/formatters.ts16
-rw-r--r--packages/contracts/src/utils/order_utils.ts20
-rw-r--r--packages/contracts/src/utils/types.ts21
-rw-r--r--packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts16
-rw-r--r--packages/contracts/test/asset_proxy_dispatcher/proxies.ts48
-rw-r--r--packages/contracts/test/exchange/core.ts607
-rw-r--r--packages/contracts/test/exchange/helpers.ts19
-rw-r--r--packages/contracts/test/exchange/wrapper.ts627
-rw-r--r--packages/contracts/test/tutorials/arbitrage.ts4
-rw-r--r--packages/contracts/test/unlimited_allowance_token.ts8
36 files changed, 1028 insertions, 1202 deletions
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index 78585e8e7..0cb6f3310 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -15,10 +15,13 @@
"test": "run-s build run_mocha",
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"run_mocha": "mocha 'lib/test/**/*.js' --timeout 100000 --bail --exit",
- "compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846",
- "compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir ../migrations/src/artifacts",
+ "compile:comment":
+ "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846",
+ "compile":
+ "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir ../migrations/src/artifacts",
"clean": "shx rm -rf ./lib",
- "generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
+ "generate_contract_wrappers":
+ "node ../abi-gen/lib/index.js --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
"lint": "tslint --project . 'migrations/**/*.ts' 'test/**/*.ts' 'util/**/*.ts' 'deploy/**/*.ts'",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
@@ -26,8 +29,10 @@
"test:circleci": "yarn test:coverage"
},
"config": {
- "abis": "../migrations/src/artifacts/@(DummyToken|Exchange|TokenRegistry|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TokenRegistry|ZRXToken|AssetProxyDispatcher|ERC20Proxy|ERC721Proxy|DummyERC721Token|LibBytes).json",
- "contracts": "Exchange,DummyToken,ZRXToken,Token,WETH9,MultiSigWallet,MultiSigWalletWithTimeLock,MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,MaliciousToken,TokenRegistry,AssetProxyDispatcher,ERC20Proxy,ERC721Proxy,DummyERC721Token,LibBytes"
+ "abis":
+ "../migrations/src/artifacts/@(DummyERC20Token|Exchange|TokenRegistry|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TokenRegistry|ZRXToken|AssetProxyDispatcher|ERC20Proxy|ERC721Proxy|DummyERC721Token|LibBytes).json",
+ "contracts":
+ "Exchange,DummyERC20Token,ZRXToken,WETH9,MultiSigWallet,MultiSigWalletWithTimeLock,MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,TokenRegistry,AssetProxyDispatcher,ERC20Proxy,ERC721Proxy,DummyERC721Token,LibBytes"
},
"repository": {
"type": "git",
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/AssetProxyDispatcher.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/AssetProxyDispatcher.sol
index 2c689496f..43fd7596e 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/AssetProxyDispatcher.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/AssetProxyDispatcher.sol
@@ -57,21 +57,21 @@ contract AssetProxyDispatcher is
/// An id can only be assigned to a single proxy at a given time,
/// however, an asset proxy may be registered to multiple ids.
/// @param assetProxyId Id to register`newAssetProxy` under.
- /// @param newAssetProxy asset proxy to register, or 0x0 to unset assetProxyId.
- /// @param currentAssetProxy Existing asset proxy to overwrite, or 0x0 if assetProxyId is currently unused.
+ /// @param newAssetProxy Address of new asset proxy to register, or 0x0 to unset assetProxyId.
+ /// @param oldAssetProxy Existing asset proxy to overwrite, or 0x0 if assetProxyId is currently unused.
function registerAssetProxy(
uint8 assetProxyId,
- IAssetProxy newAssetProxy,
- IAssetProxy currentAssetProxy)
+ address newAssetProxy,
+ address oldAssetProxy)
external
onlyOwner
{
// Ensure the existing asset proxy is not unintentionally overwritten
- require(currentAssetProxy == assetProxies[assetProxyId]);
+ require(oldAssetProxy == address(assetProxies[assetProxyId]));
// Add asset proxy and log registration
- assetProxies[assetProxyId] = newAssetProxy;
- emit AssetProxySet(assetProxyId, newAssetProxy, currentAssetProxy);
+ assetProxies[assetProxyId] = IAssetProxy(newAssetProxy);
+ emit AssetProxySet(assetProxyId, newAssetProxy, oldAssetProxy);
}
/// @dev Gets an asset proxy.
@@ -79,9 +79,9 @@ contract AssetProxyDispatcher is
/// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.
function getAssetProxy(uint8 assetProxyId)
external view
- returns (IAssetProxy)
+ returns (address)
{
IAssetProxy assetProxy = assetProxies[assetProxyId];
- return assetProxy;
+ return address(assetProxy);
}
}
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/IAssetProxyDispatcher.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/IAssetProxyDispatcher.sol
index 044983823..88bc0d353 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/IAssetProxyDispatcher.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/IAssetProxyDispatcher.sol
@@ -31,20 +31,20 @@ contract IAssetProxyDispatcher is
// Logs registration of new asset proxy
event AssetProxySet(
uint8 id,
- IAssetProxy newAssetClassAddress,
- IAssetProxy oldAssetClassAddress
+ address newAssetProxy,
+ address oldAssetProxy
);
/// @dev Registers an asset proxy to an asset proxy id.
/// An id can only be assigned to a single proxy at a given time,
/// however, an asset proxy may be registered to multiple ids.
/// @param assetProxyId Id to register`newAssetProxy` under.
- /// @param newAssetProxy asset proxy to register, or 0x0 to unset assetProxyId.
- /// @param currentAssetProxy Existing asset proxy to overwrite, or 0x0 if assetProxyId is currently unused.
+ /// @param newAssetProxy Address of new asset proxy to register, or 0x0 to unset assetProxyId.
+ /// @param oldAssetProxy Existing asset proxy to overwrite, or 0x0 if assetProxyId is currently unused.
function registerAssetProxy(
uint8 assetProxyId,
- IAssetProxy newAssetProxy,
- IAssetProxy currentAssetProxy)
+ address newAssetProxy,
+ address oldAssetProxy)
external;
/// @dev Gets an asset proxy.
@@ -52,5 +52,5 @@ contract IAssetProxyDispatcher is
/// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.
function getAssetProxy(uint8 assetProxyId)
external view
- returns (IAssetProxy);
+ returns (address);
}
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy.sol
index e785bd26d..eef3a39db 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy.sol
@@ -21,7 +21,7 @@ pragma solidity ^0.4.21;
import "../IAssetProxy.sol";
import "../../../utils/LibBytes/LibBytes.sol";
import "../../../utils/Authorizable/Authorizable.sol";
-import { Token_v1 as ERC20Token } from "../../../../previous/Token/Token_v1.sol";
+import "../../../tokens/ERC20Token/IERC20Token.sol";
contract ERC20Proxy is
LibBytes,
@@ -44,7 +44,7 @@ contract ERC20Proxy is
{
require(assetMetadata.length == 21);
address token = readAddress(assetMetadata, 1);
- bool success = ERC20Token(token).transferFrom(from, to, amount);
+ bool success = IERC20Token(token).transferFrom(from, to, amount);
require(success == true);
}
}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol b/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol
index 91136b29f..995cbcf76 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol
@@ -23,7 +23,6 @@ import "./MixinExchangeCore.sol";
import "./MixinSignatureValidator.sol";
import "./MixinSettlementProxy.sol";
import "./MixinWrapperFunctions.sol";
-import "../AssetProxyDispatcher/IAssetProxyDispatcher.sol";
contract Exchange is
MixinExchangeCore,
@@ -34,13 +33,12 @@ contract Exchange is
string constant public VERSION = "2.0.1-alpha";
function Exchange(
- IToken _zrxToken,
- bytes _zrxProxyData,
- IAssetProxy _assetProxyDispatcher)
+ address _assetProxyDispatcher,
+ bytes memory _zrxProxyData)
public
MixinExchangeCore()
MixinSignatureValidator()
- MixinSettlementProxy(_assetProxyDispatcher, _zrxToken, _zrxProxyData)
+ MixinSettlementProxy(_assetProxyDispatcher, _zrxProxyData)
MixinWrapperFunctions()
{}
}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol b/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
index 3af51e915..ef2fb2a96 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
@@ -37,8 +37,8 @@ contract IExchange {
address indexed feeRecipient,
bytes makerAssetData,
bytes takerAssetData,
- uint256 makerTokenFilledAmount,
- uint256 takerTokenFilledAmount,
+ uint256 makerAssetFilledAmount,
+ uint256 takerAssetFilledAmount,
uint256 makerFeePaid,
uint256 takerFeePaid,
bytes32 indexed orderHash
@@ -49,8 +49,8 @@ contract IExchange {
address indexed feeRecipient,
bytes makerAssetData,
bytes takerAssetData,
- uint256 makerTokenCancelledAmount,
- uint256 takerTokenCancelledAmount,
+ uint256 makerAssetCancelledAmount,
+ uint256 takerAssetCancelledAmount,
bytes32 indexed orderHash
);
@@ -77,9 +77,9 @@ contract IExchange {
/// @dev Calculates the sum of values already filled and cancelled for a given order.
/// @param orderHash The Keccak-256 hash of the given order.
/// @return Sum of values already filled and cancelled.
- function getUnavailableTakerTokenAmount(bytes32 orderHash)
+ function getUnavailableTakerAssetAmount(bytes32 orderHash)
public view
- returns (uint256 unavailableTakerTokenAmount);
+ returns (uint256 unavailableTakerAssetAmount);
/// @dev Calculates partial value given a numerator and denominator.
/// @param numerator Numerator.
@@ -100,8 +100,8 @@ contract IExchange {
returns (bool isError);
/// @dev Calculates Keccak-256 hash of order with specified parameters.
- /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient.
- /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
+ /// @param orderAddresses Array of order's maker, taker, makerAsset, takerAsset, and feeRecipient.
+ /// @param orderValues Array of order's makerAssetAmount, takerAssetAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
/// @return Keccak-256 hash of order.
function getOrderHash(address[5] orderAddresses, uint256[6] orderValues)
public view
@@ -124,34 +124,34 @@ contract IExchange {
returns (bool isValid);
/// @dev Fills the input order.
- /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient.
- /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
- /// @param takerTokenFillAmount Desired amount of takerToken to fill.
+ /// @param orderAddresses Array of order's maker, taker, makerAsset, takerAsset, and feeRecipient.
+ /// @param orderValues Array of order's makerAssetAmount, takerAssetAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to fill.
/// @param v ECDSA signature parameter v.
/// @param r ECDSA signature parameters r.
/// @param s ECDSA signature parameters s.
- /// @return Total amount of takerToken filled in trade.
+ /// @return Total amount of takerAsset filled in trade.
function fillOrder(
address[5] orderAddresses,
uint256[6] orderValues,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
uint8 v,
bytes32 r,
bytes32 s)
public
- returns (uint256 takerTokenFilledAmount);
+ returns (uint256 takerAssetFilledAmount);
/// @dev Cancels the input order.
- /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient.
- /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
- /// @param takerTokenCancelAmount Desired amount of takerToken to cancel in order.
- /// @return Amount of takerToken cancelled.
+ /// @param orderAddresses Array of order's maker, taker, makerAsset, takerAsset, and feeRecipient.
+ /// @param orderValues Array of order's makerAssetAmount, takerAssetAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
+ /// @param takerAssetCancelAmount Desired amount of takerAsset to cancel in order.
+ /// @return Amount of takerAsset cancelled.
function cancelOrder(
address[5] orderAddresses,
uint256[6] orderValues,
- uint256 takerTokenCancelAmount)
+ uint256 takerAssetCancelAmount)
public
- returns (uint256 takerTokenCancelledAmount);
+ returns (uint256 takerAssetCancelledAmount);
/// @dev Cancels all orders for a specified maker up to a certain time.
/// @param salt Orders created with a salt less or equal to this value will be cancelled.
@@ -159,51 +159,51 @@ contract IExchange {
external;
/// @dev Fills an order with specified parameters and ECDSA signature. Throws if specified amount not filled entirely.
- /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient.
- /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
- /// @param takerTokenFillAmount Desired amount of takerToken to fill.
+ /// @param orderAddresses Array of order's maker, taker, makerAsset, takerAsset, and feeRecipient.
+ /// @param orderValues Array of order's makerAssetAmount, takerAssetAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to fill.
/// @param v ECDSA signature parameter v.
/// @param r ECDSA signature parameters r.
/// @param s ECDSA signature parameters s.
function fillOrKillOrder(
address[5] orderAddresses,
uint256[6] orderValues,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
uint8 v,
bytes32 r,
bytes32 s)
public;
/// @dev Fills an order with specified parameters and ECDSA signature. Returns false if the transaction would otherwise revert.
- /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient.
- /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
- /// @param takerTokenFillAmount Desired amount of takerToken to fill.
+ /// @param orderAddresses Array of order's maker, taker, makerAsset, takerAsset, and feeRecipient.
+ /// @param orderValues Array of order's makerAssetAmount, takerAssetAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to fill.
/// @param v ECDSA signature parameter v.
/// @param r ECDSA signature parameters r.
/// @param s ECDSA signature parameters s.
/// @return Success if the transaction did not revert.
- /// @return Total amount of takerToken filled in trade.
+ /// @return Total amount of takerAsset filled in trade.
function fillOrderNoThrow(
address[5] orderAddresses,
uint256[6] orderValues,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
uint8 v,
bytes32 r,
bytes32 s)
public
- returns (bool success, uint256 takerTokenFilledAmount);
+ returns (bool success, uint256 takerAssetFilledAmount);
/// @dev Synchronously executes multiple calls of fillOrder in a single transaction.
/// @param orderAddresses Array of address arrays containing individual order addresses.
/// @param orderValues Array of uint256 arrays containing individual order values.
- /// @param takerTokenFillAmounts Array of desired amounts of takerToken to fill in orders.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to fill in orders.
/// @param v Array ECDSA signature v parameters.
/// @param r Array of ECDSA signature r parameters.
/// @param s Array of ECDSA signature s parameters.
function batchFillOrders(
address[5][] orderAddresses,
uint256[6][] orderValues,
- uint256[] takerTokenFillAmounts,
+ uint256[] takerAssetFillAmounts,
uint8[] v,
bytes32[] r,
bytes32[] s)
@@ -212,14 +212,14 @@ contract IExchange {
/// @dev Synchronously executes multiple calls of fillOrKill in a single transaction.
/// @param orderAddresses Array of address arrays containing individual order addresses.
/// @param orderValues Array of uint256 arrays containing individual order values.
- /// @param takerTokenFillAmounts Array of desired amounts of takerToken to fill in orders.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to fill in orders.
/// @param v Array ECDSA signature v parameters.
/// @param r Array of ECDSA signature r parameters.
/// @param s Array of ECDSA signature s parameters.
function batchFillOrKillOrders(
address[5][] orderAddresses,
uint256[6][] orderValues,
- uint256[] takerTokenFillAmounts,
+ uint256[] takerAssetFillAmounts,
uint8[] v,
bytes32[] r,
bytes32[] s)
@@ -228,62 +228,62 @@ contract IExchange {
/// @dev Synchronously executes multiple calls of fillOrderNoThrow in a single transaction.
/// @param orderAddresses Array of address arrays containing individual order addresses.
/// @param orderValues Array of uint256 arrays containing individual order values.
- /// @param takerTokenFillAmounts Array of desired amounts of takerToken to fill in orders.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to fill in orders.
/// @param v Array ECDSA signature v parameters.
/// @param r Array of ECDSA signature r parameters.
/// @param s Array of ECDSA signature s parameters.
function batchFillOrdersNoThrow(
address[5][] orderAddresses,
uint256[6][] orderValues,
- uint256[] takerTokenFillAmounts,
+ uint256[] takerAssetFillAmounts,
uint8[] v,
bytes32[] r,
bytes32[] s)
external;
- /// @dev Synchronously executes multiple fill orders in a single transaction until total takerTokenFillAmount filled.
+ /// @dev Synchronously executes multiple fill orders in a single transaction until total takerAssetFillAmount filled.
/// @param orderAddresses Array of address arrays containing individual order addresses.
/// @param orderValues Array of uint256 arrays containing individual order values.
- /// @param takerTokenFillAmount Desired total amount of takerToken to fill in orders.
+ /// @param takerAssetFillAmount Desired total amount of takerAsset to fill in orders.
/// @param v Array ECDSA signature v parameters.
/// @param r Array of ECDSA signature r parameters.
/// @param s Array of ECDSA signature s parameters.
- /// @return Total amount of takerTokenFillAmount filled in orders.
+ /// @return Total amount of takerAssetFillAmount filled in orders.
function marketFillOrders(
address[5][] orderAddresses,
uint256[6][] orderValues,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
uint8[] v,
bytes32[] r,
bytes32[] s)
external
- returns (uint256 totalTakerTokenFilledAmount);
+ returns (uint256 totalTakerAssetFilledAmount);
- /// @dev Synchronously executes multiple calls of fillOrderNoThrow in a single transaction until total takerTokenFillAmount filled.
+ /// @dev Synchronously executes multiple calls of fillOrderNoThrow in a single transaction until total takerAssetFillAmount filled.
/// @param orderAddresses Array of address arrays containing individual order addresses.
/// @param orderValues Array of uint256 arrays containing individual order values.
- /// @param takerTokenFillAmount Desired total amount of takerToken to fill in orders.
+ /// @param takerAssetFillAmount Desired total amount of takerAsset to fill in orders.
/// @param v Array ECDSA signature v parameters.
/// @param r Array of ECDSA signature r parameters.
/// @param s Array of ECDSA signature s parameters.
- /// @return Total amount of takerTokenFillAmount filled in orders.
+ /// @return Total amount of takerAssetFillAmount filled in orders.
function marketFillOrdersNoThrow(
address[5][] orderAddresses,
uint256[6][] orderValues,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
uint8[] v,
bytes32[] r,
bytes32[] s)
external
- returns (uint256 totalTakerTokenFilledAmount);
+ returns (uint256 totalTakerAssetFilledAmount);
/// @dev Synchronously cancels multiple orders in a single transaction.
/// @param orderAddresses Array of address arrays containing individual order addresses.
/// @param orderValues Array of uint256 arrays containing individual order values.
- /// @param takerTokenCancelAmounts Array of desired amounts of takerToken to cancel in orders.
+ /// @param takerAssetCancelAmounts Array of desired amounts of takerAsset to cancel in orders.
function batchCancelOrders(
address[5][] orderAddresses,
uint256[6][] orderValues,
- uint256[] takerTokenCancelAmounts)
+ uint256[] takerAssetCancelAmounts)
external;
}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/LibOrder.sol b/packages/contracts/src/contracts/current/protocol/Exchange/LibOrder.sol
index d47a0fbbe..61a4a382d 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/LibOrder.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/LibOrder.sol
@@ -26,8 +26,8 @@ contract LibOrder {
"address makerAddress",
"address takerAddress",
"address feeRecipientAddress",
- "uint256 makerTokenAmount",
- "uint256 takerTokenAmount",
+ "uint256 makerAssetAmount",
+ "uint256 takerAssetAmount",
"uint256 makerFee",
"uint256 takerFee",
"uint256 expirationTimeSeconds",
@@ -40,8 +40,8 @@ contract LibOrder {
address makerAddress;
address takerAddress;
address feeRecipientAddress;
- uint256 makerTokenAmount;
- uint256 takerTokenAmount;
+ uint256 makerAssetAmount;
+ uint256 takerAssetAmount;
uint256 makerFee;
uint256 takerFee;
uint256 expirationTimeSeconds;
@@ -66,8 +66,8 @@ contract LibOrder {
order.makerAddress,
order.takerAddress,
order.feeRecipientAddress,
- order.makerTokenAmount,
- order.takerTokenAmount,
+ order.makerAssetAmount,
+ order.takerAssetAmount,
order.makerFee,
order.takerFee,
order.expirationTimeSeconds,
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
index ec1bd57ce..710315515 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
@@ -39,7 +39,7 @@ contract MixinExchangeCore is
LibErrors,
LibPartialAmount
{
- // Mapping of orderHash => amount of takerToken already bought by maker
+ // Mapping of orderHash => amount of takerAsset already bought by maker
mapping (bytes32 => uint256) public filled;
// Mapping of orderHash => cancelled
@@ -53,21 +53,21 @@ contract MixinExchangeCore is
address indexed makerAddress,
address takerAddress,
address indexed feeRecipientAddress,
- bytes makerAssetData,
- bytes takerAssetData,
- uint256 makerTokenFilledAmount,
- uint256 takerTokenFilledAmount,
+ uint256 makerAssetFilledAmount,
+ uint256 takerAssetFilledAmount,
uint256 makerFeePaid,
uint256 takerFeePaid,
- bytes32 indexed orderHash
+ bytes32 indexed orderHash,
+ bytes makerAssetData,
+ bytes takerAssetData
);
event Cancel(
address indexed makerAddress,
address indexed feeRecipientAddress,
+ bytes32 indexed orderHash,
bytes makerAssetData,
- bytes takerAssetData,
- bytes32 indexed orderHash
+ bytes takerAssetData
);
event CancelUpTo(
@@ -81,12 +81,12 @@ contract MixinExchangeCore is
/// @dev Fills the input order.
/// @param order Order struct containing order specifications.
- /// @param takerTokenFillAmount Desired amount of takerToken to sell.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
/// @param signature Proof that order has been created by maker.
/// @return Amounts filled and fees paid by maker and taker.
function fillOrder(
Order memory order,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
bytes memory signature)
public
returns (FillResults memory fillResults)
@@ -109,8 +109,8 @@ contract MixinExchangeCore is
// Validate order and maker only if first time seen
// TODO: Read filled and cancelled only once
if (filled[orderHash] == 0) {
- require(order.makerTokenAmount > 0);
- require(order.takerTokenAmount > 0);
+ require(order.makerAssetAmount > 0);
+ require(order.takerAssetAmount > 0);
require(isValidSignature(orderHash, order.makerAddress, signature));
}
@@ -118,7 +118,7 @@ contract MixinExchangeCore is
if (order.takerAddress != address(0)) {
require(order.takerAddress == msg.sender);
}
- require(takerTokenFillAmount > 0);
+ require(takerAssetFillAmount > 0);
// Validate order expiration
if (block.timestamp >= order.expirationTimeSeconds) {
@@ -127,39 +127,39 @@ contract MixinExchangeCore is
}
// Validate order availability
- uint256 remainingTakerTokenFillAmount = safeSub(order.takerTokenAmount, filled[orderHash]);
- if (remainingTakerTokenFillAmount == 0) {
+ uint256 remainingTakerAssetFillAmount = safeSub(order.takerAssetAmount, filled[orderHash]);
+ if (remainingTakerAssetFillAmount == 0) {
emit ExchangeError(uint8(Errors.ORDER_FULLY_FILLED), orderHash);
return fillResults;
}
// Validate fill order rounding
- fillResults.takerTokenFilledAmount = min256(takerTokenFillAmount, remainingTakerTokenFillAmount);
- if (isRoundingError(fillResults.takerTokenFilledAmount, order.takerTokenAmount, order.makerTokenAmount)) {
+ fillResults.takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetFillAmount);
+ if (isRoundingError(fillResults.takerAssetFilledAmount, order.takerAssetAmount, order.makerAssetAmount)) {
emit ExchangeError(uint8(Errors.ROUNDING_ERROR_TOO_LARGE), orderHash);
- fillResults.takerTokenFilledAmount = 0;
+ fillResults.takerAssetFilledAmount = 0;
return fillResults;
}
// Update state
- filled[orderHash] = safeAdd(filled[orderHash], fillResults.takerTokenFilledAmount);
+ filled[orderHash] = safeAdd(filled[orderHash], fillResults.takerAssetFilledAmount);
// Settle order
- (fillResults.makerTokenFilledAmount, fillResults.makerFeePaid, fillResults.takerFeePaid) =
- settleOrder(order, msg.sender, fillResults.takerTokenFilledAmount);
+ (fillResults.makerAssetFilledAmount, fillResults.makerFeePaid, fillResults.takerFeePaid) =
+ settleOrder(order, msg.sender, fillResults.takerAssetFilledAmount);
// Log order
emit Fill(
order.makerAddress,
msg.sender,
order.feeRecipientAddress,
- order.makerAssetData,
- order.takerAssetData,
- fillResults.makerTokenFilledAmount,
- fillResults.takerTokenFilledAmount,
+ fillResults.makerAssetFilledAmount,
+ fillResults.takerAssetFilledAmount,
fillResults.makerFeePaid,
fillResults.takerFeePaid,
- orderHash
+ orderHash,
+ order.makerAssetData,
+ order.takerAssetData
);
return fillResults;
}
@@ -176,8 +176,8 @@ contract MixinExchangeCore is
bytes32 orderHash = getOrderHash(order);
// Validate the order
- require(order.makerTokenAmount > 0);
- require(order.takerTokenAmount > 0);
+ require(order.makerAssetAmount > 0);
+ require(order.takerAssetAmount > 0);
require(order.makerAddress == msg.sender);
if (block.timestamp >= order.expirationTimeSeconds) {
@@ -195,9 +195,9 @@ contract MixinExchangeCore is
emit Cancel(
order.makerAddress,
order.feeRecipientAddress,
+ orderHash,
order.makerAssetData,
- order.takerAssetData,
- orderHash
+ order.takerAssetData
);
return true;
}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlementProxy.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlementProxy.sol
index e8a7a148f..5fff2cd60 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlementProxy.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlementProxy.sol
@@ -20,7 +20,6 @@ pragma solidity ^0.4.21;
pragma experimental ABIEncoderV2;
import "./mixins/MSettlement.sol";
-import "../../tokens/Token/IToken.sol";
import "./LibPartialAmount.sol";
import "../AssetProxyDispatcher/IAssetProxy.sol";
@@ -29,70 +28,60 @@ contract MixinSettlementProxy is
MSettlement,
LibPartialAmount
{
- IAssetProxy TRANSFER_PROXY;
+ IAssetProxy ASSET_PROXY_DISPATCHER;
bytes ZRX_PROXY_DATA;
- IToken ZRX_TOKEN;
- function transferProxy()
+ function assetProxyDispatcher()
public view
- returns (IAssetProxy)
+ returns (address)
{
- return TRANSFER_PROXY;
- }
-
- function zrxToken()
- external view
- returns (IToken)
- {
- return ZRX_TOKEN;
+ return address(ASSET_PROXY_DISPATCHER);
}
function zrxProxyData()
external view
- returns (bytes)
+ returns (bytes memory)
{
return ZRX_PROXY_DATA;
}
function MixinSettlementProxy(
- IAssetProxy assetProxyDispatcherContract,
- IToken zrxToken,
- bytes zrxProxyData)
+ address _assetProxyDispatcher,
+ bytes memory _zrxProxyData)
public
{
- ZRX_TOKEN = zrxToken;
- TRANSFER_PROXY = assetProxyDispatcherContract;
- ZRX_PROXY_DATA = zrxProxyData;
+ ASSET_PROXY_DISPATCHER = IAssetProxy(_assetProxyDispatcher);
+ ZRX_PROXY_DATA = _zrxProxyData;
}
function settleOrder(
Order memory order,
address takerAddress,
- uint256 takerTokenFilledAmount)
+ uint256 takerAssetFilledAmount)
internal
returns (
- uint256 makerTokenFilledAmount,
+ uint256 makerAssetFilledAmount,
uint256 makerFeePaid,
uint256 takerFeePaid
)
{
- makerTokenFilledAmount = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.makerTokenAmount);
- TRANSFER_PROXY.transferFrom(
+ makerAssetFilledAmount = getPartialAmount(takerAssetFilledAmount, order.takerAssetAmount, order.makerAssetAmount);
+ ASSET_PROXY_DISPATCHER.transferFrom(
order.makerAssetData,
order.makerAddress,
takerAddress,
- makerTokenFilledAmount
+ makerAssetFilledAmount
);
- TRANSFER_PROXY.transferFrom(
+ ASSET_PROXY_DISPATCHER.transferFrom(
order.takerAssetData,
takerAddress,
order.makerAddress,
- takerTokenFilledAmount
+ takerAssetFilledAmount
);
if (order.feeRecipientAddress != address(0)) {
if (order.makerFee > 0) {
- makerFeePaid = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.makerFee);
- TRANSFER_PROXY.transferFrom(
+ makerFeePaid = getPartialAmount(takerAssetFilledAmount, order.takerAssetAmount, order.makerFee);
+ ASSET_PROXY_DISPATCHER.transferFrom(
ZRX_PROXY_DATA,
order.makerAddress,
order.feeRecipientAddress,
@@ -100,8 +89,8 @@ contract MixinSettlementProxy is
);
}
if (order.takerFee > 0) {
- takerFeePaid = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.takerFee);
- TRANSFER_PROXY.transferFrom(
+ takerFeePaid = getPartialAmount(takerAssetFilledAmount, order.takerAssetAmount, order.takerFee);
+ ASSET_PROXY_DISPATCHER.transferFrom(
ZRX_PROXY_DATA,
takerAddress,
order.feeRecipientAddress,
@@ -109,6 +98,6 @@ contract MixinSettlementProxy is
);
}
}
- return (makerTokenFilledAmount, makerFeePaid, takerFeePaid);
+ return (makerAssetFilledAmount, makerFeePaid, takerFeePaid);
}
}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
index 027fcd87f..2c0fd0751 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
@@ -31,35 +31,35 @@ contract MixinWrapperFunctions is
LibBytes,
LibPartialAmount
{
- /// @dev Fills the input order. Reverts if exact takerTokenFillAmount not filled.
+ /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
/// @param order Order struct containing order specifications.
- /// @param takerTokenFillAmount Desired amount of takerToken to sell.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
/// @param signature Proof that order has been created by maker.
function fillOrKillOrder(
Order memory order,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
bytes memory signature)
public
returns (FillResults memory fillResults)
{
fillResults = fillOrder(
order,
- takerTokenFillAmount,
+ takerAssetFillAmount,
signature
);
- require(fillResults.takerTokenFilledAmount == takerTokenFillAmount);
+ require(fillResults.takerAssetFilledAmount == takerAssetFillAmount);
return fillResults;
}
/// @dev Fills an order with specified parameters and ECDSA signature.
/// Returns false if the transaction would otherwise revert.
/// @param order Order struct containing order specifications.
- /// @param takerTokenFillAmount Desired amount of takerToken to sell.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
/// @param signature Proof that order has been created by maker.
/// @return Amounts filled and fees paid by maker and taker.
function fillOrderNoThrow(
Order memory order,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
bytes memory signature)
public
returns (FillResults memory fillResults)
@@ -73,14 +73,14 @@ contract MixinWrapperFunctions is
// | Header | 0x00 | 4 | function selector |
// | Params | | 3 * 32 | function parameters: |
// | | 0x00 | | 1. offset to order (*) |
- // | | 0x20 | | 2. takerTokenFillAmount |
+ // | | 0x20 | | 2. takerAssetFillAmount |
// | | 0x40 | | 3. offset to signature (*) |
// | Data | | 11 * 32 | order: |
// | | 0x000 | | 1. makerAddress |
// | | 0x020 | | 2. takerAddress |
// | | 0x040 | | 3. feeRecipientAddress |
- // | | 0x060 | | 4. makerTokenAmount |
- // | | 0x080 | | 5. takerTokenAmount |
+ // | | 0x060 | | 4. makerAssetAmount |
+ // | | 0x080 | | 5. takerAssetAmount |
// | | 0x0A0 | | 6. makerFeeAmount |
// | | 0x0C0 | | 7. takerFeeAmount |
// | | 0x0E0 | | 8. expirationTimeSeconds |
@@ -150,8 +150,8 @@ contract MixinWrapperFunctions is
mstore(dataAreaEnd, mload(sourceOffset)) // makerAddress
mstore(add(dataAreaEnd, 0x20), mload(add(sourceOffset, 0x20))) // takerAddress
mstore(add(dataAreaEnd, 0x40), mload(add(sourceOffset, 0x40))) // feeRecipientAddress
- mstore(add(dataAreaEnd, 0x60), mload(add(sourceOffset, 0x60))) // makerTokenAmount
- mstore(add(dataAreaEnd, 0x80), mload(add(sourceOffset, 0x80))) // takerTokenAmount
+ mstore(add(dataAreaEnd, 0x60), mload(add(sourceOffset, 0x60))) // makerAssetAmount
+ mstore(add(dataAreaEnd, 0x80), mload(add(sourceOffset, 0x80))) // takerAssetAmount
mstore(add(dataAreaEnd, 0xA0), mload(add(sourceOffset, 0xA0))) // makerFeeAmount
mstore(add(dataAreaEnd, 0xC0), mload(add(sourceOffset, 0xC0))) // takerFeeAmount
mstore(add(dataAreaEnd, 0xE0), mload(add(sourceOffset, 0xE0))) // expirationTimeSeconds
@@ -199,8 +199,8 @@ contract MixinWrapperFunctions is
sourceOffset := add(sourceOffset, 0x20)
}
- /////// Write takerTokenFillAmount ///////
- mstore(paramsAreaOffset, takerTokenFillAmount)
+ /////// Write takerAssetFillAmount ///////
+ mstore(paramsAreaOffset, takerAssetFillAmount)
paramsAreaOffset := add(paramsAreaOffset, 0x20)
/////// Write signature ///////
@@ -252,18 +252,18 @@ contract MixinWrapperFunctions is
/// @dev Synchronously executes multiple calls of fillOrder.
/// @param orders Array of order specifications.
- /// @param takerTokenFillAmounts Array of desired amounts of takerToken to sell in orders.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
/// @param signatures Proofs that orders have been created by makers.
function batchFillOrders(
Order[] memory orders,
- uint256[] memory takerTokenFillAmounts,
+ uint256[] memory takerAssetFillAmounts,
bytes[] memory signatures)
public
{
for (uint256 i = 0; i < orders.length; i++) {
fillOrder(
orders[i],
- takerTokenFillAmounts[i],
+ takerAssetFillAmounts[i],
signatures[i]
);
}
@@ -271,18 +271,18 @@ contract MixinWrapperFunctions is
/// @dev Synchronously executes multiple calls of fillOrKill.
/// @param orders Array of order specifications.
- /// @param takerTokenFillAmounts Array of desired amounts of takerToken to sell in orders.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
/// @param signatures Proofs that orders have been created by makers.
function batchFillOrKillOrders(
Order[] memory orders,
- uint256[] memory takerTokenFillAmounts,
+ uint256[] memory takerAssetFillAmounts,
bytes[] memory signatures)
public
{
for (uint256 i = 0; i < orders.length; i++) {
fillOrKillOrder(
orders[i],
- takerTokenFillAmounts[i],
+ takerAssetFillAmounts[i],
signatures[i]
);
}
@@ -291,31 +291,31 @@ contract MixinWrapperFunctions is
/// @dev Fills an order with specified parameters and ECDSA signature.
/// Returns false if the transaction would otherwise revert.
/// @param orders Array of order specifications.
- /// @param takerTokenFillAmounts Array of desired amounts of takerToken to sell in orders.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
/// @param signatures Proofs that orders have been created by makers.
function batchFillOrdersNoThrow(
Order[] memory orders,
- uint256[] memory takerTokenFillAmounts,
+ uint256[] memory takerAssetFillAmounts,
bytes[] memory signatures)
public
{
for (uint256 i = 0; i < orders.length; i++) {
fillOrderNoThrow(
orders[i],
- takerTokenFillAmounts[i],
+ takerAssetFillAmounts[i],
signatures[i]
);
}
}
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerToken is sold by taker.
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.
/// @param orders Array of order specifications.
- /// @param takerTokenFillAmount Desired amount of takerToken to sell.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
/// @param signatures Proofs that orders have been created by makers.
/// @return Amounts filled and fees paid by makers and taker.
function marketSellOrders(
Order[] memory orders,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
bytes[] memory signatures)
public
returns (FillResults memory totalFillResults)
@@ -325,36 +325,36 @@ contract MixinWrapperFunctions is
// Token being sold by taker must be the same for each order
require(areBytesEqual(orders[i].takerAssetData, orders[0].takerAssetData));
- // Calculate the remaining amount of takerToken to sell
- uint256 remainingTakerTokenFillAmount = safeSub(takerTokenFillAmount, totalFillResults.takerTokenFilledAmount);
+ // Calculate the remaining amount of takerAsset to sell
+ uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
- // Attempt to sell the remaining amount of takerToken
+ // Attempt to sell the remaining amount of takerAsset
FillResults memory singleFillResults = fillOrder(
orders[i],
- remainingTakerTokenFillAmount,
+ remainingTakerAssetFillAmount,
signatures[i]
);
// Update amounts filled and fees paid by maker and taker
addFillResults(totalFillResults, singleFillResults);
- // Stop execution if the entire amount of takerToken has been sold
- if (totalFillResults.takerTokenFilledAmount == takerTokenFillAmount) {
+ // Stop execution if the entire amount of takerAsset has been sold
+ if (totalFillResults.takerAssetFilledAmount == takerAssetFillAmount) {
break;
}
}
return totalFillResults;
}
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerToken is sold by taker.
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.
/// Returns false if the transaction would otherwise revert.
/// @param orders Array of order specifications.
- /// @param takerTokenFillAmount Desired amount of takerToken to sell.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
/// @param signatures Proofs that orders have been signed by makers.
/// @return Amounts filled and fees paid by makers and taker.
function marketSellOrdersNoThrow(
Order[] memory orders,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
bytes[] memory signatures)
public
returns (FillResults memory totalFillResults)
@@ -364,35 +364,35 @@ contract MixinWrapperFunctions is
// Token being sold by taker must be the same for each order
require(areBytesEqual(orders[i].takerAssetData, orders[0].takerAssetData));
- // Calculate the remaining amount of takerToken to sell
- uint256 remainingTakerTokenFillAmount = safeSub(takerTokenFillAmount, totalFillResults.takerTokenFilledAmount);
+ // Calculate the remaining amount of takerAsset to sell
+ uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
- // Attempt to sell the remaining amount of takerToken
+ // Attempt to sell the remaining amount of takerAsset
FillResults memory singleFillResults = fillOrderNoThrow(
orders[i],
- remainingTakerTokenFillAmount,
+ remainingTakerAssetFillAmount,
signatures[i]
);
// Update amounts filled and fees paid by maker and taker
addFillResults(totalFillResults, singleFillResults);
- // Stop execution if the entire amount of takerToken has been sold
- if (totalFillResults.takerTokenFilledAmount == takerTokenFillAmount) {
+ // Stop execution if the entire amount of takerAsset has been sold
+ if (totalFillResults.takerAssetFilledAmount == takerAssetFillAmount) {
break;
}
}
return totalFillResults;
}
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerToken is bought by taker.
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.
/// @param orders Array of order specifications.
- /// @param makerTokenFillAmount Desired amount of makerToken to buy.
+ /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
/// @param signatures Proofs that orders have been signed by makers.
/// @return Amounts filled and fees paid by makers and taker.
function marketBuyOrders(
Order[] memory orders,
- uint256 makerTokenFillAmount,
+ uint256 makerAssetFillAmount,
bytes[] memory signatures)
public
returns (FillResults memory totalFillResults)
@@ -402,29 +402,29 @@ contract MixinWrapperFunctions is
// Token being bought by taker must be the same for each order
require(areBytesEqual(orders[i].makerAssetData, orders[0].makerAssetData));
- // Calculate the remaining amount of makerToken to buy
- uint256 remainingMakerTokenFillAmount = safeSub(makerTokenFillAmount, totalFillResults.makerTokenFilledAmount);
+ // Calculate the remaining amount of makerAsset to buy
+ uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
- // Convert the remaining amount of makerToken to buy into remaining amount
- // of takerToken to sell, assuming entire amount can be sold in the current order
- uint256 remainingTakerTokenFillAmount = getPartialAmount(
- orders[i].takerTokenAmount,
- orders[i].makerTokenAmount,
- remainingMakerTokenFillAmount
+ // Convert the remaining amount of makerAsset to buy into remaining amount
+ // of takerAsset to sell, assuming entire amount can be sold in the current order
+ uint256 remainingTakerAssetFillAmount = getPartialAmount(
+ orders[i].takerAssetAmount,
+ orders[i].makerAssetAmount,
+ remainingMakerAssetFillAmount
);
- // Attempt to sell the remaining amount of takerToken
+ // Attempt to sell the remaining amount of takerAsset
FillResults memory singleFillResults = fillOrder(
orders[i],
- remainingTakerTokenFillAmount,
+ remainingTakerAssetFillAmount,
signatures[i]
);
// Update amounts filled and fees paid by maker and taker
addFillResults(totalFillResults, singleFillResults);
- // Stop execution if the entire amount of makerToken has been bought
- if (totalFillResults.makerTokenFilledAmount == makerTokenFillAmount) {
+ // Stop execution if the entire amount of makerAsset has been bought
+ if (totalFillResults.makerAssetFilledAmount == makerAssetFillAmount) {
break;
}
}
@@ -434,12 +434,12 @@ contract MixinWrapperFunctions is
/// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.
/// Returns false if the transaction would otherwise revert.
/// @param orders Array of order specifications.
- /// @param makerTokenFillAmount Desired amount of makerToken to buy.
+ /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
/// @param signatures Proofs that orders have been signed by makers.
/// @return Amounts filled and fees paid by makers and taker.
function marketBuyOrdersNoThrow(
Order[] memory orders,
- uint256 makerTokenFillAmount,
+ uint256 makerAssetFillAmount,
bytes[] memory signatures)
public
returns (FillResults memory totalFillResults)
@@ -449,29 +449,29 @@ contract MixinWrapperFunctions is
// Token being bought by taker must be the same for each order
require(areBytesEqual(orders[i].makerAssetData, orders[0].makerAssetData));
- // Calculate the remaining amount of makerToken to buy
- uint256 remainingMakerTokenFillAmount = safeSub(makerTokenFillAmount, totalFillResults.makerTokenFilledAmount);
+ // Calculate the remaining amount of makerAsset to buy
+ uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
- // Convert the remaining amount of makerToken to buy into remaining amount
- // of takerToken to sell, assuming entire amount can be sold in the current order
- uint256 remainingTakerTokenFillAmount = getPartialAmount(
- orders[i].takerTokenAmount,
- orders[i].makerTokenAmount,
- remainingMakerTokenFillAmount
+ // Convert the remaining amount of makerAsset to buy into remaining amount
+ // of takerAsset to sell, assuming entire amount can be sold in the current order
+ uint256 remainingTakerAssetFillAmount = getPartialAmount(
+ orders[i].takerAssetAmount,
+ orders[i].makerAssetAmount,
+ remainingMakerAssetFillAmount
);
- // Attempt to sell the remaining amount of takerToken
+ // Attempt to sell the remaining amount of takerAsset
FillResults memory singleFillResults = fillOrderNoThrow(
orders[i],
- remainingTakerTokenFillAmount,
+ remainingTakerAssetFillAmount,
signatures[i]
);
// Update amounts filled and fees paid by maker and taker
addFillResults(totalFillResults, singleFillResults);
- // Stop execution if the entire amount of makerToken has been bought
- if (totalFillResults.makerTokenFilledAmount == makerTokenFillAmount) {
+ // Stop execution if the entire amount of makerAsset has been bought
+ if (totalFillResults.makerAssetFilledAmount == makerAssetFillAmount) {
break;
}
}
@@ -496,8 +496,8 @@ contract MixinWrapperFunctions is
internal
pure
{
- totalFillResults.makerTokenFilledAmount = safeAdd(totalFillResults.makerTokenFilledAmount, singleFillResults.makerTokenFilledAmount);
- totalFillResults.takerTokenFilledAmount = safeAdd(totalFillResults.takerTokenFilledAmount, singleFillResults.takerTokenFilledAmount);
+ totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);
+ totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);
totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);
totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);
}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
index d2ec4da04..9a7f80109 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
@@ -24,15 +24,15 @@ import "../LibOrder.sol";
contract MExchangeCore is LibOrder {
struct FillResults {
- uint256 makerTokenFilledAmount;
- uint256 takerTokenFilledAmount;
+ uint256 makerAssetFilledAmount;
+ uint256 takerAssetFilledAmount;
uint256 makerFeePaid;
uint256 takerFeePaid;
}
function fillOrder(
Order memory order,
- uint256 takerTokenFillAmount,
+ uint256 takerAssetFillAmount,
bytes memory signature)
public
returns (FillResults memory fillResults);
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MSettlement.sol b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MSettlement.sol
index a9911c8ce..172138f2d 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MSettlement.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MSettlement.sol
@@ -26,10 +26,10 @@ contract MSettlement is LibOrder {
function settleOrder(
Order memory order,
address takerAddress,
- uint256 takerTokenFilledAmount)
+ uint256 takerAssetFilledAmount)
internal
returns (
- uint256 makerTokenFilledAmount,
+ uint256 makerAssetFilledAmount,
uint256 makerFeePaid,
uint256 takerFeePaid
);
diff --git a/packages/contracts/src/contracts/current/test/DummyToken/DummyToken.sol b/packages/contracts/src/contracts/current/test/DummyERC20Token/DummyERC20Token.sol
index 8b29da919..2626399c2 100644
--- a/packages/contracts/src/contracts/current/test/DummyToken/DummyToken.sol
+++ b/packages/contracts/src/contracts/current/test/DummyERC20Token/DummyERC20Token.sol
@@ -21,16 +21,16 @@ pragma solidity ^0.4.21;
import "../Mintable/Mintable.sol";
import "../../utils/Ownable/Ownable.sol";
-contract DummyToken is Mintable, Ownable {
+contract DummyERC20Token is Mintable, Ownable {
string public name;
string public symbol;
- uint public decimals;
+ uint256 public decimals;
- function DummyToken(
+ function DummyERC20Token(
string _name,
string _symbol,
- uint _decimals,
- uint _totalSupply)
+ uint256 _decimals,
+ uint256 _totalSupply)
public
{
name = _name;
@@ -40,11 +40,11 @@ contract DummyToken is Mintable, Ownable {
balances[msg.sender] = _totalSupply;
}
- function setBalance(address _target, uint _value)
+ function setBalance(address _target, uint256 _value)
public
onlyOwner
{
- uint currBalance = balanceOf(_target);
+ uint256 currBalance = balanceOf(_target);
if (_value < currBalance) {
totalSupply = safeSub(totalSupply, safeSub(currBalance, _value));
} else {
diff --git a/packages/contracts/src/contracts/current/test/MaliciousToken/MaliciousToken.sol b/packages/contracts/src/contracts/current/test/MaliciousToken/MaliciousToken.sol
deleted file mode 100644
index 3a0092276..000000000
--- a/packages/contracts/src/contracts/current/test/MaliciousToken/MaliciousToken.sol
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.4.21;
-
-import "../../tokens/ERC20Token/ERC20Token.sol";
-
-contract MaliciousToken is ERC20Token {
- uint8 stateToUpdate = 1; // Not null so that change only requires 5000 gas
-
- function updateState()
- internal
- {
- stateToUpdate++;
- }
-
- function balanceOf(address _owner)
- public
- constant
- returns (uint)
- {
- updateState();
- return balances[_owner];
- }
-
- function allowance(address _owner, address _spender)
- public
- constant
- returns (uint)
- {
- updateState();
- return allowed[_owner][_spender];
- }
-}
diff --git a/packages/contracts/src/contracts/current/test/Mintable/Mintable.sol b/packages/contracts/src/contracts/current/test/Mintable/Mintable.sol
index 81cbd39dd..305737b72 100644
--- a/packages/contracts/src/contracts/current/test/Mintable/Mintable.sol
+++ b/packages/contracts/src/contracts/current/test/Mintable/Mintable.sol
@@ -26,7 +26,7 @@ import "../../utils/SafeMath/SafeMath.sol";
* Base contract that creates a mintable UnlimitedAllowanceToken
*/
contract Mintable is UnlimitedAllowanceToken, SafeMath {
- function mint(uint _value)
+ function mint(uint256 _value)
public
{
require(_value <= 100000000000000000000);
diff --git a/packages/contracts/src/contracts/current/tokens/ERC20Token/ERC20Token.sol b/packages/contracts/src/contracts/current/tokens/ERC20Token/ERC20Token.sol
index ad6cb28b4..13ceeb2c6 100644
--- a/packages/contracts/src/contracts/current/tokens/ERC20Token/ERC20Token.sol
+++ b/packages/contracts/src/contracts/current/tokens/ERC20Token/ERC20Token.sol
@@ -18,22 +18,22 @@
pragma solidity ^0.4.18;
-import "../Token/Token.sol";
+import "./IERC20Token.sol";
-contract ERC20Token is Token {
+contract ERC20Token is IERC20Token {
- function transfer(address _to, uint _value)
+ function transfer(address _to, uint256 _value)
public
returns (bool)
{
require(balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]);
balances[msg.sender] -= _value;
balances[_to] += _value;
- Transfer(msg.sender, _to, _value);
+ emit Transfer(msg.sender, _to, _value);
return true;
}
- function transferFrom(address _from, address _to, uint _value)
+ function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool)
{
@@ -41,23 +41,22 @@ contract ERC20Token is Token {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
- Transfer(_from, _to, _value);
+ emit Transfer(_from, _to, _value);
return true;
}
- function approve(address _spender, uint _value)
+ function approve(address _spender, uint256 _value)
public
returns (bool)
{
allowed[msg.sender][_spender] = _value;
- Approval(msg.sender, _spender, _value);
+ emit Approval(msg.sender, _spender, _value);
return true;
}
function balanceOf(address _owner)
- public
- view
- returns (uint)
+ public view
+ returns (uint256)
{
return balances[_owner];
}
@@ -65,12 +64,12 @@ contract ERC20Token is Token {
function allowance(address _owner, address _spender)
public
view
- returns (uint)
+ returns (uint256)
{
return allowed[_owner][_spender];
}
- mapping (address => uint) balances;
- mapping (address => mapping (address => uint)) allowed;
- uint public totalSupply;
+ mapping (address => uint256) balances;
+ mapping (address => mapping (address => uint256)) allowed;
+ uint256 public totalSupply;
}
diff --git a/packages/contracts/src/contracts/current/tokens/Token/Token.sol b/packages/contracts/src/contracts/current/tokens/ERC20Token/IERC20Token.sol
index d683c3113..0159b31e8 100644
--- a/packages/contracts/src/contracts/current/tokens/Token/Token.sol
+++ b/packages/contracts/src/contracts/current/tokens/ERC20Token/IERC20Token.sol
@@ -18,36 +18,53 @@
pragma solidity ^0.4.18;
-contract Token {
+contract IERC20Token {
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
- function transfer(address _to, uint _value) public returns (bool) {}
+ function transfer(address _to, uint256 _value)
+ public
+ returns (bool);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
- function transferFrom(address _from, address _to, uint _value) public returns (bool) {}
-
- /// @notice `msg.sender` approves `_addr` to spend `_value` tokens
+ function transferFrom(address _from, address _to, uint256 _value)
+ public
+ returns (bool);
+
+ /// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
- function approve(address _spender, uint _value) public returns (bool) {}
+ function approve(address _spender, uint256 _value)
+ public
+ returns (bool);
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
- function balanceOf(address _owner) public view returns (uint) {}
+ function balanceOf(address _owner)
+ public view
+ returns (uint256);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
- function allowance(address _owner, address _spender) public view returns (uint) {}
+ function allowance(address _owner, address _spender)
+ public view
+ returns (uint256);
- event Transfer(address indexed _from, address indexed _to, uint _value);
- event Approval(address indexed _owner, address indexed _spender, uint _value);
+ event Transfer(
+ address indexed _from,
+ address indexed _to,
+ uint256 _value);
+
+ event Approval(
+ address indexed _owner,
+ address indexed _spender,
+ uint256 _value);
}
diff --git a/packages/contracts/src/contracts/current/tokens/Token/IToken.sol b/packages/contracts/src/contracts/current/tokens/Token/IToken.sol
deleted file mode 100644
index cafbd436b..000000000
--- a/packages/contracts/src/contracts/current/tokens/Token/IToken.sol
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.4.18;
-
-contract IToken {
-
- /// @notice send `value` token to `to` from `msg.sender`
- /// @param to The address of the recipient
- /// @param value The amount of token to be transferred
- /// @return Whether the transfer was successful or not
- function transfer(address to, uint value)
- public
- returns (bool);
-
- /// @notice send `value` token to `to` from `from` on the condition it is approved by `from`
- /// @param from The address of the sender
- /// @param to The address of the recipient
- /// @param value The amount of token to be transferred
- /// @return Whether the transfer was successful or not
- function transferFrom(address from, address to, uint value)
- public
- returns (bool);
-
- /// @notice `msg.sender` approves `addr` to spend `value` tokens
- /// @param spender The address of the account able to transfer the tokens
- /// @param value The amount of wei to be approved for transfer
- /// @return Whether the approval was successful or not
- function approve(address spender, uint value)
- public
- returns (bool);
-
- /// @param owner The address from which the balance will be retrieved
- /// @return The balance
- function balanceOf(address owner)
- public view
- returns (uint);
-
- /// @param owner The address of the account owning tokens
- /// @param spender The address of the account able to transfer the tokens
- /// @return Amount of remaining tokens allowed to spent
- function allowance(address owner, address spender)
- public view
- returns (uint);
-
- event Transfer(
- address indexed from,
- address indexed to,
- uint value);
-
- event Approval(
- address indexed owner,
- address indexed spender,
- uint value);
-}
diff --git a/packages/contracts/src/contracts/current/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol b/packages/contracts/src/contracts/current/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol
index 97c18afb7..be774e374 100644
--- a/packages/contracts/src/contracts/current/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol
+++ b/packages/contracts/src/contracts/current/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol
@@ -22,25 +22,25 @@ import { ERC20Token } from "../ERC20Token/ERC20Token.sol";
contract UnlimitedAllowanceToken is ERC20Token {
- uint constant MAX_UINT = 2**256 - 1;
+ uint256 constant MAX_UINT = 2**256 - 1;
/// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717
/// @param _from Address to transfer from.
/// @param _to Address to transfer to.
/// @param _value Amount to transfer.
/// @return Success of transfer.
- function transferFrom(address _from, address _to, uint _value)
+ function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool)
{
- uint allowance = allowed[_from][msg.sender];
+ uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value && balances[_to] + _value >= balances[_to]);
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT) {
allowed[_from][msg.sender] -= _value;
}
- Transfer(_from, _to, _value);
+ emit Transfer(_from, _to, _value);
return true;
}
}
diff --git a/packages/contracts/src/contracts/current/utils/Authorizable/Authorizable.sol b/packages/contracts/src/contracts/current/utils/Authorizable/Authorizable.sol
index 3e2e0782f..f6032f889 100644
--- a/packages/contracts/src/contracts/current/utils/Authorizable/Authorizable.sol
+++ b/packages/contracts/src/contracts/current/utils/Authorizable/Authorizable.sol
@@ -100,9 +100,8 @@ contract Authorizable is
/// @dev Gets all authorized addresses.
/// @return Array of authorized addresses.
function getAuthorizedAddresses()
- public
- constant
- returns (address[])
+ public view
+ returns (address[] memory)
{
return authorities;
}
diff --git a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
index f78d9baec..ce107f306 100644
--- a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
+++ b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
@@ -25,7 +25,7 @@ contract LibBytes {
/// @param rhs Second byte array to compare.
/// @return True if arrays are the same. False otherwise.
function areBytesEqual(bytes memory lhs, bytes memory rhs)
- public
+ public pure
returns (bool equal)
{
assembly {
diff --git a/packages/contracts/src/contracts/previous/Token/IToken_v1.sol b/packages/contracts/src/contracts/previous/Token/IToken_v1.sol
deleted file mode 100644
index db4286964..000000000
--- a/packages/contracts/src/contracts/previous/Token/IToken_v1.sol
+++ /dev/null
@@ -1,52 +0,0 @@
-pragma solidity ^0.4.18;
-
-contract IToken_v1 {
-
- /// @notice send `value` token to `to` from `msg.sender`
- /// @param to The address of the recipient
- /// @param value The amount of token to be transferred
- /// @return Whether the transfer was successful or not
- function transfer(address to, uint value)
- public
- returns (bool);
-
- /// @notice send `value` token to `to` from `from` on the condition it is approved by `from`
- /// @param from The address of the sender
- /// @param to The address of the recipient
- /// @param value The amount of token to be transferred
- /// @return Whether the transfer was successful or not
- function transferFrom(address from, address to, uint value)
- public
- returns (bool);
-
- /// @notice `msg.sender` approves `addr` to spend `value` tokens
- /// @param spender The address of the account able to transfer the tokens
- /// @param value The amount of wei to be approved for transfer
- /// @return Whether the approval was successful or not
- function approve(address spender, uint value)
- public
- returns (bool);
-
- /// @param owner The address from which the balance will be retrieved
- /// @return The balance
- function balanceOf(address owner)
- public view
- returns (uint);
-
- /// @param owner The address of the account owning tokens
- /// @param spender The address of the account able to transfer the tokens
- /// @return Amount of remaining tokens allowed to spent
- function allowance(address owner, address spender)
- public view
- returns (uint);
-
- event Transfer(
- address indexed from,
- address indexed to,
- uint value);
-
- event Approval(
- address indexed owner,
- address indexed spender,
- uint value);
-}
diff --git a/packages/contracts/src/utils/artifacts.ts b/packages/contracts/src/utils/artifacts.ts
index 87cc73cff..78ba1c142 100644
--- a/packages/contracts/src/utils/artifacts.ts
+++ b/packages/contracts/src/utils/artifacts.ts
@@ -1,9 +1,7 @@
-import * as DummyTokenArtifact from '../artifacts/DummyToken.json';
+import * as DummyERC20TokenArtifact from '../artifacts/DummyERC20Token.json';
import * as ExchangeArtifact from '../artifacts/Exchange.json';
-import * as MaliciousTokenArtifact from '../artifacts/MaliciousToken.json';
import * as MultiSigWalletWithTimeLockArtifact from '../artifacts/MultiSigWalletWithTimeLock.json';
import * as MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact from '../artifacts/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json';
-import * as TokenArtifact from '../artifacts/Token.json';
import * as TokenRegistryArtifact from '../artifacts/TokenRegistry.json';
import * as EtherTokenArtifact from '../artifacts/WETH9.json';
import * as ZRXArtifact from '../artifacts/ZRXToken.json';
@@ -12,12 +10,10 @@ import { Artifact } from './types';
export const artifacts = {
ZRXArtifact: (ZRXArtifact as any) as Artifact,
- DummyTokenArtifact: (DummyTokenArtifact as any) as Artifact,
- TokenArtifact: (TokenArtifact as any) as Artifact,
+ DummyERC20TokenArtifact: (DummyERC20TokenArtifact as any) as Artifact,
ExchangeArtifact: (ExchangeArtifact as any) as Artifact,
EtherTokenArtifact: (EtherTokenArtifact as any) as Artifact,
TokenRegistryArtifact: (TokenRegistryArtifact as any) as Artifact,
- MaliciousTokenArtifact: (MaliciousTokenArtifact as any) as Artifact,
MultiSigWalletWithTimeLockArtifact: (MultiSigWalletWithTimeLockArtifact as any) as Artifact,
MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact: (MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact as any) as Artifact,
};
diff --git a/packages/contracts/src/utils/asset_proxy_utils.ts b/packages/contracts/src/utils/asset_proxy_utils.ts
index da610cbcc..1a7a312dd 100644
--- a/packages/contracts/src/utils/asset_proxy_utils.ts
+++ b/packages/contracts/src/utils/asset_proxy_utils.ts
@@ -4,37 +4,35 @@ import ethUtil = require('ethereumjs-util');
import { AssetProxyId } from './types';
-export function encodeAssetProxyId(assetProxyId: AssetProxyId): Buffer {
- return ethUtil.toBuffer(assetProxyId);
-}
-
-export function encodeAddress(address: string): Buffer {
- if (!ethUtil.isValidAddress(address)) {
- throw new Error(`Invalid Address: ${address}`);
- }
- const encodedAddress = ethUtil.toBuffer(address);
- return encodedAddress;
-}
-
-export function encodeUint256(value: BigNumber): Buffer {
- const formattedValue = new BN(value.toString(10));
- const encodedValue = ethUtil.toBuffer(formattedValue);
- return encodedValue;
-}
-
-export function encodeERC20ProxyData(tokenAddress: string): string {
- const encodedAssetProxyId = encodeAssetProxyId(AssetProxyId.ERC20);
- const encodedAddress = encodeAddress(tokenAddress);
- const encodedMetadata = Buffer.concat([encodedAssetProxyId, encodedAddress]);
- const encodedMetadataHex = ethUtil.bufferToHex(encodedMetadata);
- return encodedMetadataHex;
-}
-
-export function encodeERC721ProxyData(tokenAddress: string, tokenId: BigNumber): string {
- const encodedAssetProxyId = encodeAssetProxyId(AssetProxyId.ERC721);
- const encodedAddress = encodeAddress(tokenAddress);
- const encodedTokenId = encodeUint256(tokenId);
- const encodedMetadata = Buffer.concat([encodedAssetProxyId, encodedAddress, encodedTokenId]);
- const encodedMetadataHex = ethUtil.bufferToHex(encodedMetadata);
- return encodedMetadataHex;
-}
+export const assetProxyUtils = {
+ encodeAssetProxyId(assetProxyId: AssetProxyId): Buffer {
+ return ethUtil.toBuffer(assetProxyId);
+ },
+ encodeAddress(address: string): Buffer {
+ if (!ethUtil.isValidAddress(address)) {
+ throw new Error(`Invalid Address: ${address}`);
+ }
+ const encodedAddress = ethUtil.toBuffer(address);
+ return encodedAddress;
+ },
+ encodeUint256(value: BigNumber): Buffer {
+ const formattedValue = new BN(value.toString(10));
+ const encodedValue = ethUtil.toBuffer(formattedValue);
+ return encodedValue;
+ },
+ encodeERC20ProxyData(tokenAddress: string): string {
+ const encodedAssetProxyId = assetProxyUtils.encodeAssetProxyId(AssetProxyId.ERC20);
+ const encodedAddress = assetProxyUtils.encodeAddress(tokenAddress);
+ const encodedMetadata = Buffer.concat([encodedAssetProxyId, encodedAddress]);
+ const encodedMetadataHex = ethUtil.bufferToHex(encodedMetadata);
+ return encodedMetadataHex;
+ },
+ encodeERC721ProxyData(tokenAddress: string, tokenId: BigNumber): string {
+ const encodedAssetProxyId = assetProxyUtils.encodeAssetProxyId(AssetProxyId.ERC721);
+ const encodedAddress = assetProxyUtils.encodeAddress(tokenAddress);
+ const encodedTokenId = assetProxyUtils.encodeUint256(tokenId);
+ const encodedMetadata = Buffer.concat([encodedAssetProxyId, encodedAddress, encodedTokenId]);
+ const encodedMetadataHex = ethUtil.bufferToHex(encodedMetadata);
+ return encodedMetadataHex;
+ },
+};
diff --git a/packages/contracts/src/utils/balances.ts b/packages/contracts/src/utils/balances.ts
index 2ebc10313..40a59e815 100644
--- a/packages/contracts/src/utils/balances.ts
+++ b/packages/contracts/src/utils/balances.ts
@@ -2,14 +2,14 @@ import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import * as Web3 from 'web3';
-import { DummyTokenContract } from '../contract_wrappers/generated/dummy_token';
+import { DummyERC20TokenContract } from '../contract_wrappers/generated/dummy_e_r_c20_token';
import { BalancesByOwner } from './types';
export class Balances {
- private _tokenContractInstances: DummyTokenContract[];
+ private _tokenContractInstances: DummyERC20TokenContract[];
private _ownerAddresses: string[];
- constructor(tokenContractInstances: DummyTokenContract[], ownerAddresses: string[]) {
+ constructor(tokenContractInstances: DummyERC20TokenContract[], ownerAddresses: string[]) {
this._tokenContractInstances = tokenContractInstances;
this._ownerAddresses = ownerAddresses;
}
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index cda012aa9..26ce8b04e 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -22,12 +22,12 @@ export class ExchangeWrapper {
public async fillOrderAsync(
signedOrder: SignedOrder,
from: string,
- opts: { takerTokenFillAmount?: BigNumber } = {},
+ opts: { takerAssetFillAmount?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
const txHash = await this._exchange.fillOrder.sendTransactionAsync(
params.order,
- params.takerTokenFillAmount,
+ params.takerAssetFillAmount,
params.signature,
{ from },
);
@@ -43,12 +43,12 @@ export class ExchangeWrapper {
public async fillOrKillOrderAsync(
signedOrder: SignedOrder,
from: string,
- opts: { takerTokenFillAmount?: BigNumber } = {},
+ opts: { takerAssetFillAmount?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
const txHash = await this._exchange.fillOrKillOrder.sendTransactionAsync(
params.order,
- params.takerTokenFillAmount,
+ params.takerAssetFillAmount,
params.signature,
{ from },
);
@@ -58,12 +58,12 @@ export class ExchangeWrapper {
public async fillOrderNoThrowAsync(
signedOrder: SignedOrder,
from: string,
- opts: { takerTokenFillAmount?: BigNumber } = {},
+ opts: { takerAssetFillAmount?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
const txHash = await this._exchange.fillOrderNoThrow.sendTransactionAsync(
params.order,
- params.takerTokenFillAmount,
+ params.takerAssetFillAmount,
params.signature,
{ from },
);
@@ -73,12 +73,12 @@ export class ExchangeWrapper {
public async batchFillOrdersAsync(
orders: SignedOrder[],
from: string,
- opts: { takerTokenFillAmounts?: BigNumber[] } = {},
+ opts: { takerAssetFillAmounts?: BigNumber[] } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchFill(orders, opts.takerTokenFillAmounts);
+ const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
const txHash = await this._exchange.batchFillOrders.sendTransactionAsync(
params.orders,
- params.takerTokenFillAmounts,
+ params.takerAssetFillAmounts,
params.signatures,
{ from },
);
@@ -88,12 +88,12 @@ export class ExchangeWrapper {
public async batchFillOrKillOrdersAsync(
orders: SignedOrder[],
from: string,
- opts: { takerTokenFillAmounts?: BigNumber[] } = {},
+ opts: { takerAssetFillAmounts?: BigNumber[] } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchFill(orders, opts.takerTokenFillAmounts);
+ const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
const txHash = await this._exchange.batchFillOrKillOrders.sendTransactionAsync(
params.orders,
- params.takerTokenFillAmounts,
+ params.takerAssetFillAmounts,
params.signatures,
{ from },
);
@@ -103,12 +103,12 @@ export class ExchangeWrapper {
public async batchFillOrdersNoThrowAsync(
orders: SignedOrder[],
from: string,
- opts: { takerTokenFillAmounts?: BigNumber[] } = {},
+ opts: { takerAssetFillAmounts?: BigNumber[] } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchFill(orders, opts.takerTokenFillAmounts);
+ const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
const txHash = await this._exchange.batchFillOrdersNoThrow.sendTransactionAsync(
params.orders,
- params.takerTokenFillAmounts,
+ params.takerAssetFillAmounts,
params.signatures,
{ from },
);
@@ -118,12 +118,12 @@ export class ExchangeWrapper {
public async marketSellOrdersAsync(
orders: SignedOrder[],
from: string,
- opts: { takerTokenFillAmount: BigNumber },
+ opts: { takerAssetFillAmount: BigNumber },
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketSellOrders(orders, opts.takerTokenFillAmount);
+ const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount);
const txHash = await this._exchange.marketSellOrders.sendTransactionAsync(
params.orders,
- params.takerTokenFillAmount,
+ params.takerAssetFillAmount,
params.signatures,
{ from },
);
@@ -133,12 +133,12 @@ export class ExchangeWrapper {
public async marketSellOrdersNoThrowAsync(
orders: SignedOrder[],
from: string,
- opts: { takerTokenFillAmount: BigNumber },
+ opts: { takerAssetFillAmount: BigNumber },
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketSellOrders(orders, opts.takerTokenFillAmount);
+ const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount);
const txHash = await this._exchange.marketSellOrdersNoThrow.sendTransactionAsync(
params.orders,
- params.takerTokenFillAmount,
+ params.takerAssetFillAmount,
params.signatures,
{ from },
);
@@ -148,12 +148,12 @@ export class ExchangeWrapper {
public async marketBuyOrdersAsync(
orders: SignedOrder[],
from: string,
- opts: { makerTokenFillAmount: BigNumber },
+ opts: { makerAssetFillAmount: BigNumber },
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketBuyOrders(orders, opts.makerTokenFillAmount);
+ const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
const txHash = await this._exchange.marketBuyOrders.sendTransactionAsync(
params.orders,
- params.makerTokenFillAmount,
+ params.makerAssetFillAmount,
params.signatures,
{ from },
);
@@ -163,12 +163,12 @@ export class ExchangeWrapper {
public async marketBuyOrdersNoThrowAsync(
orders: SignedOrder[],
from: string,
- opts: { makerTokenFillAmount: BigNumber },
+ opts: { makerAssetFillAmount: BigNumber },
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketBuyOrders(orders, opts.makerTokenFillAmount);
+ const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
const txHash = await this._exchange.marketBuyOrdersNoThrow.sendTransactionAsync(
params.orders,
- params.makerTokenFillAmount,
+ params.makerAssetFillAmount,
params.signatures,
{ from },
);
@@ -221,7 +221,7 @@ export class ExchangeWrapper {
);
return partialAmount;
}
- public async getTakerTokenFilledAmount(orderHashHex: string): Promise<BigNumber> {
+ public async getTakerAssetFilledAmountAsync(orderHashHex: string): Promise<BigNumber> {
const filledAmount = new BigNumber(await this._exchange.filled.callAsync(orderHashHex));
return filledAmount;
}
diff --git a/packages/contracts/src/utils/formatters.ts b/packages/contracts/src/utils/formatters.ts
index fce10c448..e706c15b5 100644
--- a/packages/contracts/src/utils/formatters.ts
+++ b/packages/contracts/src/utils/formatters.ts
@@ -5,27 +5,27 @@ import { orderUtils } from './order_utils';
import { BatchCancelOrders, BatchFillOrders, MarketBuyOrders, MarketSellOrders, SignedOrder } from './types';
export const formatters = {
- createBatchFill(signedOrders: SignedOrder[], takerTokenFillAmounts: BigNumber[] = []) {
+ createBatchFill(signedOrders: SignedOrder[], takerAssetFillAmounts: BigNumber[] = []) {
const batchFill: BatchFillOrders = {
orders: [],
signatures: [],
- takerTokenFillAmounts,
+ takerAssetFillAmounts,
};
_.forEach(signedOrders, signedOrder => {
const orderStruct = orderUtils.getOrderStruct(signedOrder);
batchFill.orders.push(orderStruct);
batchFill.signatures.push(signedOrder.signature);
- if (takerTokenFillAmounts.length < signedOrders.length) {
- batchFill.takerTokenFillAmounts.push(signedOrder.takerTokenAmount);
+ if (takerAssetFillAmounts.length < signedOrders.length) {
+ batchFill.takerAssetFillAmounts.push(signedOrder.takerAssetAmount);
}
});
return batchFill;
},
- createMarketSellOrders(signedOrders: SignedOrder[], takerTokenFillAmount: BigNumber) {
+ createMarketSellOrders(signedOrders: SignedOrder[], takerAssetFillAmount: BigNumber) {
const marketSellOrders: MarketSellOrders = {
orders: [],
signatures: [],
- takerTokenFillAmount,
+ takerAssetFillAmount,
};
_.forEach(signedOrders, signedOrder => {
const orderStruct = orderUtils.getOrderStruct(signedOrder);
@@ -34,11 +34,11 @@ export const formatters = {
});
return marketSellOrders;
},
- createMarketBuyOrders(signedOrders: SignedOrder[], makerTokenFillAmount: BigNumber) {
+ createMarketBuyOrders(signedOrders: SignedOrder[], makerAssetFillAmount: BigNumber) {
const marketBuyOrders: MarketBuyOrders = {
orders: [],
signatures: [],
- makerTokenFillAmount,
+ makerAssetFillAmount,
};
_.forEach(signedOrders, signedOrder => {
const orderStruct = orderUtils.getOrderStruct(signedOrder);
diff --git a/packages/contracts/src/utils/order_utils.ts b/packages/contracts/src/utils/order_utils.ts
index 18892b4d4..52eb44941 100644
--- a/packages/contracts/src/utils/order_utils.ts
+++ b/packages/contracts/src/utils/order_utils.ts
@@ -7,18 +7,18 @@ import { crypto } from './crypto';
import { OrderStruct, SignatureType, SignedOrder, UnsignedOrder } from './types';
export const orderUtils = {
- createFill: (signedOrder: SignedOrder, takerTokenFillAmount?: BigNumber) => {
+ createFill: (signedOrder: SignedOrder, takerAssetFillAmount?: BigNumber) => {
const fill = {
order: orderUtils.getOrderStruct(signedOrder),
- takerTokenFillAmount: takerTokenFillAmount || signedOrder.takerTokenAmount,
+ takerAssetFillAmount: takerAssetFillAmount || signedOrder.takerAssetAmount,
signature: signedOrder.signature,
};
return fill;
},
- createCancel(signedOrder: SignedOrder, takerTokenCancelAmount?: BigNumber) {
+ createCancel(signedOrder: SignedOrder, takerAssetCancelAmount?: BigNumber) {
const cancel = {
order: orderUtils.getOrderStruct(signedOrder),
- takerTokenCancelAmount: takerTokenCancelAmount || signedOrder.takerTokenAmount,
+ takerAssetCancelAmount: takerAssetCancelAmount || signedOrder.takerAssetAmount,
};
return cancel;
},
@@ -27,8 +27,8 @@ export const orderUtils = {
makerAddress: signedOrder.makerAddress,
takerAddress: signedOrder.takerAddress,
feeRecipientAddress: signedOrder.feeRecipientAddress,
- makerTokenAmount: signedOrder.makerTokenAmount,
- takerTokenAmount: signedOrder.takerTokenAmount,
+ makerAssetAmount: signedOrder.makerAssetAmount,
+ takerAssetAmount: signedOrder.takerAssetAmount,
makerFee: signedOrder.makerFee,
takerFee: signedOrder.takerFee,
expirationTimeSeconds: signedOrder.expirationTimeSeconds,
@@ -44,8 +44,8 @@ export const orderUtils = {
'address makerAddress',
'address takerAddress',
'address feeRecipientAddress',
- 'uint256 makerTokenAmount',
- 'uint256 takerTokenAmount',
+ 'uint256 makerAssetAmount',
+ 'uint256 takerAssetAmount',
'uint256 makerFee',
'uint256 takerFee',
'uint256 expirationTimeSeconds',
@@ -58,8 +58,8 @@ export const orderUtils = {
order.makerAddress,
order.takerAddress,
order.feeRecipientAddress,
- order.makerTokenAmount,
- order.takerTokenAmount,
+ order.makerAssetAmount,
+ order.takerAssetAmount,
order.makerFee,
order.takerFee,
order.expirationTimeSeconds,
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index 7de167f27..8bc9641fc 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -14,19 +14,19 @@ export interface SubmissionContractEventArgs {
export interface BatchFillOrders {
orders: OrderStruct[];
signatures: string[];
- takerTokenFillAmounts: BigNumber[];
+ takerAssetFillAmounts: BigNumber[];
}
export interface MarketSellOrders {
orders: OrderStruct[];
signatures: string[];
- takerTokenFillAmount: BigNumber;
+ takerAssetFillAmount: BigNumber;
}
export interface MarketBuyOrders {
orders: OrderStruct[];
signatures: string[];
- makerTokenFillAmount: BigNumber;
+ makerAssetFillAmount: BigNumber;
}
export interface BatchCancelOrders {
@@ -47,10 +47,10 @@ export interface DefaultOrderParams {
exchangeAddress: string;
makerAddress: string;
feeRecipientAddress: string;
- makerTokenAddress: string;
- takerTokenAddress: string;
- makerTokenAmount: BigNumber;
- takerTokenAmount: BigNumber;
+ makerAssetAddress: string;
+ takerAssetAddress: string;
+ makerAssetAmount: BigNumber;
+ takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
makerAssetData: string;
@@ -100,10 +100,9 @@ export enum ContractName {
MultiSigWalletWithTimeLock = 'MultiSigWalletWithTimeLock',
Exchange = 'Exchange',
ZRXToken = 'ZRXToken',
- DummyToken = 'DummyToken',
+ DummyERC20Token = 'DummyERC20Token',
EtherToken = 'WETH9',
MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress = 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress',
- MaliciousToken = 'MaliciousToken',
AccountLevels = 'AccountLevels',
EtherDelta = 'EtherDelta',
Arbitrage = 'Arbitrage',
@@ -138,8 +137,8 @@ export interface OrderStruct {
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
- makerTokenAmount: BigNumber;
- takerTokenAmount: BigNumber;
+ makerAssetAmount: BigNumber;
+ takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
diff --git a/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts b/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts
index f54ed6442..5cbe11e53 100644
--- a/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts
+++ b/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts
@@ -6,11 +6,11 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { AssetProxyDispatcherContract } from '../../src/contract_wrappers/generated/asset_proxy_dispatcher';
+import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c20_token';
import { DummyERC721TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c721_token';
-import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token';
import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy';
import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy';
-import { encodeERC20ProxyData, encodeERC721ProxyData } from '../../src/utils/asset_proxy_utils';
+import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
import { Balances } from '../../src/utils/balances';
import { constants } from '../../src/utils/constants';
import { AssetProxyId, ContractName } from '../../src/utils/types';
@@ -30,7 +30,7 @@ describe('AssetProxyDispatcher', () => {
let tokenOwner: string;
let makerAddress: string;
let takerAddress: string;
- let zrx: DummyTokenContract;
+ let zrx: DummyERC20TokenContract;
let dmyBalances: Balances;
let assetProxyDispatcher: AssetProxyDispatcherContract;
let erc20Proxy: ERC20ProxyContract;
@@ -68,8 +68,8 @@ describe('AssetProxyDispatcher', () => {
from: owner,
});
// Deploy zrx and set initial balances
- const zrxInstance = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS);
- zrx = new DummyTokenContract(zrxInstance.abi, zrxInstance.address, provider);
+ const zrxInstance = await deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS);
+ zrx = new DummyERC20TokenContract(zrxInstance.abi, zrxInstance.address, provider);
await zrx.setBalance.sendTransactionAsync(makerAddress, INITIAL_BALANCE, { from: tokenOwner });
await zrx.setBalance.sendTransactionAsync(takerAddress, INITIAL_BALANCE, { from: tokenOwner });
dmyBalances = new Balances([zrx], [makerAddress, takerAddress]);
@@ -242,7 +242,7 @@ describe('AssetProxyDispatcher', () => {
{ from: owner },
);
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = encodeERC20ProxyData(zrx.address);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(10);
@@ -265,7 +265,7 @@ describe('AssetProxyDispatcher', () => {
it('should throw if dispatching to unregistered proxy', async () => {
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = encodeERC20ProxyData(zrx.address);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(10);
@@ -290,7 +290,7 @@ describe('AssetProxyDispatcher', () => {
{ from: owner },
);
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = encodeERC20ProxyData(zrx.address);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(10);
diff --git a/packages/contracts/test/asset_proxy_dispatcher/proxies.ts b/packages/contracts/test/asset_proxy_dispatcher/proxies.ts
index 2a8b6d567..9437fcbf0 100644
--- a/packages/contracts/test/asset_proxy_dispatcher/proxies.ts
+++ b/packages/contracts/test/asset_proxy_dispatcher/proxies.ts
@@ -6,11 +6,11 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { AssetProxyDispatcherContract } from '../../src/contract_wrappers/generated/asset_proxy_dispatcher';
+import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c20_token';
import { DummyERC721TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c721_token';
-import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token';
import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy';
import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy';
-import { encodeERC20ProxyData, encodeERC721ProxyData } from '../../src/utils/asset_proxy_utils';
+import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
import { Balances } from '../../src/utils/balances';
import { constants } from '../../src/utils/constants';
import { AssetProxyId, ContractName } from '../../src/utils/types';
@@ -29,12 +29,12 @@ describe('Asset Transfer Proxies', () => {
let tokenOwner: string;
let makerAddress: string;
let takerAddress: string;
- let zrx: DummyTokenContract;
+ let zrx: DummyERC20TokenContract;
let erc721Token: DummyERC721TokenContract;
let dmyBalances: Balances;
let erc20Proxy: ERC20ProxyContract;
let erc721Proxy: ERC721ProxyContract;
- const makerTokenId = new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010');
+ const makerAssetId = new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010');
const testAddressPaddedWithZeros = '0x0000000000000000056000000000000000000010';
const INITIAL_BALANCE = new BigNumber(10000);
@@ -59,8 +59,8 @@ describe('Asset Transfer Proxies', () => {
from: owner,
});
// Deploy zrx and set initial balances
- const zrxInstance = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS);
- zrx = new DummyTokenContract(zrxInstance.abi, zrxInstance.address, provider);
+ const zrxInstance = await deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS);
+ zrx = new DummyERC20TokenContract(zrxInstance.abi, zrxInstance.address, provider);
await zrx.setBalance.sendTransactionAsync(makerAddress, INITIAL_BALANCE, { from: tokenOwner });
await zrx.setBalance.sendTransactionAsync(takerAddress, INITIAL_BALANCE, { from: tokenOwner });
dmyBalances = new Balances([zrx], [makerAddress, takerAddress]);
@@ -82,7 +82,7 @@ describe('Asset Transfer Proxies', () => {
await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, {
from: takerAddress,
});
- await erc721Token.mint.sendTransactionAsync(makerAddress, makerTokenId, { from: tokenOwner });
+ await erc721Token.mint.sendTransactionAsync(makerAddress, makerAssetId, { from: tokenOwner });
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -93,7 +93,7 @@ describe('Asset Transfer Proxies', () => {
describe('Transfer Proxy - ERC20', () => {
it('should successfully transfer tokens', async () => {
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = encodeERC20ProxyData(zrx.address);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(10);
@@ -116,7 +116,7 @@ describe('Asset Transfer Proxies', () => {
it('should do nothing if transferring 0 amount of a token', async () => {
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = encodeERC20ProxyData(zrx.address);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(0);
@@ -135,7 +135,7 @@ describe('Asset Transfer Proxies', () => {
it('should throw if allowances are too low', async () => {
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = encodeERC20ProxyData(zrx.address);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address);
// Create allowance less than transfer amount. Set allowance on proxy.
const allowance = new BigNumber(0);
const transferAmount = new BigNumber(10);
@@ -156,7 +156,7 @@ describe('Asset Transfer Proxies', () => {
it('should throw if requesting address is not authorized', async () => {
// Construct metadata for ERC20 proxy
- const encodedProxyMetadata = encodeERC20ProxyData(zrx.address);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(10);
return expect(
@@ -170,10 +170,10 @@ describe('Asset Transfer Proxies', () => {
describe('Transfer Proxy - ERC721', () => {
it('should successfully transfer tokens', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = encodeERC721ProxyData(erc721Token.address, makerTokenId);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId);
// Verify pre-condition
- const ownerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(ownerMakerToken).to.be.bignumber.equal(makerAddress);
+ const ownerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(1);
@@ -185,16 +185,16 @@ describe('Asset Transfer Proxies', () => {
{ from: assetProxyDispatcherAddress },
);
// Verify transfer was successful
- const newOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(newOwnerMakerToken).to.be.bignumber.equal(takerAddress);
+ const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
});
it('should throw if transferring 0 amount of a token', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = encodeERC721ProxyData(erc721Token.address, makerTokenId);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId);
// Verify pre-condition
- const ownerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(ownerMakerToken).to.be.bignumber.equal(makerAddress);
+ const ownerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(0);
@@ -211,10 +211,10 @@ describe('Asset Transfer Proxies', () => {
it('should throw if transferring > 1 amount of a token', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = encodeERC721ProxyData(erc721Token.address, makerTokenId);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId);
// Verify pre-condition
- const ownerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(ownerMakerToken).to.be.bignumber.equal(makerAddress);
+ const ownerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(500);
@@ -231,7 +231,7 @@ describe('Asset Transfer Proxies', () => {
it('should throw if allowances are too low', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = encodeERC721ProxyData(erc721Token.address, makerTokenId);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId);
// Remove transfer approval for makerAddress.
await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, false, {
from: makerAddress,
@@ -247,7 +247,7 @@ describe('Asset Transfer Proxies', () => {
it('should throw if requesting address is not authorized', async () => {
// Construct metadata for ERC721 proxy
- const encodedProxyMetadata = encodeERC721ProxyData(erc721Token.address, makerTokenId);
+ const encodedProxyMetadata = assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(1);
return expect(
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index 1e5e0b53a..924dee951 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -8,8 +8,8 @@ import * as _ from 'lodash';
import * as Web3 from 'web3';
import { AssetProxyDispatcherContract } from '../../src/contract_wrappers/generated/asset_proxy_dispatcher';
+import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c20_token';
import { DummyERC721TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c721_token';
-import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token';
import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy';
import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy';
import {
@@ -18,7 +18,7 @@ import {
ExchangeErrorContractEventArgs,
FillContractEventArgs,
} from '../../src/contract_wrappers/generated/exchange';
-import { encodeERC20ProxyData, encodeERC721ProxyData } from '../../src/utils/asset_proxy_utils';
+import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
import { Balances } from '../../src/utils/balances';
import { constants } from '../../src/utils/constants';
import { crypto } from '../../src/utils/crypto';
@@ -49,9 +49,9 @@ describe('Exchange', () => {
const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
- let rep: DummyTokenContract;
- let dgd: DummyTokenContract;
- let zrx: DummyTokenContract;
+ let rep: DummyERC20TokenContract;
+ let dgd: DummyERC20TokenContract;
+ let zrx: DummyERC20TokenContract;
let erc721Token: DummyERC721TokenContract;
let exchange: ExchangeContract;
let assetProxyDispatcher: AssetProxyDispatcherContract;
@@ -64,18 +64,18 @@ describe('Exchange', () => {
let dmyBalances: Balances;
let orderFactory: OrderFactory;
- const erc721MakerTokenIds = [
+ const erc721MakerAssetIds = [
new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010'),
new BigNumber('0x2020202020202020202020202020202020202020202020202020202020202020'),
];
- const erc721TakerTokenIds = [
+ const erc721TakerAssetIds = [
new BigNumber('0x3030303030303030303030303030303030303030303030303030303030303030'),
new BigNumber('0x4040404040404040404040404040404040404040404040404040404040404040'),
];
- let defaultMakerTokenAddress: string;
- let defaultTakerTokenAddress: string;
+ let defaultMakerAssetAddress: string;
+ let defaultTakerAssetAddress: string;
let zeroEx: ZeroEx;
@@ -85,14 +85,14 @@ describe('Exchange', () => {
[tokenOwner, takerAddress, feeRecipientAddress] = accounts;
const owner = tokenOwner;
const [repInstance, dgdInstance, zrxInstance, erc721TokenInstance] = await Promise.all([
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
+ deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS),
+ deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS),
+ deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS),
deployer.deployAsync(ContractName.DummyERC721Token, constants.DUMMY_ERC721TOKEN_ARGS),
]);
- rep = new DummyTokenContract(repInstance.abi, repInstance.address, provider);
- dgd = new DummyTokenContract(dgdInstance.abi, dgdInstance.address, provider);
- zrx = new DummyTokenContract(zrxInstance.abi, zrxInstance.address, provider);
+ rep = new DummyERC20TokenContract(repInstance.abi, repInstance.address, provider);
+ dgd = new DummyERC20TokenContract(dgdInstance.abi, dgdInstance.address, provider);
+ zrx = new DummyERC20TokenContract(zrxInstance.abi, zrxInstance.address, provider);
erc721Token = new DummyERC721TokenContract(erc721TokenInstance.abi, erc721TokenInstance.address, provider);
// Deploy Asset Proxy Dispatcher
const assetProxyDispatcherInstance = await deployer.deployAsync(ContractName.AssetProxyDispatcher);
@@ -129,9 +129,8 @@ describe('Exchange', () => {
);
// Deploy and configure Exchange
const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
- zrx.address,
- encodeERC20ProxyData(zrx.address),
assetProxyDispatcher.address,
+ assetProxyUtils.encodeERC20ProxyData(zrx.address),
]);
exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner });
@@ -141,19 +140,19 @@ describe('Exchange', () => {
});
exWrapper = new ExchangeWrapper(exchange, zeroEx);
- defaultMakerTokenAddress = rep.address;
- defaultTakerTokenAddress = dgd.address;
+ defaultMakerAssetAddress = rep.address;
+ defaultTakerAssetAddress = dgd.address;
const defaultOrderParams = {
exchangeAddress: exchange.address,
makerAddress,
feeRecipientAddress,
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
takerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
- makerAssetData: encodeERC20ProxyData(defaultMakerTokenAddress),
- takerAssetData: encodeERC20ProxyData(defaultTakerTokenAddress),
+ makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
};
const privateKey = constants.TESTRPC_PRIVATE_KEYS[0];
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
@@ -189,10 +188,10 @@ describe('Exchange', () => {
erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, {
from: takerAddress,
}),
- erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerTokenIds[0], { from: tokenOwner }),
- erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerTokenIds[1], { from: tokenOwner }),
- erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerTokenIds[0], { from: tokenOwner }),
- erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerTokenIds[1], { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerAssetIds[0], { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerAssetIds[1], { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerAssetIds[0], { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerAssetIds[1], { from: tokenOwner }),
]);
});
beforeEach(async () => {
@@ -215,80 +214,80 @@ describe('Exchange', () => {
it('should create an unfillable order', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(1001),
- takerTokenAmount: new BigNumber(3),
+ makerAssetAmount: new BigNumber(1001),
+ takerAssetAmount: new BigNumber(3),
});
- const takerTokenFilledAmountBefore = await exWrapper.getTakerTokenFilledAmount(
+ const takerAssetFilledAmountBefore = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(takerTokenFilledAmountBefore).to.be.bignumber.equal(0);
+ expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0);
- const fillTakerTokenAmount1 = new BigNumber(2);
+ const fillTakerAssetAmount1 = new BigNumber(2);
await exWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerTokenFillAmount: fillTakerTokenAmount1,
+ takerAssetFillAmount: fillTakerAssetAmount1,
});
- const takerTokenFilledAmountAfter1 = await exWrapper.getTakerTokenFilledAmount(
+ const takerAssetFilledAmountAfter1 = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(takerTokenFilledAmountAfter1).to.be.bignumber.equal(fillTakerTokenAmount1);
+ expect(takerAssetFilledAmountAfter1).to.be.bignumber.equal(fillTakerAssetAmount1);
- const fillTakerTokenAmount2 = new BigNumber(1);
+ const fillTakerAssetAmount2 = new BigNumber(1);
await exWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerTokenFillAmount: fillTakerTokenAmount2,
+ takerAssetFillAmount: fillTakerAssetAmount2,
});
- const takerTokenFilledAmountAfter2 = await exWrapper.getTakerTokenFilledAmount(
+ const takerAssetFilledAmountAfter2 = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(takerTokenFilledAmountAfter2).to.be.bignumber.equal(takerTokenFilledAmountAfter1);
+ expect(takerAssetFilledAmountAfter2).to.be.bignumber.equal(takerAssetFilledAmountAfter1);
});
- it('should transfer the correct amounts when makerTokenAmount === takerTokenAmount', async () => {
+ it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
});
- const takerTokenFilledAmountBefore = await exWrapper.getTakerTokenFilledAmount(
+ const takerAssetFilledAmountBefore = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(takerTokenFilledAmountBefore).to.be.bignumber.equal(0);
+ expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0);
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
- await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount });
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- const makerAmountBoughtAfter = await exWrapper.getTakerTokenFilledAmount(
+ const makerAmountBoughtAfter = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerTokenFillAmount);
+ expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerAssetFillAmount);
const newBalances = await dmyBalances.getAsync();
- const makerTokenFilledAmount = takerTokenFillAmount
- .times(signedOrder.makerTokenAmount)
- .dividedToIntegerBy(signedOrder.takerTokenAmount);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
const makerFeePaid = signedOrder.makerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
const takerFeePaid = signedOrder.takerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount),
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFeePaid),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFeePaid),
@@ -298,50 +297,50 @@ describe('Exchange', () => {
);
});
- it('should transfer the correct amounts when makerTokenAmount > takerTokenAmount', async () => {
+ it('should transfer the correct amounts when makerAssetAmount > takerAssetAmount', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
});
- const takerTokenFilledAmountBefore = await exWrapper.getTakerTokenFilledAmount(
+ const takerAssetFilledAmountBefore = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(takerTokenFilledAmountBefore).to.be.bignumber.equal(0);
+ expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0);
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
- await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount });
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- const makerAmountBoughtAfter = await exWrapper.getTakerTokenFilledAmount(
+ const makerAmountBoughtAfter = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerTokenFillAmount);
+ expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerAssetFillAmount);
const newBalances = await dmyBalances.getAsync();
- const makerTokenFilledAmount = takerTokenFillAmount
- .times(signedOrder.makerTokenAmount)
- .dividedToIntegerBy(signedOrder.takerTokenAmount);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
const makerFeePaid = signedOrder.makerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
const takerFeePaid = signedOrder.takerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount),
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFeePaid),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFeePaid),
@@ -351,50 +350,50 @@ describe('Exchange', () => {
);
});
- it('should transfer the correct amounts when makerTokenAmount < takerTokenAmount', async () => {
+ it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
});
- const takerTokenFilledAmountBefore = await exWrapper.getTakerTokenFilledAmount(
+ const takerAssetFilledAmountBefore = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(takerTokenFilledAmountBefore).to.be.bignumber.equal(0);
+ expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0);
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
- await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount });
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- const makerAmountBoughtAfter = await exWrapper.getTakerTokenFilledAmount(
+ const makerAmountBoughtAfter = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerTokenFillAmount);
+ expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerAssetFillAmount);
const newBalances = await dmyBalances.getAsync();
- const makerTokenFilledAmount = takerTokenFillAmount
- .times(signedOrder.makerTokenAmount)
- .dividedToIntegerBy(signedOrder.takerTokenAmount);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
const makerFeePaid = signedOrder.makerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
const takerFeePaid = signedOrder.takerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount),
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFeePaid),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFeePaid),
@@ -407,49 +406,49 @@ describe('Exchange', () => {
it('should transfer the correct amounts when taker is specified and order is claimed by taker', async () => {
signedOrder = orderFactory.newSignedOrder({
takerAddress,
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
});
- const takerTokenFilledAmountBefore = await exWrapper.getTakerTokenFilledAmount(
+ const takerAssetFilledAmountBefore = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(takerTokenFilledAmountBefore).to.be.bignumber.equal(0);
+ expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0);
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
- await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount });
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- const makerAmountBoughtAfter = await exWrapper.getTakerTokenFilledAmount(
+ const makerAmountBoughtAfter = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- const expectedMakerAmountBoughtAfter = takerTokenFillAmount.add(takerTokenFilledAmountBefore);
+ const expectedMakerAmountBoughtAfter = takerAssetFillAmount.add(takerAssetFilledAmountBefore);
expect(makerAmountBoughtAfter).to.be.bignumber.equal(expectedMakerAmountBoughtAfter);
const newBalances = await dmyBalances.getAsync();
- const makerTokenFilledAmount = takerTokenFillAmount
- .times(signedOrder.makerTokenAmount)
- .dividedToIntegerBy(signedOrder.takerTokenAmount);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
const makerFeePaid = signedOrder.makerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
const takerFeePaid = signedOrder.takerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount),
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFeePaid),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFeePaid),
@@ -459,33 +458,33 @@ describe('Exchange', () => {
);
});
- it('should fill remaining value if takerTokenFillAmount > remaining takerTokenAmount', async () => {
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
- await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount });
+ it('should fill remaining value if takerAssetFillAmount > remaining takerAssetAmount', async () => {
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
const res = await exWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerTokenFillAmount: signedOrder.takerTokenAmount,
+ takerAssetFillAmount: signedOrder.takerAssetAmount,
});
const log = res.logs[0] as LogWithDecodedArgs<FillContractEventArgs>;
- expect(log.args.takerTokenFilledAmount).to.be.bignumber.equal(
- signedOrder.takerTokenAmount.minus(takerTokenFillAmount),
+ expect(log.args.takerAssetFilledAmount).to.be.bignumber.equal(
+ signedOrder.takerAssetAmount.minus(takerAssetFillAmount),
);
const newBalances = await dmyBalances.getAsync();
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(signedOrder.makerTokenAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(signedOrder.makerAssetAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(signedOrder.takerTokenAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(signedOrder.takerAssetAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(signedOrder.makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(signedOrder.takerTokenAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(signedOrder.takerAssetAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(signedOrder.makerTokenAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(signedOrder.makerAssetAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(signedOrder.takerFee),
@@ -498,14 +497,14 @@ describe('Exchange', () => {
it('should log 1 event with the correct arguments when order has a feeRecipient', async () => {
const divisor = 2;
const res = await exWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerTokenFillAmount: signedOrder.takerTokenAmount.div(divisor),
+ takerAssetFillAmount: signedOrder.takerAssetAmount.div(divisor),
});
expect(res.logs).to.have.length(1);
const log = res.logs[0] as LogWithDecodedArgs<FillContractEventArgs>;
const logArgs = log.args;
- const expectedFilledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor);
- const expectedFilledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor);
+ const expectedFilledMakerAssetAmount = signedOrder.makerAssetAmount.div(divisor);
+ const expectedFilledTakerAssetAmount = signedOrder.takerAssetAmount.div(divisor);
const expectedFeeMPaid = signedOrder.makerFee.div(divisor);
const expectedFeeTPaid = signedOrder.takerFee.div(divisor);
@@ -514,8 +513,8 @@ describe('Exchange', () => {
expect(signedOrder.feeRecipientAddress).to.be.equal(logArgs.feeRecipientAddress);
expect(signedOrder.makerAssetData).to.be.equal(logArgs.makerAssetData);
expect(signedOrder.takerAssetData).to.be.equal(logArgs.takerAssetData);
- expect(expectedFilledMakerTokenAmount).to.be.bignumber.equal(logArgs.makerTokenFilledAmount);
- expect(expectedFilledTakerTokenAmount).to.be.bignumber.equal(logArgs.takerTokenFilledAmount);
+ expect(expectedFilledMakerAssetAmount).to.be.bignumber.equal(logArgs.makerAssetFilledAmount);
+ expect(expectedFilledTakerAssetAmount).to.be.bignumber.equal(logArgs.takerAssetFilledAmount);
expect(expectedFeeMPaid).to.be.bignumber.equal(logArgs.makerFeePaid);
expect(expectedFeeTPaid).to.be.bignumber.equal(logArgs.takerFeePaid);
expect(orderUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash);
@@ -527,14 +526,14 @@ describe('Exchange', () => {
});
const divisor = 2;
const res = await exWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerTokenFillAmount: signedOrder.takerTokenAmount.div(divisor),
+ takerAssetFillAmount: signedOrder.takerAssetAmount.div(divisor),
});
expect(res.logs).to.have.length(1);
const log = res.logs[0] as LogWithDecodedArgs<FillContractEventArgs>;
const logArgs = log.args;
- const expectedFilledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor);
- const expectedFilledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor);
+ const expectedFilledMakerAssetAmount = signedOrder.makerAssetAmount.div(divisor);
+ const expectedFilledTakerAssetAmount = signedOrder.takerAssetAmount.div(divisor);
const expectedFeeMPaid = new BigNumber(0);
const expectedFeeTPaid = new BigNumber(0);
@@ -543,8 +542,8 @@ describe('Exchange', () => {
expect(signedOrder.feeRecipientAddress).to.be.equal(logArgs.feeRecipientAddress);
expect(signedOrder.makerAssetData).to.be.equal(logArgs.makerAssetData);
expect(signedOrder.takerAssetData).to.be.equal(logArgs.takerAssetData);
- expect(expectedFilledMakerTokenAmount).to.be.bignumber.equal(logArgs.makerTokenFilledAmount);
- expect(expectedFilledTakerTokenAmount).to.be.bignumber.equal(logArgs.takerTokenFilledAmount);
+ expect(expectedFilledMakerAssetAmount).to.be.bignumber.equal(logArgs.makerAssetFilledAmount);
+ expect(expectedFilledTakerAssetAmount).to.be.bignumber.equal(logArgs.takerAssetFilledAmount);
expect(expectedFeeMPaid).to.be.bignumber.equal(logArgs.makerFeePaid);
expect(expectedFeeTPaid).to.be.bignumber.equal(logArgs.takerFeePaid);
expect(orderUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash);
@@ -553,15 +552,15 @@ describe('Exchange', () => {
it('should throw when taker is specified and order is claimed by other', async () => {
signedOrder = orderFactory.newSignedOrder({
takerAddress: feeRecipientAddress,
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
});
return expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT);
});
it('should throw if signature is invalid', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
});
const invalidR = ethUtil.sha3('invalidR');
@@ -573,35 +572,35 @@ describe('Exchange', () => {
return expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT);
});
- it('should throw if makerTokenAmount is 0', async () => {
+ it('should throw if makerAssetAmount is 0', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(0),
+ makerAssetAmount: new BigNumber(0),
});
return expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT);
});
- it('should throw if takerTokenAmount is 0', async () => {
+ it('should throw if takerAssetAmount is 0', async () => {
signedOrder = orderFactory.newSignedOrder({
- takerTokenAmount: new BigNumber(0),
+ takerAssetAmount: new BigNumber(0),
});
return expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT);
});
- it('should throw if takerTokenFillAmount is 0', async () => {
+ it('should throw if takerAssetFillAmount is 0', async () => {
signedOrder = orderFactory.newSignedOrder();
return expect(
exWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerTokenFillAmount: new BigNumber(0),
+ takerAssetFillAmount: new BigNumber(0),
}),
).to.be.rejectedWith(constants.REVERT);
});
it('should throw if maker balances are too low to fill order', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
});
return expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT);
@@ -609,7 +608,7 @@ describe('Exchange', () => {
it('should throw if taker balances are too low to fill order', async () => {
signedOrder = orderFactory.newSignedOrder({
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
});
return expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT);
@@ -679,17 +678,17 @@ describe('Exchange', () => {
return expect(exWrapper.cancelOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT);
});
- it('should throw if makerTokenAmount is 0', async () => {
+ it('should throw if makerAssetAmount is 0', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(0),
+ makerAssetAmount: new BigNumber(0),
});
return expect(exWrapper.cancelOrderAsync(signedOrder, makerAddress)).to.be.rejectedWith(constants.REVERT);
});
- it('should throw if takerTokenAmount is 0', async () => {
+ it('should throw if takerAssetAmount is 0', async () => {
signedOrder = orderFactory.newSignedOrder({
- takerTokenAmount: new BigNumber(0),
+ takerAssetAmount: new BigNumber(0),
});
return expect(exWrapper.cancelOrderAsync(signedOrder, makerAddress)).to.be.rejectedWith(constants.REVERT);
@@ -698,7 +697,7 @@ describe('Exchange', () => {
it('should be able to cancel a full order', async () => {
await exWrapper.cancelOrderAsync(signedOrder, makerAddress);
await exWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerTokenFillAmount: signedOrder.takerTokenAmount.div(2),
+ takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
});
const newBalances = await dmyBalances.getAsync();
@@ -771,47 +770,47 @@ describe('Exchange', () => {
balances = await dmyBalances.getAsync();
const signedOrders = await Promise.all([
orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(9), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(9), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(9), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(9), 18),
salt: new BigNumber(0),
}),
orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(79), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(79), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(79), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(79), 18),
salt: new BigNumber(1),
}),
orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
salt: new BigNumber(2),
}),
orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(7979), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(7979), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(7979), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(7979), 18),
salt: new BigNumber(3),
}),
]);
await exWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress);
const newBalances = await dmyBalances.getAsync();
- const fillMakerTokenAmount = signedOrders[2].makerTokenAmount.add(signedOrders[3].makerTokenAmount);
- const fillTakerTokenAmount = signedOrders[2].takerTokenAmount.add(signedOrders[3].takerTokenAmount);
+ const fillMakerAssetAmount = signedOrders[2].makerAssetAmount.add(signedOrders[3].makerAssetAmount);
+ const fillTakerAssetAmount = signedOrders[2].takerAssetAmount.add(signedOrders[3].takerAssetAmount);
const makerFee = signedOrders[2].makerFee.add(signedOrders[3].makerFee);
const takerFee = signedOrders[2].takerFee.add(signedOrders[3].takerFee);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(fillMakerTokenAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(fillMakerAssetAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(fillTakerTokenAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(fillTakerAssetAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(fillTakerTokenAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(fillTakerAssetAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(fillMakerTokenAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(fillMakerAssetAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -825,165 +824,165 @@ describe('Exchange', () => {
describe('Testing Exchange of ERC721 Tokens', () => {
it('should successfully exchange a single token between the maker and taker (via fillOrder)', async () => {
// Construct Exchange parameters
- const makerTokenId = erc721MakerTokenIds[0];
- const takerTokenId = erc721TakerTokenIds[1];
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[1];
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(1),
- takerTokenAmount: new BigNumber(1),
- makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId),
- takerAssetData: encodeERC721ProxyData(erc721Token.address, takerTokenId),
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: new BigNumber(1),
+ makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
- const takerTokenFillAmount = signedOrder.takerTokenAmount;
- const res = await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount });
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ const res = await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
// Verify post-conditions
- const newOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(newOwnerMakerToken).to.be.bignumber.equal(takerAddress);
- const newOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(newOwnerTakerToken).to.be.bignumber.equal(makerAddress);
+ const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
+ const newOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(newOwnerTakerAsset).to.be.bignumber.equal(makerAddress);
});
- it('should throw when maker does not own the token with id makerTokenId', async () => {
+ it('should throw when maker does not own the token with id makerAssetId', async () => {
// Construct Exchange parameters
- const makerTokenId = erc721TakerTokenIds[0];
- const takerTokenId = erc721TakerTokenIds[1];
+ const makerAssetId = erc721TakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[1];
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(1),
- takerTokenAmount: new BigNumber(1),
- makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId),
- takerAssetData: encodeERC721ProxyData(erc721Token.address, takerTokenId),
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: new BigNumber(1),
+ makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(initialOwnerMakerToken).to.be.bignumber.not.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.not.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
- const takerTokenFillAmount = signedOrder.takerTokenAmount;
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expect(
- exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount }),
+ exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
).to.be.rejectedWith(constants.REVERT);
});
- it('should throw when taker does not own the token with id takerTokenId', async () => {
+ it('should throw when taker does not own the token with id takerAssetId', async () => {
// Construct Exchange parameters
- const makerTokenId = erc721MakerTokenIds[0];
- const takerTokenId = erc721MakerTokenIds[1];
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721MakerAssetIds[1];
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(1),
- takerTokenAmount: new BigNumber(1),
- makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId),
- takerAssetData: encodeERC721ProxyData(erc721Token.address, takerTokenId),
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: new BigNumber(1),
+ makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(initialOwnerTakerToken).to.be.bignumber.not.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.not.equal(takerAddress);
// Call Exchange
- const takerTokenFillAmount = signedOrder.takerTokenAmount;
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expect(
- exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount }),
+ exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
).to.be.rejectedWith(constants.REVERT);
});
- it('should throw when makerTokenAmount is greater than 1', async () => {
+ it('should throw when makerAssetAmount is greater than 1', async () => {
// Construct Exchange parameters
- const makerTokenId = erc721MakerTokenIds[0];
- const takerTokenId = erc721TakerTokenIds[0];
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(2),
- takerTokenAmount: new BigNumber(1),
- makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId),
- takerAssetData: encodeERC721ProxyData(erc721Token.address, takerTokenId),
+ makerAssetAmount: new BigNumber(2),
+ takerAssetAmount: new BigNumber(1),
+ makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
- const takerTokenFillAmount = signedOrder.takerTokenAmount;
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expect(
- exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount }),
+ exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
).to.be.rejectedWith(constants.REVERT);
});
- it('should throw when takerTokenAmount is greater than 1', async () => {
+ it('should throw when takerAssetAmount is greater than 1', async () => {
// Construct Exchange parameters
- const makerTokenId = erc721MakerTokenIds[0];
- const takerTokenId = erc721TakerTokenIds[0];
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(1),
- takerTokenAmount: new BigNumber(500),
- makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId),
- takerAssetData: encodeERC721ProxyData(erc721Token.address, takerTokenId),
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: new BigNumber(500),
+ makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
- const takerTokenFillAmount = signedOrder.takerTokenAmount;
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expect(
- exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount }),
+ exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
).to.be.rejectedWith(constants.REVERT);
});
it('should throw on partial fill', async () => {
// Construct Exchange parameters
- const makerTokenId = erc721MakerTokenIds[0];
- const takerTokenId = erc721TakerTokenIds[0];
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(1),
- takerTokenAmount: new BigNumber(0),
- makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId),
- takerAssetData: encodeERC721ProxyData(erc721Token.address, takerTokenId),
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: new BigNumber(0),
+ makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
- const takerTokenFillAmount = signedOrder.takerTokenAmount;
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expect(
- exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount }),
+ exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
).to.be.rejectedWith(constants.REVERT);
});
- it('should successfully fill order when makerToken is ERC721 and takerToken is ERC20', async () => {
+ it('should successfully fill order when makerAsset is ERC721 and takerAsset is ERC20', async () => {
// Construct Exchange parameters
- const makerTokenId = erc721MakerTokenIds[0];
+ const makerAssetId = erc721MakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(1),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId),
- takerAssetData: encodeERC20ProxyData(defaultTakerTokenAddress),
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
// Call Exchange
balances = await dmyBalances.getAsync();
- const takerTokenFillAmount = signedOrder.takerTokenAmount;
- await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount });
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
// Verify ERC721 token was transferred from Maker to Taker
- const newOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(newOwnerMakerToken).to.be.bignumber.equal(takerAddress);
+ const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
// Verify ERC20 tokens were transferred from Taker to Maker & fees were paid correctly
const newBalances = await dmyBalances.getAsync();
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(signedOrder.makerFee),
@@ -996,32 +995,32 @@ describe('Exchange', () => {
);
});
- it('should successfully fill order when makerToken is ERC20 and takerToken is ERC721', async () => {
+ it('should successfully fill order when makerAsset is ERC20 and takerAsset is ERC721', async () => {
// Construct Exchange parameters
- const takerTokenId = erc721TakerTokenIds[0];
+ const takerAssetId = erc721TakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
- takerTokenAmount: new BigNumber(1),
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetData: encodeERC721ProxyData(erc721Token.address, takerTokenId),
- makerAssetData: encodeERC20ProxyData(defaultMakerTokenAddress),
+ takerAssetAmount: new BigNumber(1),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
+ makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
});
// Verify pre-conditions
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
balances = await dmyBalances.getAsync();
- const takerTokenFillAmount = signedOrder.takerTokenAmount;
- await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerTokenFillAmount });
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
// Verify ERC721 token was transferred from Taker to Maker
- const newOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(newOwnerTakerToken).to.be.bignumber.equal(makerAddress);
+ const newOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(newOwnerTakerAsset).to.be.bignumber.equal(makerAddress);
// Verify ERC20 tokens were transferred from Maker to Taker & fees were paid correctly
const newBalances = await dmyBalances.getAsync();
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(signedOrder.makerTokenAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(signedOrder.makerAssetAmount),
);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(signedOrder.makerTokenAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(signedOrder.makerAssetAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(signedOrder.makerFee),
diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts
index 43dfd5402..3c4431647 100644
--- a/packages/contracts/test/exchange/helpers.ts
+++ b/packages/contracts/test/exchange/helpers.ts
@@ -7,7 +7,7 @@ import ethUtil = require('ethereumjs-util');
import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy';
import { ExchangeContract } from '../../src/contract_wrappers/generated/exchange';
-import { encodeERC20ProxyData } from '../../src/utils/asset_proxy_utils';
+import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
import { constants } from '../../src/utils/constants';
import { ExchangeWrapper } from '../../src/utils/exchange_wrapper';
import { OrderFactory } from '../../src/utils/order_factory';
@@ -36,16 +36,15 @@ describe('Exchange', () => {
const owner = accounts[0];
const tokenRegistry = await deployer.deployAsync(ContractName.TokenRegistry);
const [rep, dgd, zrx] = await Promise.all([
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
+ deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS),
+ deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS),
+ deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS),
]);
const assetProxyDispatcher = await deployer.deployAsync(ContractName.AssetProxyDispatcher);
// Deploy and configure Exchange
const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
- zrx.address,
- AssetProxyId.ERC20,
assetProxyDispatcher.address,
+ AssetProxyId.ERC20,
]);
const exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner });
@@ -55,12 +54,12 @@ describe('Exchange', () => {
exchangeAddress: exchange.address,
makerAddress,
feeRecipientAddress,
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
takerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
- makerAssetData: encodeERC20ProxyData(rep.address),
- takerAssetData: encodeERC20ProxyData(dgd.address),
+ makerAssetData: assetProxyUtils.encodeERC20ProxyData(rep.address),
+ takerAssetData: assetProxyUtils.encodeERC20ProxyData(dgd.address),
};
const privateKey = constants.TESTRPC_PRIVATE_KEYS[0];
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index 7744d0388..88755ee03 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -7,13 +7,13 @@ import * as _ from 'lodash';
import * as Web3 from 'web3';
import { AssetProxyDispatcherContract } from '../../src/contract_wrappers/generated/asset_proxy_dispatcher';
+import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c20_token';
import { DummyERC721TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c721_token';
-import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token';
import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy';
import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy';
import { ExchangeContract } from '../../src/contract_wrappers/generated/exchange';
import { TokenRegistryContract } from '../../src/contract_wrappers/generated/token_registry';
-import { encodeERC20ProxyData, encodeERC721ProxyData } from '../../src/utils/asset_proxy_utils';
+import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
import { Balances } from '../../src/utils/balances';
import { constants } from '../../src/utils/constants';
import { ExchangeWrapper } from '../../src/utils/exchange_wrapper';
@@ -36,9 +36,9 @@ describe('Exchange', () => {
const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
- let rep: DummyTokenContract;
- let dgd: DummyTokenContract;
- let zrx: DummyTokenContract;
+ let rep: DummyERC20TokenContract;
+ let dgd: DummyERC20TokenContract;
+ let zrx: DummyERC20TokenContract;
let erc721Token: DummyERC721TokenContract;
let exchange: ExchangeContract;
let tokenRegistry: TokenRegistryContract;
@@ -52,11 +52,11 @@ describe('Exchange', () => {
let dmyBalances: Balances;
let orderFactory: OrderFactory;
- const erc721MakerTokenId = new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010');
- const erc721TakerTokenId = new BigNumber('0x3030303030303030303030303030303030303030303030303030303030303030');
+ const erc721MakerAssetId = new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010');
+ const erc721TakerAssetId = new BigNumber('0x3030303030303030303030303030303030303030303030303030303030303030');
- let defaultMakerTokenAddress: string;
- let defaultTakerTokenAddress: string;
+ let defaultMakerAssetAddress: string;
+ let defaultTakerAssetAddress: string;
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
@@ -64,14 +64,14 @@ describe('Exchange', () => {
[makerAddress, takerAddress, feeRecipientAddress] = accounts;
const owner = tokenOwner;
const [repInstance, dgdInstance, zrxInstance, erc721TokenInstance] = await Promise.all([
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
+ deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS),
+ deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS),
+ deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS),
deployer.deployAsync(ContractName.DummyERC721Token, constants.DUMMY_ERC721TOKEN_ARGS),
]);
- rep = new DummyTokenContract(repInstance.abi, repInstance.address, provider);
- dgd = new DummyTokenContract(dgdInstance.abi, dgdInstance.address, provider);
- zrx = new DummyTokenContract(zrxInstance.abi, zrxInstance.address, provider);
+ rep = new DummyERC20TokenContract(repInstance.abi, repInstance.address, provider);
+ dgd = new DummyERC20TokenContract(dgdInstance.abi, dgdInstance.address, provider);
+ zrx = new DummyERC20TokenContract(zrxInstance.abi, zrxInstance.address, provider);
erc721Token = new DummyERC721TokenContract(erc721TokenInstance.abi, erc721TokenInstance.address, provider);
const tokenRegistryInstance = await deployer.deployAsync(ContractName.TokenRegistry);
tokenRegistry = new TokenRegistryContract(tokenRegistryInstance.abi, tokenRegistryInstance.address, provider);
@@ -110,9 +110,8 @@ describe('Exchange', () => {
);
// Deploy and configure Exchange
const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
- zrx.address,
- encodeERC20ProxyData(zrx.address),
assetProxyDispatcher.address,
+ assetProxyUtils.encodeERC20ProxyData(zrx.address),
]);
exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner });
@@ -120,18 +119,18 @@ describe('Exchange', () => {
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
exWrapper = new ExchangeWrapper(exchange, zeroEx);
- defaultMakerTokenAddress = rep.address;
- defaultTakerTokenAddress = dgd.address;
+ defaultMakerAssetAddress = rep.address;
+ defaultTakerAssetAddress = dgd.address;
const defaultOrderParams = {
exchangeAddress: exchange.address,
makerAddress,
feeRecipientAddress,
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
takerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
- makerAssetData: encodeERC20ProxyData(defaultMakerTokenAddress),
- takerAssetData: encodeERC20ProxyData(defaultTakerTokenAddress),
+ makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
+ takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
};
const privateKey = constants.TESTRPC_PRIVATE_KEYS[0];
@@ -156,8 +155,8 @@ describe('Exchange', () => {
erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, {
from: takerAddress,
}),
- erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerTokenId, { from: tokenOwner }),
- erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerTokenId, { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerAssetId, { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerAssetId, { from: tokenOwner }),
]);
});
beforeEach(async () => {
@@ -170,39 +169,39 @@ describe('Exchange', () => {
describe('fillOrKillOrder', () => {
it('should transfer the correct amounts', async () => {
const signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
});
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
await exWrapper.fillOrKillOrderAsync(signedOrder, takerAddress, {
- takerTokenFillAmount,
+ takerAssetFillAmount,
});
const newBalances = await dmyBalances.getAsync();
- const makerTokenFilledAmount = takerTokenFillAmount
- .times(signedOrder.makerTokenAmount)
- .dividedToIntegerBy(signedOrder.takerTokenAmount);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
const makerFee = signedOrder.makerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
const takerFee = signedOrder.takerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount),
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -222,11 +221,11 @@ describe('Exchange', () => {
);
});
- it('should throw if entire takerTokenFillAmount not filled', async () => {
+ it('should throw if entire takerAssetFillAmount not filled', async () => {
const signedOrder = orderFactory.newSignedOrder();
await exWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerTokenFillAmount: signedOrder.takerTokenAmount.div(2),
+ takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
});
return expect(exWrapper.fillOrKillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
@@ -238,39 +237,39 @@ describe('Exchange', () => {
describe('fillOrderNoThrow', () => {
it('should transfer the correct amounts', async () => {
const signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
});
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, {
- takerTokenFillAmount,
+ takerAssetFillAmount,
});
const newBalances = await dmyBalances.getAsync();
- const makerTokenFilledAmount = takerTokenFillAmount
- .times(signedOrder.makerTokenAmount)
- .dividedToIntegerBy(signedOrder.takerTokenAmount);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
const makerFee = signedOrder.makerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
const takerFee = signedOrder.takerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount),
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -282,7 +281,7 @@ describe('Exchange', () => {
it('should not change balances if maker balances are too low to fill order', async () => {
const signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
+ makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
});
await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
@@ -292,7 +291,7 @@ describe('Exchange', () => {
it('should not change balances if taker balances are too low to fill order', async () => {
const signedOrder = orderFactory.newSignedOrder({
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
+ takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
});
await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
@@ -328,48 +327,48 @@ describe('Exchange', () => {
expect(newBalances).to.be.deep.equal(balances);
});
- it('should not change balances if makerTokenAddress is ZRX, makerTokenAmount + makerFee > maker balance', async () => {
+ it('should not change balances if makerAssetAddress is ZRX, makerAssetAmount + makerFee > maker balance', async () => {
const makerZRXBalance = new BigNumber(balances[makerAddress][zrx.address]);
const signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: makerZRXBalance,
+ makerAssetAmount: makerZRXBalance,
makerFee: new BigNumber(1),
- makerAssetData: encodeERC20ProxyData(zrx.address),
+ makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address),
});
await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await dmyBalances.getAsync();
expect(newBalances).to.be.deep.equal(balances);
});
- it('should not change balances if makerTokenAddress is ZRX, makerTokenAmount + makerFee > maker allowance', async () => {
+ it('should not change balances if makerAssetAddress is ZRX, makerAssetAmount + makerFee > maker allowance', async () => {
const makerZRXAllowance = await zrx.allowance.callAsync(makerAddress, erc20Proxy.address);
const signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(makerZRXAllowance),
+ makerAssetAmount: new BigNumber(makerZRXAllowance),
makerFee: new BigNumber(1),
- makerAssetData: encodeERC20ProxyData(zrx.address),
+ makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address),
});
await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await dmyBalances.getAsync();
expect(newBalances).to.be.deep.equal(balances);
});
- it('should not change balances if takerTokenAddress is ZRX, takerTokenAmount + takerFee > taker balance', async () => {
+ it('should not change balances if takerAssetAddress is ZRX, takerAssetAmount + takerFee > taker balance', async () => {
const takerZRXBalance = new BigNumber(balances[takerAddress][zrx.address]);
const signedOrder = orderFactory.newSignedOrder({
- takerTokenAmount: takerZRXBalance,
+ takerAssetAmount: takerZRXBalance,
takerFee: new BigNumber(1),
- takerAssetData: encodeERC20ProxyData(zrx.address),
+ takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address),
});
await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await dmyBalances.getAsync();
expect(newBalances).to.be.deep.equal(balances);
});
- it('should not change balances if takerTokenAddress is ZRX, takerTokenAmount + takerFee > taker allowance', async () => {
+ it('should not change balances if takerAssetAddress is ZRX, takerAssetAmount + takerFee > taker allowance', async () => {
const takerZRXAllowance = await zrx.allowance.callAsync(takerAddress, erc20Proxy.address);
const signedOrder = orderFactory.newSignedOrder({
- takerTokenAmount: new BigNumber(takerZRXAllowance),
+ takerAssetAmount: new BigNumber(takerZRXAllowance),
takerFee: new BigNumber(1),
- takerAssetData: encodeERC20ProxyData(zrx.address),
+ takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address),
});
await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await dmyBalances.getAsync();
@@ -378,27 +377,27 @@ describe('Exchange', () => {
it('should successfully exchange ERC721 tokens', async () => {
// Construct Exchange parameters
- const makerTokenId = erc721MakerTokenId;
- const takerTokenId = erc721TakerTokenId;
+ const makerAssetId = erc721MakerAssetId;
+ const takerAssetId = erc721TakerAssetId;
const signedOrder = orderFactory.newSignedOrder({
- makerTokenAmount: new BigNumber(1),
- takerTokenAmount: new BigNumber(1),
- makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId),
- takerAssetData: encodeERC721ProxyData(erc721Token.address, takerTokenId),
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: new BigNumber(1),
+ makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
+ takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
- const takerTokenFillAmount = signedOrder.takerTokenAmount;
- await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, { takerTokenFillAmount });
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, { takerAssetFillAmount });
// Verify post-conditions
- const newOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
- expect(newOwnerMakerToken).to.be.bignumber.equal(takerAddress);
- const newOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId);
- expect(newOwnerTakerToken).to.be.bignumber.equal(makerAddress);
+ const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
+ const newOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(newOwnerTakerAsset).to.be.bignumber.equal(makerAddress);
});
});
@@ -414,33 +413,33 @@ describe('Exchange', () => {
describe('batchFillOrders', () => {
it('should transfer the correct amounts', async () => {
- const takerTokenFillAmounts: BigNumber[] = [];
- const makerTokenAddress = rep.address;
- const takerTokenAddress = dgd.address;
+ const takerAssetFillAmounts: BigNumber[] = [];
+ const makerAssetAddress = rep.address;
+ const takerAssetAddress = dgd.address;
_.forEach(signedOrders, signedOrder => {
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
- const makerTokenFilledAmount = takerTokenFillAmount
- .times(signedOrder.makerTokenAmount)
- .dividedToIntegerBy(signedOrder.takerTokenAmount);
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
const makerFee = signedOrder.makerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
const takerFee = signedOrder.takerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
- takerTokenFillAmounts.push(takerTokenFillAmount);
- balances[makerAddress][makerTokenAddress] = balances[makerAddress][makerTokenAddress].minus(
- makerTokenFilledAmount,
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ takerAssetFillAmounts.push(takerAssetFillAmount);
+ balances[makerAddress][makerAssetAddress] = balances[makerAddress][makerAssetAddress].minus(
+ makerAssetFilledAmount,
);
- balances[makerAddress][takerTokenAddress] = balances[makerAddress][takerTokenAddress].add(
- takerTokenFillAmount,
+ balances[makerAddress][takerAssetAddress] = balances[makerAddress][takerAssetAddress].add(
+ takerAssetFillAmount,
);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(makerFee);
- balances[takerAddress][makerTokenAddress] = balances[takerAddress][makerTokenAddress].add(
- makerTokenFilledAmount,
+ balances[takerAddress][makerAssetAddress] = balances[takerAddress][makerAssetAddress].add(
+ makerAssetFilledAmount,
);
- balances[takerAddress][takerTokenAddress] = balances[takerAddress][takerTokenAddress].minus(
- takerTokenFillAmount,
+ balances[takerAddress][takerAssetAddress] = balances[takerAddress][takerAssetAddress].minus(
+ takerAssetFillAmount,
);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(takerFee);
balances[feeRecipientAddress][zrx.address] = balances[feeRecipientAddress][zrx.address].add(
@@ -449,7 +448,7 @@ describe('Exchange', () => {
});
await exWrapper.batchFillOrdersAsync(signedOrders, takerAddress, {
- takerTokenFillAmounts,
+ takerAssetFillAmounts,
});
const newBalances = await dmyBalances.getAsync();
@@ -459,33 +458,33 @@ describe('Exchange', () => {
describe('batchFillOrKillOrders', () => {
it('should transfer the correct amounts', async () => {
- const takerTokenFillAmounts: BigNumber[] = [];
- const makerTokenAddress = rep.address;
- const takerTokenAddress = dgd.address;
+ const takerAssetFillAmounts: BigNumber[] = [];
+ const makerAssetAddress = rep.address;
+ const takerAssetAddress = dgd.address;
_.forEach(signedOrders, signedOrder => {
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
- const makerTokenFilledAmount = takerTokenFillAmount
- .times(signedOrder.makerTokenAmount)
- .dividedToIntegerBy(signedOrder.takerTokenAmount);
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
const makerFee = signedOrder.makerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
const takerFee = signedOrder.takerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
- takerTokenFillAmounts.push(takerTokenFillAmount);
- balances[makerAddress][makerTokenAddress] = balances[makerAddress][makerTokenAddress].minus(
- makerTokenFilledAmount,
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ takerAssetFillAmounts.push(takerAssetFillAmount);
+ balances[makerAddress][makerAssetAddress] = balances[makerAddress][makerAssetAddress].minus(
+ makerAssetFilledAmount,
);
- balances[makerAddress][takerTokenAddress] = balances[makerAddress][takerTokenAddress].add(
- takerTokenFillAmount,
+ balances[makerAddress][takerAssetAddress] = balances[makerAddress][takerAssetAddress].add(
+ takerAssetFillAmount,
);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(makerFee);
- balances[takerAddress][makerTokenAddress] = balances[takerAddress][makerTokenAddress].add(
- makerTokenFilledAmount,
+ balances[takerAddress][makerAssetAddress] = balances[takerAddress][makerAssetAddress].add(
+ makerAssetFilledAmount,
);
- balances[takerAddress][takerTokenAddress] = balances[takerAddress][takerTokenAddress].minus(
- takerTokenFillAmount,
+ balances[takerAddress][takerAssetAddress] = balances[takerAddress][takerAssetAddress].minus(
+ takerAssetFillAmount,
);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(takerFee);
balances[feeRecipientAddress][zrx.address] = balances[feeRecipientAddress][zrx.address].add(
@@ -494,7 +493,7 @@ describe('Exchange', () => {
});
await exWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
- takerTokenFillAmounts,
+ takerAssetFillAmounts,
});
const newBalances = await dmyBalances.getAsync();
@@ -502,17 +501,17 @@ describe('Exchange', () => {
});
it('should throw if a single signedOrder does not fill the expected amount', async () => {
- const takerTokenFillAmounts: BigNumber[] = [];
+ const takerAssetFillAmounts: BigNumber[] = [];
_.forEach(signedOrders, signedOrder => {
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
- takerTokenFillAmounts.push(takerTokenFillAmount);
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ takerAssetFillAmounts.push(takerAssetFillAmount);
});
await exWrapper.fillOrKillOrderAsync(signedOrders[0], takerAddress);
return expect(
exWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
- takerTokenFillAmounts,
+ takerAssetFillAmounts,
}),
).to.be.rejectedWith(constants.REVERT);
});
@@ -520,33 +519,33 @@ describe('Exchange', () => {
describe('batchFillOrdersNoThrow', async () => {
it('should transfer the correct amounts', async () => {
- const takerTokenFillAmounts: BigNumber[] = [];
- const makerTokenAddress = rep.address;
- const takerTokenAddress = dgd.address;
+ const takerAssetFillAmounts: BigNumber[] = [];
+ const makerAssetAddress = rep.address;
+ const takerAssetAddress = dgd.address;
_.forEach(signedOrders, signedOrder => {
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
- const makerTokenFilledAmount = takerTokenFillAmount
- .times(signedOrder.makerTokenAmount)
- .dividedToIntegerBy(signedOrder.takerTokenAmount);
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
const makerFee = signedOrder.makerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
const takerFee = signedOrder.takerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
- takerTokenFillAmounts.push(takerTokenFillAmount);
- balances[makerAddress][makerTokenAddress] = balances[makerAddress][makerTokenAddress].minus(
- makerTokenFilledAmount,
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ takerAssetFillAmounts.push(takerAssetFillAmount);
+ balances[makerAddress][makerAssetAddress] = balances[makerAddress][makerAssetAddress].minus(
+ makerAssetFilledAmount,
);
- balances[makerAddress][takerTokenAddress] = balances[makerAddress][takerTokenAddress].add(
- takerTokenFillAmount,
+ balances[makerAddress][takerAssetAddress] = balances[makerAddress][takerAssetAddress].add(
+ takerAssetFillAmount,
);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(makerFee);
- balances[takerAddress][makerTokenAddress] = balances[takerAddress][makerTokenAddress].add(
- makerTokenFilledAmount,
+ balances[takerAddress][makerAssetAddress] = balances[takerAddress][makerAssetAddress].add(
+ makerAssetFilledAmount,
);
- balances[takerAddress][takerTokenAddress] = balances[takerAddress][takerTokenAddress].minus(
- takerTokenFillAmount,
+ balances[takerAddress][takerAssetAddress] = balances[takerAddress][takerAssetAddress].minus(
+ takerAssetFillAmount,
);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(takerFee);
balances[feeRecipientAddress][zrx.address] = balances[feeRecipientAddress][zrx.address].add(
@@ -555,7 +554,7 @@ describe('Exchange', () => {
});
await exWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerTokenFillAmounts,
+ takerAssetFillAmounts,
});
const newBalances = await dmyBalances.getAsync();
@@ -563,9 +562,9 @@ describe('Exchange', () => {
});
it('should not throw if an order is invalid and fill the remaining orders', async () => {
- const takerTokenFillAmounts: BigNumber[] = [];
- const makerTokenAddress = rep.address;
- const takerTokenAddress = dgd.address;
+ const takerAssetFillAmounts: BigNumber[] = [];
+ const makerAssetAddress = rep.address;
+ const takerAssetAddress = dgd.address;
const invalidOrder = {
...signedOrders[0],
@@ -573,31 +572,31 @@ describe('Exchange', () => {
};
const validOrders = signedOrders.slice(1);
- takerTokenFillAmounts.push(invalidOrder.takerTokenAmount.div(2));
+ takerAssetFillAmounts.push(invalidOrder.takerAssetAmount.div(2));
_.forEach(validOrders, signedOrder => {
- const takerTokenFillAmount = signedOrder.takerTokenAmount.div(2);
- const makerTokenFilledAmount = takerTokenFillAmount
- .times(signedOrder.makerTokenAmount)
- .dividedToIntegerBy(signedOrder.takerTokenAmount);
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
const makerFee = signedOrder.makerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
const takerFee = signedOrder.takerFee
- .times(makerTokenFilledAmount)
- .dividedToIntegerBy(signedOrder.makerTokenAmount);
- takerTokenFillAmounts.push(takerTokenFillAmount);
- balances[makerAddress][makerTokenAddress] = balances[makerAddress][makerTokenAddress].minus(
- makerTokenFilledAmount,
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ takerAssetFillAmounts.push(takerAssetFillAmount);
+ balances[makerAddress][makerAssetAddress] = balances[makerAddress][makerAssetAddress].minus(
+ makerAssetFilledAmount,
);
- balances[makerAddress][takerTokenAddress] = balances[makerAddress][takerTokenAddress].add(
- takerTokenFillAmount,
+ balances[makerAddress][takerAssetAddress] = balances[makerAddress][takerAssetAddress].add(
+ takerAssetFillAmount,
);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(makerFee);
- balances[takerAddress][makerTokenAddress] = balances[takerAddress][makerTokenAddress].add(
- makerTokenFilledAmount,
+ balances[takerAddress][makerAssetAddress] = balances[takerAddress][makerAssetAddress].add(
+ makerAssetFilledAmount,
);
- balances[takerAddress][takerTokenAddress] = balances[takerAddress][takerTokenAddress].minus(
- takerTokenFillAmount,
+ balances[takerAddress][takerAssetAddress] = balances[takerAddress][takerAssetAddress].minus(
+ takerAssetFillAmount,
);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(takerFee);
balances[feeRecipientAddress][zrx.address] = balances[feeRecipientAddress][zrx.address].add(
@@ -607,7 +606,7 @@ describe('Exchange', () => {
const newOrders = [invalidOrder, ...validOrders];
await exWrapper.batchFillOrdersNoThrowAsync(newOrders, takerAddress, {
- takerTokenFillAmounts,
+ takerAssetFillAmounts,
});
const newBalances = await dmyBalances.getAsync();
@@ -616,35 +615,35 @@ describe('Exchange', () => {
});
describe('marketSellOrders', () => {
- it('should stop when the entire takerTokenFillAmount is filled', async () => {
- const takerTokenFillAmount = signedOrders[0].takerTokenAmount.plus(
- signedOrders[1].takerTokenAmount.div(2),
+ it('should stop when the entire takerAssetFillAmount is filled', async () => {
+ const takerAssetFillAmount = signedOrders[0].takerAssetAmount.plus(
+ signedOrders[1].takerAssetAmount.div(2),
);
await exWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
- takerTokenFillAmount,
+ takerAssetFillAmount,
});
const newBalances = await dmyBalances.getAsync();
- const makerTokenFilledAmount = signedOrders[0].makerTokenAmount.add(
- signedOrders[1].makerTokenAmount.dividedToIntegerBy(2),
+ const makerAssetFilledAmount = signedOrders[0].makerAssetAmount.add(
+ signedOrders[1].makerAssetAmount.dividedToIntegerBy(2),
);
const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -654,24 +653,24 @@ describe('Exchange', () => {
);
});
- it('should fill all signedOrders if cannot fill entire takerTokenFillAmount', async () => {
- const takerTokenFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
+ it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
+ const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
- balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][
- defaultMakerTokenAddress
- ].minus(signedOrder.makerTokenAmount);
- balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][
- defaultTakerTokenAddress
- ].add(signedOrder.takerTokenAmount);
+ balances[makerAddress][defaultMakerAssetAddress] = balances[makerAddress][
+ defaultMakerAssetAddress
+ ].minus(signedOrder.makerAssetAmount);
+ balances[makerAddress][defaultTakerAssetAddress] = balances[makerAddress][
+ defaultTakerAssetAddress
+ ].add(signedOrder.takerAssetAmount);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(
signedOrder.makerFee,
);
- balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][
- defaultMakerTokenAddress
- ].add(signedOrder.makerTokenAmount);
- balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][
- defaultTakerTokenAddress
- ].minus(signedOrder.takerTokenAmount);
+ balances[takerAddress][defaultMakerAssetAddress] = balances[takerAddress][
+ defaultMakerAssetAddress
+ ].add(signedOrder.makerAssetAmount);
+ balances[takerAddress][defaultTakerAssetAddress] = balances[takerAddress][
+ defaultTakerAssetAddress
+ ].minus(signedOrder.takerAssetAmount);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(
signedOrder.takerFee,
);
@@ -680,58 +679,58 @@ describe('Exchange', () => {
);
});
await exWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
- takerTokenFillAmount,
+ takerAssetFillAmount,
});
const newBalances = await dmyBalances.getAsync();
expect(newBalances).to.be.deep.equal(balances);
});
- it('should throw when an signedOrder does not use the same takerTokenAddress', async () => {
+ it('should throw when an signedOrder does not use the same takerAssetAddress', async () => {
signedOrders = [
orderFactory.newSignedOrder(),
- orderFactory.newSignedOrder({ takerAssetData: encodeERC20ProxyData(zrx.address) }),
+ orderFactory.newSignedOrder({ takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address) }),
orderFactory.newSignedOrder(),
];
return expect(
exWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
- takerTokenFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
+ takerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
}),
).to.be.rejectedWith(constants.REVERT);
});
});
describe('marketSellOrdersNoThrow', () => {
- it('should stop when the entire takerTokenFillAmount is filled', async () => {
- const takerTokenFillAmount = signedOrders[0].takerTokenAmount.plus(
- signedOrders[1].takerTokenAmount.div(2),
+ it('should stop when the entire takerAssetFillAmount is filled', async () => {
+ const takerAssetFillAmount = signedOrders[0].takerAssetAmount.plus(
+ signedOrders[1].takerAssetAmount.div(2),
);
await exWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerTokenFillAmount,
+ takerAssetFillAmount,
});
const newBalances = await dmyBalances.getAsync();
- const makerTokenFilledAmount = signedOrders[0].makerTokenAmount.add(
- signedOrders[1].makerTokenAmount.dividedToIntegerBy(2),
+ const makerAssetFilledAmount = signedOrders[0].makerAssetAmount.add(
+ signedOrders[1].makerAssetAmount.dividedToIntegerBy(2),
);
const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -741,24 +740,24 @@ describe('Exchange', () => {
);
});
- it('should fill all signedOrders if cannot fill entire takerTokenFillAmount', async () => {
- const takerTokenFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
+ it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
+ const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
- balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][
- defaultMakerTokenAddress
- ].minus(signedOrder.makerTokenAmount);
- balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][
- defaultTakerTokenAddress
- ].add(signedOrder.takerTokenAmount);
+ balances[makerAddress][defaultMakerAssetAddress] = balances[makerAddress][
+ defaultMakerAssetAddress
+ ].minus(signedOrder.makerAssetAmount);
+ balances[makerAddress][defaultTakerAssetAddress] = balances[makerAddress][
+ defaultTakerAssetAddress
+ ].add(signedOrder.takerAssetAmount);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(
signedOrder.makerFee,
);
- balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][
- defaultMakerTokenAddress
- ].add(signedOrder.makerTokenAmount);
- balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][
- defaultTakerTokenAddress
- ].minus(signedOrder.takerTokenAmount);
+ balances[takerAddress][defaultMakerAssetAddress] = balances[takerAddress][
+ defaultMakerAssetAddress
+ ].add(signedOrder.makerAssetAmount);
+ balances[takerAddress][defaultTakerAssetAddress] = balances[takerAddress][
+ defaultTakerAssetAddress
+ ].minus(signedOrder.takerAssetAmount);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(
signedOrder.takerFee,
);
@@ -767,58 +766,58 @@ describe('Exchange', () => {
);
});
await exWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerTokenFillAmount,
+ takerAssetFillAmount,
});
const newBalances = await dmyBalances.getAsync();
expect(newBalances).to.be.deep.equal(balances);
});
- it('should throw when a signedOrder does not use the same takerTokenAddress', async () => {
+ it('should throw when a signedOrder does not use the same takerAssetAddress', async () => {
signedOrders = [
orderFactory.newSignedOrder(),
- orderFactory.newSignedOrder({ takerAssetData: encodeERC20ProxyData(zrx.address) }),
+ orderFactory.newSignedOrder({ takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address) }),
orderFactory.newSignedOrder(),
];
return expect(
exWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerTokenFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
+ takerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
}),
).to.be.rejectedWith(constants.REVERT);
});
});
describe('marketBuyOrders', () => {
- it('should stop when the entire makerTokenFillAmount is filled', async () => {
- const makerTokenFillAmount = signedOrders[0].makerTokenAmount.plus(
- signedOrders[1].makerTokenAmount.div(2),
+ it('should stop when the entire makerAssetFillAmount is filled', async () => {
+ const makerAssetFillAmount = signedOrders[0].makerAssetAmount.plus(
+ signedOrders[1].makerAssetAmount.div(2),
);
await exWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
- makerTokenFillAmount,
+ makerAssetFillAmount,
});
const newBalances = await dmyBalances.getAsync();
- const makerAmountBought = signedOrders[0].takerTokenAmount.add(
- signedOrders[1].takerTokenAmount.dividedToIntegerBy(2),
+ const makerAmountBought = signedOrders[0].takerAssetAmount.add(
+ signedOrders[1].takerAssetAmount.dividedToIntegerBy(2),
);
const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(makerAmountBought),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(makerAmountBought),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -828,24 +827,24 @@ describe('Exchange', () => {
);
});
- it('should fill all signedOrders if cannot fill entire makerTokenFillAmount', async () => {
- const makerTokenFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
+ it('should fill all signedOrders if cannot fill entire makerAssetFillAmount', async () => {
+ const makerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
- balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][
- defaultMakerTokenAddress
- ].minus(signedOrder.makerTokenAmount);
- balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][
- defaultTakerTokenAddress
- ].add(signedOrder.takerTokenAmount);
+ balances[makerAddress][defaultMakerAssetAddress] = balances[makerAddress][
+ defaultMakerAssetAddress
+ ].minus(signedOrder.makerAssetAmount);
+ balances[makerAddress][defaultTakerAssetAddress] = balances[makerAddress][
+ defaultTakerAssetAddress
+ ].add(signedOrder.takerAssetAmount);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(
signedOrder.makerFee,
);
- balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][
- defaultMakerTokenAddress
- ].add(signedOrder.makerTokenAmount);
- balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][
- defaultTakerTokenAddress
- ].minus(signedOrder.takerTokenAmount);
+ balances[takerAddress][defaultMakerAssetAddress] = balances[takerAddress][
+ defaultMakerAssetAddress
+ ].add(signedOrder.makerAssetAmount);
+ balances[takerAddress][defaultTakerAssetAddress] = balances[takerAddress][
+ defaultTakerAssetAddress
+ ].minus(signedOrder.takerAssetAmount);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(
signedOrder.takerFee,
);
@@ -854,58 +853,58 @@ describe('Exchange', () => {
);
});
await exWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
- makerTokenFillAmount,
+ makerAssetFillAmount,
});
const newBalances = await dmyBalances.getAsync();
expect(newBalances).to.be.deep.equal(balances);
});
- it('should throw when an signedOrder does not use the same makerTokenAddress', async () => {
+ it('should throw when an signedOrder does not use the same makerAssetAddress', async () => {
signedOrders = [
orderFactory.newSignedOrder(),
- orderFactory.newSignedOrder({ makerAssetData: encodeERC20ProxyData(zrx.address) }),
+ orderFactory.newSignedOrder({ makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address) }),
orderFactory.newSignedOrder(),
];
return expect(
exWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
- makerTokenFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
+ makerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
}),
).to.be.rejectedWith(constants.REVERT);
});
});
describe('marketBuyOrdersNoThrow', () => {
- it('should stop when the entire makerTokenFillAmount is filled', async () => {
- const makerTokenFillAmount = signedOrders[0].makerTokenAmount.plus(
- signedOrders[1].makerTokenAmount.div(2),
+ it('should stop when the entire makerAssetFillAmount is filled', async () => {
+ const makerAssetFillAmount = signedOrders[0].makerAssetAmount.plus(
+ signedOrders[1].makerAssetAmount.div(2),
);
await exWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
- makerTokenFillAmount,
+ makerAssetFillAmount,
});
const newBalances = await dmyBalances.getAsync();
- const makerAmountBought = signedOrders[0].takerTokenAmount.add(
- signedOrders[1].takerTokenAmount.dividedToIntegerBy(2),
+ const makerAmountBought = signedOrders[0].takerAssetAmount.add(
+ signedOrders[1].takerAssetAmount.dividedToIntegerBy(2),
);
const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFillAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(makerAmountBought),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(makerAmountBought),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFillAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -915,24 +914,24 @@ describe('Exchange', () => {
);
});
- it('should fill all signedOrders if cannot fill entire takerTokenFillAmount', async () => {
- const takerTokenFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
+ it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
+ const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
- balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][
- defaultMakerTokenAddress
- ].minus(signedOrder.makerTokenAmount);
- balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][
- defaultTakerTokenAddress
- ].add(signedOrder.takerTokenAmount);
+ balances[makerAddress][defaultMakerAssetAddress] = balances[makerAddress][
+ defaultMakerAssetAddress
+ ].minus(signedOrder.makerAssetAmount);
+ balances[makerAddress][defaultTakerAssetAddress] = balances[makerAddress][
+ defaultTakerAssetAddress
+ ].add(signedOrder.takerAssetAmount);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(
signedOrder.makerFee,
);
- balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][
- defaultMakerTokenAddress
- ].add(signedOrder.makerTokenAmount);
- balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][
- defaultTakerTokenAddress
- ].minus(signedOrder.takerTokenAmount);
+ balances[takerAddress][defaultMakerAssetAddress] = balances[takerAddress][
+ defaultMakerAssetAddress
+ ].add(signedOrder.makerAssetAmount);
+ balances[takerAddress][defaultTakerAssetAddress] = balances[takerAddress][
+ defaultTakerAssetAddress
+ ].minus(signedOrder.takerAssetAmount);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(
signedOrder.takerFee,
);
@@ -941,23 +940,23 @@ describe('Exchange', () => {
);
});
await exWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerTokenFillAmount,
+ takerAssetFillAmount,
});
const newBalances = await dmyBalances.getAsync();
expect(newBalances).to.be.deep.equal(balances);
});
- it('should throw when a signedOrder does not use the same makerTokenAddress', async () => {
+ it('should throw when a signedOrder does not use the same makerAssetAddress', async () => {
signedOrders = [
orderFactory.newSignedOrder(),
- orderFactory.newSignedOrder({ makerAssetData: encodeERC20ProxyData(zrx.address) }),
+ orderFactory.newSignedOrder({ makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address) }),
orderFactory.newSignedOrder(),
];
return expect(
exWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
- makerTokenFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
+ makerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
}),
).to.be.rejectedWith(constants.REVERT);
});
@@ -965,11 +964,11 @@ describe('Exchange', () => {
describe('batchCancelOrders', () => {
it('should be able to cancel multiple signedOrders', async () => {
- const takerTokenCancelAmounts = _.map(signedOrders, signedOrder => signedOrder.takerTokenAmount);
+ const takerAssetCancelAmounts = _.map(signedOrders, signedOrder => signedOrder.takerAssetAmount);
await exWrapper.batchCancelOrdersAsync(signedOrders, makerAddress);
await exWrapper.batchFillOrdersAsync(signedOrders, takerAddress, {
- takerTokenFillAmounts: takerTokenCancelAmounts,
+ takerAssetFillAmounts: takerAssetCancelAmounts,
});
const newBalances = await dmyBalances.getAsync();
expect(balances).to.be.deep.equal(newBalances);
diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts
index d8f777c8f..95bc421e1 100644
--- a/packages/contracts/test/tutorials/arbitrage.ts
+++ b/packages/contracts/test/tutorials/arbitrage.ts
@@ -54,8 +54,8 @@
// before(async () => {
// const accounts = await web3Wrapper.getAvailableAddressesAsync();
// [coinbase, maker, edMaker, edFrontRunner] = accounts;
-// weth = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS);
-// zrx = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS);
+// weth = await deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS);
+// zrx = await deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS);
// const accountLevels = await deployer.deployAsync(ContractName.AccountLevels);
// const edAdminAddress = accounts[0];
// const edMakerFee = 0;
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts
index 50d5c4d03..f2284685f 100644
--- a/packages/contracts/test/unlimited_allowance_token.ts
+++ b/packages/contracts/test/unlimited_allowance_token.ts
@@ -5,7 +5,7 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import * as Web3 from 'web3';
-import { DummyTokenContract } from '../src/contract_wrappers/generated/dummy_token';
+import { DummyERC20TokenContract } from '../src/contract_wrappers/generated/dummy_e_r_c20_token';
import { constants } from '../src/utils/constants';
import { ContractName } from '../src/utils/types';
@@ -27,14 +27,14 @@ describe('UnlimitedAllowanceToken', () => {
const MAX_MINT_VALUE = new BigNumber(100000000000000000000);
let tokenAddress: string;
- let token: DummyTokenContract;
+ let token: DummyERC20TokenContract;
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
spender = accounts[1];
- const tokenInstance = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS);
- token = new DummyTokenContract(tokenInstance.abi, tokenInstance.address, provider);
+ const tokenInstance = await deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS);
+ token = new DummyERC20TokenContract(tokenInstance.abi, tokenInstance.address, provider);
await token.mint.sendTransactionAsync(MAX_MINT_VALUE, { from: owner });
tokenAddress = token.address;
});