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

x/gamm: Make a PoolType() query, that returns a string type name #2739

Closed
ValarDragon opened this issue Sep 14, 2022 · 1 comment · Fixed by #2832
Closed

x/gamm: Make a PoolType() query, that returns a string type name #2739

ValarDragon opened this issue Sep 14, 2022 · 1 comment · Fixed by #2832
Assignees

Comments

@ValarDragon
Copy link
Member

Background & suggested design

We should make a PoolType() query, so users & contracts can easily know the type of a pool, between Balancer and Stableswap pools. This can be done via the pool query, but thats intended for clients as a fallback if they need the raw representation. We don't want that to be the stable API people are depending upon, and hence don't want that to be contract-accessible.

@pysel
Copy link
Member

pysel commented Sep 16, 2022

I think it would be good to add a method to PoolI interface for example .Type() so we won't need to use typecasting to access type

_, ok := pool.(*balancer.Pool)
if ok {
      return &types.QueryPoolTypeResponse{Type: "Balancer"}, nil
} 
return &types.QueryPoolTypeResponse{Type: "Stableswap"}, nil

@mattverse mattverse self-assigned this Sep 22, 2022
@mergify mergify bot closed this as completed in #2832 Sep 26, 2022
mergify bot pushed a commit that referenced this issue Sep 26, 2022
Closes: #2739 

## What is the purpose of the change

Adds pool type query to query the type of pool. The query would return a string of the type of pool in a string, depending on the type of pool, would return an error otherwise.


## Brief Changelog
- Add pool type query 


## Testing and Verifying
Added new test cases 
## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? yes 
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`?yes
  - How is the feature or change documented? (not applicable   /   specification (`x/<module>/spec/`)  /  [Osmosis docs repo](https://github.com/osmosis-labs/docs)   /   not documented)
Repository owner moved this from Needs Review 🔍 to Done ✅ in Osmosis Chain Development Sep 26, 2022
mergify bot pushed a commit that referenced this issue Sep 26, 2022
Closes: #2739

## What is the purpose of the change

Adds pool type query to query the type of pool. The query would return a string of the type of pool in a string, depending on the type of pool, would return an error otherwise.

## Brief Changelog
- Add pool type query

## Testing and Verifying
Added new test cases
## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? yes
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`?yes
  - How is the feature or change documented? (not applicable   /   specification (`x/<module>/spec/`)  /  [Osmosis docs repo](https://github.com/osmosis-labs/docs)   /   not documented)

(cherry picked from commit ae6a366)

# Conflicts:
#	CHANGELOG.md
pysel pushed a commit to pysel/osmosis that referenced this issue Sep 28, 2022
Closes: osmosis-labs#2739 

## What is the purpose of the change

Adds pool type query to query the type of pool. The query would return a string of the type of pool in a string, depending on the type of pool, would return an error otherwise.


## Brief Changelog
- Add pool type query 


## Testing and Verifying
Added new test cases 
## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? yes 
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`?yes
  - How is the feature or change documented? (not applicable   /   specification (`x/<module>/spec/`)  /  [Osmosis docs repo](https://github.com/osmosis-labs/docs)   /   not documented)
mattverse added a commit that referenced this issue Sep 30, 2022
* Add Pool Type Query (#2832)

Closes: #2739

## What is the purpose of the change

Adds pool type query to query the type of pool. The query would return a string of the type of pool in a string, depending on the type of pool, would return an error otherwise.

## Brief Changelog
- Add pool type query

## Testing and Verifying
Added new test cases
## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? yes
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`?yes
  - How is the feature or change documented? (not applicable   /   specification (`x/<module>/spec/`)  /  [Osmosis docs repo](https://github.com/osmosis-labs/docs)   /   not documented)

(cherry picked from commit ae6a366)

# Conflicts:
#	CHANGELOG.md

* fix merge conflict

Co-authored-by: Matt, Park <[email protected]>
Co-authored-by: mattverse <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants