File tree 1 file changed +14
-4
lines changed
src/implementations/osmosis
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -20,17 +20,27 @@ pub fn osmosis_calculate_join_pool_shares(
20
20
21
21
// Validate that sent assets are in the pool
22
22
// TODO: Need to check if there are duplicates in the assets list?
23
+ let mut valid: bool = false ;
23
24
assets
24
25
. iter ( )
25
26
. map ( |a| {
26
- if pool_state. assets . contains ( a) {
27
- Ok ( ( ) )
28
- } else {
29
- Err ( StdError :: generic_err ( format ! ( "Asset {} is not in the pool {}" , a, pool_id) ) )
27
+ for asset in & pool_state. assets {
28
+ if asset. denom == a. denom {
29
+ valid = true ;
30
+ return Ok ( ( ) ) ;
31
+ }
30
32
}
33
+ Ok ( ( ) )
31
34
} )
32
35
. collect :: < StdResult < Vec < _ > > > ( ) ?;
33
36
37
+ if valid == false {
38
+ return Err ( StdError :: generic_err ( format ! (
39
+ "Assets {:?} are not in the pool {}, expected: {:?}" ,
40
+ assets, pool_id, pool_state. assets
41
+ ) ) ) ;
42
+ }
43
+
34
44
if assets. len ( ) == 2 {
35
45
let shares_out_amount = calc_join_pool_shares_double_sided (
36
46
assets,
You can’t perform that action at this time.
0 commit comments