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

feat: introduce return value for updatePrice to facilitate upkeep #18

Merged
merged 7 commits into from
Sep 18, 2024

Conversation

xenide
Copy link
Contributor

@xenide xenide commented Sep 13, 2024

While writing the keeper bot to update price ourselves as a last resort (after a period of unclaimed bounty), I realized one thing that needs improvement:

  • there is no easy way to simulate if a price update will pay a bounty.
    • in the previous iteration, keeper would require rpc infra, which simulates an updatePrice call, and then see if the receiving wallet indeed has received a reward
    • this is quite involved and not just simulating a call and reading its return value

So the proposed solution here is to add a return value such that:

  • MEV bots and our keeper can easily do a simulated call off chain to see if prices have indeed deviated beyond the threshold

Considerations

  • I've thought of returning the result as a bool, but decided that a uint256 would be more useful for bots to ascertain the exact rewards applicable

Other improvements

  • consolidate the ETH transfer in one call instead of transferring the bounty for each hop
  • fixed a bug where in multiple-hop routes, the threshold for each hop wasn't read

@xenide xenide requested a review from OliverNChalk September 13, 2024 17:28
@xenide xenide marked this pull request as ready for review September 13, 2024 17:29
Copy link
Contributor

@OliverNChalk OliverNChalk left a comment

Choose a reason for hiding this comment

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

Looks good, i do think mev bots should simulate to get the ETH transfer amount (check post balances) but this change looks good

src/ReservoirPriceOracle.sol Outdated Show resolved Hide resolved
@xenide xenide closed this Sep 18, 2024
@xenide xenide reopened this Sep 18, 2024
@xenide xenide merged commit b946c0c into dev Sep 18, 2024
5 checks passed
@xenide xenide deleted the feat/updatePrice-return-value branch September 18, 2024 14:03
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