From c19bb7ef6f883bf4a1da69138588b9aaf341fef0 Mon Sep 17 00:00:00 2001 From: Benjamin Cosman Date: Tue, 24 Apr 2018 16:31:38 -0700 Subject: [PATCH] styling in Migrations.sol --- contracts/Migrations.sol | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol index 27598ade8..5258557e8 100644 --- a/contracts/Migrations.sol +++ b/contracts/Migrations.sol @@ -1,23 +1,21 @@ pragma solidity ^0.4.21; -contract Migrations { - address public owner; - uint public last_completed_migration; +import "zeppelin-solidity/contracts/ownership/Ownable.sol"; - modifier restricted() { - if (msg.sender == owner) _; - } +// This is a truffle contract, needed for truffle integration. +contract Migrations is Ownable { + uint256 public lastCompletedMigration; - function Migrations() public { - owner = msg.sender; - } + function Migrations() public { + owner = msg.sender; + } - function setCompleted(uint completed) public restricted { - last_completed_migration = completed; - } + function setCompleted(uint _completed) public onlyOwner { + lastCompletedMigration = _completed; + } - function upgrade(address new_address) public restricted { - Migrations upgraded = Migrations(new_address); - upgraded.setCompleted(last_completed_migration); - } + function upgrade(address _newAddress) public onlyOwner { + Migrations upgraded = Migrations(_newAddress); + upgraded.setCompleted(lastCompletedMigration); + } }