This commit is contained in:
David Sun 2019-11-23 20:22:28 -05:00 committed by Jacob Evans
parent 5863ccc0a0
commit 3d5b229c46
No known key found for this signature in database
GPG Key ID: 2036DA2ADDFB0842
5 changed files with 23 additions and 63 deletions

View File

@ -140,13 +140,8 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase<Exchange
if (quote.type === MarketOperation.Buy) {
const { makerAssetFillAmount } = quote;
txHash = await this._exchangeContract
.marketBuyOrdersFillOrKill(
orders,
makerAssetFillAmount,
orders.map(o => o.signature),
)
.sendTransactionAsync(
{
.marketBuyOrdersFillOrKill(orders, makerAssetFillAmount, orders.map(o => o.signature))
.sendTransactionAsync({
from: finalTakerAddress,
gas: gasLimit,
gasPrice,
@ -155,12 +150,8 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase<Exchange
} else {
const { takerAssetFillAmount } = quote;
txHash = await this._exchangeContract
.marketSellOrdersFillOrKill(
orders,
takerAssetFillAmount,
orders.map(o => o.signature),
).sendTransactionAsync(
{
.marketSellOrdersFillOrKill(orders, takerAssetFillAmount, orders.map(o => o.signature))
.sendTransactionAsync({
from: finalTakerAddress,
gas: gasLimit,
gasPrice,

View File

@ -196,8 +196,7 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<Forward
formattedFeePercentage,
feeRecipient,
)
.sendTransactionAsync(
{
.sendTransactionAsync({
from: finalTakerAddress,
gas: gasLimit,
gasPrice,
@ -206,8 +205,7 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<Forward
} else {
txHash = await this._forwarder
.marketSellOrdersWithEth(orders, orders.map(o => o.signature), formattedFeePercentage, feeRecipient)
.sendTransactionAsync(
{
.sendTransactionAsync({
from: finalTakerAddress,
gas: gasLimit,
gasPrice,

View File

@ -183,24 +183,20 @@ describe('ExchangeSwapQuoteConsumer', () => {
await erc20MakerTokenContract
.transfer(makerAddress, marketBuySwapQuote.worstCaseQuoteInfo.makerAssetAmount)
.sendTransactionAsync(
{
.sendTransactionAsync({
from: coinbaseAddress,
});
await erc20TakerTokenContract
.transfer(takerAddress, marketBuySwapQuote.worstCaseQuoteInfo.totalTakerAssetAmount)
.sendTransactionAsync(
{
.sendTransactionAsync({
from: coinbaseAddress,
});
await erc20MakerTokenContract
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE)
.sendTransactionAsync(
{ from: makerAddress });
.sendTransactionAsync({ from: makerAddress });
await erc20TakerTokenContract
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE)
.sendTransactionAsync(
{ from: takerAddress });
.sendTransactionAsync({ from: takerAddress });
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
@ -211,12 +207,10 @@ describe('ExchangeSwapQuoteConsumer', () => {
* Does not test the validity of the state change performed by the forwarder smart contract
*/
it('should perform a marketSell execution when provided a MarketSell type swapQuote', async () => {
console.log('herello?');
await expectMakerAndTakerBalancesForMakerAssetAsync(
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
constants.ZERO_AMOUNT,
);
console.log('he?');
await expectMakerAndTakerBalancesForTakerAssetAsync(
constants.ZERO_AMOUNT,
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
@ -225,12 +219,10 @@ describe('ExchangeSwapQuoteConsumer', () => {
takerAddress,
gasLimit: 4000000,
});
console.log('herelloas?');
await expectMakerAndTakerBalancesForMakerAssetAsync(
constants.ZERO_AMOUNT,
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
);
console.log('haserello?');
await expectMakerAndTakerBalancesForTakerAssetAsync(
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
constants.ZERO_AMOUNT,

View File

@ -154,11 +154,7 @@ describe('ForwarderSwapQuoteConsumer', () => {
const totalFillableAmount = new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI);
await erc20TokenContract.transfer(
makerAddress,
totalFillableAmount,
).sendTransactionAsync(
{
await erc20TokenContract.transfer(makerAddress, totalFillableAmount).sendTransactionAsync({
from: coinbaseAddress,
});

View File

@ -123,31 +123,20 @@ describe('OrderPruner', () => {
// give double fillableAmount to maker and taker as buffer
await erc20MakerTokenContract
.transfer(
makerAddress,
fillableAmount.multipliedBy(4),
)
.sendTransactionAsync(
{ from: coinbaseAddress });
.transfer(makerAddress, fillableAmount.multipliedBy(4))
.sendTransactionAsync({ from: coinbaseAddress });
await erc20TakerTokenContract
.transfer(
takerAddress,
fillableAmount.multipliedBy(4),
)
.sendTransactionAsync(
{ from: coinbaseAddress });
.transfer(takerAddress, fillableAmount.multipliedBy(4))
.sendTransactionAsync({ from: coinbaseAddress });
await erc20MakerTokenContract
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
.sendTransactionAsync(
{ from: makerAddress });
.sendTransactionAsync({ from: makerAddress });
await erc20MakerTokenContract
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
.sendTransactionAsync(
{ from: takerAddress });
.sendTransactionAsync({ from: takerAddress });
await erc20TakerTokenContract
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
.sendTransactionAsync(
{ from: takerAddress });
.sendTransactionAsync({ from: takerAddress });
partiallyFilledOpenSignedOrderFeeless = await orderFactory.newSignedOrderAsync({
takerAssetAmount: fillableAmount,
@ -160,8 +149,7 @@ describe('OrderPruner', () => {
partialFillAmount,
partiallyFilledOpenSignedOrderFeeless.signature,
)
.sendTransactionAsync(
{
.sendTransactionAsync({
from: takerAddress,
gasPrice: GAS_PRICE,
gas: 4000000,
@ -181,8 +169,7 @@ describe('OrderPruner', () => {
partialFillAmount,
partiallyFilledOpenSignedOrderFeeInTakerAsset.signature,
)
.sendTransactionAsync(
{
.sendTransactionAsync({
from: takerAddress,
gasPrice: GAS_PRICE,
gas: 4000000,
@ -202,8 +189,7 @@ describe('OrderPruner', () => {
partialFillAmount,
partiallyFilledOpenSignedOrderFeeInMakerAsset.signature,
)
.sendTransactionAsync(
{
.sendTransactionAsync({
from: takerAddress,
gasPrice: GAS_PRICE,
gas: 4000000,
@ -216,11 +202,8 @@ describe('OrderPruner', () => {
});
await exchangeContract
.fillOrKillOrder(
filledOpenSignedOrder, fillableAmount, filledOpenSignedOrder.signature,
)
.sendTransactionAsync(
{
.fillOrKillOrder(filledOpenSignedOrder, fillableAmount, filledOpenSignedOrder.signature)
.sendTransactionAsync({
from: takerAddress,
gasPrice: GAS_PRICE,
gas: 4000000,