From 4e4bbc1120b434bba7100334d2298fe8808cb3bb Mon Sep 17 00:00:00 2001 From: mihaisc Date: Fri, 9 Apr 2021 16:59:20 +0300 Subject: [PATCH 1/2] limit price precision to 18 (#492) Signed-off-by: mihaisc --- package-lock.json | 2 +- src/hooks/usePricing.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 14624660c..68d41941f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16410,7 +16410,7 @@ } }, "ethereumjs-abi": { - "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1a27c59c15ab1e95ee8e5c4ed6ad814c49cc439e", + "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1ce6a1d64235fabe2aaf827fd606def55693508f", "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", "requires": { "bn.js": "^4.11.8", diff --git a/src/hooks/usePricing.ts b/src/hooks/usePricing.ts index 436fc6ba3..59746a316 100644 --- a/src/hooks/usePricing.ts +++ b/src/hooks/usePricing.ts @@ -129,12 +129,20 @@ function usePricing(ddo: DDO): UsePricing { setStep(1, 'buy') Logger.log('Price found for buying', price) + Decimal.set({ precision: 18 }) + switch (price?.type) { case 'pool': { const oceanAmmount = new Decimal(price.value).times(1.05).toString() const maxPrice = new Decimal(price.value).times(2).toString() setStep(2, 'buy') - Logger.log('Buying token from pool', price, accountId, price) + Logger.log( + 'Buying token from pool', + price, + accountId, + oceanAmmount, + maxPrice + ) tx = await ocean.pool.buyDT( accountId, price.address, @@ -190,6 +198,7 @@ function usePricing(ddo: DDO): UsePricing { ): Promise { if (!ocean || !accountId) return + Decimal.set({ precision: 18 }) if (!config.oceanTokenAddress) { Logger.error(`'oceanTokenAddress' not set in config`) return From ab71ba187ffa7eb5f451ce414165d8ec86ae2a87 Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Sat, 10 Apr 2021 12:34:08 +0300 Subject: [PATCH 2/2] remove status and text status check on start job (#489) --- src/components/organisms/AssetActions/Compute/index.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/organisms/AssetActions/Compute/index.tsx b/src/components/organisms/AssetActions/Compute/index.tsx index 83a442ed3..e849e8b4c 100644 --- a/src/components/organisms/AssetActions/Compute/index.tsx +++ b/src/components/organisms/AssetActions/Compute/index.tsx @@ -395,11 +395,7 @@ export default function Compute({ selectedAlgorithmAsset.dataToken ) - if ( - !response || - response.status !== 10 || - response.statusText !== 'Job started' - ) { + if (!response) { setError('Error starting compute job.') return }