Skip to content

Commit

Permalink
Init BitScreener SmartContracts project
Browse files Browse the repository at this point in the history
  • Loading branch information
tobernguyen committed Jun 26, 2018
0 parents commit e487e17
Show file tree
Hide file tree
Showing 19 changed files with 7,789 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INFURA_API_KEY=API_KEY
MNENOMIC=MNEOMIC_FROM_METAMASK
52 changes: 52 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
extends: airbnb-base
env:
node: true
jest: true
es6: true
parserOptions:
sourceType: strict
rules:
generator-star-spacing:
- 2
- before: true
after: true
no-shadow: 0
require-yield: 0
no-param-reassign: 0
comma-dangle:
- error
- never
no-underscore-dangle: 0
import/no-extraneous-dependencies:
- 2
- devDependencies: true
import/order:
- error
func-names: 0
no-unused-expressions: 0
prefer-arrow-callback: 1
no-use-before-define:
- 2
- functions: false
space-before-function-paren:
- 2
- always
max-len:
- 2
- 120
- 2
-
ignoreStrings: true
ignoreComments: true
ignoreTemplateLiterals: true
semi:
- 2
- never
strict:
- 2
- global
arrow-parens:
- 2
- always
no-console: 0
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.*sw*
.env
node_modules
build/
.DS_Store
scripts/data
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"solidity.soliumRules": {
"imports-on-top": 0,
"variable-declarations": 0,
"indentation": [
"error",
2
],
"quotes": [
"error",
"single"
]
}
}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BitScreener, one of the best real-time crypto-tracking platforms, has served more than 1,2 million traders and investors worldwide to track their investments since launch in 2017.

It is now integrating crowdsourcing financial data and content ecosystem on blockchain through token BITX. BITX works as the payment method for financial traders and investors to buy advanced data services and the incentive method for the value contributors of the ecosystem.

BitScreener will be a financial data marketplace for financial professionals and engineers to monetize their investment knowledge. The full ecosystem aims to track and analyze 100,000+ stocks worldwide together with existing 2000+ cryptos in a single platform.

Smart contract is published in Ethereum blockchain. Address is: [0xff2b3353c3015e9f1fbf95b9bda23f58aa7ce007](https://etherscan.io/address/0xff2b3353c3015e9f1fbf95b9bda23f58aa7ce007)

For more information about BitScreener and the Token sale please visit:

https://tokensale.bitscreener.com/
27 changes: 27 additions & 0 deletions contracts/BITXDistributionTools.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
pragma solidity ^0.4.24;

import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
import './BitScreenerToken.sol';

contract BITXDistributionTools is Ownable {
BitScreenerToken public token;

constructor(BitScreenerToken _token)
public
{
token = _token;
}

function issueToMany(address[] _recipients, uint256[] _amount)
public
onlyOwner
{
require(_recipients.length == _amount.length);
for (uint i = 0; i < _recipients.length; i++) {
// Issue once only
if (token.balanceOf(_recipients[i]) < _amount[i]) {
require(token.issue(_recipients[i], _amount[i]));
}
}
}
}
94 changes: 94 additions & 0 deletions contracts/BitScreenerToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
pragma solidity ^0.4.24;

import 'openzeppelin-solidity/contracts/token/ERC827/ERC827Token.sol';
import './MultiOwnable.sol';

contract BitScreenerToken is ERC827Token, MultiOwnable {
string public name = 'BitScreenerToken';
string public symbol = 'BITX';
uint8 public decimals = 18;
uint256 public totalSupply;
address public owner;

bool public allowTransfers = false;
bool public issuanceFinished = false;

event AllowTransfersChanged(bool _newState);
event Issue(address indexed _to, uint256 _value);
event Burn(address indexed _from, uint256 _value);
event IssuanceFinished();

modifier transfersAllowed() {
require(allowTransfers);
_;
}

modifier canIssue() {
require(!issuanceFinished);
_;
}

constructor(address[] _owners) public {
_setOwners(_owners);
}

/**
* @dev Enable/disable token transfers. Can be called only by owners
* @param _allowTransfers True - allow False - disable
*/
function setAllowTransfers(bool _allowTransfers) external onlyOwner {
allowTransfers = _allowTransfers;
emit AllowTransfersChanged(_allowTransfers);
}

function transfer(address _to, uint256 _value) public transfersAllowed returns (bool) {
return super.transfer(_to, _value);
}

function transferFrom(address _from, address _to, uint256 _value) public transfersAllowed returns (bool) {
return super.transferFrom(_from, _to, _value);
}

function transferAndCall(address _to, uint256 _value, bytes _data) public payable transfersAllowed returns (bool) {
return super.transferAndCall(_to, _value, _data);
}

function transferFromAndCall(address _from, address _to, uint256 _value, bytes _data) public payable transfersAllowed returns (bool) {
return super.transferFromAndCall(_from, _to, _value, _data);
}

/**
* @dev Issue tokens to specified wallet
* @param _to Wallet address
* @param _value Amount of tokens
*/
function issue(address _to, uint256 _value) external onlyOwner canIssue returns (bool) {
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Issue(_to, _value);
emit Transfer(address(0), _to, _value);
return true;
}

/**
* @dev Finish token issuance
* @return True if success
*/
function finishIssuance() public onlyOwner returns (bool) {
issuanceFinished = true;
emit IssuanceFinished();
return true;
}

/**
* @dev Burn tokens
* @param _value Amount of tokens to burn
*/
function burn(uint256 _value) external {
require(balances[msg.sender] >= _value);
totalSupply = totalSupply.sub(_value);
balances[msg.sender] = balances[msg.sender].sub(_value);
emit Transfer(msg.sender, address(0), _value);
emit Burn(msg.sender, _value);
}
}
23 changes: 23 additions & 0 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pragma solidity ^0.4.24;

contract Migrations {
address public owner;
uint256 public last_completed_migration;

modifier restricted() {
if (msg.sender == owner) _;
}

constructor() public {
owner = msg.sender;
}

function setCompleted(uint256 completed) public restricted {
last_completed_migration = completed;
}

function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
51 changes: 51 additions & 0 deletions contracts/MultiOwnable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
pragma solidity ^0.4.24;

/**
* @title MultiOwnable
* @dev The MultiOwnable contract has owners addresses and provides basic authorization control
* functions, this simplifies the implementation of "users permissions".
*/
contract MultiOwnable {
address public manager; // address used to set owners
address[] public owners;
mapping(address => bool) public ownerByAddress;

event SetOwners(address[] owners);

modifier onlyOwner() {
require(ownerByAddress[msg.sender] == true);
_;
}

/**
* @dev MultiOwnable constructor sets the manager
*/
constructor() public {
manager = msg.sender;
}

/**
* @dev Function to set owners addresses
*/
function setOwners(address[] _owners) public {
require(msg.sender == manager);
_setOwners(_owners);
}

function _setOwners(address[] _owners) internal {
for(uint256 i = 0; i < owners.length; i++) {
ownerByAddress[owners[i]] = false;
}


for(uint256 j = 0; j < _owners.length; j++) {
ownerByAddress[_owners[j]] = true;
}
owners = _owners;
emit SetOwners(_owners);
}

function getOwners() public view returns (address[]) {
return owners;
}
}
Loading

0 comments on commit e487e17

Please sign in to comment.