Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions apps/aquachain/src/app/services/local-dao/local-dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ export interface ParsedProposal extends DaoProposal {
export class LocalDaoService {
private readonly contractService = inject(ContractService);

async getProposal(contract: string, proposalId: number): Promise<DaoProposal> {
async getProposal(
contract: string,
proposalId: number,
): Promise<DaoProposal> {
const client = await this.contractService.getqueryClient();
return client.queryContractSmart(contract, {
get_proposal: { proposal_id: proposalId },
Expand Down Expand Up @@ -151,17 +154,10 @@ export class LocalDaoService {
proposalId: number,
choice: VoteChoice,
) {
const votePayload =
choice === 'yes'
? { yes: {} }
: choice === 'no'
? { no: {} }
: { abstain: {} };

return this.contractService.simulateAndExecute(
sender,
contract,
{ vote: { proposal_id: proposalId, vote: votePayload } },
{ vote: { proposal_id: proposalId, vote: choice } },
'cast vote',
);
}
Expand All @@ -182,7 +178,9 @@ export class LocalDaoService {
}
}

export function daoActionDefinition(actionTag: string): DaoActionDefinition | undefined {
export function daoActionDefinition(
actionTag: string,
): DaoActionDefinition | undefined {
return DAO_ACTIONS.find((action) => action.tag === actionTag);
}

Expand Down Expand Up @@ -309,7 +307,10 @@ export function proposalStatusLabel(status: ProposalStatus): string {
}
}

export function isVotingOpen(proposal: DaoProposal, nowSeconds: number): boolean {
export function isVotingOpen(
proposal: DaoProposal,
nowSeconds: number,
): boolean {
if (proposal.status !== 'open') {
return false;
}
Expand Down
Loading