From 96a2bd44918ae83bd32b87e1f3b197c5cf55b61c Mon Sep 17 00:00:00 2001 From: MenesesGHZ Date: Sun, 21 Aug 2022 20:43:45 -0700 Subject: [PATCH] update Migrations.sol template code --- .../truffle/getting-started/running-migrations.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/docs/truffle/getting-started/running-migrations.md b/src/docs/truffle/getting-started/running-migrations.md index a25ed888c..d6d351220 100644 --- a/src/docs/truffle/getting-started/running-migrations.md +++ b/src/docs/truffle/getting-started/running-migrations.md @@ -78,7 +78,8 @@ Truffle requires you to have a Migrations contract in order to use the Migration Filename: `contracts/Migrations.sol` ```solidity -pragma solidity ^0.4.8; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; contract Migrations { address public owner; @@ -87,19 +88,20 @@ contract Migrations { uint public last_completed_migration; modifier restricted() { - if (msg.sender == owner) _; + require(msg.sender == owner); + _; } - function Migrations() { + constructor() { owner = msg.sender; } // A function with the signature `setCompleted(uint)` is required. - function setCompleted(uint completed) restricted { + function setCompleted(uint completed) public restricted { last_completed_migration = completed; } - function upgrade(address new_address) restricted { + function upgrade(address new_address) public restricted { Migrations upgraded = Migrations(new_address); upgraded.setCompleted(last_completed_migration); }