Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefix parameters in MintController with underscores for consistency #270

Merged
merged 1 commit into from
Jan 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contracts/minting/Controller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ contract Controller is Ownable {
* @dev ensure that caller is the controller of a non-zero worker address
*/
modifier onlyController() {
require(controllers[msg.sender] != address(0), "The value of controllers[msg.sender] must be non-zero.");
require(controllers[msg.sender] != address(0),
"The value of controllers[msg.sender] must be non-zero.");
_;
}

Expand Down
43 changes: 22 additions & 21 deletions contracts/minting/MintController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ contract MintController is Controller {
MinterManagementInterface public minterManager;

event MinterManagerSet(
address indexed oldMinterManager,
address indexed newMinterManager
address indexed _oldMinterManager,
address indexed _newMinterManager
);
event MinterConfigured(
address indexed msgSender,
address indexed minter,
uint256 allowance
address indexed _msgSender,
address indexed _minter,
uint256 _allowance
);
event MinterRemoved(
address indexed msgSender,
address indexed minter
address indexed _msgSender,
address indexed _minter
);
event MinterAllowanceIncrement(
address indexed msgSender,
address indexed minter,
uint256 increment,
uint256 newAllowance
address indexed _msgSender,
address indexed _minter,
uint256 _increment,
uint256 _newAllowance
);

constructor(address _minterManager) public {
Expand Down Expand Up @@ -92,15 +92,15 @@ contract MintController is Controller {
* @dev Enables the minter and sets its allowance
*/
function configureMinter(
uint256 newAllowance
uint256 _newAllowance
)
public
onlyController
returns (bool)
{
address minter = controllers[msg.sender];
emit MinterConfigured(msg.sender, minter, newAllowance);
return internal_setMinterAllowance(minter, newAllowance);
emit MinterConfigured(msg.sender, minter, _newAllowance);
return internal_setMinterAllowance(minter, _newAllowance);
}

/**
Expand All @@ -110,22 +110,23 @@ contract MintController is Controller {
* about it being used to undo a removeMinter() transaction.
*/
function incrementMinterAllowance(
uint256 allowanceIncrement
uint256 _allowanceIncrement
)
public
onlyController
returns (bool)
{
address minter = controllers[msg.sender];
require(minterManager.isMinter(minter), "Can only increment allowance for minters in minterManager.");
require(minterManager.isMinter(minter),
"Can only increment allowance for minters in minterManager.");

uint256 currentAllowance = minterManager.minterAllowance(minter);
uint256 newAllowance = currentAllowance.add(allowanceIncrement);
uint256 newAllowance = currentAllowance.add(_allowanceIncrement);

emit MinterAllowanceIncrement(
msg.sender,
minter,
allowanceIncrement,
_allowanceIncrement,
newAllowance
);
return internal_setMinterAllowance(minter, newAllowance);
Expand All @@ -138,12 +139,12 @@ contract MintController is Controller {
* set its allowance.
*/
function internal_setMinterAllowance(
address minter,
uint256 newAllowance
address _minter,
uint256 _newAllowance
)
internal
returns (bool)
{
return minterManager.configureMinter(minter, newAllowance);
return minterManager.configureMinter(_minter, _newAllowance);
}
}
26 changes: 17 additions & 9 deletions contracts/minting/MinterManagementInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,35 @@
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is furnished to
* do so, subject to the following conditions:
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

pragma solidity ^0.4.24;

// Using an interface for managing minters so that MintController
// can be used for managing minters with different contracts.
interface MinterManagementInterface {
function isMinter(address account) external view returns (bool);
function minterAllowance(address minter) external view returns (uint256);
function configureMinter(address minter, uint256 minterAllowedAmount) external returns (bool);
function removeMinter(address minter) external returns (bool);
function isMinter(address _account) external view returns (bool);
function minterAllowance(address _minter) external view returns (uint256);

function configureMinter(
address _minter,
uint256 _minterAllowedAmount
)
external
returns (bool);

function removeMinter(address _minter) external returns (bool);
}