diff --git a/.gitignore b/.gitignore index 5add475..05236e7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ docs/ lcov.info lcov.info.pruned report -coverage/ \ No newline at end of file +coverage/ +broadcast/ \ No newline at end of file diff --git a/src/Validly.sol b/src/Validly.sol index 06676f3..3da9713 100644 --- a/src/Validly.sol +++ b/src/Validly.sol @@ -188,6 +188,8 @@ contract Validly is IValidly, ERC20, ReentrancyGuard { (amount0, amount1) = pool.depositLiquidity(amount0, amount1, msg.sender, _verificationContext, abi.encode(msg.sender)); + + emit Deposit(msg.sender, _recipient, amount0, amount1, shares); } /** @@ -215,11 +217,13 @@ contract Validly is IValidly, ERC20, ReentrancyGuard { revert Validly__withdraw_invalidRecipient(); } - (uint256 reserve0, uint256 reserve1) = pool.getReserves(); + { + (uint256 reserve0, uint256 reserve1) = pool.getReserves(); - uint256 totalSupplyCache = totalSupply(); - amount0 = Math.mulDiv(reserve0, _shares, totalSupplyCache); - amount1 = Math.mulDiv(reserve1, _shares, totalSupplyCache); + uint256 totalSupplyCache = totalSupply(); + amount0 = Math.mulDiv(reserve0, _shares, totalSupplyCache); + amount1 = Math.mulDiv(reserve1, _shares, totalSupplyCache); + } if (amount0 == 0 || amount1 == 0) revert Validly__withdraw_AmountZero(); @@ -234,6 +238,8 @@ contract Validly is IValidly, ERC20, ReentrancyGuard { _burn(msg.sender, _shares); pool.withdrawLiquidity(amount0, amount1, msg.sender, _recipient, _verificationContext); + + emit Withdraw(msg.sender, _recipient, amount0, amount1, _shares); } /** diff --git a/src/interfaces/IValidly.sol b/src/interfaces/IValidly.sol index b2ec41a..792e7e2 100644 --- a/src/interfaces/IValidly.sol +++ b/src/interfaces/IValidly.sol @@ -5,6 +5,10 @@ import {ISovereignALM} from "@valantis-core/ALM/interfaces/ISovereignALM.sol"; import {ISovereignPool} from "@valantis-core/pools/interfaces/ISovereignPool.sol"; interface IValidly is ISovereignALM { + event Deposit(address sender, address recipient, uint256 amount0, uint256 amount1, uint256 shares); + + event Withdraw(address sender, address recipient, uint256 amount0, uint256 amount1, uint256 shares); + function MINIMUM_LIQUIDITY() external view returns (uint256); function INVARIANT_CACHE_SLOT() external view returns (bytes32);