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