The LikeRegistry contract lacks validation to prevent users from being matched with multiple partners simultaneously. This violates the expected monogamous matching behavior of a dating platform and creates potential for social and financial exploitation
function likeUser(address liked) external payable {
require(msg.value >= 1 ether, "Must send at least 1 ETH");
require(!likes[msg.sender][liked], "Already liked");
require(msg.sender != liked, "Cannot like yourself");
require(profileNFT.profileToToken(msg.sender) != 0, "Must have a profile NFT");
require(profileNFT.profileToToken(liked) != 0, "Liked user must have a profile NFT");
likes[msg.sender][liked] = true;
emit Liked(msg.sender, liked);
if (likes[liked][msg.sender]) {
matches[msg.sender].push(liked);
matches[liked].push(msg.sender);
emit Matched(msg.sender, liked);
matchRewards(liked, msg.sender);
}
}
function testMultipleMatches() public {
address alice = makeAddr("alice");
address bob = makeAddr("bob");
address charlie = makeAddr("charlie");
address dave = makeAddr("dave");
vm.deal(alice, 5 ether);
vm.deal(bob, 5 ether);
vm.deal(charlie, 5 ether);
vm.deal(dave, 5 ether);
vm.startPrank(alice);
soulboundNFT.mintProfile("Alice", 25, "ipfs://alice");
vm.stopPrank();
vm.startPrank(bob);
soulboundNFT.mintProfile("Bob", 28, "ipfs://bob");
vm.stopPrank();
vm.startPrank(charlie);
soulboundNFT.mintProfile("Charlie", 30, "ipfs://charlie");
vm.stopPrank();
vm.startPrank(dave);
soulboundNFT.mintProfile("Dave", 27, "ipfs://dave");
vm.stopPrank();
vm.prank(alice);
likeRegistry.likeUser{value: 1 ether}(bob);
vm.prank(bob);
likeRegistry.likeUser{value: 1 ether}(alice);
vm.prank(charlie);
likeRegistry.likeUser{value: 1 ether}(alice);
vm.prank(alice);
likeRegistry.likeUser{value: 1 ether}(charlie);
vm.prank(dave);
likeRegistry.likeUser{value: 1 ether}(alice);
vm.prank(alice);
likeRegistry.likeUser{value: 1 ether}(dave);
vm.prank(alice);
address[] memory aliceMatches = likeRegistry.getMatches();
assertEq(aliceMatches.length, 3);
assertEq(aliceMatches[0], bob);
assertEq(aliceMatches[1], charlie);
assertEq(aliceMatches[2], dave);
}