From f1ff1472ba91f90062e60c5304fc64bd35840a92 Mon Sep 17 00:00:00 2001 From: MacBook Pro Date: Sat, 29 Jun 2024 20:24:46 +0100 Subject: [PATCH] made maxDropAmount to be 5 usdt --- faucet-client/src/components/mining/PoWMinerStatus.tsx | 4 ++-- faucet-config.yaml | 2 +- src/eth/EthClaimManager.ts | 6 +++--- src/webserv/FaucetWebApi.ts | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/faucet-client/src/components/mining/PoWMinerStatus.tsx b/faucet-client/src/components/mining/PoWMinerStatus.tsx index 7ed6920..49e7168 100644 --- a/faucet-client/src/components/mining/PoWMinerStatus.tsx +++ b/faucet-client/src/components/mining/PoWMinerStatus.tsx @@ -133,7 +133,7 @@ export class PoWMinerStatus extends React.PureComponent< } if ( - this.state.balance >= this.props.faucetConfig.maxClaim && + this.state.balance >= (this.props.faucetConfig.faucetCoinType === "native"?this.props.faucetConfig.maxClaim: this.props.faucetConfig.maxClaim * 5) && !this.stoppedMiner ) { this.stoppedMiner = true; @@ -233,7 +233,7 @@ export class PoWMinerStatus extends React.PureComponent<
{toReadableAmount( - this.props.faucetConfig.maxClaim, + this.props.faucetConfig.faucetCoinType === "native"?this.props.faucetConfig.maxClaim:this.props.faucetConfig.maxClaim *5, this.props.faucetConfig.faucetCoinDecimals, this.props.faucetConfig.faucetCoinSymbol, )} diff --git a/faucet-config.yaml b/faucet-config.yaml index 0e89740..9852bef 100644 --- a/faucet-config.yaml +++ b/faucet-config.yaml @@ -64,7 +64,7 @@ faucetCoinSymbol: RWA # native = native coin (ETH) # erc20 = ERC20 token # both = ERC20 and native coin -faucetCoinType: "native" +faucetCoinType: "erc20" faucetCoinContractSymbol: "USDT" # coin contract address (only for faucetCoinType = erc20) diff --git a/src/eth/EthClaimManager.ts b/src/eth/EthClaimManager.ts index dea4417..1c0482f 100644 --- a/src/eth/EthClaimManager.ts +++ b/src/eth/EthClaimManager.ts @@ -2,7 +2,7 @@ import { WebSocket } from 'ws'; import { faucetConfig } from "../config/FaucetConfig.js"; import { FaucetLogLevel, FaucetProcess } from "../common/FaucetProcess.js"; import { ServiceManager } from "../common/ServiceManager.js"; -import { EthWalletManager } from "./EthWalletManager.js"; +import { EthWalletManager, FaucetCoinType } from "./EthWalletManager.js"; import { FaucetStatsLog } from "../services/FaucetStatsLog.js"; import { FaucetDatabase } from "../db/FaucetDatabase.js"; import { EthWalletRefill } from "./EthWalletRefill.js"; @@ -194,9 +194,9 @@ export class EthClaimManager { if(BigInt(sessionData.dropAmount) < BigInt(faucetConfig.minDropAmount)) throw new FaucetError("AMOUNT_TOO_LOW", "drop amount lower than minimum"); - let maxDropAmount = BigInt(faucetConfig.maxDropAmount); + let maxDropAmount = userInput.faucetCoinType == FaucetCoinType.NATIVE? BigInt(faucetConfig.maxDropAmount): BigInt(faucetConfig.maxDropAmount * 5); if(sessionData.data["overrideMaxDropAmount"]) - maxDropAmount = BigInt(sessionData.data["overrideMaxDropAmount"]); + maxDropAmount = userInput.faucetCoinType == FaucetCoinType.NATIVE? BigInt(sessionData.data["overrideMaxDropAmount"]): BigInt(sessionData.data["overrideMaxDropAmount"] * 5); if(BigInt(sessionData.dropAmount) > maxDropAmount) sessionData.dropAmount = maxDropAmount.toString(); diff --git a/src/webserv/FaucetWebApi.ts b/src/webserv/FaucetWebApi.ts index d9167d1..a3f16ed 100644 --- a/src/webserv/FaucetWebApi.ts +++ b/src/webserv/FaucetWebApi.ts @@ -1,7 +1,7 @@ import { IncomingMessage } from "http"; import { faucetConfig } from "../config/FaucetConfig.js"; import { ServiceManager } from "../common/ServiceManager.js"; -import { EthWalletManager } from "../eth/EthWalletManager.js"; +import { EthWalletManager, FaucetCoinType } from "../eth/EthWalletManager.js"; import { FaucetStatus, IFaucetStatus } from "../services/FaucetStatus.js"; import { FaucetHttpResponse } from "./FaucetHttpServer.js"; import { SessionManager } from "../session/SessionManager.js"; @@ -146,7 +146,7 @@ export class FaucetWebApi { } private onGetMaxReward(): number { - return faucetConfig.maxDropAmount; + return faucetConfig.faucetCoinType === FaucetCoinType.NATIVE? faucetConfig.maxDropAmount:faucetConfig.maxDropAmount *5; } public getFaucetHomeHtml(): string { @@ -179,7 +179,7 @@ export class FaucetWebApi { faucetCoinContract: faucetConfig.faucetCoinContract, faucetCoinDecimals: ethWalletManager.getFaucetDecimals(), minClaim: faucetConfig.minDropAmount, - maxClaim: faucetConfig.maxDropAmount, + maxClaim: faucetConfig.faucetCoinType === FaucetCoinType.NATIVE? faucetConfig.maxDropAmount: faucetConfig.maxDropAmount *5, sessionTimeout: faucetConfig.sessionTimeout, ethTxExplorerLink: faucetConfig.ethTxExplorerLink, time: Math.floor((new Date()).getTime() / 1000),