This results in both users and the protocol owner being unable to access any tokens. The tokens remain locked and unrecoverable within the contract.
The following test demonstrates that balances are never updated, leading to an empty multiSig and preventing the owner from withdrawing fees. To aid debugging, an event has been added to the LikeRegistry
contract to log the multiSig address.
pragma solidity ^0.8.19;
import "forge-std/Test.sol";
import {MultiSigWallet} from "../src/MultiSig.sol";
import {LikeRegistry} from "../src/LikeRegistry.sol";
import {SoulboundProfileNFT} from "../src/SoulboundProfileNFT.sol";
contract LikeRegistryTest is Test {
SoulboundProfileNFT profileNFT;
LikeRegistry likeRegistry;
address loveBird1;
address loveBird2;
address owner;
function setUp() public {
owner = makeAddr("owner");
loveBird1 = makeAddr("loveBird1");
loveBird2 = makeAddr("loveBird2");
vm.deal(payable(loveBird1), 10 ether);
vm.deal(payable(loveBird2), 10 ether);
}
function test_userBalancesNotUpdated() public {
vm.startPrank(owner);
profileNFT = new SoulboundProfileNFT();
likeRegistry = new LikeRegistry(address(profileNFT));
vm.stopPrank();
vm.prank(loveBird1);
profileNFT.mintProfile("Alice", 25, "ipfs://profileImageAlice");
vm.prank(loveBird2);
profileNFT.mintProfile("Bob", 25, "ipfs://profileImageBob");
vm.prank(loveBird1);
likeRegistry.likeUser{value: 1 ether}(loveBird2);
uint256 userBalance = likeRegistry.userBalances(loveBird1);
assertEq(userBalance, 0);
console.log("User1's balance: ", userBalance);
vm.recordLogs();
vm.prank(loveBird2);
likeRegistry.likeUser{value: 1 ether}(loveBird1);
userBalance = likeRegistry.userBalances(loveBird2);
assertEq(userBalance, 0);
console.log("User2's balance: ", userBalance);
Vm.Log[] memory logs = vm.getRecordedLogs();
bytes32 walletAddressBytes = logs[2].topics[1];
address multiSigWalletAddress = address(uint160(uint256(walletAddressBytes)));
uint256 balance = address(multiSigWalletAddress).balance;
assertEq(balance, 0);
console.log("MultiSig's balance: ", balance);
vm.prank(owner);
vm.expectRevert();
likeRegistry.withdrawFees();
assertEq(owner.balance, 0);
console.log("Owner's balance: ", owner.balance);
}
}
Update the userBalances after a user likes another profile.
Modify the LikeRegistry::likeUser
function as follows: