1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 09:44:53 +01:00

Merge pull request #95 from oceanprotocol/fix/swapfee

swapFee calculation fix
This commit is contained in:
Matthias Kretschmann 2020-10-05 22:36:14 +02:00 committed by GitHub
commit 1d55b01398
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -96,9 +96,10 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
setUserBalance(userBalance) setUserBalance(userBalance)
// Get liquidity provider fee // Get swap fee
// swapFee is tricky: to get 0.1% you need to convert from 0.001
const swapFee = await ocean.pool.getSwapFee(price.address) const swapFee = await ocean.pool.getSwapFee(price.address)
setSwapFee(swapFee) setSwapFee(`${Number(swapFee) * 100}`)
} catch (error) { } catch (error) {
console.error(error.message) console.error(error.message)
} finally { } finally {

View File

@ -44,7 +44,8 @@ export default function PublishPage({
const ddo = await publish( const ddo = await publish(
(metadata as unknown) as Metadata, (metadata as unknown) as Metadata,
{ ...price, swapFee: `${price.swapFee}` }, // swapFee is tricky: to get 0.1% you need to send 0.001 as value
{ ...price, swapFee: `${price.swapFee / 100}` },
serviceType, serviceType,
price.datatoken price.datatoken
) )