diff --git a/packages/foundry/.env.example b/packages/foundry/.env.example
deleted file mode 100644
index 7fe93e3..0000000
--- a/packages/foundry/.env.example
+++ /dev/null
@@ -1,3 +0,0 @@
-DEPLOYER_PRIVATE_KEY=
-ETHERSCAN_API_KEY=
-ALCHEMY_API_KEY=
\ No newline at end of file
diff --git a/packages/foundry/foundry.toml b/packages/foundry/foundry.toml
index 0e4c8f1..e57001d 100644
--- a/packages/foundry/foundry.toml
+++ b/packages/foundry/foundry.toml
@@ -6,7 +6,7 @@ libs = ['lib']
fs_permissions = [{ access = "read-write", path = "./"}]
[rpc_endpoints]
-default_network = "http://127.0.0.1:8545"
+default_network = "https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
localhost = "http://127.0.0.1:8545"
mainnet = "https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_API_KEY}"
diff --git a/packages/nextjs/components/index/abis/xocpin.ts b/packages/nextjs/components/index/abis/xocpin.ts
new file mode 100644
index 0000000..6864def
--- /dev/null
+++ b/packages/nextjs/components/index/abis/xocpin.ts
@@ -0,0 +1,309 @@
+export const xocPinABI = [
+ {
+ inputs: [{ internalType: "string", name: "_tokenURI", type: "string" }],
+ stateMutability: "nonpayable",
+ type: "constructor",
+ },
+ { inputs: [{ internalType: "address", name: "target", type: "address" }], name: "AddressEmptyCode", type: "error" },
+ {
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
+ name: "AddressInsufficientBalance",
+ type: "error",
+ },
+ {
+ inputs: [
+ { internalType: "address", name: "sender", type: "address" },
+ { internalType: "uint256", name: "tokenId", type: "uint256" },
+ { internalType: "address", name: "owner", type: "address" },
+ ],
+ name: "ERC721IncorrectOwner",
+ type: "error",
+ },
+ {
+ inputs: [
+ { internalType: "address", name: "operator", type: "address" },
+ { internalType: "uint256", name: "tokenId", type: "uint256" },
+ ],
+ name: "ERC721InsufficientApproval",
+ type: "error",
+ },
+ {
+ inputs: [{ internalType: "address", name: "approver", type: "address" }],
+ name: "ERC721InvalidApprover",
+ type: "error",
+ },
+ {
+ inputs: [{ internalType: "address", name: "operator", type: "address" }],
+ name: "ERC721InvalidOperator",
+ type: "error",
+ },
+ { inputs: [{ internalType: "address", name: "owner", type: "address" }], name: "ERC721InvalidOwner", type: "error" },
+ {
+ inputs: [{ internalType: "address", name: "receiver", type: "address" }],
+ name: "ERC721InvalidReceiver",
+ type: "error",
+ },
+ {
+ inputs: [{ internalType: "address", name: "sender", type: "address" }],
+ name: "ERC721InvalidSender",
+ type: "error",
+ },
+ {
+ inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
+ name: "ERC721NonexistentToken",
+ type: "error",
+ },
+ { inputs: [], name: "FailedInnerCall", type: "error" },
+ { inputs: [{ internalType: "address", name: "owner", type: "address" }], name: "OwnableInvalidOwner", type: "error" },
+ {
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
+ name: "OwnableUnauthorizedAccount",
+ type: "error",
+ },
+ {
+ inputs: [{ internalType: "address", name: "token", type: "address" }],
+ name: "SafeERC20FailedOperation",
+ type: "error",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ { indexed: true, internalType: "address", name: "owner", type: "address" },
+ { indexed: true, internalType: "address", name: "approved", type: "address" },
+ { indexed: true, internalType: "uint256", name: "tokenId", type: "uint256" },
+ ],
+ name: "Approval",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ { indexed: true, internalType: "address", name: "owner", type: "address" },
+ { indexed: true, internalType: "address", name: "operator", type: "address" },
+ { indexed: false, internalType: "bool", name: "approved", type: "bool" },
+ ],
+ name: "ApprovalForAll",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ { indexed: false, internalType: "uint256", name: "_fromTokenId", type: "uint256" },
+ { indexed: false, internalType: "uint256", name: "_toTokenId", type: "uint256" },
+ ],
+ name: "BatchMetadataUpdate",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [{ indexed: false, internalType: "uint256", name: "_tokenId", type: "uint256" }],
+ name: "MetadataUpdate",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ { indexed: true, internalType: "address", name: "previousOwner", type: "address" },
+ { indexed: true, internalType: "address", name: "newOwner", type: "address" },
+ ],
+ name: "OwnershipTransferred",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ { indexed: true, internalType: "address", name: "from", type: "address" },
+ { indexed: true, internalType: "address", name: "to", type: "address" },
+ { indexed: true, internalType: "uint256", name: "tokenId", type: "uint256" },
+ ],
+ name: "Transfer",
+ type: "event",
+ },
+ {
+ inputs: [],
+ name: "MINT_PRICE",
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "TREASURY",
+ outputs: [{ internalType: "address", name: "", type: "address" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "XOCOLATL",
+ outputs: [{ internalType: "address", name: "", type: "address" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ { internalType: "address", name: "to", type: "address" },
+ { internalType: "uint256", name: "tokenId", type: "uint256" },
+ ],
+ name: "approve",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [{ internalType: "address", name: "owner", type: "address" }],
+ name: "balanceOf",
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "baseTokenURI",
+ outputs: [{ internalType: "string", name: "", type: "string" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
+ name: "getApproved",
+ outputs: [{ internalType: "address", name: "", type: "address" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ { internalType: "address", name: "owner", type: "address" },
+ { internalType: "address", name: "operator", type: "address" },
+ ],
+ name: "isApprovedForAll",
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [{ internalType: "address", name: "to", type: "address" }],
+ name: "mint",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "name",
+ outputs: [{ internalType: "string", name: "", type: "string" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "nextTokenId",
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "owner",
+ outputs: [{ internalType: "address", name: "", type: "address" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
+ name: "ownerOf",
+ outputs: [{ internalType: "address", name: "", type: "address" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" },
+ {
+ inputs: [
+ { internalType: "address", name: "from", type: "address" },
+ { internalType: "address", name: "to", type: "address" },
+ { internalType: "uint256", name: "tokenId", type: "uint256" },
+ ],
+ name: "safeTransferFrom",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ { internalType: "address", name: "from", type: "address" },
+ { internalType: "address", name: "to", type: "address" },
+ { internalType: "uint256", name: "tokenId", type: "uint256" },
+ { internalType: "bytes", name: "data", type: "bytes" },
+ ],
+ name: "safeTransferFrom",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ { internalType: "address", name: "operator", type: "address" },
+ { internalType: "bool", name: "approved", type: "bool" },
+ ],
+ name: "setApprovalForAll",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [{ internalType: "string", name: "_baseTokenURI", type: "string" }],
+ name: "setBaseTokenURI",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ { internalType: "uint256", name: "tokenId", type: "uint256" },
+ { internalType: "string", name: "_tokenURI", type: "string" },
+ ],
+ name: "setTokenURI",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
+ name: "supportsInterface",
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "symbol",
+ outputs: [{ internalType: "string", name: "", type: "string" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
+ name: "tokenURI",
+ outputs: [{ internalType: "string", name: "", type: "string" }],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ { internalType: "address", name: "from", type: "address" },
+ { internalType: "address", name: "to", type: "address" },
+ { internalType: "uint256", name: "tokenId", type: "uint256" },
+ ],
+ name: "transferFrom",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
+ name: "transferOwnership",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+];
diff --git a/packages/nextjs/components/index/cta.js b/packages/nextjs/components/index/cta.js
index 7926c8c..1164b8e 100644
--- a/packages/nextjs/components/index/cta.js
+++ b/packages/nextjs/components/index/cta.js
@@ -1,7 +1,38 @@
-import React from "react";
+import React, { useState } from "react";
+import Image from "next/image";
+import { xocolatlABI } from "../xoc-dapp/abis/xocabis";
+import { xocPinABI } from "./abis/xocpin";
import Container from "./container";
+import { parseEther } from "viem";
+import { useContractWrite } from "wagmi";
+import { useAccount } from "wagmi";
const Cta = () => {
+ const [showCard, setShowCard] = useState(false);
+ const account = useAccount();
+
+ const handleButtonClick = () => {
+ setShowCard(true);
+ };
+
+ const handleCloseCard = () => {
+ setShowCard(false);
+ };
+
+ const { write: approve } = useContractWrite({
+ address: "0xa411c9Aa00E020e4f88Bc19996d29c5B7ADB4ACf",
+ abi: xocolatlABI,
+ functionName: "approve",
+ args: ["0x72fa57b14b83D165EACab4E2bB3B3B9D5B9C5A52", parseEther("100")],
+ });
+
+ const { write: mintNFT } = useContractWrite({
+ address: "0x72fa57b14b83D165EACab4E2bB3B3B9D5B9C5A52",
+ abi: xocPinABI,
+ functionName: "mint",
+ args: [account.address],
+ });
+
return (
@@ -12,16 +43,60 @@ const Cta = () => {
+ {showCard && (
+
+
+
+
+
+
+
+
Price to Mint
+
100 $XOC
+
First Come, First Served
+
+
+
NFTs Minted
+
4,200
+
↗︎ 400 (22%)
+
+
+
+
+
+
+
+
+
+
+
+ )}
);
};
diff --git a/packages/nextjs/components/index/hero.tsx b/packages/nextjs/components/index/hero.tsx
index a4a4d76..6b94e92 100644
--- a/packages/nextjs/components/index/hero.tsx
+++ b/packages/nextjs/components/index/hero.tsx
@@ -49,6 +49,7 @@ const Hero = () => {
}
}, [latestPriceData, ONE_HUNDRED_XOC]);
+
const { write: approve } = useContractWrite({
address: ADDR_LIB.polygon.weth.address,
abi: erc20ABI,
diff --git a/packages/nextjs/components/streams/FlowingBalance.tsx b/packages/nextjs/components/streams/FlowingBalance.tsx
new file mode 100644
index 0000000..552cf5d
--- /dev/null
+++ b/packages/nextjs/components/streams/FlowingBalance.tsx
@@ -0,0 +1,102 @@
+import React, { memo, useEffect, useMemo, useState } from "react";
+import { formatEther } from "viem";
+
+// Constants
+export const ANIMATION_MINIMUM_STEP_TIME = 40;
+
+// Utility functions
+export const absoluteValue = (n: bigint) => {
+ return n >= BigInt(0) ? n : -n;
+};
+
+export function toFixedUsingString(numStr: string, decimalPlaces: number): string {
+ const [wholePart, decimalPart] = numStr.split(".");
+
+ if (!decimalPart || decimalPart.length <= decimalPlaces) {
+ return numStr.padEnd(wholePart.length + 1 + decimalPlaces, "0");
+ }
+
+ const decimalPartBigInt = BigInt(
+ `${decimalPart.slice(0, decimalPlaces)}${decimalPart[decimalPlaces] >= "5" ? "1" : "0"}`,
+ );
+
+ return `${wholePart}.${decimalPartBigInt.toString().padStart(decimalPlaces, "0")}`;
+}
+
+// Hooks
+export const useSignificantFlowingDecimal = (flowRate: bigint, animationStepTimeInMs: number): number | undefined =>
+ useMemo(() => {
+ if (flowRate === BigInt(0)) {
+ return undefined;
+ }
+
+ const ticksPerSecond = 1000 / animationStepTimeInMs;
+ const flowRatePerTick = flowRate / BigInt(ticksPerSecond);
+
+ const [beforeEtherDecimal, afterEtherDecimal] = formatEther(flowRatePerTick).split(".");
+
+ const isFlowingInWholeNumbers = absoluteValue(BigInt(beforeEtherDecimal)) > BigInt(0);
+
+ if (isFlowingInWholeNumbers) {
+ return 0; // Flowing in whole numbers per tick.
+ }
+ const numberAfterDecimalWithoutLeadingZeroes = BigInt(afterEtherDecimal);
+
+ const lengthToFirstSignificantDecimal = afterEtherDecimal
+ .toString()
+ .replace(numberAfterDecimalWithoutLeadingZeroes.toString(), "").length; // We're basically counting the zeroes.
+
+ return Math.min(lengthToFirstSignificantDecimal + 2, 18); // Don't go over 18.
+ }, [flowRate, animationStepTimeInMs]);
+
+const useFlowingBalance = (startingBalance: bigint, startingBalanceDate: Date, flowRate: bigint) => {
+ const [flowingBalance, setFlowingBalance] = useState(startingBalance);
+
+ const startingBalanceTime = startingBalanceDate.getTime();
+ useEffect(() => {
+ if (flowRate === BigInt(0)) return;
+
+ let lastAnimationTimestamp = 0;
+
+ const animationStep = (currentAnimationTimestamp: number) => {
+ const animationFrameId = window.requestAnimationFrame(animationStep);
+ if (currentAnimationTimestamp - lastAnimationTimestamp > ANIMATION_MINIMUM_STEP_TIME) {
+ const elapsedTimeInMilliseconds = BigInt(Date.now() - startingBalanceTime);
+ const flowingBalance_ = startingBalance + (flowRate * elapsedTimeInMilliseconds) / BigInt(1000);
+
+ setFlowingBalance(flowingBalance_);
+
+ lastAnimationTimestamp = currentAnimationTimestamp;
+ }
+
+ return () => window.cancelAnimationFrame(animationFrameId);
+ };
+
+ const animationFrameId = window.requestAnimationFrame(animationStep);
+
+ return () => window.cancelAnimationFrame(animationFrameId);
+ }, [startingBalance, startingBalanceTime, flowRate]);
+
+ return flowingBalance;
+};
+
+// FlowingBalance Component
+const FlowingBalance: React.FC<{
+ startingBalance: bigint;
+ startingBalanceDate: Date;
+ flowRate: bigint;
+}> = memo(function FlowingBalance({ startingBalance, startingBalanceDate, flowRate }) {
+ const flowingBalance = useFlowingBalance(startingBalance, startingBalanceDate, flowRate);
+
+ const decimalPlaces = useSignificantFlowingDecimal(flowRate, ANIMATION_MINIMUM_STEP_TIME);
+
+ return (
+
+ {decimalPlaces !== undefined
+ ? toFixedUsingString(formatEther(flowingBalance), decimalPlaces)
+ : formatEther(flowingBalance)}
+
+ );
+});
+
+export default FlowingBalance;
diff --git a/packages/nextjs/components/streams/SuperTokens.tsx b/packages/nextjs/components/streams/SuperTokens.tsx
index bedc85a..c063ac8 100644
--- a/packages/nextjs/components/streams/SuperTokens.tsx
+++ b/packages/nextjs/components/streams/SuperTokens.tsx
@@ -38,7 +38,7 @@ const SupertokensComponent: React.FC = () => {
address: "0xcfA132E353cB4E398080B9700609bb008eceB125",
abi: CFAv1ForwarderABI,
functionName: "setFlowrate",
- args: ["0x36d9a149895d905D117C38F3090f4344B76Ec9F4", receiverAddress, BigInt(100)],
+ args: ["0x36d9a149895d905D117C38F3090f4344B76Ec9F4", receiverAddress, BigInt(100000000000000)],
});
const { write: deleteFlow } = useContractWrite({
@@ -50,70 +50,76 @@ const SupertokensComponent: React.FC = () => {
return (
<>
-
-
Approve Upgrade
- setApproveAmount(e.target.value)}
- />
-
-
-
-
Upgrade
- setUpgradeAmount(e.target.value)}
- />
-
-
-
-
Downgrade
- setDowngradeAmount(e.target.value)}
- />
-
-
-
-
Set Flowrate
- setReceiverAddress(e.target.value)}
- />
-
-
-
-
Delete Flowrate
-
setDeleteAddress(e.target.value)}
- />
-
+
>
);
diff --git a/packages/nextjs/components/xoc-dapp/Dashboard.tsx b/packages/nextjs/components/xoc-dapp/Dashboard.tsx
index 81df5a6..51a9d83 100644
--- a/packages/nextjs/components/xoc-dapp/Dashboard.tsx
+++ b/packages/nextjs/components/xoc-dapp/Dashboard.tsx
@@ -3,7 +3,6 @@ import { useState } from "react";
import AmountInput from "./AmountInput";
import CollateralInfo from "./CollateralInfo";
import PillNavigation from "./PillNavigation";
-import Swap from "./Swap";
import { houseOfCoinABI, houseOfReserveABI } from "./abis/xocabis";
import { parseEther } from "viem";
import { useContractWrite } from "wagmi";
@@ -110,7 +109,7 @@ const Dashboard: React.FC = () => {
/>
)}
- {selectedTab === "exchange" && }
+ {selectedTab === "exchange"}
{(depositError || depositLoading) &&
Hello!!!
}
{mintingError &&
Hello!!!
}
diff --git a/packages/nextjs/components/xoc-dapp/Swap/SwapButton.tsx b/packages/nextjs/components/xoc-dapp/Swap/SwapButton.tsx
deleted file mode 100644
index 519b1f3..0000000
--- a/packages/nextjs/components/xoc-dapp/Swap/SwapButton.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-import React from "react";
-import { GetBalances } from "./SwapInputBox";
-import { NUMBER_REGEX } from "./utils";
-import type { actionType } from "./utils";
-import { useConnectModal } from "@rainbow-me/rainbowkit";
-import { scroll } from "viem/chains";
-import { useAccount, useNetwork, useSwitchNetwork } from "wagmi";
-import { ArrowsRightLeftIcon } from "@heroicons/react/24/outline";
-
-type SwapButtonProps = {
- action: actionType;
- swap: () => void;
- isLoading: boolean;
- value: string;
-};
-
-const SwapButton: React.FC
= ({ action, swap, isLoading, value }) => {
- const { isConnected, isConnecting } = useAccount();
- const { chain: connectedChain } = useNetwork();
- const { switchNetwork } = useSwitchNetwork();
- const { openConnectModal } = useConnectModal();
- const { data: Balances } = GetBalances({ token: "All" });
- const inSufficientFunds =
- action === "Wrap" ? Balances.ethBalance < Number(value) : Balances.wethBalance < Number(value);
-
- return (
- <>
- {isConnected && connectedChain ? (
-
- ) : connectedChain && connectedChain?.id !== scroll.id ? (
-
- ) : (
-
- )}
- >
- );
-};
-
-export default SwapButton;
diff --git a/packages/nextjs/components/xoc-dapp/Swap/SwapFee.tsx b/packages/nextjs/components/xoc-dapp/Swap/SwapFee.tsx
deleted file mode 100644
index b3b4781..0000000
--- a/packages/nextjs/components/xoc-dapp/Swap/SwapFee.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import useIsMounted from "../../../hooks/scaffold-eth/isMounted";
-import { useFeeData } from "wagmi";
-
-function SwapFee() {
- const isMouted = useIsMounted();
- //fix hydration error
- const { data, isError, isLoading } = useFeeData({
- watch: true,
- });
-
- if (isMouted && isLoading) return ~$0.00;
- if (isMouted && isError) return Error fetching fee data
;
- // const gasPrice = Number(data?.formatted.gasPrice);
- if (isMouted && data)
- return (
- ~${Number(data?.formatted.gasPrice).toFixed(3)}
- );
-}
-
-export default SwapFee;
diff --git a/packages/nextjs/components/xoc-dapp/Swap/SwapInputBox.tsx b/packages/nextjs/components/xoc-dapp/Swap/SwapInputBox.tsx
deleted file mode 100644
index b0acb28..0000000
--- a/packages/nextjs/components/xoc-dapp/Swap/SwapInputBox.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-import React from "react";
-import Image from "next/image";
-import { InputBase } from "../../scaffold-eth/Input/InputBase";
-import { NUMBER_REGEX, stripWeth } from "./utils";
-import type { tokenType } from "./utils";
-import { useAccount } from "wagmi";
-import { useAccountBalance, useScaffoldContractRead } from "~~/hooks/scaffold-eth";
-import useIsMounted from "~~/hooks/scaffold-eth/isMounted";
-
-interface Props {
- isInput?: boolean;
- token: tokenType;
- value: string;
- setValue: (value: string) => void;
-}
-
-const SwapInputBox: React.FC = ({ isInput, token, value, setValue }) => {
- const ticker = token === "Ether" ? "ETH" : "WETH";
-
- const { jsx: Balance } = GetBalances({ token });
-
- return (
-
-
{token}
-
-
-
- {ticker}
-
-
setValue(value)}
- error={Boolean(value) && !NUMBER_REGEX.test(value)}
- disabled={!isInput}
- />
-
-
- Balance: {Balance}
-
-
- );
-};
-
-export default SwapInputBox;
-
-export function GetBalances({ token }: { token: tokenType }) {
- const { address } = useAccount();
- const isMounted = useIsMounted();
- const account = isMounted && address ? address : "";
- const { balance, isError, isLoading } = useAccountBalance(account);
- const {
- data,
- isError: isErrorWeth,
- isLoading: isLoadingWeth,
- } = useScaffoldContractRead({ contractName: "WETH9", functionName: "balanceOf", args: [account] });
-
- let jsxToRender = 0.00;
- let balanceData = { ethBalance: 0, wethBalance: 0 };
-
- if (token === "All")
- balanceData = {
- ethBalance: Number(balance?.toFixed(4) as string),
- wethBalance: stripWeth(data),
- };
- else if (token === "Wrapped Ether") {
- if (isLoadingWeth) jsxToRender = ;
- if (isErrorWeth) jsxToRender = Error;
- jsxToRender = {data !== undefined ? stripWeth(data) : "0"};
- } else {
- if (isLoading) jsxToRender = ;
- if (isError) jsxToRender = Error;
- jsxToRender = {balance ? balance.toFixed(4) : "0"};
- }
- return { jsx: jsxToRender, data: balanceData };
-}
diff --git a/packages/nextjs/components/xoc-dapp/Swap/index.tsx b/packages/nextjs/components/xoc-dapp/Swap/index.tsx
deleted file mode 100644
index 3323c97..0000000
--- a/packages/nextjs/components/xoc-dapp/Swap/index.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-import { useState } from "react";
-import Arrow from "../../../public/Arrow";
-import GasStation from "../../../public/GasStation";
-import SwapButton from "./SwapButton";
-import SwapFee from "./SwapFee";
-import SwapInputBox from "./SwapInputBox";
-import type { actionType } from "./utils";
-import { NUMBER_REGEX } from "./utils";
-import { parseEther } from "viem";
-import { useScaffoldContractWrite } from "~~/hooks/scaffold-eth";
-
-const Swap = () => {
- const [action, setAction] = useState("Wrap");
- const [value, setValue] = useState("");
-
- // Blockcalls
- const { writeAsync: depositETH, isLoading: isWrapping } = useScaffoldContractWrite({
- contractName: "WETH9",
- functionName: "deposit",
- value: NUMBER_REGEX.test(value) ? parseEther(value) : undefined,
- });
- const { writeAsync: withdrawETH, isLoading: isUnwrapping } = useScaffoldContractWrite({
- contractName: "WETH9",
- functionName: "withdraw",
- args: [NUMBER_REGEX.test(value) ? parseEther(value) : undefined],
- });
-
- return (
-
- {action}
-
-
-
setAction(action === "Wrap" ? "Unwrap" : "Wrap")}
- className="p-2 rounded-lg bg-secondary w-[35px] h-[35px] cursor-pointer border-[#243c5a] border-[3px] m-auto absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 transition-all duration-300 hover:rotate-180"
- />
-
-
-
-
-
-
-
- );
-};
-
-export default Swap;
diff --git a/packages/nextjs/components/xoc-dapp/Swap/utils.ts b/packages/nextjs/components/xoc-dapp/Swap/utils.ts
deleted file mode 100644
index 9599788..0000000
--- a/packages/nextjs/components/xoc-dapp/Swap/utils.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-//TYPES
-export type tokenType = "Ether" | "Wrapped Ether" | "All";
-export type actionType = "Wrap" | "Unwrap";
-
-// UTILS
-
-export const NUMBER_REGEX = /^\.?\d+\.?\d*$/;
-export const stripWeth = (token: bigint | undefined) => {
- let weth = 0;
- if (token !== undefined) {
- const _weth = Number(token) / 1e18;
- _weth === 0 ? (weth = 0) : (weth = _weth).toFixed(4);
- }
- return weth;
-};
diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts
index 008d4eb..d0f3e22 100644
--- a/packages/nextjs/contracts/deployedContracts.ts
+++ b/packages/nextjs/contracts/deployedContracts.ts
@@ -4,6 +4,1449 @@
*/
import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract";
-const deployedContracts = {} as const;
+const deployedContracts = {
+ 137: {
+ XocPin: {
+ address: "0x5f9e56c45b76917e71B7F3fDa61718Ab2C319e26",
+ abi: [
+ {
+ inputs: [
+ {
+ internalType: "string",
+ name: "_tokenURI",
+ type: "string",
+ },
+ ],
+ stateMutability: "nonpayable",
+ type: "constructor",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "target",
+ type: "address",
+ },
+ ],
+ name: "AddressEmptyCode",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "account",
+ type: "address",
+ },
+ ],
+ name: "AddressInsufficientBalance",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "sender",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ {
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ ],
+ name: "ERC721IncorrectOwner",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "operator",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "ERC721InsufficientApproval",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "approver",
+ type: "address",
+ },
+ ],
+ name: "ERC721InvalidApprover",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "operator",
+ type: "address",
+ },
+ ],
+ name: "ERC721InvalidOperator",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ ],
+ name: "ERC721InvalidOwner",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "receiver",
+ type: "address",
+ },
+ ],
+ name: "ERC721InvalidReceiver",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "sender",
+ type: "address",
+ },
+ ],
+ name: "ERC721InvalidSender",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "ERC721NonexistentToken",
+ type: "error",
+ },
+ {
+ inputs: [],
+ name: "FailedInnerCall",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ ],
+ name: "OwnableInvalidOwner",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "account",
+ type: "address",
+ },
+ ],
+ name: "OwnableUnauthorizedAccount",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "token",
+ type: "address",
+ },
+ ],
+ name: "SafeERC20FailedOperation",
+ type: "error",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "address",
+ name: "approved",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "Approval",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "address",
+ name: "operator",
+ type: "address",
+ },
+ {
+ indexed: false,
+ internalType: "bool",
+ name: "approved",
+ type: "bool",
+ },
+ ],
+ name: "ApprovalForAll",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: false,
+ internalType: "uint256",
+ name: "_fromTokenId",
+ type: "uint256",
+ },
+ {
+ indexed: false,
+ internalType: "uint256",
+ name: "_toTokenId",
+ type: "uint256",
+ },
+ ],
+ name: "BatchMetadataUpdate",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: false,
+ internalType: "uint256",
+ name: "_tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "MetadataUpdate",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: "address",
+ name: "previousOwner",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "address",
+ name: "newOwner",
+ type: "address",
+ },
+ ],
+ name: "OwnershipTransferred",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: "address",
+ name: "from",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "Transfer",
+ type: "event",
+ },
+ {
+ inputs: [],
+ name: "MINT_PRICE",
+ outputs: [
+ {
+ internalType: "uint256",
+ name: "",
+ type: "uint256",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "TREASURY",
+ outputs: [
+ {
+ internalType: "address",
+ name: "",
+ type: "address",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "XOCOLATL",
+ outputs: [
+ {
+ internalType: "address",
+ name: "",
+ type: "address",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "approve",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ ],
+ name: "balanceOf",
+ outputs: [
+ {
+ internalType: "uint256",
+ name: "",
+ type: "uint256",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "baseTokenURI",
+ outputs: [
+ {
+ internalType: "string",
+ name: "",
+ type: "string",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "getApproved",
+ outputs: [
+ {
+ internalType: "address",
+ name: "",
+ type: "address",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ {
+ internalType: "address",
+ name: "operator",
+ type: "address",
+ },
+ ],
+ name: "isApprovedForAll",
+ outputs: [
+ {
+ internalType: "bool",
+ name: "",
+ type: "bool",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ ],
+ name: "mint",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "name",
+ outputs: [
+ {
+ internalType: "string",
+ name: "",
+ type: "string",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "nextTokenId",
+ outputs: [
+ {
+ internalType: "uint256",
+ name: "",
+ type: "uint256",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "owner",
+ outputs: [
+ {
+ internalType: "address",
+ name: "",
+ type: "address",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "ownerOf",
+ outputs: [
+ {
+ internalType: "address",
+ name: "",
+ type: "address",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "renounceOwnership",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "from",
+ type: "address",
+ },
+ {
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "safeTransferFrom",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "from",
+ type: "address",
+ },
+ {
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ {
+ internalType: "bytes",
+ name: "data",
+ type: "bytes",
+ },
+ ],
+ name: "safeTransferFrom",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "operator",
+ type: "address",
+ },
+ {
+ internalType: "bool",
+ name: "approved",
+ type: "bool",
+ },
+ ],
+ name: "setApprovalForAll",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "string",
+ name: "_baseTokenURI",
+ type: "string",
+ },
+ ],
+ name: "setBaseTokenURI",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ {
+ internalType: "string",
+ name: "_tokenURI",
+ type: "string",
+ },
+ ],
+ name: "setTokenURI",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "bytes4",
+ name: "interfaceId",
+ type: "bytes4",
+ },
+ ],
+ name: "supportsInterface",
+ outputs: [
+ {
+ internalType: "bool",
+ name: "",
+ type: "bool",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "symbol",
+ outputs: [
+ {
+ internalType: "string",
+ name: "",
+ type: "string",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "tokenURI",
+ outputs: [
+ {
+ internalType: "string",
+ name: "",
+ type: "string",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "from",
+ type: "address",
+ },
+ {
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "transferFrom",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "newOwner",
+ type: "address",
+ },
+ ],
+ name: "transferOwnership",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ ],
+ inheritedFunctions: {
+ approve: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ balanceOf: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ getApproved: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ isApprovedForAll: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ name: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ ownerOf: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ safeTransferFrom: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ setApprovalForAll: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ supportsInterface: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ symbol: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ tokenURI: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ transferFrom: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ owner: "lib/openzeppelin-contracts/contracts/access/Ownable.sol",
+ renounceOwnership: "lib/openzeppelin-contracts/contracts/access/Ownable.sol",
+ transferOwnership: "lib/openzeppelin-contracts/contracts/access/Ownable.sol",
+ },
+ },
+ },
+ 31337: {
+ XocPin: {
+ address: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
+ abi: [
+ {
+ inputs: [
+ {
+ internalType: "string",
+ name: "_tokenURI",
+ type: "string",
+ },
+ ],
+ stateMutability: "nonpayable",
+ type: "constructor",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "target",
+ type: "address",
+ },
+ ],
+ name: "AddressEmptyCode",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "account",
+ type: "address",
+ },
+ ],
+ name: "AddressInsufficientBalance",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "sender",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ {
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ ],
+ name: "ERC721IncorrectOwner",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "operator",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "ERC721InsufficientApproval",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "approver",
+ type: "address",
+ },
+ ],
+ name: "ERC721InvalidApprover",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "operator",
+ type: "address",
+ },
+ ],
+ name: "ERC721InvalidOperator",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ ],
+ name: "ERC721InvalidOwner",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "receiver",
+ type: "address",
+ },
+ ],
+ name: "ERC721InvalidReceiver",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "sender",
+ type: "address",
+ },
+ ],
+ name: "ERC721InvalidSender",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "ERC721NonexistentToken",
+ type: "error",
+ },
+ {
+ inputs: [],
+ name: "FailedInnerCall",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ ],
+ name: "OwnableInvalidOwner",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "account",
+ type: "address",
+ },
+ ],
+ name: "OwnableUnauthorizedAccount",
+ type: "error",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "token",
+ type: "address",
+ },
+ ],
+ name: "SafeERC20FailedOperation",
+ type: "error",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "address",
+ name: "approved",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "Approval",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "address",
+ name: "operator",
+ type: "address",
+ },
+ {
+ indexed: false,
+ internalType: "bool",
+ name: "approved",
+ type: "bool",
+ },
+ ],
+ name: "ApprovalForAll",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: false,
+ internalType: "uint256",
+ name: "_fromTokenId",
+ type: "uint256",
+ },
+ {
+ indexed: false,
+ internalType: "uint256",
+ name: "_toTokenId",
+ type: "uint256",
+ },
+ ],
+ name: "BatchMetadataUpdate",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: false,
+ internalType: "uint256",
+ name: "_tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "MetadataUpdate",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: "address",
+ name: "previousOwner",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "address",
+ name: "newOwner",
+ type: "address",
+ },
+ ],
+ name: "OwnershipTransferred",
+ type: "event",
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: "address",
+ name: "from",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ {
+ indexed: true,
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "Transfer",
+ type: "event",
+ },
+ {
+ inputs: [],
+ name: "MINT_PRICE",
+ outputs: [
+ {
+ internalType: "uint256",
+ name: "",
+ type: "uint256",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "TREASURY",
+ outputs: [
+ {
+ internalType: "address",
+ name: "",
+ type: "address",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "XOCOLATL",
+ outputs: [
+ {
+ internalType: "address",
+ name: "",
+ type: "address",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "approve",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ ],
+ name: "balanceOf",
+ outputs: [
+ {
+ internalType: "uint256",
+ name: "",
+ type: "uint256",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "baseTokenURI",
+ outputs: [
+ {
+ internalType: "string",
+ name: "",
+ type: "string",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "getApproved",
+ outputs: [
+ {
+ internalType: "address",
+ name: "",
+ type: "address",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "owner",
+ type: "address",
+ },
+ {
+ internalType: "address",
+ name: "operator",
+ type: "address",
+ },
+ ],
+ name: "isApprovedForAll",
+ outputs: [
+ {
+ internalType: "bool",
+ name: "",
+ type: "bool",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ ],
+ name: "mint",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "name",
+ outputs: [
+ {
+ internalType: "string",
+ name: "",
+ type: "string",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "nextTokenId",
+ outputs: [
+ {
+ internalType: "uint256",
+ name: "",
+ type: "uint256",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "owner",
+ outputs: [
+ {
+ internalType: "address",
+ name: "",
+ type: "address",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "ownerOf",
+ outputs: [
+ {
+ internalType: "address",
+ name: "",
+ type: "address",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "renounceOwnership",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "from",
+ type: "address",
+ },
+ {
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "safeTransferFrom",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "from",
+ type: "address",
+ },
+ {
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ {
+ internalType: "bytes",
+ name: "data",
+ type: "bytes",
+ },
+ ],
+ name: "safeTransferFrom",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "operator",
+ type: "address",
+ },
+ {
+ internalType: "bool",
+ name: "approved",
+ type: "bool",
+ },
+ ],
+ name: "setApprovalForAll",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "string",
+ name: "_baseTokenURI",
+ type: "string",
+ },
+ ],
+ name: "setBaseTokenURI",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ {
+ internalType: "string",
+ name: "_tokenURI",
+ type: "string",
+ },
+ ],
+ name: "setTokenURI",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "bytes4",
+ name: "interfaceId",
+ type: "bytes4",
+ },
+ ],
+ name: "supportsInterface",
+ outputs: [
+ {
+ internalType: "bool",
+ name: "",
+ type: "bool",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [],
+ name: "symbol",
+ outputs: [
+ {
+ internalType: "string",
+ name: "",
+ type: "string",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "tokenURI",
+ outputs: [
+ {
+ internalType: "string",
+ name: "",
+ type: "string",
+ },
+ ],
+ stateMutability: "view",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "from",
+ type: "address",
+ },
+ {
+ internalType: "address",
+ name: "to",
+ type: "address",
+ },
+ {
+ internalType: "uint256",
+ name: "tokenId",
+ type: "uint256",
+ },
+ ],
+ name: "transferFrom",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ {
+ inputs: [
+ {
+ internalType: "address",
+ name: "newOwner",
+ type: "address",
+ },
+ ],
+ name: "transferOwnership",
+ outputs: [],
+ stateMutability: "nonpayable",
+ type: "function",
+ },
+ ],
+ inheritedFunctions: {
+ approve: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ balanceOf: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ getApproved: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ isApprovedForAll: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ name: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ ownerOf: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ safeTransferFrom: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ setApprovalForAll: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ supportsInterface: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ symbol: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ tokenURI: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ transferFrom: "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol",
+ owner: "lib/openzeppelin-contracts/contracts/access/Ownable.sol",
+ renounceOwnership: "lib/openzeppelin-contracts/contracts/access/Ownable.sol",
+ transferOwnership: "lib/openzeppelin-contracts/contracts/access/Ownable.sol",
+ },
+ },
+ },
+} as const;
export default deployedContracts satisfies GenericContractsDeclaration;
diff --git a/packages/nextjs/pages/streams.tsx b/packages/nextjs/pages/streams.tsx
index cf29660..f25d762 100644
--- a/packages/nextjs/pages/streams.tsx
+++ b/packages/nextjs/pages/streams.tsx
@@ -1,12 +1,47 @@
import { MetaHeader } from "../components/MetaHeader";
import type { NextPage } from "next";
+import { useContractRead } from "wagmi";
+import { useAccount } from "wagmi";
+import FlowingBalance from "~~/components/streams/FlowingBalance";
import SuperTokens from "~~/components/streams/SuperTokens";
+import { CFAv1ForwarderABI } from "~~/components/streams/abis/CFAv1Forwarder";
+import { SuperTokenABI } from "~~/components/streams/abis/SuperTokenABI";
const Streams: NextPage = () => {
+ const account = useAccount();
+
+ const { data: balanceOf } = useContractRead({
+ address: "0x36d9a149895d905D117C38F3090f4344B76Ec9F4",
+ abi: SuperTokenABI,
+ functionName: "balanceOf",
+ args: [account.address],
+ });
+
+ console.log(balanceOf);
+
+ const { data: getAccountFlowrate } = useContractRead({
+ address: "0xcfA132E353cB4E398080B9700609bb008eceB125",
+ abi: CFAv1ForwarderABI,
+ functionName: "getAccountFlowrate",
+ args: ["0x36d9a149895d905D117C38F3090f4344B76Ec9F4", account.address],
+ });
+
return (
<>
-
+
>
);
};