diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-08-22 01:15:45 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-08-22 04:53:44 +0800 |
commit | 7fa5b474ebac649b6a23c8b9108e07c117dcc00b (patch) | |
tree | 2427772c0c2ca2d2661349dd6ea82d6ab92be5df /packages/contracts/src/2.0.0 | |
parent | 3d25758b1d107528b0bc8a578e3c5ecf020395b3 (diff) | |
download | dexon-sol-tools-7fa5b474ebac649b6a23c8b9108e07c117dcc00b.tar dexon-sol-tools-7fa5b474ebac649b6a23c8b9108e07c117dcc00b.tar.gz dexon-sol-tools-7fa5b474ebac649b6a23c8b9108e07c117dcc00b.tar.bz2 dexon-sol-tools-7fa5b474ebac649b6a23c8b9108e07c117dcc00b.tar.lz dexon-sol-tools-7fa5b474ebac649b6a23c8b9108e07c117dcc00b.tar.xz dexon-sol-tools-7fa5b474ebac649b6a23c8b9108e07c117dcc00b.tar.zst dexon-sol-tools-7fa5b474ebac649b6a23c8b9108e07c117dcc00b.zip |
Add ZRX balances and allowances to TraderInfo
Diffstat (limited to 'packages/contracts/src/2.0.0')
-rw-r--r-- | packages/contracts/src/2.0.0/extensions/OrderValidator/OrderValidator.sol | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/packages/contracts/src/2.0.0/extensions/OrderValidator/OrderValidator.sol b/packages/contracts/src/2.0.0/extensions/OrderValidator/OrderValidator.sol index 1c9cc6978..8f4ce9ccc 100644 --- a/packages/contracts/src/2.0.0/extensions/OrderValidator/OrderValidator.sol +++ b/packages/contracts/src/2.0.0/extensions/OrderValidator/OrderValidator.sol @@ -34,20 +34,26 @@ contract OrderValidator { using LibBytes for bytes; struct TraderInfo { - uint256 makerBalance; // Maker's balance of makerAsset - uint256 makerAllowance; // Maker's allowance to corresponding AssetProxy - uint256 takerBalance; // Taker's balance of takerAsset - uint256 takerAllowance; // Taker's allowance to corresponding AssetProxy + uint256 makerBalance; // Maker's balance of makerAsset + uint256 makerAllowance; // Maker's allowance to corresponding AssetProxy + uint256 takerBalance; // Taker's balance of takerAsset + uint256 takerAllowance; // Taker's allowance to corresponding AssetProxy + uint256 makerZrxBalance; // Maker's balance of ZRX + uint256 makerZrxAllowance; // Maker's allowance of ZRX to ERC20Proxy + uint256 takerZrxBalance; // Taker's balance of ZRX + uint256 takerZrxAllowance; // Taker's allowance of ZRX to ERC20Proxy } - // Exchange contract. - // solhint-disable-next-line var-name-mixedcase + // solhint-disable var-name-mixedcase IExchange internal EXCHANGE; + bytes internal ZRX_ASSET_DATA; + // solhint-enable var-name-mixedcase - constructor (address _exchange) + constructor (address _exchange, bytes memory _zrxAssetData) public { EXCHANGE = IExchange(_exchange); + ZRX_ASSET_DATA = _zrxAssetData; } /// @dev Fetches information for order and maker/taker of order. @@ -89,6 +95,9 @@ contract OrderValidator { { (traderInfo.makerBalance, traderInfo.makerAllowance) = getBalanceAndAllowance(order.makerAddress, order.makerAssetData); (traderInfo.takerBalance, traderInfo.takerAllowance) = getBalanceAndAllowance(takerAddress, order.takerAssetData); + bytes memory zrxAssetData = ZRX_ASSET_DATA; + (traderInfo.makerZrxBalance, traderInfo.makerZrxAllowance) = getBalanceAndAllowance(order.makerAddress, zrxAssetData); + (traderInfo.takerZrxBalance, traderInfo.takerZrxAllowance) = getBalanceAndAllowance(takerAddress, zrxAssetData); return traderInfo; } |