Skip to content

Instantly share code, notes, and snippets.

@MiloTruck
MiloTruck / Vault.sol
Created October 13, 2023 03:16
Foundry Snapshots
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
// From https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol
import {ERC20} from './ERC20.sol';
contract Vault is ERC20 {
// Underlying asset
ERC20 public token;
@MiloTruck
MiloTruck / M-01.t.sol
Last active August 30, 2023 18:12
PoCs for LUKSO Audit Report
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import "../../contracts/LSP0ERC725Account/LSP0ERC725Account.sol";
contract Implementation {
// _pendingOwner is at slot 3 for LSP0ERC725Account
bytes32[3] __gap;
address _pendingOwner;
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;
library Execution {
function functionCallWithValue(
address to,
uint256 value,
bytes memory data
) internal returns (bytes memory) {
assembly {
@MiloTruck
MiloTruck / EnumerableMapTest.sol
Last active June 15, 2023 05:42
Using `delete` on OpenZeppelin's EnumerableSet/EnumerableMap
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
contract EnumerableMapTest is Test {
using EnumerableMap for EnumerableMap.AddressToUintMap;
EnumerableMap.AddressToUintMap map;
@MiloTruck
MiloTruck / MockERC20Fee.sol
Created May 30, 2022 18:53
MockERC20 token that implements fee-on transfer.
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "solmate/tokens/ERC20.sol";
contract MockERC20Fee is ERC20 {
// 2% fee for all transfers
uint256 internal feeRate = (2 / 100) * 1 ether;
constructor(
string memory name_,