From a2612c70b10eb1450e6b5f4847af797eef4516d9 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Wed, 19 Jun 2024 16:02:19 -0300 Subject: [PATCH] compile --- docs/staking-architecture.md | 2 ++ src/Staking.sol | 8 ++++---- src/interfaces/IRewardsDistributor.sol | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/staking-architecture.md b/docs/staking-architecture.md index 1063ac2..e49e655 100644 --- a/docs/staking-architecture.md +++ b/docs/staking-architecture.md @@ -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 diff --git a/src/Staking.sol b/src/Staking.sol index a5c797b..89fb521 100644 --- a/src/Staking.sol +++ b/src/Staking.sol @@ -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]; @@ -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; } } } diff --git a/src/interfaces/IRewardsDistributor.sol b/src/interfaces/IRewardsDistributor.sol index 0d608c4..c686c99 100644 --- a/src/interfaces/IRewardsDistributor.sol +++ b/src/interfaces/IRewardsDistributor.sol @@ -12,6 +12,8 @@ interface IRewardsDistributor { function distributeRewards() external; + function rewardTokens() external view returns (address[] memory); + function rewardConfigurations( address receiver, address token