fix: update config
This commit is contained in:
parent
0fcfdf4094
commit
69f63a4dba
@ -9,10 +9,8 @@ PORT=8000
|
||||
SERVICE_FEE=0.05
|
||||
REWARD_ADDRESS=
|
||||
|
||||
# bull settings
|
||||
REDIS_URL=redis://127.0.0.1:6379
|
||||
|
||||
# tx-manager settings
|
||||
RPC_URL=
|
||||
CHAIN_ID=1
|
||||
PRIVATE_KEY=
|
||||
CONFIRMATIONS=4
|
||||
MAX_GAS_PRICE=100
|
||||
|
@ -3,7 +3,7 @@ import { registerAs } from '@nestjs/config';
|
||||
export default registerAs('bull', () => ({
|
||||
name: 'withdrawal',
|
||||
redis: {
|
||||
host: 'localhost',
|
||||
host: process.env.NODE_ENV === 'development' ? 'localhost' : 'redis',
|
||||
port: 6379,
|
||||
},
|
||||
settings: {
|
||||
|
@ -1,16 +1,17 @@
|
||||
import { Wallet } from 'ethers';
|
||||
import { NETWORKS_INFO } from '@/constants';
|
||||
|
||||
import { version } from '../../package.json';
|
||||
|
||||
export const baseConfig = () => ({
|
||||
base: {
|
||||
version,
|
||||
gasLimit: 600000,
|
||||
minimumBalance: 0.5,
|
||||
port: process.env.PORT,
|
||||
chainId: process.env.CHAIN_ID,
|
||||
serviceFee: process.env.SERVICE_FEE,
|
||||
rewardAddress: process.env.REWARD_ADDRESS,
|
||||
port: parseInt(process.env.PORT, 10) || 8080,
|
||||
address: new Wallet(process.env.PRIVATE_KEY).address,
|
||||
gasLimit: NETWORKS_INFO[process.env.CHAIN_ID].gasLimit,
|
||||
minimumBalance: NETWORKS_INFO[process.env.CHAIN_ID].minimumBalance,
|
||||
},
|
||||
});
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
import { RPC_LIST } from '@/constants';
|
||||
|
||||
export default registerAs('txManager', () => ({
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
rpcUrl: process.env.RPC_URL,
|
||||
rpcUrl: RPC_LIST[process.env.CHAIN_ID],
|
||||
config: {
|
||||
CONFIRMATIONS: '4',
|
||||
MAX_GAS_PRICE: '100',
|
||||
THROW_ON_REVERT: false,
|
||||
CONFIRMATIONS: process.env.CONFIRMATIONS,
|
||||
MAX_GAS_PRICE: process.env.MAX_GAS_PRICE,
|
||||
},
|
||||
}));
|
||||
|
@ -1,4 +1,20 @@
|
||||
import { BigNumber } from 'ethers';
|
||||
import { ChainId } from '@/types';
|
||||
|
||||
const NETWORKS_INFO: { [chainId in ChainId] } = {
|
||||
[ChainId.MAINNET]: {
|
||||
gasLimit: BigNumber.from(600000),
|
||||
minimumBalance: 0.5,
|
||||
},
|
||||
[ChainId.GOERLI]: {
|
||||
gasLimit: BigNumber.from(600000),
|
||||
minimumBalance: 0.5,
|
||||
},
|
||||
[ChainId.OPTIMISM]: {
|
||||
gasLimit: '',
|
||||
minimumBalance: 0.5,
|
||||
},
|
||||
};
|
||||
|
||||
const numbers = {
|
||||
ZERO: 0,
|
||||
@ -10,10 +26,8 @@ const numbers = {
|
||||
};
|
||||
|
||||
const BG_ZERO = BigNumber.from(numbers.ZERO);
|
||||
const FIELD_SIZE = BigNumber.from(
|
||||
'21888242871839275222246405745257275088548364400416034343698204186575808495617',
|
||||
);
|
||||
const FIELD_SIZE = BigNumber.from('21888242871839275222246405745257275088548364400416034343698204186575808495617');
|
||||
|
||||
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||
|
||||
export { numbers, FIELD_SIZE, BG_ZERO, ZERO_ADDRESS };
|
||||
export { numbers, NETWORKS_INFO, FIELD_SIZE, BG_ZERO, ZERO_ADDRESS };
|
||||
|
@ -91,7 +91,7 @@ export class WithdrawalProcessor extends BaseProcessor<Withdrawal> {
|
||||
}
|
||||
|
||||
async prepareTransaction({ proof, args }) {
|
||||
const chainId = this.configService.get('base.chainId');
|
||||
const { chainId, address } = this.configService.get('base');
|
||||
|
||||
const contract = this.providerService.getTornadoPool();
|
||||
|
||||
@ -104,8 +104,8 @@ export class WithdrawalProcessor extends BaseProcessor<Withdrawal> {
|
||||
if (chainId === ChainId.OPTIMISM) {
|
||||
// @ts-ignore
|
||||
gasLimit = await contract.estimateGas.transaction(proof, ...args, {
|
||||
from: address,
|
||||
value: BigNumber.from(0)._hex,
|
||||
from: '0x1a5245ea5210C3B57B7Cfdf965990e63534A7b52',
|
||||
gasPrice: toWei('0.015', 'gwei'),
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user