Method _burn() is not getting called from any external or public method. Which will make this functionality unuseable.
Consider exposing an external or public method to call _burn().
+ struct UserStake {
+ uint256 supplyIndex;
+ uint256 balances;
+ uint256 claimable;
+ }
+
+ mapping(address => UserStake) usersStake;
- mapping(address => uint256) public supplyIndex;
+
- mapping(address => uint256) public balances;
+
- mapping(address => uint256) public claimable;
+
function updateFor(address recipient) public {
update();
- uint256 _supplied = balances[recipient];
+ UserStake storage userStake = usersStake[recipient];
+ uint256 _supplied = userStake.balances;
+ uint256 _updatedSupplyIndex = userStake.supplyIndex;
if (_supplied > 0) {
- uint256 _supplyIndex = supplyIndex[recipient];
- supplyIndex[recipient] = index;
+ uint256 _supplyIndex = _updatedSupplyIndex;
+ _updatedSupplyIndex = index;
uint256 _delta = index - _supplyIndex;
if (_delta > 0) {
uint256 _share = _supplied * _delta / 1e18;
- claimable[recipient] += _share;
+ userStake.claimable += _share;
}
} else {
- supplyIndex[recipient] = index;
+ _updatedSupplyIndex = index;
}
+ userStake.supplyIndex = _updatedSupplyIndex;
}
}