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

feat: add SdkDecEncoder #1

Merged
merged 1 commit into from
Nov 26, 2022
Merged

Conversation

NibiruHeisenberg
Copy link
Contributor

Adds a SdkDecEncoder that allows one to use sdk.Dec objects as keys in the Collections API.

An example of storing objects keyed by sdk.Dec is when ordering Perp Positions by liquidation price. Liquidation price is given as an sdk.Dec and this allows us to build an ordered map of Perp Positions sorted by liquidation price ascending or descending.

@NibiruHeisenberg NibiruHeisenberg self-assigned this Nov 26, 2022
@NibiruHeisenberg NibiruHeisenberg added the enhancement New feature or request label Nov 26, 2022
@NibiruHeisenberg NibiruHeisenberg enabled auto-merge (squash) November 26, 2022 03:21
if err != nil {
panic(fmt.Errorf("invalid DecKey: %w", err))
}
fmt.Println("sdkDecKeyEncoder.Encode", string(bz))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) remove print

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this needs to go.

@NibiruHeisenberg NibiruHeisenberg merged commit f7599f9 into main Nov 26, 2022
@NibiruHeisenberg NibiruHeisenberg deleted the feat/sdk-dec-key-encoder branch November 26, 2022 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants