Skip to content

Commit

Permalink
Add isMember check + index handleCommunityFeeUpdated
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin committed Nov 2, 2024
1 parent c69d5dd commit 1923471
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
10 changes: 8 additions & 2 deletions apps/web/components/Proposals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,14 @@ export function Proposals({
<Link href={createProposalUrl}>
<Button
icon={<PlusIcon height={24} width={24} />}
disabled={!isConnected || missmatchUrl}
tooltip={isConnected ? undefined : "Connect wallet first"}
disabled={!isConnected || missmatchUrl || !isMemberCommunity}
tooltip={
isConnected ?
isMemberCommunity ?
undefined
: "Register to community first"
: "Connect wallet first"
}
>
Create a proposal
</Button>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/configs/subgraph.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"VERSION_TESTNET": "0.1.17",
"VERSION_TESTNET": "0.1.18",
"VERSION_PROD": "0.1.4"
}
20 changes: 19 additions & 1 deletion pkg/subgraph/src/mappings/registry-community.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import {
KickEnabledUpdated,
CouncilSafeChangeStarted,
CouncilSafeUpdated,
BasisStakedAmountUpdated
BasisStakedAmountUpdated,
CommunityFeeUpdated
} from "../../generated/templates/RegistryCommunityV0_0/RegistryCommunityV0_0";

import { RegistryFactoryV0_0 as RegistryFactoryContract } from "../../generated/RegistryFactoryV0_0/RegistryFactoryV0_0";
Expand Down Expand Up @@ -543,6 +544,23 @@ export function handleBasisStakedAmountUpdated(
community.save();
}

export function handleCommunityFeeUpdated(event: CommunityFeeUpdated): void {
log.debug("RegistryCommunity: handleCommunityFeeUpdated: {}", [
event.params._newFee.toString()
]);

let community = RegistryCommunity.load(event.address.toHexString());
if (community == null) {
log.error("RegistryCommunity: Community not found: {}", [
event.address.toHexString()
]);
return;
}

community.communityFee = event.params._newFee;
community.save();
}

// handler: handleMemberPowerDecreased
// export function handleMemberPowerDecreased(event: MemberPowerDecreased): void {
// log.debug("RegistryCommunity: handleMemberPowerDecreased: member:{} power:{} strategy:{} ", [
Expand Down

0 comments on commit 1923471

Please sign in to comment.