From 878bd34ef6607afe01f280cd5aedf3184fc4ca7b Mon Sep 17 00:00:00 2001 From: Ciara Nightingale Date: Fri, 7 Feb 2025 10:00:33 +0000 Subject: [PATCH] formatting --- src/LikeRegistry.sol | 18 ++++++++---------- src/MultiSig.sol | 2 +- src/SoulboundProfileNFT.sol | 21 +++++++++++++-------- test/testSoulboundProfileNFT.t.sol | 1 - 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/LikeRegistry.sol b/src/LikeRegistry.sol index 8fb0ae8..5efd567 100644 --- a/src/LikeRegistry.sol +++ b/src/LikeRegistry.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import "./SoulboundProfileNFT.sol"; +import "./SoulboundProfileNFT.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./MultiSig.sol"; -contract LikeRegistry is Ownable{ +contract LikeRegistry is Ownable { struct Like { address liker; address liked; @@ -24,13 +24,11 @@ contract LikeRegistry is Ownable{ event Liked(address indexed liker, address indexed liked); event Matched(address indexed user1, address indexed user2); - constructor(address _profileNFT) Ownable(msg.sender){ + constructor(address _profileNFT) Ownable(msg.sender) { profileNFT = SoulboundProfileNFT(_profileNFT); } - function likeUser( - address liked - ) external payable { + 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"); @@ -56,7 +54,7 @@ contract LikeRegistry is Ownable{ userBalances[to] = 0; uint256 totalRewards = matchUserOne + matchUserTwo; - uint256 matchingFees = (totalRewards * FIXEDFEE ) / 100; + uint256 matchingFees = (totalRewards * FIXEDFEE) / 100; uint256 rewards = totalRewards - matchingFees; totalFees += matchingFees; @@ -64,7 +62,7 @@ contract LikeRegistry is Ownable{ MultiSigWallet multiSigWallet = new MultiSigWallet(from, to); // Send ETH to the deployed multisig wallet - (bool success, ) = payable(address(multiSigWallet)).call{value: rewards}(""); + (bool success,) = payable(address(multiSigWallet)).call{value: rewards}(""); require(success, "Transfer failed"); } @@ -75,9 +73,9 @@ contract LikeRegistry is Ownable{ function withdrawFees() external onlyOwner { require(totalFees > 0, "No fees to withdraw"); uint256 totalFeesToWithdraw = totalFees; - + totalFees = 0; - (bool success, ) = payable(owner()).call{value: totalFeesToWithdraw}(""); + (bool success,) = payable(owner()).call{value: totalFeesToWithdraw}(""); require(success, "Transfer failed"); } diff --git a/src/MultiSig.sol b/src/MultiSig.sol index 19dcc41..8214cd0 100644 --- a/src/MultiSig.sol +++ b/src/MultiSig.sol @@ -72,7 +72,7 @@ contract MultiSigWallet { require(txn.approvedByOwner1 && txn.approvedByOwner2, "Not enough approvals"); txn.executed = true; - (bool success, ) = payable(txn.to).call{value: txn.value}(""); + (bool success,) = payable(txn.to).call{value: txn.value}(""); require(success, "Transaction failed"); emit TransactionExecuted(_txId, txn.to, txn.value); diff --git a/src/SoulboundProfileNFT.sol b/src/SoulboundProfileNFT.sol index cc738eb..b8fbf60 100644 --- a/src/SoulboundProfileNFT.sol +++ b/src/SoulboundProfileNFT.sol @@ -6,7 +6,6 @@ import "@openzeppelin/contracts/access/Ownable.sol"; import {Base64} from "@openzeppelin/contracts/utils/Base64.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; - contract SoulboundProfileNFT is ERC721, Ownable { error ERC721Metadata__URI_QueryFor_NonExistentToken(); error SoulboundTokenCannotBeTransferred(); @@ -54,7 +53,7 @@ contract SoulboundProfileNFT is ERC721, Ownable { emit ProfileBurned(msg.sender, tokenId); } - /// @notice App owner can block users + /// @notice App owner can block users function blockProfile(address blockAddress) external onlyOwner { uint256 tokenId = profileToToken[blockAddress]; require(tokenId != 0, "No profile found"); @@ -67,12 +66,12 @@ contract SoulboundProfileNFT is ERC721, Ownable { } /// @notice Override of transferFrom to prevent any transfer. - function transferFrom(address, address, uint256) public pure override{ + function transferFrom(address, address, uint256) public pure override { // Soulbound token cannot be transferred revert SoulboundTokenCannotBeTransferred(); } - function safeTransferFrom(address, address, uint256, bytes memory) public pure override{ + function safeTransferFrom(address, address, uint256, bytes memory) public pure override { // Soulbound token cannot be transferred revert SoulboundTokenCannotBeTransferred(); } @@ -91,10 +90,16 @@ contract SoulboundProfileNFT is ERC721, Ownable { Base64.encode( bytes( // bytes casting actually unnecessary as 'abi.encodePacked()' returns a bytes abi.encodePacked( - '{"name":"', profileName, '", ', - '"description":"A soulbound dating profile NFT.", ', - '"attributes": [{"trait_type": "Age", "value": ', Strings.toString(profileAge), '}], ', - '"image":"', imageURI, '"}' + '{"name":"', + profileName, + '", ', + '"description":"A soulbound dating profile NFT.", ', + '"attributes": [{"trait_type": "Age", "value": ', + Strings.toString(profileAge), + "}], ", + '"image":"', + imageURI, + '"}' ) ) ) diff --git a/test/testSoulboundProfileNFT.t.sol b/test/testSoulboundProfileNFT.t.sol index e9a5504..79e53da 100644 --- a/test/testSoulboundProfileNFT.t.sol +++ b/test/testSoulboundProfileNFT.t.sol @@ -32,7 +32,6 @@ contract SoulboundProfileNFTTest is Test { vm.prank(user); vm.expectRevert("Profile already exists"); soulboundNFT.mintProfile("Alice", 25, "ipfs://profileImage"); - } function testTokenURI() public {