Skip to content

Commit

Permalink
fix atomic resolution calculation
Browse files Browse the repository at this point in the history
Signed-off-by: Shrenuj Bansal <[email protected]>
  • Loading branch information
shrenujb committed Sep 25, 2024
1 parent 9aa85a3 commit f976558
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/protocol-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Protocol Build & Push Image to AWS ECR
on: # yamllint disable-line rule:truthy
push:
branches:
- tra617
- main
- 'release/protocol/v[0-9]+.[0-9]+.x' # e.g. release/protocol/v0.1.x
- 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x
Expand Down
5 changes: 4 additions & 1 deletion protocol/x/listing/keeper/listing.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ func (k Keeper) CreatePerpetual(
}

// calculate atomic resolution from reference price
atomicResolution := types.ResolutionOffset - int32(math.Floor(math.Log10(float64(metadata.ReferencePrice))))
// atomic resolution = -6 - (log10(referencePrice) - decimals)
atomicResolution := types.ResolutionOffset -
(int32(math.Floor(math.Log10(float64(metadata.ReferencePrice)))) -
int32(marketMapDetails.Ticker.Decimals))

// Create a new perpetual
perpetual, err := k.PerpetualsKeeper.CreatePerpetual(
Expand Down

0 comments on commit f976558

Please sign in to comment.