Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
28 changes: 21 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
Part of the course on "Ethereum Blockchain DAPP Development"
## Part of the course on "Ethereum Blockchain DApp Development"
http://www.ACloudFan.com

MAC/UBUNTU/LINUX Users:
### MAC/UBUNTU/LINUX Users:
Please rename truffle-config.js to config.js

Please rename truffle-config to config.js
### Sample Contracts
The following sample smart contracts are used across several lectures:
* Calculator
* CalculatorV2
* CalculatorV3
* interactionChannel

Calculator/CalculatorV2/interactionChannel contract is used as a sample in lectures in the course
### Objectives
The aim is to achieve the following objectives:
1. Introduction to DApp development
2. Demonstrate the use of various wallets
3. How to manage smart contracts
4. Introduction to Remix
5. Demonstrate the use of a browser based Solidity IDE for smart contract development
6. Development of contracts using Truffle framework

1 DAPP development sample and for demonstrating the use of wallets for managing contracts
2. For demonstrating use of Broweser based Solidity contract development
2. Development of contracts using Truffle framework
#### Legend:
- DApp: Decentralised Application
- IDE: Integrated Development Environment
- Remix: Solidity IDE
58 changes: 58 additions & 0 deletions contracts/CalculatorV3.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// pk: changed to latest version 0.4.23
pragma solidity ^0.4.23;

// pk: changed the contract version from 2 to 3
contract CalculatorV3 {

uint result;

event NumberAdded(uint n);
event NumberSubtracted(uint n);
event NumberMultiplied(uint n);
event NumberDivided(uint n);

// pk: changed the function name to something other than the contract name
function Calculator(uint num) public {
// constructor
result = num;
}

// returns the result
// pk: "constant" deprecated, replaced with "view"
function getResult() public view returns (uint){
return result;
}

// result = result + num
function addToNumber(uint num) public returns (uint) {
result += num;
// pk: inserted "emit" before calling the event
emit NumberAdded(num);
return result;
}

// result = result - num
function substractNumber(uint num) public returns (uint) {
result -= num;
// pk: inserted "emit" before calling the event
emit NumberSubtracted(num);
return result;
}

// result = result * num
function multiplyWithNumber(uint num) public returns (uint) {
result *= num;
// pk: inserted "emit" before calling the event
emit NumberMultiplied(num);
return result;
}

// result = result / num
function divideByNumber(uint num) public returns (uint) {
result /= num;
// pk: inserted "emit" before calling the event
emit NumberDivided(num);
return result;
}

}