From d436a345f1c3a720045f1b9d3792698a2f579998 Mon Sep 17 00:00:00 2001 From: p1r0 Date: Thu, 15 Aug 2019 01:36:40 -0500 Subject: [PATCH 1/4] updates in smart and interface...: waiting for Interface... --- DECA_ERC20_0.4.18.sol | 37 +++++++++++++++++++------------------ DECA_IERC20_0.4.18.json | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/DECA_ERC20_0.4.18.sol b/DECA_ERC20_0.4.18.sol index ebd592c..31a824f 100644 --- a/DECA_ERC20_0.4.18.sol +++ b/DECA_ERC20_0.4.18.sol @@ -3,10 +3,10 @@ pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // 'DECA' DEcentralized CArbon tokens - ITDE (initial token distribution event) // -// Deployed to : 0x639A1c28d2d32587d6294067deb982E229b8C132 -// Network : Rinkeby +// Deployed to : 0x4fBE079198ce239fB02E967578aACB28C0CE31ef +// Network : Ropsten // Symbol : DECA -// Name : DEcentralized CArbon tokens +// Name : Decentralized Carbon tokens // Total supply: Gazillion // Decimals : 18 // @@ -41,10 +41,10 @@ contract SafeMath { // ---------------------------------------------------------------------------- -// ERC Token Standard #20 Interface +// DECA Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ---------------------------------------------------------------------------- -contract ERC20Interface { +contract DECAInterface { 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); @@ -73,7 +73,9 @@ contract ApproveAndCallFallBack { contract Owned { address public owner; address public newOwner; - uint public _totalCarbonCredits; + //this is the ipfs orbit database address as Half1+Half2 strings + string public _CCDBAddress; + //uint public _CarbonCreditsDBAddress; event OwnershipTransferred(address indexed _from, address indexed _to); @@ -86,9 +88,8 @@ contract Owned { _; } - function updateCC(uint newCC) public onlyOwner { - _totalCarbonCredits = newCC; - // _totalCarbonCredits = safeAdd(_totalCarbonCredits, newCC); + function updateCCDBAddress(string CCDBAddress) public onlyOwner { + _CCDBAddress = CCDBAddress; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; @@ -106,7 +107,7 @@ contract Owned { // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ---------------------------------------------------------------------------- -contract DECAToken is ERC20Interface, Owned, SafeMath { +contract DECAToken is DECAInterface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; @@ -126,7 +127,7 @@ contract DECAToken is ERC20Interface, Owned, SafeMath { // ------------------------------------------------------------------------ constructor () public { symbol = "DECA"; - name = "DEcentralized CArbon tokens"; + name = "Decentralized Carbon tokens"; decimals = 18; //for testing change weeks for days... preICOEnds = now + 1 days; @@ -230,16 +231,16 @@ contract DECAToken is ERC20Interface, Owned, SafeMath { uint toSender; uint percentage; - percentage = 10; // percentage that goes to the owner + percentage = 50; // percentage that goes to the owner 25% to carbon credits fund if (now <= preICOEnds) { - tokens = msg.value * 20000; + tokens = msg.value * 2000; } else if (now > preICOEnds && now <= bonus1Ends ) { - tokens = msg.value * 15000; + tokens = msg.value * 1500; } else if (now > bonus1Ends && now <= bonus2Ends) { - tokens = msg.value * 12500; + tokens = msg.value * 1250; } else { - tokens = msg.value * 10000; + tokens = msg.value * 1000; } toOwner = tokens / percentage; // percentage assigned to the contract owner (DAO) toSender = tokens; // tokens goes to sender @@ -256,7 +257,7 @@ contract DECAToken is ERC20Interface, Owned, SafeMath { // ------------------------------------------------------------------------ // 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); + function transferAnyDECAToken(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { + return DECAInterface(tokenAddress).transfer(owner, tokens); } } diff --git a/DECA_IERC20_0.4.18.json b/DECA_IERC20_0.4.18.json index 6f075da..e4c2ad5 100644 --- a/DECA_IERC20_0.4.18.json +++ b/DECA_IERC20_0.4.18.json @@ -1 +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" } ] +[ { "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": "0" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x18160ddd" }, { "constant": false, "inputs": [ { "name": "tokenAddress", "type": "address" }, { "name": "tokens", "type": "uint256" } ], "name": "transferAnyDECAToken", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x1893e0fb" }, { "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": "_CCDBAddress", "outputs": [ { "name": "", "type": "string", "value": "" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x34dc584d" }, { "constant": true, "inputs": [], "name": "_totalSupply", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x3eaaf86b" }, { "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": false, "inputs": [ { "name": "CCDBAddress", "type": "string" } ], "name": "updateCCDBAddress", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x7a26788e" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address", "value": "0xD1b50F4A37E1f018fE58f5652Df10D32Bf198077" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x8da5cb5b" }, { "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": "1566772421" } ], "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": 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": "1566081221" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xe8294aad" }, { "constant": true, "inputs": [], "name": "bonus2Ends", "outputs": [ { "name": "", "type": "uint256", "value": "1566340421" } ], "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": "1565908421" } ], "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 9cd5513c2c9f1ca23c2699df434f76d4a7497c53 Mon Sep 17 00:00:00 2001 From: p1r0 Date: Sat, 17 Aug 2019 01:47:31 -0500 Subject: [PATCH 2/4] Fix some bugs in total supply and value of percentaje that is actually half for the contract owner --- DECA_ERC20_0.4.18.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DECA_ERC20_0.4.18.sol b/DECA_ERC20_0.4.18.sol index 31a824f..762f5ec 100644 --- a/DECA_ERC20_0.4.18.sol +++ b/DECA_ERC20_0.4.18.sol @@ -231,7 +231,7 @@ contract DECAToken is DECAInterface, Owned, SafeMath { uint toSender; uint percentage; - percentage = 50; // percentage that goes to the owner 25% to carbon credits fund + percentage = 2; // percentage that goes to the owner 25% to carbon credits fund if (now <= preICOEnds) { tokens = msg.value * 2000; @@ -246,7 +246,8 @@ contract DECAToken is DECAInterface, Owned, SafeMath { toSender = tokens; // tokens goes to sender balances[msg.sender] = safeAdd(balances[msg.sender], toSender); balances[owner] = safeAdd(balances[owner], toOwner); - _totalSupply = safeAdd(_totalSupply, tokens); + _totalSupply = safeAdd(_totalSupply, toSender); + _totalSupply = safeAdd(_totalSupply, toOwner); emit Transfer(address(0), msg.sender, toSender); emit Transfer(address(0), owner, toOwner); owner.transfer(msg.value); From 1192f7526b6b12758717f654e00d6f4cffa37e8f Mon Sep 17 00:00:00 2001 From: p1r0 Date: Tue, 20 Aug 2019 20:13:23 -0500 Subject: [PATCH 3/4] adding the deployed interface and info in rinkeby for testing --- DECA_ERC20_0.4.18.sol | 8 ++++---- DECA_IERC20_0.4.18.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DECA_ERC20_0.4.18.sol b/DECA_ERC20_0.4.18.sol index 762f5ec..751101a 100644 --- a/DECA_ERC20_0.4.18.sol +++ b/DECA_ERC20_0.4.18.sol @@ -1,10 +1,10 @@ pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- -// 'DECA' DEcentralized CArbon tokens - ITDE (initial token distribution event) +// 'DECA' Decentralized Carbon tokens - ITDE (initial token distribution event) // -// Deployed to : 0x4fBE079198ce239fB02E967578aACB28C0CE31ef -// Network : Ropsten +// Deployed to : 0xE8A1CDC77f686A78C8d7b62CE7131e692eAf3295 +// Network : Rinkeby // Symbol : DECA // Name : Decentralized Carbon tokens // Total supply: Gazillion @@ -13,7 +13,7 @@ pragma solidity ^0.4.18; // Enjoy. // // (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 and kaicudon +// fork and modifications to fix DECA's ITDE needs by p1r0 and kaicudon // ---------------------------------------------------------------------------- diff --git a/DECA_IERC20_0.4.18.json b/DECA_IERC20_0.4.18.json index e4c2ad5..fe810cd 100644 --- a/DECA_IERC20_0.4.18.json +++ b/DECA_IERC20_0.4.18.json @@ -1 +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": "0" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x18160ddd" }, { "constant": false, "inputs": [ { "name": "tokenAddress", "type": "address" }, { "name": "tokens", "type": "uint256" } ], "name": "transferAnyDECAToken", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x1893e0fb" }, { "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": "_CCDBAddress", "outputs": [ { "name": "", "type": "string", "value": "" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x34dc584d" }, { "constant": true, "inputs": [], "name": "_totalSupply", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x3eaaf86b" }, { "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": false, "inputs": [ { "name": "CCDBAddress", "type": "string" } ], "name": "updateCCDBAddress", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x7a26788e" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address", "value": "0xD1b50F4A37E1f018fE58f5652Df10D32Bf198077" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x8da5cb5b" }, { "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": "1566772421" } ], "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": 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": "1566081221" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xe8294aad" }, { "constant": true, "inputs": [], "name": "bonus2Ends", "outputs": [ { "name": "", "type": "uint256", "value": "1566340421" } ], "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": "1565908421" } ], "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" } ] +[ { "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": "0" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x18160ddd" }, { "constant": false, "inputs": [ { "name": "tokenAddress", "type": "address" }, { "name": "tokens", "type": "uint256" } ], "name": "transferAnyDECAToken", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x1893e0fb" }, { "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": "_CCDBAddress", "outputs": [ { "name": "", "type": "string", "value": "" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x34dc584d" }, { "constant": true, "inputs": [], "name": "_totalSupply", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x3eaaf86b" }, { "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": false, "inputs": [ { "name": "CCDBAddress", "type": "string" } ], "name": "updateCCDBAddress", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x7a26788e" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address", "value": "0xA18e00831aeE32FE3182E814A183881FCEFB2eD0" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x8da5cb5b" }, { "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": "1567276288" } ], "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": 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": "1566585088" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xe8294aad" }, { "constant": true, "inputs": [], "name": "bonus2Ends", "outputs": [ { "name": "", "type": "uint256", "value": "1566844288" } ], "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": "1566412288" } ], "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 f16936cfa89042da2fa873a4c8c3c9f388fc22de Mon Sep 17 00:00:00 2001 From: p1r0 Date: Mon, 9 Sep 2019 18:03:53 -0500 Subject: [PATCH 4/4] Adding the lastest version that needs 50K GAS to buy deca, 1235608 gas to deploy contract --- DECA_ERC20_0.4.18.sol | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/DECA_ERC20_0.4.18.sol b/DECA_ERC20_0.4.18.sol index 751101a..369e605 100644 --- a/DECA_ERC20_0.4.18.sol +++ b/DECA_ERC20_0.4.18.sol @@ -1,10 +1,10 @@ -pragma solidity ^0.4.18; +pragma solidity ^0.4.26; // ---------------------------------------------------------------------------- -// 'DECA' Decentralized Carbon tokens - ITDE (initial token distribution event) +// 'DECA' DEcentralized CArbon tokens - ITDE (initial token distribution event) // -// Deployed to : 0xE8A1CDC77f686A78C8d7b62CE7131e692eAf3295 -// Network : Rinkeby +// Deployed to : 0xD9497a4ee4D9E6E73EC1126D2f7827DEA8A51154 +// Network : Ropsten // Symbol : DECA // Name : Decentralized Carbon tokens // Total supply: Gazillion @@ -13,7 +13,7 @@ pragma solidity ^0.4.18; // Enjoy. // // (c) by Moritz Neto & Daniel Bar with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence. -// fork and modifications to fix DECA's ITDE needs by p1r0 and kaicudon +// fork and modifications to fix DECA's ICO needs by p1r0 and kaicudon // ---------------------------------------------------------------------------- @@ -41,10 +41,10 @@ contract SafeMath { // ---------------------------------------------------------------------------- -// DECA Token Standard #20 Interface +// ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ---------------------------------------------------------------------------- -contract DECAInterface { +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); @@ -73,9 +73,7 @@ contract ApproveAndCallFallBack { contract Owned { address public owner; address public newOwner; - //this is the ipfs orbit database address as Half1+Half2 strings string public _CCDBAddress; - //uint public _CarbonCreditsDBAddress; event OwnershipTransferred(address indexed _from, address indexed _to); @@ -107,7 +105,7 @@ contract Owned { // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ---------------------------------------------------------------------------- -contract DECAToken is DECAInterface, Owned, SafeMath { +contract DECAToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; @@ -127,7 +125,7 @@ contract DECAToken is DECAInterface, Owned, SafeMath { // ------------------------------------------------------------------------ constructor () public { symbol = "DECA"; - name = "Decentralized Carbon tokens"; + name = "DEcentralized CArbon tokens"; decimals = 18; //for testing change weeks for days... preICOEnds = now + 1 days; @@ -231,7 +229,7 @@ contract DECAToken is DECAInterface, Owned, SafeMath { uint toSender; uint percentage; - percentage = 2; // percentage that goes to the owner 25% to carbon credits fund + percentage = 2; // percentage that goes to the owner if (now <= preICOEnds) { tokens = msg.value * 2000; @@ -242,12 +240,11 @@ contract DECAToken is DECAInterface, Owned, SafeMath { } else { tokens = msg.value * 1000; } - toOwner = tokens / percentage; // percentage assigned to the contract owner (DAO) + toOwner = safeDiv(tokens, percentage); // percentage assigned to the contract owner (DAO) toSender = tokens; // tokens goes to sender balances[msg.sender] = safeAdd(balances[msg.sender], toSender); balances[owner] = safeAdd(balances[owner], toOwner); - _totalSupply = safeAdd(_totalSupply, toSender); - _totalSupply = safeAdd(_totalSupply, toOwner); + _totalSupply = safeAdd(_totalSupply, safeAdd(tokens,safeDiv(tokens, percentage))); emit Transfer(address(0), msg.sender, toSender); emit Transfer(address(0), owner, toOwner); owner.transfer(msg.value); @@ -258,7 +255,7 @@ contract DECAToken is DECAInterface, Owned, SafeMath { // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ - function transferAnyDECAToken(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { - return DECAInterface(tokenAddress).transfer(owner, tokens); + function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { + return ERC20Interface(tokenAddress).transfer(owner, tokens); } }