Skip to content

Commit

Permalink
[Fortune Exchange Oracle] Change reward_amount to string (#2553)
Browse files Browse the repository at this point in the history
* change reward amount to string

* add url to log
  • Loading branch information
portuu3 authored Sep 25, 2024
1 parent a2e28c9 commit 463f374
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class JobDto {
jobDescription?: string;

@ApiProperty({ name: 'reward_amount' })
rewardAmount?: number;
rewardAmount?: string;

@ApiProperty({ name: 'reward_token' })
rewardToken?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ export class JobService {
data.fields?.includes(JobFieldName.RewardAmount) ||
data.sortField === JobSortField.REWARD_AMOUNT
) {
job.rewardAmount =
manifest.fundAmount / manifest.submissionsRequired;
job.rewardAmount = (
manifest.fundAmount / manifest.submissionsRequired
).toString();
}
if (data.fields?.includes(JobFieldName.RewardToken)) {
job.rewardToken = TOKEN;
Expand All @@ -189,8 +190,8 @@ export class JobService {

if (data.sortField === JobSortField.REWARD_AMOUNT) {
jobs.sort((a, b) => {
const rewardA = a.rewardAmount ?? 0;
const rewardB = b.rewardAmount ?? 0;
const rewardA = Number(a.rewardAmount ?? 0);
const rewardB = Number(b.rewardAmount ?? 0);
if (data.sort === SortDirection.DESC) {
return rewardB - rewardA;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class ExchangeOracleGateway {
return response.data as T;
} catch (e) {
console.error(
`Error, while executing exchange oracle API call, error details: ${e}`,
`Error, while executing exchange oracle API call to ${options.url}, error details: ${e}`,
);
throw e;
}
Expand Down

0 comments on commit 463f374

Please sign in to comment.