Adding support for a percentage recover by the DAO section added by kaicudon (some fixes integration by p1r0)

This commit is contained in:
p1r0 2019-03-08 18:46:20 -06:00
parent 9dffb27b23
commit 5ebded09cc
1 changed files with 17 additions and 15 deletions

View File

@ -1,17 +1,19 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// 'SC1' Decentralized Carbon Credits initial token distribution event // 'DECA' DEcentralized CArbon tokens - ITDE (initial token distribution event)
// //
// Deployed to : 0xB022F4332cAE44156Cb77Fd4c70e1585C74F0656 // Deployed to : 0xA3137012E5285D655768535CA6a0140F79f25D9c
// Symbol : SC1 // Network : Ropsten
// Name : Decentralized Carbon Credits // Symbol : DECA
// Name : DEcentralized CArbon tokens
// Total supply: Gazillion // Total supply: Gazillion
// Decimals : 18 // Decimals : 18
// //
// Enjoy. // Enjoy.
// //
// (c) by Moritz Neto & Daniel Bar with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence. // (c) by Moritz Neto & Daniel Bar with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence.
// fork and modifications to fix DECA's ICO needs by p1r0 <p1r0@neetsec.com> and kaicudon <kaicudon@neetsec.com>
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -104,7 +106,7 @@ contract Owned {
// ERC20 Token, with the addition of symbol, name and decimals and assisted // ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers // token transfers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
contract SC1Token is ERC20Interface, Owned, SafeMath { contract DECAToken is ERC20Interface, Owned, SafeMath {
string public symbol; string public symbol;
string public name; string public name;
uint8 public decimals; uint8 public decimals;
@ -121,8 +123,8 @@ contract SC1Token is ERC20Interface, Owned, SafeMath {
// Constructor // Constructor
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
constructor () public { constructor () public {
symbol = "SC1"; symbol = "DECA";
name = "Decentralized Carbon Credits"; name = "DEcentralized CArbon tokens";
decimals = 18; decimals = 18;
bonusEnds = now + 1 weeks; bonusEnds = now + 1 weeks;
endDate = now + 7 weeks; endDate = now + 7 weeks;
@ -214,7 +216,7 @@ contract SC1Token is ERC20Interface, Owned, SafeMath {
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// 1,000 SC1 Tokens per 1 ETH // 1,000 DECA Tokens per 1 ETH
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
function () public payable { function () public payable {
require(now >= startDate && now <= endDate); require(now >= startDate && now <= endDate);
@ -223,20 +225,20 @@ contract SC1Token is ERC20Interface, Owned, SafeMath {
uint toSender; uint toSender;
uint percentage; uint percentage;
per = 10; // percentage that goes to the owner percentage = 10; // percentage that goes to the owner
if (now <= bonusEnds) { if (now <= bonusEnds) {
tokens = msg.value * 1200; tokens = msg.value * 1200;
} else { } else {
tokens = msg.value * 1000; tokens = msg.value * 1000;
} }
toowner = tokens / 10; // value assigned to owner as profit toOwner = tokens / percentage; // percentage assigned to the contract owner (DAO)
tosender = tokens - toowner; // remainder that goes to sender toSender = tokens; // tokens goes to sender
balances[msg.sender] = safeAdd(balances[msg.sender], tosender); balances[msg.sender] = safeAdd(balances[msg.sender], toSender);
balances[owner] = safeAdd(balances[owner], toowner); balances[owner] = safeAdd(balances[owner], toOwner);
_totalSupply = safeAdd(_totalSupply, tokens); _totalSupply = safeAdd(_totalSupply, tokens);
emit Transfer(address(0), msg.sender, tosender); emit Transfer(address(0), msg.sender, toSender);
emit Transfer(address(0), owner, toowner); emit Transfer(address(0), owner, toOwner);
owner.transfer(msg.value); owner.transfer(msg.value);
} }