Browse Source

init files

Ted 6 years ago
commit
3501e83330
4 changed files with 36 additions and 0 deletions
  1. 23 0
      contracts/Migrations.sol
  2. 5 0
      migrations/1_initial_migration.js
  3. 4 0
      truffle-config.js
  4. 4 0
      truffle.js

+ 23 - 0
contracts/Migrations.sol

@@ -0,0 +1,23 @@
+pragma solidity ^0.4.23;
+
+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);
+  }
+}

+ 5 - 0
migrations/1_initial_migration.js

@@ -0,0 +1,5 @@
+var Migrations = artifacts.require("./Migrations.sol");
+
+module.exports = function(deployer) {
+  deployer.deploy(Migrations);
+};

+ 4 - 0
truffle-config.js

@@ -0,0 +1,4 @@
+module.exports = {
+  // See <http://truffleframework.com/docs/advanced/configuration>
+  // to customize your Truffle configuration!
+};

+ 4 - 0
truffle.js

@@ -0,0 +1,4 @@
+module.exports = {
+  // See <http://truffleframework.com/docs/advanced/configuration>
+  // to customize your Truffle configuration!
+};