Content
@
0 reply
0 recast
0 reaction
Noah Bragg ๐ฅ
@nbragg
Solidity devs: How possible is it to store a large array to hold a leaderboard onchain? It would need to be updated as it changes and shifted around. My gut reaction as that this would be too expensive to make happen. Is on a layer2 at least. Or are there any better solutions?
7 replies
0 recast
5 reactions
Varun Srinivasan
@v
Do you need the sorting onchain? Or just the scores?
1 reply
0 recast
0 reaction
Noah Bragg ๐ฅ
@nbragg
Would want sorting onchain so that onchain logic changes based on your relation to other players on the leaderboard. "who are the 5 above you and 5 below you" Kind of thing.
1 reply
0 recast
0 reaction
Jem
@jem
We (Axis) implemented an on-chain sealed bid batch auction, which requires the decrypted bids to be sorted. This might be relevant for you? TLDR: - The sorting function is separate from other functionality. - The caller can pass in the number of bids to [decrypt and] sort, so that it can be batched to fit within the chain's gas limit. - Sort hints can be optionally passed in, to reduce gas costs. Source: https://github.com/Axis-Fi/axis-core/blob/4c94df816638db7fe5ab10ee8ed97b69f73b7869/src/modules/auctions/batch/EMP.sol#L434
1 reply
0 recast
1 reaction
Noah Bragg ๐ฅ
@nbragg
Interesting! Thanks for sharing. checking it out.
0 reply
0 recast
1 reaction