remove unused functions
This commit is contained in:
@@ -29,44 +29,3 @@ export interface NativeOrderFillableAmountFields {
|
||||
fillableTakerAmount: BigNumber;
|
||||
fillableTakerFeeAmount: BigNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an amount of taker asset, calculate the the amount of maker asset
|
||||
* @param order The order
|
||||
* @param makerFillAmount the amount of taker asset
|
||||
*/
|
||||
export function getNativeMakerFillAmount(order: CommonOrderFields, takerFillAmount: BigNumber): BigNumber {
|
||||
// Round down because exchange rate favors Maker
|
||||
const makerFillAmount = takerFillAmount
|
||||
.multipliedBy(order.makerAmount)
|
||||
.div(order.takerAmount)
|
||||
.integerValue(BigNumber.ROUND_FLOOR);
|
||||
return makerFillAmount;
|
||||
}
|
||||
/**
|
||||
* Given an amount of maker asset, calculate the equivalent amount in taker asset
|
||||
* @param order The order
|
||||
* @param makerFillAmount the amount of maker asset
|
||||
*/
|
||||
export function getNativeTakerFillAmount(order: CommonOrderFields, makerFillAmount: BigNumber): BigNumber {
|
||||
// Round up because exchange rate favors Maker
|
||||
const takerFillAmount = makerFillAmount
|
||||
.multipliedBy(order.takerAmount)
|
||||
.div(order.makerAmount)
|
||||
.integerValue(BigNumber.ROUND_CEIL);
|
||||
return takerFillAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an amount of taker asset, calculate the fee amount required for the taker
|
||||
* @param order The order
|
||||
* @param takerFillAmount the amount of taker asset
|
||||
*/
|
||||
export function getNativeTakerFeeFillAmount(order: LimitOrderFields, takerFillAmount: BigNumber): BigNumber {
|
||||
// Round down because Taker fee rate favors Taker
|
||||
const takerFeeAmount = takerFillAmount
|
||||
.multipliedBy(order.takerTokenFeeAmount)
|
||||
.div(order.takerAmount)
|
||||
.integerValue(BigNumber.ROUND_FLOOR);
|
||||
return takerFeeAmount;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import { BigNumber } from '@0x/utils';
|
||||
import { constants } from '../constants';
|
||||
import { MarketOperation, SwapQuoteLimitOrder, SwapQuoteOrder } from '../types';
|
||||
|
||||
import { getNativeTakerFeeFillAmount } from './native_orders';
|
||||
|
||||
const { PROTOCOL_FEE_MULTIPLIER, ZERO_AMOUNT } = constants;
|
||||
const { ROUND_DOWN, ROUND_UP } = BigNumber;
|
||||
|
||||
@@ -217,13 +215,7 @@ function createBestCaseFillOrderCalls(quoteInfo: QuoteFillInfo): QuoteFillOrderC
|
||||
? {
|
||||
totalOrderInput: o.takerAmount,
|
||||
totalOrderOutput: o.makerAmount,
|
||||
totalOrderInputFee:
|
||||
o.type === FillQuoteTransformerOrderType.Limit
|
||||
? getNativeTakerFeeFillAmount(
|
||||
((o as SwapQuoteLimitOrder).fillData.order as LimitOrderFields),
|
||||
o.takerAmount,
|
||||
)
|
||||
: ZERO_AMOUNT,
|
||||
totalOrderInputFee: ZERO_AMOUNT, // Limit orders not supported atm
|
||||
totalOrderOutputFee: ZERO_AMOUNT, // makerToken fees are not supported in v4 (sell output)
|
||||
}
|
||||
: // Buy
|
||||
@@ -231,7 +223,7 @@ function createBestCaseFillOrderCalls(quoteInfo: QuoteFillInfo): QuoteFillOrderC
|
||||
totalOrderInput: o.makerAmount,
|
||||
totalOrderOutput: o.takerAmount,
|
||||
totalOrderInputFee: ZERO_AMOUNT, // makerToken fees are not supported in v4 (buy input)
|
||||
totalOrderOutputFee: ZERO_AMOUNT,
|
||||
totalOrderOutputFee: ZERO_AMOUNT, // Limit orders not supported atm
|
||||
}),
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user