Skip to content

Commit

Permalink
finish 02
Browse files Browse the repository at this point in the history
  • Loading branch information
amazingandyyy committed Nov 19, 2017
1 parent 3a04c1e commit 0cc761a
Show file tree
Hide file tree
Showing 60 changed files with 116 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build
build/
.idea
.DS_Store
13 changes: 13 additions & 0 deletions 02-Testing/finish/contracts/HelloEthSalon.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pragma solidity ^0.4.4;

contract HelloEthSalon {
string message = "Hello Ethereum Salon!";

function HelloEthSalon() {
// constructor
}

function GetMessage() returns (string) {
return message;
}
}
23 changes: 23 additions & 0 deletions 02-Testing/finish/contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -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);
}
}
7 changes: 7 additions & 0 deletions 02-Testing/finish/migrations/1_initial_migration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var Migrations = artifacts.require("./Migrations.sol");
var HelloEthSalon = artifacts.require('./HelloEthSalon.sol');

module.exports = function(deployer) {
deployer.deploy(Migrations);
deployer.deploy(HelloEthSalon);
};
9 changes: 9 additions & 0 deletions 02-Testing/finish/test/hello_eth_salon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var HelloEthSalon = artifacts.require("./HelloEthSalon.sol");

contract("HelloEthSalon:GetMessage", function (accounts) {
it("should return a correct string", async function () {
const contract = await HelloEthSalon.deployed();
const result = await contract.GetMessage.call();
assert.isTrue(result === "Hello Ethereum Salon!");
});
});
4 changes: 4 additions & 0 deletions 02-Testing/finish/truffle-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
};
File renamed without changes.
13 changes: 13 additions & 0 deletions 02-Testing/start/contracts/HelloEthSalon.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pragma solidity ^0.4.4;

contract HelloEthSalon {
string message = "Hello Ethereum Salon!";

function HelloEthSalon() {
// constructor
}

function GetMessage() returns (string) {
return message;
}
}
23 changes: 23 additions & 0 deletions 02-Testing/start/contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -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);
}
}
4 changes: 4 additions & 0 deletions 02-Testing/start/truffle-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
};
4 changes: 4 additions & 0 deletions 02-Testing/start/truffle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var Migrations = artifacts.require("./Migrations.sol");

module.exports = function(deployer) {
deployer.deploy(Migrations);
};
10 changes: 10 additions & 0 deletions __old_versions/02-Testing/start/truffle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*", // Match any network id
gas: 4700000
}
}
};

0 comments on commit 0cc761a

Please sign in to comment.