Skip to content

evm playground - optimizations, patterns and bytecode decoding

License

Notifications You must be signed in to change notification settings

AdvaithD/protocol-pg

Repository files navigation

Protocol Playground• CI

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

  1. State Variable Notes
  2. Gas benchmark of EIP1167 Clones vs. Clones with immutable Args
  3. Basic Gas Optimizations
  4. CREATE3 Factory (WIP)

Contracts

  1. EIP1167 Clones
  2. Clones with Immutable Args
  3. ERC721 Merkle Drop
  4. Minimal Multisig with EIP712
  5. Utility Contract for Type Conversions (for solidity tests etc)
  6. Generic User - Use in tests to execute virtually any operation as a user
  7. 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

About

evm playground - optimizations, patterns and bytecode decoding

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published