mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
fail safe against empty creator liquidity, just read out weights
This commit is contained in:
parent
8996722fcb
commit
c6011d29ef
@ -175,22 +175,23 @@ export default function Pool(): ReactElement {
|
||||
setSwapFee(swapFee)
|
||||
|
||||
// Get weights
|
||||
function getWeight(weight: string) {
|
||||
return isValidNumber(weight)
|
||||
? new Decimal(weight).mul(10).toString()
|
||||
: '0'
|
||||
}
|
||||
const weightDt = dataLiquidity.pool.datatokenWeight
|
||||
const weightDtDecimal = isValidNumber(weightDt)
|
||||
? new Decimal(weightDt).mul(10).toString()
|
||||
: '0'
|
||||
const weightDtDecimal = getWeight(weightDt)
|
||||
setWeightDt(weightDtDecimal)
|
||||
|
||||
const weightOceanDecimal = isValidNumber(weightDt)
|
||||
? new Decimal(100).minus(new Decimal(weightDt).mul(10)).toString()
|
||||
: '0'
|
||||
const weightOcean = dataLiquidity.pool.baseTokenWeight
|
||||
const weightOceanDecimal = getWeight(weightOcean)
|
||||
setWeightOcean(weightOceanDecimal)
|
||||
|
||||
//
|
||||
// Get everything the creator put into the pool
|
||||
//
|
||||
|
||||
const creatorPoolTokens = dataLiquidity.pool.shares[0].shares
|
||||
const creatorPoolTokens = dataLiquidity.pool.shares[0]?.shares
|
||||
setCreatorPoolTokens(creatorPoolTokens)
|
||||
|
||||
const creatorOceanBalance =
|
||||
|
Loading…
Reference in New Issue
Block a user