Skip to content

Conversation

@matallui
Copy link

@matallui matallui commented Apr 2, 2025

What?

  • Implement a NativeTokenMaxLossEnforcer caveat enforcer, which enforces that your native token balance losses do not exceed a max value

Why?

  • A good example of this is when we want to enforce a simulation outcome but, more generally, it could be used to prevent certain types of attacks (e.g. red-pill attacks), by capping our max spending.

How?

  • This enforcer was based off of the NativeBalanceGteEnforcer, and the logic and tests were just adapted since we're now capping the losses, rather than guaranteeing a minimum gain.

Notes

As a side note, I had proposed to the team that we also rename our current *BalanceGteEnforcer caveat enforcers to *MinGainEnforcer, since that naming more accurately describes what it enforces IMO.

@matallui matallui requested a review from a team as a code owner April 2, 2025 01:56
@hanzel98
Copy link
Contributor

Duplicate: #90

@hanzel98 hanzel98 closed this Apr 24, 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