Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

@0x/asset-swapper: Fix fee schedule not being scaled by gas price. #2522

Merged
merged 2 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/asset-swapper/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
{
"note": "Add `maxFallbackSlippage` option.",
"pr": 2513
},
{
"note": "Fix fee schedule not being scaled by gas price.",
"pr": 2522
}
]
},
Expand Down
6 changes: 3 additions & 3 deletions packages/asset-swapper/src/utils/swap_quote_calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { fillableAmountsUtils } from './fillable_amounts_utils';
import { MarketOperationUtils } from './market_operation_utils';
import { convertNativeOrderToFullyFillableOptimizedOrders } from './market_operation_utils/orders';
import { ERC20BridgeSource, OptimizedMarketOrder } from './market_operation_utils/types';
import { ERC20BridgeSource, GetMarketOrdersOpts, OptimizedMarketOrder } from './market_operation_utils/types';
import { ProtocolFeeUtils } from './protocol_fee_utils';
import {
isOrderTakerFeePayableWithMakerAsset,
Expand Down Expand Up @@ -132,9 +132,9 @@ export class SwapQuoteCalculator {

{
// Scale fees by gas price.
const _opts = {
const _opts: GetMarketOrdersOpts = {
...opts,
fees: _.mapValues(opts.feeSchedule, v => v.times(gasPrice)),
feeSchedule: _.mapValues(opts.feeSchedule, v => v.times(gasPrice)),
};

const firstOrderMakerAssetData = !!prunedOrders[0]
Expand Down