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

Commit

Permalink
fix: lower db pool connections (#319)
Browse files Browse the repository at this point in the history
* fix: lower db pool connections

* disable RFQT debug logging

* exit early when all sources excluded

* throw a validation error
  • Loading branch information
dekz authored Aug 14, 2020
1 parent d9cb04d commit bc9f218
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ormconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export const config: ConnectionOptions = {
logging: true,
logger: 'debug',
extra: {
max: 20,
max: 15,
},
};
20 changes: 17 additions & 3 deletions src/services/swap_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
WRAP_QUOTE_GAS,
ZERO,
} from '../constants';
import { InsufficientFundsError } from '../errors';
import { InsufficientFundsError, ValidationError, ValidationErrorCodes } from '../errors';
import { logger } from '../logger';
import { TokenMetadatasForChains } from '../token_metadatas_for_networks';
import {
Expand Down Expand Up @@ -74,8 +74,12 @@ export class SwapService {
...SWAP_QUOTER_OPTS,
rfqt: {
...SWAP_QUOTER_OPTS.rfqt,
warningLogger: logger.warn.bind(logger),
infoLogger: logger.info.bind(logger),
// tslint:disable-next-line:no-empty
warningLogger: () => {},
// tslint:disable-next-line:no-empty
infoLogger: () => {},
// warningLogger: logger.warn.bind(logger),
// infoLogger: logger.info.bind(logger),
},
};
this._swapQuoter = new SwapQuoter(this._provider, orderbook, swapQuoterOpts);
Expand Down Expand Up @@ -449,6 +453,16 @@ export class SwapService {
affiliateFee,
} = params;
let _rfqt: RfqtRequestOpts | undefined;
const isAllExcluded = Object.values(ERC20BridgeSource).every(s => excludedSources.includes(s));
if (isAllExcluded) {
throw new ValidationError([
{
field: 'excludedSources',
code: ValidationErrorCodes.ValueOutOfRange,
reason: 'Request excluded all sources',
},
]);
}
if (apiKey !== undefined && (isETHSell || from !== undefined)) {
let takerAddress;
switch (swapVersion) {
Expand Down
10 changes: 10 additions & 0 deletions src/token_metadatas_for_networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,4 +777,14 @@ export const TokenMetadatasForChains: TokenMetadataAndChainAddresses[] = [
[ChainId.Ganache]: NULL_ADDRESS,
},
},
{
symbol: 'CRV',
name: 'Curve DAO Token',
decimals: 18,
tokenAddresses: {
[ChainId.Mainnet]: '0xd533a949740bb3306d119cc777fa900ba034cd52',
[ChainId.Kovan]: NULL_ADDRESS,
[ChainId.Ganache]: NULL_ADDRESS,
},
},
];

0 comments on commit bc9f218

Please sign in to comment.