-
Notifications
You must be signed in to change notification settings - Fork 5
/
GroupManager.sol
89 lines (67 loc) · 2.01 KB
/
GroupManager.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./CollateralManager.sol";
contract GroupManager is Ownable {
enum StakeDuration { DAY, WEEK, MONTH, YEAR }
struct Group {
uint256 id;
address [] participants;
uint256 groupStakeBalance;
}
struct Stake {
uint256 amount;
uint256 timestamp;
StakeDuration duration;
bool autoRenewal;
}
uint256 minGroupSize;
uint256 maxGroupSize;
uint256 tssThreshold;
uint256 nextGroupId;
// Nodes balances
mapping(address => uint256) public balances;
// Nodes stake balances
mapping(address => uint256) public stakeBalances;
// ID to group mapping
mapping(uint256 => Group) public groups;
// Node to group mapping
mapping(address => Group) public groups;
// Group list
uint256 [] public group;
constructor() {
nextGroupId = 1;
minGroupSize = 8;
maxGroupSize = 80;
tssThreshold = 8;
}
function getNodeGroup(address _node) public returns (address) {
}
function getGroupNodes(address _group) public returns (address []) {
}
function joinToGroup() public returns (uint256) {
}
/**
* @param _id: ID of the group
* @param _address: Address of tss distributed key, created in group.
* @params _sigs: We needs to at least "tssThreshold" numner of group nodes confirmation.
* ========================================================================================
* @return True/False: Is success done or not.
**/
function setGroupAddress(uint256 _id, address _address, bytes[] calldata _sigs) public returns (bool) {
}
function deposit(uint256 amount) public {
}
function stake(uint256 amount, uint8 _period) public {
// subrtact from balances and add to stakeBalances
}
function withdraw(uint256 amount) public {
// withdraw from balances
}
function adminAddNodeToGroup() public onlyOwner {
}
function adminSetGroupSize(uint256 _min, uint256 _max) public onlyOwner {
}
function adminSetTssThreshold(uint256 _tssThreshold) public onlyOwner {
}
}