Skip to content

feat: Add UInt256 precision improvements to DeFiBlocks#12

Closed
nialexsan wants to merge 1 commit into
mainfrom
feat/uint256-precision-improvements
Closed

feat: Add UInt256 precision improvements to DeFiBlocks#12
nialexsan wants to merge 1 commit into
mainfrom
feat/uint256-precision-improvements

Conversation

@nialexsan

Copy link
Copy Markdown
Contributor
  • Add DFBMathUtils contract for high-precision math operations
  • Create DFBv2 with AutoBalancerV2 using UInt256 calculations
  • Add AutoBalancerV2Adapter with utility functions
  • Include comprehensive tests demonstrating precision improvements
  • Add documentation explaining the improvements and migration guide

This follows the same pattern as TidalProtocol's precision upgrade, providing 18-decimal fixed-point arithmetic for better accuracy in DeFi calculations.

- Add DFBMathUtils contract for high-precision math operations
- Create DFBv2 with AutoBalancerV2 using UInt256 calculations
- Add AutoBalancerV2Adapter with utility functions
- Include comprehensive tests demonstrating precision improvements
- Add documentation explaining the improvements and migration guide

This follows the same pattern as TidalProtocol's precision upgrade,
providing 18-decimal fixed-point arithmetic for better accuracy in
DeFi calculations.
@sisyphusSmiling

Copy link
Copy Markdown
Contributor

To be honest, I doubt the source of discrepancies originate from the AutoBalancer's decimal precision. Even after the precision refactor, the protocol pulls funds by UFix64 amounts, so IMO it's unlikely that the lack of precision here would cause errors. Particularly because all values related to the AutoBalancer - contained balances, prices, time, thresholds are all UFix64.

Additionally, I would really hope that Sourceconnectors integrating with TidalProtocol don't need to manage balances via UInt256 as that's quite a dev ex hurdly given Cadence-native tokens us UFix64.

That said, I think we should integrate this branch as a last resort after pulling latest from onflow/FlowALP#31 into the end-to-end test scenarios.

@nialexsan

Copy link
Copy Markdown
Contributor Author

merged another change #14

@nialexsan nialexsan closed this Aug 5, 2025
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.

3 participants