Skip to content

Commit

Permalink
change token name from REN to RED.
Browse files Browse the repository at this point in the history
  • Loading branch information
qtxie committed Jan 5, 2018
1 parent 2974a22 commit d79eefd
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 92 deletions.
12 changes: 6 additions & 6 deletions solc-input.json
Expand Up @@ -5,15 +5,15 @@
"node_modules/=../node_modules/"
],
"outputSelection": {
"RENToken.sol": {
"REDToken.sol": {
"*": [
"metadata",
"abi",
"evm.bytecode",
"evm.sourceMap"
]
},
"RENCrowdfund.sol": {
"REDCrowdfund.sol": {
"*": [
"metadata",
"abi",
Expand All @@ -24,14 +24,14 @@
}
},
"sources": {
"RENToken.sol": {
"REDToken.sol": {
"urls": [
"RENToken.sol"
"REDToken.sol"
]
},
"RENCrowdfund.sol": {
"REDCrowdfund.sol": {
"urls": [
"RENCrowdfund.sol"
"REDCrowdfund.sol"
]
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/RENCrowdfund.sol → src/REDCrowdfund.sol
Expand Up @@ -2,21 +2,21 @@ pragma solidity ^0.4.18;

import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
import "./RENToken.sol";
import "./REDToken.sol";

contract RENCrowdfund is Ownable {
contract REDCrowdfund is Ownable {

using SafeMath for uint;

bool public isOpen = false; // Is the crowd fund open?
address public tokenAddress; // Address of the deployed REN token contract
address public tokenAddress; // Address of the deployed RED token contract
address public wallet; // Address of secure wallet to receive crowdfund contributions

uint256 public weiRaised = 0;
uint256 public startsAt; // Crowdfund starting time (Epoch format)
uint256 public endsAt; // Crowdfund ending time (Epoch format)

RENToken public REN; // Instance of the REN token contract
REDToken public RED; // Instance of the RED token contract

/*----------------- Events -----------------*/

Expand Down Expand Up @@ -52,12 +52,12 @@ contract RENCrowdfund is Ownable {
// -------------------------------------------------
// Contract's constructor
// -------------------------------------------------
function RENCrowdfund(address _tokenAddress) public {
function REDCrowdfund(address _tokenAddress) public {
wallet = 0x123; // ICO wallet address
startsAt = 1515405600; // Jan 8th 2018, 18:00, GMT+8
endsAt = 1517479200; // Feb 1th 2018, 18:00, GMT+8
tokenAddress = _tokenAddress; // REN token Address
REN = RENToken(tokenAddress);
tokenAddress = _tokenAddress; // RED token Address
RED = REDToken(tokenAddress);
}

// -------------------------------------------------
Expand All @@ -73,33 +73,33 @@ contract RENCrowdfund is Ownable {
// -------------------------------------------------
function openCrowdfund() external onlyOwner returns (bool success) {
isOpen = true;
REN.startCrowdfund();
RED.startCrowdfund();
return true;
}

// -------------------------------------------------
// Function to buy REN. One can also buy REN by calling this function directly and send
// Function to buy RED. One can also buy RED by calling this function directly and send
// it to another destination.
// -------------------------------------------------
function buyTokens(address _to) public crowdfundIsActive nonZeroAddress(_to) nonZeroValue payable {
uint256 weiAmount = msg.value;
uint256 tokens;
uint price = 2500;

if (REN.isPreSaleStage()) {price = 2750;} // 10% discount for pre-sale
if (RED.isPreSaleStage()) {price = 2750;} // 10% discount for pre-sale
tokens = weiAmount * price;
weiRaised = weiRaised.add(weiAmount);
wallet.transfer(weiAmount);
if (!REN.transferFromCrowdfund(_to, tokens)) {revert();}
if (!RED.transferFromCrowdfund(_to, tokens)) {revert();}
TokenPurchase(_to, weiAmount, tokens);
}

// -------------------------------------------------
// Closes the crowdfunding. Any unsold REN will go back to the foundation.
// Closes the crowdfunding. Any unsold RED will go back to the foundation.
// -------------------------------------------------
function closeCrowdfund() external notBeforeCrowdfundEnds onlyOwner returns (bool success) {
AmountRaised(wallet, weiRaised);
REN.finalizeCrowdfund();
RED.finalizeCrowdfund();
isOpen = false;
return true;
}
Expand Down
56 changes: 28 additions & 28 deletions src/RENToken.sol → src/REDToken.sol
Expand Up @@ -4,14 +4,14 @@ import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
import "../node_modules/zeppelin-solidity/contracts/token/ERC20.sol";

contract RENToken is ERC20, Ownable {
contract REDToken is ERC20, Ownable {

using SafeMath for uint;

/*----------------- Token Information -----------------*/

string public constant name = "Red Exchange Note";
string public constant symbol = "REN";
string public constant name = "Red Community Token";
string public constant symbol = "RED";

uint8 public decimals = 18; // (ERC20 API) Decimal precision, factor is 1e18

Expand Down Expand Up @@ -43,7 +43,7 @@ contract RENToken is ERC20, Ownable {
PublicSale, // Public crowdsale state
Done // Ending state after ICO
}
icoStages stage; // Crowdfunding current state
icoStages stage; // Crowdfunding curREDt state

/*----------------- Events -----------------*/

Expand Down Expand Up @@ -113,7 +113,7 @@ contract RENToken is ERC20, Ownable {
}

// -------------------------------------------------
// Approves another address a certain amount of REN
// Approves another address a certain amount of RED
// -------------------------------------------------
function approve(address _spender, uint256 _value) public returns (bool success) {
require((_value == 0) || (allowance(msg.sender, _spender) == 0));
Expand All @@ -123,14 +123,14 @@ contract RENToken is ERC20, Ownable {
}

// -------------------------------------------------
// Gets an address's REN allowance
// Gets an address's RED allowance
// -------------------------------------------------
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}

// -------------------------------------------------
// Gets the REN balance of any address
// Gets the RED balance of any address
// -------------------------------------------------
function balanceOf(address _owner) public constant returns (uint256 balance) {
return accounts[_owner];
Expand All @@ -142,28 +142,28 @@ contract RENToken is ERC20, Ownable {
// -------------------------------------------------
// Contract's constructor
// -------------------------------------------------
function RENToken() public {
totalSupply = 200000000 * 1e18; // 100% - 200 million total REN with 18 decimals
function REDToken() public {
totalSupply = 200000000 * 1e18; // 100% - 200 million total RED with 18 decimals

angelSupply = 20000000 * 1e18; // 10% - 20 million REN for angels sale
privateEquitySupply = 48000000 * 1e18; // 24% - 48 million REN for pre-crowdsale
publicSupply = 12000000 * 1e18; // 6% - 12 million REN for the public crowdsale
redTeamSupply = 30000000 * 1e18; // 15% - 30 million REN for Red team
foundationSupply = 70000000 * 1e18; // 35% - 70 million REN for foundation/incentivising efforts
marketingSupply = 20000000 * 1e18; // 10% - 20 million REN for covering marketing and strategic expenses
angelSupply = 20000000 * 1e18; // 10% - 20 million RED for angels sale
privateEquitySupply = 48000000 * 1e18; // 24% - 48 million RED for pre-crowdsale
publicSupply = 12000000 * 1e18; // 6% - 12 million RED for the public crowdsale
redTeamSupply = 30000000 * 1e18; // 15% - 30 million RED for Red team
foundationSupply = 70000000 * 1e18; // 35% - 70 million RED for foundation/incentivising efforts
marketingSupply = 20000000 * 1e18; // 10% - 20 million RED for covering marketing and strategic expenses

presaleAmountRemaining = angelSupply + privateEquitySupply; // Decreased over the course of the pre-sale
redTeamAddress = 0x123; // Red Team address
foundationAddress = 0x123; // Foundation/Community address
marketingAddress = 0x123; // Marketing/Strategic address
redTeamAddress = 0x31aa507c140E012d0DcAf041d482e04F36323B03; // Red Team address
foundationAddress = 0x93e3AF42939C163Ee4146F63646Fb4C286CDbFeC; // Foundation/Community address
marketingAddress = 0x0; // Marketing/Strategic address

icoStartsAt = 1515405600; // Jan 8th 2018, 18:00, GMT+8
icoEndsAt = 1517479200; // Feb 1th 2018, 18:00, GMT+8
//angelLockingPeriod = icoEndsAt.add(90 days); // 3 months locking period
redTeamLockingPeriod = icoEndsAt.add(365 days); // 12 months locking period

addToBalance(foundationAddress, foundationSupply);
addToBalance(marketingAddress, marketingSupply);
//addToBalance(marketingAddress, marketingSupply);

stage = icoStages.Ready; // Initializes state
}
Expand Down Expand Up @@ -216,7 +216,7 @@ contract RENToken is ERC20, Ownable {
}

// -------------------------------------------------
// Finalizes presale. If some REN are left, let them overflow to the crowdfund
// Finalizes presale. If some RED are left, let them overflow to the crowdfund
// -------------------------------------------------
function finalizePresale() external onlyOwner returns (bool success) {
require(stage == icoStages.PreSale);
Expand All @@ -231,7 +231,7 @@ contract RENToken is ERC20, Ownable {
}

// -------------------------------------------------
// Finalizes crowdfund. If there are leftover REN, let them overflow to foundation
// Finalizes crowdfund. If there are leftover RED, let them overflow to foundation
// -------------------------------------------------
function finalizeCrowdfund() external onlyCrowdfund {
require(stage == icoStages.PublicSale);
Expand All @@ -246,11 +246,11 @@ contract RENToken is ERC20, Ownable {
}

// -------------------------------------------------
// Function to send REN to presale investors
// Function to send RED to presale investors
// -------------------------------------------------
function deliverPresaleRENaccounts(address[] _batchOfAddresses, uint[] _amountOfREN) external onlyOwner returns (bool success) {
function deliverPresaleRedaccounts(address[] _batchOfAddresses, uint[] _amountOfRED) external onlyOwner returns (bool success) {
for (uint256 i = 0; i < _batchOfAddresses.length; i++) {
deliverPresaleRENBalance(_batchOfAddresses[i], _amountOfREN[i]);
deliverPresaleREDBalance(_batchOfAddresses[i], _amountOfRED[i]);
}
return true;
}
Expand All @@ -268,11 +268,11 @@ contract RENToken is ERC20, Ownable {
// All presale purchases will be delivered. If one address has contributed more than once,
// the contributions will be aggregated
// -------------------------------------------------
function deliverPresaleRENBalance(address _accountHolder, uint _amountOfBoughtREN) internal onlyOwner {
function deliverPresaleREDBalance(address _accountHolder, uint _amountOfBoughtRED) internal onlyOwner {
require(presaleAmountRemaining > 0);
addToBalance(_accountHolder, _amountOfBoughtREN);
Transfer(0x0, _accountHolder, _amountOfBoughtREN);
presaleAmountRemaining = presaleAmountRemaining.sub(_amountOfBoughtREN);
addToBalance(_accountHolder, _amountOfBoughtRED);
Transfer(0x0, _accountHolder, _amountOfBoughtRED);
presaleAmountRemaining = presaleAmountRemaining.sub(_amountOfBoughtRED);
}

// -------------------------------------------------
Expand Down
20 changes: 10 additions & 10 deletions test/deploy.js
Expand Up @@ -20,8 +20,8 @@ const base = async (web3, solcOutput, accounts) => {
.forEach((name) => contractRegistry[name].NAME = name)

const {
RENToken,
RENCrowdfund
REDToken,
REDCrowdfund
} = contractRegistry

const deploy = async (Contract, ...arguments) => {
Expand All @@ -40,16 +40,16 @@ const base = async (web3, solcOutput, accounts) => {
})
}

const ren = await deploy(RENToken)
const renCrowdfund = await deploy(RENCrowdfund, ren.options.address)
const red = await deploy(REDToken)
const redCrowdfund = await deploy(REDCrowdfund, red.options.address)

await send(ren, DEPLOYER, 'setCrowdfundAddress', renCrowdfund.options.address)
await send(ren, DEPLOYER, 'changeFoundationAddress', FOUNDATION)
// await send(ren, DEPLOYER, 'changePrivateEquityAddress', BIZ)
await send(ren, DEPLOYER, 'changeRedTeamAddress', TEAM)
await send(renCrowdfund, DEPLOYER, 'changeWalletAddress', WALLET)
await send(red, DEPLOYER, 'setCrowdfundAddress', redCrowdfund.options.address)
await send(red, DEPLOYER, 'changeFoundationAddress', FOUNDATION)
await send(red, DEPLOYER, 'changeMarketingAddress', BIZ)
await send(red, DEPLOYER, 'changeRedTeamAddress', TEAM)
await send(redCrowdfund, DEPLOYER, 'changeWalletAddress', WALLET)

return {ren, renCrowdfund}
return {red, redCrowdfund}
}

module.exports = {
Expand Down

0 comments on commit d79eefd

Please sign in to comment.