Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/refferal contract #75

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open

Conversation

udkreddySomish
Copy link
Collaborator

Refferal amount can be claimed if the data is signed by the pre defined signer address.

@udkreddySomish udkreddySomish linked an issue Oct 22, 2020 that may be closed by this pull request
@nitika-goel nitika-goel requested a review from maxsam4 October 26, 2020 07:49
*/
modifier onlyOwner() {
require(owner == msg.sender, "Not owner");
_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

function claim(bytes calldata hash, uint8 v, bytes32 r, bytes32 s) external {
require(endDate > now, "Callable only before end date");
require(!userClaimed[msg.sender], "Already claimed");
require(msg.sender == abi.decode(hash, (address)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to take hash as input. Just use msg.sender as the hash.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

userClaimed[msg.sender] = true;
bLotToken.mint(msg.sender, refferalAmount);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest adding a function to change the signer in case the signer gets compromised or something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a function to update signer address

let signedHash = (await web3.eth.accounts.sign(hash, adminPrivateKey));

await refferal.claim(hash, signedHash.v, signedHash.r, signedHash.s, {from:user2});

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add asserts to make sure the correct amount of blot were minted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create contract for Referral Program
2 participants