-
Notifications
You must be signed in to change notification settings - Fork 0
/
Base.sol
28 lines (25 loc) · 803 Bytes
/
Base.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// SPDX-License-Identifier: MIT
// link to docs: https://docs.soliditylang.org/
// Specifying the version of solidity to use
pragma solidity ^0.8.0;
// Creating a contract.
contract counter {
// making it public it will be availaibe outside contract also.
uint public count;
// Runs every time when contract is created (Initialized).
constructor(){
count = 0;
}
// Read function: Con't change any value in BChain (No gas to pay).
function getCount() public view returns(uint){
return count;
}
// Read function: Changes one of value in BChain (Gas to pay).
function incrementCount() public {
count++;
}
// Read function: Changes one of value in BChain (Gas to pay).
function decrementCount() public {
count--;
}
}