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

Commit bc9f218

Browse files
authored
fix: lower db pool connections (#319)
* fix: lower db pool connections * disable RFQT debug logging * exit early when all sources excluded * throw a validation error
1 parent d9cb04d commit bc9f218

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

src/ormconfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export const config: ConnectionOptions = {
1414
logging: true,
1515
logger: 'debug',
1616
extra: {
17-
max: 20,
17+
max: 15,
1818
},
1919
};

src/services/swap_service.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
WRAP_QUOTE_GAS,
3737
ZERO,
3838
} from '../constants';
39-
import { InsufficientFundsError } from '../errors';
39+
import { InsufficientFundsError, ValidationError, ValidationErrorCodes } from '../errors';
4040
import { logger } from '../logger';
4141
import { TokenMetadatasForChains } from '../token_metadatas_for_networks';
4242
import {
@@ -74,8 +74,12 @@ export class SwapService {
7474
...SWAP_QUOTER_OPTS,
7575
rfqt: {
7676
...SWAP_QUOTER_OPTS.rfqt,
77-
warningLogger: logger.warn.bind(logger),
78-
infoLogger: logger.info.bind(logger),
77+
// tslint:disable-next-line:no-empty
78+
warningLogger: () => {},
79+
// tslint:disable-next-line:no-empty
80+
infoLogger: () => {},
81+
// warningLogger: logger.warn.bind(logger),
82+
// infoLogger: logger.info.bind(logger),
7983
},
8084
};
8185
this._swapQuoter = new SwapQuoter(this._provider, orderbook, swapQuoterOpts);
@@ -449,6 +453,16 @@ export class SwapService {
449453
affiliateFee,
450454
} = params;
451455
let _rfqt: RfqtRequestOpts | undefined;
456+
const isAllExcluded = Object.values(ERC20BridgeSource).every(s => excludedSources.includes(s));
457+
if (isAllExcluded) {
458+
throw new ValidationError([
459+
{
460+
field: 'excludedSources',
461+
code: ValidationErrorCodes.ValueOutOfRange,
462+
reason: 'Request excluded all sources',
463+
},
464+
]);
465+
}
452466
if (apiKey !== undefined && (isETHSell || from !== undefined)) {
453467
let takerAddress;
454468
switch (swapVersion) {

src/token_metadatas_for_networks.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,4 +777,14 @@ export const TokenMetadatasForChains: TokenMetadataAndChainAddresses[] = [
777777
[ChainId.Ganache]: NULL_ADDRESS,
778778
},
779779
},
780+
{
781+
symbol: 'CRV',
782+
name: 'Curve DAO Token',
783+
decimals: 18,
784+
tokenAddresses: {
785+
[ChainId.Mainnet]: '0xd533a949740bb3306d119cc777fa900ba034cd52',
786+
[ChainId.Kovan]: NULL_ADDRESS,
787+
[ChainId.Ganache]: NULL_ADDRESS,
788+
},
789+
},
780790
];

0 commit comments

Comments
 (0)