diff --git a/src/components/organisms/AssetActions/Pool/Add.tsx b/src/components/organisms/AssetActions/Pool/Add.tsx index 6f7d01117..27854e115 100644 --- a/src/components/organisms/AssetActions/Pool/Add.tsx +++ b/src/components/organisms/AssetActions/Pool/Add.tsx @@ -43,6 +43,7 @@ export default function Add({ poolAddress, amount ) + // TODO: Figure out the result structure, thenreplace `any` return in lib-js console.log(result) } catch (error) { console.error(error.message) diff --git a/src/components/organisms/AssetActions/Pool/Remove.tsx b/src/components/organisms/AssetActions/Pool/Remove.tsx index f656f6596..4d58834f9 100644 --- a/src/components/organisms/AssetActions/Pool/Remove.tsx +++ b/src/components/organisms/AssetActions/Pool/Remove.tsx @@ -31,6 +31,7 @@ export default function Remove({ amount, maximumPoolShares ) + // TODO: Figure out the result structure, thenreplace `any` return in lib-js console.log(result) } catch (error) { console.error(error.message) diff --git a/src/components/organisms/AssetActions/Pool/index.tsx b/src/components/organisms/AssetActions/Pool/index.tsx index 708a5b2f5..77d29c3dd 100644 --- a/src/components/organisms/AssetActions/Pool/index.tsx +++ b/src/components/organisms/AssetActions/Pool/index.tsx @@ -17,6 +17,12 @@ export interface Balance { dt: string } +/* + TODO: figure out correct userBalance + TODO: create tooltip copy + TODO: figure out what to do with BPT +*/ + export default function Pool({ ddo }: { ddo: DDO }): ReactElement { const { ocean, accountId } = useOcean() const { price, poolAddress } = useMetadata(ddo) @@ -46,12 +52,18 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { setIsLoading(true) try { + // + // Get data token symbol + // const dtSymbol = await ocean.datatokens.getSymbol( ddo.dataToken, accountId ) setDtSymbol(dtSymbol) + // + // Get everything which is in the pool + // const oceanReserve = await ocean.pool.getOceanReserve( accountId, poolAddress @@ -62,20 +74,23 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { dt: dtReserve }) + const totalPoolTokens = await ocean.pool.totalSupply(poolAddress) + setTotalPoolTokens(totalPoolTokens) + + // + // Get everything the user has put into the pool + // const poolTokens = await ocean.pool.sharesBalance( accountId, poolAddress ) setPoolTokens(poolTokens) - const totalPoolTokens = await ocean.pool.totalSupply(poolAddress) - setTotalPoolTokens(totalPoolTokens) + const userOceanBalance = + (Number(poolTokens) / Number(totalPoolTokens)) * Number(oceanReserve) const userBalance = { - ocean: `${ - (Number(poolTokens) / Number(totalPoolTokens)) * - Number(oceanReserve) - }`, + ocean: `${userOceanBalance}`, dt: '-' } @@ -122,7 +137,7 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {

- Your Liquidity{' '} + Your Liquidity