Skip to content

Commit

Permalink
dex: add max_positions_per_pair to params
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Apr 4, 2024
1 parent 92749dd commit 21fa91b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/core/app/src/params/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ impl AppParameters {
new.check_valid()?;
// TODO: move the checks below into their respective components.
// Tracked by #3593

let AppParameters {
chain_id,
community_pool_params:
Expand Down Expand Up @@ -75,6 +74,7 @@ impl AppParameters {
is_enabled: _,
fixed_candidates: _,
max_hops: _,
max_positions_per_pair: _,
},
// IMPORTANT: Don't use `..` here! We want to ensure every single field is verified!
} = self;
Expand Down Expand Up @@ -169,6 +169,7 @@ impl AppParameters {
is_enabled: _,
fixed_candidates: _,
max_hops: _,
max_positions_per_pair: _,
},
// IMPORTANT: Don't use `..` here! We want to ensure every single field is verified!
} = self;
Expand Down Expand Up @@ -244,6 +245,7 @@ impl AppParameters {
*min_validator_stake >= 1_000_000u128.into(),
"the minimum validator stake must be at least 1penumbra",
),
// TODO(erwan): add a `max_positions_per_pair` check
])
}

Expand Down
5 changes: 5 additions & 0 deletions crates/core/component/dex/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct DexParameters {
pub is_enabled: bool,
pub fixed_candidates: Vec<asset::Id>,
pub max_hops: u32,
pub max_positions_per_pair: u32,
}

impl DomainType for DexParameters {
Expand All @@ -28,6 +29,7 @@ impl TryFrom<pb::DexParameters> for DexParameters {
.map(|id| id.try_into())
.collect::<Result<_, _>>()?,
max_hops: msg.max_hops,
max_positions_per_pair: msg.max_positions_per_pair,
})
}
}
Expand All @@ -42,6 +44,7 @@ impl From<DexParameters> for pb::DexParameters {
.map(Into::into)
.collect(),
max_hops: params.max_hops,
max_positions_per_pair: params.max_positions_per_pair,
}
}
}
Expand All @@ -63,6 +66,8 @@ impl Default for DexParameters {
cache.get_unit("test_btc").unwrap().id(),
],
max_hops: 4,
// TODO(erwan): setting this to 10 for testing.
max_positions_per_pair: 10,
}
}
}

0 comments on commit 21fa91b

Please sign in to comment.