diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-06-11 12:13:59 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-06-13 02:45:02 +0800 |
commit | 5910bec52e0664f70d5dc98ce8303ec5373107ba (patch) | |
tree | 38ca83fc80b7e9739c551112b691ce1cedceedaa /packages/contracts/src | |
parent | 764b1c35cb7bf763deeb5db34ebe36d6e973b409 (diff) | |
download | dexon-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
Diffstat (limited to 'packages/contracts/src')
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlement.sol | 28 |
1 files changed, 9 insertions, 19 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 |