diff --git a/public/favicon.ico b/public/favicon.ico
index 718d6fe..7cac1d1 100644
Binary files a/public/favicon.ico and b/public/favicon.ico differ
diff --git a/src/assets/logo.png b/src/assets/logo.png
deleted file mode 100644
index efe5767..0000000
Binary files a/src/assets/logo.png and /dev/null differ
diff --git a/src/components/AppConfig.tsx b/src/components/AppConfig.tsx
index 1c26e57..7f5ea1c 100644
--- a/src/components/AppConfig.tsx
+++ b/src/components/AppConfig.tsx
@@ -7,12 +7,12 @@ import { infuraProvider } from 'wagmi/providers/infura'
import { publicProvider } from 'wagmi/providers/public'
const { chains, provider } = configureChains(
- [chain.goerli],
+ [chain.goerli, chain.polygonMumbai],
[infuraProvider({ apiKey: INFURA_ID }), publicProvider()]
)
const { connectors } = getDefaultWallets({
- appName: 'My RainbowKit App',
+ appName: 'Allyu',
chains
})
diff --git a/src/components/Logo.tsx b/src/components/Logo.tsx
new file mode 100644
index 0000000..75a39ca
--- /dev/null
+++ b/src/components/Logo.tsx
@@ -0,0 +1,1022 @@
+export default function Logo(props: { className?: string }) {
+ return (
+
+ )
+}
diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx
index 38f5d8c..c00b3fc 100644
--- a/src/components/Navbar.tsx
+++ b/src/components/Navbar.tsx
@@ -1,7 +1,7 @@
import { ConnectButton } from '@rainbow-me/rainbowkit'
-import logo from 'assets/logo.png'
import Image from 'next/image'
import Link from 'next/link'
+import Logo from './Logo'
export default function Navbar() {
return (
@@ -10,8 +10,8 @@ export default function Navbar() {
-
- ALLYU
+
+ ALLYU
diff --git a/src/components/bill/FundModal.tsx b/src/components/bill/FundModal.tsx
index 22d3c5e..e140710 100644
--- a/src/components/bill/FundModal.tsx
+++ b/src/components/bill/FundModal.tsx
@@ -59,6 +59,10 @@ export default function FundModal({
const codeHash = `0x${hash(code)}`
const balance = await dai.balanceOf(address)
+ if (balance.lt(bill.value)) {
+ throw new Error('Insufficient funds inDai')
+ }
+
const daiRes = await dai.approve(allyu.address, balance)
await daiRes.wait()
@@ -71,8 +75,10 @@ export default function FundModal({
maxFeePerGas: maxFeePerGas?.add(1000000000),
maxPriorityFeePerGas: maxPriorityFeePerGas?.add(1000000000)
})
+
const transaction = await res.wait()
setTransaction(transaction)
+
setBill({ ...bill, isFunded: true })
setIsSuccess(true)
if (containerRef.current) {
diff --git a/src/components/request/Step2.tsx b/src/components/request/Step2.tsx
index 18e548e..e2a151c 100644
--- a/src/components/request/Step2.tsx
+++ b/src/components/request/Step2.tsx
@@ -27,7 +27,7 @@ export default function Step2(props: RequestProps) {
diff --git a/src/components/ui/Loading.tsx b/src/components/ui/Loading.tsx
index 5ca87a7..e617ceb 100644
--- a/src/components/ui/Loading.tsx
+++ b/src/components/ui/Loading.tsx
@@ -1,3 +1,10 @@
+import Logo from 'components/Logo'
+
export default function Loading() {
- return
;
+ return (
+
+ )
}
diff --git a/src/eth-sdk/config.ts b/src/eth-sdk/config.ts
index 7692cb7..7dcb289 100644
--- a/src/eth-sdk/config.ts
+++ b/src/eth-sdk/config.ts
@@ -4,7 +4,11 @@ export default defineConfig({
contracts: {
goerli: {
dai: '0x11fE4B6AE13d2a6055C8D9cF65c55bac32B5d844',
- allyu: '0xDd803437C05E6B7463a5889249Bd1f8687bD1CB8'
+ allyu: '0xdAb87c1670972D389e625dcb9f8813dC5AB30bE5'
+ },
+ polygonMumbai: {
+ dai: '0x001B3B4d0F3714Ca98ba10F6042DaEbF0B1B7b6F',
+ allyu: '0x12c2c185f8B14006aadE9f8914508C49CE019A84'
}
}
})
diff --git a/src/pages/404.tsx b/src/pages/404.tsx
index 199f745..08259de 100644
--- a/src/pages/404.tsx
+++ b/src/pages/404.tsx
@@ -12,9 +12,9 @@ const NotFound: NextPage = () => {
-
+
404
-
Page not found
+
Page not found
diff --git a/src/pages/500.tsx b/src/pages/500.tsx
index 51f4343..8a28e9e 100644
--- a/src/pages/500.tsx
+++ b/src/pages/500.tsx
@@ -12,7 +12,7 @@ const InternalError: NextPage = () => {
-
+
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index c695d39..b6acba4 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -1,7 +1,24 @@
import type { NextPage } from 'next'
import Head from 'next/head'
+import Image from 'next/image'
+import { useEffect, useState } from 'react'
+import { BillValue } from 'types/types'
+import { getBillImage } from 'utils/images'
+import { formatNumber } from 'utils/number'
const Home: NextPage = () => {
+ const [count, setCount] = useState(12089654)
+
+ useEffect(() => {
+ const interval = setInterval(() => {
+ if (Math.random() > 0.35) {
+ setCount((prev) => prev + 1)
+ }
+ }, 1000)
+
+ return () => clearInterval(interval)
+ }, [])
+
return (
<>
@@ -10,9 +27,70 @@ const Home: NextPage = () => {
-
+
+
+
+
${formatNumber(count)}
+ in crypto-backed cash
+
+
+
+
>
)
}
+const BillsGrid = ({ count }: { count: number }) => {
+ const [randomBills, setRandomBills] = useState
([])
+ const rows = 6
+ const columns = 6
+ const positions = ['2', '4', '6', '8', '10', '4']
+
+ const billValues = [
+ BillValue.Five,
+ BillValue.Ten,
+ BillValue.Twenty,
+ BillValue.Fifty,
+ BillValue.OneHundred,
+ BillValue.FiveHundred
+ ]
+
+ const generateRandomBills = () => {
+ const bills = []
+ for (let i = 0; i < rows; i++) {
+ const col = []
+
+ for (let j = 0; j < columns; j++) {
+ const randomIndex = Math.floor(Math.random() * billValues.length)
+ const bill = billValues[randomIndex]
+ col.push(bill)
+ }
+
+ bills.push(col)
+ }
+
+ setRandomBills(bills)
+ }
+
+ useEffect(() => {
+ generateRandomBills()
+ }, [])
+
+ return (
+
+ {randomBills.map((row, i) => (
+
+
+ {row.map((col, j) => (
+
+ {}
+
+ ))}
+
+
+ ))}
+
+ )
+}
+
export default Home
diff --git a/src/utils/number.ts b/src/utils/number.ts
index f7401e2..d2e1372 100644
--- a/src/utils/number.ts
+++ b/src/utils/number.ts
@@ -10,3 +10,9 @@ export function isValidAmount(amount: BigNumberish | undefined): boolean {
return false
}
}
+
+export function formatNumber(amount: BigNumberish): string {
+ return BigNumber.from(amount)
+ .toString()
+ .replace(/\B(?=(\d{3})+(?!\d))/g, ',')
+}