8000 extracting APRs module by gmbronco · Pull Request #2027 · balancer/backend · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

extracting APRs module #2027

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

Merged
merged 40 commits into from
Jun 19, 2025
Merged

extracting APRs module #2027

merged 40 commits into from
Jun 19, 2025

Conversation

gmbronco
Copy link
Collaborator

No description provided.

Copy link
changeset-bot bot commented May 21, 2025

🦋 Changeset detected

Latest commit: ea559fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
backend Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR


let protocolFee = parseFloat(pool.dynamicData.protocolSwapFee);
if (pool.type === 'GYROE') {
protocolFee = parseFloat(pool.dynamicData.protocolYieldFee || '0');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems odd. Need to double check how we sync gyro protocol fees.

Comment on lines 22 to 43
10000
export type AprCalculatorType =
| 'swapFeeApr'
| 'boostedPoolApr'
| 'dynamicSwapFeeApr'
| 'gaugeApr'
| 'veBalProtocolApr'
| 'veBalVotingApr'
| 'morphoRewardsApr'
| 'ybTokensApr'
| 'aaveApiApr'
| 'masterchefFarmApr'
| 'reliquaryFarmApr'
| 'beetswarsGaugeVotingApr'
| 'quantAmmApr';

/**
* Configuration for APR calculators
*/
export interface AprCalculatorConfig {
type: AprCalculatorType;
params?: Record<string, any>;
}
Copy link
Collaborator
@franzns franzns Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AprCalculatorType and AprCalculatorConfig seems unused

Comment on lines 19 to 21
2. **Handlers Layer** - Contains pure calculation logic (`AprHandler` implementations)
3. **Configuration Layer** - Defines which calculators to use for each chain
4. **Manager Layer** - Coordinates calculators and persistence (`AprManager`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either call them Handlers or Calculators, its mixed currently.

private aprConfig: YbAprConfig,
chain: Chain,
) {
this.ybTokensAprHandlers = new YbAprHandlers(this.aprConfig, chain);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if we need to dissect the YbAprHandlers a bit as well. In a first run, I think we could copy them as-is and refactor them in a second phase.

@franzns franzns marked this pull request as ready for review June 16, 2025 13:37
@gmbronco
Copy link
Collaborator Author
gmbronco commented Jun 18, 2025

MaBeetsAprHandler updates prismaPoolStakingReliquaryFarmLevel, ideally it would be a separate action

@gmbronco
Copy link
Collaborator Author

Overall looks great, most of the services are returning APRs without any DB access. Few remarks:

  • use DI for the tokenService - I updated the LiquidityGaugeAprHandler and added an interface, so it's easy to pass in the constructors, but some handlers are still calling the DB directly, eg: quant amm
  • mix in side effects in the controllers, outside of the module, so it's easier to test and compose
  • nice to have: prismaPoolStakingReliquaryFarmLevel updates are mixed into the handler, possible to extract? your call.

@franzns franzns merged commit fbe8990 into v3-canary Jun 19, 2025
1 check passed
@franzns franzns deleted the aprs-module branch June 19, 2025 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0