Skip to content

Commit

Permalink
retrieve tokens decimals before parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
vhcsilva committed Feb 23, 2024
1 parent 82f1108 commit 7ea5731
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/models/network-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,19 @@ export class Network_v2 extends Model<Network_v2Methods> implements Deployable {
}

async getBounty(id: number) {
return bounty(await this.callTx(this.contract.methods.getBounty(id)));
const chainBounty = await this.callTx(this.contract.methods.getBounty(id));
const transactionalToken = new ERC20(this.connection, chainBounty?.transactional);
await transactionalToken.start();
const rewardToken =
chainBounty?.rewardToken !== nativeZeroAddress ? new ERC20(this.connection, chainBounty?.rewardToken) : null;

if (rewardToken)
await rewardToken.start();

return bounty(await this.callTx(this.contract.methods.getBounty(id)),
this.networkToken.decimals,
transactionalToken.decimals,
rewardToken?.decimals);
}

/**
Expand Down

0 comments on commit 7ea5731

Please sign in to comment.