diff --git a/files/grest/rpc/02_indexes/13_3_00.sql b/files/grest/rpc/02_indexes/13_3_00.sql index c4ee4216..789ca696 100644 --- a/files/grest/rpc/02_indexes/13_3_00.sql +++ b/files/grest/rpc/02_indexes/13_3_00.sql @@ -1,6 +1,4 @@ CREATE INDEX IF NOT EXISTS pool_stat_pool_hash_id ON pool_stat(pool_hash_id); CREATE INDEX IF NOT EXISTS pool_stat_epoch_no ON pool_stat(epoch_no); --- CREATE INDEX IF NOT EXISTS idx_drep_hash_view ON drep_hash (view); -CREATE INDEX IF NOT EXISTS idx_drep_hash_raw ON drep_hash (raw); CREATE INDEX IF NOT EXISTS idx_reward_rest_addr_id ON reward_rest (addr_id); CREATE INDEX IF NOT EXISTS idx_reward_rest_spendable_epoch ON reward_rest (spendable_epoch); \ No newline at end of file diff --git a/files/grest/rpc/02_indexes/13_5_0_2.sql b/files/grest/rpc/02_indexes/13_5_0_2.sql new file mode 100644 index 00000000..9e26961a --- /dev/null +++ b/files/grest/rpc/02_indexes/13_5_0_2.sql @@ -0,0 +1,3 @@ +DROP INDEX IF EXISTS idx_stake_address_view; +CREATE INDEX IF NOT EXISTS idx_stake_address_hash_raw ON stake_address (hash_raw); +CREATE INDEX IF NOT EXISTS idx_drep_hash_raw ON drep_hash (raw); \ No newline at end of file diff --git a/files/grest/rpc/governance/proposal_voting_summary.sql b/files/grest/rpc/governance/proposal_voting_summary.sql index da2a4e52..713493e2 100644 --- a/files/grest/rpc/governance/proposal_voting_summary.sql +++ b/files/grest/rpc/governance/proposal_voting_summary.sql @@ -1,3 +1,4 @@ + CREATE OR REPLACE FUNCTION grest.proposal_voting_summary(_proposal_id text) RETURNS TABLE ( proposal_type text, @@ -8,16 +9,19 @@ RETURNS TABLE ( drep_no_votes_cast integer, drep_no_vote_power lovelace, drep_no_pct numeric, + drep_abstain_votes_cast integer, pool_yes_votes_cast integer, pool_yes_vote_power lovelace, pool_yes_pct numeric, pool_no_votes_cast integer, pool_no_vote_power lovelace, pool_no_pct numeric, + pool_abstain_votes_cast integer, committee_yes_votes_cast integer, committee_yes_pct numeric, committee_no_votes_cast integer, - committee_no_pct numeric + committee_no_pct numeric, + committee_abstain_votes_cast integer ) LANGUAGE plpgsql AS $$ @@ -169,6 +173,7 @@ BEGIN y.drep_no_votes_cast::integer, (y.drep_non_abstain_total - y.drep_yes_vote_power)::lovelace AS drep_no_vote_power, ROUND((y.drep_non_abstain_total - y.drep_yes_vote_power) * 100 / y.drep_non_abstain_total, 2) AS drep_no_pct, + (SELECT COALESCE(SUM(active_drep_votes_cast), 0)::integer FROM active_prop_drep_votes WHERE vote = 'Abstain') AS drep_abstain_votes_cast, (CASE WHEN y.proposal_type IN ('ParameterChange', 'TreasuryWithdrawals', 'NewConstitution') THEN 0 ELSE y.pool_yes_votes_cast @@ -193,6 +198,7 @@ BEGIN WHEN y.proposal_type IN ('ParameterChange', 'TreasuryWithdrawals', 'NewConstitution') THEN 0 ELSE ROUND((y.pool_non_abstain_total - y.pool_yes_vote_power) * 100 / y.pool_non_abstain_total, 2) END) AS pool_no_pct, + (SELECT COALESCE(SUM(pool_votes_cast), 0)::integer FROM active_prop_pool_votes WHERE vote = 'Abstain') AS pool_abstain_votes_cast, y.committee_yes_votes_cast::integer, (CASE WHEN y.proposal_type IN ('NoConfidence', 'NewCommittee') THEN 0 @@ -205,7 +211,8 @@ BEGIN (CASE WHEN y.proposal_type IN ('NoConfidence', 'NewCommittee') THEN 0 ELSE ROUND((committee_non_abstain_total - y.committee_yes_votes_cast) * 100 / y.committee_non_abstain_total, 2) - END) AS committee_no_pct + END) AS committee_no_pct, + (SELECT COALESCE(SUM(committee_votes_cast), 0)::integer FROM committee_votes WHERE vote = 'Abstain') AS committee_abstain_votes_cast FROM ( SELECT diff --git a/files/grest/rpc/governance/voter_proposal_list.sql b/files/grest/rpc/governance/voter_proposal_list.sql index 46e575c5..18b132cb 100644 --- a/files/grest/rpc/governance/voter_proposal_list.sql +++ b/files/grest/rpc/governance/voter_proposal_list.sql @@ -63,7 +63,7 @@ BEGIN gap.type, gap.description, gap.deposit::text, - grest.cip5_hex_to_stake_addr(sa.hash_raw)::text, + grest.cip5_hex_to_stake_addr(sa.hash_raw)::varchar, b.epoch_no, gap.ratified_epoch, gap.enacted_epoch, @@ -81,7 +81,7 @@ BEGIN ELSE JSONB_BUILD_OBJECT( 'stake_address', ( - SELECT grest.cip5_hex_to_stake_addr(sa2.hash_raw)::text + SELECT grest.cip5_hex_to_stake_addr(sa2.hash_raw)::varchar FROM stake_address AS sa2 WHERE sa2.id = tw.stake_address_id ), diff --git a/specs/results/koiosapi-guild.yaml b/specs/results/koiosapi-guild.yaml index 22fb030f..d79c3b61 100644 --- a/specs/results/koiosapi-guild.yaml +++ b/specs/results/koiosapi-guild.yaml @@ -8,7 +8,7 @@ info: license: name: Creative Commons Attribution 4.0 International url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE - version: v1.2.0 + version: v1.2.1 description: | Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples. @@ -3061,7 +3061,7 @@ components: example: "31235800000" active_stake_pct: type: - - string + - number - 'null' description: Active stake for the pool, expressed as a percentage of total active stake on network example: 13.512182543475783 @@ -5494,6 +5494,10 @@ components: type: number description: Percentage of 'no' votes from dreps example: 39.28 + drep_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from dreps + example: 5 pool_yes_votes_cast: type: number description: Number of 'yes' votes casted by pools @@ -5518,6 +5522,9 @@ components: type: number description: Percentage of 'no' votes from pools example: 0 + pool_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from pools committee_yes_votes_cast: type: number description: Number of 'yes' votes casted by committee @@ -5534,6 +5541,9 @@ components: type: number description: Percentage of 'no' votes from committee example: 28.57 + committee_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from committee proposal_votes: type: array description: List of all votes cast on specified governance action diff --git a/specs/results/koiosapi-mainnet.yaml b/specs/results/koiosapi-mainnet.yaml index ba0d62e1..3fad91d1 100644 --- a/specs/results/koiosapi-mainnet.yaml +++ b/specs/results/koiosapi-mainnet.yaml @@ -8,7 +8,7 @@ info: license: name: Creative Commons Attribution 4.0 International url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE - version: v1.2.0 + version: v1.2.1 description: | Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples. @@ -3061,7 +3061,7 @@ components: example: "31235800000" active_stake_pct: type: - - string + - number - 'null' description: Active stake for the pool, expressed as a percentage of total active stake on network example: 13.512182543475783 @@ -5494,6 +5494,10 @@ components: type: number description: Percentage of 'no' votes from dreps example: 39.28 + drep_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from dreps + example: 5 pool_yes_votes_cast: type: number description: Number of 'yes' votes casted by pools @@ -5518,6 +5522,9 @@ components: type: number description: Percentage of 'no' votes from pools example: 0 + pool_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from pools committee_yes_votes_cast: type: number description: Number of 'yes' votes casted by committee @@ -5534,6 +5541,9 @@ components: type: number description: Percentage of 'no' votes from committee example: 28.57 + committee_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from committee proposal_votes: type: array description: List of all votes cast on specified governance action diff --git a/specs/results/koiosapi-preprod.yaml b/specs/results/koiosapi-preprod.yaml index 11d29f49..6ac8bc40 100644 --- a/specs/results/koiosapi-preprod.yaml +++ b/specs/results/koiosapi-preprod.yaml @@ -8,7 +8,7 @@ info: license: name: Creative Commons Attribution 4.0 International url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE - version: v1.2.0 + version: v1.2.1 description: | Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples. @@ -3061,7 +3061,7 @@ components: example: "31235800000" active_stake_pct: type: - - string + - number - 'null' description: Active stake for the pool, expressed as a percentage of total active stake on network example: 13.512182543475783 @@ -5494,6 +5494,10 @@ components: type: number description: Percentage of 'no' votes from dreps example: 39.28 + drep_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from dreps + example: 5 pool_yes_votes_cast: type: number description: Number of 'yes' votes casted by pools @@ -5518,6 +5522,9 @@ components: type: number description: Percentage of 'no' votes from pools example: 0 + pool_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from pools committee_yes_votes_cast: type: number description: Number of 'yes' votes casted by committee @@ -5534,6 +5541,9 @@ components: type: number description: Percentage of 'no' votes from committee example: 28.57 + committee_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from committee proposal_votes: type: array description: List of all votes cast on specified governance action diff --git a/specs/results/koiosapi-preview.yaml b/specs/results/koiosapi-preview.yaml index 390ba1c9..0c0ed67d 100644 --- a/specs/results/koiosapi-preview.yaml +++ b/specs/results/koiosapi-preview.yaml @@ -8,7 +8,7 @@ info: license: name: Creative Commons Attribution 4.0 International url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE - version: v1.2.0 + version: v1.2.1 description: | Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples. @@ -3061,7 +3061,7 @@ components: example: "31235800000" active_stake_pct: type: - - string + - number - 'null' description: Active stake for the pool, expressed as a percentage of total active stake on network example: 13.512182543475783 @@ -5494,6 +5494,10 @@ components: type: number description: Percentage of 'no' votes from dreps example: 39.28 + drep_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from dreps + example: 5 pool_yes_votes_cast: type: number description: Number of 'yes' votes casted by pools @@ -5518,6 +5522,9 @@ components: type: number description: Percentage of 'no' votes from pools example: 0 + pool_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from pools committee_yes_votes_cast: type: number description: Number of 'yes' votes casted by committee @@ -5534,6 +5541,9 @@ components: type: number description: Percentage of 'no' votes from committee example: 28.57 + committee_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from committee proposal_votes: type: array description: List of all votes cast on specified governance action diff --git a/specs/templates/1-api-info.yaml b/specs/templates/1-api-info.yaml index 6e3bf50f..de45e8c3 100644 --- a/specs/templates/1-api-info.yaml +++ b/specs/templates/1-api-info.yaml @@ -7,7 +7,7 @@ info: license: name: Creative Commons Attribution 4.0 International url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE - version: v1.2.0 + version: v1.2.1 description: | Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples. diff --git a/specs/templates/4-api-schemas.yaml b/specs/templates/4-api-schemas.yaml index a338603a..8fbd7947 100644 --- a/specs/templates/4-api-schemas.yaml +++ b/specs/templates/4-api-schemas.yaml @@ -226,7 +226,7 @@ schemas: example: "31235800000" active_stake_pct: type: - - string + - number - 'null' description: Active stake for the pool, expressed as a percentage of total active stake on network example: 13.512182543475783 @@ -2659,6 +2659,10 @@ schemas: type: number description: Percentage of 'no' votes from dreps example: 39.28 + drep_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from dreps + example: 5 pool_yes_votes_cast: type: number description: Number of 'yes' votes casted by pools @@ -2683,6 +2687,9 @@ schemas: type: number description: Percentage of 'no' votes from pools example: 0 + pool_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from pools committee_yes_votes_cast: type: number description: Number of 'yes' votes casted by committee @@ -2699,6 +2706,9 @@ schemas: type: number description: Percentage of 'no' votes from committee example: 28.57 + committee_abstain_votes_cast: + type: number + description: Percentage of 'abstain' votes from committee proposal_votes: type: array description: List of all votes cast on specified governance action