1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

remove percentage fee from price sum, depends smart contract calculation (#1249)

Co-authored-by: Soon Huat <soon_huat.phan@daimler.com>
This commit is contained in:
Soon Huat 2022-03-24 22:56:09 +08:00 committed by GitHub
parent c201688c4a
commit ba672e99ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -298,10 +298,6 @@ export async function getOrderPriceAndFees(
.add(new Decimal(+orderPriceAndFee?.consumeMarketOrderFee || 0))
.add(new Decimal(+orderPriceAndFee?.publisherMarketOrderFee || 0))
.add(new Decimal(+orderPriceAndFee?.providerFee?.providerFeeAmount || 0))
.add(new Decimal(+orderPriceAndFee?.publisherMarketPoolSwapFee || 0))
.add(new Decimal(+orderPriceAndFee?.publisherMarketFixedSwapFee || 0))
.add(new Decimal(+orderPriceAndFee?.consumeMarketPoolSwapFee || 0))
.add(new Decimal(+orderPriceAndFee?.consumeMarketFixedSwapFee || 0))
.toString()
return orderPriceAndFee
}

View File

@ -2,6 +2,7 @@ import { FixedRateExchange, PriceAndFees } from '@oceanprotocol/lib'
import { AccessDetails } from 'src/@types/Price'
import Web3 from 'web3'
import { getOceanConfig } from './ocean'
import { getSiteMetadata } from './siteConfig'
import { getDummyWeb3 } from './web3'
/**
@ -24,11 +25,13 @@ export async function getFixedBuyPrice(
}
const config = getOceanConfig(chainId)
const { appConfig } = getSiteMetadata()
const fixed = new FixedRateExchange(web3, config.fixedRateExchangeAddress)
const estimatedPrice = await fixed.calcBaseInGivenOutDT(
accessDetails.addressOrId,
'1'
'1',
appConfig.consumeMarketPoolSwapFee
)
return estimatedPrice
}