Skip to content

Commit

Permalink
Add delegatesCurrentIndex doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcorbalan committed Sep 15, 2023
1 parent 4116e08 commit 784eb11
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/GasTankModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ contract GasTankModule is SafeStorage, Ownable, GelatoRelayContextERC2771 {

mapping(address delegate => EnumerableSet.AddressSet) internal delegatedGasTanks;

// index 0 is used for no when delegate is not a real delegate
// this saves which tokens a delegate is allowed to use on a given gasTank. Index 0 is used for when delegate is not
// a real delegate
mapping(address gasTank => mapping(address delegate => mapping(uint16 index => EnumerableSet.AddressSet))) internal
tokens;

// this is used as the index for the `tokens` mapping, to prevent having to remove all elements in the AddressSet
// one by one. So each time a delegate is added for a gasTank, this index is increased by 1 and this way a clean
// new instance of the AddressSet is used to save which tokens the delegate is allowed to use
mapping(address gasTank => mapping(address delegate => uint16 index)) internal delegatesCurrentIndex;

////////////////////////////
Expand Down

0 comments on commit 784eb11

Please sign in to comment.