kopia lustrzana https://github.com/bugout-dev/dao
return array with all pool ids that controller owns
rodzic
ec0ce83c24
commit
b1bf65fb2a
|
@ -265,16 +265,23 @@ contract TerminusFacet is ERC1155WithTerminusStorage {
|
||||||
{
|
{
|
||||||
LibTerminus.TerminusStorage storage ts = LibTerminus.terminusStorage();
|
LibTerminus.TerminusStorage storage ts = LibTerminus.terminusStorage();
|
||||||
|
|
||||||
|
uint256 index = 0;
|
||||||
|
uint256[] memory poolIDs = new uint256[](ts.currentPoolID);
|
||||||
|
uint256 numControlledPools = 0;
|
||||||
for (uint256 i = 0; i < ts.currentPoolID; i++) {
|
for (uint256 i = 0; i < ts.currentPoolID; i++) {
|
||||||
uint256 index = 0;
|
|
||||||
uint256[] memory poolIDs = new uint256[](ts.currentPoolID);
|
|
||||||
address poolController = ts.poolController[i];
|
address poolController = ts.poolController[i];
|
||||||
if (poolController == controler) {
|
if (poolController == controler) {
|
||||||
poolIDs[index] = i;
|
numControlledPools++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uint256[] memory controlledPools = new uint256[](numControlledPools);
|
||||||
|
for (uint256 i = 0; i < ts.currentPoolID; i++) {
|
||||||
|
address poolController = ts.poolController[i];
|
||||||
|
if (poolController == controler) {
|
||||||
|
controlledPools[index] = i;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
index++;
|
|
||||||
return poolIDs[:index];
|
|
||||||
}
|
}
|
||||||
|
return controlledPools;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue