Skip to content

AdminControlled #690

Answered by mfornet
cenwadike asked this question in Q&A
Discussion options

You must be logged in to vote

Reference to the function.

This functions replace specific bits of the value from the storage at specified key. Only bits that are set in mask will be replaced with bits at the same position from value.

The motivation for this function is that sometimes, different values are packed inside the same slot on ethereum, either by some solidity optimisation, or our own optimisation. In this case, we only want to replace some part of the value, instead of the whole value. In practice most of the time adminSstore is enough.

How does adminSstoreWork:

merged = old_value ^ value
filtered = merged & mask
recovered = filtered ^ old_value
  1. In the first step (merged) we merge the two values together, w…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cenwadike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants