Skip to content

Commit

Permalink
compile
Browse files Browse the repository at this point in the history
  • Loading branch information
anajuliabit committed Jun 19, 2024
1 parent 73f5afe commit a2612c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/staking-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ struct Stake {

#### `unstake(uint256 amount, uint256 stakeId)`

TODO improve description of lockPeriod

- The shares are burned when the keyper unstakes.
- The caller must have staked for at least `lockPeriod` for the specific stake.
- If amount is greater than the user balance, the contract will unstake the
Expand Down
8 changes: 4 additions & 4 deletions src/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ contract Staking is ERC20VotesUpgradeable, Ownable2StepUpgradeable {
rewardsDistributor.distributeRewards();

if (caller != address(0)) {
address[] rewardTokens = rewardsDistributor.rewardTokens();
address[] memory rewardTokens = rewardsDistributor.rewardTokens();

for (uint256 i = 0; i < rewardTokens.length; i++) {
address token = rewardTokens[i];
Expand All @@ -150,15 +150,15 @@ contract Staking is ERC20VotesUpgradeable, Ownable2StepUpgradeable {
.userRewardPerTokenPaid = balanceOf(caller);
}
} else {
uint256 rewardPerToken = rewardPerToken(token);
uint256 _rewardPerToken = rewardPerToken(token);

keyperRewards[caller][token].earned += (balanceOf(caller) *
(rewardPerToken -
(_rewardPerToken -
keyperRewards[caller][token]
.userRewardPerTokenPaid));

keyperRewards[caller][token]
.userRewardPerTokenPaid = rewardPerToken;
.userRewardPerTokenPaid = _rewardPerToken;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/IRewardsDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ interface IRewardsDistributor {

function distributeRewards() external;

function rewardTokens() external view returns (address[] memory);

function rewardConfigurations(
address receiver,
address token
Expand Down

0 comments on commit a2612c7

Please sign in to comment.