mirror of
https://github.com/tornadocash/tornado-pool-relayer
synced 2024-02-02 15:04:09 +01:00
fix: relayer fee
This commit is contained in:
parent
0c0354b7a1
commit
c95249ca4c
@ -1,10 +1,7 @@
|
|||||||
import { ChainId } from '@/types';
|
import { ChainId } from '@/types';
|
||||||
|
|
||||||
export const CONTRACT_NETWORKS: { [chainId in ChainId]: string } = {
|
export const CONTRACT_NETWORKS: { [chainId in ChainId]: string } = {
|
||||||
// [ChainId.MAINNET]: '0x8Bfac9EF3d73cE08C7CEC339C0fE3B2e57814c1E',
|
// [ChainId.XDAI]: '0xE6DdD048304053Bf6ba258D47937289574971057', // BNB
|
||||||
[ChainId.GOERLI]: '0xE2D9aF526edeB16a02FBC3B68B0eB9B534f9c114',
|
|
||||||
[ChainId.OPTIMISM]: '0xcd7318c299A82E887f5180EF865a4c350dFC9fe5',
|
|
||||||
// [ChainId.XDAI]: '0xdd85b1dbE3379AFA37F703822f9E328d4bAf8625', // BNB
|
|
||||||
[ChainId.XDAI]: '0x9719570C85c93a74c72B5B2c08AA133fcBc35377', // ETH
|
[ChainId.XDAI]: '0x9719570C85c93a74c72B5B2c08AA133fcBc35377', // ETH
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -122,11 +122,9 @@ export class TransactionProcessor extends BaseProcessor<Transaction> {
|
|||||||
|
|
||||||
// for withdrawals the amount is negative
|
// for withdrawals the amount is negative
|
||||||
if (amount.isNegative()) {
|
if (amount.isNegative()) {
|
||||||
const integerMultiplier = getToIntegerMultiplier(serviceFee.withdrawal);
|
const oneEther = getToIntegerMultiplier();
|
||||||
|
|
||||||
return BigNumber.from(amount)
|
return amount.mul(toWei(serviceFee.withdrawal)).div(oneEther);
|
||||||
.mul(serviceFee.withdrawal * integerMultiplier)
|
|
||||||
.div(numbers.ONE_HUNDRED * integerMultiplier);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return serviceFee.transfer;
|
return serviceFee.transfer;
|
||||||
|
@ -11,7 +11,7 @@ export function toChecksumAddress(value: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function toWei(value: string, uintName = 'ether') {
|
export function toWei(value: string, uintName = 'ether') {
|
||||||
return utils.parseUnits(value, uintName);
|
return utils.parseUnits(String(value), uintName);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hexToNumber(hex: string) {
|
export function hexToNumber(hex: string) {
|
||||||
@ -26,12 +26,6 @@ export function fromWei(balance: BigNumberish) {
|
|||||||
return utils.formatUnits(balance, numbers.ETH_DECIMALS);
|
return utils.formatUnits(balance, numbers.ETH_DECIMALS);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getToIntegerMultiplier(value: number | string): number {
|
export function getToIntegerMultiplier(): BigNumber {
|
||||||
const [, decimals] = String(value).split('.');
|
return toWei('1', 'ether');
|
||||||
|
|
||||||
if (!decimals) {
|
|
||||||
return numbers.ZERO;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Math.pow(numbers.TEN, decimals.length);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user