Skip to content

Commit

Permalink
fix: add options payload
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveVodrazka committed Oct 8, 2024
1 parent e911e55 commit 908c4c2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
8 changes: 5 additions & 3 deletions src/components/AddProposal/proposeOptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AccountInterface } from "starknet";
import { GOVERNANCE_ADDRESS } from "../../constants/amm";
import { AMM_ADDRESS, GOVERNANCE_ADDRESS } from "../../constants/amm";

export const proposeOptions = async (
options: string[],
Expand All @@ -9,8 +9,10 @@ export const proposeOptions = async (
contractAddress: GOVERNANCE_ADDRESS,
entrypoint: "submit_custom_proposal",
calldata: [
2, // add options custom proposal prop id
options.length,
"0x2", // add options custom proposal prop id
options.length + 2, // length of the payload Span<felt252>
AMM_ADDRESS,
options.length / 11, // length of the array of options (each option is 11 fields)
...options,
],
};
Expand Down
26 changes: 16 additions & 10 deletions src/pages/governance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { useEffect } from "react";

import styles from "./governance.module.css";
import { AddProposal } from "../components/AddProposal";
import { useAccount } from "../hooks/useAccount";
import { coreTeamAddresses } from "../constants/amm";

const VotingSubpage = () => {
return (
Expand Down Expand Up @@ -67,6 +69,7 @@ const ProposeOptionsSubpage = () => {
};

const Governance = () => {
const account = useAccount();
const subpage = useGovernanceSubpage();
const navigate = useNavigate();

Expand Down Expand Up @@ -131,16 +134,19 @@ const Governance = () => {
>
Staking
</button>
<button
className={`${
subpage === GovernanceSubpage.Propose && "primary active"
} ${buttonStyles.offset}`}
onClick={() => {
handleNavigateClick(GovernanceSubpage.Propose);
}}
>
Propose
</button>
{/* CURRENTLY ONLY SHOW TO THE CORE TEAM MEMBERS */}
{account?.address && coreTeamAddresses.includes(account.address) && (
<button
className={`${
subpage === GovernanceSubpage.Propose && "primary active"
} ${buttonStyles.offset}`}
onClick={() => {
handleNavigateClick(GovernanceSubpage.Propose);
}}
>
Propose
</button>
)}
</div>
<div className="divider" />
</div>
Expand Down

0 comments on commit 908c4c2

Please sign in to comment.