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(#1758): add CIP-119 support on backend and metadata-validation #1811

Merged
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
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
113 changes: 0 additions & 113 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
Loading