Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
contract da76241 Nov 2, 2019
1 contributor

Users who have contributed to this file

203 lines (170 sloc) 5.84 KB
pragma solidity ^0.4.1;
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns(address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns(bool) {
return msg.sender == _owner;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns(uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns(uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns(uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns(uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns(uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
contract ERC20 {
function mint(address account, uint256 amount) external returns (bool);
}
contract DDOS is Ownable{
using SafeMath for * ;
uint256 starttime = 10;
uint256 public withdrawAmount = 0;
uint256 public devWithdrawAmount = 0;
uint256 secUint = 25 trx;
uint256 dev = 10; //10%
// constructor () public{
// tokenAddress = new ERC20("DDOS","ddos token",6);
// }
address tokenAddress;
function setERC20Address(address _tokenAddress) public onlyOwner{
tokenAddress = _tokenAddress;
}
function setStarttime(uint256 _starttime) public onlyOwner{
starttime = _starttime;
}
function devCal() private returns(uint256){
uint256 nowhave = block.timestamp.sub(starttime).mul(secUint).mul(dev).div(100).sub(devWithdrawAmount);
return nowhave;
}
function devWithdraw() public onlyOwner{
uint256 devNowhave = devCal();
address _owner = owner();
ERC20(tokenAddress).mint(_owner,devNowhave);
devWithdrawAmount = devWithdrawAmount.add(devNowhave);
}
function cal() private returns(uint256){
uint256 nowhave = block.timestamp.sub(starttime).mul(secUint).mul(90).div(100).sub(withdrawAmount);
uint256 send = nowhave.mul(1).div(10000);
withdrawAmount = withdrawAmount.add(send);
return send;
}
function getToken() public{
uint256 send = cal();
ERC20(tokenAddress).mint(msg.sender,send);
}
}
You can’t perform that action at this time.