-
Notifications
You must be signed in to change notification settings - Fork 14
feat: update proposal's value #570
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
base: master
Are you sure you want to change the base?
Conversation
af4325d
to
0e77cd4
Compare
Co-authored-by: Copilot <[email protected]>
1f8ae4e
to
0706ce6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates proposal value calculation functionality by implementing a new system to calculate and store the USD value of a proposal's total voting power. The change reduces database precision from 30 to 3 decimal places for better USD representation and adds comprehensive value calculation logic.
Key changes:
- Implements
getProposalValue
function to calculate proposal USD values based on voting power and strategy values - Updates database schema to use
DECIMAL(13,3)
precision forscores_total_value
column - Integrates value calculation into the proposal scoring workflow
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/helpers/entityValue.ts | New helper function to calculate proposal values with validation and error handling |
src/scores.ts | Integration of value calculation into proposal update workflow |
test/schema.sql | Database schema update to reduce decimal precision from (64,30) to (13,3) |
test/unit/helpers/entityValue.test.ts | Comprehensive test coverage for the new value calculation function |
Enhanced Proposal Value Calculation System
This PR refines the proposal value tracking system by implementing standardized precision and centralized
calculation logic for proposal USD values.
Key Features
🎯 Core Enhancement
scores_total_value
column precision fromDECIMAL(64,30)
toDECIMAL(13,3)
for optimized storage and performance (feat: set vote fiat value #566)🔧 Technical Implementation
src/helpers/entityValue.ts
creating a single source of truth for all value operationsDatabase Changes
scores_total_value
column fromDECIMAL(64,30)
toDECIMAL(13,3)
optimizing storage while maintaining appropriate precision for USD valuesTesting
Update the db with
scores_total_value
column, with the voter's total voting power x strategy value