This repository contains all Ethereum Smart Contracts used at Knowledge.
Truffle is our development, testing and deployment framework.
OpenZeppelin is the solidity library we use for writing secure Smart Contracts on Ethereum.
We follow the Knowledge Project Guidelines and Consensys Best Practices.
The Knowledge Token Sale starts on January 15, 2018 and it ends April 8th at 12pm. For more information visit knowledge.io or join the Knowledge Token Channel on Telegram where we'll be happy to discuss any questions you may have about our platform.
- Smart contract compilation, deployment and binary management with Truffle.
- Automated contract testing with Mocha and Chai.
- Solidity code linting with Solium.
- Automated known vulnerability checks with Solium.
- JavaScript code linting with StandardJS.
- Secure solidity utility functions with OpenZeppelin Solidity
- Continuous integration testing with Travis CI
- Code testing coverage reports with solidity-coverage and codecov
- Ethereum gas cost reporter with eth-gas-reporter
- Configurable build pipeline with support for custom build processes.
- Scriptable deployment & migrations with Truffle framework.
- Upgradable ERC20 Token contract.
- Network management for deploying to many public & private networks.
- Ropsten TestNet deployment script.
- Interactive console for direct contract communication.
- Instant rebuilding of assets during development.
- External script runner that executes scripts within a Truffle environment.
All ethereum solidity smart contracts can be found in the /contracts
directory.
- ERC20Token.sol is a standard ERC20 token contract, based on OpenZeppelin implementation.
- KnowledgeToken.sol is the ERC20 Token contract implementation for the KNW token.
150,000,000.00000000
tokens are created in total. - UpgradableToken.sol is used to be able to upgrade the contract. If we ever discover a security vulnerability or have the need to publish a another version of the token contract users will be able to migrate their tokens to the new contract version. It's inspired by Lunyr and Civic token contract.
- PayableToken.sol is used to receive payments at the Knowledge Marketplace and Adviser Self Service Platform. It can generate payment requests and manage fees.
- /utils/ is meant for utilitarian contracts, such as SafeMath or Ownable.
- /interfaces/ are contracts used just for type safety.
For you to able to understand and execute the code in this repository advanced knowledge of JavaScript, Node.js and Ethereum is required. If you are not familiar with these technologies we suggest you to visit ethereum.org and learnnode.com.
To get started with smart contract programming with Solidity you can find an introduction to the language in the Solidity documentation. In the documentation, you can find code examples as well as a reference of the syntax and details on how to write smart contracts.
You can start using Solidity in your browser with no need to download or compile anything.
You need some global environment configurations
- install Node.js v8.9.3. We recommend using nvm and avn to manage the node versions.
In the project root directory run npm install
to install all project dependencies
In separate tabs of your console run the following commands:
npm run ganache
npm run deploy
For more information visit the Truffle Framework documentation.
We do both static linting and analysis and functional tests.
npm run ganache
npm run lint
npm run test
You can run scripts with automated functionality like creating contracts and transfer tokens. Here's a list of scripts and how to run them:
npm run truffle:exec -- current-version
- Displays the current versionnpm run truffle:exec -- deploy-first-time [--network development]
- Deploy all the neccesary contracts needed for the first time, or if you want to just create all the contracts again form zeronpm run truffle:exec -- upgrade-to-contract [--network development]
- Upgrades the proxy contract to a new version, you'll be prompted with the contract name (the contract class name) of the contract to upgrade to. This will also updates the CURRENT_VERSION file in the rootnpm run truffle:exec -- transfer-tokens [--network development]
- This will help you transfer tokens from an account to anothernpm run truffle:exec -- transfer-ether [--network development]
- This will help you transfer ether from an account to another
Read the contributing guidelines for details.
Please report bugs big and small by opening an issue. No possible bug report is too small.
MIT © Knowledge
See LICENSE for more info
Blockchain technology is rebuilding the internet in a trustless, decentralized way, allowing for fundamental core improvements on existing business models and industries, and a new breed of dot-io powerhouse frameworks are emerging. Knowledge.io is producing an ecosystem that offers significant improvement in the areas of ad tech, commerce, education, and employment, and a supply and demand marketplace of goods and services, all based around rewarding users for what the massive and centralized supergiants utilize to make extraordinary profits - people’s data. The Knowledge.io ecosystem is built on the foundation of decentralization and rewarding people for sharing their knowledge.