diff --git a/.gitignore b/.gitignore index c3509fc..8f8a975 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -build +build/ .idea .DS_Store \ No newline at end of file diff --git a/02-Testing/finish/contracts/HelloEthSalon.sol b/02-Testing/finish/contracts/HelloEthSalon.sol new file mode 100644 index 0000000..62ca23e --- /dev/null +++ b/02-Testing/finish/contracts/HelloEthSalon.sol @@ -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; + } +} diff --git a/02-Testing/finish/contracts/Migrations.sol b/02-Testing/finish/contracts/Migrations.sol new file mode 100644 index 0000000..f170cb4 --- /dev/null +++ b/02-Testing/finish/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/02-Testing/finish/migrations/1_initial_migration.js b/02-Testing/finish/migrations/1_initial_migration.js new file mode 100644 index 0000000..f0ac313 --- /dev/null +++ b/02-Testing/finish/migrations/1_initial_migration.js @@ -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); +}; diff --git a/02-Testing/finish/test/hello_eth_salon.js b/02-Testing/finish/test/hello_eth_salon.js new file mode 100644 index 0000000..7ca6031 --- /dev/null +++ b/02-Testing/finish/test/hello_eth_salon.js @@ -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!"); + }); +}); diff --git a/02-Testing/finish/truffle-config.js b/02-Testing/finish/truffle-config.js new file mode 100644 index 0000000..a6330d6 --- /dev/null +++ b/02-Testing/finish/truffle-config.js @@ -0,0 +1,4 @@ +module.exports = { + // See + // to customize your Truffle configuration! +}; diff --git a/_old_versions/01-HelloWorld/finish/truffle.js b/02-Testing/finish/truffle.js similarity index 100% rename from _old_versions/01-HelloWorld/finish/truffle.js rename to 02-Testing/finish/truffle.js diff --git a/02-Testing/start/contracts/HelloEthSalon.sol b/02-Testing/start/contracts/HelloEthSalon.sol new file mode 100644 index 0000000..62ca23e --- /dev/null +++ b/02-Testing/start/contracts/HelloEthSalon.sol @@ -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; + } +} diff --git a/02-Testing/start/contracts/Migrations.sol b/02-Testing/start/contracts/Migrations.sol new file mode 100644 index 0000000..f170cb4 --- /dev/null +++ b/02-Testing/start/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/_old_versions/01-HelloWorld/finish/migrations/1_initial_migration.js b/02-Testing/start/migrations/1_initial_migration.js similarity index 100% rename from _old_versions/01-HelloWorld/finish/migrations/1_initial_migration.js rename to 02-Testing/start/migrations/1_initial_migration.js diff --git a/02-Testing/start/truffle-config.js b/02-Testing/start/truffle-config.js new file mode 100644 index 0000000..a6330d6 --- /dev/null +++ b/02-Testing/start/truffle-config.js @@ -0,0 +1,4 @@ +module.exports = { + // See + // to customize your Truffle configuration! +}; diff --git a/02-Testing/start/truffle.js b/02-Testing/start/truffle.js new file mode 100644 index 0000000..a6330d6 --- /dev/null +++ b/02-Testing/start/truffle.js @@ -0,0 +1,4 @@ +module.exports = { + // See + // to customize your Truffle configuration! +}; diff --git a/_old_versions/01-HelloWorld/README.md b/__old_versions/01-HelloWorld/README.md similarity index 100% rename from _old_versions/01-HelloWorld/README.md rename to __old_versions/01-HelloWorld/README.md diff --git a/_old_versions/01-HelloWorld/finish/contracts/ConvertLib.sol b/__old_versions/01-HelloWorld/finish/contracts/ConvertLib.sol similarity index 100% rename from _old_versions/01-HelloWorld/finish/contracts/ConvertLib.sol rename to __old_versions/01-HelloWorld/finish/contracts/ConvertLib.sol diff --git a/_old_versions/01-HelloWorld/finish/contracts/HelloEthSalon.sol b/__old_versions/01-HelloWorld/finish/contracts/HelloEthSalon.sol similarity index 100% rename from _old_versions/01-HelloWorld/finish/contracts/HelloEthSalon.sol rename to __old_versions/01-HelloWorld/finish/contracts/HelloEthSalon.sol diff --git a/_old_versions/01-HelloWorld/finish/contracts/MetaCoin.sol b/__old_versions/01-HelloWorld/finish/contracts/MetaCoin.sol similarity index 100% rename from _old_versions/01-HelloWorld/finish/contracts/MetaCoin.sol rename to __old_versions/01-HelloWorld/finish/contracts/MetaCoin.sol diff --git a/_old_versions/01-HelloWorld/finish/contracts/Migrations.sol b/__old_versions/01-HelloWorld/finish/contracts/Migrations.sol similarity index 100% rename from _old_versions/01-HelloWorld/finish/contracts/Migrations.sol rename to __old_versions/01-HelloWorld/finish/contracts/Migrations.sol diff --git a/_old_versions/01-HelloWorld/start/migrations/1_initial_migration.js b/__old_versions/01-HelloWorld/finish/migrations/1_initial_migration.js similarity index 100% rename from _old_versions/01-HelloWorld/start/migrations/1_initial_migration.js rename to __old_versions/01-HelloWorld/finish/migrations/1_initial_migration.js diff --git a/_old_versions/01-HelloWorld/finish/migrations/2_deploy_contracts.js b/__old_versions/01-HelloWorld/finish/migrations/2_deploy_contracts.js similarity index 100% rename from _old_versions/01-HelloWorld/finish/migrations/2_deploy_contracts.js rename to __old_versions/01-HelloWorld/finish/migrations/2_deploy_contracts.js diff --git a/_old_versions/01-HelloWorld/finish/test/TestMetacoin.sol b/__old_versions/01-HelloWorld/finish/test/TestMetacoin.sol similarity index 100% rename from _old_versions/01-HelloWorld/finish/test/TestMetacoin.sol rename to __old_versions/01-HelloWorld/finish/test/TestMetacoin.sol diff --git a/_old_versions/01-HelloWorld/finish/test/metacoin.js b/__old_versions/01-HelloWorld/finish/test/metacoin.js similarity index 100% rename from _old_versions/01-HelloWorld/finish/test/metacoin.js rename to __old_versions/01-HelloWorld/finish/test/metacoin.js diff --git a/_old_versions/01-HelloWorld/start/truffle.js b/__old_versions/01-HelloWorld/finish/truffle.js similarity index 100% rename from _old_versions/01-HelloWorld/start/truffle.js rename to __old_versions/01-HelloWorld/finish/truffle.js diff --git a/_old_versions/01-HelloWorld/start/contracts/ConvertLib.sol b/__old_versions/01-HelloWorld/start/contracts/ConvertLib.sol similarity index 100% rename from _old_versions/01-HelloWorld/start/contracts/ConvertLib.sol rename to __old_versions/01-HelloWorld/start/contracts/ConvertLib.sol diff --git a/_old_versions/01-HelloWorld/start/contracts/MetaCoin.sol b/__old_versions/01-HelloWorld/start/contracts/MetaCoin.sol similarity index 100% rename from _old_versions/01-HelloWorld/start/contracts/MetaCoin.sol rename to __old_versions/01-HelloWorld/start/contracts/MetaCoin.sol diff --git a/_old_versions/01-HelloWorld/start/contracts/Migrations.sol b/__old_versions/01-HelloWorld/start/contracts/Migrations.sol similarity index 100% rename from _old_versions/01-HelloWorld/start/contracts/Migrations.sol rename to __old_versions/01-HelloWorld/start/contracts/Migrations.sol diff --git a/_old_versions/02-Testing/exercise/migrations/1_initial_migration.js b/__old_versions/01-HelloWorld/start/migrations/1_initial_migration.js similarity index 100% rename from _old_versions/02-Testing/exercise/migrations/1_initial_migration.js rename to __old_versions/01-HelloWorld/start/migrations/1_initial_migration.js diff --git a/_old_versions/01-HelloWorld/start/migrations/2_deploy_contracts.js b/__old_versions/01-HelloWorld/start/migrations/2_deploy_contracts.js similarity index 100% rename from _old_versions/01-HelloWorld/start/migrations/2_deploy_contracts.js rename to __old_versions/01-HelloWorld/start/migrations/2_deploy_contracts.js diff --git a/_old_versions/01-HelloWorld/start/test/TestMetacoin.sol b/__old_versions/01-HelloWorld/start/test/TestMetacoin.sol similarity index 100% rename from _old_versions/01-HelloWorld/start/test/TestMetacoin.sol rename to __old_versions/01-HelloWorld/start/test/TestMetacoin.sol diff --git a/_old_versions/01-HelloWorld/start/test/metacoin.js b/__old_versions/01-HelloWorld/start/test/metacoin.js similarity index 100% rename from _old_versions/01-HelloWorld/start/test/metacoin.js rename to __old_versions/01-HelloWorld/start/test/metacoin.js diff --git a/_old_versions/02-Testing/exercise/truffle.js b/__old_versions/01-HelloWorld/start/truffle.js similarity index 100% rename from _old_versions/02-Testing/exercise/truffle.js rename to __old_versions/01-HelloWorld/start/truffle.js diff --git a/_old_versions/02-Testing/README.md b/__old_versions/02-Testing/README.md similarity index 100% rename from _old_versions/02-Testing/README.md rename to __old_versions/02-Testing/README.md diff --git a/_old_versions/02-Testing/exercise/contracts/ConvertLib.sol b/__old_versions/02-Testing/exercise/contracts/ConvertLib.sol similarity index 100% rename from _old_versions/02-Testing/exercise/contracts/ConvertLib.sol rename to __old_versions/02-Testing/exercise/contracts/ConvertLib.sol diff --git a/_old_versions/02-Testing/exercise/contracts/HelloEthSalon.sol b/__old_versions/02-Testing/exercise/contracts/HelloEthSalon.sol similarity index 100% rename from _old_versions/02-Testing/exercise/contracts/HelloEthSalon.sol rename to __old_versions/02-Testing/exercise/contracts/HelloEthSalon.sol diff --git a/_old_versions/02-Testing/exercise/contracts/MetaCoin.sol b/__old_versions/02-Testing/exercise/contracts/MetaCoin.sol similarity index 100% rename from _old_versions/02-Testing/exercise/contracts/MetaCoin.sol rename to __old_versions/02-Testing/exercise/contracts/MetaCoin.sol diff --git a/_old_versions/02-Testing/exercise/contracts/Migrations.sol b/__old_versions/02-Testing/exercise/contracts/Migrations.sol similarity index 100% rename from _old_versions/02-Testing/exercise/contracts/Migrations.sol rename to __old_versions/02-Testing/exercise/contracts/Migrations.sol diff --git a/_old_versions/02-Testing/finish/migrations/1_initial_migration.js b/__old_versions/02-Testing/exercise/migrations/1_initial_migration.js similarity index 100% rename from _old_versions/02-Testing/finish/migrations/1_initial_migration.js rename to __old_versions/02-Testing/exercise/migrations/1_initial_migration.js diff --git a/_old_versions/02-Testing/exercise/migrations/2_deploy_contracts.js b/__old_versions/02-Testing/exercise/migrations/2_deploy_contracts.js similarity index 100% rename from _old_versions/02-Testing/exercise/migrations/2_deploy_contracts.js rename to __old_versions/02-Testing/exercise/migrations/2_deploy_contracts.js diff --git a/_old_versions/02-Testing/exercise/test/TestMetacoin.sol b/__old_versions/02-Testing/exercise/test/TestMetacoin.sol similarity index 100% rename from _old_versions/02-Testing/exercise/test/TestMetacoin.sol rename to __old_versions/02-Testing/exercise/test/TestMetacoin.sol diff --git a/_old_versions/02-Testing/exercise/test/hello_eth_salon.js b/__old_versions/02-Testing/exercise/test/hello_eth_salon.js similarity index 100% rename from _old_versions/02-Testing/exercise/test/hello_eth_salon.js rename to __old_versions/02-Testing/exercise/test/hello_eth_salon.js diff --git a/_old_versions/02-Testing/exercise/test/metacoin.js b/__old_versions/02-Testing/exercise/test/metacoin.js similarity index 100% rename from _old_versions/02-Testing/exercise/test/metacoin.js rename to __old_versions/02-Testing/exercise/test/metacoin.js diff --git a/_old_versions/02-Testing/finish/truffle.js b/__old_versions/02-Testing/exercise/truffle.js similarity index 100% rename from _old_versions/02-Testing/finish/truffle.js rename to __old_versions/02-Testing/exercise/truffle.js diff --git a/_old_versions/02-Testing/finish/contracts/ConvertLib.sol b/__old_versions/02-Testing/finish/contracts/ConvertLib.sol similarity index 100% rename from _old_versions/02-Testing/finish/contracts/ConvertLib.sol rename to __old_versions/02-Testing/finish/contracts/ConvertLib.sol diff --git a/_old_versions/02-Testing/finish/contracts/HelloEthSalon.sol b/__old_versions/02-Testing/finish/contracts/HelloEthSalon.sol similarity index 100% rename from _old_versions/02-Testing/finish/contracts/HelloEthSalon.sol rename to __old_versions/02-Testing/finish/contracts/HelloEthSalon.sol diff --git a/_old_versions/02-Testing/finish/contracts/MetaCoin.sol b/__old_versions/02-Testing/finish/contracts/MetaCoin.sol similarity index 100% rename from _old_versions/02-Testing/finish/contracts/MetaCoin.sol rename to __old_versions/02-Testing/finish/contracts/MetaCoin.sol diff --git a/_old_versions/02-Testing/finish/contracts/Migrations.sol b/__old_versions/02-Testing/finish/contracts/Migrations.sol similarity index 100% rename from _old_versions/02-Testing/finish/contracts/Migrations.sol rename to __old_versions/02-Testing/finish/contracts/Migrations.sol diff --git a/_old_versions/02-Testing/start/migrations/1_initial_migration.js b/__old_versions/02-Testing/finish/migrations/1_initial_migration.js similarity index 100% rename from _old_versions/02-Testing/start/migrations/1_initial_migration.js rename to __old_versions/02-Testing/finish/migrations/1_initial_migration.js diff --git a/_old_versions/02-Testing/finish/migrations/2_deploy_contracts.js b/__old_versions/02-Testing/finish/migrations/2_deploy_contracts.js similarity index 100% rename from _old_versions/02-Testing/finish/migrations/2_deploy_contracts.js rename to __old_versions/02-Testing/finish/migrations/2_deploy_contracts.js diff --git a/_old_versions/02-Testing/finish/test/TestMetacoin.sol b/__old_versions/02-Testing/finish/test/TestMetacoin.sol similarity index 100% rename from _old_versions/02-Testing/finish/test/TestMetacoin.sol rename to __old_versions/02-Testing/finish/test/TestMetacoin.sol diff --git a/_old_versions/02-Testing/finish/test/hello_eth_salon.js b/__old_versions/02-Testing/finish/test/hello_eth_salon.js similarity index 100% rename from _old_versions/02-Testing/finish/test/hello_eth_salon.js rename to __old_versions/02-Testing/finish/test/hello_eth_salon.js diff --git a/_old_versions/02-Testing/finish/test/metacoin.js b/__old_versions/02-Testing/finish/test/metacoin.js similarity index 100% rename from _old_versions/02-Testing/finish/test/metacoin.js rename to __old_versions/02-Testing/finish/test/metacoin.js diff --git a/_old_versions/02-Testing/start/truffle.js b/__old_versions/02-Testing/finish/truffle.js similarity index 100% rename from _old_versions/02-Testing/start/truffle.js rename to __old_versions/02-Testing/finish/truffle.js diff --git a/_old_versions/02-Testing/start/contracts/ConvertLib.sol b/__old_versions/02-Testing/start/contracts/ConvertLib.sol similarity index 100% rename from _old_versions/02-Testing/start/contracts/ConvertLib.sol rename to __old_versions/02-Testing/start/contracts/ConvertLib.sol diff --git a/_old_versions/02-Testing/start/contracts/HelloEthSalon.sol b/__old_versions/02-Testing/start/contracts/HelloEthSalon.sol similarity index 100% rename from _old_versions/02-Testing/start/contracts/HelloEthSalon.sol rename to __old_versions/02-Testing/start/contracts/HelloEthSalon.sol diff --git a/_old_versions/02-Testing/start/contracts/MetaCoin.sol b/__old_versions/02-Testing/start/contracts/MetaCoin.sol similarity index 100% rename from _old_versions/02-Testing/start/contracts/MetaCoin.sol rename to __old_versions/02-Testing/start/contracts/MetaCoin.sol diff --git a/_old_versions/02-Testing/start/contracts/Migrations.sol b/__old_versions/02-Testing/start/contracts/Migrations.sol similarity index 100% rename from _old_versions/02-Testing/start/contracts/Migrations.sol rename to __old_versions/02-Testing/start/contracts/Migrations.sol diff --git a/__old_versions/02-Testing/start/migrations/1_initial_migration.js b/__old_versions/02-Testing/start/migrations/1_initial_migration.js new file mode 100644 index 0000000..4d5f3f9 --- /dev/null +++ b/__old_versions/02-Testing/start/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/_old_versions/02-Testing/start/migrations/2_deploy_contracts.js b/__old_versions/02-Testing/start/migrations/2_deploy_contracts.js similarity index 100% rename from _old_versions/02-Testing/start/migrations/2_deploy_contracts.js rename to __old_versions/02-Testing/start/migrations/2_deploy_contracts.js diff --git a/_old_versions/02-Testing/start/test/TestMetacoin.sol b/__old_versions/02-Testing/start/test/TestMetacoin.sol similarity index 100% rename from _old_versions/02-Testing/start/test/TestMetacoin.sol rename to __old_versions/02-Testing/start/test/TestMetacoin.sol diff --git a/_old_versions/02-Testing/start/test/metacoin.js b/__old_versions/02-Testing/start/test/metacoin.js similarity index 100% rename from _old_versions/02-Testing/start/test/metacoin.js rename to __old_versions/02-Testing/start/test/metacoin.js diff --git a/__old_versions/02-Testing/start/truffle.js b/__old_versions/02-Testing/start/truffle.js new file mode 100644 index 0000000..ee423ce --- /dev/null +++ b/__old_versions/02-Testing/start/truffle.js @@ -0,0 +1,10 @@ +module.exports = { + networks: { + development: { + host: "localhost", + port: 8545, + network_id: "*", // Match any network id + gas: 4700000 + } + } +};