tx-manager conf from env

This commit is contained in:
smart_ex 2022-07-04 17:21:19 +10:00
parent 8649a5d258
commit a4fdadafd7
4 changed files with 14 additions and 11 deletions

@ -20,12 +20,13 @@ jobs:
- run: yarn lint
- name: Telegram Failure Notification
uses: appleboy/telegram-action@master
if: failure()
with:
message: ❗ Build failed for [${{ github.repository }}](https://github.com/${{ github.repository }}/actions) because of ${{ github.actor }}
format: markdown
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
# TODO if: failure()
# if: failure()
# with:
# message: ❗ Build failed for [${{ github.repository }}](https://github.com/${{ github.repository }}/actions) because of ${{ github.actor }}
# format: markdown
# to: ${{ secrets.TELEGRAM_CHAT_ID }}
# token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
# TODO: Edit this step
# publish:
# runs-on: ubuntu-latest

@ -8,6 +8,8 @@ export const netId = <availableIds>Number(process.env.NET_ID || 1);
export const redisUrl = process.env.REDIS_URL || 'redis://127.0.0.1:6379';
export const rpcUrl = process.env.HTTP_RPC_URL;
export const CONFIRMATIONS = Number(process.env.CONFIRMATIONS) || 4;
export const MAX_GAS_PRICE = Number(process.env.MAX_GAS_PRICE) || 1000;
export const BASE_FEE_RESERVE_PERCENTAGE = Number(process.env.BASE_FEE_RESERVE_PERCENTAGE) || 25;
export const mainnetRpcUrl = process.env.ORACLE_RPC_URL || 'https://mainnet.infura.io/';
export const offchainOracleAddress = '0x07D91f5fb9Bf7798734C3f606dB065549F6893bb';
export const multiCallAddress = '0xda3c19c6fe954576707fa24695efb830d9cca1ca';

@ -40,13 +40,13 @@ export class NotifierService {
private telegram: Telegram | MockTelegram;
private readonly token: string;
private readonly chatId: string;
prefix: string;
host: string;
constructor(private store: RedisStore, private config: ConfigService) {
this.token = process.env.TELEGRAM_NOTIFIER_BOT_TOKEN;
this.chatId = process.env.TELEGRAM_NOTIFIER_CHAT_ID;
this.telegram = this.token ? new Telegram(this.token) : new MockTelegram();
this.prefix = this.config.host;
this.host = this.config.host;
}
async processAlert(message: string) {
@ -72,7 +72,7 @@ export class NotifierService {
}
send(message: string, level: Levels) {
const text = `${AlertLevel[level]} ${this.prefix}: ${message}`;
const text = `${AlertLevel[level]} ${this.host}: ${message}`;
return this.telegram.sendMessage(this.chatId, text, { parse_mode: 'HTML' });
}

@ -4,7 +4,7 @@ import { Provider } from '@ethersproject/providers';
import { formatEther, parseUnits } from 'ethers/lib/utils';
import { BigNumber, BigNumberish, BytesLike } from 'ethers';
import { ProxyLightABI, TornadoProxyABI } from '../contracts';
import { CONFIRMATIONS, gasLimits, tornadoServiceFee } from '../config';
import { BASE_FEE_RESERVE_PERCENTAGE, CONFIRMATIONS, gasLimits, MAX_GAS_PRICE, tornadoServiceFee } from '../config';
import { JobStatus, RelayerJobType } from '../types';
import { PriceService } from './price.service';
import { Job } from 'bullmq';
@ -47,7 +47,7 @@ export class TxService {
this.txManager = new TxManager({
privateKey,
rpcUrl,
config: { THROW_ON_REVERT: true, CONFIRMATIONS },
config: { THROW_ON_REVERT: true, CONFIRMATIONS, MAX_GAS_PRICE, BASE_FEE_RESERVE_PERCENTAGE },
provider: this.provider,
});
this.oracle = new GasPriceOracle({