Skip to content

Commit

Permalink
feat: remove withdrawal minimums
Browse files Browse the repository at this point in the history
  • Loading branch information
AshtonStephens committed Dec 16, 2024
1 parent d837cf1 commit 7e3a129
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1728,13 +1728,6 @@
"description": "Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap.",
"nullable": true,
"minimum": 0
},
"perWithdrawalMinimum": {
"type": "integer",
"format": "int64",
"description": "Per withdrawal minimum. If none then there is no minimum.",
"nullable": true,
"minimum": 0
}
}
},
Expand Down Expand Up @@ -2208,13 +2201,6 @@
"description": "Per withdrawal cap. If none then there is no cap.",
"nullable": true,
"minimum": 0
},
"perWithdrawalMinimum": {
"type": "integer",
"format": "int64",
"description": "Per withdrawal minimum. If none then there is no minimum.",
"nullable": true,
"minimum": 0
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1528,13 +1528,6 @@
"description": "Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap.",
"nullable": true,
"minimum": 0
},
"perWithdrawalMinimum": {
"type": "integer",
"format": "int64",
"description": "Per withdrawal minimum. If none then there is no minimum.",
"nullable": true,
"minimum": 0
}
}
},
Expand Down Expand Up @@ -2008,13 +2001,6 @@
"description": "Per withdrawal cap. If none then there is no cap.",
"nullable": true,
"minimum": 0
},
"perWithdrawalMinimum": {
"type": "integer",
"format": "int64",
"description": "Per withdrawal minimum. If none then there is no minimum.",
"nullable": true,
"minimum": 0
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1782,13 +1782,6 @@
"description": "Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap.",
"nullable": true,
"minimum": 0
},
"perWithdrawalMinimum": {
"type": "integer",
"format": "int64",
"description": "Per withdrawal minimum. If none then there is no minimum.",
"nullable": true,
"minimum": 0
}
}
},
Expand Down Expand Up @@ -2262,13 +2255,6 @@
"description": "Per withdrawal cap. If none then there is no cap.",
"nullable": true,
"minimum": 0
},
"perWithdrawalMinimum": {
"type": "integer",
"format": "int64",
"description": "Per withdrawal minimum. If none then there is no minimum.",
"nullable": true,
"minimum": 0
}
}
},
Expand Down
1 change: 0 additions & 1 deletion emily/handler/src/api/handlers/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ pub async fn set_limits(context: EmilyContext, limits: Limits) -> impl warp::rep
peg_cap: limits.peg_cap,
per_deposit_minimum: limits.per_deposit_minimum,
per_deposit_cap: limits.per_deposit_cap,
per_withdrawal_minimum: limits.per_withdrawal_minimum,
per_withdrawal_cap: limits.per_withdrawal_cap,
},
),
Expand Down
4 changes: 0 additions & 4 deletions emily/handler/src/api/models/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ pub struct Limits {
pub per_deposit_minimum: Option<u64>,
/// Per deposit cap. If none then there is no cap.
pub per_deposit_cap: Option<u64>,
/// Per withdrawal minimum. If none then there is no minimum.
pub per_withdrawal_minimum: Option<u64>,
/// Per withdrawal cap. If none then there is no cap.
pub per_withdrawal_cap: Option<u64>,
/// Represents the individual limits for requests coming from different accounts.
Expand Down Expand Up @@ -46,8 +44,6 @@ pub struct AccountLimits {
pub per_deposit_minimum: Option<u64>,
/// Per deposit cap. If none then the cap is the same as the global per deposit cap.
pub per_deposit_cap: Option<u64>,
/// Per withdrawal minimum. If none then there is no minimum.
pub per_withdrawal_minimum: Option<u64>,
/// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap.
pub per_withdrawal_cap: Option<u64>,
}
4 changes: 0 additions & 4 deletions emily/handler/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ impl Settings {
.ok()
.map(|v| v.parse())
.transpose()?,
per_withdrawal_minimum: env::var("DEFAULT_PER_WITHDRAWAL_MINIMUM")
.ok()
.map(|v| v.parse())
.transpose()?,
per_withdrawal_cap: env::var("DEFAULT_PER_WITHDRAWAL_CAP")
.ok()
.map(|v| v.parse())
Expand Down
2 changes: 0 additions & 2 deletions emily/handler/src/database/accessors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ pub async fn get_limits(context: &EmilyContext) -> Result<Limits, Error> {
peg_cap: default_global_cap.peg_cap,
per_deposit_minimum: default_global_cap.per_deposit_minimum,
per_deposit_cap: default_global_cap.per_deposit_cap,
per_withdrawal_minimum: default_global_cap.per_withdrawal_minimum,
per_withdrawal_cap: default_global_cap.per_withdrawal_cap,
};
// Aggregate all the latest entries by account.
Expand Down Expand Up @@ -673,7 +672,6 @@ pub async fn get_limits(context: &EmilyContext) -> Result<Limits, Error> {
peg_cap: global_cap.peg_cap,
per_deposit_minimum: global_cap.per_deposit_minimum,
per_deposit_cap: global_cap.per_deposit_cap,
per_withdrawal_minimum: global_cap.per_withdrawal_minimum,
per_withdrawal_cap: global_cap.per_withdrawal_cap,
account_caps,
})
Expand Down
4 changes: 0 additions & 4 deletions emily/handler/src/database/entries/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ pub struct LimitEntry {
pub per_deposit_minimum: Option<u64>,
/// Per deposit cap. If none then the cap is the same as the global per deposit cap.
pub per_deposit_cap: Option<u64>,
/// Per withdrawal minimum. If none then there is no minimum.
pub per_withdrawal_minimum: Option<u64>,
/// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap.
pub per_withdrawal_cap: Option<u64>,
}
Expand All @@ -49,7 +47,6 @@ impl From<LimitEntry> for AccountLimits {
peg_cap: limit_entry.peg_cap,
per_deposit_minimum: limit_entry.per_deposit_minimum,
per_deposit_cap: limit_entry.per_deposit_cap,
per_withdrawal_minimum: limit_entry.per_withdrawal_minimum,
per_withdrawal_cap: limit_entry.per_withdrawal_cap,
}
}
Expand All @@ -74,7 +71,6 @@ impl LimitEntry {
peg_cap: account_limit.peg_cap,
per_deposit_minimum: account_limit.per_deposit_minimum,
per_deposit_cap: account_limit.per_deposit_cap,
per_withdrawal_minimum: account_limit.per_withdrawal_minimum,
per_withdrawal_cap: account_limit.per_withdrawal_cap,
}
}
Expand Down
20 changes: 0 additions & 20 deletions emily/handler/tests/integration/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ async fn empty_default_is_as_expected() {
peg_cap: Some(None),
per_deposit_minimum: Some(None),
per_deposit_cap: Some(None),
per_withdrawal_minimum: Some(None),
per_withdrawal_cap: Some(None),
account_caps: HashMap::new(),
};
Expand All @@ -42,7 +41,6 @@ async fn adding_and_then_updating_single_accout_limit_works() {
peg_cap: Some(Some(100)),
per_deposit_minimum: Some(Some(100)),
per_deposit_cap: Some(Some(100)),
per_withdrawal_minimum: Some(Some(100)),
per_withdrawal_cap: Some(Some(100)),
},
),
Expand All @@ -52,7 +50,6 @@ async fn adding_and_then_updating_single_accout_limit_works() {
peg_cap: Some(Some(1200)),
per_deposit_minimum: Some(Some(1200)),
per_deposit_cap: Some(Some(1200)),
per_withdrawal_minimum: Some(Some(1200)),
per_withdrawal_cap: Some(Some(1200)),
},
),
Expand All @@ -62,7 +59,6 @@ async fn adding_and_then_updating_single_accout_limit_works() {
peg_cap: Some(Some(100)),
per_deposit_minimum: Some(Some(200)),
per_deposit_cap: Some(Some(300)),
per_withdrawal_minimum: Some(Some(400)),
per_withdrawal_cap: Some(Some(500)),
},
),
Expand All @@ -72,7 +68,6 @@ async fn adding_and_then_updating_single_accout_limit_works() {
peg_cap: Some(Some(200)),
per_deposit_minimum: Some(Some(200)),
per_deposit_cap: Some(Some(200)),
per_withdrawal_minimum: Some(Some(200)),
per_withdrawal_cap: Some(Some(200)),
},
),
Expand All @@ -82,7 +77,6 @@ async fn adding_and_then_updating_single_accout_limit_works() {
peg_cap: Some(Some(300)),
per_deposit_minimum: Some(Some(300)),
per_deposit_cap: Some(Some(300)),
per_withdrawal_minimum: Some(Some(300)),
per_withdrawal_cap: Some(Some(300)),
},
),
Expand All @@ -97,7 +91,6 @@ async fn adding_and_then_updating_single_accout_limit_works() {
peg_cap: Some(Some(200)),
per_deposit_minimum: Some(Some(200)),
per_deposit_cap: Some(Some(200)),
per_withdrawal_minimum: Some(Some(200)),
per_withdrawal_cap: Some(Some(200)),
},
),
Expand All @@ -107,7 +100,6 @@ async fn adding_and_then_updating_single_accout_limit_works() {
peg_cap: Some(Some(300)),
per_deposit_minimum: Some(Some(300)),
per_deposit_cap: Some(Some(300)),
per_withdrawal_minimum: Some(Some(300)),
per_withdrawal_cap: Some(Some(300)),
},
),
Expand All @@ -121,7 +113,6 @@ async fn adding_and_then_updating_single_accout_limit_works() {
peg_cap: Some(None),
per_deposit_minimum: Some(None),
per_deposit_cap: Some(None),
per_withdrawal_minimum: Some(None),
per_withdrawal_cap: Some(None),
account_caps: expected_account_caps.clone(),
};
Expand Down Expand Up @@ -175,7 +166,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(Some(100)),
per_deposit_minimum: Some(Some(100)),
per_deposit_cap: Some(Some(100)),
per_withdrawal_minimum: Some(Some(100)),
per_withdrawal_cap: Some(Some(100)),
},
),
Expand All @@ -185,7 +175,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(Some(150)),
per_deposit_minimum: Some(Some(150)),
per_deposit_cap: Some(Some(150)),
per_withdrawal_minimum: Some(Some(150)),
per_withdrawal_cap: Some(Some(150)),
},
),
Expand All @@ -195,7 +184,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(Some(150)),
per_deposit_minimum: Some(Some(150)),
per_deposit_cap: Some(Some(150)),
per_withdrawal_minimum: Some(Some(150)),
per_withdrawal_cap: Some(Some(150)),
},
),
Expand All @@ -210,7 +198,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(Some(200)),
per_deposit_minimum: Some(Some(200)),
per_deposit_cap: Some(Some(200)),
per_withdrawal_minimum: Some(Some(200)),
per_withdrawal_cap: Some(Some(200)),
},
),
Expand All @@ -220,7 +207,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(Some(300)),
per_deposit_minimum: Some(Some(300)),
per_deposit_cap: Some(Some(300)),
per_withdrawal_minimum: Some(Some(300)),
per_withdrawal_cap: Some(Some(300)),
},
),
Expand All @@ -232,7 +218,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(None),
per_deposit_minimum: Some(None),
per_deposit_cap: Some(None),
per_withdrawal_minimum: Some(None),
per_withdrawal_cap: Some(None),
},
),
Expand All @@ -244,7 +229,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(Some(123)),
per_deposit_minimum: Some(Some(654)),
per_deposit_cap: Some(Some(456)),
per_withdrawal_minimum: Some(Some(987)),
per_withdrawal_cap: Some(Some(789)),
account_caps: account_limits_to_set_globally.clone(),
};
Expand All @@ -258,7 +242,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(Some(100)),
per_deposit_minimum: Some(Some(100)),
per_deposit_cap: Some(Some(100)),
per_withdrawal_minimum: Some(Some(100)),
per_withdrawal_cap: Some(Some(100)),
},
),
Expand All @@ -268,7 +251,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(Some(200)),
per_deposit_minimum: Some(Some(200)),
per_deposit_cap: Some(Some(200)),
per_withdrawal_minimum: Some(Some(200)),
per_withdrawal_cap: Some(Some(200)),
},
),
Expand All @@ -278,7 +260,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(Some(300)),
per_deposit_minimum: Some(Some(300)),
per_deposit_cap: Some(Some(300)),
per_withdrawal_minimum: Some(Some(300)),
per_withdrawal_cap: Some(Some(300)),
},
),
Expand All @@ -290,7 +271,6 @@ async fn test_updating_account_limits_via_global_limit_works() {
peg_cap: Some(Some(123)),
per_deposit_minimum: Some(Some(654)),
per_deposit_cap: Some(Some(456)),
per_withdrawal_minimum: Some(Some(987)),
per_withdrawal_cap: Some(Some(789)),
account_caps: expected_global_account_limits.clone(),
};
Expand Down

0 comments on commit 7e3a129

Please sign in to comment.