-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo-2.tsx
50 lines (39 loc) · 1.44 KB
/
demo-2.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import type { NextPage } from 'next'
import Nav from '../components/Nav'
import Heading from '../components/Heading'
import DaiBox from '../components/DaiBox'
import CdaiBox from '../components/CdaiBox'
import Footer from '../components/Footer'
import AuthorizeCompoundOverlay from '../components/AuthorizeCompoundOverlay'
import useCdaiAllowance from '../hooks/useCdaiAllowance'
import useDaiBalance from '../hooks/useDaiBalance'
import useCdaiUnderlyingBalance from '../hooks/useCdaiUnderlyingBalance'
import styles from '../styles/Home.module.css'
/**
* Paso 2: consultar si compound tiene autorización para acceder a los fondos del usuario
*/
const Home: NextPage = () => {
const address = '0xD2e2B135BCA466271069c394f655e0c70535C2dd'
const daiBalance = useDaiBalance(address)
const cdaiBalance = useCdaiUnderlyingBalance(address)
const cdaiAllowance = useCdaiAllowance(address)
return (
<div>
<Nav address={address} />
<main className={styles.main}>
<Heading />
<div className={styles.content}>
<DaiBox balance={daiBalance.formatted} isLoading={daiBalance.isLoading} />
< >
<CdaiBox balance={cdaiBalance.formatted} isLoading={cdaiBalance.isLoading} />
{!cdaiAllowance.isAuthorized && <AuthorizeCompoundOverlay isLoading={cdaiAllowance.isLoading} />}
</div>
</main>
<Footer />
</div>
)
}
/**
* Exports
*/
export default Home