Skip to content

Commit

Permalink
Include current colony index in actions tracking logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubcolony authored and rdig committed May 31, 2023
1 parent 7867bb4 commit 66016f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/trackColonies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default async (): Promise<void> => {
const colonyAddedLogs = await getLogs(
networkClient,
networkClient.filters.ColonyAdded(),
{ fromBlock: 27976203 },
);

colonyAddedLogs.forEach((log) => {
Expand All @@ -58,9 +59,15 @@ export default async (): Promise<void> => {
* Once we found all current colonies, setup all Colony related listeners we care about
* We map the array of colonies into functions returning Promises
*/
const trackingPromises = setToJS(coloniesSet).map(
({ colonyAddress }) =>
const coloniesArray = setToJS(coloniesSet);
const trackingPromises = coloniesArray.map(
({ colonyAddress }, index) =>
async () => {
verbose(
'Fetching past actions for colony:',
colonyAddress,
`(${index + 1} out of ${coloniesArray.length})`,
);
await trackColonyActions(colonyAddress);

await colonySpecificEventsListener(colonyAddress);
Expand Down
2 changes: 0 additions & 2 deletions src/trackColonyActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
getCachedColonyClient,
getLatestBlock,
mapLogToContractEvent,
verbose,
} from '~utils';

const getFilter = (
Expand Down Expand Up @@ -58,7 +57,6 @@ const trackActionsByEvent = async (
};

export default async (colonyAddress: string): Promise<void> => {
verbose('Fetching past actions for colony:', colonyAddress);
await trackActionsByEvent(
ContractEventsSignatures.TokensMinted,
colonyAddress,
Expand Down

0 comments on commit 66016f9

Please sign in to comment.