prettier
This commit is contained in:
parent
5863ccc0a0
commit
3d5b229c46
@ -140,13 +140,8 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase<Exchange
|
|||||||
if (quote.type === MarketOperation.Buy) {
|
if (quote.type === MarketOperation.Buy) {
|
||||||
const { makerAssetFillAmount } = quote;
|
const { makerAssetFillAmount } = quote;
|
||||||
txHash = await this._exchangeContract
|
txHash = await this._exchangeContract
|
||||||
.marketBuyOrdersFillOrKill(
|
.marketBuyOrdersFillOrKill(orders, makerAssetFillAmount, orders.map(o => o.signature))
|
||||||
orders,
|
.sendTransactionAsync({
|
||||||
makerAssetFillAmount,
|
|
||||||
orders.map(o => o.signature),
|
|
||||||
)
|
|
||||||
.sendTransactionAsync(
|
|
||||||
{
|
|
||||||
from: finalTakerAddress,
|
from: finalTakerAddress,
|
||||||
gas: gasLimit,
|
gas: gasLimit,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
@ -155,12 +150,8 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase<Exchange
|
|||||||
} else {
|
} else {
|
||||||
const { takerAssetFillAmount } = quote;
|
const { takerAssetFillAmount } = quote;
|
||||||
txHash = await this._exchangeContract
|
txHash = await this._exchangeContract
|
||||||
.marketSellOrdersFillOrKill(
|
.marketSellOrdersFillOrKill(orders, takerAssetFillAmount, orders.map(o => o.signature))
|
||||||
orders,
|
.sendTransactionAsync({
|
||||||
takerAssetFillAmount,
|
|
||||||
orders.map(o => o.signature),
|
|
||||||
).sendTransactionAsync(
|
|
||||||
{
|
|
||||||
from: finalTakerAddress,
|
from: finalTakerAddress,
|
||||||
gas: gasLimit,
|
gas: gasLimit,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
|
@ -196,8 +196,7 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<Forward
|
|||||||
formattedFeePercentage,
|
formattedFeePercentage,
|
||||||
feeRecipient,
|
feeRecipient,
|
||||||
)
|
)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({
|
||||||
{
|
|
||||||
from: finalTakerAddress,
|
from: finalTakerAddress,
|
||||||
gas: gasLimit,
|
gas: gasLimit,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
@ -206,8 +205,7 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<Forward
|
|||||||
} else {
|
} else {
|
||||||
txHash = await this._forwarder
|
txHash = await this._forwarder
|
||||||
.marketSellOrdersWithEth(orders, orders.map(o => o.signature), formattedFeePercentage, feeRecipient)
|
.marketSellOrdersWithEth(orders, orders.map(o => o.signature), formattedFeePercentage, feeRecipient)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({
|
||||||
{
|
|
||||||
from: finalTakerAddress,
|
from: finalTakerAddress,
|
||||||
gas: gasLimit,
|
gas: gasLimit,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
|
@ -183,24 +183,20 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
|
|
||||||
await erc20MakerTokenContract
|
await erc20MakerTokenContract
|
||||||
.transfer(makerAddress, marketBuySwapQuote.worstCaseQuoteInfo.makerAssetAmount)
|
.transfer(makerAddress, marketBuySwapQuote.worstCaseQuoteInfo.makerAssetAmount)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({
|
||||||
{
|
|
||||||
from: coinbaseAddress,
|
from: coinbaseAddress,
|
||||||
});
|
});
|
||||||
await erc20TakerTokenContract
|
await erc20TakerTokenContract
|
||||||
.transfer(takerAddress, marketBuySwapQuote.worstCaseQuoteInfo.totalTakerAssetAmount)
|
.transfer(takerAddress, marketBuySwapQuote.worstCaseQuoteInfo.totalTakerAssetAmount)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({
|
||||||
{
|
|
||||||
from: coinbaseAddress,
|
from: coinbaseAddress,
|
||||||
});
|
});
|
||||||
await erc20MakerTokenContract
|
await erc20MakerTokenContract
|
||||||
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE)
|
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({ from: makerAddress });
|
||||||
{ from: makerAddress });
|
|
||||||
await erc20TakerTokenContract
|
await erc20TakerTokenContract
|
||||||
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE)
|
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({ from: takerAddress });
|
||||||
{ from: takerAddress });
|
|
||||||
});
|
});
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
await blockchainLifecycle.revertAsync();
|
await blockchainLifecycle.revertAsync();
|
||||||
@ -211,12 +207,10 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
* Does not test the validity of the state change performed by the forwarder smart contract
|
* 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 () => {
|
it('should perform a marketSell execution when provided a MarketSell type swapQuote', async () => {
|
||||||
console.log('herello?');
|
|
||||||
await expectMakerAndTakerBalancesForMakerAssetAsync(
|
await expectMakerAndTakerBalancesForMakerAssetAsync(
|
||||||
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
|
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
|
||||||
constants.ZERO_AMOUNT,
|
constants.ZERO_AMOUNT,
|
||||||
);
|
);
|
||||||
console.log('he?');
|
|
||||||
await expectMakerAndTakerBalancesForTakerAssetAsync(
|
await expectMakerAndTakerBalancesForTakerAssetAsync(
|
||||||
constants.ZERO_AMOUNT,
|
constants.ZERO_AMOUNT,
|
||||||
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
|
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
|
||||||
@ -225,12 +219,10 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
takerAddress,
|
takerAddress,
|
||||||
gasLimit: 4000000,
|
gasLimit: 4000000,
|
||||||
});
|
});
|
||||||
console.log('herelloas?');
|
|
||||||
await expectMakerAndTakerBalancesForMakerAssetAsync(
|
await expectMakerAndTakerBalancesForMakerAssetAsync(
|
||||||
constants.ZERO_AMOUNT,
|
constants.ZERO_AMOUNT,
|
||||||
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
|
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
|
||||||
);
|
);
|
||||||
console.log('haserello?');
|
|
||||||
await expectMakerAndTakerBalancesForTakerAssetAsync(
|
await expectMakerAndTakerBalancesForTakerAssetAsync(
|
||||||
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
|
new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI),
|
||||||
constants.ZERO_AMOUNT,
|
constants.ZERO_AMOUNT,
|
||||||
|
@ -154,11 +154,7 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
|
|
||||||
const totalFillableAmount = new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI);
|
const totalFillableAmount = new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI);
|
||||||
|
|
||||||
await erc20TokenContract.transfer(
|
await erc20TokenContract.transfer(makerAddress, totalFillableAmount).sendTransactionAsync({
|
||||||
makerAddress,
|
|
||||||
totalFillableAmount,
|
|
||||||
).sendTransactionAsync(
|
|
||||||
{
|
|
||||||
from: coinbaseAddress,
|
from: coinbaseAddress,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -123,31 +123,20 @@ describe('OrderPruner', () => {
|
|||||||
|
|
||||||
// give double fillableAmount to maker and taker as buffer
|
// give double fillableAmount to maker and taker as buffer
|
||||||
await erc20MakerTokenContract
|
await erc20MakerTokenContract
|
||||||
.transfer(
|
.transfer(makerAddress, fillableAmount.multipliedBy(4))
|
||||||
makerAddress,
|
.sendTransactionAsync({ from: coinbaseAddress });
|
||||||
fillableAmount.multipliedBy(4),
|
|
||||||
)
|
|
||||||
.sendTransactionAsync(
|
|
||||||
{ from: coinbaseAddress });
|
|
||||||
await erc20TakerTokenContract
|
await erc20TakerTokenContract
|
||||||
.transfer(
|
.transfer(takerAddress, fillableAmount.multipliedBy(4))
|
||||||
takerAddress,
|
.sendTransactionAsync({ from: coinbaseAddress });
|
||||||
fillableAmount.multipliedBy(4),
|
|
||||||
)
|
|
||||||
.sendTransactionAsync(
|
|
||||||
{ from: coinbaseAddress });
|
|
||||||
await erc20MakerTokenContract
|
await erc20MakerTokenContract
|
||||||
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
|
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({ from: makerAddress });
|
||||||
{ from: makerAddress });
|
|
||||||
await erc20MakerTokenContract
|
await erc20MakerTokenContract
|
||||||
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
|
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({ from: takerAddress });
|
||||||
{ from: takerAddress });
|
|
||||||
await erc20TakerTokenContract
|
await erc20TakerTokenContract
|
||||||
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
|
.approve(contractAddresses.erc20Proxy, UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({ from: takerAddress });
|
||||||
{ from: takerAddress });
|
|
||||||
|
|
||||||
partiallyFilledOpenSignedOrderFeeless = await orderFactory.newSignedOrderAsync({
|
partiallyFilledOpenSignedOrderFeeless = await orderFactory.newSignedOrderAsync({
|
||||||
takerAssetAmount: fillableAmount,
|
takerAssetAmount: fillableAmount,
|
||||||
@ -160,8 +149,7 @@ describe('OrderPruner', () => {
|
|||||||
partialFillAmount,
|
partialFillAmount,
|
||||||
partiallyFilledOpenSignedOrderFeeless.signature,
|
partiallyFilledOpenSignedOrderFeeless.signature,
|
||||||
)
|
)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({
|
||||||
{
|
|
||||||
from: takerAddress,
|
from: takerAddress,
|
||||||
gasPrice: GAS_PRICE,
|
gasPrice: GAS_PRICE,
|
||||||
gas: 4000000,
|
gas: 4000000,
|
||||||
@ -181,8 +169,7 @@ describe('OrderPruner', () => {
|
|||||||
partialFillAmount,
|
partialFillAmount,
|
||||||
partiallyFilledOpenSignedOrderFeeInTakerAsset.signature,
|
partiallyFilledOpenSignedOrderFeeInTakerAsset.signature,
|
||||||
)
|
)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({
|
||||||
{
|
|
||||||
from: takerAddress,
|
from: takerAddress,
|
||||||
gasPrice: GAS_PRICE,
|
gasPrice: GAS_PRICE,
|
||||||
gas: 4000000,
|
gas: 4000000,
|
||||||
@ -202,8 +189,7 @@ describe('OrderPruner', () => {
|
|||||||
partialFillAmount,
|
partialFillAmount,
|
||||||
partiallyFilledOpenSignedOrderFeeInMakerAsset.signature,
|
partiallyFilledOpenSignedOrderFeeInMakerAsset.signature,
|
||||||
)
|
)
|
||||||
.sendTransactionAsync(
|
.sendTransactionAsync({
|
||||||
{
|
|
||||||
from: takerAddress,
|
from: takerAddress,
|
||||||
gasPrice: GAS_PRICE,
|
gasPrice: GAS_PRICE,
|
||||||
gas: 4000000,
|
gas: 4000000,
|
||||||
@ -216,11 +202,8 @@ describe('OrderPruner', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await exchangeContract
|
await exchangeContract
|
||||||
.fillOrKillOrder(
|
.fillOrKillOrder(filledOpenSignedOrder, fillableAmount, filledOpenSignedOrder.signature)
|
||||||
filledOpenSignedOrder, fillableAmount, filledOpenSignedOrder.signature,
|
.sendTransactionAsync({
|
||||||
)
|
|
||||||
.sendTransactionAsync(
|
|
||||||
{
|
|
||||||
from: takerAddress,
|
from: takerAddress,
|
||||||
gasPrice: GAS_PRICE,
|
gasPrice: GAS_PRICE,
|
||||||
gas: 4000000,
|
gas: 4000000,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user