@0x/asset-swapper
: Use IZeroExContract
in EP swap quote consumer.
This commit is contained in:
@@ -37,6 +37,10 @@
|
||||
{
|
||||
"note": "Add `refundReceiver` to `ExchangeProxySwapQuoteConsumer` options.",
|
||||
"pr": 2657
|
||||
},
|
||||
{
|
||||
"note": "Use `IZeroExContract` in EP swap quote consumer.",
|
||||
"pr": "TODO"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { ContractAddresses } from '@0x/contract-addresses';
|
||||
import { ITransformERC20Contract } from '@0x/contract-wrappers';
|
||||
import { IZeroExContract } from '@0x/contract-wrappers';
|
||||
import {
|
||||
assetDataUtils,
|
||||
encodeAffiliateFeeTransformerData,
|
||||
@@ -45,7 +45,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||
affiliateFeeTransformer: number;
|
||||
};
|
||||
|
||||
private readonly _transformFeature: ITransformERC20Contract;
|
||||
private readonly _exchangeProxy: IZeroExContract;
|
||||
|
||||
constructor(
|
||||
supportedProvider: SupportedProvider,
|
||||
@@ -58,7 +58,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||
this.provider = provider;
|
||||
this.chainId = chainId;
|
||||
this.contractAddresses = contractAddresses;
|
||||
this._transformFeature = new ITransformERC20Contract(contractAddresses.exchangeProxy, supportedProvider);
|
||||
this._exchangeProxy = new IZeroExContract(contractAddresses.exchangeProxy, supportedProvider);
|
||||
this.transformerNonces = {
|
||||
wethTransformer: findTransformerNonce(
|
||||
contractAddresses.transformers.wethTransformer,
|
||||
@@ -165,7 +165,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||
});
|
||||
|
||||
const minBuyAmount = BigNumber.max(0, quote.worstCaseQuoteInfo.makerAssetAmount.minus(buyTokenFeeAmount));
|
||||
const calldataHexString = this._transformFeature
|
||||
const calldataHexString = this._exchangeProxy
|
||||
.transformERC20(
|
||||
isFromETH ? ETH_TOKEN_ADDRESS : sellToken,
|
||||
isToETH ? ETH_TOKEN_ADDRESS : buyToken,
|
||||
@@ -183,7 +183,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||
return {
|
||||
calldataHexString,
|
||||
ethAmount,
|
||||
toAddress: this._transformFeature.address,
|
||||
toAddress: this._exchangeProxy.address,
|
||||
allowanceTarget: this.contractAddresses.exchangeProxyAllowanceTarget,
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user