|
@@ -1,31 +1,31 @@
|
|
|
-import "./HumanStandardToken.sol";
|
|
|
+import "./EIP20.sol";
|
|
|
|
|
|
pragma solidity ^0.4.8;
|
|
|
|
|
|
-contract HumanStandardTokenFactory {
|
|
|
+contract EIP20Factory {
|
|
|
|
|
|
mapping(address => address[]) public created;
|
|
|
- mapping(address => bool) public isHumanToken; //verify without having to do a bytecode check.
|
|
|
- bytes public humanStandardByteCode;
|
|
|
+ mapping(address => bool) public isEIP20; //verify without having to do a bytecode check.
|
|
|
+ bytes public EIP20ByteCode;
|
|
|
|
|
|
- function HumanStandardTokenFactory() public {
|
|
|
- //upon creation of the factory, deploy a HumanStandardToken (parameters are meaningless) and store the bytecode provably.
|
|
|
- address verifiedToken = createHumanStandardToken(10000, "Verify Token", 3, "VTX");
|
|
|
- humanStandardByteCode = codeAt(verifiedToken);
|
|
|
+ function EIP20Factory() public {
|
|
|
+ //upon creation of the factory, deploy a EIP20 (parameters are meaningless) and store the bytecode provably.
|
|
|
+ address verifiedToken = createEIP20(10000, "Verify Token", 3, "VTX");
|
|
|
+ EIP20ByteCode = codeAt(verifiedToken);
|
|
|
}
|
|
|
|
|
|
//verifies if a contract that has been deployed is a Human Standard Token.
|
|
|
//NOTE: This is a very expensive function, and should only be used in an eth_call. ~800k gas
|
|
|
- function verifyHumanStandardToken(address _tokenContract) public view returns (bool) {
|
|
|
+ function verifyEIP20(address _tokenContract) public view returns (bool) {
|
|
|
bytes memory fetchedTokenByteCode = codeAt(_tokenContract);
|
|
|
|
|
|
- if (fetchedTokenByteCode.length != humanStandardByteCode.length) {
|
|
|
+ if (fetchedTokenByteCode.length != EIP20ByteCode.length) {
|
|
|
return false; //clear mismatch
|
|
|
}
|
|
|
|
|
|
//starting iterating through it if lengths match
|
|
|
for (uint i = 0; i < fetchedTokenByteCode.length; i ++) {
|
|
|
- if (fetchedTokenByteCode[i] != humanStandardByteCode[i]) {
|
|
|
+ if (fetchedTokenByteCode[i] != EIP20ByteCode[i]) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -51,11 +51,11 @@ contract HumanStandardTokenFactory {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function createHumanStandardToken(uint256 _initialAmount, string _name, uint8 _decimals, string _symbol) public returns (address) {
|
|
|
+ function createEIP20(uint256 _initialAmount, string _name, uint8 _decimals, string _symbol) public returns (address) {
|
|
|
|
|
|
- HumanStandardToken newToken = (new HumanStandardToken(_initialAmount, _name, _decimals, _symbol));
|
|
|
+ EIP20 newToken = (new EIP20(_initialAmount, _name, _decimals, _symbol));
|
|
|
created[msg.sender].push(address(newToken));
|
|
|
- isHumanToken[address(newToken)] = true;
|
|
|
+ isEIP20[address(newToken)] = true;
|
|
|
newToken.transfer(msg.sender, _initialAmount); //the factory will own the created tokens. You must transfer them.
|
|
|
return address(newToken);
|
|
|
}
|