Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Pass contract into resolveReserve (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich authored Apr 13, 2022
1 parent 11b313c commit 1d8f10d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app-toolkit/helpers/position/single-vault.token-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ type SingleVaultTokenHelperParams<T> = {
dependencies?: AppGroupsDefinition[];
resolveContract: (opts: { address: string; network: Network }) => T;
resolveUnderlyingTokenAddress: (opts: { contract: T }) => string | Promise<string>;
resolveReserve?: (opts: { underlyingToken: Token; address: string; network: Network }) => Promise<number>;
resolveReserve?: (opts: {
contract: T;
underlyingToken: Token;
address: string;
network: Network;
}) => Promise<number>;
resolvePricePerShare?: (opts: {
reserve: number;
supply: number;
Expand Down Expand Up @@ -71,7 +76,7 @@ export class SingleVaultTokenHelper {
multicall.wrap(tokenContract).totalSupply(),
]);

const reserveRaw = await resolveReserve({ underlyingToken, address, network });
const reserveRaw = await resolveReserve({ contract, underlyingToken, address, network });
const supply = Number(supplyRaw) / 10 ** decimals;
const reserve = Number(reserveRaw) / 10 ** underlyingToken.decimals;
const pricePerShare = await resolvePricePerShare({ reserve, supply, address, network });
Expand Down

0 comments on commit 1d8f10d

Please sign in to comment.