Skip to content
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

CS Note 8.4: Frontrunning Considerations for Off-Chain Infrastructure #498

Open
bingen opened this issue Oct 9, 2024 · 0 comments
Open

Comments

@bingen
Copy link
Collaborator

bingen commented Oct 9, 2024

Due to the risk of frontrunning, integrators should make sure to consider the following points when writing off-chain infrastructure:

  1. The function CollateralRegistry.redeemCollateral calculates the redemption fee based on the user-provided maximum redeemed amount, rather than the actual amount. If the user sets a _maxIterationsPerCollateral, they may not receive the maximum amount. This will result in receiving less collateral than expected, while still paying the same percentage fee. Similarily, if all but one branch is backed, a redemption could redeem all collateral on a branch and then escape.
  2. The user can also set a _maxFeePercentage, which will revert the transaction if the actual fee percentage is higher than expected. If the user is frontrun, the prior redemption will increase the basefee and reduce the total BOLD supply, so the fee will increase. This can cause their redemption to revert, as the user's specified _boldAmount would push the fee above the specified maximum. The user may want to write a wrapper contract that calculates the _boldAmount that can be redeemed without going above the _maxFeePercentage.
  3. The execution order of liquidations can influence subsequent liquidations through redistributions. A profitable redistribution could restore a previously liquidatable trove, while an unprofitable redistribution might cause a previously healthy trove to become liquidatable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant