GenieInPot / F3D

0 stars 2 forks source link

Need a 3-tier Referral System in Solidity #1

Open GenieInPot opened 6 years ago

GenieInPot commented 6 years ago

Need to be integrated to the F3D smart contract.

gitcoinbot commented 6 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 1.0 ETH (279.17 USD @ $279.17/ETH) attached to it.

StevenJNPearce commented 6 years ago

Please define the requirements more clearly.

What exactly is a "3-tier referral system"? It's a pyramid with 3 tiers? How should it work in this case? Need allot more information.

I don't have any moral opposition to implementing a MLM scheme, if people want to throw away their money it's not my problem. However without clear definition of the requirements you won't get me (or other Gitcoin users) to contribute if we don't have enough information to know if the work we do will be acceptable to you.

gitcoinbot commented 6 years ago

Issue Status: 1. Open 2. Cancelled


Work has been started.

These users each claimed they can complete the work by 2 hours ago. Please review their action plans below:

1) sameer2800 has been approved to start work.

Hi , regarding the question u asked in github, i am beginner to intermediate in solidity. i participated in EthIndia hackathon and a winner of nuCypher sponsor award.

here is my idea. i have a mapping from a person to his referral. lets say the name of the mapping is parent. 1) when a person puts a referral code, i store this referral address in parent mapping. now, i will check the parent of this referral is present in parent mapping. if not, i will give all 10% to one level parent. 2) if there is a parent for this address also, then i will go one step ahead in parent mapping. and i will distribute all the 10% among the three in 5, 3, 2 ratio.

I will be taking 1 or 2 days but i need some more info from your side. thank you.

Learn more on the Gitcoin Issue Details page.

GenieInPot commented 6 years ago

@StevenJNPearce Yes, It's a pyramid in 3 levels. I'm trying to tweak a current contract from F3D game. Right now they have only 1-level referral. Here's the code link (https://github.com/GenieInPot/F3D/blob/master/Fomo3Dlong.sol). If you want to run their contract, which is kinda messy, you do have to remove other libs and contracts they use in the code. I can help with that if needed.

In the original contract, once a player buys keys for say, 1 ETH, if he puts in a referral code, it will be saved in plyr_[_pID].laff. And that id of the player will get paid 10% of whatever amount the player purchase, which is 0.1ETH in this case.

What I want to do is to make it to be 3 levels. That is, once a player buys for 1 ETH, his direct referral gets 5%, 0.05 ETH, and one level above gets 3%, 0.03 ETH, and the top level gets 2%, 0.02ETH. If let's say the game just started, and the player just gets 2 levels above, the reward splits as 5% + 5%, which means the direct referral gets 5%, and top level gets 5%. If there's just only 1 level above, all 10% rewards go to the direct referral.

If the player doesn't use a referral code at all. Then he only gets 90% of the keys bought. The algorithm for calculating # of keys is in a separate contract, which you can find it here(https://github.com/GenieInPot/F3D/blob/master/F3DKeysCalcLong.sol).

sameer2800 commented 6 years ago

I am interested to work on this if it is still free.

GenieInPot commented 6 years ago

@sameer2800 It's still open. What's your level of experience with Solidity? Do you have some links to your previous work?

rstormsf commented 6 years ago

this can be easily done in solidity.

sameer2800 commented 6 years ago

@GenieInPot , i have beginner to intermediate level of experience on solidity. my recent work : https://github.com/sameer2800/project-butarin-new/tree/building-blockchain . also, i have sent you a mail, please verify.

GenieInPot commented 6 years ago

@rstormsf Awesome! How long do you think it can be finished? And do you mind to click start work on Gitcoin to get the bounty? Cheers.

GenieInPot commented 6 years ago

@sameer2800 Thanks for getting back. Check out your smart contract in the project. Seems like you still use a pretty old version of solidity 0.4.17. which the latest version we do is 0.4.24. There have been a few bug fixes and changes in new versions. I'm curious if there'are any particular reasons you still stick with the old one.

On a side note, I dont think it's a good idea to leave your seed and apikeys in your souce code ;)

sameer2800 commented 6 years ago

@GenieInPot ,thanks for suggestions. There was no particular reason on using 0.4.17, i was going through some old documentation and hence, i am using that version. yes,i should remove those keys.

rstormsf commented 6 years ago

@GenieInPot do u think I'll be interested to work on this just for the bounty :-))))

sameer2800 commented 6 years ago

@GenieInPot , i have raised a PR, please have a look. https://github.com/GenieInPot/F3D/pulls

GenieInPot commented 6 years ago

@sameer2800 Thanks for submitting the code! Have you tested it out yet? I don't think it'll work as required. Take a look at line # 1356 :

        uint256 _aff = _eth / 5;
        uint256 _affParent = _eth / 3;
        uint256 _affGrandParent = _eth / 2;
GenieInPot commented 6 years ago

@sameer2800 Actually I'm trying to approve your request on Gitcoin, but keep getting the error message 'Only the funder of this bounty may perform this action.'

Anyone has an idea about that?

gitcoinbot commented 6 years ago

@jebek29 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

sameer2800 commented 6 years ago

@GenieInPot , the denominators should be 20 ,33 , 50 for 5%, 3% and 2% tokens. I updated the PR. please have a look.

gitcoinbot commented 6 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 1.0 ETH (280.34 USD @ $280.34/ETH) has been submitted by:

  1. @sameer2800

If you are the bounty funder, please take a look at the submitted work:


GenieInPot commented 6 years ago

@sameer2800 Thanks for fixing the rates, but those aren't all of them. You've got the basic idea for the mechanism. But have you tried to compile the code to see if will pass at all ;)

GenieInPot commented 6 years ago

I'm kinda disappointed with Gitcoin right now. Maybe it's because my task is not exciting, I thought a simple task like this should be resolved in hours ;) Maybe it's a good idea for me to just spend a few hours to get it done myself.

sameer2800 commented 6 years ago

@GenieInPot ,i am sorry for that. I updated the PR and fixed the issues. Please review it.

sameer2800 commented 6 years ago

Hi @GenieInPot , any update on this task?

thelostone-mc commented 6 years ago

Hey @GenieInPot 👋 From the gitcoin core team here ! It's been a while since my man @sameer2800 has submitted his work. Could we have trigger the payout after reviewing his work?

vs77bb commented 6 years ago

@GenieInPot I see this comment above:

@sameer2800 Actually I'm trying to approve your request on Gitcoin, but keep getting the error message 'Only the funder of this bounty may perform this action.'

When you are ready to pay out, you'd need to make sure the same MetaMask account you used to fund the issue is unlocked. Let us know if you have any questions 👍

GenieInPot commented 6 years ago

Hi @GenieInPot , any update on this task?

Sorry got to distracted on some other stuff, and was not able to reply. The work you submitted has the basic logic, but not the production code we can use. I had to actually rewrite the whole piece by myself. But I'm okay to pay u 50% bounty if that works for you. @sameer2800

sameer2800 commented 6 years ago

I am happy to take.when u say production base ,may I know what is that I am missing there ?

GenieInPot commented 6 years ago

oh, to get a basic idea, the easiest way is to put your code in Remix. and it'll show all the warnings and tips.

GenieInPot commented 6 years ago

i'll just go ahead and pull the trigger. and again, thanks for all your work @sameer2800 !

sameer2800 commented 6 years ago

Hi @GenieInPot , i havent received the bounty. can u check please.

gitcoinbot commented 6 years ago

Issue Status: 1. Open 2. Cancelled


The funding of 1.0 ETH (236.2 USD @ $236.2/ETH) attached to this issue has been cancelled by the bounty submitter

sameer2800 commented 6 years ago

@GenieInPot , looks like the task has been cancelled and i havent received anything. can you please trigger the bounty.

spm32 commented 6 years ago

Hey @GenieInPot I noticed that the bounty was cancelled but @sameer2800 did make a PR. Is there a reason for not paying out?

GenieInPot commented 6 years ago

Now that is weird. What I did was to payout bounty, then Advanced Payout, then set 50% to payout. I even got the page says the transaction was set and waiting for results. Don't understand why it canceled the bounty!

GenieInPot commented 6 years ago

And I don't understand why i can still click payout bounty button, even the bounty is closed? Anyway, I go ahead and try to replicate the same process I did before. Here's the screenshot. https://imgur.com/a/HTiqBgI

sameer2800 commented 6 years ago

@ceresstation , can u help @GenieInPot here

vs77bb commented 6 years ago

@GenieInPot This is an issue on our side, we're tracking. Sorry about this. CC @mbeacom / @SaptakS for review on our side!

@GenieInPot mind paying out @sameer2800 using Gitcoin Tip? The 1ETH should be back in your wallet now, so you should be able to pay out accordingly 👍

gitcoinbot commented 6 years ago

⚡️ A tip worth 0.50000 ETH (114.56 USD @ $229.11/ETH) has been granted to @sameer2800 for this issue from @GenieInPot. ⚡️

The sender had the following public comments:

Bounty payout. Thanks!

Nice work @sameer2800! To redeem your tip, login to Gitcoin at https://gitcoin.co/explorer and select 'Claim Tip' from dropdown menu in the top right, or check your email for a link to the tip redemption page.

GenieInPot commented 6 years ago

Done! I @sameer2800 . https://etherscan.io/tx/0x0a5865fe60cdc79adabe5ca29b048a44dccff69c45e507b646e8912095119f18 Thanks guys for all the helps!