Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Sep 30, 2022
1 parent f0dd78a commit 9ecd8e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Misc Improvements

* [#2804](https://github.com/osmosis-labs/osmosis/pull/2804) Improve error handling and messages when parsing pool assets.

## v12.0.0

This release includes several cosmwasm-developer and appchain-ecosystem affecting upgrades:
Expand Down
13 changes: 10 additions & 3 deletions x/gamm/pool-models/balancer/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,12 @@ func (p Pool) parsePoolAssetsByDenoms(tokenADenom, tokenBDenom string) (
) {
Aasset, found1 := getPoolAssetByDenom(p.PoolAssets, tokenADenom)
Basset, found2 := getPoolAssetByDenom(p.PoolAssets, tokenBDenom)
if !(found1 && found2) {
return Aasset, Basset, errors.New("one of the provided pool denoms does not exist in pool")

if !found1 {
return PoolAsset{}, PoolAsset{}, fmt.Errorf("(%s) does not exist in the pool", tokenADenom)
}
if !found2 {
return PoolAsset{}, PoolAsset{}, fmt.Errorf("(%s) does not exist in the pool", tokenBDenom)
}
return Aasset, Basset, nil
}
Expand All @@ -261,7 +265,10 @@ func (p Pool) parsePoolAssets(tokensA sdk.Coins, tokenBDenom string) (
return tokenA, Aasset, Basset, errors.New("expected tokensB to be of length one")
}
Aasset, Basset, err = p.parsePoolAssetsByDenoms(tokensA[0].Denom, tokenBDenom)
return tokensA[0], Aasset, Basset, err
if err != nil {
return sdk.Coin{}, PoolAsset{}, PoolAsset{}, err
}
return tokensA[0], Aasset, Basset, nil
}

func (p Pool) parsePoolAssetsCoins(tokensA sdk.Coins, tokensB sdk.Coins) (
Expand Down

0 comments on commit 9ecd8e0

Please sign in to comment.