π―
This file contains hidden or 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: WTFPL | |
pragma solidity 0.8.19; | |
contract Victim { | |
mapping(address => uint256) public balanceOf; | |
function deposit() external payable { | |
balanceOf[msg.sender] += msg.value; | |
} |
This file contains hidden or 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: WTFPL | |
pragma solidity 0.8.19; | |
contract A { | |
/** | |
* @dev Returns 118 for contract `A`. | |
*/ | |
function codesize() external pure returns (uint256 code) { | |
// solhint-disable-next-line no-inline-assembly | |
assembly { |
This file contains hidden or 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: WTFPL | |
pragma solidity ^0.8.19; | |
contract ManaTesting { | |
function test_iWeak() public view returns (uint256 manaUsed) { | |
uint256 startMana = manaleft(); | |
uint256 i = 0; | |
i++; | |
manaUsed = startMana - manaleft(); | |
} |
This file contains hidden or 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: WTFPL | |
pragma solidity 0.8.18; | |
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; | |
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; | |
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; | |
/** | |
* @dev Error that occurs when an unauthorised transfer is triggered. |
This file contains hidden or 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: WTPFL | |
pragma solidity 0.8.18; | |
contract Called { | |
function callMe() external view returns (address) { | |
// solhint-disable-next-line avoid-tx-origin | |
assert(tx.origin == msg.sender); | |
return msg.sender; | |
} | |
} |
This file contains hidden or 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
/** | |
* @dev Solidity version for standard pack mode. | |
*/ | |
function hashAddr(address addr) external pure returns (bytes32) { | |
/** | |
* @dev The function `keccak256` hashes `0x000000000000000000000000+addr`. | |
* Remember that one EVM word is 32 bytes and Ethereum addresses are 20 bytes long. | |
*/ | |
return keccak256(abi.encode(addr)); | |
} |
This file contains hidden or 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: WTFPL | |
pragma solidity 0.8.17; | |
/** | |
* @dev A simple contract that reverts. | |
*/ | |
contract Revert { | |
function revertWithoutReason() external pure { | |
// solhint-disable-next-line reason-string | |
revert(); |
This file contains hidden or 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
// Decompiled by library.dedaub.com | |
// 2022.11.28 11:00 UTC | |
// Data structures and variables inferred from the use of storage instructions | |
uint256 owner_0_0_19; // STORAGE[0x0] bytes 0 to 19 | |
uint256 owner_1_0_19; // STORAGE[0x1] bytes 0 to 19 | |
function () public payable { | |
revert(); |
This file contains hidden or 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.19; | |
/** | |
* @title Returnbomb attack example | |
* @author pcaversaccio | |
*/ | |
contract Evil { | |
uint256 public counter; |
This file contains hidden or 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.17; | |
contract Storage { | |
struct SomeStruct { | |
uint16 a; | |
uint16 b; | |
uint16 c; | |
uint16 d; | |
} |