3

I was reading through the implementation of ERC721A Upgradable's ERC721AStorage.sol and found this function

function layout() internal pure returns (Layout storage l) {
    bytes32 slot = STORAGE_SLOT;
    assembly {
        l.slot := slot
    }
}

I'm specifically wondering about l.slot. I'm guessing the slot property has a special meaning in Yul associated with the storage slot, but I don't really know if that's correct. Where can I learn about how this works? I read through https://docs.soliditylang.org/en/latest/yul.html and didn't see anything specific to this, but maybe I missed something?

[EDIT]: This example demonstrates using the slot to store and retrieve, but I still haven't found any docs or a good explanation of this.

1
  • This Q&A helped shed some light on .slot for me
    – RSW
    May 17, 2023 at 1:48

1 Answer 1

2

A slot is a word used to describe the location of stack and storage in Yul. You can take a look at this resource to learn more about how slot works:

https://docs.soliditylang.org/en/v0.8.13/assembly.html#memory-safety

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.