Skip to content

Commit

Permalink
fix: faucet action linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerilym committed Jul 9, 2024
1 parent 3cbb703 commit 82113e5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions apps/staking/app/faucet/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import path from 'path';
import { formatEther, isAddress as isAddressViem, type Address } from 'viem';
import { FaucetFormSchema } from './AuthModule';

// TODO: move these to a database util file
/*
interface DiscordIdExport {
id: number;
name: string;
Expand Down Expand Up @@ -125,7 +127,7 @@ const importOperatorIds = (operatorExport: Array<OperatorAddressExport>) => {
db.close();
}
}
};
}; */

enum TABLE {
TRANSACTIONS = 'transactions',
Expand Down Expand Up @@ -218,7 +220,7 @@ const faucetTokenDrip = BigInt(FAUCET.DRIP * Math.pow(10, SENT_DECIMALS));

const minTargetEthBalance = BigInt(FAUCET.MIN_ETH_BALANCE * Math.pow(10, ETH_DECIMALS));

const hoursBetweenTransactions = parseInt(process.env.FAUCET_HOURS_BETWEEN_USES ?? 0);
const hoursBetweenTransactions = parseInt(process.env.FAUCET_HOURS_BETWEEN_USES ?? '0');

const isAddress = (address?: string): address is Address => {
return !!address && isAddressViem(address, { strict: false });
Expand Down Expand Up @@ -465,7 +467,7 @@ export async function transferTestTokens({
if (
!idIsInTable({
db,
source: TRANSACTIONS_TABLE.OPERATOR,
source: TABLE.OPERATOR,
id: walletAddress,
})
) {
Expand All @@ -479,7 +481,7 @@ export async function transferTestTokens({
);
}

if (hasRecentTransaction({ db, source: TRANSACTIONS_TABLE.OPERATOR, id: walletAddress })) {
if (hasRecentTransaction({ db, source: TABLE.OPERATOR, id: walletAddress })) {
throw new FaucetError(FAUCET_ERROR.ALREADY_USED, dictionary('alreadyUsed'));
}

Expand All @@ -492,7 +494,7 @@ export async function transferTestTokens({
if (
!idIsInTable({
db,
source: TRANSACTIONS_TABLE.DISCORD,
source: TABLE.DISCORD,
id: discordId,
})
) {
Expand All @@ -507,7 +509,7 @@ export async function transferTestTokens({
);
}

if (hasRecentTransaction({ db, source: TRANSACTIONS_TABLE.DISCORD, id: discordId })) {
if (hasRecentTransaction({ db, source: TABLE.DISCORD, id: discordId })) {
throw new FaucetError(
FAUCET_ERROR.ALREADY_USED_SERVICE,
dictionary('alreadyUsedService', {
Expand All @@ -523,7 +525,7 @@ export async function transferTestTokens({
if (
!idIsInTable({
db,
source: TRANSACTIONS_TABLE.TELEGRAM,
source: TABLE.TELEGRAM,
id: telegramId,
})
) {
Expand All @@ -538,7 +540,7 @@ export async function transferTestTokens({
);
}

if (hasRecentTransaction({ db, source: TRANSACTIONS_TABLE.TELEGRAM, id: telegramId })) {
if (hasRecentTransaction({ db, source: TABLE.TELEGRAM, id: telegramId })) {
throw new FaucetError(
FAUCET_ERROR.ALREADY_USED_SERVICE,
dictionary('alreadyUsedService', {
Expand Down

0 comments on commit 82113e5

Please sign in to comment.