LinkedIdList.sol
State Variables
_SENTINEL
Marks the beginning of the list.
Unrealistic to have that many ids.
uint internal constant _SENTINEL = type(uint).max;Functions
validNewId
Modifier to guarantee the given new id is valid.
modifier validNewId(List storage self, uint id);validId
Modifier to guarantee the given id is valid.
modifier validId(List storage self, uint id);validPosition
Modifier to guarantee the given position is valid.
onlyConsecutiveIds
Modifier to guarantee the given ids are consecutive.
validMoveParameter
prevId is checked by consecutiveId to be valid
init
should never be called more than once
length
lastId
Returns the last id in
listIds
lists the ids contained in the linked list.
Parameters
self
List
The linked List from where the ids should be listed.
Returns
<none>
uint256[]
array of ids that are contained in the list
isExistingId
Returns whether id is in list and not Sentinel
Parameters
self
List
The linked List from where the ids should be listed.
id
uint256
The id to check.
getPreviousId
Id and prevId can be _SENTINEL
Parameters
self
List
The linked List from where the ids should be listed.
id
uint256
The id to check.
getNextId
Id and nextId can be _SENTINEL
Parameters
self
List
The linked List from which to get the next id.
id
uint256
The id to check.
addId
Add To list at last position
Parameters
self
List
The linked List to which to add the id.
id
uint256
The id to add.
removeId
Remove Id from list and decrease size.
Parameters
self
List
The linked List from which to remove the id.
prevId
uint256
The id of the previous id.
id
uint256
The id to remove.
moveIdInList
Move id in list
Parameters
self
List
The linked List in which to move the id.
id
uint256
The id to move.
prevId
uint256
The id of the previous id.
idToPositionAfter
uint256
The id to position after.
Errors
Library__LinkedIdList__InvalidId
Given id invalid.
Library__LinkedIdList__InvalidNewId
Given new id invalid.
Library__LinkedIdList__InvalidPosition
Given position in list is invalid.
Library__LinkedIdList__IdNotConsecutive
Given ids are not consecutive.
Library__LinkedIdList__InvalidIntermediatePosition
Given ids are not consecutive.
Structs
List
Struct used to store information about an element in the list.
Properties
size
uint256
last
uint256
list
mapping(uint256 => uint256)
Last updated