-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzameenx.sol
38 lines (30 loc) · 1.01 KB
/
zameenx.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
pragma solidity ^0.4.24;
contract rohan{
struct zameen{
address owner;
uint price;
}
event pricechanged(string a,uint b);
event ownerchanged(string a, address b);
zameen[2] public zameenx;
constructor(){
zameenx[0].owner=tx.origin;
zameenx[0].price=5;
zameenx[1].owner=tx.origin;
zameenx[1].price=2;
}
function changeprice(uint b,uint c) public returns(uint){
require(msg.sender == zameenx[b].owner ,"This is by an Unauthenticated Person");
require(c > 0 ,"the new price should always be greater than 0");
zameenx[b].price = c;
emit pricechanged("Price has been changed" ,c);
return c;
}
function changeowner(uint a,address b) public returns(address){
require(msg.sender == zameenx[a].owner);
require(zameenx[a].owner != b );
zameenx[a].owner = b;
emit ownerchanged("Owner has been changed" ,b);
return b;
}
}