Skip to content

Commit

Permalink
feat: cip-119 support on haskell backend
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Aug 23, 2024
1 parent ce37326 commit d61c23c
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 246 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ changes.
- Add SPO and CC committee total votes to gov actions [Issue 1704](https://github.com/IntersectMBO/govtool/issues/1704)
- Add support for hard fork initiation governance action details [Issue 1600](https://github.com/IntersectMBO/govtool/issues/1600)
- Add support for hard fork initiation previous governance action data [Issue 1600](https://github.com/IntersectMBO/govtool/issues/1600)
- Add support for CIP-119 on the backend and metadata validation [Issue 1758](https://github.com/IntersectMBO/govtool/issues/1758)

### Fixed

Expand Down
12 changes: 11 additions & 1 deletion govtool/backend/sql/get-drep-info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,14 @@ SELECT
DRepRegister.tx_hash,
DRepRetire.tx_hash,
SoleVoterRegister.tx_hash,
SoleVoterRetire.tx_hash
SoleVoterRetire.tx_hash,
off_chain_vote_drep_data.payment_address,
off_chain_vote_drep_data.given_name,
off_chain_vote_drep_data.objectives,
off_chain_vote_drep_data.motivations,
off_chain_vote_drep_data.qualifications,
off_chain_vote_drep_data.image_url,
off_chain_vote_drep_data.image_hash
FROM
IsRegisteredAsDRep
CROSS JOIN IsRegisteredAsSoleVoter
Expand All @@ -189,3 +196,6 @@ FROM
CROSS JOIN DRepRetire
CROSS JOIN SoleVoterRegister
CROSS JOIN SoleVoterRetire
CROSS JOIN LatestRegistrationEntry
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = LatestRegistrationEntry.voting_anchor_id
LEFT JOIN off_chain_vote_drep_data ON off_chain_vote_drep_data.off_chain_vote_data_id = off_chain_vote_data.id
20 changes: 18 additions & 2 deletions govtool/backend/sql/list-dreps.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ SELECT
encode(dr_voting_anchor.tx_hash, 'hex') AS tx_hash,
newestRegister.time AS last_register_time,
COALESCE(latestDeposit.deposit, 0),
non_deregister_voting_anchor.url IS NOT NULL AS has_non_deregister_voting_anchor
non_deregister_voting_anchor.url IS NOT NULL AS has_non_deregister_voting_anchor,
off_chain_vote_drep_data.payment_address,
off_chain_vote_drep_data.given_name,
off_chain_vote_drep_data.objectives,
off_chain_vote_drep_data.motivations,
off_chain_vote_drep_data.qualifications,
off_chain_vote_drep_data.image_url,
off_chain_vote_drep_data.image_hash
FROM
drep_hash dh
JOIN (
Expand Down Expand Up @@ -89,6 +96,8 @@ FROM
AND DRepDistr.rn = 1
LEFT JOIN voting_anchor va ON va.id = dr_voting_anchor.voting_anchor_id
LEFT JOIN voting_anchor non_deregister_voting_anchor on non_deregister_voting_anchor.id = dr_non_deregister_voting_anchor.voting_anchor_id
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = va.id
LEFT JOIN off_chain_vote_drep_data on off_chain_vote_drep_data.off_chain_vote_data_id = off_chain_vote_data.id
CROSS JOIN DRepActivity
LEFT JOIN voting_procedure AS voting_procedure ON voting_procedure.drep_voter = dh.id
LEFT JOIN tx AS tx ON tx.id = voting_procedure.tx_id
Expand Down Expand Up @@ -128,4 +137,11 @@ GROUP BY
dr_voting_anchor.tx_hash,
newestRegister.time,
latestDeposit.deposit,
non_deregister_voting_anchor.url
non_deregister_voting_anchor.url,
off_chain_vote_drep_data.payment_address,
off_chain_vote_drep_data.given_name,
off_chain_vote_drep_data.objectives,
off_chain_vote_drep_data.motivations,
off_chain_vote_drep_data.qualifications,
off_chain_vote_drep_data.image_url,
off_chain_vote_drep_data.image_hash
136 changes: 0 additions & 136 deletions govtool/backend/sql/list-proposals-my.sql

This file was deleted.

16 changes: 15 additions & 1 deletion govtool/backend/src/VVA/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ drepRegistrationToDrep Types.DRepRegistration {..} =
dRepStatus = mapDRepStatus dRepRegistrationStatus,
dRepType = mapDRepType dRepRegistrationType,
dRepLatestTxHash = HexText <$> dRepRegistrationLatestTxHash,
dRepLatestRegistrationDate = dRepRegistrationLatestRegistrationDate
dRepLatestRegistrationDate = dRepRegistrationLatestRegistrationDate,
dRepPaymentAddress = dRepRegistrationPaymentAddress,
dRepGivenName = dRepRegistrationGivenName,
dRepObjectives = dRepRegistrationObjectives,
dRepMotivations = dRepRegistrationMotivations,
dRepQualifications = dRepRegistrationQualifications,
dRepImageUrl = dRepRegistrationImageUrl,
dRepImageHash = HexText <$> dRepRegistrationImageHash
}

delegationToResponse :: Types.Delegation -> DelegationResponse
Expand Down Expand Up @@ -286,6 +293,13 @@ drepInfo (unHexText -> dRepId) = do
, dRepInfoResponseDRepRetireTxHash = HexText <$> dRepInfoDRepRetireTx
, dRepInfoResponseSoleVoterRegisterTxHash = HexText <$> dRepInfoSoleVoterRegisterTx
, dRepInfoResponseSoleVoterRetireTxHash = HexText <$> dRepInfoSoleVoterRetireTx
, dRepInfoResponsePaymentAddress = dRepInfoPaymentAddress
, dRepInfoResponseGivenName = dRepInfoGivenName
, dRepInfoResponseObjectives = dRepInfoObjectives
, dRepInfoResponseMotivations = dRepInfoMotivations
, dRepInfoResponseQualifications = dRepInfoQualifications
, dRepInfoResponseImageUrl = dRepInfoImageUrl
, dRepInfoResponseImageHash = HexText <$> dRepInfoImageHash
}

getCurrentDelegation :: App m => HexText -> m (Maybe DelegationResponse)
Expand Down
Loading

0 comments on commit d61c23c

Please sign in to comment.