Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
fix: egs polling and forwarder buy (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
dekz authored Jul 1, 2020
1 parent 16eabc0 commit 94587d0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
},
"dependencies": {
"@0x/assert": "^3.0.4",
"@0x/asset-swapper": "0xProject/gitpkg-registry#0x-asset-swapper-v4.5.0-9a8139ce9",
"@0x/asset-swapper": "0xProject/gitpkg-registry#0x-asset-swapper-v4.5.0-0eb0d4d45",
"@0x/connect": "^6.0.4",
"@0x/contract-addresses": "0xProject/gitpkg-registry#0x-contract-addresses-v4.9.0-f14b6f2ba",
"@0x/contract-wrappers": "0xProject/gitpkg-registry#0x-contract-wrappers-v13.6.3-f14b6f2ba",
Expand Down
9 changes: 1 addition & 8 deletions src/services/swap_service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
ExtensionContractType,
Orderbook,
ProtocolFeeUtils,
SwapQuote,
SwapQuoteConsumer,
SwapQuoter,
Expand Down Expand Up @@ -29,7 +28,6 @@ import {
GAS_LIMIT_BUFFER_MULTIPLIER,
GST2_WALLET_ADDRESSES,
ONE,
PROTOCOL_FEE_UTILS_POLLING_INTERVAL_IN_MS,
QUOTE_ORDER_EXPIRATION_BUFFER_MS,
UNWRAP_QUOTE_GAS,
WRAP_QUOTE_GAS,
Expand All @@ -55,7 +53,6 @@ export class SwapService {
private readonly _web3Wrapper: Web3Wrapper;
private readonly _wethContract: WETH9Contract;
private readonly _gasTokenContract: ERC20TokenContract;
private readonly _protocolFeeUtils: ProtocolFeeUtils;
private readonly _forwarderAddress: string;

constructor(orderbook: Orderbook, provider: SupportedProvider) {
Expand Down Expand Up @@ -84,10 +81,6 @@ export class SwapService {
getTokenMetadataIfExists('GST2', CHAIN_ID).tokenAddress,
this._provider,
);
this._protocolFeeUtils = new ProtocolFeeUtils(
PROTOCOL_FEE_UTILS_POLLING_INTERVAL_IN_MS,
swapQuoterOpts.ethGasStationUrl,
);
this._forwarderAddress = contractAddresses.forwarder;
}

Expand Down Expand Up @@ -267,7 +260,7 @@ export class SwapService {
const value = isUnwrap ? ZERO : amount;
const affiliatedData = serviceUtils.attributeCallData(data, affiliateAddress);
// TODO: consider not using protocol fee utils due to lack of need for an aggresive gas price for wrapping/unwrapping
const gasPrice = providedGasPrice || (await this._protocolFeeUtils.getGasPriceEstimationOrThrowAsync());
const gasPrice = providedGasPrice || (await this._swapQuoter.getGasPriceEstimationOrThrowAsync());
const gasEstimate = isUnwrap ? UNWRAP_QUOTE_GAS : WRAP_QUOTE_GAS;
const apiSwapQuote: GetSwapQuoteResponse = {
price: ONE,
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
lodash "^4.17.11"
valid-url "^1.0.9"

"@0x/asset-swapper@0xProject/gitpkg-registry#0x-asset-swapper-v4.5.0-9a8139ce9":
"@0x/asset-swapper@0xProject/gitpkg-registry#0x-asset-swapper-v4.5.0-0eb0d4d45":
version "4.5.0"
resolved "https://codeload.github.com/0xProject/gitpkg-registry/tar.gz/1dc56a8c840edf07e470daeda76d4c4a90502bd7"
resolved "https://codeload.github.com/0xProject/gitpkg-registry/tar.gz/cc0d5b67008429f0f6cacfdc795e34b8986eeabb"
dependencies:
"@0x/assert" "^3.0.8"
"@0x/contract-addresses" "^4.10.0"
Expand Down

0 comments on commit 94587d0

Please sign in to comment.