Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bounty parse #111

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading