Skip to content

Commit dfa46a8

Browse files
authored
Merge pull request #12 from ValantisLabs/feat/events
Feat/events
2 parents 9ae4d6c + 4ec38ee commit dfa46a8

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ docs/
1616
lcov.info
1717
lcov.info.pruned
1818
report
19-
coverage/
19+
coverage/
20+
broadcast/

src/Validly.sol

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ contract Validly is IValidly, ERC20, ReentrancyGuard {
188188

189189
(amount0, amount1) =
190190
pool.depositLiquidity(amount0, amount1, msg.sender, _verificationContext, abi.encode(msg.sender));
191+
192+
emit Deposit(msg.sender, _recipient, amount0, amount1, shares);
191193
}
192194

193195
/**
@@ -215,11 +217,13 @@ contract Validly is IValidly, ERC20, ReentrancyGuard {
215217
revert Validly__withdraw_invalidRecipient();
216218
}
217219

218-
(uint256 reserve0, uint256 reserve1) = pool.getReserves();
220+
{
221+
(uint256 reserve0, uint256 reserve1) = pool.getReserves();
219222

220-
uint256 totalSupplyCache = totalSupply();
221-
amount0 = Math.mulDiv(reserve0, _shares, totalSupplyCache);
222-
amount1 = Math.mulDiv(reserve1, _shares, totalSupplyCache);
223+
uint256 totalSupplyCache = totalSupply();
224+
amount0 = Math.mulDiv(reserve0, _shares, totalSupplyCache);
225+
amount1 = Math.mulDiv(reserve1, _shares, totalSupplyCache);
226+
}
223227

224228
if (amount0 == 0 || amount1 == 0) revert Validly__withdraw_AmountZero();
225229

@@ -234,6 +238,8 @@ contract Validly is IValidly, ERC20, ReentrancyGuard {
234238
_burn(msg.sender, _shares);
235239

236240
pool.withdrawLiquidity(amount0, amount1, msg.sender, _recipient, _verificationContext);
241+
242+
emit Withdraw(msg.sender, _recipient, amount0, amount1, _shares);
237243
}
238244

239245
/**

src/interfaces/IValidly.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import {ISovereignALM} from "@valantis-core/ALM/interfaces/ISovereignALM.sol";
55
import {ISovereignPool} from "@valantis-core/pools/interfaces/ISovereignPool.sol";
66

77
interface IValidly is ISovereignALM {
8+
event Deposit(address sender, address recipient, uint256 amount0, uint256 amount1, uint256 shares);
9+
10+
event Withdraw(address sender, address recipient, uint256 amount0, uint256 amount1, uint256 shares);
11+
812
function MINIMUM_LIQUIDITY() external view returns (uint256);
913

1014
function INVARIANT_CACHE_SLOT() external view returns (bytes32);

0 commit comments

Comments
 (0)