Skip to content

Commit

Permalink
fix: deploy failing
Browse files Browse the repository at this point in the history
  • Loading branch information
0xChin committed Aug 11, 2024
1 parent 327a744 commit 45d6d2d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 73 deletions.
62 changes: 0 additions & 62 deletions frontend/app/api/createVault/route.ts

This file was deleted.

26 changes: 15 additions & 11 deletions frontend/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Image from "next/image";
import { ConnectButton } from "@rainbow-me/rainbowkit";
import {
useChainId,
useWaitForTransactionReceipt,
useWatchContractEvent,
useWriteContract,
} from "wagmi";
Expand All @@ -14,7 +13,6 @@ import {
FACTORY_CONTRACT_ADDRESS,
} from "@/utils/vaultConfig";
import { parseUnits } from "viem";
import { pythPriceFeedIds } from "@/utils/vaultConfig";
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { useEffect, useState } from "react";
import {
Expand All @@ -39,12 +37,11 @@ import {
SelectValue,
} from "@/components/ui/select";
import Token from "@/components/token";
import { parse } from "path";

export default function Home() {
const { writeContractAsync } = useWriteContract();
const chainId = useChainId();
const [isCreatingVault, setIsCreatingVault] = useState(false);
const [group, setGroup] = useState("deployedVaults");
const [vaults, setVaults] = useState<{ [key: number]: `0x${string}`[] }>({});
const [parsedVaults, setParsedVaults] = useState<`0x${string}`[]>([]);
const [asset, setAsset] = useState<`0x${string}`>("0x");
Expand Down Expand Up @@ -78,7 +75,7 @@ export default function Home() {
borrowToken!,
parseUnits(minHealthFactor.toString(), 16),
parseUnits(maxHealthFactor.toString(), 16),
BigInt(0),
ADDRESS_TO_ORACLE_ID[chainId][asset!],
],
});
} catch (error) {
Expand Down Expand Up @@ -128,25 +125,32 @@ export default function Home() {
<ToggleGroup
type="single"
className="flex"
value={isCreatingVault ? "createVault" : "deployedVaults"}
onValueChange={(value) => setIsCreatingVault(value === "createVault")}
value={group}
onValueChange={(value) => setGroup(value)}
>
<ToggleGroupItem
className="px-40"
className="px-32"
value="deployedVaults"
aria-label="Deployed Vaults"
>
<p>Deployed Vaults</p>
</ToggleGroupItem>
<ToggleGroupItem
className="px-40"
className="px-32"
value="createVault"
aria-label="Create Vault"
>
<p>Create Vault</p>
</ToggleGroupItem>
<ToggleGroupItem
className="px-32"
value="simulate"
aria-label="Simulate"
>
<p>Simulate</p>
</ToggleGroupItem>
</ToggleGroup>
{!isCreatingVault &&
{group === "deployedVaults" &&
(parsedVaults && parsedVaults.length > 0 ? (
<Table className="mt-4">
<TableHeader>
Expand All @@ -172,7 +176,7 @@ export default function Home() {
No deployed vaults found. Create one to get started.
</p>
))}
{isCreatingVault && (
{group === "createVault" && (
<form className="mt-4 p-4 bg-gray-100 rounded">
<label className="block mb-2">
Protocol:
Expand Down

0 comments on commit 45d6d2d

Please sign in to comment.