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
|
// If the caller has specified a taker fill amount, we use this for all validation
|
||||||
fillableTakerAssetAmount = opts.expectedFillTakerTokenAmount;
|
fillableTakerAssetAmount = opts.expectedFillTakerTokenAmount;
|
||||||
} else if (shouldValidateRemainingOrderAmountIsFillable) {
|
} else if (shouldValidateRemainingOrderAmountIsFillable) {
|
||||||
// Historically if a fill amount was not specified we would default to the amount
|
// Default behaviour is to validate the amount left on the order.
|
||||||
// left on the order.
|
|
||||||
const filledTakerTokenAmount = await this.getFilledTakerAssetAmountAsync(
|
const filledTakerTokenAmount = await this.getFilledTakerAssetAmountAsync(
|
||||||
orderHashUtils.getOrderHashHex(signedOrder),
|
orderHashUtils.getOrderHashHex(signedOrder),
|
||||||
);
|
);
|
||||||
@ -1190,7 +1189,11 @@ export class ExchangeWrapper extends ContractWrapper {
|
|||||||
fillableTakerAssetAmount,
|
fillableTakerAssetAmount,
|
||||||
);
|
);
|
||||||
const makerTransferAmount = orderCalculationUtils.getMakerFillAmount(signedOrder, 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
|
* 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
|
* expectedFillTakerTokenAmount: If specified, the validation method will ensure that the supplied order maker has a sufficient
|
||||||
* supplied order maker has a sufficient allowance/balance to fill this amount of the order's
|
* allowance/balance to fill this amount of the order's takerTokenAmount.
|
||||||
* takerTokenAmount.
|
* validateRemainingOrderAmountIsFillable: The validation method ensures that the maker has a sufficient allowance/balance to fill
|
||||||
* validateRemainingOrderAmountIsFillable: The validation method ensures that the maker has a sufficient
|
* the entire remaining order amount. This is the default. If neither options are specified,
|
||||||
* allowance/balance to fill the entire remaining order amount. This is the default. If neither options are
|
* the balances and allowances are checked to determine the order is fillable for a
|
||||||
* 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".
|
* 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 {
|
export interface ValidateOrderFillableOpts {
|
||||||
expectedFillTakerTokenAmount?: BigNumber;
|
expectedFillTakerTokenAmount?: BigNumber;
|
||||||
validateRemainingOrderAmountIsFillable?: boolean;
|
validateRemainingOrderAmountIsFillable?: boolean;
|
||||||
|
simulationTakerAddress?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user