-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ranking.sol
29 lines (20 loc) · 862 Bytes
/
Ranking.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
import "./SingleRanking.sol";
library Ranking {
struct Data {
mapping(uint => SingleRanking.Data) rankings;
}
function add(Data storage _rankings, uint _category, uint _key, uint _value) internal {
SingleRanking.add(_rankings.rankings[_category], _key, _value);
}
function remove(Data storage _rankings, uint _category, uint _key, uint _value) internal {
SingleRanking.remove(_rankings.rankings[_category], _key, _value);
}
function length(Data storage _rankings, uint _category) public view returns (uint) {
return SingleRanking.length(_rankings.rankings[_category]);
}
function get(Data storage _rankings, uint _category, uint _offset, uint _count) public view returns (uint[] memory) {
return SingleRanking.get(_rankings.rankings[_category], _offset, _count);
}
}