Migration of DECAs ERC20 to truffle and openzepplin
This commit is contained in:
parent
1af0f37e30
commit
9034a8af4d
|
@ -1,268 +0,0 @@
|
|||
pragma solidity 0.4.26;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 'DECA' DEcentralized CArbon tokens - ITDE (initial token distribution event)
|
||||
//
|
||||
// Deployed to : 0xD9497a4ee4D9E6E73EC1126D2f7827DEA8A51154
|
||||
// Network : Ropsten
|
||||
// Symbol : DECA
|
||||
// Name : Decentralized Carbon tokens
|
||||
// Total supply: Gazillion
|
||||
// Decimals : 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 <p1r0@neetsec.com> and kaicudon <kaicudon@neetsec.com>
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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;
|
||||
string public _CCDBAddress;
|
||||
|
||||
event OwnershipTransferred(address indexed _from, address indexed _to);
|
||||
|
||||
constructor () public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
modifier onlyOwner {
|
||||
require(msg.sender == owner);
|
||||
_;
|
||||
}
|
||||
|
||||
function updateCCDBAddress(string CCDBAddress) public onlyOwner {
|
||||
_CCDBAddress = CCDBAddress;
|
||||
}
|
||||
|
||||
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 DECAToken is ERC20Interface, Owned, SafeMath {
|
||||
string public symbol = "DECA";
|
||||
string public name = "DEcentralized CArbon tokens";
|
||||
uint8 public decimals = 18;
|
||||
uint public _totalSupply;
|
||||
//for testing change weeks for hours...
|
||||
uint public preICOEnds = now + 1 hours;
|
||||
uint public bonus1Ends = now + 3 hours;
|
||||
uint public bonus2Ends = now + 6 hours;
|
||||
uint public endDate = now + 11 hours;
|
||||
|
||||
mapping(address => uint) balances;
|
||||
mapping(address => mapping(address => uint)) allowed;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// 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) {
|
||||
// approve should only be called when setting an initial allowance,
|
||||
// or when resetting it to zero. To increase and decrease it, use
|
||||
// 'increaseApproval' and 'decreaseApproval'
|
||||
if (allowed[msg.sender][spender] == 0 || tokens == 0){
|
||||
emit Approval(msg.sender, spender, tokens);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* approve should be called when allowed[spender] == 0. To increment
|
||||
* allowed value is better to use this function to avoid 2 calls (and wait until
|
||||
* the first transaction is mined)
|
||||
*/
|
||||
function increaseApproval (address spender, uint tokens) public returns (bool success){
|
||||
allowed[msg.sender][spender] = safeAdd(allowed[msg.sender][spender], tokens);
|
||||
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
|
||||
return true;
|
||||
}
|
||||
|
||||
function decreaseApproval (address spender, uint tokens) public returns (bool success) {
|
||||
uint oldValue = allowed[msg.sender][spender];
|
||||
if (tokens > oldValue) {
|
||||
allowed[msg.sender][spender] = 0;
|
||||
}
|
||||
else{
|
||||
allowed[msg.sender][spender] = safeSub(oldValue, tokens);
|
||||
}
|
||||
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
|
||||
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 DECA Tokens per 1 ETH
|
||||
// ------------------------------------------------------------------------
|
||||
function () public payable {
|
||||
require(now <= endDate);
|
||||
uint tokens;
|
||||
uint toOwner;
|
||||
uint toSender;
|
||||
uint divBy;
|
||||
|
||||
divBy = 10; // division to get 10%
|
||||
|
||||
if (now <= preICOEnds) {
|
||||
tokens = msg.value * 2000;
|
||||
} else if (now > preICOEnds && now <= bonus1Ends ) {
|
||||
tokens = msg.value * 1500;
|
||||
} else if (now > bonus1Ends && now <= bonus2Ends) {
|
||||
tokens = msg.value * 1250;
|
||||
} else {
|
||||
tokens = msg.value * 1000;
|
||||
}
|
||||
toOwner = safeDiv(tokens, divBy); // divBy to get the percentage assigned to the contract owner (for exchange to Cabron Credits)
|
||||
toSender = tokens; // tokens goes to sender
|
||||
balances[msg.sender] = safeAdd(balances[msg.sender], toSender);
|
||||
balances[owner] = safeAdd(balances[owner], toOwner);
|
||||
_totalSupply = safeAdd(_totalSupply, safeAdd(toSender,toOwner));
|
||||
emit Transfer(address(0), msg.sender, toSender);
|
||||
emit Transfer(address(0), owner, toOwner);
|
||||
}
|
||||
|
||||
//Close down the ICO and Claim the Ether.
|
||||
function getETH() public onlyOwner {
|
||||
require(now >= endDate );
|
||||
// transfer the ETH balance in the contract to the owner
|
||||
owner.transfer(address(this).balance);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// 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);
|
||||
}
|
||||
}
|
|
@ -1,268 +0,0 @@
|
|||
pragma solidity 0.5.3;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 'DECA' DEcentralized CArbon tokens - ITDE (initial token distribution event)
|
||||
//
|
||||
// Deployed to : ------
|
||||
// Network : Ropsten
|
||||
// Symbol : DECA
|
||||
// Name : Decentralized Carbon tokens
|
||||
// Total supply: Gazillion
|
||||
// Decimals : 18
|
||||
//
|
||||
// (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>,
|
||||
// Oscar <oscar@neetsec.com> and kaicudon <kaicudon@neetsec.com>
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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 getTotalSupply() public view returns (uint);
|
||||
function balanceOf(address tokenOwner) public view returns (uint balance);
|
||||
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
|
||||
function transfer(address to, uint tokens) public returns (bool success);
|
||||
function approve(address spender, uint tokens) public returns (bool success);
|
||||
function increaseApproval (address spender, uint tokens) public returns (bool success);
|
||||
function decreaseApproval (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 memory data) public;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Owned contract
|
||||
// ----------------------------------------------------------------------------
|
||||
contract Owned {
|
||||
address payable public owner;
|
||||
address payable public newOwner;
|
||||
string public CCDBAddress;
|
||||
|
||||
event OwnershipTransferred(address indexed _from, address indexed _to);
|
||||
|
||||
constructor () public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
modifier onlyOwner {
|
||||
require(msg.sender == owner);
|
||||
_;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
//Function that updates the orbitDB address at IPFS
|
||||
//This database will store the carbon credits gotten by the 20% DECAS that the contract owner recives
|
||||
// ----------------------------------------------------------------------------
|
||||
function updateCCDBAddress(string memory _CCDBAddress) public onlyOwner {
|
||||
CCDBAddress = _CCDBAddress;
|
||||
}
|
||||
function transferOwnership(address payable _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 DECAToken is ERC20Interface, Owned, SafeMath {
|
||||
string constant public symbol = "DECA";
|
||||
string constant public name = "DEcentralized CArbon tokens";
|
||||
uint8 constant public decimals = 18;
|
||||
uint public totalSupply;
|
||||
//for testing change weeks for hours...
|
||||
uint public preICOEnds = now + 1 weeks;
|
||||
uint public bonus1Ends = now + 3 weeks;
|
||||
uint public bonus2Ends = now + 6 weeks;
|
||||
uint public endDate = now + 11 weeks;
|
||||
|
||||
mapping(address => uint) balances;
|
||||
mapping(address => mapping(address => uint)) allowed;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Total supply: Get the total token supply
|
||||
// ------------------------------------------------------------------------
|
||||
function getTotalSupply() public view returns (uint) {
|
||||
return totalSupply - balances[address(0)];
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Get the token balance for account `tokenOwner`
|
||||
// ------------------------------------------------------------------------
|
||||
function balanceOf(address tokenOwner) public view 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
|
||||
// ------------------------------------------------------------------------
|
||||
function approve(address spender, uint tokens) public returns (bool success) {
|
||||
// approves to set an allowance
|
||||
allowed[msg.sender][spender] = tokens;
|
||||
emit Approval(msg.sender, spender, tokens);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// approve should be called when allowed[spender] == 0. To increment
|
||||
// allowed value is better to use this function to avoid 2 calls (and wait until
|
||||
// the first transaction is mined)
|
||||
// ------------------------------------------------------------------------
|
||||
function increaseApproval (address spender, uint tokens) public returns (bool success){
|
||||
allowed[msg.sender][spender] = safeAdd(allowed[msg.sender][spender], tokens);
|
||||
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
|
||||
return true;
|
||||
}
|
||||
|
||||
function decreaseApproval (address spender, uint tokens) public returns (bool success) {
|
||||
uint oldValue = allowed[msg.sender][spender];
|
||||
if (tokens > oldValue) {
|
||||
allowed[msg.sender][spender] = 0;
|
||||
}
|
||||
else{
|
||||
allowed[msg.sender][spender] = safeSub(oldValue, tokens);
|
||||
}
|
||||
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
|
||||
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 view 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 memory data) public returns (bool success) {
|
||||
allowed[msg.sender][spender] = tokens;
|
||||
emit Approval(msg.sender, spender, tokens);
|
||||
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// 100 DECA Tokens per 1 ETH
|
||||
// ------------------------------------------------------------------------
|
||||
function () external payable {
|
||||
require(now <= endDate);
|
||||
uint tokens;
|
||||
uint toOwner;
|
||||
uint toSender;
|
||||
uint divBy;
|
||||
// ------------------------------------------------------------------------
|
||||
// We want to have 20% of the DECA tokens market cap in order to exchange
|
||||
// them for carbon credits and have a better decentralization
|
||||
// NOTE: The Contract Owner must publish this usage in the orbitdb database
|
||||
// in order to prove that it's not holding using them with any other propose
|
||||
// (this can be also verified by the blockchain).
|
||||
// ------------------------------------------------------------------------
|
||||
divBy = 4; // 25% extra printed to be 20% of the marketcap, please see README.md
|
||||
|
||||
if (now <= preICOEnds) {
|
||||
tokens = msg.value * 200;
|
||||
} else if (now > preICOEnds && now <= bonus1Ends ) {
|
||||
tokens = msg.value * 150;
|
||||
} else if (now > bonus1Ends && now <= bonus2Ends) {
|
||||
tokens = msg.value * 125;
|
||||
} else {
|
||||
tokens = msg.value * 100;
|
||||
}
|
||||
|
||||
toOwner = safeDiv(tokens, divBy); //created 25% extra to the contract owner
|
||||
toSender = tokens; //tokens that goes to the sender
|
||||
balances[msg.sender] = safeAdd(balances[msg.sender], toSender);
|
||||
balances[owner] = safeAdd(balances[owner], toOwner);
|
||||
totalSupply = safeAdd(totalSupply, safeAdd(toSender,toOwner));
|
||||
emit Transfer(address(0), msg.sender, toSender);
|
||||
emit Transfer(address(0), owner, toOwner);
|
||||
}
|
||||
|
||||
//Close down the ICO and claim the Ether.
|
||||
function getETH() public onlyOwner {
|
||||
require(now >= endDate );
|
||||
// transfer the ETH balance in the contract to the owner
|
||||
owner.transfer(address(this).balance);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// 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);
|
||||
}
|
||||
}
|
|
@ -1,493 +0,0 @@
|
|||
[
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokens",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [],
|
||||
"name": "getETH",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "_CCDBAddress",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "_totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokens",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "decreaseApproval",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "tokenOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "balance",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [],
|
||||
"name": "acceptOwnership",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "CCDBAddress",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "updateCCDBAddress",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokens",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "endDate",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "newOwner",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokens",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "increaseApproval",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "tokenAddress",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokens",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferAnyERC20Token",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "tokenOwner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "remaining",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "bonus1Ends",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "bonus2Ends",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "preICOEnds",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
|
@ -1,493 +0,0 @@
|
|||
[
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokens",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [],
|
||||
"name": "getETH",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokens",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "decreaseApproval",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "tokenOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "balance",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [],
|
||||
"name": "acceptOwnership",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_CCDBAddress",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "updateCCDBAddress",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokens",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "endDate",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "getTotalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "newOwner",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "CCDBAddress",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokens",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "increaseApproval",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "tokenAddress",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokens",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferAnyERC20Token",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "tokenOwner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "remaining",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "bonus1Ends",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "bonus2Ends",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "preICOEnds",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
|
@ -0,0 +1,595 @@
|
|||
{
|
||||
"contractName": "Context",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
}
|
||||
],
|
||||
"metadata": "{\"compiler\":{\"version\":\"0.5.12+commit.7709ece9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/GSN/Context.sol\":\"Context\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/GSN/Context.sol\":{\"keccak256\":\"0x90a3995645af7562d84b9d69363ffa5ae7217714ab61e951bf7bc450f40e4061\",\"urls\":[\"bzz-raw://216ef9d6b614db4eb46970b4e84903f2534a45572dd30a79f0041f1a5830f436\",\"dweb:/ipfs/QmNPrJ4MWKUAWzKXpUqeyKRUfosaoANZAqXgvepdrCwZAG\"]}},\"version\":1}",
|
||||
"bytecode": "0x",
|
||||
"deployedBytecode": "0x",
|
||||
"sourceMap": "",
|
||||
"deployedSourceMap": "",
|
||||
"source": "pragma solidity ^0.5.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\ncontract Context {\n // Empty internal constructor, to prevent people from mistakenly deploying\n // an instance of this contract, which should be used via inheritance.\n constructor () internal { }\n // solhint-disable-previous-line no-empty-blocks\n\n function _msgSender() internal view returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n",
|
||||
"sourcePath": "@openzeppelin/contracts/GSN/Context.sol",
|
||||
"ast": {
|
||||
"absolutePath": "@openzeppelin/contracts/GSN/Context.sol",
|
||||
"exportedSymbols": {
|
||||
"Context": [
|
||||
381
|
||||
]
|
||||
},
|
||||
"id": 382,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 356,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"^",
|
||||
"0.5",
|
||||
".0"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:2"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 381,
|
||||
"linearizedBaseContracts": [
|
||||
381
|
||||
],
|
||||
"name": "Context",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": {
|
||||
"id": 359,
|
||||
"nodeType": "Block",
|
||||
"src": "726:3:2",
|
||||
"statements": []
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 360,
|
||||
"implemented": true,
|
||||
"kind": "constructor",
|
||||
"modifiers": [],
|
||||
"name": "",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 357,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "714:2:2"
|
||||
},
|
||||
"returnParameters": {
|
||||
"id": 358,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "726:0:2"
|
||||
},
|
||||
"scope": 381,
|
||||
"src": "702:27:2",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 368,
|
||||
"nodeType": "Block",
|
||||
"src": "850:34:2",
|
||||
"statements": [
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"id": 365,
|
||||
"name": "msg",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1057,
|
||||
"src": "867:3:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_magic_message",
|
||||
"typeString": "msg"
|
||||
}
|
||||
},
|
||||
"id": 366,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"memberName": "sender",
|
||||
"nodeType": "MemberAccess",
|
||||
"referencedDeclaration": null,
|
||||
"src": "867:10:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address_payable",
|
||||
"typeString": "address payable"
|
||||
}
|
||||
},
|
||||
"functionReturnParameters": 364,
|
||||
"id": 367,
|
||||
"nodeType": "Return",
|
||||
"src": "860:17:2"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 369,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
"name": "_msgSender",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 361,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "807:2:2"
|
||||
},
|
||||
"returnParameters": {
|
||||
"id": 364,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 363,
|
||||
"name": "",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 369,
|
||||
"src": "833:15:2",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address_payable",
|
||||
"typeString": "address payable"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 362,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "833:15:2",
|
||||
"stateMutability": "payable",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address_payable",
|
||||
"typeString": "address payable"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "832:17:2"
|
||||
},
|
||||
"scope": 381,
|
||||
"src": "788:96:2",
|
||||
"stateMutability": "view",
|
||||
"superFunction": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 379,
|
||||
"nodeType": "Block",
|
||||
"src": "947:165:2",
|
||||
"statements": [
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"id": 374,
|
||||
"name": "this",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1071,
|
||||
"src": "957:4:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_contract$_Context_$381",
|
||||
"typeString": "contract Context"
|
||||
}
|
||||
},
|
||||
"id": 375,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "957:4:2"
|
||||
},
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"id": 376,
|
||||
"name": "msg",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1057,
|
||||
"src": "1097:3:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_magic_message",
|
||||
"typeString": "msg"
|
||||
}
|
||||
},
|
||||
"id": 377,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"memberName": "data",
|
||||
"nodeType": "MemberAccess",
|
||||
"referencedDeclaration": null,
|
||||
"src": "1097:8:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_calldata_ptr",
|
||||
"typeString": "bytes calldata"
|
||||
}
|
||||
},
|
||||
"functionReturnParameters": 373,
|
||||
"id": 378,
|
||||
"nodeType": "Return",
|
||||
"src": "1090:15:2"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 380,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
"name": "_msgData",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 370,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "907:2:2"
|
||||
},
|
||||
"returnParameters": {
|
||||
"id": 373,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 372,
|
||||
"name": "",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 380,
|
||||
"src": "933:12:2",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "memory",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_memory_ptr",
|
||||
"typeString": "bytes"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 371,
|
||||
"name": "bytes",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "933:5:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_storage_ptr",
|
||||
"typeString": "bytes"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "932:14:2"
|
||||
},
|
||||
"scope": 381,
|
||||
"src": "890:222:2",
|
||||
"stateMutability": "view",
|
||||
"superFunction": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"scope": 382,
|
||||
"src": "525:589:2"
|
||||
}
|
||||
],
|
||||
"src": "0:1115:2"
|
||||
},
|
||||
"legacyAST": {
|
||||
"absolutePath": "@openzeppelin/contracts/GSN/Context.sol",
|
||||
"exportedSymbols": {
|
||||
"Context": [
|
||||
381
|
||||
]
|
||||
},
|
||||
"id": 382,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 356,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"^",
|
||||
"0.5",
|
||||
".0"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:2"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 381,
|
||||
"linearizedBaseContracts": [
|
||||
381
|
||||
],
|
||||
"name": "Context",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": {
|
||||
"id": 359,
|
||||
"nodeType": "Block",
|
||||
"src": "726:3:2",
|
||||
"statements": []
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 360,
|
||||
"implemented": true,
|
||||
"kind": "constructor",
|
||||
"modifiers": [],
|
||||
"name": "",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 357,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "714:2:2"
|
||||
},
|
||||
"returnParameters": {
|
||||
"id": 358,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "726:0:2"
|
||||
},
|
||||
"scope": 381,
|
||||
"src": "702:27:2",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 368,
|
||||
"nodeType": "Block",
|
||||
"src": "850:34:2",
|
||||
"statements": [
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"id": 365,
|
||||
"name": "msg",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1057,
|
||||
"src": "867:3:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_magic_message",
|
||||
"typeString": "msg"
|
||||
}
|
||||
},
|
||||
"id": 366,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"memberName": "sender",
|
||||
"nodeType": "MemberAccess",
|
||||
"referencedDeclaration": null,
|
||||
"src": "867:10:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address_payable",
|
||||
"typeString": "address payable"
|
||||
}
|
||||
},
|
||||
"functionReturnParameters": 364,
|
||||
"id": 367,
|
||||
"nodeType": "Return",
|
||||
"src": "860:17:2"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 369,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
"name": "_msgSender",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 361,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "807:2:2"
|
||||
},
|
||||
"returnParameters": {
|
||||
"id": 364,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 363,
|
||||
"name": "",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 369,
|
||||
"src": "833:15:2",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address_payable",
|
||||
"typeString": "address payable"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 362,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "833:15:2",
|
||||
"stateMutability": "payable",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address_payable",
|
||||
"typeString": "address payable"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "832:17:2"
|
||||
},
|
||||
"scope": 381,
|
||||
"src": "788:96:2",
|
||||
"stateMutability": "view",
|
||||
"superFunction": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 379,
|
||||
"nodeType": "Block",
|
||||
"src": "947:165:2",
|
||||
"statements": [
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"id": 374,
|
||||
"name": "this",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1071,
|
||||
"src": "957:4:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_contract$_Context_$381",
|
||||
"typeString": "contract Context"
|
||||
}
|
||||
},
|
||||
"id": 375,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "957:4:2"
|
||||
},
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"id": 376,
|
||||
"name": "msg",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1057,
|
||||
"src": "1097:3:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_magic_message",
|
||||
"typeString": "msg"
|
||||
}
|
||||
},
|
||||
"id": 377,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"memberName": "data",
|
||||
"nodeType": "MemberAccess",
|
||||
"referencedDeclaration": null,
|
||||
"src": "1097:8:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_calldata_ptr",
|
||||
"typeString": "bytes calldata"
|
||||
}
|
||||
},
|
||||
"functionReturnParameters": 373,
|
||||
"id": 378,
|
||||
"nodeType": "Return",
|
||||
"src": "1090:15:2"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 380,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
"name": "_msgData",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 370,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "907:2:2"
|
||||
},
|
||||
"returnParameters": {
|
||||
"id": 373,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 372,
|
||||
"name": "",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 380,
|
||||
"src": "933:12:2",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "memory",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_memory_ptr",
|
||||
"typeString": "bytes"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 371,
|
||||
"name": "bytes",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "933:5:2",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_storage_ptr",
|
||||
"typeString": "bytes"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "932:14:2"
|
||||
},
|
||||
"scope": 381,
|
||||
"src": "890:222:2",
|
||||
"stateMutability": "view",
|
||||
"superFunction": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"scope": 382,
|
||||
"src": "525:589:2"
|
||||
}
|
||||
],
|
||||
"src": "0:1115:2"
|
||||
},
|
||||
"compiler": {
|
||||
"name": "solc",
|
||||
"version": "0.5.12+commit.7709ece9.Emscripten.clang"
|
||||
},
|
||||
"networks": {},
|
||||
"schemaVersion": "3.0.19",
|
||||
"updatedAt": "2019-12-29T01:52:30.751Z",
|
||||
"devdoc": {
|
||||
"methods": {}
|
||||
},
|
||||
"userdoc": {
|
||||
"methods": {}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,144 @@
|
|||
pragma solidity 0.5.12;
|
||||
|
||||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
import "@openzeppelin/contracts/math/SafeMath.sol";
|
||||
// ----------------------------------------------------------------------------
|
||||
// 'DECA' DEcentralized CArbon tokens - ITDE (initial token distribution event)
|
||||
//
|
||||
// Deployed to : ------
|
||||
// Network : Ropsten
|
||||
// Symbol : DECA
|
||||
// Name : DEcentralized CArbon tokens
|
||||
// Total supply: Gazillion
|
||||
// Decimals : 18
|
||||
//
|
||||
// Designed and wrote by D. Perez Negron <david@neetsec.com> A.K.A p1r0
|
||||
// Test and Migrations to truffle by vitaliykuzmich
|
||||
// ----------------------------------------------------------------------------
|
||||
/**
|
||||
* @dev The reason using this instead of openzeppelin, because owner are not 'payable'
|
||||
*/
|
||||
contract Ownable is Context {
|
||||
address payable private _owner;
|
||||
using SafeMath for uint256;
|
||||
|
||||
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
||||
|
||||
/**
|
||||
* @dev Initializes the contract setting the deployer as the initial owner.
|
||||
*/
|
||||
constructor () internal {
|
||||
_owner = _msgSender();
|
||||
emit OwnershipTransferred(address(0), _owner);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the address of the current owner.
|
||||
*/
|
||||
function owner() public view returns (address payable) {
|
||||
return _owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Throws if called by any account other than the owner.
|
||||
*/
|
||||
modifier onlyOwner() {
|
||||
require(isOwner(), "Ownable: caller is not the owner");
|
||||
_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns true if the caller is the current owner.
|
||||
*/
|
||||
function isOwner() public view returns (bool) {
|
||||
return _msgSender() == _owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Leaves the contract without owner. It will not be possible to call
|
||||
* `onlyOwner` functions anymore. Can only be called by the current owner.
|
||||
*
|
||||
* NOTE: Renouncing ownership will leave the contract without an owner,
|
||||
* thereby removing any functionality that is only available to the owner.
|
||||
*/
|
||||
function renounceOwnership() public onlyOwner {
|
||||
emit OwnershipTransferred(_owner, address(0));
|
||||
_owner = address(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Transfers ownership of the contract to a new account (`newOwner`).
|
||||
* Can only be called by the current owner.
|
||||
*/
|
||||
function transferOwnership(address payable newOwner) public onlyOwner {
|
||||
_transferOwnership(newOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Transfers ownership of the contract to a new account (`newOwner`).
|
||||
*/
|
||||
function _transferOwnership(address payable newOwner) internal {
|
||||
require(newOwner != address(0), "Ownable: new owner is the zero address");
|
||||
emit OwnershipTransferred(_owner, newOwner);
|
||||
_owner = newOwner;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ERC20 Token, with the addition of symbol, name and decimals and assisted
|
||||
// token transfers
|
||||
// ----------------------------------------------------------------------------
|
||||
contract DECAToken is ERC20, Ownable {
|
||||
using SafeMath for uint256;
|
||||
string constant public symbol = "DECA";
|
||||
string constant public name = "DEcentralized CArbon tokens";
|
||||
uint8 constant public decimals = 18;
|
||||
//for testing change weeks for hours...
|
||||
uint public preICOEnds = now + 1 weeks;
|
||||
uint public bonus1Ends = now + 3 weeks;
|
||||
uint public bonus2Ends = now + 6 weeks;
|
||||
uint public endDate = now + 11 weeks;
|
||||
// ------------------------------------------------------------------------
|
||||
// 100 DECA Tokens per 1 ETH
|
||||
// ------------------------------------------------------------------------
|
||||
function() external payable {
|
||||
require(now <= endDate);
|
||||
uint tokens;
|
||||
uint toOwner;
|
||||
uint toSender;
|
||||
uint divBy;
|
||||
|
||||
divBy = 40; //2.5% extra printed to be 2% of the marketcap, please see README.md
|
||||
if (now <= preICOEnds) {
|
||||
tokens = msg.value * 200;
|
||||
} else if (now > preICOEnds && now <= bonus1Ends) {
|
||||
tokens = msg.value * 150;
|
||||
} else if (now > bonus1Ends && now <= bonus2Ends) {
|
||||
tokens = msg.value * 125;
|
||||
} else {
|
||||
tokens = msg.value * 100;
|
||||
}
|
||||
|
||||
toOwner = tokens.div(divBy);
|
||||
//created 2.5% extra to the contract owner to approach 2% total marketcap
|
||||
toSender = tokens;
|
||||
//tokens that goes to the sender
|
||||
|
||||
_mint(owner(), toOwner);
|
||||
_mint(msg.sender, toSender);
|
||||
}
|
||||
|
||||
//Close down the ICO and claim the Ether.
|
||||
function getETH() public onlyOwner {
|
||||
require(now >= endDate);
|
||||
// transfer the ETH balance in the contract to the owner
|
||||
owner().transfer(address(this).balance);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Owner can transfer out any accidentally sent ERC20 tokens
|
||||
// ------------------------------------------------------------------------
|
||||
function transferAnyERC20Token(address payable tokenAddress, uint tokens) public onlyOwner returns (bool success) {
|
||||
return IERC20(tokenAddress).transfer(owner(), tokens);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
pragma solidity >=0.4.21 <0.7.0;
|
||||
|
||||
contract Migrations {
|
||||
address public owner;
|
||||
uint public last_completed_migration;
|
||||
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
modifier restricted() {
|
||||
if (msg.sender == owner) _;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
const Migrations = artifacts.require("Migrations");
|
||||
|
||||
module.exports = function (deployer) {
|
||||
deployer.deploy(Migrations);
|
||||
};
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
var DECAToken = artifacts.require("DECAToken");
|
||||
|
||||
module.exports = function(deployer) {
|
||||
const name = "DEcentralized CArbon tokens";
|
||||
const symbol = "DECA";
|
||||
const decimals = 18;
|
||||
deployer.deploy(DECAToken, name, symbol, decimals);
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "carbon-token",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "truffle-config.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"openzeppelin-solidity": "2.4.0",
|
||||
"solc": "^0.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"web3": "^1.2.4"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/**
|
||||
* Use this file to configure your truffle project. It's seeded with some
|
||||
* common settings for different networks and features like migrations,
|
||||
* compilation and testing. Uncomment the ones you need or modify
|
||||
* them to suit your project as necessary.
|
||||
*
|
||||
* More information about configuration can be found at:
|
||||
*
|
||||
* truffleframework.com/docs/advanced/configuration
|
||||
*
|
||||
* To deploy via Infura you'll need a wallet provider (like truffle-hdwallet-provider)
|
||||
* to sign your transactions before they're sent to a remote public node. Infura accounts
|
||||
* are available for free at: infura.io/register.
|
||||
*
|
||||
* You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
|
||||
* public/private key pairs. If you're publishing your code to GitHub make sure you load this
|
||||
* phrase from a file you've .gitignored so it doesn't accidentally become public.
|
||||
*
|
||||
*/
|
||||
|
||||
// const HDWalletProvider = require('truffle-hdwallet-provider');
|
||||
// const infuraKey = "fj4jll3k.....";
|
||||
//
|
||||
// const fs = require('fs');
|
||||
// const mnemonic = fs.readFileSync(".secret").toString().trim();
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Networks define how you connect to your ethereum client and let you set the
|
||||
* defaults web3 uses to send transactions. If you don't specify one truffle
|
||||
* will spin up a development blockchain for you on port 9545 when you
|
||||
* run `develop` or `test`. You can ask a truffle command to use a specific
|
||||
* network from the command line, e.g
|
||||
*
|
||||
* $ truffle test --network <network-name>
|
||||
*/
|
||||
|
||||
networks: {
|
||||
// Useful for testing. The `development` name is special - truffle uses it by default
|
||||
// if it's defined here and no other network is specified at the command line.
|
||||
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
|
||||
// tab if you use this network and you must also set the `host`, `port` and `network_id`
|
||||
// options below to some value.
|
||||
//
|
||||
// development: {
|
||||
// host: "127.0.0.1", // Localhost (default: none)
|
||||
// port: 8545, // Standard Ethereum port (default: none)
|
||||
// network_id: "*", // Any network (default: none)
|
||||
// },
|
||||
|
||||
// Another network with more advanced options...
|
||||
// advanced: {
|
||||
// port: 8777, // Custom port
|
||||
// network_id: 1342, // Custom network
|
||||
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
|
||||
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
|
||||
// from: <address>, // Account to send txs from (default: accounts[0])
|
||||
// websockets: true // Enable EventEmitter interface for web3 (default: false)
|
||||
// },
|
||||
|
||||
// Useful for deploying to a public network.
|
||||
// NB: It's important to wrap the provider as a function.
|
||||
// ropsten: {
|
||||
// provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),
|
||||
// network_id: 3, // Ropsten's id
|
||||
// gas: 5500000, // Ropsten has a lower block limit than mainnet
|
||||
// confirmations: 2, // # of confs to wait between deployments. (default: 0)
|
||||
// timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
|
||||
// skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
|
||||
// },
|
||||
|
||||
// Useful for private networks
|
||||
// private: {
|
||||
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
|
||||
// network_id: 2111, // This network is yours, in the cloud.
|
||||
// production: true // Treats this network as if it was a public net. (default: false)
|
||||
// }
|
||||
|
||||
development: {
|
||||
host: "localhost",
|
||||
port: 8545,
|
||||
network_id: "*",
|
||||
gas: 6712390
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// Set default mocha options here, use special reporters etc.
|
||||
mocha: {
|
||||
// timeout: 100000
|
||||
},
|
||||
|
||||
}
|
Loading…
Reference in New Issue