Last active
December 10, 2018 04:59
-
-
Save Juan-cc/7bc4424f2fe5f69d3ce671ea18fd2564 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
import "github.com/ConsenSys/Tokens/contracts/eip20/EIP20.sol"; | |
import "github.com/ConsenSys/Tokens/contracts/eip20/EIP20Interface.sol"; | |
import "github.com/ConsenSys/Tokens/contracts/eip20/EIP20Factory.sol"; | |
contract Owned{ | |
address private owner; | |
constructor() public{ | |
owner = msg.sender; | |
} | |
modifier ownerOnly(address _owner){ | |
require(owner == _owner, "Access denied. Company owner only."); | |
_; | |
} | |
function modifyOwner(address _owner) | |
public | |
ownerOnly(msg.sender) | |
{ | |
owner = _owner; | |
} | |
} | |
contract KM is Owned { | |
//address public kmOwner; | |
mapping (address => address) public companiesByOwner; | |
address private bcFactory; | |
address private tokenFactory; | |
constructor() public { | |
//kmOwner = msg.sender; | |
tokenFactory = new EIP20Factory(); | |
bcFactory = new BCFactory(); | |
} | |
function createToken(uint256 _initialAmount, string _name, uint8 _decimals, string _symbol) | |
public | |
ownerOnly(msg.sender) | |
returns(address){ | |
return EIP20Factory(tokenFactory).createEIP20( _initialAmount, _name, _decimals, _symbol); | |
} | |
} | |
contract BC is Owned { | |
//address public bcOwner; | |
mapping (address => bool) public admins; | |
string private name; | |
string private phone; | |
string private url; | |
string private did; | |
address private uPortAddress; | |
constructor(string _companyName, string _phone, string _url, string _did, address _uPortAddress) | |
public | |
{ | |
name = _companyName; | |
phone = _phone; | |
url = _url; | |
did = _did; | |
uPortAddress = _uPortAddress; | |
} | |
/*function createBC(string _companyName, string _phone, string _url, string _did, address _uPortAddress) | |
public | |
ownerOnly(msg.sender) | |
{ | |
name = _companyName; | |
phone = _phone; | |
url = _url; | |
did = _did; | |
uPortAddress = _uPortAddress; | |
}*/ | |
} | |
contract BCFactory is Owned { | |
mapping (address => BC) companies; | |
function createBCCompany(string companyName, string phone, string url, string did, address uPortAddress) | |
public | |
ownerOnly(msg.sender) | |
{ | |
BC company = new BC(companyName, phone, url, did, uPortAddress); | |
companies[company] = company; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment