diff --git a/contracts/ERC223/ERC223.sol b/contracts/ERC223/ERC223.sol deleted file mode 100644 index 2be35dd..0000000 --- a/contracts/ERC223/ERC223.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma solidity ^0.4.19; - -/** -* @title ERC223 interface -* @dev see https://github.com/ethereum/eips/issues/223 -*/ -contract ERC223 { - function transfer(address _to, uint _value, bytes _data) public returns (bool success); - function transfer(address _to, uint _value, bytes _data, string _fallback) public returns (bool success); - event Transfer(address indexed from, address indexed to, uint value, bytes data); -} diff --git a/contracts/ERC223/ERC223Token.sol b/contracts/ERC223/ERC223Token.sol deleted file mode 100644 index fb45b8d..0000000 --- a/contracts/ERC223/ERC223Token.sol +++ /dev/null @@ -1,169 +0,0 @@ -pragma solidity ^0.4.19; - -import "./ERC223.sol"; -import "./ERC223TokenReceiver.sol"; -import "zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; -import "zeppelin-solidity/contracts/math/SafeMath.sol"; - - -/** -* @title ERC223Token -* @dev Generic implementation for the required functionality of the ERC223 standard. -* @dev -*/ -contract ERC223Token is ERC223, ERC20Basic { - using SafeMath for uint256; - - string public name; - string public symbol; - uint8 public decimals; - uint256 public totalSupply; - mapping(address => uint256) public balances; - - /** - * @dev Function to access name of token. - * @return _name string the name of the token. - */ - function name() public view returns (string _name) { - return name; - } - - /** - * @dev Function to access symbol of token. - * @return _symbol string the symbol of the token. - */ - function symbol() public view returns (string _symbol) { - return symbol; - } - - /** - * @dev Function to access decimals of token. - * @return _decimals uint8 decimal point of token fractions. - */ - function decimals() public view returns (uint8 _decimals) { - return decimals; - } - - /** - * @dev Function to access total supply of tokens. - * @return _totalSupply uint256 total token supply. - */ - function totalSupply() public view returns (uint256 _totalSupply) { - return totalSupply; - } - - /** - * @dev Function to access the balance of a specific address. - * @param _owner address the target address to get the balance from. - * @return _balance uint256 the balance of the target address. - */ - function balanceOf(address _owner) public view returns (uint256 _balance) { - return balances[_owner]; - } - - /** - * @dev Function that is called when a user or another contract wants to transfer funds using custom fallback. - * @param _to address to which the tokens are transfered. - * @param _value uint256 amount of tokens to be transfered. - * @param _data bytes data along token transaction. - * @param _fallback string name of the custom fallback function to be called after transaction. - */ - function transfer(address _to, uint256 _value, bytes _data, string _fallback) public returns (bool _success) { - if (isContract(_to)) { - if (balanceOf(msg.sender) < _value) - revert(); - balances[msg.sender] = balanceOf(msg.sender).sub(_value); - balances[_to] = balanceOf(_to).add(_value); - - // Calls the custom fallback function. - // Will fail if not implemented, reverting transaction. - assert(_to.call.value(0)(bytes4(keccak256(_fallback)), msg.sender, _value, _data)); - - Transfer(msg.sender, _to, _value, _data); - return true; - } else { - return transferToAddress(_to, _value, _data); - } - } - - /** - * @dev Function that is called when a user or another contract wants to transfer funds using default fallback. - * @param _to address to which the tokens are transfered. - * @param _value uint256 amount of tokens to be transfered. - * @param _data bytes data along token transaction. - */ - function transfer(address _to, uint256 _value, bytes _data) public returns (bool _success) { - if (isContract(_to)) { - return transferToContract(_to, _value, _data); - } else { - return transferToAddress(_to, _value, _data); - } - } - - /** - * @dev Standard function transfer similar to ERC20 transfer with no _data. - * Added due to backwards compatibility reasons. - * @param _to address to which the tokens are transfered. - * @param _value uint256 amount of tokens to be transfered. - */ - function transfer(address _to, uint256 _value) public returns (bool _success) { - // Adds empty bytes to fill _data param in functions - bytes memory empty; - if (isContract(_to)) { - return transferToContract(_to, _value, empty); - } else { - return transferToAddress(_to, _value, empty); - } - } - - /** - * @dev Function to test whether target address is a contract. - * @param _addr address to be tested as a contract address or something else. - * @return _isContract bool true if target address is a contract false otherwise. - */ - function isContract(address _addr) private view returns (bool _isContract) { - uint length; - assembly { - length := extcodesize(_addr) - } - return (length > 0); - } - - /** - * @dev Function that is called when transaction target is an address. - * @param _to address to which the tokens are transfered. - * @param _value uint256 amount of tokens to be transfered. - * @param _data bytes data along token transaction. - */ - function transferToAddress(address _to, uint256 _value, bytes _data) private returns (bool _success) { - if (balanceOf(msg.sender) < _value) - revert(); - balances[msg.sender] = balanceOf(msg.sender).sub(_value); - balances[_to] = balanceOf(_to).add(_value); - - Transfer(msg.sender, _to, _value, _data); - return true; - } - - /** - * @dev Function that is called when transaction target is a contract. - * @param _to address to which the tokens are transfered. - * @param _value uint256 amount of tokens to be transfered. - * @param _data bytes data along token transaction. - */ - function transferToContract(address _to, uint256 _value, bytes _data) private returns (bool _success) { - if (balanceOf(msg.sender) < _value) { - revert(); - } - balances[msg.sender] = balanceOf(msg.sender).sub(_value); - balances[_to] = balanceOf(_to).add(_value); - - // Calls the default fallback function. - // Will fail if not implemented, reverting transaction. - ERC223TokenReceiver receiver = ERC223TokenReceiver(_to); - receiver.tokenFallback(msg.sender, _value, _data); - - Transfer(msg.sender, _to, _value, _data); - return true; - } -} diff --git a/contracts/ERC223/ERC223TokenReceiver.sol b/contracts/ERC223/ERC223TokenReceiver.sol deleted file mode 100644 index c8465f0..0000000 --- a/contracts/ERC223/ERC223TokenReceiver.sol +++ /dev/null @@ -1,42 +0,0 @@ -pragma solidity ^0.4.19; - - -/** - * @title ERC223 token handler - * @dev see https://github.com/ethereum/eips/issues/223 - */ -contract ERC223TokenReceiver { - - struct TKN { - address sender; - //address origin; - uint256 value; - bytes data; - bytes4 sig; - } - - /** - * @dev Fallback function. Transaction will fail if not implemented in receiver contract. - * @param _from address from which the tokens are transfered. - * @param _value uint256 amount of tokens to be transfered. - * @param _data bytes data along token transaction. - */ - function tokenFallback(address _from, uint256 _value, bytes _data) public pure { - TKN memory tkn; - tkn.sender = _from; - //tkn.origin = _from; - tkn.value = _value; - tkn.data = _data; - uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24); - tkn.sig = bytes4(u); - - /** - * tkn variable is analogue of msg variable of Ether transaction - * tkn.sender is person who initiated this token transaction (analogue of msg.sender) - * tkn.value the number of tokens that were sent (analogue of msg.value) - * tkn.data is data of token transaction (analogue of msg.data) - * tkn.sig is 4 bytes signature of function - * if data of token transaction is a function execution - */ - } -} diff --git a/contracts/FrameworkToken.sol b/contracts/FrameworkToken.sol index fe19412..12b1fdd 100644 --- a/contracts/FrameworkToken.sol +++ b/contracts/FrameworkToken.sol @@ -4,9 +4,8 @@ import 'zeppelin-solidity/contracts/ownership/Contactable.sol'; import 'zeppelin-solidity/contracts/token/ERC20/CappedToken.sol'; import 'zeppelin-solidity/contracts/token/ERC20/PausableToken.sol'; -import './ERC223/ERC223Token.sol'; -contract FrameworkToken is CappedToken, ERC223Token, PausableToken, Contactable { +contract FrameworkToken is CappedToken, PausableToken, Contactable { string public name = "Framework"; string public symbol = "FRWK"; uint8 public decimals = 18; diff --git a/contracts/MembershipAccessControl.sol b/contracts/MembershipAccessControl.sol deleted file mode 100644 index a97da30..0000000 --- a/contracts/MembershipAccessControl.sol +++ /dev/null @@ -1,93 +0,0 @@ -pragma solidity ^0.4.19; - -import 'zeppelin-solidity/contracts/ownership/rbac/Roles.sol'; - -contract MembershipAccessControl { - - using Roles for Roles.Role; - - // Memberships of each account - enum MembershipType {ADMIN, OWNER, MANAGER, FOUNDER, INVESTOR} - - mapping (uint => Roles.Role) private memberships; - - event MembershipAdded(address addr, MembershipType memberType); - event MembershipRemoved(address addr, MembershipType memberType); - - function MembershipAccessControl() public { - addMembership(msg.sender, MembershipType.OWNER); - addMembership(msg.sender, MembershipType.ADMIN); - } - - /** - * @dev reverts if addr does not have membership - * @param addr address - * @param memberType the name of the membership - */ - function checkMembership(address addr, MembershipType memberType) public canAdmin(msg.sender) { - memberships[uint(memberType)].check(addr); - } - - /** - * @dev determine if addr has membership - * @param addr address - * @param memberType the name of the membership - * @return bool - */ - function hasMembership(address addr, MembershipType memberType) public canAdmin(msg.sender) returns (bool) { - return memberships[uint(memberType)].has(addr); - } - - /** - * @dev add a membership to an address - * @param addr address - * @param memberType the name of the membership - */ - function addMembership(address addr, MembershipType memberType) canAdmin(msg.sender) public { - addMembershipInternal(addr, memberType); - } - - /** - * @dev remove a membership from an address - * @param addr address - * @param memberType the name of the membership - */ - function removeMembership(address addr, MembershipType memberType) canAdmin(msg.sender) public { - removeMembershipInternal(addr, memberType); - } - - /** - * @dev add a membership to an address - * @param addr address - * @param memberType the name of the membership - */ - function addMembershipInternal(address addr, MembershipType memberType) internal { - memberships[uint(memberType)].add(addr); - MembershipAdded(addr, memberType); - } - - /** - * @dev remove a membership from an address - * @param addr address - * @param memberType the name of the membership - */ - function removeMembershipInternal(address addr, MembershipType memberType) internal { - memberships[uint(memberType)].remove(addr); - MembershipRemoved(addr, memberType); - } - - /** - * @dev modifier to scope access to a single membership (uses msg.sender as addr) - * @param memberType the name of the membership - * // reverts - */ - modifier onlyMembership(MembershipType memberType) { - checkMembership(msg.sender, memberType); - _; - } - - modifier canAdmin(address _address) { - require(hasMembership(_address, MembershipType.ADMIN)); - _; - } -}