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} maxBaseTokenAmount max amount of baseToken we want to pay for datatokenAmount
|
||||||
* @param {String} address User address
|
* @param {String} address User address
|
||||||
* @param {String} consumeMarketAddress consumeMarketAddress
|
* @param {String} consumeMarketAddress consumeMarketAddress
|
||||||
* @param {String} consumeMarketFee consumeMarketFee
|
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
||||||
* @return {Promise<TransactionReceipt>} transaction receipt
|
* @return {Promise<TransactionReceipt>} transaction receipt
|
||||||
*/
|
*/
|
||||||
public async buyDT(
|
public async buyDT(
|
||||||
@ -168,10 +168,7 @@ export class FixedRateExchange {
|
|||||||
consumeMarketFee: string = '0'
|
consumeMarketFee: string = '0'
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
const exchange = await this.getExchange(exchangeId)
|
const exchange = await this.getExchange(exchangeId)
|
||||||
const consumeMarketFeeFormatted = await this.amountToUnits(
|
const consumeMarketFeeFormatted = this.web3.utils.toWei(consumeMarketFee)
|
||||||
exchange.baseToken,
|
|
||||||
consumeMarketFee
|
|
||||||
)
|
|
||||||
const dtAmountFormatted = await this.amountToUnits(
|
const dtAmountFormatted = await this.amountToUnits(
|
||||||
exchange.datatoken,
|
exchange.datatoken,
|
||||||
datatokenAmount
|
datatokenAmount
|
||||||
@ -255,7 +252,7 @@ export class FixedRateExchange {
|
|||||||
* @param {String} minBaseTokenAmount min amount of baseToken we want to receive back
|
* @param {String} minBaseTokenAmount min amount of baseToken we want to receive back
|
||||||
* @param {String} address User address
|
* @param {String} address User address
|
||||||
* @param {String} consumeMarketAddress consumeMarketAddress
|
* @param {String} consumeMarketAddress consumeMarketAddress
|
||||||
* @param {String} consumeMarketFee consumeMarketFee
|
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
||||||
* @return {Promise<TransactionReceipt>} transaction receipt
|
* @return {Promise<TransactionReceipt>} transaction receipt
|
||||||
*/
|
*/
|
||||||
public async sellDT(
|
public async sellDT(
|
||||||
@ -267,10 +264,7 @@ export class FixedRateExchange {
|
|||||||
consumeMarketFee: string = '0'
|
consumeMarketFee: string = '0'
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
const exchange = await this.getExchange(exchangeId)
|
const exchange = await this.getExchange(exchangeId)
|
||||||
const consumeMarketFeeFormatted = await this.amountToUnits(
|
const consumeMarketFeeFormatted = this.web3.utils.toWei(consumeMarketFee)
|
||||||
exchange.baseToken,
|
|
||||||
consumeMarketFee
|
|
||||||
)
|
|
||||||
const dtAmountFormatted = await this.amountToUnits(
|
const dtAmountFormatted = await this.amountToUnits(
|
||||||
exchange.datatoken,
|
exchange.datatoken,
|
||||||
datatokenAmount
|
datatokenAmount
|
||||||
@ -571,7 +565,7 @@ export class FixedRateExchange {
|
|||||||
* calcBaseInGivenOutDT - Calculates how many base tokens are needed to get specified amount of datatokens
|
* calcBaseInGivenOutDT - Calculates how many base tokens are needed to get specified amount of datatokens
|
||||||
* @param {String} exchangeId ExchangeId
|
* @param {String} exchangeId ExchangeId
|
||||||
* @param {string} datatokenAmount Amount of datatokens user wants to buy
|
* @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
|
* @return {Promise<PriceAndFees>} how many base tokens are needed and fees
|
||||||
*/
|
*/
|
||||||
public async calcBaseInGivenOutDT(
|
public async calcBaseInGivenOutDT(
|
||||||
@ -584,7 +578,7 @@ export class FixedRateExchange {
|
|||||||
.calcBaseInGivenOutDT(
|
.calcBaseInGivenOutDT(
|
||||||
exchangeId,
|
exchangeId,
|
||||||
await this.amountToUnits(fixedRateExchange.datatoken, datatokenAmount),
|
await this.amountToUnits(fixedRateExchange.datatoken, datatokenAmount),
|
||||||
await this.amountToUnits(fixedRateExchange.baseToken, consumeMarketFee)
|
this.web3.utils.toWei(consumeMarketFee)
|
||||||
)
|
)
|
||||||
.call()
|
.call()
|
||||||
|
|
||||||
@ -613,7 +607,7 @@ export class FixedRateExchange {
|
|||||||
* getBTOut - returns amount in baseToken that user will receive for datatokenAmount sold
|
* getBTOut - returns amount in baseToken that user will receive for datatokenAmount sold
|
||||||
* @param {String} exchangeId ExchangeId
|
* @param {String} exchangeId ExchangeId
|
||||||
* @param {Number} datatokenAmount Amount of datatokens
|
* @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
|
* @return {Promise<string>} Amount of baseTokens user will receive
|
||||||
*/
|
*/
|
||||||
public async getAmountBTOut(
|
public async getAmountBTOut(
|
||||||
@ -626,7 +620,7 @@ export class FixedRateExchange {
|
|||||||
.calcBaseOutGivenInDT(
|
.calcBaseOutGivenInDT(
|
||||||
exchangeId,
|
exchangeId,
|
||||||
await this.amountToUnits(exchange.datatoken, datatokenAmount),
|
await this.amountToUnits(exchange.datatoken, datatokenAmount),
|
||||||
await this.amountToUnits(exchange.baseToken, consumeMarketFee)
|
this.web3.utils.toWei(consumeMarketFee)
|
||||||
)
|
)
|
||||||
.call()
|
.call()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user