• This repository has been archived on 09/Sep/2024
  • Stars
    star
    438
  • Rank 99,453 (Top 2 %)
  • Language
    Solidity
  • License
    MIT License
  • Created over 2 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A library of modern, hyper-optimized, and extensible Huff contracts with extensive testing and documentation built by Huff maintainers.

huffmate β€’ ci version license Discord

A set of modern, opinionated, and secure Huff contracts.

Warning

These contracts are unaudited and are not recommended for use in production.

Although contracts have been rigorously reviewed, this is experimental software and is provided on an "as is" and "as available" basis. We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.

Usage

Recommended To install with Foundry:

forge install huff-language/huffmate

To install with Hardhat or Truffle:

npm install @pentagonxyz/huffmate

Contracts

auth
β”œβ”€ Auth β€” "Flexible and updatable auth pattern"
β”œβ”€ NonPayable β€” "Modifier Macro that reverts the tx when msg.value > 0"
β”œβ”€ OnlyContract β€” "Basic Macro that reverts when the sender is an EOA"
β”œβ”€ Owned β€” "Simple single owner authorization"
β”œβ”€ RolesAuthority β€” "Role based Authority that supports up to 256 roles"
data-structures
β”œβ”€ Arrays β€” "Memory translation handlers for arrays"
β”œβ”€ Hashmap β€” "Simple mapping utilities for 32 byte words"
β”œβ”€ Bytes β€” "Helpers for working with Bytes"
proxies
β”œβ”€ Clones β€” "Clones library for deploying minimal proxy contracts"
β”œβ”€ Proxy β€” "Minimal ERC1967-compliant + upgradeable proxy contract"
mechanisms
|  β”œβ”€ huff-clones β€” "Library for creating clone contracts with immutable arguments"
|  |  β”œβ”€ ExampleClone β€” "Example clones-with-immutable-args clone contract"
|  |  β”œβ”€ ExampleCloneFactory β€” "Example clones-with-immutable-args factory contract"
|  |  β”œβ”€ HuffClone β€” "Clones-with-immutable-args Clone Instance"
|  |  └─ HuffCloneLib β€” "Library for creating a HuffClone"
|  └─ huff-vrgda β€” "Variable Rate Gradual Dutch Auctions written in Huff"
|      β”œβ”€ LinearVRGDA β€” "VRGDA with a linear issuance curve"
|      β”œβ”€ LogisticVRGDA β€” "VRGDA with a logistic issuance curve"
|      └─ VRGDA β€” "Sell tokens roughly according to an issuance schedule"
math
β”œβ”€ FixedPointMath β€” "Arithmetic library with operations for fixed-point numbers"
β”œβ”€ Math β€” "Refactored, common arithmetic macros"
β”œβ”€ SafeMath β€” "Safe Wrappers over primitive arithmetic operations"
β”œβ”€ Trigonometry β€” "Basic trigonometry functions where inputs and outputs are integers"
tokens
β”œβ”€ ERC20 β€” "Modern and gas efficient ERC20 + EIP-2612 implementation"
β”œβ”€ ERC721 β€” "Modern, minimalist, and gas efficient ERC721 implementation"
β”œβ”€ ERC1155 β€” "Minimalist and gas efficient standard ERC1155 implementation"
β”œβ”€ ERC4626 β€” "Minimal ERC4626 tokenized Vault implementation"
utils
β”œβ”€ Address β€” "Simple Utils for working with addresses"
β”œβ”€ BitPackLib β€” "Efficient bit packing library"
β”œβ”€ Calls β€” "Minimal wrappers for constructing calls to other contracts"
β”œβ”€ CommonErrors β€” "Wrappers for reverting with common error messages"
β”œβ”€ CREATE3 β€” "Deploy to deterministic addresses without the initcode factor"
β”œβ”€ ECDSA β€” "An optimised ECDSA wrapper"
β”œβ”€ ERC1155Receiver β€” "A minimal interface for receiving ERC1155 tokens"
β”œβ”€ ERC20Transfer β€” "Efficient ERC20 transfer wrappers"
β”œβ”€ Errors β€” "Custom error utilities"
β”œβ”€ Ethers β€” "Utilities for working with ether at a low level"
β”œβ”€ JumpTableUtil β€” "Utility macros for retrieving jumpdest pcs from jump tables"
β”œβ”€ LibBit β€” "A library ported from solady for bit twiddling operations"
β”œβ”€ MerkleProofLib β€” "Gas optimized merkle proof verification library"
β”œβ”€ Multicallable β€” "Enables a single call to call multiple methods within a contract"
β”œβ”€ Pausable β€” "An implementation of the Pausable standard"
β”œβ”€ ReentrancyGuard β€” "Gas optimized reentrancy protection for smart contracts"
β”œβ”€ Refunded β€” "Efficient gas refunds distributed through a modifier"
β”œβ”€ SafeTransferLib β€” "Safe ETH and ERC20 transfer library that gracefully handles missing return values"
β”œβ”€ Shuffling β€” "Refactored algorithms for shuffling and other bitwise algorithms"
└─ SSTORE2 β€” "Faster & cheaper contract key-value storage for Ethereum Contracts"
└─ Ternary β€” "A collection of ternary operations with abstracted conditional logic"
└─ TSOwnable β€” "An Ownable Implementation using Two-Step Transfer Pattern"

Acknowledgements

These contracts were inspired by or directly modified from many sources, primarily: