Skip to content

Instantly share code, notes, and snippets.

@devtooligan
devtooligan / pureConsole.sol
Last active January 21, 2024 14:25
console.log from pure functions h/t @z0age
// @author original POC by @z0age
library pureConsole {
/*********************
* string + uint256
********************/
function log(string memory errorMessage, uint256 value) internal pure {
@devtooligan
devtooligan / emitRevertTest.sol
Last active June 15, 2023 22:36
Foundry test - Emit event and revert
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "forge-std/Test.sol";
contract Reverter {
event Test();
function emitAndRevert() external {
emit Test();
@devtooligan
devtooligan / cursedbeaconproxy.sol
Last active April 9, 2024 16:10
PoC of crit bug found in Astaria.xyz's custom BeaconProxy contract
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
contract SheHateMe {
receive() external payable {}
function getImpl(uint8 x) public returns (address) {
return address(this);
@devtooligan
devtooligan / TestIsPayable.sol
Created July 1, 2023 19:54
Utility to check if a function is payable
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "forge-std/Test.sol";
contract Utility {
error BadCalldata();
error NonPayable();
error Payable();
error NoCode();
@devtooligan
devtooligan / UnrolledLoopTest.sol
Last active July 28, 2023 20:42
unrolled loop
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "forge-std/Test.sol";
contract UnrolledLoopTest is Test {
function _transfer1(uint256 counter) internal returns (uint256) {
// token.transfer(addressList[counter], amount);
return counter + 1;
}