Decentralized Carbon Credits in an ERC20 by Neetsec
[[TOC]]
|-- LICENSE
|-- README.md
|-- contracts
|-- build
| |-- contracts
| |-- Context.json
| |-- DECA.json
| |-- ERC20.json
| |-- IERC20.json
| |-- Migrations.json
| |-- Ownable.json
| `-- SafeMath.json
| |-- DECA.sol
| `-- Migrations.sol
|-- migrations
| |-- 1_initial_migration.js
| `-- 2_deploy_contracts.js
|-- package.json
|-- run-rpc.sh
|-- test
| `-- DECA.js
|-- truffle.js
|-- .gitignore
|-- .gitlab-ci.yml- Node.js >= 12
- @openzeppelin/contracts = 2.4.0
- ganache-cli >= 6.9.1
- truffle = 5.1.3
Download and install Node.js v12.x and npm.
- Node.js
Using Ubuntu
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
$ sudo apt-get install -y nodejsUsing Debian, as root
$ curl -sL https://deb.nodesource.com/setup_12.x | bash -
$ apt-get install -y nodejsClone the repo
$ git clone https://gitlab.com/deca-currency/dcc.git
$ cd dccInstall the dependencies
$ npm installInstall ganache-cli
$ sudo npm install -g ganache-cliInstall truffle
$ sudo npm install -g truffle@5.1.3- can see the test in pipelines or you can run it locally
- open shell and execute "./run-rpc.sh" (remember change /usr/local/bin/ganache-cli to your path)
$ ./run-rpc.sh- open second shell, and execute
$ truffle testsClass Diagram ERC20 Token generated with sol2uml
Apart from the ERC20 standard methods that our token complies, we introduce some improvements, either for security or others that match DECA specific requirements.
Notes:
- The following specifications use syntax from Solidity (0.5.12)
Returns the address of the current owner.
function owner() public view returns (address payable)Returns true if the caller is the current owner.
function isOwner() public view returns (bool)Can only be called by the current owner.
function transferOwnership(address payable newOwner) public onlyOwner Updates the official orbitDB address for carbon credits.
Can Only be updated by the current owner
function updateCCDBAddress(string memory newCCDBAddress) public onlyOwner Owner can transfer out any accidentally sent ERC20 tokens
function transferAnyERC20Token(address payable tokenAddress, uint tokens) public onlyOwner returns (bool success)Close down the ICO and claim the Ether.
function getETH() public onlyOwner { require(now >= endDate); owner().transfer(address(this).balance); }Now, based on the total Ethereums we got by the ICO (ETHTS) and considering our promodates which are:
| PROMO | TIME (weeks) | DECA TOKENS PER ETH |
|---|---|---|
| preICO | 1 | 300 |
| Bonus1 | 2 | 275 |
| Bonus2 | 3 | 250 |
| ICO | 5 | 225 |
