-
Notifications
You must be signed in to change notification settings - Fork 0
/
impBasics.sol
52 lines (37 loc) · 1.02 KB
/
impBasics.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract impBasics{
address private contractOwner;
uint private value = 100;
bool switcher = false;
//will run only when contract is deployed
constructor(address accessableAddress){
contractOwner = accessableAddress;
}
function tryingBasics() public view returns(uint,uint,uint){
return (block.chainid,block.difficulty,block.number);
}
modifier onlyOwner(){
require(contractOwner == msg.sender, "Only onwer is allowed to run");
_;
}
modifier flip(){
if(switcher != true ){
revert("switch is off");
}
_;
}
function getValue() public view onlyOwner returns(uint){
return value;
}
function run() public view returns(uint){
assert(value==100);
return value;
}
function changeFlip(bool option) public{
switcher = option;
}
function runner() public view flip returns(uint){
return value;
}
}