Skip to content

Commit

Permalink
enhanced logging in DepositV3
Browse files Browse the repository at this point in the history
  • Loading branch information
DrZoltanFazekas committed Oct 8, 2024
1 parent b4660e4 commit b2820c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/DelegationV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,18 @@ contract DelegationV3 is Initializable, PausableUpgradeable, Ownable2StepUpgrade
require(success, "deposit failed");
}

event Log(uint256 _totalSupply, uint256 _msgValue, uint256 _getStake, uint256 _getReward, uint256 shares);
function stake() public payable whenNotPaused {
require(msg.value >= MIN_DELEGATION, "delegated amount too low");
//TODO: topup deposit by msg.value so that msg.value becomes part of getStake()
Storage storage $ = _getStorage();
uint256 shares = NonRebasingLST($.lst).totalSupply() * msg.value / (getStake() + getRewards());
uint256 _totalSupply = NonRebasingLST($.lst).totalSupply();
uint256 _msgValue = msg.value;
uint256 _getRewards = getRewards();
uint256 _getStake = getStake();
//uint256 shares = NonRebasingLST($.lst).totalSupply() * msg.value / (getStake() + getRewards());
uint256 shares = _totalSupply * _msgValue / (_getStake + _getRewards);
emit Log(_totalSupply, _msgValue, _getStake, _getRewards, shares);
NonRebasingLST($.lst).mint(msg.sender, shares);
emit Staked(msg.sender, msg.value, shares);
}
Expand Down

0 comments on commit b2820c5

Please sign in to comment.