-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from subsquid/develop
release
- Loading branch information
Showing
12 changed files
with
757 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { addressFormatter } from '@lib/formatters/formatters'; | ||
import { Box, Stack, styled, Typography } from '@mui/material'; | ||
|
||
import { Avatar } from '@components/Avatar'; | ||
import { CopyToClipboard } from '@components/CopyToClipboard'; | ||
|
||
const Name = styled(Box, { | ||
name: 'Name', | ||
})(({ theme }) => ({ | ||
marginBottom: theme.spacing(0.25), | ||
whiteSpace: 'nowrap', | ||
})); | ||
|
||
export function SourceWalletName({ source }: { source: { id: string } }) { | ||
return ( | ||
<Stack direction="row" spacing={2} alignItems="center"> | ||
<Avatar name={source.id.slice(2)} colorDiscriminator={source.id} /> | ||
<Box> | ||
<Name>Contract</Name> | ||
<Typography variant="caption"> | ||
<CopyToClipboard text={source.id} content={addressFormatter(source.id, true)} /> | ||
</Typography> | ||
</Box> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { Warning } from '@mui/icons-material'; | ||
import { Alert, Box, TableBody, TableCell, TableHead, TableRow, Typography } from '@mui/material'; | ||
import { Outlet } from 'react-router-dom'; | ||
|
||
import { useSourcesQuery, useSquid } from '@api/subsquid-network-squid'; | ||
import SquaredChip from '@components/Chip/SquaredChip'; | ||
import { DashboardTable, NoItems } from '@components/Table'; | ||
import { CenteredPageWrapper } from '@layouts/NetworkLayout'; | ||
import { ConnectedWalletRequired } from '@network/ConnectedWalletRequired'; | ||
import { useAccount } from '@network/useAccount'; | ||
import { useContracts } from '@network/useContracts'; | ||
|
||
import { SourceWalletName } from './BuyBackName'; | ||
import { DepositButton } from './DepositButton'; | ||
|
||
export function OtcContracts() { | ||
const account = useAccount(); | ||
const squid = useSquid(); | ||
|
||
const { data: sourcesQuery, isLoading: isSourcesQueryLoading } = useSourcesQuery(squid, { | ||
address: account.address as `0x${string}`, | ||
}); | ||
const { BUYBACK } = useContracts(); | ||
|
||
const BUYBACKs = [BUYBACK]; | ||
const sources = sourcesQuery?.accounts; | ||
|
||
const isLoading = isSourcesQueryLoading; | ||
|
||
return ( | ||
<DashboardTable loading={isLoading} title={<SquaredChip label="Buyback" color="primary" />}> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>Contract</TableCell> | ||
<TableCell></TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{BUYBACKs.length ? ( | ||
<> | ||
{BUYBACKs.map(address => { | ||
return ( | ||
<TableRow key={address}> | ||
<TableCell> | ||
<SourceWalletName source={{ id: address }} /> | ||
</TableCell> | ||
<TableCell> | ||
<Box display="flex" justifyContent="flex-end"> | ||
<DepositButton address={address} sources={sources} /> | ||
</Box> | ||
</TableCell> | ||
</TableRow> | ||
); | ||
})} | ||
</> | ||
) : ( | ||
<NoItems> | ||
<span>No vesting was found</span> | ||
</NoItems> | ||
)} | ||
</TableBody> | ||
</DashboardTable> | ||
); | ||
} | ||
|
||
export function BuyBacksPage() { | ||
return ( | ||
<CenteredPageWrapper className="wide"> | ||
<ConnectedWalletRequired> | ||
<Alert sx={{ mb: 2 }} color="warning" icon={<Warning color="warning" />}> | ||
<Typography> | ||
This is the official Subsquid Labs buyback page. ⚠️Attention: Please only deposit the | ||
contractually agreed amount of SQD Tokens. Deposited SQD cannot be refunded. For | ||
questions, please reach out to [email protected] | ||
</Typography> | ||
</Alert> | ||
<OtcContracts /> | ||
</ConnectedWalletRequired> | ||
<Outlet /> | ||
</CenteredPageWrapper> | ||
); | ||
} |
Oops, something went wrong.