Skip to content

Commit

Permalink
Fix management page breaking when pool address in URL is lowercase (#362
Browse files Browse the repository at this point in the history
)
  • Loading branch information
onnovisser authored Sep 7, 2021
1 parent e03e875 commit db94d7a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tinlake-ui/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useTrancheYield = (poolId?: string | undefined) => {

return React.useMemo(() => {
if (pools.data?.pools && poolId) {
const poolData = pools.data.pools.find((singlePool) => singlePool.id === poolId)
const poolData = pools.data.pools.find((singlePool) => singlePool.id.toLowerCase() === poolId.toLowerCase())
if (poolData?.seniorYield30Days && poolData?.juniorYield30Days) {
return {
dropYield: toPrecision(baseToDisplay(poolData.seniorYield30Days.muln(100), 27), 2),
Expand Down
2 changes: 1 addition & 1 deletion tinlake-ui/utils/useEpoch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function useEpoch(poolId?: string) {
const query = useQuery(
['epoch', poolId, address],
() => {
const pool = ipfsPools.active.find((p) => p.addresses.ROOT_CONTRACT === poolId)
const pool = ipfsPools.active.find((p) => p.addresses.ROOT_CONTRACT.toLowerCase() === poolId!.toLowerCase())
const tinlake = initTinlake({ addresses: pool?.addresses, contractConfig: pool?.contractConfig })
return getEpoch(tinlake, address!)
},
Expand Down
2 changes: 1 addition & 1 deletion tinlake-ui/utils/usePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function usePool(poolId?: string) {
}

async function getPool(ipfsPools: IpfsPools, poolId: string, address?: string | null) {
const pool = ipfsPools.active.find((p) => p.addresses.ROOT_CONTRACT === poolId)
const pool = ipfsPools.active.find((p) => p.addresses.ROOT_CONTRACT.toLowerCase() === poolId.toLowerCase())

if (!pool) throw new Error(`Pool not found: ${poolId}`)

Expand Down

0 comments on commit db94d7a

Please sign in to comment.