From b144a208f843fe1957372441059348c5d60226b9 Mon Sep 17 00:00:00 2001 From: myh <95896306+Anchor-x@users.noreply.github.com> Date: Wed, 5 Jun 2024 16:08:43 +0800 Subject: [PATCH] =?UTF-8?q?truffle=E8=BF=81=E7=A7=BB=E5=8A=9F=E8=83=BDSoli?= =?UTF-8?q?dity=E5=90=88=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contracts/Migrations.sol | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 contracts/Migrations.sol diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol new file mode 100644 index 0000000..d5114c1 --- /dev/null +++ b/contracts/Migrations.sol @@ -0,0 +1,23 @@ +pragma solidity ^0.5.0; + +contract Migrations { + address public owner; + uint public last_completed_migration; + + constructor() public { + owner = msg.sender; + } + + modifier restricted() { + if (msg.sender == owner) _; + } + + function setCompleted(uint completed) public restricted { + last_completed_migration = completed; + } + + function upgrade(address new_address) public restricted { + Migrations upgraded = Migrations(new_address); + upgraded.setCompleted(last_completed_migration); + } +}