-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauction.sol
40 lines (31 loc) · 855 Bytes
/
auction.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
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
contract Auction {
address Admin;
address public owner;
string house;
uint256 basePrice;
constructor() {
Admin = msg.sender;
}
modifier verify(){
require(msg.sender == Admin,"unautherized");
_;
}
function setAuction(string memory _house,uint256 _basePrice) public verify{
house = _house;
basePrice = _basePrice;
owner = msg.sender;
}
function displayAuction() public view returns(string memory,uint256){
return (house,basePrice);
}
function auctionCall(uint256 amount) public payable {
if(amount >=basePrice){
basePrice = amount;
owner = msg.sender;
}else{
payable (msg.sender).transfer(amount);
}
}
}