Skip to content

Commit

Permalink
T
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized committed Oct 14, 2024
1 parent a519a2a commit d3e8b96
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/tokens/ERC20Votes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,21 @@ abstract contract ERC20Votes is ERC20 {
/// mstore(0x00, account)
/// let delegateSlot := keccak256(0x0c, 0x1d)
/// ```
/// The checkpoints slot of a delegate is given by:
/// The checkpoints length slot of a delegate is given by:
/// ```
/// mstore(0x09, _ERC20_VOTES_MASTER_SLOT_SEED)
/// mstore(0x00, delegate)
/// let delegateCheckpointsSlot := keccak256(0x0c, 0x1c)
/// let lengthSlot := keccak256(0x0c, 0x1c)
/// ```
/// The total checkpoints length slot is `_ERC20_VOTES_MASTER_SLOT_SEED`.
///
/// The `i`-th checkpoint slot is given by:
/// ```
/// let checkpointSlot := add(i, shl(96, lengthSlot))
/// let key := and(sload(checkpointSlot), 0xffffffffffff)
/// let value := shr(48, sload(checkpointSlot))
/// if eq(value, address()) { value := sload(not(checkpointSlot)) }
/// ```
/// The total checkpoints slot is `_ERC20_VOTES_MASTER_SLOT_SEED`.
uint256 private constant _ERC20_VOTES_MASTER_SLOT_SEED = 0xff466c9ff7631d35c7;

/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
Expand Down

0 comments on commit d3e8b96

Please sign in to comment.