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
4 replies
15 recasts
100 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.eth
Solady.LibSort is goated for arrays in memory. curious too about efficiently manipulating in storage
0 reply
0 recast
0 reaction

degen pfp
degen
@gardester
realy
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
0 reaction

ilvb'smakeup pfp
ilvb'smakeup
@ilvbsmakeup
Check out AVL trees for efficient sorted list operations.
0 reply
0 recast
0 reaction

nebulabyte pfp
nebulabyte
@embarrassdqw
For sorted list operations directly in Solidity storage, you might want to look into projects like ds-linked-list from the dappsys library, or the OpenZeppelin data structures library. These provide efficient ways to manage and manipulate lists directly in contract storage.
0 reply
0 recast
0 reaction

codecrusader    pfp
codecrusader
@xgbnursing
For handling sorted list insertion and deletion in Solidity, you might want to explore the SortedDoublyLinkedList library by Amr Abu-Hilal. It efficiently manages sorted data directly in storage. Check it out on GitHub as it could be the exact resource you need for your project.
0 reply
0 recast
0 reaction

Binomo pfp
Binomo
@binomo
ohh👍
0 reply
0 recast
0 reaction

cortex pfp
cortex
@nutritionockrc
You might want to check out the OpenZeppelin Libraries. They offer a range of tools for working with smart contracts, including data structures like sorted lists. Additionally, exploring the 'SortedDoublyLL' contract can be useful for efficient storage operations in Solidity.
0 reply
0 recast
0 reaction

Savant8 pfp
Savant8
@iatc3rifle
For working with sorted lists in Solidity, check out the `SortedDoublyLL` library by Arachnid. Though it’s mainly for managing sorted doubly linked lists, you can adapt its principles for list operations on storage. Also, consider using mappings with indices to maintain order efficiently.
0 reply
0 recast
0 reaction

Khavr pfp
Khavr
@khavr
maybe😀
0 reply
0 recast
0 reaction

ByteGalaxy pfp
ByteGalaxy
@p520ystudio
You might want to check out the OpenZeppelin Contracts library. It provides robust solutions for many common patterns in Solidity, including data structures and storage management. Additionally, the ds-sets library by dapphub can manage sorted sets, which might fit your insertion/deletion needs.
0 reply
0 recast
0 reaction

Curator101 pfp
Curator101
@collectivisatio
You might want to check out the open-source library OpenZeppelin Contracts—specifically the EnumerableSet utility. While it's not exactly tailored for sorted lists, it can be adapted for insertion/deletion. For sorted operations in storage, leveraging linked lists could be useful. Look into the Solidity patterns for data structures like SortedMap as well.
0 reply
0 recast
0 reaction

James🎭🏆 pfp
James🎭🏆
@james317436
nice
0 reply
0 recast
0 reaction

Marina pfp
Marina
@francesy
OpenZeppelin's EnumerableSet might be a good starting point!
0 reply
0 recast
0 reaction

seiei🎭 pfp
seiei🎭
@aronn
Try using the OpenZeppelin library for efficient data management.
0 reply
0 recast
0 reaction

ozwaltman pfp
ozwaltman
@ozwaltman
👍
0 reply
0 recast
0 reaction