aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-08 17:00:36 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-08 17:00:36 +0800
commit5d464d87e07003c231fca55e87b95cc7e1e9e978 (patch)
treebb5fdc0219f1ee5ca848a9f92c135e4d9e8b1ce5
parent01c33ef8b7929ae936fd4bb84bb5d3aee3e63e8d (diff)
downloaddexon-sol-tools-5d464d87e07003c231fca55e87b95cc7e1e9e978.tar
dexon-sol-tools-5d464d87e07003c231fca55e87b95cc7e1e9e978.tar.gz
dexon-sol-tools-5d464d87e07003c231fca55e87b95cc7e1e9e978.tar.bz2
dexon-sol-tools-5d464d87e07003c231fca55e87b95cc7e1e9e978.tar.lz
dexon-sol-tools-5d464d87e07003c231fca55e87b95cc7e1e9e978.tar.xz
dexon-sol-tools-5d464d87e07003c231fca55e87b95cc7e1e9e978.tar.zst
dexon-sol-tools-5d464d87e07003c231fca55e87b95cc7e1e9e978.zip
Don't use batchFillOrderAsync for fillOrderAsync
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index a15df5a77..dffb9df13 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -134,10 +134,44 @@ export class ExchangeWrapper extends ContractWrapper {
*/
public async fillOrderAsync(signedOrder: SignedOrder, takerTokenFillAmount: BigNumber.BigNumber,
shouldCheckTransfer: boolean, takerAddress: string): Promise<void> {
- await this.batchFillOrderAsync([{
- signedOrder,
+ assert.doesConformToSchema('signedOrder',
+ SchemaValidator.convertToJSONSchemaCompatibleObject(signedOrder as object),
+ signedOrderSchema);
+ assert.isBigNumber('takerTokenFillAmount', takerTokenFillAmount);
+ assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer);
+ await assert.isSenderAddressAsync('takerAddress', takerAddress, this.web3Wrapper);
+
+ const exchangeInstance = await this.getExchangeContractAsync();
+ await this.validateFillOrderAndThrowIfInvalidAsync(signedOrder, takerTokenFillAmount, takerAddress);
+
+ const [orderAddresses, orderValues] = ExchangeWrapper.getOrderAddressesAndValues(signedOrder);
+
+ const gas = await exchangeInstance.fill.estimateGas(
+ orderAddresses,
+ orderValues,
takerTokenFillAmount,
- }], shouldCheckTransfer, takerAddress);
+ shouldCheckTransfer,
+ signedOrder.ecSignature.v,
+ signedOrder.ecSignature.r,
+ signedOrder.ecSignature.s,
+ {
+ from: takerAddress,
+ },
+ );
+ const response: ContractResponse = await exchangeInstance.fill(
+ orderAddresses,
+ orderValues,
+ takerTokenFillAmount,
+ shouldCheckTransfer,
+ signedOrder.ecSignature.v,
+ signedOrder.ecSignature.r,
+ signedOrder.ecSignature.s,
+ {
+ from: takerAddress,
+ gas,
+ },
+ );
+ this.throwErrorLogsAsErrors(response.logs);
}
/**
* Batched version of fillOrderAsync. Executes fills atomically in a single transaction.