From 3a31893538e6f46af35840ecbce638ea0e375f96 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Sat, 19 May 2018 16:53:46 -0300 Subject: [PATCH] require tokenfactory in mmt constructor, fixes in interfaces, bump solcv --- config/contracts.json | 6 ++++++ contracts/token/ApproveAndCallFallBack.sol | 9 +++++++-- contracts/token/MiniMeToken.sol | 5 +++-- contracts/token/MiniMeTokenFactory.sol | 2 +- contracts/token/MiniMeTokenInterface.sol | 4 ++-- contracts/token/TokenController.sol | 10 +++++----- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/config/contracts.json b/config/contracts.json index 923d2c9..87eb4db 100644 --- a/config/contracts.json +++ b/config/contracts.json @@ -17,6 +17,12 @@ "contracts": { "ERC20Receiver": { "deploy": false + }, + "MiniMeToken": { + "deploy": false + }, + "MiniMeTokenFactory": { + "deploy": true } } } diff --git a/contracts/token/ApproveAndCallFallBack.sol b/contracts/token/ApproveAndCallFallBack.sol index accc9c7..864b988 100644 --- a/contracts/token/ApproveAndCallFallBack.sol +++ b/contracts/token/ApproveAndCallFallBack.sol @@ -1,5 +1,10 @@ pragma solidity ^0.4.23; -contract ApproveAndCallFallBack { - function receiveApproval(address from, uint256 _amount, address _token, bytes _data) public; +interface ApproveAndCallFallBack { + function receiveApproval( + address from, + uint256 _amount, + address _token, + bytes _data + ) external; } diff --git a/contracts/token/MiniMeToken.sol b/contracts/token/MiniMeToken.sol index b6ade81..67b2c56 100644 --- a/contracts/token/MiniMeToken.sol +++ b/contracts/token/MiniMeToken.sol @@ -116,6 +116,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled { ) public { + require(_tokenFactory != address(0)); //if not set, clone feature will not work properly tokenFactory = MiniMeTokenFactory(_tokenFactory); name = _tokenName; // Set the name decimals = _decimalUnits; // Set the decimals @@ -399,11 +400,11 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled { /** * @notice Creates a new clone token with the initial distribution being - * this token at `snapshotBlock` + * this token at `_snapshotBlock` * @param _cloneTokenName Name of the clone token * @param _cloneDecimalUnits Number of decimals of the smallest unit * @param _cloneTokenSymbol Symbol of the clone token - * @param snapshotBlock Block when the distribution of the parent token is + * @param _snapshotBlock Block when the distribution of the parent token is * copied to set the initial distribution of the new clone token; * if the block is zero than the actual block, the current block is used * @param _transfersEnabled True if transfers are allowed in the clone diff --git a/contracts/token/MiniMeTokenFactory.sol b/contracts/token/MiniMeTokenFactory.sol index 92851d2..3793f09 100644 --- a/contracts/token/MiniMeTokenFactory.sol +++ b/contracts/token/MiniMeTokenFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.23; import "./MiniMeToken.sol"; diff --git a/contracts/token/MiniMeTokenInterface.sol b/contracts/token/MiniMeTokenInterface.sol index cc1300c..8e7b3d0 100644 --- a/contracts/token/MiniMeTokenInterface.sol +++ b/contracts/token/MiniMeTokenInterface.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.17; +pragma solidity ^0.4.23; import "./ERC20Token.sol"; @@ -19,7 +19,7 @@ contract MiniMeTokenInterface is ERC20Token { uint256 _amount, bytes _extraData ) - public + external returns (bool success); /** diff --git a/contracts/token/TokenController.sol b/contracts/token/TokenController.sol index b70a228..9b9d4f0 100644 --- a/contracts/token/TokenController.sol +++ b/contracts/token/TokenController.sol @@ -1,14 +1,14 @@ -pragma solidity ^0.4.14; +pragma solidity ^0.4.23; /** * @dev The token controller contract must implement these functions */ -contract TokenController { +interface TokenController { /** * @notice Called when `_owner` sends ether to the MiniMe Token contract * @param _owner The address that sent the ether to create tokens * @return True if the ether is accepted, false if it throws */ - function proxyPayment(address _owner) payable returns(bool); + function proxyPayment(address _owner) external payable returns(bool); /** * @notice Notifies the controller about a token transfer allowing the @@ -18,7 +18,7 @@ contract TokenController { * @param _amount The amount of the transfer * @return False if the controller does not authorize the transfer */ - function onTransfer(address _from, address _to, uint _amount) returns(bool); + function onTransfer(address _from, address _to, uint _amount) external returns(bool); /** * @notice Notifies the controller about an approval allowing the @@ -28,6 +28,6 @@ contract TokenController { * @param _amount The amount in the `approve()` call * @return False if the controller does not authorize the approval */ - function onApprove(address _owner, address _spender, uint _amount) + function onApprove(address _owner, address _spender, uint _amount) external returns(bool); }