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: comet library #176

Merged
merged 4 commits into from
Jan 27, 2025
Merged

feat: comet library #176

merged 4 commits into from
Jan 27, 2025

Conversation

0xsambugs
Copy link
Collaborator

@0xsambugs 0xsambugs commented Jan 24, 2025

This PR does two things. First, it introduces LibComet. This library reproduces some of the logic inside Comet's code to be able to calculate the amount of rewards owed to a certain account. But we do so in a view manner, without modifying the state

Then, this PR also introduces CometRewardsTracker. A new contract that exposes the code in LibComet, so that we can use it from our connector (this will done in another PR)

Testing
In order to make sure that this works as expected, we've done the following:

  1. We added a function to CometRewardsTracker that would compare our code's results with Comet's
  2. We added some fork tests that take a few accounts in some chains where Comet is deployed, and then it compares our calculation with Comet's, over different blocks

@0xsambugs 0xsambugs self-assigned this Jan 24, 2025
Copy link

github-actions bot commented Jan 24, 2025

Slither report

THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results.
Summary

@@ -268,6 +268,7 @@ abstract contract CompoundV3Connector is BaseConnector, Initializable {
uint256 rewardBalance = 0;
address rewardToken = cometRewards_.rewardConfig(address(cToken_)).token;
if (rewardToken != address(0)) {
// TODO: check if there is something to claim
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should check if there is something to claim before claiming it

Copy link
Contributor

Choose a reason for hiding this comment

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

This will be awesome!

@0xsambugs 0xsambugs requested a review from 0xKoaj January 24, 2025 18:34
Copy link
Contributor

@0xKoaj 0xKoaj left a comment

Choose a reason for hiding this comment

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

Great work!!

@0xsambugs 0xsambugs merged commit a524c1b into main Jan 27, 2025
5 checks passed
@0xsambugs 0xsambugs deleted the feat/comet-library branch January 27, 2025 14:36
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