aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-06-11 12:13:59 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-06-13 02:45:02 +0800
commit5910bec52e0664f70d5dc98ce8303ec5373107ba (patch)
tree38ca83fc80b7e9739c551112b691ce1cedceedaa
parent764b1c35cb7bf763deeb5db34ebe36d6e973b409 (diff)
downloaddexon-sol-tools-5910bec52e0664f70d5dc98ce8303ec5373107ba.tar
dexon-sol-tools-5910bec52e0664f70d5dc98ce8303ec5373107ba.tar.gz
dexon-sol-tools-5910bec52e0664f70d5dc98ce8303ec5373107ba.tar.bz2
dexon-sol-tools-5910bec52e0664f70d5dc98ce8303ec5373107ba.tar.lz
dexon-sol-tools-5910bec52e0664f70d5dc98ce8303ec5373107ba.tar.xz
dexon-sol-tools-5910bec52e0664f70d5dc98ce8303ec5373107ba.tar.zst
dexon-sol-tools-5910bec52e0664f70d5dc98ce8303ec5373107ba.zip
Make ZRX_PROXY_ID constant rather than popping it from ZRX_ASSET_DATA
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol28
-rw-r--r--packages/contracts/test/exchange/core.ts2
-rw-r--r--packages/contracts/test/exchange/match_orders.ts2
-rw-r--r--packages/contracts/test/exchange/transactions.ts2
-rw-r--r--packages/contracts/test/exchange/wrapper.ts2
5 files changed, 13 insertions, 23 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol
index f0caf7446..69b70112f 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol
@@ -36,19 +36,11 @@ contract MixinSettlement is
MSettlement,
MAssetProxyDispatcher
{
- // ZRX metadata used for fee transfers.
+ // ZRX address encoded as a byte array.
// This will be constant throughout the life of the Exchange contract,
// since ZRX will always be transferred via the ERC20 AssetProxy.
bytes internal ZRX_ASSET_DATA;
-
- /// @dev Gets the ZRX metadata used for fee transfers.
- function zrxAssetData()
- external
- view
- returns (bytes memory)
- {
- return ZRX_ASSET_DATA;
- }
+ uint8 constant ZRX_PROXY_ID = 1;
/// TODO: _zrxAssetData should be a constant in production.
/// @dev Constructor sets the metadata that will be used for paying ZRX fees.
@@ -73,7 +65,6 @@ contract MixinSettlement is
uint8 makerAssetProxyId = uint8(popByte(order.makerAssetData));
uint8 takerAssetProxyId = uint8(popByte(order.takerAssetData));
bytes memory zrxAssetData = ZRX_ASSET_DATA;
- uint8 zrxProxyId = uint8(popByte(zrxAssetData));
dispatchTransferFrom(
order.makerAssetData,
makerAssetProxyId,
@@ -90,14 +81,14 @@ contract MixinSettlement is
);
dispatchTransferFrom(
zrxAssetData,
- zrxProxyId,
+ ZRX_PROXY_ID,
order.makerAddress,
order.feeRecipientAddress,
fillResults.makerFeePaid
);
dispatchTransferFrom(
zrxAssetData,
- zrxProxyId,
+ ZRX_PROXY_ID,
takerAddress,
order.feeRecipientAddress,
fillResults.takerFeePaid
@@ -120,7 +111,6 @@ contract MixinSettlement is
uint8 leftMakerAssetProxyId = uint8(popByte(leftOrder.makerAssetData));
uint8 rightMakerAssetProxyId = uint8(popByte(rightOrder.makerAssetData));
bytes memory zrxAssetData = ZRX_ASSET_DATA;
- uint8 zrxProxyId = uint8(popByte(zrxAssetData));
// Order makers and taker
dispatchTransferFrom(
leftOrder.makerAssetData,
@@ -147,14 +137,14 @@ contract MixinSettlement is
// Maker fees
dispatchTransferFrom(
zrxAssetData,
- zrxProxyId,
+ ZRX_PROXY_ID,
leftOrder.makerAddress,
leftOrder.feeRecipientAddress,
matchedFillResults.left.makerFeePaid
);
dispatchTransferFrom(
zrxAssetData,
- zrxProxyId,
+ ZRX_PROXY_ID,
rightOrder.makerAddress,
rightOrder.feeRecipientAddress,
matchedFillResults.right.makerFeePaid
@@ -164,7 +154,7 @@ contract MixinSettlement is
if (leftOrder.feeRecipientAddress == rightOrder.feeRecipientAddress) {
dispatchTransferFrom(
zrxAssetData,
- zrxProxyId,
+ ZRX_PROXY_ID,
takerAddress,
leftOrder.feeRecipientAddress,
safeAdd(
@@ -175,14 +165,14 @@ contract MixinSettlement is
} else {
dispatchTransferFrom(
zrxAssetData,
- zrxProxyId,
+ ZRX_PROXY_ID,
takerAddress,
leftOrder.feeRecipientAddress,
matchedFillResults.left.takerFeePaid
);
dispatchTransferFrom(
zrxAssetData,
- zrxProxyId,
+ ZRX_PROXY_ID,
takerAddress,
rightOrder.feeRecipientAddress,
matchedFillResults.right.takerFeePaid
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index 53b98c755..63c2fa6c0 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -87,7 +87,7 @@ describe('Exchange core', () => {
artifacts.Exchange,
provider,
txDefaults,
- assetProxyUtils.encodeERC20AssetData(zrxToken.address),
+ zrxToken.address,
);
exchangeWrapper = new ExchangeWrapper(exchange, provider);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts
index 18a46187f..b8dca04fd 100644
--- a/packages/contracts/test/exchange/match_orders.ts
+++ b/packages/contracts/test/exchange/match_orders.ts
@@ -96,7 +96,7 @@ describe('matchOrders', () => {
artifacts.Exchange,
provider,
txDefaults,
- assetProxyUtils.encodeERC20AssetData(zrxToken.address),
+ zrxToken.address,
);
exchangeWrapper = new ExchangeWrapper(exchange, provider);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts
index 12390ce01..21ff123e5 100644
--- a/packages/contracts/test/exchange/transactions.ts
+++ b/packages/contracts/test/exchange/transactions.ts
@@ -72,7 +72,7 @@ describe('Exchange transactions', () => {
artifacts.Exchange,
provider,
txDefaults,
- assetProxyUtils.encodeERC20AssetData(zrxToken.address),
+ zrxToken.address,
);
exchangeWrapper = new ExchangeWrapper(exchange, provider);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index ad0704e3a..5371ae1d1 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -81,7 +81,7 @@ describe('Exchange wrappers', () => {
artifacts.Exchange,
provider,
txDefaults,
- assetProxyUtils.encodeERC20AssetData(zrxToken.address),
+ zrxToken.address,
);
exchangeWrapper = new ExchangeWrapper(exchange, provider);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);