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

fix(restrictions): remove wallet-only restriction from max_maker_vol #2153

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions mm2src/mm2_main/src/lp_swap/max_maker_vol_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ pub enum MaxMakerVolRpcError {
},
#[display(fmt = "No such coin {}", coin)]
NoSuchCoin { coin: String },
#[display(fmt = "Coin {} is wallet only", coin)]
CoinIsWalletOnly { coin: String },
#[display(fmt = "Transport error: {}", _0)]
Transport(String),
#[display(fmt = "Internal error: {}", _0)]
Expand Down Expand Up @@ -111,11 +109,10 @@ impl From<CheckBalanceError> for MaxMakerVolRpcError {
impl HttpStatusCode for MaxMakerVolRpcError {
fn status_code(&self) -> StatusCode {
match self {
MaxMakerVolRpcError::NoSuchCoin { .. } => StatusCode::NOT_FOUND,
MaxMakerVolRpcError::NotSufficientBalance { .. }
| MaxMakerVolRpcError::NotSufficientBaseCoinBalance { .. }
| MaxMakerVolRpcError::VolumeTooLow { .. }
| MaxMakerVolRpcError::NoSuchCoin { .. }
| MaxMakerVolRpcError::CoinIsWalletOnly { .. } => StatusCode::BAD_REQUEST,
| MaxMakerVolRpcError::VolumeTooLow { .. } => StatusCode::BAD_REQUEST,
MaxMakerVolRpcError::Transport(_) | MaxMakerVolRpcError::InternalError(_) => {
StatusCode::INTERNAL_SERVER_ERROR
},
Expand All @@ -138,14 +135,12 @@ pub struct MaxMakerVolResponse {

pub async fn max_maker_vol(ctx: MmArc, req: MaxMakerVolRequest) -> MmResult<MaxMakerVolResponse, MaxMakerVolRpcError> {
let coin = lp_coinfind_or_err(&ctx, &req.coin).await?;
if coin.wallet_only(&ctx) {
return MmError::err(MaxMakerVolRpcError::CoinIsWalletOnly { coin: req.coin });
}
let CoinVolumeInfo {
volume,
balance,
locked_by_swaps,
} = get_max_maker_vol(&ctx, &coin).await?;

Ok(MaxMakerVolResponse {
coin: req.coin,
volume: MmNumberMultiRepr::from(volume),
Expand Down
Loading