Skip to content

Instantly share code, notes, and snippets.

View passandscore's full-sized avatar

Jason Schwarz passandscore

View GitHub Profile
@passandscore
passandscore / TokenLockers.sol
Created February 12, 2024 21:25
Manages the timelock logic for external tokens.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "./ERC20.sol";
import "./interfaces/IERC20.sol";
contract TokenLockers is ERC20 {
error InsufficentFunds();
error InsufficentInputValue();
error InvalidLocktime();
@passandscore
passandscore / Reentrancy.sol
Created June 19, 2024 20:00
Educational Solidity Example: Demonstrating a Reentrancy Attack
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
// Inspired By: https://solidity-by-example.org/hacks/re-entrancy/
/**
* @title EtherStore
* @dev A simple contract for depositing and withdrawing ETH.
* Vulnerable to re-entrancy attack.
*/
@passandscore
passandscore / DeleteNumberAtIndex.sol
Created June 21, 2024 13:23
Solidity Challenge - DeleteNumberAtIndex
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
contract DeleteNumberAtIndexChallenge {
struct Number {
uint value;
}
Number[] public numbers;
@passandscore
passandscore / sendZeroValueToSelf.ts
Created February 13, 2025 02:03
Cancel Stuck Pending EVM Transactions
import { ethers } from "ethers";
import * as fs from "fs";
import * as path from "path";
import * as dotenv from "dotenv";
// Terminal Command: npx ts-node scripts/sendZeroValueToSelf.ts
// Used when a transaction fails to send
// Load environment variables from .env file
dotenv.config();