Skip to content

Commit

Permalink
Deployed new contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
luloxi committed Oct 20, 2024
1 parent bcfad94 commit 42a1683
Show file tree
Hide file tree
Showing 9 changed files with 987 additions and 96 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ Social protocol where interactions are monetized 💰 allowing users to earn thr
-**Search**: By address or username
- ✅ Enable options for sharing on other platforms
-**Avalanche L1 with USDC as native gas:** Use an Avalanche L1 with USDC as native gas (Reference: [Create an Avalanche L1](https://docs.avax.network/tooling/create-deploy-avalanche-l1s/create-avalanche-l1))
- Enable liking with incentive
- ✅ Enable liking with incentive
- ✅ Enable posting with a fee to owner

## 📈 Phase 2 (Business model)

Expand Down
271 changes: 271 additions & 0 deletions packages/foundry/broadcast/Deploy.s.sol/7615243/run-1729412035.json

Large diffs are not rendered by default.

271 changes: 271 additions & 0 deletions packages/foundry/broadcast/Deploy.s.sol/7615243/run-1729412955.json

Large diffs are not rendered by default.

166 changes: 91 additions & 75 deletions packages/foundry/broadcast/Deploy.s.sol/7615243/run-latest.json

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions packages/foundry/contracts/PunkSociety.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ pragma solidity ^0.8.0;

import { PunkProfile } from "./PunkProfile.sol";
import { PunkPosts } from "./PunkPosts.sol";

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
// import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
// import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

Expand All @@ -12,7 +14,7 @@ struct Comment {
uint256 index;
}

contract PunkSociety {
contract PunkSociety is Ownable {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -92,7 +94,7 @@ contract PunkSociety {
CONSTRUCTOR FUNCTION
//////////////////////////////////////////////////////////////*/

constructor(address _punkProfile, address _punkPosts) {
constructor(address _punkProfile, address _punkPosts) Ownable(msg.sender) {
punkProfile = PunkProfile(_punkProfile);
punkPosts = PunkPosts(_punkPosts);
}
Expand All @@ -109,6 +111,7 @@ contract PunkSociety {
userPosts[msg.sender].push(postId);

punkPosts.mint(_tokenURI);
payable(owner()).transfer(3 ether);

emit PostCreated(postId, msg.sender, _tokenURI, block.timestamp);
}
Expand All @@ -130,7 +133,7 @@ contract PunkSociety {
require(
!userToPostLikes[msg.sender][_postID], "You have already liked this post"
);
require(msg.value == 0.1 ether, "Must send 0.1 ETH to like a post");
require(msg.value == 1 ether, "Must send 0.1 ETH to like a post");

address postOwner = postIdToUser[_postID];
require(postOwner != address(0), "Post owner does not exist");
Expand All @@ -139,7 +142,7 @@ contract PunkSociety {
postToLikes[_postID]++;

// Transfer 0.1 ETH to the post owner
(bool sent,) = postOwner.call{ value: 0.1 ether }("");
(bool sent,) = postOwner.call{ value: 1 ether }("");
require(sent, "Failed to send ETH to the post owner");

emit PostLiked(_postID, msg.sender, block.timestamp);
Expand All @@ -152,7 +155,7 @@ contract PunkSociety {
require(
userToPostLikes[msg.sender][_postID], "You have not liked this post yet"
);
require(msg.value == 0.1 ether, "Must send 0.1 ETH to unlike a post");
require(msg.value == 0.5 ether, "Must send 0.1 ETH to unlike a post");

address postOwner = postIdToUser[_postID];
require(postOwner != address(0), "Post owner does not exist");
Expand All @@ -161,7 +164,7 @@ contract PunkSociety {
postToLikes[_postID]--;

// Transfer 0.1 ETH to the post owner
(bool sent,) = postOwner.call{ value: 0.1 ether }("");
(bool sent,) = postOwner.call{ value: 0.5 ether }("");
require(sent, "Failed to send ETH to the post owner");

emit PostUnliked(_postID, msg.sender, block.timestamp);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useState } from "react";
import { PunkBalance } from "../PunkBalance";
import { useAccount } from "wagmi";
import { InputBase } from "~~/components/scaffold-eth";
import { useScaffoldWriteContract } from "~~/hooks/scaffold-eth";
Expand Down Expand Up @@ -45,9 +46,16 @@ export const SendUSDCModal = ({ modalId }: SendUSDCModalProps) => {
<label className="modal-box relative" htmlFor="">
<div className="flex flex-col justify-center items-center text-center gap-3">
<h2 className="text-xl">Transfer USDC to other address</h2>
<InputBase value={receiver} onChange={setReceiver} placeholder="Enter amount" />
<InputBase value={amount} onChange={setAmount} placeholder="Enter amount" />
<button className="btn btn-primary" onClick={handleTransfer}>

<InputBase value={receiver} onChange={setReceiver} placeholder="Enter receiver" />
<div className="flex flex-row justify-between items-center">
<PunkBalance address={connectedAddress} />
<InputBase value={amount} onChange={setAmount} placeholder="Enter amount" />
</div>
<button
className="btn btn-primary text-white bg-[#2E79CC] hover:bg-blue-700 active:bg-blue-700 border-0"
onClick={handleTransfer}
>
Transfer
</button>
<label
Expand Down
Loading

0 comments on commit 42a1683

Please sign in to comment.