Skip to content

Commit

Permalink
Make MAX_BALANCE optional
Browse files Browse the repository at this point in the history
  • Loading branch information
harryttd committed Oct 13, 2023
1 parent 0b165da commit 46b90f0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Tezos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const sendTez = async (
const userBalanceMutez = await Tezos.tz.getBalance(address)
const userBalance = Number(format("mutez", "tz", userBalanceMutez).valueOf())

if (userBalance + amount > env.MAX_BALANCE) {
if (env.MAX_BALANCE !== null && userBalance + amount > env.MAX_BALANCE) {
console.log(`${address} balance too high (${userBalance}). Not sending.`)
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type InfoResponseBody = {
faucetAddress: string
captchaEnabled: boolean
challengesEnabled: boolean
maxBalance: number
maxBalance: number | null
minTez: number,
maxTez: number
}
2 changes: 1 addition & 1 deletion src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const env = {
...process.env,
DISABLE_CHALLENGES: DISABLE_CHALLENGES === "true",
ENABLE_CAPTCHA: ENABLE_CAPTCHA !== "false",
MAX_BALANCE: MAX_BALANCE ? Number(MAX_BALANCE) : 6000,
MAX_BALANCE: MAX_BALANCE ? Number(MAX_BALANCE) : null,
MIN_TEZ: MIN_TEZ ? Number(MIN_TEZ) : 1,
MAX_TEZ: MAX_TEZ ? Number(MAX_TEZ) : 6000,
CHALLENGE_SIZE: CHALLENGE_SIZE ? Number(CHALLENGE_SIZE) : 2048,
Expand Down

0 comments on commit 46b90f0

Please sign in to comment.