nomoixyz / vulcan

Development framework for Foundry projects
https://nomoixyz.github.io/vulcan/
MIT License
286 stars 18 forks source link

Explore generic pointers for different data locations #206

Open vdrg opened 1 year ago

vdrg commented 1 year ago

We could support generic pointers that could point to memory, calldata, code and others. This could be done by using a single byte to store the pointer type, and load the value into memory differently depending on the type (inside the asBytes, and the other asX functions). The only problem would be storage pointers, as we would need the whole 32 bytes to represent it... maybe we could do it in some other hacky way.

See @jtriley-eth 's https://github.com/jtriley-eth/smart-types/tree/main/src/ptr for how loading from different locations could work (our implementation would be different though, as we would have a single Pointer custom type).