Ethereum Social Media Boilerplate

Thanks i did comment implementation and very little changes but as i just started React and also Javascript is general just now i didnt do it in an optimized way, however if you have any react solidity experience and would like to work together i would be happy build something togetherā€¦ i try to pull request my modification as soon as i figure out how to use github XD

thanks again Daniel, as i understood anyone can use addCategory function to add category right?
if it is then how it can be restricted to contract owner only?

another question i made a donation button on every post then i tried to make a similar function as Votes named Donates but instead of adding +1 to every click adds donate amount to table for every post,i copy pasted vote functionā€¦code below doesnt work when i call it and add nothing to donates table i also added listenerā€¦ you have any idea on this? it would be great help


    event Donated (bytes32 indexed postId, address indexed postOwner, address indexed donator, uint80 postDonations);
    struct post {
        address postOwner;
        bytes32 parentPost;
        bytes32 contentId;
        int40 votes;
        bytes32 categoryId;
        uint80 donates;
    }
    function donate (bytes32 _postId, uint80  _donationAdded) external 
    {
        address _donator = msg.sender;
        bytes32 _category = postRegistry[_postId].categoryId; 
        address _contributor = postRegistry[_postId].postOwner;
        require (postRegistry[_postId].postOwner != _donator, "you cannot donate your posts");       
        postRegistry[_postId].donates += _donationAdded;
        emit Donated(_postId, _contributor, _donator, postRegistry[_postId].donates);      
    }
    function getPost(bytes32 _postId) public view returns(address, bytes32, bytes32, int72, bytes32, uint80) {   
        return (
            postRegistry[_postId].postOwner,
            postRegistry[_postId].parentPost,
            postRegistry[_postId].contentId,
            postRegistry[_postId].votes,
            postRegistry[_postId].categoryId,
            postRegistry[_postId].donates);
    }

i did a pull request with comment and donate and image upload implement

Hi Saxon,

Your function currently will only increase the .donates portion of the struct for the value added as donation.

But Iā€™m curious what that donation entails. If you want the donor to actually transfer tokens to the post owner, it will be a bit more complex than the current implementation of the votes function. Also the implementation will vary whether you want the donor to transfer native tokens (i.e. ETH) or an ERC20 token.

1 Like

Thanks will take a look later on.

Actually i did the donate transfer part with moralis docs the user now can input amount of matic (native token) and send it to postOwner of each post and doesnt bother contract for that but when i click send i want also to call this function and add donates in database thats the part which doesnt work right now

You will have to sync the donated event to the server. It will register on a different table as there is one table per synced event.

1 Like

i launched Polytter.fun you can comment donate and get reputation also there is a profile and feed for everyone ā€¦ i would appreciate you to test it and anyone intrested in developing this project with huge potential is welcomed to participate in it ā€¦ also looking for teamā€¦ huge thanks to @DanielWeb3 though for his great help

Great job and amazing to here you have your dApp launched. Will definitely take a look.

1 Like

Hey, as well you can check.
https://docs.moralis.io/moralis-server/web3/web3#events
And research
web3.eth.net.getId():
Moralis.switchNetwork("");

With this you can automate network management. Have fun.

1 Like

thanks a lot for help i will do changes

Hey guys @Saxon & @DanielWeb3, have you seen this EIP3722 related to social media?

Here is a recent video interview with the proposer: https://www.youtube.com/watch?v=ZokZdg6OriM

1 Like

Interesting, however, not sure if an EIP level standard is needed for this.

It is quite limited in what you can do. The reddit clone for example could not be supported with this contract model.

2 Likes

Hi again i wonder how can users can choose different chain and moralis listen to different deployed contracts (what if i make same deploy address for contracts on all chains based on nounce). should i import chainId in all posts and change contract and then add 1 column (chainId) in all tables to differentiate every posts and if its that does it work? should i make a listener for every different address contract?

I am very new to all this I couldnā€™t find contracts address and will need a little help implementing all can I contact u over zoom or google meet

Hello you can make a new post with all the details of your problem.

Hello, thanks for the tutorial, Iā€™m trying to figure out how to generate my contract address while creating a new sync.

When you deploy your contract, you can wait for the transaction to be confirmed (so the contract is live), and then you can create a sync for an event from code (watching from code section).

Ohh okay, he just didnā€™t indicate where he was deploying the contract.

You can use a testnet like mumbai or goerli. It is up to you, you just have to change the chain in your wallet and any Moralis server settings when you want to interact with it to where the contract is deployed.