diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts index e773cfada6..d001e08602 100644 --- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts @@ -1169,8 +1169,7 @@ export class ExchangeWrapper extends ContractWrapper { // If the caller has specified a taker fill amount, we use this for all validation fillableTakerAssetAmount = opts.expectedFillTakerTokenAmount; } else if (shouldValidateRemainingOrderAmountIsFillable) { - // Historically if a fill amount was not specified we would default to the amount - // left on the order. + // Default behaviour is to validate the amount left on the order. const filledTakerTokenAmount = await this.getFilledTakerAssetAmountAsync( orderHashUtils.getOrderHashHex(signedOrder), ); @@ -1190,7 +1189,11 @@ export class ExchangeWrapper extends ContractWrapper { fillableTakerAssetAmount, ); const makerTransferAmount = orderCalculationUtils.getMakerFillAmount(signedOrder, fillableTakerAssetAmount); - await this.validateMakerTransferThrowIfInvalidAsync(signedOrder, makerTransferAmount); + await this.validateMakerTransferThrowIfInvalidAsync( + signedOrder, + makerTransferAmount, + opts.simulationTakerAddress, + ); } /** * Validate the transfer from the maker to the taker. This is simulated on-chain diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index d3ee92eaa9..955b59713e 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -120,16 +120,19 @@ export interface ContractWrappersConfig { } /** - * expectedFillTakerTokenAmount: If specified, the validation method will ensure that the - * supplied order maker has a sufficient allowance/balance to fill this amount of the order's - * takerTokenAmount. - * validateRemainingOrderAmountIsFillable: The validation method ensures that the maker has a sufficient - * allowance/balance to fill the entire remaining order amount. This is the default. If neither options are - * specified, the balances and allowances are checked to determine the order is fillable for a non-zero amount. We call such orders "partially fillable orders". + * expectedFillTakerTokenAmount: If specified, the validation method will ensure that the supplied order maker has a sufficient + * allowance/balance to fill this amount of the order's takerTokenAmount. + * validateRemainingOrderAmountIsFillable: The validation method ensures that the maker has a sufficient allowance/balance to fill + * the entire remaining order amount. This is the default. If neither options are specified, + * the balances and allowances are checked to determine the order is fillable for a + * non-zero amount. We call such orders "partially fillable orders". + * simulationTakerAddress: During the maker transfer simulation validation, tokens are sent from the maker to the simulationTakerAddress. This defaults + * to the takerAddress specified in the order. Some tokens prevent transfer to the NULL address so this address can be specified. */ export interface ValidateOrderFillableOpts { expectedFillTakerTokenAmount?: BigNumber; validateRemainingOrderAmountIsFillable?: boolean; + simulationTakerAddress?: string; } /**