Skip to content

Commit

Permalink
fixed some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
yashgo0018 committed May 7, 2024
1 parent 9c6a67b commit 9df0243
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
31 changes: 18 additions & 13 deletions packages/hardhat/contracts/maci-contracts/MACIWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract MACIWrapper is MACI {
mapping(address => uint256) public pollIds;

// pubkey.x => pubkey.y => bool
mapping(uint256 => mapping(uint256 => bool)) public isPublicKeyRegistered;
mapping(uint256 => mapping(uint256 => bool)) public isPublicKeyRegistered;

error PubKeyAlreadyRegistered();
error PollAddressDoesNotExist(address _poll);
Expand All @@ -28,16 +28,17 @@ contract MACIWrapper is MACI {
InitialVoiceCreditProxy _initialVoiceCreditProxy,
TopupCredit _topupCredit,
uint8 _stateTreeDepth
) MACI(
_pollFactory,
_messageProcessorFactory,
_tallyFactory,
_signUpGatekeeper,
_initialVoiceCreditProxy,
_topupCredit,
_stateTreeDepth
) {
}
)
MACI(
_pollFactory,
_messageProcessorFactory,
_tallyFactory,
_signUpGatekeeper,
_initialVoiceCreditProxy,
_topupCredit,
_stateTreeDepth
)
{}

/// @notice Allows any eligible user sign up. The sign-up gatekeeper should prevent
/// double sign-ups or ineligible users from doing so. This function will
Expand All @@ -60,7 +61,11 @@ contract MACIWrapper is MACI {
if (isPublicKeyRegistered[_pubKey.x][_pubKey.y])
revert PubKeyAlreadyRegistered();

super.signUp(_pubKey, _signUpGatekeeperData, _initialVoiceCreditProxyData);
super.signUp(
_pubKey,
_signUpGatekeeperData,
_initialVoiceCreditProxyData
);

isPublicKeyRegistered[_pubKey.x][_pubKey.y] = true;
}
Expand All @@ -81,7 +86,7 @@ contract MACIWrapper is MACI {
address _vkRegistry,
Mode _mode
) public override returns (PollContracts memory pollAddr) {
uint256 pollId = nextPollId;
uint256 pollId = nextPollId;

PollContracts memory p = super.deployPoll(
_duration,
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/app/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function AdminPage() {
const { address } = useAccount();
const [openCreatePollModal, setOpenCreatePollModal] = useState(false);
const [currentPage, setCurrentPage] = useState(1);
const { data: admin } = useScaffoldContractRead({ contractName: "MACIWrapper", functionName: "owner" });
const { data: admin } = useScaffoldContractRead({ contractName: "PollManager", functionName: "owner" });
const [limit] = useState(10);
const { totalPolls, polls, refetch: refetchPolls } = useFetchPolls(currentPage, limit);
const totalPages = useTotalPages(totalPolls, limit);
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const HeaderMenuLinks = () => {

const { address } = useAccount();

const { data: owner } = useScaffoldContractRead({ contractName: "MACIWrapper", functionName: "owner" });
const { data: owner } = useScaffoldContractRead({ contractName: "PollManager", functionName: "owner" });

return (
<>
Expand Down

0 comments on commit 9df0243

Please sign in to comment.