Skip to content

Commit

Permalink
fix: Release boost to public (#4806)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR authored Sep 11, 2024
1 parent ff4d0ce commit 62db6f6
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 55 deletions.
3 changes: 1 addition & 2 deletions src/components/SpaceCreateVoting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const {
userSelectedDateStart,
userSelectedDateEnd
} = useFormSpaceProposal();
const { isWhitelisted } = useBoost();
const disableChoiceEdit = computed(() => form.value.type === 'basic');
Expand Down Expand Up @@ -121,7 +120,7 @@ defineEmits<{
"
@update:type="value => (form.type = value)"
/>
<template v-if="isWhitelisted(space.id)">
<template v-if="space.boost.enabled">
<BaseMessage
v-if="!BOOST_ENABLED_VOTING_TYPES.includes(form.type)"
level="info"
Expand Down
2 changes: 0 additions & 2 deletions src/components/SpaceProposalPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ useMeta({
const route = useRoute();
const { web3, web3Account } = useWeb3();
const { modalEmailOpen } = useModal();
const { isWhitelisted } = useBoost();
const { isMessageVisible, setMessageVisibility } = useFlaggedMessageStatus(
route.params.id as string
);
Expand Down Expand Up @@ -58,7 +57,6 @@ const strategies = computed(
const boostEnabled = computed(() => {
return (
BOOST_ENABLED_VOTING_TYPES.includes(props.proposal.type) &&
isWhitelisted(props.space.id) &&
props.space.boost.enabled
);
});
Expand Down
9 changes: 1 addition & 8 deletions src/composables/useBoost.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BOOST_WHITELIST_SETTINGS, claimTokens } from '@/helpers/boost';
import { claimTokens } from '@/helpers/boost';
import { BoostSubgraph } from '@/helpers/boost/types';
import { Proposal, ExtendedSpace } from '@/helpers/interfaces';
import { TWO_WEEKS } from '@/helpers/constants';
Expand All @@ -8,16 +8,10 @@ import { getInstance } from '@snapshot-labs/lock/plugins/vue3';

export function useBoost() {
const auth = getInstance();
const { env } = useApp();
const { web3Account, web3 } = useWeb3();
const { changeNetwork } = useChangeNetwork();

const loadingClaim = ref(false);

function isWhitelisted(spaceId: string) {
return (BOOST_WHITELIST_SETTINGS[env] ?? []).includes(spaceId);
}

function sanitizeBoosts(
boosts: BoostSubgraph[],
proposals: Proposal[],
Expand Down Expand Up @@ -86,7 +80,6 @@ export function useBoost() {
}

return {
isWhitelisted,
sanitizeBoosts,
loadVouchers,
handleClaim,
Expand Down
26 changes: 0 additions & 26 deletions src/helpers/boost/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,6 @@ export const SUPPORTED_NETWORKS = Object.keys(BOOST_CONTRACTS);
export const SNAPSHOT_GUARD_ADDRESS =
'0x064417ab192edC00E791d5911ecDbb7c9a718383';

export const BOOST_WHITELIST_SETTINGS = {
demo: [],
production: [
// External testers
'community.daosquare.eth',
'nsfwgov.eth',
'worldassociation.eth',
'kumaprotocol.eth',
'mimo.eth',
'vote.vitadao.eth',
'shutterdao0x36.eth',
'testeteste123.eth',
'alkimiexchange.eth',
// Internal testers
'testsnap.eth',
'fabien.eth',
'pscott.eth',
'gillvill.eth',
'0cf5e.eth',
'thanku.eth',
'test.wa0x6e.eth',
'aurelianob.eth',
'pscott.eth'
]
};

export async function createBoost(
web3: Web3Provider,
networkId: string,
Expand Down
11 changes: 2 additions & 9 deletions src/views/SpaceBoost.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const { getRelativeProposalPeriod } = useIntl();
const { env } = useApp();
const { formatNumber, getNumberFormatter } = useIntl();
const { loadBalances, tokens, loading: loadingBalances } = useBalances();
const { isWhitelisted } = useBoost();
const proposal = ref();
const createStatus = ref('');
Expand Down Expand Up @@ -726,11 +725,7 @@ watch(
</div>
<TuneButton
:loading="isLoading"
:disabled="
!isWhitelisted(space.id) ||
!space.boost.enabled ||
proposal.state === 'closed'
"
:disabled="!space.boost.enabled || proposal.state === 'closed'"
primary
class="w-full mt-3"
@click="handleCreate"
Expand All @@ -745,9 +740,7 @@ watch(
<i-ho-exclamation-circle />
This proposal is closed
</template>
<template
v-else-if="!isWhitelisted(space.id) || !space.boost.enabled"
>
<template v-else-if="!space.boost.enabled">
<i-ho-exclamation-circle />
Boost is not enabled in this space
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/views/SpaceProposals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const { profiles, loadProfiles } = useProfiles();
const { apolloQuery } = useApolloQuery();
const { web3Account } = useWeb3();
const { isFollowing } = useFollowSpace(props.space.id);
const { isWhitelisted, sanitizeBoosts } = useBoost();
const { sanitizeBoosts } = useBoost();
const {
store,
userVotedProposalIds,
Expand Down Expand Up @@ -87,7 +87,7 @@ async function getProposals(skip = 0) {
}
async function loadBoosts(proposals: Proposal[]) {
if (!isWhitelisted(props.space.id) || !props.space.boost.enabled) return;
if (!props.space.boost.enabled) return;
const alreadyLoadedProposals = boosts.value.map(
boost => boost.strategy.proposal
Expand Down
7 changes: 1 addition & 6 deletions src/views/SpaceSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const { web3Account } = useWeb3();
const { send, isSending } = useClient();
const { reloadSpace, deleteSpace } = useExtendedSpaces();
const { loadFollows } = useFollowSpace();
const { isWhitelisted } = useBoost();
const {
validationErrors,
isValid,
Expand Down Expand Up @@ -265,11 +264,7 @@ onBeforeRouteLeave(async () => {
</template>

<template v-if="currentPage === Page.VOTING">
<SettingsBoostBlock
v-if="isWhitelisted(space.id)"
context="settings"
:is-view-only="isViewOnly"
/>
<SettingsBoostBlock context="settings" :is-view-only="isViewOnly" />

<SettingsVotingBlock
context="settings"
Expand Down

0 comments on commit 62db6f6

Please sign in to comment.