Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions web/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ export default function Footer() {
web
</a>
]
[
<a
href="https://docs.google.com/forms/d/e/1FAIpQLSfrDO-K8bSsSs36-tP9mv9kTr8wj08WGU6eL_h6c_-a9liKDg/viewform"
target="_blank"
rel="noopener noreferrer"
>
contact support
</a>
]
</footer>
);
}
4 changes: 2 additions & 2 deletions web/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default function Header() {
<div className={styles.container}>
<div className="d-flex w100 justify-content-center align-items-center pb-2">
<Image
src="/daosmb.png"
alt="smb and monkeDAO logo"
src="/balloon.png"
alt="Balloonsville 2.0 logo"
width="400px"
height="90.5px"
/>
Expand Down
24 changes: 12 additions & 12 deletions web/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const App: FC<AppProps> = ({ Component, pageProps }) => {
const network = WalletAdapterNetwork.Mainnet;

// You can also provide a custom RPC endpoint
const endpoint = 'https://twilight-young-forest.solana-mainnet.quiknode.pro/54d70411d028158bdff6f66991476e66296d3cbe/'; //useMemo(() => clusterApiUrl(network), [network]);
const endpoint = 'https://sparkling-falling-wave.solana-mainnet.quiknode.pro/1e6d18e31964c5d7d01164756e1afebf6d38fe59/'; //useMemo(() => clusterApiUrl(network), [network]);

// @solana/wallet-adapter-wallets includes all the adapters but supports tree shaking and lazy loading --
// Only the wallets you configure here will be compiled into your application, and only the dependencies
Expand All @@ -50,21 +50,21 @@ const App: FC<AppProps> = ({ Component, pageProps }) => {
return (
<>
<Head>
<title>MonkeDAO x SMB | Vote</title>
<meta name="description" content="MonkeDAO x SMB | Vote" />
<title>Balloonsville | Vote</title>
<meta name="description" content="Balloonsville | Vote" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
<div className="container py-3">
<ConnectionProvider endpoint={endpoint}>
<WalletProvider wallets={wallets} autoConnect>
<WalletModalProvider>
<Layout>
<Component {...pageProps} />
</Layout>
</WalletModalProvider>
</WalletProvider>
</ConnectionProvider>
<ConnectionProvider endpoint={endpoint}>
<WalletProvider wallets={wallets} autoConnect>
<WalletModalProvider>
<Layout>
<Component {...pageProps} />
</Layout>
</WalletModalProvider>
</WalletProvider>
</ConnectionProvider>
</div>
</>
);
Expand Down
25 changes: 11 additions & 14 deletions web/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {

const VoteProgramAddressPubKey = new PublicKey(VOTE_PROGRAM_ADDRESS);

const NFT_CREATOR_ADDRESS = '9uBX3ASjxWvNBAD1xjbVaKA74mWGZys3RGSF7DdeDD3F';
const NFT_CREATOR_ADDRESS = 'E595MwLgTJapMQjcnsQ4bARCVF2wBMxhWb8YPciyHKaz';

const Home: NextPage = () => {
const { connection } = useConnection();
Expand Down Expand Up @@ -180,18 +180,13 @@ const Home: NextPage = () => {
Proposal #{proposalId}
</span>
</h5>
<h4 className="my-0 fw-normal">
{proposal.info.prompt}{' '}
{Number(proposal.id) === 1
? 'If this vote passes with 66% supporting, Votes 2-4 are all considered void.'
: ''}
</h4>
<h4 className="my-0 fw-normal">{proposal.info.prompt}</h4>
</div>
<div className="card-body">
<div className="row">
<div className="col-sm-6">
<h3 className="card-title">
{totalVotes} / {proposal.info.totalVotesAvailable}
{totalVotes} / 5000
<small className="text-muted fw-light"> votes</small>
</h3>
<div className="progress">
Expand Down Expand Up @@ -237,10 +232,12 @@ const Home: NextPage = () => {
'E MM/dd/yyyy'
)}{' '}
-{' '}
{format(
new Date(proposal.info?.proposalEndDate),
'E MM/dd/yyyy'
)}
{proposal.info?.proposalEndDate
? format(
new Date(proposal.info?.proposalEndDate),
'E MM/dd/yyyy'
)
: ''}
</span>

<Link href={`/proposal/${proposalId}`} passHref>
Expand All @@ -264,8 +261,8 @@ const Home: NextPage = () => {
Vote for proposals put forth by a DAO on-chain by connecting your
wallet.
<br />
This is currently being used by MonkeDAO. Each SMB can vote once for
a proposal, if you buy an SMB that has already voted on a particular
Use your Balloonsville 2.0 NFT to vote on the future of the project,
if you buy a Balloon that has already voted on a particular
proposal, you CANNOT vote again using it.
</p>
</div>
Expand Down
87 changes: 42 additions & 45 deletions web/pages/proposal/[proposalId].tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { NextPage } from 'next';
import Head from 'next/head';
import Image from 'next/image';
import Link from 'next/link';

import Base58 from 'bs58';
Expand All @@ -10,7 +9,7 @@ import { useCallback, useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import { useConnection, useWallet } from '@solana/wallet-adapter-react';
import { Transaction, TransactionInstruction } from '@solana/web3.js';
import { PublicKey, sendAndConfirmRawTransaction } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
import { Snackbar } from '@material-ui/core';
import Alert from '@material-ui/lab/Alert';
import { format } from 'date-fns';
Expand All @@ -32,15 +31,13 @@ import {
VoteOption,
VoteOptionWithResult,
} from '../../types';
import { arrayBuffer } from 'stream/consumers';
import { debug } from 'console';

const VoteProgramAddressPubKey = new PublicKey(VOTE_PROGRAM_ADDRESS);
const MetaplexMetadataProgramAddressPubKey = new PublicKey(
METAPLEX_METADATA_PROGRAM_ADDRESS
);

const NFT_CREATOR_ADDRESS = '9uBX3ASjxWvNBAD1xjbVaKA74mWGZys3RGSF7DdeDD3F';
const NFT_CREATOR_ADDRESS = 'E595MwLgTJapMQjcnsQ4bARCVF2wBMxhWb8YPciyHKaz';
const CreatorAddressPublicKey = new PublicKey(NFT_CREATOR_ADDRESS);

const renderer = (callback: () => void) => {
Expand Down Expand Up @@ -138,7 +135,7 @@ const Home: NextPage = () => {
info: proposalInfo!,
url,
});
} catch (e) { }
} catch (e) {}

setIsLoadingProposal(false);
}
Expand Down Expand Up @@ -169,9 +166,9 @@ const Home: NextPage = () => {
time = new Date(
new BN(
e.account.data[104] +
(e.account.data[105] << 8) +
(e.account.data[106] << 16) +
(e.account.data[107] << 24)
(e.account.data[105] << 8) +
(e.account.data[106] << 16) +
(e.account.data[107] << 24)
).toNumber() * 1000
),
vote_option = new BN(e.account.data.slice(108), 10, 'le').toString();
Expand Down Expand Up @@ -232,10 +229,10 @@ const Home: NextPage = () => {
const sys_key = new PublicKey('11111111111111111111111111111111');

let account_0 = {
pubkey: publicKey,
isSigner: true,
isWritable: true,
},
pubkey: publicKey,
isSigner: true,
isWritable: true,
},
account_1 = {
pubkey: mintTokenId,
isSigner: false,
Expand Down Expand Up @@ -289,25 +286,30 @@ const Home: NextPage = () => {
transaction.feePayer = publicKey;
transactionArr.push(transaction);
}
let errorMessage: any = "";
let errorMessage: any = '';
if (signAllTransactions) {
try {
const txns = await signAllTransactions(transactionArr);
const sendPromises = txns.map(txn => connection.sendRawTransaction(txn.serialize(), { skipPreflight: true, maxRetries: 100 }));
const sendPromises = txns.map((txn) =>
connection.sendRawTransaction(txn.serialize(), {
skipPreflight: true,
maxRetries: 100,
})
);
const result = await Promise.all(sendPromises);

const confirmPromises = result.map(tx => connection.confirmTransaction(tx, 'finalized'));

const confirmPromises = result.map((tx) =>
connection.confirmTransaction(tx, 'finalized')
);
const confirmResult = await Promise.all(confirmPromises);
console.log(confirmResult);
console.log(result);
}
catch (err: any) {
} catch (err: any) {
console.error(err);
errorMessage = err;
setVotingActionInProgress(false);
}
}
else {
} else {
for (let transaction of transactionArr) {
try {
const signature = await sendTransaction(transaction, connection, {
Expand All @@ -317,7 +319,6 @@ const Home: NextPage = () => {
signature,
'finalized'
);

} catch (e: any) {
const logs = e?.logs;
let error = 'Unknown error occurred.';
Expand All @@ -333,14 +334,13 @@ const Home: NextPage = () => {

setVotingActionInProgress(false);
setSelectedNFTMintAddress([]);
if (errorMessage !== "") {
if (errorMessage !== '') {
setAlertState({
open: true,
message: 'Your vote failed :( Please try again!',
severity: 'error',
});
}
else {
} else {
setAlertState({
open: true,
message: 'Congratulations! Your vote was recorded.',
Expand Down Expand Up @@ -408,10 +408,10 @@ const Home: NextPage = () => {
return <span>Invalid Proposal Id</span>;
}

const disableVoting = true;
// isVotingActionInProgress ||
// selectedNFTMintAddress.length === 0 ||
// !isVoteAllowed;
const disableVoting = proposalId !== 1 &&
(isVotingActionInProgress ||
selectedNFTMintAddress.length === 0 ||
!isVoteAllowed);

const renderVoteData = (votes: any, proposalInfo?: ProposalInfo) => {
if (!proposalInfo) {
Expand All @@ -432,15 +432,15 @@ const Home: NextPage = () => {
);

const totalVotePercentage =
Number(votes.length / proposalInfo.totalVotesAvailable) * 100;
Number(votes.length / 5000) * 100;
const totalVotePercentageLabel =
totalVotePercentage < 1 ? '<1%' : `${totalVotePercentage.toFixed(0)}%`;

return (
<div className="row">
<div className="col-sm-6">
<h3 className="card-title">
{votes.length} / {proposalInfo.totalVotesAvailable}
{votes.length} / 5,000
<small className="text-muted fw-light"> votes</small>
</h3>
<div className="progress">
Expand Down Expand Up @@ -500,12 +500,7 @@ const Home: NextPage = () => {
</span>
</h4>
</div>
<h3 className="mb-0">
{proposalInfo?.prompt || 'Unable to load'}{' '}
{proposalId === 1
? 'If this vote passes with 66% supporting, Votes 2-4 are all considered void.'
: ''}
</h3>
<h3 className="mb-0">{proposalInfo?.prompt || 'Unable to load'}</h3>
<div className="mb-1 text-muted">
{proposalInfo ? (
<div className="badge bg-light text-dark mt-2 p-2">
Expand All @@ -524,13 +519,15 @@ const Home: NextPage = () => {
<div className="d-flex justify-content-end">
<p className="fw-bold">
<span>End Date: </span>
{format(
new Date(proposalInfo?.proposalEndDate),
'E MM/dd/yyyy'
)}
{proposalInfo?.proposalEndDate
? format(
new Date(proposalInfo?.proposalEndDate),
'E MM/dd/yyyy'
)
: ''}
</p>
</div>
<div className="d-flex justify-content-end pt-2">
{/* <div className="d-flex justify-content-end pt-2">
<Link href={proposalInfo.documentProposalUri} passHref>
<a
rel="noopener noreferrer"
Expand All @@ -547,7 +544,7 @@ const Home: NextPage = () => {
width="32px"
alt="arweave"
/>
</div>
</div> */}
</div>
</div>
</div>
Expand Down Expand Up @@ -611,8 +608,8 @@ const Home: NextPage = () => {
return (
<div className={styles.container}>
<Head>
<title>MonkeDAO x SMB | Vote Proposal {proposalId}</title>
<meta name="description" content="MonkeDAO x SMB | Vote" />
<title>Balloonsville | Vote Proposal {proposalId}</title>
<meta name="description" content="Balloonsville | Vote" />
</Head>

<main className={styles.main}>
Expand Down
Binary file added web/public/balloon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion web/styles/Home.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}

.code {
background: #fafafa;
background: #d5cfcb;
border-radius: 5px;
padding: 0.75rem;
font-size: 1.1rem;
Expand Down
8 changes: 4 additions & 4 deletions web/styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ body {
padding: 0;
margin: 0;
font-family: 'Open Sans', sans-serif !important;
background-color: #fef6d8 !important;
background-color: #d5cfcb !important;
}

a {
Expand All @@ -19,11 +19,11 @@ a {
}

.wallet-adapter-button {
background-color: #f4be00 !important;
color: black !important;
background-color: #1b1c40 !important;
color: white !important;
}

$primary: #f4be00;
$primary: #1b1c40;
$danger: #fef6d8;
$light: #f3f3f3;

Expand Down
2 changes: 1 addition & 1 deletion web/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type ProposalInfo = {
totalVotesAvailable: number;
voteOptions: Array<VoteOption>;
proposalDate: string;
proposalEndDate: string;
proposalEndDate?: string;
};

export type Proposal = {
Expand Down
Loading