Hey Krakovia
Is there a way to tell what kind of value a storage location holds ?
Sep 21, 2022, 8:27 PM
In my Case
Location 1 is uint256 with value 1
Location 2 is bool with value true
Location 3 is an Array of length 1 with value 223 at 0 index
Location 4 is a mapping
Location 1 is uint256 with value 1
Location 2 is bool with value true
Location 3 is an Array of length 1 with value 223 at 0 index
Location 4 is a mapping
Sep 21, 2022, 8:28 PM
No
You'd have to look at code
Sep 21, 2022, 8:40 PM
Hey Niccolo
Consider I know the storage location of the array.
Is there a way to find the elements that are stored in that slot ?
Consider I know the storage location of the array.
Is there a way to find the elements that are stored in that slot ?
@karola96 🥺
Sep 22, 2022, 5:55 AM
You want to use a debugger, a getter function or something like Foundry
Sep 22, 2022, 11:15 AM
No….Like if I know the storage location of an array
And I access it using ethers.getStorageAt(contract, location).
It stores the length of the array though
Is there a way to get the stored elements too ?
I feel it has something to do with keccak256( )
But didn’t understand 🥲
And I access it using ethers.getStorageAt(contract, location).
It stores the length of the array though
Is there a way to get the stored elements too ?
I feel it has something to do with keccak256( )
But didn’t understand 🥲
Sep 22, 2022, 11:32 AM
Yul + assembly?
Why would you go that deep into storage?
What problem are you try to solve?
Why would you go that deep into storage?
What problem are you try to solve?
Sep 22, 2022, 12:07 PM
I am trying to solve nothing 🥲
I am learning and had this doubt.
If we could get elements stored from the storage location of array or mapping
I am learning and had this doubt.
If we could get elements stored from the storage location of array or mapping
https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html
I am sure this has the answer on “how to”
But I wasn’t able to understand it 🥲
But I wasn’t able to understand it 🥲
Sep 22, 2022, 12:09 PM
Yeah i think you're looking for yul
Sep 22, 2022, 12:10 PM
What’s YUL ?
Sep 22, 2022, 12:11 PM
https://docs.soliditylang.org/en/v0.8.17/yul.html
https://fuellabs.medium.com/introducing-yul-a-new-low-level-language-for-ethereum-aa64ce89512f
Sep 22, 2022, 12:14 PM
Not necessarily, if he doesn't need to access that inside the contract itself (which would be weird since it'd be an useless complication) he can just achieve that with web3
Sep 22, 2022, 12:14 PM
Please pm to update my memory about you
Sep 22, 2022, 12:15 PM
This answers your question
Sep 22, 2022, 12:16 PM
Would it be okay if I message you regarding this ? 😅
Sep 22, 2022, 12:17 PM
yes, nothing is "private" in storage
const slotKey = BigNumber.from(solidityKeccak256(["uint256"], [slotNumber]))
then getStorageAt(ca, slotKey.add(i)) where i is index of array
const slotKey = BigNumber.from(solidityKeccak256(["uint256"], [slotNumber]))
then getStorageAt(ca, slotKey.add(i)) where i is index of array
heres good article https://blog.openzeppelin.com/ethereum-in-depth-part-2-6339cf6bddb9/
Sep 22, 2022, 12:37 PM
I got it
https://solidity-by-example.org/hacks/accessing-private-data/
Thanks Bro 🤙🏻👍
https://solidity-by-example.org/hacks/accessing-private-data/
Thanks Bro 🤙🏻👍
Been thinking about how to solve it since yesterday 🥲
Sep 22, 2022, 5:55 PM