-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyFirstContract.sol
65 lines (50 loc) · 1.19 KB
/
MyFirstContract.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
53
54
55
56
57
58
59
60
61
62
63
64
65
pragma solidity ^0.4.0;
interface Regulator{
function checkValue(uint amount) returns (bool);
function loan() returns (bool);
}
contract bank is Regulator{
uint private value;
function bank(uint amount) {
value = amount;
}
function deposit(uint amount){
value += amount;
}
function withdraw(uint amount){
if(checkValue(amount)){
value -= amount;
}
}
function balance() returns (uint){
return value;
}
function checkValue(uint amount) returns (bool){
return amount >= value;
}
function loan() returns (bool){
return value > 0;
}
}
contract MyFirstContract is bank(10){
string private name;
uint private age;
function setName(string newName) {
name = newName;
}
function getName() returns (string) {
return name;
}
function setAge(uint newAge) {
age = newAge;
}
function getAge() returns(uint) {
return age;
}
function checkValue(uint amount) returns (bool){
return true;
}
function loan() returns (bool){
return true;
}
}