protocol-pg
protocol-pg copied to clipboard
evm playground - optimizations, patterns and bytecode decoding
Protocol Playground• 
Playground exploring solidity patterns, gas optimizations and compilations of notes.
Doing this for fun, but also to build a personal resource, and share it with others.
Notes
- State Variable Notes
- Gas benchmark of EIP1167 Clones vs. Clones with immutable Args
- Basic Gas Optimizations
- CREATE3 Factory (WIP)
Contracts
- EIP1167 Clones
- Clones with Immutable Args
- ERC721 Merkle Drop
- Minimal Multisig with EIP712
- Utility Contract for Type Conversions (for solidity tests etc)
- Generic User - Use in tests to execute virtually any operation as a user
- Create3 Factory
Contributing
You will need a copy of Foundry installed before proceeding. See the installation guide for details.
Setup
git clone https://github.com/transmissions11/foundry-template.git
cd foundry-template
forge install
Run Tests
forge test
# Run a specific test
forge test --match-contract "ContractName"
Update Gas Snapshots
forge snapshot
REPL
Run make repl
Example:
➜ uint256 a = 200;
➜ a
Type: uint
├ Hex: 0xc8
└ Decimal: 20
➜ abi.encode(100,100,100)
Type: dynamic bytes
├ Hex (Memory):
├─ Length ([0x00:0x20]): 0x0000000000000000000000000000000000000000000000000000000000000060
├─ Contents ([0x20:..]): 0x000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064
├ Hex (Tuple Encoded):
├─ Pointer ([0x00:0x20]): 0x0000000000000000000000000000000000000000000000000000000000000020
├─ Length ([0x20:0x40]): 0x0000000000000000000000000000000000000000000000000000000000000060
└─ Contents ([0x40:..]): 0x000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064