Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge gov branch into development #165

Merged
merged 109 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
e9a7c6c
Initial commit for governance
codemaster115 May 11, 2022
4774b2f
Fix parser error
codemaster115 May 11, 2022
5d5d669
Update programs
codemaster115 May 13, 2022
460d75c
Add proposal view page
codemaster115 May 14, 2022
0b8acdb
Upgrade locker program
codemaster115 May 17, 2022
b1b793e
Fix build error
codemaster115 May 17, 2022
f68b227
Fix build error
codemaster115 May 17, 2022
2c49d10
feat(farm): add stake/unstake using `sendAll` (#112)
solberenson May 13, 2022
ebbef8a
feat: increase transaction timeout to 120s (#131)
solberenson May 13, 2022
e952cd8
update timeout to 180s (testing)
BowTiedHeron May 14, 2022
bf438b0
feat(farm): add stake vault button (#132)
solberenson May 15, 2022
6bbb8d7
fix(farms): Upgraded farms to new gem farm version and added a staked…
BowTiedHeron Apr 30, 2022
ceeb44b
KK farm init
tomjpandolfi May 13, 2022
894a868
new line eof new-farm.tsx
tomjpandolfi May 13, 2022
a2e7565
fix(farm): update "Your Vault" state on stake/unstake (#133)
solberenson May 16, 2022
4437894
update timeout to 5min (testing)
BowTiedHeron May 16, 2022
8cca024
feat: add google analytics 4
gonwi May 16, 2022
4fa9481
feat: add google analytics 4 (#139)
gonwi May 16, 2022
24812e3
fix(farm): update "Stake Vault" visibility on stake (#135)
solberenson May 16, 2022
d5c031a
Initial commit for governance
codemaster115 May 11, 2022
1d1db1f
Upgrade locker program
codemaster115 May 17, 2022
a3a8f9d
Fix conflict
codemaster115 May 17, 2022
204a6c0
Replace proposal prefix
codemaster115 May 17, 2022
8de1547
test vercel
BowTiedHeron May 17, 2022
12b8046
Update tribeca sdk
codemaster115 May 18, 2022
474ea1d
Merge branch 'gov' of github.com:honey-labs/honey-frontend into gov
codemaster115 May 18, 2022
c2a2bce
Fix build error
codemaster115 May 19, 2022
7c05d26
change vote card color
codemaster115 May 19, 2022
ec08a8e
Fix minor issues, change styling
codemaster115 May 19, 2022
3a02a8e
Update token supply value
codemaster115 May 19, 2022
2fe56fc
Fix build error
codemaster115 May 20, 2022
6d255de
Fix styling
codemaster115 May 23, 2022
5efdf0b
Initial commit for governance
codemaster115 May 11, 2022
4267b2c
Fix parser error
codemaster115 May 11, 2022
f811033
Update programs
codemaster115 May 13, 2022
863b08f
Add proposal view page
codemaster115 May 14, 2022
802c7e8
solved merge conflicts with dev (2)
codemaster115 May 17, 2022
b1d8cc0
Fix build error
codemaster115 May 17, 2022
e10da89
Fix build error
codemaster115 May 17, 2022
7d10a98
merge conflicts with dev 3
BowTiedHeron Apr 30, 2022
dc088ed
conflicts 4
gonwi May 16, 2022
e0b5c15
feat: add google analytics 4 (#139)
gonwi May 16, 2022
a43a7c0
Initial commit for governance
codemaster115 May 11, 2022
7dcebb5
Upgrade locker program
codemaster115 May 17, 2022
a7d8cff
Fix conflict
codemaster115 May 17, 2022
ba4cdf8
Replace proposal prefix
codemaster115 May 17, 2022
01b4203
Update tribeca sdk
codemaster115 May 18, 2022
166d2fa
test vercel
BowTiedHeron May 17, 2022
e4c6a51
Fix build error
codemaster115 May 19, 2022
0457529
change vote card color
codemaster115 May 19, 2022
7084b0a
conflicts
codemaster115 May 19, 2022
31a130c
Update token supply value
codemaster115 May 19, 2022
cfd7a44
Fix build error
codemaster115 May 20, 2022
2f4df80
conflicts
codemaster115 May 23, 2022
9cec282
fix conflicts
BowTiedHeron May 28, 2022
79b8143
proposal stylings
oshioked May 31, 2022
9ba9fdb
fix grid style
oshioked May 31, 2022
63242c0
add back btn and edited header
oshioked May 31, 2022
bbbace4
fix link bug and reduce vote stat width
oshioked May 31, 2022
8488de3
remove green border
oshioked May 31, 2022
d68135f
no error when input empty
oshioked May 31, 2022
0b24a87
more layout fixes
oshioked May 31, 2022
f6c969b
styling example draft proposal
BowTiedHeron May 31, 2022
554fac8
fix header and add bg container for proposal cards
oshioked Jun 1, 2022
fc1e873
remove unnecessary file
oshioked Jun 1, 2022
2228eb3
edit proposal confirm modal
oshioked Jun 1, 2022
47751b9
fix alignment
oshioked Jun 1, 2022
77a0fb0
tooltip experiment
oshioked Jun 1, 2022
e9c3fb8
space btw votes and bars
oshioked Jun 1, 2022
40d39b1
fix alignment
oshioked Jun 1, 2022
9bbb20c
prompt wallet connect on new proposal click
oshioked Jun 1, 2022
a55beea
reduce modal width
oshioked Jun 1, 2022
11e3402
remove 1 from proposal details box
oshioked Jun 1, 2022
c64125b
add issue token action
codemaster115 Jun 2, 2022
704cc89
change env variable name
codemaster115 Jun 2, 2022
6e61b26
test vercel
BowTiedHeron Jun 2, 2022
010479d
fix right overflow on modal
oshioked Jun 6, 2022
ef2d5e0
upgrade env
codemaster115 Jun 7, 2022
826aa76
custom dropdown
oshioked Jun 8, 2022
d081675
close dropdown on clicking out
oshioked Jun 8, 2022
6d43c30
added variables to .env.example
BowTiedHeron Jun 9, 2022
a4fc01f
fix right overflow on modal
oshioked Jun 9, 2022
3ded2e7
custom dropdown
oshioked Jun 9, 2022
b038042
Merge branch 'gov' of https://github.com/honey-labs/honey-frontend in…
oshioked Jun 9, 2022
17e183e
feat: add tribeca v2 IDLs
gonwi Jul 26, 2022
66d00ca
changed proposal copy; veHONEY required to activate a proposal and am…
BowTiedHeron Jul 27, 2022
d436067
feat(governance): add governance v2
gonwi Jul 29, 2022
20e90d1
Merge branch 'gov' of https://github.com/honey-labs/honey-frontend in…
gonwi Jul 29, 2022
868a6dc
refactor(governance): rename all V2 functions
gonwi Jul 30, 2022
7ae83a2
feat(governance): add unlock locker buttons to Honey and Vehoney modals
gonwi Jul 30, 2022
5cd2a8a
fix(governance): fix enviroment variable
gonwi Aug 1, 2022
48943a3
feat(governance): add totalVeHoney supply
gonwi Aug 4, 2022
b06652f
Merge branch 'development' into gov
gonwi Aug 4, 2022
d3c439a
fix(governance): fix `package.json`
gonwi Aug 4, 2022
696f0b1
fix(governance): fix package dependencies error from merge
gonwi Aug 4, 2022
63fea74
build(governance): remove package
gonwi Aug 5, 2022
b7aaf6d
feat(governance): add
gonwi Aug 13, 2022
b599953
refactor(governance): remove unused imports
gonwi Aug 16, 2022
47c5c92
feat(governance): add config file for enviroment variables
gonwi Aug 16, 2022
571cc43
feat(governance): add config file for enviroment variables
gonwi Aug 17, 2022
8c584ef
fix(governance): add correct connect button
gonwi Aug 19, 2022
4cce6d4
Styling fixes on the gov branch (#179)
BowTiedHeron Aug 31, 2022
3dfb10c
fix(governance): disable unlock locker button
gonwi Aug 31, 2022
d98b8a6
feat(governance): add formatted lock period end date
gonwi Sep 11, 2022
14e5927
fix(governance): improve date formatting
gonwi Sep 11, 2022
1bdb3b5
preparing for HIP#4
BowTiedHeron Sep 24, 2022
8885218
fix(governance): fix lockPeriodHasEnded conditional and enable unlock…
gonwi Sep 26, 2022
ba32da1
Merge branch 'gov' of https://github.com/honey-labs/honey-frontend in…
gonwi Sep 26, 2022
a70de72
merge development with gov
gonwi Sep 27, 2022
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
10 changes: 9 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
NEXT_PUBLIC_RPC_NODE = `https://ssc-dao.genesysgo.net/`
NEXT_PUBLIC_GA=
NEXT_PUBLIC_GA=
NEXT_PUBLIC_HONEY_MINT=
NEXT_PUBLIC_PHONEY_MINT=
NEXT_PUBLIC_STAKE_POOL_ADDR=
NEXT_PUBLIC_VOTER_PROGRAM_ID=
NEXT_PUBLIC_GOVERNOR_ADDRESS=
NEXT_PUBLIC_SMART_WALLET_ADDRESS=
NEXT_PUBLIC_LOCKER_ADDR=
NEXT_PUBLIC_HONEY_MINT_WRAPPER=
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Hello and welcome 👋🏼, we are happy to see that you arrived at Honey Labs -
- <a href="https://github.com/GokiProtocol/walletkit" target="blank">Goki-Wallet:</a> for connecting to Solana wallets
- <a href="https://degen-xyz.vercel.app/" target="blank">Degen-UI:</a> for styling accopanied by <a href="https://vanilla-extract.style/documentation/setup/" target="blank">Vanilla-Extract</a> for custom CSS classes



## <span style="color: rgb(235, 85, 69); font-weight: 900">Getting Started</span>
The Honey Finance Ecosystem consists of several components this repo represents the Front-end.
Expand Down
52 changes: 52 additions & 0 deletions actions/Memo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import {
buildStubbedTransaction,
createMemoInstruction
} from '@saberhq/solana-contrib';
import { useSolana } from '@saberhq/use-solana';
import { useEffect, useState } from 'react';
import { Text, Textarea } from 'degen';
import { serializeToBase64 } from 'helpers/utils';
import type { ActionFormProps } from './types';

export const Memo: React.FC<ActionFormProps> = ({
actor,
setError,
setTxRaw
}: ActionFormProps) => {
const [memo, setMemo] = useState<string>('');
const { network } = useSolana();

useEffect(() => {
if (memo === '') {
setError('Memo cannot be empty');
}
}, [memo, setError]);

return (
<>
<Textarea
id="memo"
// tw="h-auto"
label="Memo"
rows={4}
placeholder="The memo for the DAO to send."
value={memo}
onChange={e => {
setMemo(e.target.value);
try {
const txStub = buildStubbedTransaction(
network !== 'localnet' ? network : 'devnet',
[createMemoInstruction(e.target.value, [actor])]
);
setTxRaw(serializeToBase64(txStub));
setError(null);
} catch (ex) {
setTxRaw('');
console.debug('Error creating memo', ex);
setError('Memo is too long');
}
}}
/>
</>
);
};
57 changes: 57 additions & 0 deletions actions/RawTX.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { extractErrorMessage } from '@saberhq/sail';
import { Transaction } from '@solana/web3.js';
import { Box, Text, Textarea } from 'degen';

import { HelperCard } from 'components/common/HelperCard';
import type { ActionFormProps } from './types';

export const RawTX: React.FC<ActionFormProps> = ({
setError,
txRaw,
setTxRaw
}: ActionFormProps) => {
return (
<>
<HelperCard variant="warn">
<Text as="p" size="base" color="yellow">
Warning: this page is for advanced users only. Invalid transaction
data may cause this page to freeze. Documentation will be coming soon.
</Text>
</HelperCard>
<HelperCard variant="muted">
<Box
// tw="prose prose-sm prose-light"
>
<Text as="p">
This page allows proposing any arbitrary transaction for execution
by the DAO. The fee payer and recent blockhash will not be used.
</Text>
</Box>
</HelperCard>
<Textarea
label="Transaction (base64)"
id="instructionsRaw"
rows={4}
placeholder="Paste raw base64 encoded transaction message"
value={txRaw}
onChange={e => {
setTxRaw(e.target.value);
try {
const buffer = Buffer.from(e.target.value, 'base64');
const tx = Transaction.from(buffer);
if (tx.instructions.length === 0) {
throw new Error('no instruction data');
}
setError(null);
} catch (err) {
setError(
`Invalid transaction data: ${
extractErrorMessage(err) ?? '(unknown)'
}`
);
}
}}
/>
</>
);
};
249 changes: 249 additions & 0 deletions actions/minter/IssueTokensAction/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
import { findMinterAddress, QUARRY_CODERS } from '@quarryprotocol/quarry-sdk';
import {
TOKEN_ACCOUNT_PARSER,
useParsedAccountData,
usePubkey,
useSail
} from '@saberhq/sail';
import { buildStubbedTransaction } from '@saberhq/solana-contrib';
import {
getATAAddress,
getOrCreateATA,
SPLToken,
TOKEN_PROGRAM_ID
} from '@saberhq/token-utils';
import { useSolana } from '@saberhq/use-solana';
import type { TransactionInstruction } from '@solana/web3.js';
import { useEffect, useMemo, useState } from 'react';
import { useQuery } from 'react-query';
import invariant from 'tiny-invariant';

import { AsyncButton } from 'components/common/AsyncButton';
import { useGovernor } from 'hooks/tribeca/useGovernor';
import { useParseTokenAmount } from 'hooks/useParseTokenAmount';
import { serializeToBase64 } from 'helpers/makeTransaction';
import { useParsedMintWrapper } from 'helpers/parser';
import type { ActionFormProps } from '../../types';
import { Input } from 'degen';

export const IssueTokensAction: React.FC<ActionFormProps> = ({
actor,
ctx,
setError,
setTxRaw
}: ActionFormProps) => {
const { govToken } = useGovernor();
const [amountStr, setAmountStr] = useState<string>('');
const [destinationStr, setDestinationStr] = useState<string>('');
const { network, providerMut } = useSolana();
const amount = useParseTokenAmount(govToken, amountStr);
const recipient = usePubkey(destinationStr);
const { handleTX } = useSail();

const minter = ctx?.minter;
const mintWrapper = useMemo(
() => (minter ? minter.mintWrapper : null),
[minter]
);
const { data: mintWrapperData } = useParsedMintWrapper(mintWrapper);
const { data: iouATAKey } = useQuery(
['ata', mintWrapperData?.accountInfo.data.tokenMint, actor?.toString()],
async () => {
invariant(mintWrapperData && actor);
return await getATAAddress({
mint: mintWrapperData.accountInfo.data.tokenMint,
owner: actor
});
},
{ enabled: !!mintWrapperData && !!actor }
);
const { data: iouATA } = useParsedAccountData(
iouATAKey,
TOKEN_ACCOUNT_PARSER
);

const outputToken = mintWrapperData?.accountInfo.data.tokenMint;
const { data: outputATAKey } = useQuery(
['ata', outputToken?.toString(), actor?.toString()],
async () => {
invariant(outputToken && actor);
return await getATAAddress({
mint: outputToken,
owner: actor
});
},
{ enabled: !!mintWrapperData && !!actor }
);
const { data: outputATA } = useParsedAccountData(
outputATAKey,
TOKEN_ACCOUNT_PARSER
);

const { data: recipientATAKey } = useQuery(
['ata', outputToken?.toString(), recipient?.toString()],
async () => {
invariant(outputToken && recipient);
return await getATAAddress({
mint: outputToken,
owner: recipient
});
},
{ enabled: !!outputToken && !!recipient }
);
const { data: recipientATA } = useParsedAccountData(
recipientATAKey,
TOKEN_ACCOUNT_PARSER
);

useEffect(() => {
if (
!providerMut ||
!mintWrapper ||
!actor ||
!amount ||
!recipient ||
!mintWrapperData ||
!govToken
) {
return;
}
void (async () => {
const [minter] = await findMinterAddress(mintWrapper, actor);

const ixs: TransactionInstruction[] = [];

const destinationATA = await getATAAddress({
mint: mintWrapperData.accountInfo.data.tokenMint,
owner: recipient
});

const mintDestination = destinationATA;

const mintIX = QUARRY_CODERS.MintWrapper.encodeIX(
'performMint',
{ amount: amount.toU64() },
{
mintWrapper,
minterAuthority: actor,
destination: mintDestination,
minter,
tokenMint: mintWrapperData.accountInfo.data.tokenMint,
tokenProgram: TOKEN_PROGRAM_ID
}
);
ixs.push(mintIX);

try {
const txStub = buildStubbedTransaction(
network !== 'localnet' ? network : 'devnet',
ixs
);
setTxRaw(serializeToBase64(txStub));
setError(null);
} catch (ex) {
setTxRaw('');
console.debug('Error issuing tokens', ex);
setError('Error generating proposal');
}
})();
}, [
amount,
recipient,
govToken,
mintWrapper,
mintWrapperData,
network,
providerMut,
setError,
setTxRaw,
actor
]);

return (
<>
<Input
label="Amount"
type="number"
min={0}
value={amountStr || ''}
onChange={e => setAmountStr(e.target.value)}
disabled={!actor}
/>
{/* <InputTokenAmount
label="Amount"
token={govToken ?? null}
tokens={[]}
tw="h-auto"
inputValue={amountStr}
inputDisabled={!actor}
inputOnChange={e => {
setAmountStr(e);
}}
/> */}
<Input
label="Recipient"
id="destination"
placeholder="Address to give tokens to"
onChange={e => setDestinationStr(e.target.value)}
/>
{/* <label tw="flex flex-col gap-1" htmlFor="destination">
<span tw="text-sm">Recipient</span>
<InputText
id="destination"
placeholder="Address to give tokens to."
value={destinationStr}
onChange={e => {
setDestinationStr(e.target.value);
}}
/>
</label> */}
{((iouATAKey && iouATA === null) ||
(outputATAKey && outputATA === null) ||
(recipientATAKey && recipientATA === null)) && (
<AsyncButton
disabled={!mintWrapperData || !actor || !outputToken}
onClick={async sdkMut => {
invariant(mintWrapperData && actor && outputToken);
const ixs: (TransactionInstruction | null)[] = [];
const { instruction: createMintWrapperATAIX } =
await getOrCreateATA({
provider: sdkMut.provider,
mint: mintWrapperData.accountInfo.data.tokenMint,
owner: actor
});
ixs.push(createMintWrapperATAIX);

if (
!outputToken.equals(mintWrapperData.accountInfo.data.tokenMint)
) {
const { instruction: createRedeemATAIX } = await getOrCreateATA({
provider: sdkMut.provider,
mint: outputToken,
owner: actor
});
ixs.push(createRedeemATAIX);
}
if (recipient) {
const { instruction: recipientATA } = await getOrCreateATA({
provider: sdkMut.provider,
mint: outputToken,
owner: recipient
});
ixs.push(recipientATA);
}
const { pending, success } = await handleTX(
sdkMut.provider.newTX(ixs),
'Create token accounts'
);
if (!success || !pending) {
return;
}
await pending.wait();
}}
>
Create token accounts
</AsyncButton>
)}
</>
);
};
Loading