Skip to content

Commit

Permalink
DOS attack intro
Browse files Browse the repository at this point in the history
  • Loading branch information
MahithChigurupati committed Feb 6, 2023
1 parent 527a9b0 commit 774b6c5
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 1 deletion.
Binary file added .DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion NFT Project/testNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ function safeMint(address to) public onlyOwner{
totalSupply++;
_mint(to,tokenID);
}
}
47 changes: 47 additions & 0 deletions englishAuction.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

contract EnglishAuction{
address payable public seller;
uint256 public timeToEnd;
bool public running;

address public highestBidder;
uint public highestBid;

constructor(){
seller = payable(msg.sender);


}

function startAuction() public{
require(!running);
require(seller == msg.sender);

running = true;
timeToEnd = block.timestamp + 1 minutes;

}

function bid() public payable{
require(running);

require(msg.value > highestBid);

payable(highestBidder).transfer(highestBid);

highestBidder = msg.sender;
highestBid = msg.value;

}

function win() public{
require(running);
require(timeToEnd <= block.timestamp);

running = false;
seller.transfer(highestBid);
}
}
27 changes: 27 additions & 0 deletions hackEnglishAuction.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

interface IEnglishAuction{
function bid() external payable;
}

contract auctionHack{
IEnglishAuction public auctionContrcat;

constructor(address addy){
auctionContrcat = IEnglishAuction(addy);
}

function bid() public payable{
auctionContrcat.bid{value: msg.value}();
}

fallback() external payable{

}

receive() external payable{

}
}

0 comments on commit 774b6c5

Please sign in to comment.