Skip to content

Commit

Permalink
apply formatting
Browse files Browse the repository at this point in the history
Signed-off-by: ryanwolhuter <[email protected]>
  • Loading branch information
ryanwolhuter committed Oct 27, 2023
1 parent 83e7d0c commit ff199d4
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 114 deletions.
2 changes: 1 addition & 1 deletion snapshot-spaces
2 changes: 1 addition & 1 deletion src/components/BaseModalSelectItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defineProps<{
/>
<BasePill>{{ tag }}</BasePill>
</div>
<span class="text-skin-text break-all" v-text="description" />
<span class="break-all text-skin-text" v-text="description" />
</div>
<i-ho-check v-if="selected" class="absolute right-0 text-md" />
</div>
Expand Down
172 changes: 86 additions & 86 deletions src/components/SpaceCreateVoting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,94 +120,94 @@ defineEmits<{
@update:type="value => (form.type = value)"
/>

<h4 class="mb-1 mt-3" v-text="$t('create.choices')" />
<div class="flex">
<div class="w-full overflow-hidden">
<draggable
v-model="form.choices"
v-bind="{ animation: 200 }"
:disabled="disableChoiceEdit"
item-key="id"
handle=".drag-handle"
class="space-y-2"
<h4 class="mb-1 mt-3" v-text="$t('create.choices')" />
<div class="flex">
<div class="w-full overflow-hidden">
<draggable
v-model="form.choices"
v-bind="{ animation: 200 }"
:disabled="disableChoiceEdit"
item-key="id"
handle=".drag-handle"
class="space-y-2"
>
>
<template #item="{ element, index }">
<UiInput
v-model="element.text"
maxlength="32"
:disabled="disableChoiceEdit"
:placeholder="index > 0 ? $t('optional') : ''"
class="group"
:focus-on-mount="index === 0"
:data-testid="`input-proposal-choice-${index}`"
>
<template #item="{ element, index }">
<UiInput
v-model="element.text"
maxlength="32"
:disabled="disableChoiceEdit"
:placeholder="index > 0 ? $t('optional') : ''"
class="group"
:focus-on-mount="index === 0"
:data-testid="`input-proposal-choice-${index}`"
>
<template #label>
<div
class="drag-handle flex cursor-grab items-center active:cursor-grabbing"
:class="{
'cursor-not-allowed active:cursor-not-allowed':
disableChoiceEdit
}"
>
<BaseIcon name="draggable" size="16" class="mr-[12px]" />
{{ $tc('create.choice', [index + 1]) }}
</div>
</template>
<template #info>
<span
class="hidden text-xs text-skin-text group-focus-within:block"
>
{{ `${element.text.length}/32` }}
</span>
</template>
</UiInput>
</template>
</draggable>
</div>
<div v-if="!disableChoiceEdit" class="ml-2 flex w-[48px] items-end">
<BaseButtonRound
v-if="!disableChoiceEdit"
size="42px"
@click="addChoices(1)"
>
<i-ho-plus-sm class="text-skin-link" />
</BaseButtonRound>
</div>
<template #label>
<div
class="drag-handle flex cursor-grab items-center active:cursor-grabbing"
:class="{
'cursor-not-allowed active:cursor-not-allowed':
disableChoiceEdit
}"
>
<BaseIcon name="draggable" size="16" class="mr-[12px]" />
{{ $tc('create.choice', [index + 1]) }}
</div>
</template>
<template #info>
<span
class="hidden text-xs text-skin-text group-focus-within:block"
>
{{ `${element.text.length}/32` }}
</span>
</template>
</UiInput>
</template>
</draggable>
</div>
</BaseBlock>

<BaseBlock
:title="$t('create.period')"
:information="$t('create.votingPeriodExplainer')"
>
<div class="space-y-2 md:flex md:space-x-3 md:space-y-0">
<SpaceCreateVotingDateStart
:delay="space.voting?.delay"
:date="dateStart"
:disabled="isEditing"
@select="value => setDateStart(value)"
/>

<SpaceCreateVotingDateEnd
:period="space.voting?.period"
:date="dateEnd"
:disabled="isEditing"
@select="value => setDateEnd(value)"
/>
<div v-if="!disableChoiceEdit" class="ml-2 flex w-[48px] items-end">
<BaseButtonRound
v-if="!disableChoiceEdit"
size="42px"
@click="addChoices(1)"
>
<i-ho-plus-sm class="text-skin-link" />
</BaseButtonRound>
</div>
</BaseBlock>

<BaseBlock v-if="$route.query.snapshot" :title="$t('snapshot')">
<UiInput
v-model="form.snapshot"
:number="true"
:placeholder="$t('create.snapshotBlock')"
>
<template #label>
{{ $t('snapshot') }}
</template>
</UiInput>
</BaseBlock>
</div>
</div>
</BaseBlock>

<BaseBlock
:title="$t('create.period')"
:information="$t('create.votingPeriodExplainer')"
>
<div class="space-y-2 md:flex md:space-x-3 md:space-y-0">
<SpaceCreateVotingDateStart
:delay="space.voting?.delay"
:date="dateStart"
:disabled="isEditing"
@select="value => setDateStart(value)"
/>

<SpaceCreateVotingDateEnd
:period="space.voting?.period"
:date="dateEnd"
:disabled="isEditing"
@select="value => setDateEnd(value)"
/>
</div>
</BaseBlock>

<BaseBlock v-if="$route.query.snapshot" :title="$t('snapshot')">
<UiInput
v-model="form.snapshot"
:number="true"
:placeholder="$t('create.snapshotBlock')"
>
<template #label>
{{ $t('snapshot') }}
</template>
</UiInput>
</BaseBlock>
</div>
</template>
7 changes: 6 additions & 1 deletion src/composables/useFollowSpace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ export function useFollowSpace(spaceId: any = {}) {
} catch (e: any) {
loadingFollow.value = '';
console.error(e);
notify(['red', e?.error_description ? `Oops, ${e.error_description}` : t('notify.somethingWentWrong')]);
notify([
'red',
e?.error_description
? `Oops, ${e.error_description}`
: t('notify.somethingWentWrong')
]);
}
}

Expand Down
25 changes: 12 additions & 13 deletions src/plugins/oSnap/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export type OsnapPluginData = {

/**
* Represents the data associated with an assertion on the Optimistic Oracle V3 subgraph.
*
*
* @field `assertionId` field is the id of the assertion.
* @field `expirationTime` field is the time that the assertion's challenge period ends.
* @field `assertionHash` field is the transaction hash from when the assertion was made.
Expand All @@ -265,7 +265,7 @@ export type AssertionGql = {

/**
* Represents the configuration of the Optimistic Governor module contract that was deployed for a given Safe.
*
*
* @field `moduleAddress` field is the address of the specific Optimistic Governor module contract that was deployed for a given Safe.
* @field `oracleAddress` field is the address of the Optimistic Oracle V3 contract.
* @field `rules` rules for this Optimistic Governor contract.
Expand All @@ -282,7 +282,7 @@ export type OGModuleDetails = {

/**
* Represents the collateral configuration for a given Optimistic Governor contract.
*
*
* @field `erc20Contract` field is the ERC20 contract that is used for collateral.
* @field `address` field is the address of the ERC20 contract that is used for collateral.
* @field `symbol` field is the symbol of the ERC20 contract that is used for collateral.
Expand All @@ -297,7 +297,7 @@ export type CollateralDetails = {

/**
* Event fired when an assertion is made on the Optimistic Oracle V3 contract.
*
*
* @field `assertionId` field is the id of the assertion.
* @field `domainId` field is the domain id of the assertion.
* @field `claim` field is the claim of the assertion.
Expand Down Expand Up @@ -328,7 +328,7 @@ export type AssertionMadeEvent = Event & {

/**
* Event fired when transactions are proposed on the Optimistic Governor contract.
*
*
* @field `proposer` field is the address of the proposer.
* @field `proposalTime` field is the time that the proposal was made.
* @field `assertionId` field is the id of the assertion.
Expand Down Expand Up @@ -356,7 +356,7 @@ export type TransactionsProposedEvent = Event & {

/**
* Event fired when an Optimistic Governor proposal's transactions are executed successfully.
*
*
* @field `proposalHash` field is the hash of the proposal.
* @field `assertionId` field is the id of the assertion.
*/
Expand All @@ -367,10 +367,9 @@ export type ProposalExecutedEvent = Event & {
};
};


/**
* Represents the transaction hash and log index of an `AssertionMade` event.
*
*
* We need these for generating a link to the assertion on the Optimistic Oracle dapp.
*/
export type AssertionTransactionDetails = {
Expand All @@ -380,15 +379,15 @@ export type AssertionTransactionDetails = {

/**
* Represents the state of a proposal on the Optimistic Governor contract. When an assertion is associated with the proposal, we also include the assertion transaction hash and log index so that we can create a link to the assertion on the Optimistic Oracle dapp.
*
*
* There are four states that a proposal can be in:
*
*
* - `can-propose-to-og`: The user can propose transactions to the Optimistic Governor contract. This is the initial state of a proposal. We also indicate if this proposal has been disputed in the Oracle, so that we can warn the user to exercise caution and avoid losing their bond.
*
*
* - `in-oo-challenge-period`: The user has proposed transactions to the Optimistic Governor contract, and the proposal is currently in the challenge period on the Optimistic Oracle contract. We also indicate when the challenge period ends, so that we can warn the user to wait until the challenge period ends before proposing new transactions.
*
*
* - `can-request-tx-execution`: The user has proposed transactions to the Optimistic Governor contract, and the challenge period has ended. The user can now request that the Optimistic Governor contract execute the transactions.
*
*
* - `transactions-executed`: The user has proposed transactions to the Optimistic Governor contract, the challenge period has ended, and the transactions have been executed by the Optimistic Governor contract.
*/
export type OGProposalState =
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/oSnap/utils/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@ export async function getPagedEvents<EventType = Event>(params: {
eventPager
);
return pagedEvents as EventType[];
}
}
18 changes: 9 additions & 9 deletions src/plugins/oSnap/utils/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ async function getAssertionGql(params: {
}
/**
* Fetches the details of a given proposal from the Optimistic Governor subgraph.
*
*
* The subgraph uses the `assertionId` that comes from assertion events as the primary key for proposals.
* However, this `assertionId` will be deleted if the proposal is disputed, so we can't use it to query the subgraph.
* Instead, we use the `proposalHash` and `explanation` to query the subgraph.
Expand Down Expand Up @@ -337,7 +337,7 @@ async function getOgProposalGql(params: {

/**
* Fetches the details of a Optimistic Governor module's collateral token.
*
*
* Returns the address, symbol, and decimals of the collateral token, along with the token contract for further querying.
*/
export async function getCollateralDetailsForProposal(
Expand Down Expand Up @@ -386,7 +386,7 @@ export async function getUserCollateralBalance(

/**
* Fetches the details of a given Optimistic Governor module from the chain.
*
*
* Performs a multicall to fetch the oracle address, rules, minimum bond, and challenge period.
*/
export async function getOGModuleDetails(params: {
Expand Down Expand Up @@ -424,11 +424,11 @@ export async function getOGModuleDetails(params: {

/**
* Fetches the state of an Optimistic Governor proposal from the chain.
*
*
* This is a fallback function that should only be used if the subgraph is not available, because it is very slow.
*
*
* The contract is designed in such a way that it deletes the `assertionId` from the proposal if the proposal is disputed, _or_ if the transactions are executed successfully. This means we can't tell the difference between a proposal that has not yet been proposed, has been disputed, or that has been executed by querying the chain.
*
*
* Instead, we must query the chain for the proposal events, and then query the chain for the execution events, and then compare the two to determine the state of the proposal. This is very slow.
*/
export async function getOgProposalStateFromChain(params: {
Expand Down Expand Up @@ -583,7 +583,7 @@ export async function getOgProposalStateFromChain(params: {

/**
* Fetches the state of an Optimistic Governor proposal from the subgraph.
*
*
* This is the preferred method of fetching the state of a proposal, because it is much faster than querying the chain.
*/
export async function getOGProposalStateGql(params: {
Expand Down Expand Up @@ -672,7 +672,7 @@ function assertionIdIsNotZero(assertionId: string) {

/**
* Fetches the state of an Optimistic Governor proposal.
*
*
* This function will attempt to fetch the state of a proposal from the subgraph, and if that fails, it will fall back to querying the chain.
*/
export async function getOGProposalState(params: {
Expand All @@ -689,7 +689,7 @@ export async function getOGProposalState(params: {
network,
moduleAddress,
explanation,
proposalHash,
proposalHash
});
} catch (error) {
console.warn(
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/safeSnap/utils/umaModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export const getModuleDetailsUma = async (
const assertion = await oracleContract.getAssertion(
event.args?.assertionId
);

const isExpired =
Math.floor(Date.now() / 1000) >= assertion.expirationTime.toNumber();

Expand Down
4 changes: 3 additions & 1 deletion src/views/PlaygroundView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ function handleNetworkSelect(value) {
class="mt-3 overflow-x-auto"
style="border-color: red !important"
>
<pre class="!text-red whitespace-pre-wrap"> {{ strategyError }}</pre>
<pre class="whitespace-pre-wrap !text-red">
{{ strategyError }}</pre
>
</BaseBlock>
</BaseBlock>
<BaseBlock :title="$t('addresses')">
Expand Down

0 comments on commit ff199d4

Please sign in to comment.