aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils/fill_scenarios.ts
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-06-03 01:53:01 +0800
committerGitHub <noreply@github.com>2017-06-03 01:53:01 +0800
commit5925f81fe185a90efaa82dd90bd8d65d74326f11 (patch)
tree12daf7aec686c576634b2daa5a58af2831cc497d /test/utils/fill_scenarios.ts
parent2ff8f4ca6ed238f331cb69aaeb912a94b3df901e (diff)
parent35c9330d6246183509a3543cdf1278b9ced191e2 (diff)
downloaddexon-sol-tools-5925f81fe185a90efaa82dd90bd8d65d74326f11.tar
dexon-sol-tools-5925f81fe185a90efaa82dd90bd8d65d74326f11.tar.gz
dexon-sol-tools-5925f81fe185a90efaa82dd90bd8d65d74326f11.tar.bz2
dexon-sol-tools-5925f81fe185a90efaa82dd90bd8d65d74326f11.tar.lz
dexon-sol-tools-5925f81fe185a90efaa82dd90bd8d65d74326f11.tar.xz
dexon-sol-tools-5925f81fe185a90efaa82dd90bd8d65d74326f11.tar.zst
dexon-sol-tools-5925f81fe185a90efaa82dd90bd8d65d74326f11.zip
Merge pull request #31 from 0xProject/unavailableFilledCancelled
Implement Unavailable, Filled and Cancelled
Diffstat (limited to 'test/utils/fill_scenarios.ts')
-rw-r--r--test/utils/fill_scenarios.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/utils/fill_scenarios.ts b/test/utils/fill_scenarios.ts
index a44d6b18a..d186593b9 100644
--- a/test/utils/fill_scenarios.ts
+++ b/test/utils/fill_scenarios.ts
@@ -51,6 +51,24 @@ export class FillScenarios {
makerFillableAmount, takerFillableAmount, feeRecepient, expirationUnixTimestampSec,
);
}
+ public async createPartiallyFilledSignedOrderAsync(makerTokenAddress: string, takerTokenAddress: string,
+ takerAddress: string, fillableAmount: BigNumber.BigNumber,
+ partialFillAmount: BigNumber.BigNumber) {
+ const prevSenderAccount = await this.zeroEx.getTransactionSenderAccountIfExistsAsync();
+ const [makerAddress] = this.userAddresses;
+ const signedOrder = await this.createAsymmetricFillableSignedOrderAsync(
+ makerTokenAddress, takerTokenAddress, makerAddress, takerAddress,
+ fillableAmount, fillableAmount,
+ );
+
+ this.zeroEx.setTransactionSenderAccount(takerAddress);
+ const shouldCheckTransfer = false;
+ await this.zeroEx.exchange.fillOrderAsync(signedOrder, partialFillAmount, shouldCheckTransfer);
+
+ // Re-set sender account so as to avoid introducing side-effects
+ this.zeroEx.setTransactionSenderAccount(prevSenderAccount as string);
+ return signedOrder;
+ }
private async createAsymmetricFillableSignedOrderWithFeesAsync(
makerTokenAddress: string, takerTokenAddress: string,
makerFee: BigNumber.BigNumber, takerFee: BigNumber.BigNumber,