Allow simulation taker address to be specified
This commit is contained in:
parent
85a7efbd61
commit
6c8d4dcc1e
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user