diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-29 17:34:38 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-29 17:34:38 +0800 |
commit | aa2616b307d3384791f1dbafc76999e7c4cf801f (patch) | |
tree | 0d8f11f66dcd595fefb184dd0dabc2d69183b782 /packages/contracts/src/utils/order_utils.ts | |
parent | 3062c18ebda8e55831038f140313000fd6d2cf71 (diff) | |
parent | 518a2da0275632a5dd61f99a105163ff5a074927 (diff) | |
download | dexon-sol-tools-aa2616b307d3384791f1dbafc76999e7c4cf801f.tar dexon-sol-tools-aa2616b307d3384791f1dbafc76999e7c4cf801f.tar.gz dexon-sol-tools-aa2616b307d3384791f1dbafc76999e7c4cf801f.tar.bz2 dexon-sol-tools-aa2616b307d3384791f1dbafc76999e7c4cf801f.tar.lz dexon-sol-tools-aa2616b307d3384791f1dbafc76999e7c4cf801f.tar.xz dexon-sol-tools-aa2616b307d3384791f1dbafc76999e7c4cf801f.tar.zst dexon-sol-tools-aa2616b307d3384791f1dbafc76999e7c4cf801f.zip |
Merge v2-prototype
Diffstat (limited to 'packages/contracts/src/utils/order_utils.ts')
-rw-r--r-- | packages/contracts/src/utils/order_utils.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/contracts/src/utils/order_utils.ts b/packages/contracts/src/utils/order_utils.ts index a9f994d80..019f6e74b 100644 --- a/packages/contracts/src/utils/order_utils.ts +++ b/packages/contracts/src/utils/order_utils.ts @@ -5,6 +5,13 @@ import { constants } from './constants'; import { CancelOrder, MatchOrder } from './types'; export const orderUtils = { + getPartialAmount(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber { + const partialAmount = numerator + .mul(target) + .div(denominator) + .floor(); + return partialAmount; + }, createFill: (signedOrder: SignedOrder, takerAssetFillAmount?: BigNumber) => { const fill = { order: orderUtils.getOrderWithoutExchangeAddress(signedOrder), |