Skip to content

Commit

Permalink
IDO Test
Browse files Browse the repository at this point in the history
  • Loading branch information
sudiptab2100 committed Jun 3, 2021
1 parent 23d741b commit aff9f64
Show file tree
Hide file tree
Showing 9 changed files with 22,033 additions and 10,130 deletions.
19,686 changes: 11,348 additions & 8,338 deletions build/contracts/IDO.json

Large diffs are not rendered by default.

242 changes: 121 additions & 121 deletions build/contracts/IStaker.json

Large diffs are not rendered by default.

9,897 changes: 9,897 additions & 0 deletions build/contracts/TestToken.json

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion contracts/IDOStaker/IDO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract IDO is Ownable, ReentrancyGuard {
uint256 public idoPrice; // Price of 1 Tokens in Wei

// Time Stamps
uint256 public constant unit = 1 hours;
uint256 public constant unit = 1 seconds;
uint256 public constant lockDuration = 7 * 24 * unit;
uint256 public constant regDuration = 48 * unit;
uint256 public constant saleStartsAfter = regDuration + 24 * unit;
Expand Down Expand Up @@ -102,8 +102,10 @@ contract IDO is Ownable, ReentrancyGuard {
}

function initialize(uint256 time) external onlyOwner notInitialized {
require(time >= block.timestamp, "IDO Can't Be in Past");
regStarts = time;
saleStarts = regStarts + saleStartsAfter;
require(idoToken.balanceOf(address(this)) >= idoAmount, "Not Enough Tokens In Contract");
}

function register(uint256 _poolNo)
Expand Down Expand Up @@ -145,4 +147,17 @@ contract IDO is Ownable, ReentrancyGuard {
idoToken.transfer(msg.sender, amount);
}

function recoverEth(address to) external onlyOwner {
(bool sent,) = address(to).call{value : address(this).balance}("");
require(sent, 'Unable To Recover Eth');
}

function recoverERC20(
address tokenAddress,
address to
) external onlyOwner {
IERC20Metadata tok = IERC20Metadata(tokenAddress);
tok.transfer(to, tok.balanceOf(address(this)));
}

}
12 changes: 12 additions & 0 deletions contracts/Tokens/TestToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";

contract TestToken is ERC20 {

constructor () ERC20("TestToken", "TeTo") {
_mint(msg.sender, 10000000 * (10 ** uint256(decimals())));
}

}
Loading

0 comments on commit aff9f64

Please sign in to comment.