Skip to content

Commit

Permalink
feat: update RC interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ypatil12 committed Nov 6, 2024
1 parent 6210642 commit 3fbed49
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/contracts/core/DelegationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ contract DelegationManager is
require(staker != address(0), InputAddressZero());
address operator = delegatedTo[staker];
require(
msg.sender == staker || checkCanCall(operator)
msg.sender == staker || _checkCanCall(operator)
|| msg.sender == _operatorDetails[operator].delegationApprover,
CallerCannotUndelegate()
);
Expand Down
9 changes: 4 additions & 5 deletions src/contracts/core/RewardsCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,17 @@ contract RewardsCoordinator is
}

/// @inheritdoc IRewardsCoordinator
function setClaimerForStaker(
function setClaimerFor(
address claimer
) external {
require(!delegationManager.isOperator(msg.sender), UnauthorizedCaller());
address earner = msg.sender;
_setClaimer(earner, claimer);
}

/// @inheritdoc IRewardsCoordinator
function setClaimerForOperator(address operator, address claimer) external checkCanCall(operator) {
require(delegationManager.isOperator(operator), UnauthorizedCaller());
_setClaimer(operator, claimer);
// TODO: stakers can still use this function, no way to introspect that caller is an AVS. Need to add storage in ALM if an avs exists
function setClaimerFor(address earner, address claimer) external checkCanCall(earner) {
_setClaimer(earner, claimer);
}

/// @inheritdoc IRewardsCoordinator
Expand Down
1 change: 1 addition & 0 deletions src/contracts/interfaces/IAllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ interface IAllocationManager is ISignatureUtils, IAllocationManagerErrors, IAllo
* @dev Note that the `metadataURI` is *never stored* and is only emitted in the `AVSMetadataURIUpdated` event.
*/
function updateAVSMetadataURI(
address avs,
string calldata metadataURI
) external;

Expand Down
16 changes: 8 additions & 8 deletions src/contracts/interfaces/IRewardsCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -333,22 +333,22 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE
) external;

/**
* @notice Sets the address of the entity that can call `processClaim` on behalf of a staker
* @notice Sets the address of the entity that can call `processClaim` on ehalf of an earner
* @param claimer The address of the entity that can call `processClaim` on behalf of the earner
* @dev Only callable by the `earner` if it is a staker
* @dev Assumes msg.sender is the earner
*/
function setClaimerForStaker(
function setClaimerFor(
address claimer
) external;

/**
* @notice Sets the address of the entity that can call `processClaim` on behalf of an operator
* @param operator The address to set the claimer for
* @notice Sets the address of the entity that can call `processClaim` on behalf of an earner
* @param earner The address to set the claimer for
* @param claimer The address of the entity that can call `processClaim` on behalf of the earner
* @dev Only callable by or on behalf of an operator.
* @dev Only callable by an address that configures the claimer
*/
function setClaimerForOperator(
address operator,
function setClaimerFor(
address earner,
address claimer
) external;

Expand Down
30 changes: 15 additions & 15 deletions src/test/unit/RewardsCoordinatorUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ contract RewardsCoordinatorUnitTests is EigenLayerUnitTestSetup, IRewardsCoordin
}

contract RewardsCoordinatorUnitTests_initializeAndSetters is RewardsCoordinatorUnitTests {
function testFuzz_setClaimerForStaker(address earner, address claimer) public filterFuzzedAddressInputs(earner) {
function testFuzz_setClaimerFor(address earner, address claimer) public filterFuzzedAddressInputs(earner) {
cheats.startPrank(earner);
cheats.expectEmit(true, true, true, true, address(rewardsCoordinator));
emit ClaimerForSet(earner, rewardsCoordinator.claimerFor(earner), claimer);
rewardsCoordinator.setClaimerForStaker(claimer);
rewardsCoordinator.setClaimerFor(claimer);
assertEq(claimer, rewardsCoordinator.claimerFor(earner), "claimerFor not set");
cheats.stopPrank();
}
Expand Down Expand Up @@ -1447,7 +1447,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -1496,7 +1496,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -1545,7 +1545,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -1660,7 +1660,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -1694,7 +1694,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -1763,7 +1763,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -1804,7 +1804,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -1843,7 +1843,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -1884,7 +1884,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -1922,7 +1922,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -1960,7 +1960,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -2025,7 +2025,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down Expand Up @@ -2090,7 +2090,7 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests
address claimer;
if (setClaimerFor) {
cheats.prank(earner);
rewardsCoordinator.setClaimerForStaker(claimerFor);
rewardsCoordinator.setClaimerFor(claimerFor);
claimer = claimerFor;
} else {
claimer = earner;
Expand Down

0 comments on commit 3fbed49

Please sign in to comment.