From cfbfaad17192bce6ccb568cab9cbddf5355356ca Mon Sep 17 00:00:00 2001 From: p1r0 Date: Mon, 11 Mar 2019 23:49:18 -0600 Subject: [PATCH 1/3] Beta version testing with days instead of weeks --- DECA_ERC20_0.4.18.sol | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/DECA_ERC20_0.4.18.sol b/DECA_ERC20_0.4.18.sol index 0507ce1..ebd592c 100644 --- a/DECA_ERC20_0.4.18.sol +++ b/DECA_ERC20_0.4.18.sol @@ -3,8 +3,8 @@ pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // 'DECA' DEcentralized CArbon tokens - ITDE (initial token distribution event) // -// Deployed to : 0xA3137012E5285D655768535CA6a0140F79f25D9c -// Network : Ropsten +// Deployed to : 0x639A1c28d2d32587d6294067deb982E229b8C132 +// Network : Rinkeby // Symbol : DECA // Name : DEcentralized CArbon tokens // Total supply: Gazillion @@ -112,7 +112,9 @@ contract DECAToken is ERC20Interface, Owned, SafeMath { uint8 public decimals; uint public _totalSupply; uint public startDate; - uint public bonusEnds; + uint public preICOEnds; + uint public bonus1Ends; + uint public bonus2Ends; uint public endDate; mapping(address => uint) balances; @@ -126,8 +128,11 @@ contract DECAToken is ERC20Interface, Owned, SafeMath { symbol = "DECA"; name = "DEcentralized CArbon tokens"; decimals = 18; - bonusEnds = now + 1 weeks; - endDate = now + 7 weeks; + //for testing change weeks for days... + preICOEnds = now + 1 days; + bonus1Ends = now + 3 days; + bonus2Ends = now + 6 days; + endDate = now + 11 days; } @@ -227,10 +232,14 @@ contract DECAToken is ERC20Interface, Owned, SafeMath { percentage = 10; // percentage that goes to the owner - if (now <= bonusEnds) { - tokens = msg.value * 1200; + if (now <= preICOEnds) { + tokens = msg.value * 20000; + } else if (now > preICOEnds && now <= bonus1Ends ) { + tokens = msg.value * 15000; + } else if (now > bonus1Ends && now <= bonus2Ends) { + tokens = msg.value * 12500; } else { - tokens = msg.value * 1000; + tokens = msg.value * 10000; } toOwner = tokens / percentage; // percentage assigned to the contract owner (DAO) toSender = tokens; // tokens goes to sender From a968dfbd8e0737be1ae22e5561da58f96bf87003 Mon Sep 17 00:00:00 2001 From: p1r0 Date: Tue, 12 Mar 2019 00:13:22 -0600 Subject: [PATCH 2/3] Adding the JSON Interface code --- DECA_IERC20_0.4.18.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 DECA_IERC20_0.4.18.json diff --git a/DECA_IERC20_0.4.18.json b/DECA_IERC20_0.4.18.json new file mode 100644 index 0000000..6f075da --- /dev/null +++ b/DECA_IERC20_0.4.18.json @@ -0,0 +1 @@ +[ { "constant": true, "inputs": [], "name": "name", "outputs": [ { "name": "", "type": "string", "value": "DEcentralized CArbon tokens" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x06fdde03" }, { "constant": false, "inputs": [ { "name": "spender", "type": "address" }, { "name": "tokens", "type": "uint256" } ], "name": "approve", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x095ea7b3" }, { "constant": true, "inputs": [], "name": "startDate", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x0b97bc86" }, { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [ { "name": "", "type": "uint256", "value": "20000000000000000000000" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x18160ddd" }, { "constant": false, "inputs": [ { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "tokens", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x23b872dd" }, { "constant": true, "inputs": [], "name": "decimals", "outputs": [ { "name": "", "type": "uint8", "value": "18" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x313ce567" }, { "constant": true, "inputs": [], "name": "_totalSupply", "outputs": [ { "name": "", "type": "uint256", "value": "20000000000000000000000" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x3eaaf86b" }, { "constant": false, "inputs": [ { "name": "newCC", "type": "uint256" } ], "name": "updateCC", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x540af003" }, { "constant": true, "inputs": [ { "name": "tokenOwner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "balance", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x70a08231" }, { "constant": false, "inputs": [], "name": "acceptOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x79ba5097" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address", "value": "0x44B029cA4D7aF4210E2cBffD953CD7d32b91b478" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x8da5cb5b" }, { "constant": true, "inputs": [], "name": "_totalCarbonCredits", "outputs": [ { "name": "", "type": "uint256", "value": "100" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x950176d4" }, { "constant": true, "inputs": [], "name": "symbol", "outputs": [ { "name": "", "type": "string", "value": "DECA" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x95d89b41" }, { "constant": false, "inputs": [ { "name": "to", "type": "address" }, { "name": "tokens", "type": "uint256" } ], "name": "transfer", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xa9059cbb" }, { "constant": true, "inputs": [], "name": "endDate", "outputs": [ { "name": "", "type": "uint256", "value": "1553319803" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xc24a0f8b" }, { "constant": false, "inputs": [ { "name": "spender", "type": "address" }, { "name": "tokens", "type": "uint256" }, { "name": "data", "type": "bytes" } ], "name": "approveAndCall", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xcae9ca51" }, { "constant": true, "inputs": [], "name": "newOwner", "outputs": [ { "name": "", "type": "address", "value": "0x0000000000000000000000000000000000000000" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xd4ee1d90" }, { "constant": false, "inputs": [ { "name": "tokenAddress", "type": "address" }, { "name": "tokens", "type": "uint256" } ], "name": "transferAnyERC20Token", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xdc39d06d" }, { "constant": true, "inputs": [ { "name": "tokenOwner", "type": "address" }, { "name": "spender", "type": "address" } ], "name": "allowance", "outputs": [ { "name": "remaining", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xdd62ed3e" }, { "constant": true, "inputs": [], "name": "bonus1Ends", "outputs": [ { "name": "", "type": "uint256", "value": "1552628603" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xe8294aad" }, { "constant": true, "inputs": [], "name": "bonus2Ends", "outputs": [ { "name": "", "type": "uint256", "value": "1552887803" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xef0b44db" }, { "constant": false, "inputs": [ { "name": "_newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xf2fde38b" }, { "constant": true, "inputs": [], "name": "preICOEnds", "outputs": [ { "name": "", "type": "uint256", "value": "1552455803" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xfc5fc8ae" }, { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor", "signature": "constructor" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "_from", "type": "address" }, { "indexed": true, "name": "_to", "type": "address" } ], "name": "OwnershipTransferred", "type": "event", "signature": "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "from", "type": "address" }, { "indexed": true, "name": "to", "type": "address" }, { "indexed": false, "name": "tokens", "type": "uint256" } ], "name": "Transfer", "type": "event", "signature": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "tokenOwner", "type": "address" }, { "indexed": true, "name": "spender", "type": "address" }, { "indexed": false, "name": "tokens", "type": "uint256" } ], "name": "Approval", "type": "event", "signature": "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925" } ] From b40f0cdc803837e6ae45c931388e58fca4d1d3a4 Mon Sep 17 00:00:00 2001 From: p1r0 Date: Tue, 12 Mar 2019 00:13:48 -0600 Subject: [PATCH 3/3] deleting old example code --- DCC_ERC20_0.4.18.sol | 237 ------------------------------------------- 1 file changed, 237 deletions(-) delete mode 100644 DCC_ERC20_0.4.18.sol diff --git a/DCC_ERC20_0.4.18.sol b/DCC_ERC20_0.4.18.sol deleted file mode 100644 index 641b437..0000000 --- a/DCC_ERC20_0.4.18.sol +++ /dev/null @@ -1,237 +0,0 @@ -pragma solidity ^0.4.18; - -// ---------------------------------------------------------------------------- -// 'SC1' Decentralized Carbon Credits initial token distribution event -// -// Deployed to : 0xB022F4332cAE44156Cb77Fd4c70e1585C74F0656 -// Symbol : SC1 -// Name : Decentralized Carbon Credits -// Total supply: Gazillion -// Decimals : 18 -// -// Enjoy. -// -// (c) by Moritz Neto & Daniel Bar with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence. -// ---------------------------------------------------------------------------- - - -// ---------------------------------------------------------------------------- -// Safe maths -// ---------------------------------------------------------------------------- -contract SafeMath { - function safeAdd(uint a, uint b) internal pure returns (uint c) { - c = a + b; - require(c >= a); - } - function safeSub(uint a, uint b) internal pure returns (uint c) { - require(b <= a); - c = a - b; - } - function safeMul(uint a, uint b) internal pure returns (uint c) { - c = a * b; - require(a == 0 || c / a == b); - } - function safeDiv(uint a, uint b) internal pure returns (uint c) { - require(b > 0); - c = a / b; - } -} - - -// ---------------------------------------------------------------------------- -// ERC Token Standard #20 Interface -// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md -// ---------------------------------------------------------------------------- -contract ERC20Interface { - function totalSupply() public constant returns (uint); - function balanceOf(address tokenOwner) public constant returns (uint balance); - function allowance(address tokenOwner, address spender) public constant returns (uint remaining); - function transfer(address to, uint tokens) public returns (bool success); - function approve(address spender, uint tokens) public returns (bool success); - function transferFrom(address from, address to, uint tokens) public returns (bool success); - - event Transfer(address indexed from, address indexed to, uint tokens); - event Approval(address indexed tokenOwner, address indexed spender, uint tokens); -} - - -// ---------------------------------------------------------------------------- -// Contract function to receive approval and execute function in one call -// -// Borrowed from MiniMeToken -// ---------------------------------------------------------------------------- -contract ApproveAndCallFallBack { - function receiveApproval(address from, uint256 tokens, address token, bytes data) public; -} - - -// ---------------------------------------------------------------------------- -// Owned contract -// ---------------------------------------------------------------------------- -contract Owned { - address public owner; - address public newOwner; - - event OwnershipTransferred(address indexed _from, address indexed _to); - - constructor() public { - owner = msg.sender; - } - - modifier onlyOwner { - require(msg.sender == owner); - _; - } - - function transferOwnership(address _newOwner) public onlyOwner { - newOwner = _newOwner; - } - function acceptOwnership() public { - require(msg.sender == newOwner); - emit OwnershipTransferred(owner, newOwner); - owner = newOwner; - newOwner = address(0); - } -} - - -// ---------------------------------------------------------------------------- -// ERC20 Token, with the addition of symbol, name and decimals and assisted -// token transfers -// ---------------------------------------------------------------------------- -contract SC1Token is ERC20Interface, Owned, SafeMath { - string public symbol; - string public name; - uint8 public decimals; - uint public _totalSupply; - uint public startDate; - uint public bonusEnds; - uint public endDate; - - mapping(address => uint) balances; - mapping(address => mapping(address => uint)) allowed; - - - // ------------------------------------------------------------------------ - // Constructor - // ------------------------------------------------------------------------ - constructor () public { - symbol = "SC1"; - name = "Decentralized Carbon Credits"; - decimals = 18; - bonusEnds = now + 1 weeks; - endDate = now + 7 weeks; - - } - - - // ------------------------------------------------------------------------ - // Total supply: Get the total token supply - // ------------------------------------------------------------------------ - - function totalSupply() public constant returns (uint) { - return _totalSupply - balances[address(0)]; - } - - - // ------------------------------------------------------------------------ - // Get the token balance for account `tokenOwner` - // ------------------------------------------------------------------------ - function balanceOf(address tokenOwner) public constant returns (uint balance) { - return balances[tokenOwner]; - } - - - // ------------------------------------------------------------------------ - // Transfer the balance from token owner's account to `to` account - // - Owner's account must have sufficient balance to transfer - // - 0 value transfers are allowed - // ------------------------------------------------------------------------ - function transfer(address to, uint tokens) public returns (bool success) { - balances[msg.sender] = safeSub(balances[msg.sender], tokens); - balances[to] = safeAdd(balances[to], tokens); - emit Transfer(msg.sender, to, tokens); - return true; - } - - - // ------------------------------------------------------------------------ - // Token owner can approve for `spender` to transferFrom(...) `tokens` - // from the token owner's account - // - // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md - // recommends that there are no checks for the approval double-spend attack - // as this should be implemented in user interfaces - // ------------------------------------------------------------------------ - function approve(address spender, uint tokens) public returns (bool success) { - allowed[msg.sender][spender] = tokens; - emit Approval(msg.sender, spender, tokens); - return true; - } - - - // ------------------------------------------------------------------------ - // Transfer `tokens` from the `from` account to the `to` account - // - // The calling account must already have sufficient tokens approve(...)-d - // for spending from the `from` account and - // - From account must have sufficient balance to transfer - // - Spender must have sufficient allowance to transfer - // - 0 value transfers are allowed - // ------------------------------------------------------------------------ - function transferFrom(address from, address to, uint tokens) public returns (bool success) { - balances[from] = safeSub(balances[from], tokens); - allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); - balances[to] = safeAdd(balances[to], tokens); - emit Transfer(from, to, tokens); - return true; - } - - - // ------------------------------------------------------------------------ - // Returns the amount of tokens approved by the owner that can be - // transferred to the spender's account - // ------------------------------------------------------------------------ - function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { - return allowed[tokenOwner][spender]; - } - - - // ------------------------------------------------------------------------ - // Token owner can approve for `spender` to transferFrom(...) `tokens` - // from the token owner's account. The `spender` contract function - // `receiveApproval(...)` is then executed - // ------------------------------------------------------------------------ - function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { - allowed[msg.sender][spender] = tokens; - emit Approval(msg.sender, spender, tokens); - ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); - return true; - } - - // ------------------------------------------------------------------------ - // 1,000 SC1 Tokens per 1 ETH - // ------------------------------------------------------------------------ - function () public payable { - require(now >= startDate && now <= endDate); - uint tokens; - if (now <= bonusEnds) { - tokens = msg.value * 1200; - } else { - tokens = msg.value * 1000; - } - balances[msg.sender] = safeAdd(balances[msg.sender], tokens); - _totalSupply = safeAdd(_totalSupply, tokens); - emit Transfer(address(0), msg.sender, tokens); - owner.transfer(msg.value); - } - - - - // ------------------------------------------------------------------------ - // Owner can transfer out any accidentally sent ERC20 tokens - // ------------------------------------------------------------------------ - function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { - return ERC20Interface(tokenAddress).transfer(owner, tokens); - } -}