Skip to content

Commit

Permalink
Merge branch 'master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosQ96 committed Feb 6, 2024
2 parents 0d588e7 + bdcfff4 commit 0f5cd26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,5 @@ NUMBER_OF_UPDATE_RECURRING_DONATION_CONCURRENT_JOB=1
# Default value is 0 0 * * * that means one day at 00:00
UPDATE_RECURRING_DONATIONS_STREAM=0 0 * * *

MPETH_GRAPHQL_PRICES_URL=
MPETH_GRAPHQL_PRICES_URL=
MPETH_GRAPHQL_PRICES_URL=
6 changes: 5 additions & 1 deletion src/services/cronJobs/importLostDonationsJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ abiDecoder.addABI(erc20ABI);

const QF_ROUND_ID = config.get('LOST_DONATIONS_QF_ROUND');
const NETWORK_ID = config.get('LOST_DONATIONS_NETWORK_ID');
const NATIVE_NETWORK_TOKEN = config.get('LOST_DONATIONS_NATIVE_NETWORK_TOKEN');

const cronJobTime =
(config.get('IMPORT_LOST_DONATIONS_CRONJOB_EXPRESSION') as string) ||
Expand Down Expand Up @@ -140,7 +141,7 @@ export const importLostDonations = async () => {
) {
// it's an eth transfer native token
const nativeToken = await Token.createQueryBuilder('token')
.where(`token.id = 198`)
.where(`token.id = :token`, { token: NATIVE_NETWORK_TOKEN })
.getOne();

tokenInDB = nativeToken;
Expand Down Expand Up @@ -213,6 +214,7 @@ export const importLostDonations = async () => {
toWalletAddress: donationParams.to.toLowerCase(),
transactionId: tx.toLowerCase(),
projectId: project.id,
userId: dbUser.id,
currency: donationParams.currency,
tokenAddress: tokenInDB?.address,
amount: donationParams.amount,
Expand All @@ -238,13 +240,15 @@ export const importLostDonations = async () => {
} catch (e) {
logger.debug('Error saving donation for for tx: ', tx);
logger.debug('Error saving donation: ', e);
continue;
}

await updateUserTotalDonated(dbUser.id);
await updateUserTotalReceived(project.adminUser?.id);
await updateTotalDonationsOfProject(project.id);
} catch (e) {
logger.error('importLostDonations() error');
continue;
}
}

Expand Down

0 comments on commit 0f5cd26

Please sign in to comment.