Skip to content

Commit

Permalink
only fund if less than 0.1 eth
Browse files Browse the repository at this point in the history
  • Loading branch information
sehyunc committed Feb 13, 2024
1 parent 545dd86 commit 4df43b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions trade.renegade.fi/app/api/fund/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,19 @@ export async function GET(request: Request) {
transport: http(),
});

// TODO: Check if already funded?

const ethAmount = parseEther("0.1")
const wethAmount = parseEther("1")
const usdcAmount = parseUnits("3000", 18)

const balance = await publicClient.getBalance({
address: recipient,
})
if (balance >= ethAmount) {
return new Response("Already funded", {
status: 200,
})
}

const transactionCount = await publicClient.getTransactionCount({
address: account.address,
})
Expand Down
4 changes: 2 additions & 2 deletions trade.renegade.fi/lib/stylus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ export const stylusDevnetEc2 = defineChain({
},
rpcUrls: {
default: {
http: ["https://35.183.100.90:8547"],
http: ["http://35.183.100.90:8547"],
webSocket: [
"wss://mainnet.infura.io/ws/v3/68c04ec6f9ce42c5becbed52a464ef81",
],
},
public: {
http: ["https://35.183.100.90:8547"],
http: ["http://35.183.100.90:8547"],
webSocket: [
"wss://mainnet.infura.io/ws/v3/68c04ec6f9ce42c5becbed52a464ef81",
],
Expand Down

0 comments on commit 4df43b9

Please sign in to comment.