Guest User

Untitled

a guest
Jan 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. pragma solidity ^0.4.19;
  2.  
  3. import "./OldminToken.sol";
  4.  
  5. contract Crowdsale is Ownable{
  6.  
  7. using SafeMath for uint;
  8.  
  9. address owner;
  10.  
  11. address multisig;
  12.  
  13. uint hardcap;
  14.  
  15. OldminToken public token = new OldminToken();
  16.  
  17. uint start = 1512907200;
  18.  
  19. uint period = 30;
  20.  
  21. uint rate;
  22.  
  23. uint restrictedPercent;
  24.  
  25. address restricted;
  26.  
  27. function Crowdsale(){
  28. owner = msg.sender;
  29. multisig = 0xEA15Adb66DC92a4BbCcC8Bf32fd25E2e86a2A770;
  30. restricted = 0xb3eD172CC64839FB0C0Aa06aa129f402e994e7De;
  31. restrictedPercent = 40;
  32. rate = 100000000000000000000;
  33. hardcap = 10000000000000000000000;
  34. }
  35.  
  36. modifier saleIsOn(){
  37. require(now > start && now < start + period * 1 days);
  38. _;
  39. }
  40.  
  41. modifier isUnderHardCap(){
  42. require(multisig.balance <= hardcap);
  43. _;
  44. }
  45.  
  46. function createTokens() isUnderHardCap saleIsOn payable{
  47. multisig.transfer(msg.value);
  48. uint tokens = rate.mul(msg.value).div(1 ether);
  49. token.mint(msg.sender, tokens);
  50. }
  51.  
  52. function() external payable{
  53. createTokens();
  54. }
  55.  
  56. function finishMinting() public onlyOwner{
  57. uint issuedTokenSuply = token.totalSupply();
  58. uint restrictedTokens = issuedTokenSuply.mul(restrictedPercent).div(100 - restrictedPercent);
  59. token.mint(restricted, restrictedTokens);
  60. token.finishMinting();
  61. }
  62. }
Add Comment
Please, Sign In to add comment