mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
default amountToUnits decimals to 18, FRE consumerMarketSwapFee witho… (#1374)
* default amountToUnits decimals to 18, FRE consumerMarketSwapFee without basetoken * Revert "default amountToUnits decimals to 18, FRE consumerMarketSwapFee without basetoken" This reverts commit 14ef599738a85d82f1268ed77a338b4ba1b9f668. * FRE, web3 toWei for percentage based value Co-authored-by: Soon Huat <soon_huat.phan@daimler.com>
This commit is contained in:
parent
4c5da01d66
commit
9106a78646
@ -156,7 +156,7 @@ export class FixedRateExchange {
|
||||
* @param {String} maxBaseTokenAmount max amount of baseToken we want to pay for datatokenAmount
|
||||
* @param {String} address User address
|
||||
* @param {String} consumeMarketAddress consumeMarketAddress
|
||||
* @param {String} consumeMarketFee consumeMarketFee
|
||||
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
||||
* @return {Promise<TransactionReceipt>} transaction receipt
|
||||
*/
|
||||
public async buyDT(
|
||||
@ -168,10 +168,7 @@ export class FixedRateExchange {
|
||||
consumeMarketFee: string = '0'
|
||||
): Promise<TransactionReceipt> {
|
||||
const exchange = await this.getExchange(exchangeId)
|
||||
const consumeMarketFeeFormatted = await this.amountToUnits(
|
||||
exchange.baseToken,
|
||||
consumeMarketFee
|
||||
)
|
||||
const consumeMarketFeeFormatted = this.web3.utils.toWei(consumeMarketFee)
|
||||
const dtAmountFormatted = await this.amountToUnits(
|
||||
exchange.datatoken,
|
||||
datatokenAmount
|
||||
@ -255,7 +252,7 @@ export class FixedRateExchange {
|
||||
* @param {String} minBaseTokenAmount min amount of baseToken we want to receive back
|
||||
* @param {String} address User address
|
||||
* @param {String} consumeMarketAddress consumeMarketAddress
|
||||
* @param {String} consumeMarketFee consumeMarketFee
|
||||
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
||||
* @return {Promise<TransactionReceipt>} transaction receipt
|
||||
*/
|
||||
public async sellDT(
|
||||
@ -267,10 +264,7 @@ export class FixedRateExchange {
|
||||
consumeMarketFee: string = '0'
|
||||
): Promise<TransactionReceipt> {
|
||||
const exchange = await this.getExchange(exchangeId)
|
||||
const consumeMarketFeeFormatted = await this.amountToUnits(
|
||||
exchange.baseToken,
|
||||
consumeMarketFee
|
||||
)
|
||||
const consumeMarketFeeFormatted = this.web3.utils.toWei(consumeMarketFee)
|
||||
const dtAmountFormatted = await this.amountToUnits(
|
||||
exchange.datatoken,
|
||||
datatokenAmount
|
||||
@ -571,7 +565,7 @@ export class FixedRateExchange {
|
||||
* calcBaseInGivenOutDT - Calculates how many base tokens are needed to get specified amount of datatokens
|
||||
* @param {String} exchangeId ExchangeId
|
||||
* @param {string} datatokenAmount Amount of datatokens user wants to buy
|
||||
* @param {String} consumeMarketFee consumeMarketFee
|
||||
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
||||
* @return {Promise<PriceAndFees>} how many base tokens are needed and fees
|
||||
*/
|
||||
public async calcBaseInGivenOutDT(
|
||||
@ -584,7 +578,7 @@ export class FixedRateExchange {
|
||||
.calcBaseInGivenOutDT(
|
||||
exchangeId,
|
||||
await this.amountToUnits(fixedRateExchange.datatoken, datatokenAmount),
|
||||
await this.amountToUnits(fixedRateExchange.baseToken, consumeMarketFee)
|
||||
this.web3.utils.toWei(consumeMarketFee)
|
||||
)
|
||||
.call()
|
||||
|
||||
@ -613,7 +607,7 @@ export class FixedRateExchange {
|
||||
* getBTOut - returns amount in baseToken that user will receive for datatokenAmount sold
|
||||
* @param {String} exchangeId ExchangeId
|
||||
* @param {Number} datatokenAmount Amount of datatokens
|
||||
* @param {String} consumeMarketFee consumeMarketFee
|
||||
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
||||
* @return {Promise<string>} Amount of baseTokens user will receive
|
||||
*/
|
||||
public async getAmountBTOut(
|
||||
@ -626,7 +620,7 @@ export class FixedRateExchange {
|
||||
.calcBaseOutGivenInDT(
|
||||
exchangeId,
|
||||
await this.amountToUnits(exchange.datatoken, datatokenAmount),
|
||||
await this.amountToUnits(exchange.baseToken, consumeMarketFee)
|
||||
this.web3.utils.toWei(consumeMarketFee)
|
||||
)
|
||||
.call()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user