huff-language / huffmate

A library of modern, hyper-optimized, and extensible Huff contracts with extensive testing and documentation built by Huff maintainers.
https://github.com/pentagonxyz/huffmate
MIT License
430 stars 55 forks source link

easier inheritance for ERC20.huff #98

Closed AmadiMichael closed 1 year ago

AmadiMichael commented 1 year ago

Changing no-match jumpi to no-match jump in ERC20.huff function dispatcher leaves the shifted function sig on the stack for contracts inheriting it which can use it after the no-match JUMPDEST. This way, importing (wrapping) contracts only have to add:

0x00 calldataload 0xE0 shr
ERC20_MAIN()

to the start of their MAIN() macro then add their specific function below it rather than copying all of ERC20.huff dispatch macro.

MathisGD commented 1 year ago

Hello @AmadiMichael, can you rebase this branch on the current dev branch please