Skip to content

Conversation

@czar0
Copy link

@czar0 czar0 commented Oct 29, 2025

The reserve amount needs to be multiplied by the delta between the token decimals and its own decimals.

  • Updated SecureMintPolicy.sol to compute reserve scaling based on the relative token/feed decimals, defaulting to 18 when a token omits decimals(), preventing PolicyRunError hits from mocks and ensuring negative/positive margins work as intended.
  • Added a private helper to safely retrieve token decimals via try/catch, keeping reserve calculations resilient against non-metadata ERC-20 implementations.

@czar0 czar0 requested a review from a team as a code owner October 29, 2025 15:29
@github-actions
Copy link

👋 czar0, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

try token.decimals() returns (uint8 value) {
return value;
} catch {
return 18;

Choose a reason for hiding this comment

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

Should this be 18 as per ERC20, or 0 like datafeeds have?

@czar0
Copy link
Author

czar0 commented Nov 4, 2025

Wrapping this PR in a new release

@czar0 czar0 closed this Nov 4, 2025
@czar0 czar0 deleted the bugfix/secure-mint-policy-scale-by-decimals branch November 4, 2025 16:49
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