Skip to content

Add RewardsDistributorAdmin, AutoRewardsDistributor and IRewardsDistributor#202

Merged
ElliotFriedman merged 22 commits intomasterfrom
rari-rewards-distributor-admin
Oct 4, 2021
Merged

Add RewardsDistributorAdmin, AutoRewardsDistributor and IRewardsDistributor#202
ElliotFriedman merged 22 commits intomasterfrom
rari-rewards-distributor-admin

Conversation

@ElliotFriedman
Copy link
Contributor

@ElliotFriedman ElliotFriedman commented Sep 29, 2021

Todo:

  • DAO script
  • E2E tests

Done:

  • Add emergency kill switch to RewardsDistributorAdmin to zero out supply or borrow speeds. This function is callable by governor and guardian
  • Unit testing
  • AutoRewardsDistributor
  • RewardsDistributorAdmin
  • Add passthrough functions in the RewardsDistributorAdmin function to enable all necessary calls to the RewardsDistributor function
  • Added ACL to RewardsDistributorAdmin that does not leverage core to make devops and deployment process simpler and lighter weight
  • Added pause functionality to both RewardsDistributorAdmin and AutoRewardsDistributor contract to stop setAutoRewardsDistribution in extenuating circumstances

Copy link
Contributor

Choose a reason for hiding this comment

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

here and elsewhere use canonical natspec annotations

Copy link
Contributor

@xklob xklob left a comment

Choose a reason for hiding this comment

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

Added some comments, but overall looks great so far!

Copy link
Contributor

Choose a reason for hiding this comment

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

what is this testing exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

testing that initial compSupplySpeeds are 0. I pass 0 address as this doesn't matter in the test because it is just hitting a mock.

Copy link
Contributor

Choose a reason for hiding this comment

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

call this AUTO_REWARDS_DISTRIBUTOR_ROLE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

/// @notice Governance should create new admin role for this contract
/// and then grant this role to all AutoRewardsDistributors so that they can call this contract
_setContractAdminRole(keccak256("REWARDS_DISTRIBUTOR_ADMIN_ROLE"));
_setContractAdminRole(keccak256("TRIBAL_CHIEF_ADMIN_ROLE"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment explaining why we reuse the TribalChief one

Copy link
Contributor

Choose a reason for hiding this comment

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

isborrowIncentivized is immutable state, same with cTokenAddress. These can be removed from the event. Normally events only want to emit changed/mutable state

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 10 to 18
Copy link
Contributor

Choose a reason for hiding this comment

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

All of these can be immutable except rewardDistributorAdmin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Copy link
Contributor

Choose a reason for hiding this comment

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

This should have an event

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

}

/**
* @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin
Copy link
Contributor

Choose a reason for hiding this comment

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

this comment is slightly inaccurate. "this" must be pendingAdmin not the sender

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just copy and pasted this comment from the rari codebase as it is a passthrough.

@ElliotFriedman ElliotFriedman merged commit 6987b6a into master Oct 4, 2021
@ElliotFriedman ElliotFriedman deleted the rari-rewards-distributor-admin branch October 4, 2021 23:17
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

Comments