-
Notifications
You must be signed in to change notification settings - Fork 3
/
LockedPoolzData.sol
50 lines (46 loc) · 1.3 KB
/
LockedPoolzData.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./LockedControl.sol";
contract LockedPoolzData is LockedControl {
function GetAllMyPoolsId() public view returns (uint256[] memory) {
return MyPoolz[msg.sender];
}
// function GetMyPoolzwithBalance
// reconsider msg.sender
function GetMyPoolsId() public view returns (uint256[] memory){
uint256[] storage allIds = MyPoolz[msg.sender];
uint256[] memory ids;
uint256 index;
for(uint i=0 ; i<allIds.length ; i++){
if(AllPoolz[allIds[i]].StartAmount > AllPoolz[allIds[i]].DebitedAmount ){
ids[index] = allIds[i];
index++;
}
}
return ids;
}
function GetPoolData(uint256 _id)
public
view
isPoolValid(_id)
returns (
uint256,
uint256,
uint256,
uint256,
address,
address
)
{
Pool storage pool = AllPoolz[_id];
require(pool.Owner == msg.sender || pool.Allowance[msg.sender] > 0, "Private Information");
return (
pool.StartTime,
pool.FinishTime,
pool.StartAmount,
pool.DebitedAmount,
pool.Owner,
pool.Token
);
}
}