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

fix fixed rate

This commit is contained in:
Bogdan Fazakas 2022-04-28 10:59:54 +03:00
parent 290e339fb1
commit 787588f20b
2 changed files with 3 additions and 5 deletions

2
package-lock.json generated
View File

@ -21590,7 +21590,6 @@
"cross-fetch": "^3.1.5",
"crypto-js": "^4.1.1",
"decimal.js": "^10.3.1",
"web3": "^1.7.3",
"web3-core": "^1.7.1",
"web3-eth-contract": "^1.7.1"
}
@ -21693,7 +21692,6 @@
"integrity": "sha512-5vwpq6kbvwkQwKqAoOU3L72GZ3Ta8RRrewKj9OJRolx28KLJJ8Dg9Rf7obRwt5jQA9bkYd8gqzMTrI7H3xLfaw==",
"dev": true,
"requires": {
"@oclif/config": "^1.15.1",
"@oclif/errors": "^1.3.3",
"@oclif/parser": "^3.8.3",
"@oclif/plugin-help": "^3",

View File

@ -2,7 +2,8 @@ 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 { consumeMarketPoolSwapFee } from '../../app.config'
import { getDummyWeb3 } from './web3'
/**
@ -25,13 +26,12 @@ 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',
appConfig.consumeMarketPoolSwapFee
consumeMarketPoolSwapFee
)
return estimatedPrice
}