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