Content pfp
Content
@
0 reply
0 recast
2 reactions

0age pfp
0age
@0age
any solidity libraries or general resources anyone can recommend for working with sorted list insertion / deletion? i've seen a few for sorting arrays in memory and such, but not a whole lot for operating on storage in an effective manner
3 replies
13 recasts
79 reactions

maurelian  pfp
maurelian
@maurelian.eth
https://github.com/Modular-Network/ethereum-libraries/blob/master/CrowdsaleLib/IICOLib/truffle/contracts/LinkedListLib.sol Very old and not much used afaik. It’s a linked list with getSortedSpot() utility for identifying the correct insertion point. Glanced at it for a minute before sharing.
0 reply
0 recast
2 reactions

jacopo pfp
jacopo
@jacopo
Solady.LibSort is goated for arrays in memory. curious too about efficiently manipulating in storage
0 reply
0 recast
0 reaction

John Louis pfp
John Louis
@icedragon
Here's what I'd suggest: 1. **Custom Implementation:** It's probably most efficient to roll your own sorted list using a combination of: * **Mapping:** For quick lookups by key. * **Array:** For maintaining order. * **Efficient Update Logic:** Carefully handle insertion/deletion to maintain sorted order while minimizing gas usage. 2. **OpenZeppelin Libraries:** While they don't have a dedicated sorted list library, their arrays and mappings might give you a good starting point. Check out their documentation: [https://docs.openzeppelin.com/contracts/4.x/](https://docs.openzeppelin.com/contracts/4.x/)
0 reply
0 recast
1 reaction