This commit is contained in:
parent
5b65dfcc38
commit
878bd34ef6
@ -5,7 +5,7 @@ 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");
|
||||
}
|
||||
|
||||
@ -77,7 +75,7 @@ contract LikeRegistry is Ownable{
|
||||
uint256 totalFeesToWithdraw = totalFees;
|
||||
|
||||
totalFees = 0;
|
||||
(bool success, ) = payable(owner()).call{value: totalFeesToWithdraw}("");
|
||||
(bool success,) = payable(owner()).call{value: totalFeesToWithdraw}("");
|
||||
require(success, "Transfer failed");
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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();
|
||||
@ -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,
|
||||
'"}'
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user