Skip to content

Commit

Permalink
made maxDropAmount to be 5 usdt
Browse files Browse the repository at this point in the history
  • Loading branch information
MacBook Pro authored and MacBook Pro committed Jun 29, 2024
1 parent 10d4080 commit f1ff147
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions faucet-client/src/components/mining/PoWMinerStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -233,7 +233,7 @@ export class PoWMinerStatus extends React.PureComponent<
<div className="col-6">
<div className="status-value">
{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,
)}
Expand Down
2 changes: 1 addition & 1 deletion faucet-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/eth/EthClaimManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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();

Expand Down
6 changes: 3 additions & 3 deletions src/webserv/FaucetWebApi.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit f1ff147

Please sign in to comment.