Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CentrifugeJS: Change Price decimals #1567

Merged
merged 3 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion centrifuge-app/src/utils/tinlake/useTinlakePools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ async function getPools(pools: IpfsPools): Promise<{ pools: TinlakePool[] }> {
const toCurrencyBalance = (val: BigNumber) => new CurrencyBalance(val.toString(), 18)
const toTokenBalance = (val: BigNumber) => new TokenBalance(val.toString(), 18)
const toRate = (val: BigNumber) => new Rate(val.toString())
const toPrice = (val: BigNumber) => new Price(val.toString())
const toPrice = (val: BigNumber) => new Rate(val.toString())

const calls: Call[] = []
pools.active.forEach((pool) => {
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-js/src/modules/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { CurrencyBalance, Perquintill, Price, Rate, TokenBalance } from '../util
import { Dec } from '../utils/Decimal'

const PerquintillBN = new BN(10).pow(new BN(18))
const PriceBN = new BN(10).pow(new BN(27))
const PriceBN = new BN(10).pow(new BN(18))
const MaxU128 = '340282366920938463463374607431768211455'
const SEC_PER_DAY = 24 * 60 * 60

Expand Down
2 changes: 1 addition & 1 deletion centrifuge-js/src/utils/BN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class TokenBalance extends CurrencyBalance {
}

export class Price extends BNSubType {
static decimals = 27
static decimals = 18
static fromFloat(number: Numeric) {
return Price._fromFloat<Price>(number)
}
Expand Down