Migrate fillOrKillOrder

This commit is contained in:
Leonid Logvinov
2017-07-07 16:01:40 -07:00
committed by Fabio Berger
parent 720b2a2506
commit 722c24d127
3 changed files with 15 additions and 14 deletions

View File

@@ -417,7 +417,7 @@
"type": "uint256[6]"
},
{
"name": "fillValueT",
"name": "fillTakerTokenAmount",
"type": "uint256"
},
{
@@ -433,7 +433,7 @@
"type": "bytes32"
}
],
"name": "fillOrKill",
"name": "fillOrKillOrder",
"outputs": [
{
"name": "success",

View File

@@ -371,29 +371,29 @@ export class ExchangeWrapper extends ContractWrapper {
* the fill order is abandoned.
* @param signedOrder An object that conforms to the SignedOrder interface. The
* signedOrder you wish to fill.
* @param takerTokenFillAmount The total amount of the takerTokens you would like to fill.
* @param fillTakerTokenAmount The total amount of the takerTokens you would like to fill.
* @param takerAddress The user Ethereum address who would like to fill this order.
* Must be available via the supplied Web3.Provider passed to 0x.js.
*/
@decorators.contractCallErrorHandler
public async fillOrKillOrderAsync(signedOrder: SignedOrder, takerTokenFillAmount: BigNumber.BigNumber,
public async fillOrKillOrderAsync(signedOrder: SignedOrder, fillTakerTokenAmount: BigNumber.BigNumber,
takerAddress: string): Promise<void> {
assert.doesConformToSchema('signedOrder', signedOrder, signedOrderSchema);
assert.isBigNumber('takerTokenFillAmount', takerTokenFillAmount);
assert.isBigNumber('fillTakerTokenAmount', fillTakerTokenAmount);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
const exchangeInstance = await this._getExchangeContractAsync(signedOrder.exchangeContractAddress);
await this._validateFillOrderAndThrowIfInvalidAsync(signedOrder, takerTokenFillAmount, takerAddress);
await this._validateFillOrderAndThrowIfInvalidAsync(signedOrder, fillTakerTokenAmount, takerAddress);
await this._validateFillOrKillOrderAndThrowIfInvalidAsync(signedOrder, exchangeInstance.address,
takerTokenFillAmount);
fillTakerTokenAmount);
const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(signedOrder);
const gas = await exchangeInstance.fillOrKill.estimateGas(
const gas = await exchangeInstance.fillOrKillOrder.estimateGas(
orderAddresses,
orderValues,
takerTokenFillAmount,
fillTakerTokenAmount,
signedOrder.ecSignature.v,
signedOrder.ecSignature.r,
signedOrder.ecSignature.s,
@@ -401,10 +401,10 @@ export class ExchangeWrapper extends ContractWrapper {
from: takerAddress,
},
);
const response: ContractResponse = await exchangeInstance.fillOrKill(
const response: ContractResponse = await exchangeInstance.fillOrKillOrder(
orderAddresses,
orderValues,
takerTokenFillAmount,
fillTakerTokenAmount,
signedOrder.ecSignature.v,
signedOrder.ecSignature.r,
signedOrder.ecSignature.s,

View File

@@ -112,10 +112,11 @@ export interface ExchangeContract extends ContractInstance {
cancelTakerTokenAmounts: BigNumber.BigNumber[],
txOpts?: TxOpts) => number;
};
fillOrKill: {
(orderAddresses: OrderAddresses, orderValues: OrderValues, fillAmount: BigNumber.BigNumber,
fillOrKillOrder: {
(orderAddresses: OrderAddresses, orderValues: OrderValues, fillTakerTokenAmount: BigNumber.BigNumber,
v: number, r: string, s: string, txOpts?: TxOpts): ContractResponse;
estimateGas: (orderAddresses: OrderAddresses, orderValues: OrderValues, fillAmount: BigNumber.BigNumber,
estimateGas: (orderAddresses: OrderAddresses, orderValues: OrderValues,
fillTakerTokenAmount: BigNumber.BigNumber,
v: number, r: string, s: string, txOpts?: TxOpts) => number;
};
batchFillOrKillOrders: {