forked from snapshot-labs/snapshot-v1
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into safesnap_connext_integration
- Loading branch information
Showing
59 changed files
with
6,210 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<script setup lang="ts"> | ||
import { TreasuryWallet } from '@/helpers/interfaces'; | ||
import { Network } from '@/plugins/oSnap/types'; | ||
import { makeConfigureOsnapUrl } from '@/plugins/oSnap/utils/getters'; | ||
const props = defineProps<{ | ||
open: boolean; | ||
isOsnapEnabled: boolean; | ||
treasury: TreasuryWallet; | ||
spaceName: string; | ||
}>(); | ||
defineEmits<{ | ||
(e: 'close'): void; | ||
}>(); | ||
const spaceUrl = window.location.href.replace('/settings', ''); | ||
const href = computed(() => | ||
makeConfigureOsnapUrl({ | ||
spaceUrl, | ||
spaceName: props.spaceName, | ||
safeAddress: props.treasury.address, | ||
network: props.treasury.network as Network | ||
}) | ||
); | ||
</script> | ||
|
||
<template> | ||
<BaseModal :open="open" @close="$emit('close')"> | ||
<template #header> | ||
<h3 v-text="'Configure oSnap'" /> | ||
</template> | ||
<div class="m-4 grid grid-cols-[auto,auto] gap-2"> | ||
<i-ho-information-circle class="mt-1 text-sm" /> | ||
<p class="text-sm"> | ||
oSnap seamlessly integrates with Snapshot and your treasury, | ||
automatically executing governance votes on-chain. Bypass the need for | ||
privileged signers to create a DAO that's more efficient and truly | ||
decentralized. | ||
<BaseLink class="mt-1 block text-skin-link" link="https://uma.xyz/osnap" | ||
>Learn more</BaseLink | ||
> | ||
</p> | ||
</div> | ||
|
||
<template #footer> | ||
<a | ||
:href="href" | ||
target="_blank" | ||
class="block w-full rounded-full py-[12px] text-white" | ||
:class=" | ||
isOsnapEnabled ? 'bg-[hsl(349,65%,52%)]' : 'bg-[hsl(240,83%,58%)]' | ||
" | ||
@click.stop="$emit('close')" | ||
> | ||
{{ isOsnapEnabled ? 'Deactivate' : 'Activate' }} oSnap | ||
<i-ho-external-link class="mb-[2px] ml-1 inline-block text-xs" /> | ||
</a> | ||
<p class="mt-2 text-xs text-skin-text"> | ||
Note that the deactivation process takes place in the Safe app | ||
</p> | ||
</template> | ||
</BaseModal> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<script setup lang="ts"> | ||
import { TreasuryWallet } from '@/helpers/interfaces'; | ||
import { Network } from '@/plugins/oSnap/types'; | ||
import { getIsOsnapEnabled } from '@/plugins/oSnap/utils/getters'; | ||
const props = defineProps<{ | ||
treasury: TreasuryWallet; | ||
treasuryIndex: number; | ||
isViewOnly?: boolean; | ||
hasOsnapPlugin: boolean; | ||
}>(); | ||
const emit = defineEmits<{ | ||
removeTreasury: [index: number]; | ||
editTreasury: [index: number]; | ||
configureOsnap: [index: number, isEnabled: boolean]; | ||
}>(); | ||
const isOsnapEnabled = ref(false); | ||
async function updateIsOsnapEnabled() { | ||
if (!props.hasOsnapPlugin) return; | ||
isOsnapEnabled.value = await getIsOsnapEnabled( | ||
props.treasury.network as Network, | ||
props.treasury.address | ||
); | ||
} | ||
onMounted(async () => { | ||
await updateIsOsnapEnabled(); | ||
window.addEventListener('focus', updateIsOsnapEnabled); | ||
}); | ||
onUnmounted(() => { | ||
window.removeEventListener('focus', updateIsOsnapEnabled); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<button | ||
class="flex h-full w-full items-center justify-between truncate rounded-md border p-4" | ||
:class="{ 'cursor-default': isViewOnly }" | ||
@click="emit('editTreasury', treasuryIndex)" | ||
> | ||
<div class="flex items-center gap-2 truncate pr-[20px] text-left"> | ||
<h4 class="truncate">{{ treasury.name }}</h4> | ||
</div> | ||
<div class="ml-auto mr-3"> | ||
<SettingsTreasuryActivateOsnapButton | ||
v-show="hasOsnapPlugin" | ||
:is-osnap-enabled="isOsnapEnabled" | ||
@click.stop=" | ||
!isViewOnly && emit('configureOsnap', treasuryIndex, isOsnapEnabled) | ||
" | ||
/> | ||
</div> | ||
<BaseButtonIcon | ||
v-show="!isViewOnly" | ||
class="-mr-2" | ||
@click.stop="emit('removeTreasury', treasuryIndex)" | ||
> | ||
<BaseIcon name="close" size="14" /> | ||
</BaseButtonIcon> | ||
</button> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
isOsnapEnabled: boolean; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<button | ||
v-if="isOsnapEnabled" | ||
class="flex items-center gap-2 rounded-full px-3 py-2 bg-skin-primary text-white" | ||
> | ||
<span class="block h-[6px] w-[6px] rounded-full bg-green" />oSnap activated | ||
</button> | ||
<button | ||
v-else | ||
class="bg-skin-link text-skin-bg flex items-center gap-2 rounded-full px-3 py-2" | ||
> | ||
<span class="block h-[6px] w-[6px] rounded-full bg-skin-bg opacity-30" /> | ||
Activate oSnap | ||
</button> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script setup lang="ts"> | ||
import { ExtendedSpace } from '@/helpers/interfaces'; | ||
defineProps<{ | ||
space: ExtendedSpace | undefined; | ||
legacyOsnap: { selection: boolean }; | ||
}>(); | ||
defineEmits<{ | ||
(event: 'legacyOsnapToggle'): void; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<div class="mb-4"> | ||
<div v-if="space?.voting?.type && space.voting.type !== 'basic'"> | ||
<h6>Where is oSnap?</h6> | ||
<p class="mb-3"> | ||
oSnap is currently disabled because your space's voting settings | ||
disallow the basic voting type which is a requirement for oSnap to work | ||
properly. | ||
</p> | ||
<p> | ||
Have your admin visit your | ||
<a :href="`#/${space.id}/settings`">settings page</a> under Voting -> | ||
Type, and make sure either "Any" or "Basic Voting" is selected. This | ||
will allow you to create oSnap proposals. | ||
</p> | ||
</div> | ||
<div v-else> | ||
<h6>oSnap Proposal</h6> | ||
<p> | ||
Are you planning for this proposal to initiate a transaction that your | ||
organizations Safe will execute if approved? (Remember, oSnap enables | ||
trustless and permissionless execution) | ||
</p> | ||
<br /> | ||
<input | ||
id="toggleOsnap" | ||
type="checkbox" | ||
:checked="legacyOsnap.selection" | ||
@change="$emit('legacyOsnapToggle')" | ||
/> | ||
<label for="toggleOsnap"> | ||
Yes, use oSnap for transactions (this will restrict voting type to | ||
Basic). | ||
</label> | ||
</div> | ||
</div> | ||
</template> |
Oops, something went wrong.