aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol30
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinMatchOrders.sol12
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IExchangeCore.sol4
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol2
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol8
-rw-r--r--packages/contracts/src/utils/types.ts2
-rw-r--r--packages/contracts/test/utils/match_order_tester.ts24
7 files changed, 41 insertions, 41 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
index b9738519f..4c45f06b5 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
@@ -92,7 +92,7 @@ contract MixinExchangeCore is
orderInfo.orderStatus,
orderInfo.orderHash,
takerAddress,
- orderInfo.orderFilledAmount,
+ orderInfo.orderTakerAssetFilledAmount,
takerAssetFillAmount,
signature
);
@@ -102,7 +102,7 @@ contract MixinExchangeCore is
(status, fillResults) = calculateFillResults(
order,
orderInfo.orderStatus,
- orderInfo.orderFilledAmount,
+ orderInfo.orderTakerAssetFilledAmount,
takerAssetFillAmount
);
if (status != uint8(Status.SUCCESS)) {
@@ -118,7 +118,7 @@ contract MixinExchangeCore is
order,
takerAddress,
orderInfo.orderHash,
- orderInfo.orderFilledAmount,
+ orderInfo.orderTakerAssetFilledAmount,
fillResults
);
return fillResults;
@@ -166,7 +166,7 @@ contract MixinExchangeCore is
}
// If order.takerAssetAmount is zero, then the order will always
- // be considered filled because 0 == takerAssetAmount == orderFilledAmount
+ // be considered filled because 0 == takerAssetAmount == orderTakerAssetFilledAmount
// Instead of distinguishing between unfilled and filled zero taker
// amount orders, we choose not to support them.
if (order.takerAssetAmount == 0) {
@@ -191,8 +191,8 @@ contract MixinExchangeCore is
}
// Fetch filled amount and validate order availability
- orderInfo.orderFilledAmount = filled[orderInfo.orderHash];
- if (orderInfo.orderFilledAmount >= order.takerAssetAmount) {
+ orderInfo.orderTakerAssetFilledAmount = filled[orderInfo.orderHash];
+ if (orderInfo.orderTakerAssetFilledAmount >= order.takerAssetAmount) {
orderInfo.orderStatus = uint8(Status.ORDER_FULLY_FILLED);
return orderInfo;
}
@@ -205,14 +205,14 @@ contract MixinExchangeCore is
/// @dev Calculates amounts filled and fees paid by maker and taker.
/// @param order to be filled.
/// @param orderStatus Status of order to be filled.
- /// @param orderFilledAmount Amount of order already filled.
+ /// @param orderTakerAssetFilledAmount Amount of order already filled.
/// @param takerAssetFillAmount Desired amount of order to fill by taker.
/// @return status Return status of calculating fill amounts. Returns Status.SUCCESS on success.
/// @return fillResults Amounts filled and fees paid by maker and taker.
function calculateFillResults(
Order memory order,
uint8 orderStatus,
- uint256 orderFilledAmount,
+ uint256 orderTakerAssetFilledAmount,
uint256 takerAssetFillAmount
)
public
@@ -235,7 +235,7 @@ contract MixinExchangeCore is
}
// Compute takerAssetFilledAmount
- uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderFilledAmount);
+ uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderTakerAssetFilledAmount);
uint256 takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetAmount);
// Validate fill order rounding
@@ -277,7 +277,7 @@ contract MixinExchangeCore is
/// @param orderStatus Status of order to be filled.
/// @param orderHash Hash of order to be filled.
/// @param takerAddress Address of order taker.
- /// @param orderFilledAmount Amount of order already filled.
+ /// @param orderTakerAssetFilledAmount Amount of order already filled.
/// @param takerAssetFillAmount Desired amount of order to fill by taker.
/// @param signature Proof that the orders was created by its maker.
function assertValidFill(
@@ -285,7 +285,7 @@ contract MixinExchangeCore is
uint8 orderStatus,
bytes32 orderHash,
address takerAddress,
- uint256 orderFilledAmount,
+ uint256 orderTakerAssetFilledAmount,
uint256 takerAssetFillAmount,
bytes memory signature
)
@@ -305,7 +305,7 @@ contract MixinExchangeCore is
);
// Validate Maker signature (check only if first time seen)
- if (orderFilledAmount == 0) {
+ if (orderTakerAssetFilledAmount == 0) {
require(
isValidSignature(orderHash, order.makerAddress, signature),
SIGNATURE_VALIDATION_FAILED
@@ -336,19 +336,19 @@ contract MixinExchangeCore is
/// @dev Updates state with results of a fill order.
/// @param order that was filled.
/// @param takerAddress Address of taker who filled the order.
- /// @param orderFilledAmount Amount of order already filled.
+ /// @param orderTakerAssetFilledAmount Amount of order already filled.
/// @return fillResults Amounts filled and fees paid by maker and taker.
function updateFilledState(
Order memory order,
address takerAddress,
bytes32 orderHash,
- uint256 orderFilledAmount,
+ uint256 orderTakerAssetFilledAmount,
FillResults memory fillResults
)
internal
{
// Update state
- filled[orderHash] = safeAdd(orderFilledAmount, fillResults.takerAssetFilledAmount);
+ filled[orderHash] = safeAdd(orderTakerAssetFilledAmount, fillResults.takerAssetFilledAmount);
// Log order
emit Fill(
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinMatchOrders.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinMatchOrders.sol
index ac382d719..9d8b521c0 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinMatchOrders.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinMatchOrders.sol
@@ -74,8 +74,8 @@ contract MixinMatchOrders is
rightOrder,
leftOrderInfo.orderStatus,
rightOrderInfo.orderStatus,
- leftOrderInfo.orderFilledAmount,
- rightOrderInfo.orderFilledAmount
+ leftOrderInfo.orderTakerAssetFilledAmount,
+ rightOrderInfo.orderTakerAssetFilledAmount
);
// Validate fill contexts
@@ -84,7 +84,7 @@ contract MixinMatchOrders is
leftOrderInfo.orderStatus,
leftOrderInfo.orderHash,
takerAddress,
- leftOrderInfo.orderFilledAmount,
+ leftOrderInfo.orderTakerAssetFilledAmount,
matchedFillResults.left.takerAssetFilledAmount,
leftSignature
);
@@ -93,7 +93,7 @@ contract MixinMatchOrders is
rightOrderInfo.orderStatus,
rightOrderInfo.orderHash,
takerAddress,
- rightOrderInfo.orderFilledAmount,
+ rightOrderInfo.orderTakerAssetFilledAmount,
matchedFillResults.right.takerAssetFilledAmount,
rightSignature
);
@@ -111,14 +111,14 @@ contract MixinMatchOrders is
leftOrder,
takerAddress,
leftOrderInfo.orderHash,
- leftOrderInfo.orderFilledAmount,
+ leftOrderInfo.orderTakerAssetFilledAmount,
matchedFillResults.left
);
updateFilledState(
rightOrder,
takerAddress,
rightOrderInfo.orderHash,
- rightOrderInfo.orderFilledAmount,
+ rightOrderInfo.orderTakerAssetFilledAmount,
matchedFillResults.right
);
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IExchangeCore.sol
index eae2c8091..fc0157d75 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IExchangeCore.sol
@@ -61,14 +61,14 @@ contract IExchangeCore {
/// @dev Calculates amounts filled and fees paid by maker and taker.
/// @param order to be filled.
/// @param orderStatus Status of order to be filled.
- /// @param orderFilledAmount Amount of order already filled.
+ /// @param orderTakerAssetFilledAmount Amount of order already filled.
/// @param takerAssetFillAmount Desired amount of order to fill by taker.
/// @return status Return status of calculating fill amounts. Returns Status.SUCCESS on success.
/// @return fillResults Amounts filled and fees paid by maker and taker.
function calculateFillResults(
LibOrder.Order memory order,
uint8 orderStatus,
- uint256 orderFilledAmount,
+ uint256 orderTakerAssetFilledAmount,
uint256 takerAssetFillAmount
)
public
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol b/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol
index 538b455d0..7d8328c67 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol
@@ -57,7 +57,7 @@ contract LibOrder {
// Keccak-256 EIP712 hash of the order
bytes32 orderHash;
// Amount of order that has been filled
- uint256 orderFilledAmount;
+ uint256 orderTakerAssetFilledAmount;
}
/// @dev Calculates Keccak-256 hash of the order.
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 cd8335568..ae1e50637 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
@@ -61,7 +61,7 @@ contract MExchangeCore is
/// @param orderStatus Status of order to be filled.
/// @param orderHash Hash of order to be filled.
/// @param takerAddress Address of order taker.
- /// @param orderFilledAmount Amount of order already filled.
+ /// @param orderTakerAssetFilledAmount Amount of order already filled.
/// @param takerAssetFillAmount Desired amount of order to fill by taker.
/// @param signature Proof that the orders was created by its maker.
function assertValidFill(
@@ -69,7 +69,7 @@ contract MExchangeCore is
uint8 orderStatus,
bytes32 orderHash,
address takerAddress,
- uint256 orderFilledAmount,
+ uint256 orderTakerAssetFilledAmount,
uint256 takerAssetFillAmount,
bytes memory signature
)
@@ -78,13 +78,13 @@ contract MExchangeCore is
/// @dev Updates state with results of a fill order.
/// @param order that was filled.
/// @param takerAddress Address of taker who filled the order.
- /// @param orderFilledAmount Amount of order already filled.
+ /// @param orderTakerAssetFilledAmount Amount of order already filled.
/// @return fillResults Amounts filled and fees paid by maker and taker.
function updateFilledState(
LibOrder.Order memory order,
address takerAddress,
bytes32 orderHash,
- uint256 orderFilledAmount,
+ uint256 orderTakerAssetFilledAmount,
LibFillResults.FillResults memory fillResults
)
internal;
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index ba1243672..8d81adece 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -178,7 +178,7 @@ export interface TransferAmountsByMatchOrders {
export interface OrderInfo {
orderStatus: number;
orderHash: string;
- orderFilledAmount: BigNumber;
+ orderTakerAssetFilledAmount: BigNumber;
}
export interface ERC20ProxyData {
diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts
index f95d8fb34..14930de08 100644
--- a/packages/contracts/test/utils/match_order_tester.ts
+++ b/packages/contracts/test/utils/match_order_tester.ts
@@ -119,21 +119,21 @@ export class MatchOrderTester {
const feeRecipientAddressLeft = signedOrderLeft.feeRecipientAddress;
const feeRecipientAddressRight = signedOrderRight.feeRecipientAddress;
// Verify Left order preconditions
- const orderFilledAmountLeft = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
+ const orderTakerAssetFilledAmountLeft = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrderLeft),
);
const expectedOrderFilledAmountLeft = initialTakerAssetFilledAmountLeft
? initialTakerAssetFilledAmountLeft
: new BigNumber(0);
- expect(expectedOrderFilledAmountLeft).to.be.bignumber.equal(orderFilledAmountLeft);
+ expect(expectedOrderFilledAmountLeft).to.be.bignumber.equal(orderTakerAssetFilledAmountLeft);
// Verify Right order preconditions
- const orderFilledAmountRight = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
+ const orderTakerAssetFilledAmountRight = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrderRight),
);
const expectedOrderFilledAmountRight = initialTakerAssetFilledAmountRight
? initialTakerAssetFilledAmountRight
: new BigNumber(0);
- expect(expectedOrderFilledAmountRight).to.be.bignumber.equal(orderFilledAmountRight);
+ expect(expectedOrderFilledAmountRight).to.be.bignumber.equal(orderTakerAssetFilledAmountRight);
// Match left & right orders
await this._exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress);
const newERC20BalancesByOwner = await this._erc20Wrapper.getBalancesAsync();
@@ -142,8 +142,8 @@ export class MatchOrderTester {
const expectedTransferAmounts = await this._calculateExpectedTransferAmountsAsync(
signedOrderLeft,
signedOrderRight,
- orderFilledAmountLeft,
- orderFilledAmountRight,
+ orderTakerAssetFilledAmountLeft,
+ orderTakerAssetFilledAmountRight,
);
let expectedERC20BalancesByOwner: ERC20BalancesByOwner;
let expectedERC721TokenIdsByOwner: ERC721TokenIdsByOwner;
@@ -169,19 +169,19 @@ export class MatchOrderTester {
/// the taker when two orders are matched.
/// @param signedOrderLeft First matched order.
/// @param signedOrderRight Second matched order.
- /// @param orderFilledAmountLeft How much left order has been filled, prior to matching orders.
- /// @param orderFilledAmountRight How much the right order has been filled, prior to matching orders.
+ /// @param orderTakerAssetFilledAmountLeft How much left order has been filled, prior to matching orders.
+ /// @param orderTakerAssetFilledAmountRight How much the right order has been filled, prior to matching orders.
/// @return TransferAmounts A struct containing the expected transfer amounts.
private async _calculateExpectedTransferAmountsAsync(
signedOrderLeft: SignedOrder,
signedOrderRight: SignedOrder,
- orderFilledAmountLeft: BigNumber,
- orderFilledAmountRight: BigNumber,
+ orderTakerAssetFilledAmountLeft: BigNumber,
+ orderTakerAssetFilledAmountRight: BigNumber,
): Promise<TransferAmounts> {
let amountBoughtByLeftMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrderLeft),
);
- amountBoughtByLeftMaker = amountBoughtByLeftMaker.minus(orderFilledAmountLeft);
+ amountBoughtByLeftMaker = amountBoughtByLeftMaker.minus(orderTakerAssetFilledAmountLeft);
const amountSoldByLeftMaker = amountBoughtByLeftMaker
.times(signedOrderLeft.makerAssetAmount)
.dividedToIntegerBy(signedOrderLeft.takerAssetAmount);
@@ -192,7 +192,7 @@ export class MatchOrderTester {
let amountBoughtByRightMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrderRight),
);
- amountBoughtByRightMaker = amountBoughtByRightMaker.minus(orderFilledAmountRight);
+ amountBoughtByRightMaker = amountBoughtByRightMaker.minus(orderTakerAssetFilledAmountRight);
const amountSoldByRightMaker = amountBoughtByRightMaker
.times(signedOrderRight.makerAssetAmount)
.dividedToIntegerBy(signedOrderRight.takerAssetAmount);