-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathReferralV2.sol
More file actions
49 lines (39 loc) · 1.84 KB
/
ReferralV2.sol
File metadata and controls
49 lines (39 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Copyright (C) 2020 PlotX.io
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/ */
pragma solidity 0.5.7;
import "./Referral.sol";
contract ReferralV2 is Referral {
Referral public referralV1;
/**
* @dev Constructor
* @param _plotToken The address of PLOT token
* @param _bLotToken The address of BPlot token
* @param _endDate user can claim thier allocated amounts before this time.
* @param _budget total amount of BLot to be minted
*/
constructor(address _plotToken, address _bLotToken, address _signer, uint _endDate, uint _budget, uint _referralAmount, address _referralV1Address) public
Referral(_plotToken, _bLotToken, _signer, _endDate, _budget, _referralAmount){
referralV1 = Referral(_referralV1Address);
}
/**
* @dev Allows users to claim their allocated tokens.
* user should claim before end date.
*/
function claim(uint8 v, bytes32 r, bytes32 s) external {
require(endDate > now, "Callable only before end date");
require(!userClaimed[msg.sender] && !referralV1.userClaimed(msg.sender), "Already claimed");
bytes memory hash = abi.encode(msg.sender);
require(isValidSignature(hash, v, r, s));
userClaimed[msg.sender] = true;
bLotToken.mint(msg.sender, referralAmount);
}
}