Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cost-models table to proposal params #16

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion backend/src/proposal/proposal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class ProposalService {
createdEpochNo: govActionProposal.epoch_no,
url: govActionProposal.url,
metadataHash: govActionProposal.metadata_hash,
protocolParams: govActionProposal.row_to_json,
protocolParams: govActionProposal.proposal_params,
title: govActionProposal.title,
abstract: govActionProposal.abstract,
motivation: govActionProposal.motivation,
Expand Down
12 changes: 11 additions & 1 deletion backend/src/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ SELECT
creator_block.epoch_no,
voting_anchor.url,
encode(voting_anchor.data_hash, 'hex') AS metadata_hash,
ROW_TO_JSON(proposal_params),
jsonb_set(
ROW_TO_JSON(proposal_params)::jsonb,
'{cost_model}',
CASE
WHEN cost_model.id IS NOT NULL THEN
ROW_TO_JSON(cost_model)::jsonb
ELSE
'null'::jsonb
END
) AS proposal_params,
off_chain_vote_gov_action_data.title,
off_chain_vote_gov_action_data.abstract,
off_chain_vote_gov_action_data.motivation,
Expand Down Expand Up @@ -103,6 +112,7 @@ FROM
JOIN block AS creator_block ON creator_block.id = creator_tx.block_id
LEFT JOIN voting_anchor ON voting_anchor.id = gov_action_proposal.voting_anchor_id
LEFT JOIN param_proposal AS proposal_params ON gov_action_proposal.param_proposal = proposal_params.id
LEFT JOIN cost_model AS cost_model ON proposal_params.cost_model_id = cost_model.id
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = voting_anchor.id
LEFT JOIN off_chain_vote_gov_action_data ON off_chain_vote_gov_action_data.off_chain_vote_data_id = off_chain_vote_data.id
LEFT JOIN voting_procedure ON voting_procedure.gov_action_proposal_id = gov_action_proposal.id
Expand Down
2 changes: 1 addition & 1 deletion backend/src/types/proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export type RawQueryGovernanceActionProposalType = {
epoch_no: number;
url: string;
encode: string;
row_to_json: any;
proposal_params: any;
metadata_hash: string;
title: string | null;
abstract: string | null;
Expand Down
Loading