diff --git a/contracts/token/ApproveAndCallFallBack.sol b/contracts/token/ApproveAndCallFallBack.sol index 10b9c8e..01bbf9b 100644 --- a/contracts/token/ApproveAndCallFallBack.sol +++ b/contracts/token/ApproveAndCallFallBack.sol @@ -1,5 +1,5 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.14; contract ApproveAndCallFallBack { - function receiveApproval(address from, uint256 _amount, address _token, bytes _data); + function receiveApproval(address from, uint256 _amount, address _token, bytes _data) public ; } diff --git a/contracts/token/MiniMeToken.sol b/contracts/token/MiniMeToken.sol index 9d586ff..2ade3f4 100644 --- a/contracts/token/MiniMeToken.sol +++ b/contracts/token/MiniMeToken.sol @@ -1,9 +1,4 @@ -pragma solidity ^0.4.17; - -import "../common/Controlled.sol"; -import "./MiniMeTokenFactory.sol"; -import "./TokenController.sol"; -import "./ApproveAndCallFallBack.sol"; +pragma solidity ^0.4.6; /* Copyright 2016, Jordi Baylina @@ -29,6 +24,11 @@ import "./ApproveAndCallFallBack.sol"; /// and DApps to upgrade their features in a decentralized manner without /// affecting the original token /// @dev It is ERC20 compliant, but still needs to under go further testing. + +import "../common/Controlled.sol"; +import "./TokenController.sol"; +import "./ApproveAndCallFallBack.sol"; + /// @dev The actual token contract, the default controller is the msg.sender /// that deploys the contract, so usually this token will be deployed by a /// token controller contract, which Giveth will call a "Campaign" @@ -43,7 +43,7 @@ contract MiniMeToken is Controlled { /// @dev `Checkpoint` is the structure that attaches a block number to a /// given value, the block number attached is the one that last changed the /// value - struct Checkpoint { + struct Checkpoint { // `fromBlock` is the block number that the value was generated from uint128 fromBlock; @@ -577,4 +577,47 @@ contract MiniMeToken is Controlled { uint256 _amount ); -} \ No newline at end of file +} + + +//////////////// +// MiniMeTokenFactory +//////////////// + +/// @dev This contract is used to generate clone contracts from a contract. +/// In solidity this is the way to create a contract from a contract of the +/// same class +contract MiniMeTokenFactory { + + /// @notice Update the DApp by creating a new token with new functionalities + /// the msg.sender becomes the controller of this clone token + /// @param _parentToken Address of the token being cloned + /// @param _snapshotBlock Block of the parent token that will + /// determine the initial distribution of the clone token + /// @param _tokenName Name of the new token + /// @param _decimalUnits Number of decimals of the new token + /// @param _tokenSymbol Token Symbol for the new token + /// @param _transfersEnabled If true, tokens will be able to be transferred + /// @return The address of the new token contract + function createCloneToken( + address _parentToken, + uint _snapshotBlock, + string _tokenName, + uint8 _decimalUnits, + string _tokenSymbol, + bool _transfersEnabled + ) returns (MiniMeToken) { + MiniMeToken newToken = new MiniMeToken( + this, + _parentToken, + _snapshotBlock, + _tokenName, + _decimalUnits, + _tokenSymbol, + _transfersEnabled + ); + + newToken.changeController(msg.sender); + return newToken; + } +} diff --git a/contracts/token/TokenController.sol b/contracts/token/TokenController.sol index 70fad1b..9dd7f91 100644 --- a/contracts/token/TokenController.sol +++ b/contracts/token/TokenController.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.14; /// @dev The token controller contract must implement these functions contract TokenController {