From 7d9e70731d4a9c0eb07a3d8e8866d7ffbeda4aae Mon Sep 17 00:00:00 2001 From: Sven Stucki Date: Tue, 28 Nov 2017 17:36:05 +0100 Subject: [PATCH] Initial commit with truffle init --- .gitignore | 7 +++++++ contracts/Migrations.sol | 23 +++++++++++++++++++++++ migrations/1_initial_migration.js | 5 +++++ truffle-config.js | 4 ++++ truffle.js | 4 ++++ 5 files changed, 43 insertions(+) create mode 100644 .gitignore create mode 100644 contracts/Migrations.sol create mode 100644 migrations/1_initial_migration.js create mode 100644 truffle-config.js create mode 100644 truffle.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..31fc82d --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# vim swap files +*.swp +*.swo + +node_modules/ +build/ + diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol new file mode 100644 index 0000000..f170cb4 --- /dev/null +++ b/contracts/Migrations.sol @@ -0,0 +1,23 @@ +pragma solidity ^0.4.17; + +contract Migrations { + address public owner; + uint public last_completed_migration; + + modifier restricted() { + if (msg.sender == owner) _; + } + + function Migrations() public { + owner = msg.sender; + } + + 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); + } +} diff --git a/migrations/1_initial_migration.js b/migrations/1_initial_migration.js new file mode 100644 index 0000000..4d5f3f9 --- /dev/null +++ b/migrations/1_initial_migration.js @@ -0,0 +1,5 @@ +var Migrations = artifacts.require("./Migrations.sol"); + +module.exports = function(deployer) { + deployer.deploy(Migrations); +}; diff --git a/truffle-config.js b/truffle-config.js new file mode 100644 index 0000000..a6330d6 --- /dev/null +++ b/truffle-config.js @@ -0,0 +1,4 @@ +module.exports = { + // See + // to customize your Truffle configuration! +}; diff --git a/truffle.js b/truffle.js new file mode 100644 index 0000000..a6330d6 --- /dev/null +++ b/truffle.js @@ -0,0 +1,4 @@ +module.exports = { + // See + // to customize your Truffle configuration! +};