Skip to content

Commit

Permalink
feat: update PTokensClaimed event
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenvaleri committed Jul 22, 2024
1 parent 90a84e4 commit f3d90e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/PointTokenVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ contract PointTokenVault is UUPSUpgradeable, AccessControlUpgradeable, Multicall
event Deposit(address indexed depositor, address indexed receiver, address indexed token, uint256 amount);
event Withdraw(address indexed withdrawer, address indexed receiver, address indexed token, uint256 amount);
event RootUpdated(bytes32 prevRoot, bytes32 newRoot);
event PTokensClaimed(address indexed account, bytes32 indexed pointsId, uint256 amount);
event PTokensClaimed(address indexed account, address indexed receiver, bytes32 indexed pointsId, uint256 amount, uint256 fee);
event RewardsClaimed(
address indexed owner, address indexed receiver, bytes32 indexed pointsId, uint256 amount, uint256 fee
);
Expand Down Expand Up @@ -151,7 +151,7 @@ contract PointTokenVault is UUPSUpgradeable, AccessControlUpgradeable, Multicall

pTokens[pointsId].mint(_receiver, _claim.amountToClaim - pTokenFee); // Subtract mint fee.

emit PTokensClaimed(_account, pointsId, _claim.amountToClaim);
emit PTokensClaimed(_account, _receiver, pointsId, _claim.amountToClaim, pTokenFee);
}

function trustClaimer(address _account, bool _isTrusted) public {
Expand Down
4 changes: 4 additions & 0 deletions contracts/test/PointTokenVault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ contract PointTokenVaultTest is Test {
);
}

event PTokensClaimed(address indexed account, address indexed receiver, bytes32 indexed pointsId, uint256 amount, uint256 fee);

function test_Distribution() public {
// Merkle tree created from leaves [keccack(vitalik, pointsId, 1e18), keccack(toly, pointsId, 0.5e18)].
bytes32[] memory goodProof = new bytes32[](1);
Expand Down Expand Up @@ -271,6 +273,8 @@ contract PointTokenVaultTest is Test {

// Can claim with the right proof
vm.prank(vitalik);
vm.expectEmit(true, true, true, true);
emit PTokensClaimed(vitalik, vitalik, eigenPointsId, 1e18, 0);
pointTokenVault.claimPTokens(PointTokenVault.Claim(eigenPointsId, 1e18, 1e18, goodProof), vitalik, vitalik);

assertEq(pointTokenVault.pTokens(eigenPointsId).balanceOf(vitalik), 1e18);
Expand Down

0 comments on commit f3d90e6

Please sign in to comment.