Skip to content

Commit

Permalink
RDC: token and crowdsale-0
Browse files Browse the repository at this point in the history
  • Loading branch information
vs committed Mar 14, 2018
0 parents commit 164e3be
Show file tree
Hide file tree
Showing 282 changed files with 36,045 additions and 0 deletions.
31 changes: 31 additions & 0 deletions contracts/CrowdsaleRDC0.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
pragma solidity ^0.4.18;


import 'zeppelin-solidity/contracts/crowdsale/validation/WhitelistedCrowdsale.sol';
import 'zeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol';
import 'zeppelin-solidity/contracts/token/ERC20/ERC20.sol';


/**
* @title CrowdsaleRDC0
* @dev Crowdsale-0
*/
contract CrowdsaleRDC0 is WhitelistedCrowdsale, TimedCrowdsale {

function CrowdsaleRDC0(ERC20 _token, uint256 _startTime, uint256 _finishTime, uint _rate) TimedCrowdsale(_startTime, _finishTime) Crowdsale( _rate, msg.sender, _token ) public payable {
}


function _forwardFunds() internal {
//eth don't transfer to another account / деньги не уходят на другой кошелек
//wallet.transfer(msg.value);
}

function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal onlyWhileOpen {
super._preValidatePurchase(_beneficiary, _weiAmount);
}

function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
token.transfer(_beneficiary, _tokenAmount);
}
}
23 changes: 23 additions & 0 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pragma solidity ^0.4.17;

contract Migrations {
address public owner;
uint public last_completed_migration;

modifier restricted() {
if (msg.sender == owner) _;
}

function Migrations() public {
owner = msg.sender;
}

function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}

function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
102 changes: 102 additions & 0 deletions contracts/TokenRDC.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
pragma solidity ^0.4.18;


import 'zeppelin-solidity/contracts/token/ERC20/BurnableToken.sol';
import 'zeppelin-solidity/contracts/token/ERC20/StandardToken.sol';
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';


/**
* @title TokenRDC
*
*/
contract TokenRDC is BurnableToken, StandardToken, Ownable {

string public constant name = "ROOMCOIN";

string public constant symbol = "RDC";

uint32 public constant decimals = 18;

uint256 public INITIAL_SUPPLY = 60000000 * (10 ** uint256(decimals));

address public currentCrowdsale;

function TokenRDC( address _foundation, address _team, address _BAP ) public {
require( _foundation != address(0x0));
require( _team != address(0x0));
require( _BAP != address(0x0));

uint256 dec = 10 ** uint256(decimals); //1000000000000000000;
totalSupply_ = INITIAL_SUPPLY;

/*
balances[msg.sender] = 39600000 * dec; // Public 66%
balances[_foundation] = 12000000 * dec; // Foundation 20%
balances[_team] = 6000000 * dec; // Team 10%
balances[_BAP] = 2400000 * dec; // Bounty, Advisor, Partnership 4%
*/

balances[msg.sender] = INITIAL_SUPPLY;
transfer( _foundation, 12000000 * dec ); // Foundation 20%
transfer( _team, 6000000 * dec ); // Team 10%
transfer( _BAP, 2400000 * dec ); // Bounty, Advisor, Partnership 4%
}

/**
* @dev transfer token to crowdsale's contract / переводим токены на адрес контратракта распродажи
* @param _crowdsale The address of crowdsale's contract.
*/
function startCrowdsale0( address _crowdsale ) onlyOwner public {
_startCrowdsale( _crowdsale, 4500000 );
}

/**
* @dev transfer token to crowdsale's contract / переводим токены на адрес контратракта распродажи
* @param _crowdsale The address of crowdsale's contract.
*/
function startCrowdsale1( address _crowdsale ) onlyOwner public {
_startCrowdsale( _crowdsale, 7920000 );
}

/**
* @dev transfer token to crowdsale's contract / переводим токены на адрес контратракта распродажи
* @param _crowdsale The address of crowdsale's contract.
*/
function startCrowdsale2( address _crowdsale ) onlyOwner public {
_startCrowdsale( _crowdsale, balances[owner] );
}

/**
* @dev transfer token to crowdsale's contract / переводим токены на адрес контратракта распродажи
* @param _crowdsale The address of crowdsale's contract.
* @param _value The amount to be transferred.
*/
function _startCrowdsale( address _crowdsale, uint256 _value ) onlyOwner internal {
require(currentCrowdsale == address(0));
currentCrowdsale = _crowdsale;
uint256 dec = 10 ** uint256(decimals);
uint256 val = _value * dec;
if( val > balances[owner] ) {
val = balances[ owner ];
}
transfer( _crowdsale, val );
}

/**
* @dev transfer token back to owner / переводим токены обратно владельцу контнракта
*
*/
function finishCrowdsale() onlyOwner public returns (bool) {
require(currentCrowdsale != address(0));
require( balances[currentCrowdsale] > 0 );

uint256 value = balances[ currentCrowdsale ];
balances[currentCrowdsale] = 0;
balances[owner] = balances[owner].add(value);
Transfer(currentCrowdsale, owner, value);

currentCrowdsale = address(0);
return true;
}
}
5 changes: 5 additions & 0 deletions migrations/1_initial_migration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var Migrations = artifacts.require("./Migrations.sol");

module.exports = function(deployer) {
deployer.deploy(Migrations);
};
7 changes: 7 additions & 0 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var TokenRDC = artifacts.require("./TokenRDC.sol");

module.exports = function(deployer) {
deployer.deploy(TokenRDC,"0x01","0x02","0x03");
//deployer.link(ConvertLib, MetaCoin);
//deployer.deploy(MetaCoin);
};
6 changes: 6 additions & 0 deletions node_modules/bn.js/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/bn.js/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 164e3be

Please sign in to comment.