Lorem ipsum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
contract EtherGame { | |
uint public targetAmount = 7 ether; | |
address public winner; | |
function deposit() public payable { | |
require(msg.value == 1 ether, "You can only send 1 Ether"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
contract Attack { | |
EtherGame etherGame; | |
constructor(EtherGame _etherGame) { | |
etherGame = EtherGame(_etherGame); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
contract Proxy { | |
address owner; | |
constructor() public { | |
owner = msg.sender; | |
} | |
function forward(address callee, bytes _data) public { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
flameshot gui --raw >> /home/zombie/Pictures/flameshot/screenshot.png | |
convert /home/zombie/Pictures/flameshot/screenshot.png \( +clone -alpha extract -draw 'fill black polygon 0,0 0,5 5,0 fill white circle 5,5 5,0' \( +clone -flip \) -compose Multiply -composite \( +clone -flop \) -compose Multiply -composite \) -alpha off -compose CopyOpacity -composite /home/zombie/Pictures/flameshot/screenshot.png | |
convert /home/zombie/Pictures/flameshot/screenshot.png \( +clone -background black -shadow 75x10+0+0 \) +swap -bordercolor none -border 10 -background none -layers merge +repage /home/zombie/Pictures/flameshot/shadow.png | |
xclip -selection clipboard -t image/png -i /home/zombie/Pictures/flameshot/shadow.png | |
rm /home/zombie/Pictures/flameshot/screenshot.png /home/zombie/Pictures/flameshot/shadow.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity 0.8.10; | |
import "forge-std/Test.sol"; | |
import "./interface.sol"; | |
interface parity { | |
function isOwner(address _addr) external view returns (bool); | |
function kill(address _to) external; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract UnstoppableLender is ReentrancyGuard { | |
... | |
function depositTokens(uint256 amount) external nonReentrant { | |
require(amount > 0, "Must deposit at least one token"); | |
// Transfer token from sender. Sender must have first approved them. | |
damnValuableToken.transferFrom(msg.sender, address(this), amount); | |
poolBalance = poolBalance + amount; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('Exploit', async function () { | |
await this.token.connect(attacker).transfer(this.pool.address, 1); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; | |
import "@openzeppelin/contracts/utils/Address.sol"; | |
contract NaiveReceiverLenderPool is ReentrancyGuard { | |
using Address for address; | |
uint256 private constant FIXED_FEE = 1 ether; // not the cheapest flash loan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract FlashLoanReceiver { | |
... | |
function receiveEther(uint256 fee) public payable { | |
require(msg.sender == pool, "Sender must be pool"); | |
uint256 amountToBeRepaid = msg.value + fee; | |
require(address(this).balance >= amountToBeRepaid, "Cannot borrow that much"); |
OlderNewer