From 017dad3f49f820b671629e0e1c0daef600952186 Mon Sep 17 00:00:00 2001 From: Ashton Stephens Date: Mon, 16 Dec 2024 13:38:02 +0000 Subject: [PATCH] Deposit minimums in limits (#1121) * feat: Limits endpoint has minimums * chore: Autogenerated sources * chore: make format * fix: Test issue * add per_deposit_minimum validation * Revert "add per_deposit_minimum validation" This reverts commit b454665ecde9f83826b574d7bcf8847cf05836da. * Put emily server back in * feat: remove withdrawal minimums * chore: Fix autogenerated sources --------- Co-authored-by: Francesco Leacche --- .../client/rust/private/docs/AccountLimits.md | 1 + .../emily/client/rust/private/docs/Limits.md | 1 + .../rust/private/src/models/account_limits.rs | 9 +++++++++ .../client/rust/private/src/models/limits.rs | 9 +++++++++ .../client/rust/public/docs/AccountLimits.md | 1 + .../emily/client/rust/public/docs/Limits.md | 1 + .../rust/public/src/models/account_limits.rs | 9 +++++++++ .../client/rust/public/src/models/limits.rs | 9 +++++++++ .../client/rust/testing/docs/AccountLimits.md | 1 + .../emily/client/rust/testing/docs/Limits.md | 1 + .../rust/testing/src/models/account_limits.rs | 9 +++++++++ .../client/rust/testing/src/models/limits.rs | 9 +++++++++ .../private-emily-openapi-spec.json | 14 +++++++++++++ .../public-emily-openapi-spec.json | 14 +++++++++++++ .../testing-emily-openapi-spec.json | 14 +++++++++++++ emily/handler/src/api/handlers/limits.rs | 1 + emily/handler/src/api/models/limits.rs | 4 ++++ emily/handler/src/context.rs | 4 ++++ emily/handler/src/database/accessors.rs | 2 ++ emily/handler/src/database/entries/limits.rs | 4 ++++ emily/handler/tests/integration/limits.rs | 20 +++++++++++++++++++ 21 files changed, 137 insertions(+) diff --git a/.generated-sources/emily/client/rust/private/docs/AccountLimits.md b/.generated-sources/emily/client/rust/private/docs/AccountLimits.md index 00aab8f84..a66fa9a87 100644 --- a/.generated-sources/emily/client/rust/private/docs/AccountLimits.md +++ b/.generated-sources/emily/client/rust/private/docs/AccountLimits.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **peg_cap** | Option<**u64**> | Represents the current sBTC limits. | [optional] **per_deposit_cap** | Option<**u64**> | Per deposit cap. If none then the cap is the same as the global per deposit cap. | [optional] +**per_deposit_minimum** | Option<**u64**> | Per deposit minimum. If none then there is no minimum. | [optional] **per_withdrawal_cap** | Option<**u64**> | Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/.generated-sources/emily/client/rust/private/docs/Limits.md b/.generated-sources/emily/client/rust/private/docs/Limits.md index 17af8e938..07404e825 100644 --- a/.generated-sources/emily/client/rust/private/docs/Limits.md +++ b/.generated-sources/emily/client/rust/private/docs/Limits.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **account_caps** | [**std::collections::HashMap**](AccountLimits.md) | Represents the individual limits for requests coming from different accounts. | **peg_cap** | Option<**u64**> | Represents the total cap for all pegged-in BTC/sBTC. | [optional] **per_deposit_cap** | Option<**u64**> | Per deposit cap. If none then there is no cap. | [optional] +**per_deposit_minimum** | Option<**u64**> | Per deposit minimum. If none then there is no minimum. | [optional] **per_withdrawal_cap** | Option<**u64**> | Per withdrawal cap. If none then there is no cap. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/.generated-sources/emily/client/rust/private/src/models/account_limits.rs b/.generated-sources/emily/client/rust/private/src/models/account_limits.rs index 45be51084..ed77256bb 100644 --- a/.generated-sources/emily/client/rust/private/src/models/account_limits.rs +++ b/.generated-sources/emily/client/rust/private/src/models/account_limits.rs @@ -30,6 +30,14 @@ pub struct AccountLimits { skip_serializing_if = "Option::is_none" )] pub per_deposit_cap: Option>, + /// Per deposit minimum. If none then there is no minimum. + #[serde( + rename = "perDepositMinimum", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. #[serde( rename = "perWithdrawalCap", @@ -46,6 +54,7 @@ impl AccountLimits { AccountLimits { peg_cap: None, per_deposit_cap: None, + per_deposit_minimum: None, per_withdrawal_cap: None, } } diff --git a/.generated-sources/emily/client/rust/private/src/models/limits.rs b/.generated-sources/emily/client/rust/private/src/models/limits.rs index 117f50891..a1c51485a 100644 --- a/.generated-sources/emily/client/rust/private/src/models/limits.rs +++ b/.generated-sources/emily/client/rust/private/src/models/limits.rs @@ -33,6 +33,14 @@ pub struct Limits { skip_serializing_if = "Option::is_none" )] pub per_deposit_cap: Option>, + /// Per deposit minimum. If none then there is no minimum. + #[serde( + rename = "perDepositMinimum", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then there is no cap. #[serde( rename = "perWithdrawalCap", @@ -50,6 +58,7 @@ impl Limits { account_caps, peg_cap: None, per_deposit_cap: None, + per_deposit_minimum: None, per_withdrawal_cap: None, } } diff --git a/.generated-sources/emily/client/rust/public/docs/AccountLimits.md b/.generated-sources/emily/client/rust/public/docs/AccountLimits.md index 00aab8f84..a66fa9a87 100644 --- a/.generated-sources/emily/client/rust/public/docs/AccountLimits.md +++ b/.generated-sources/emily/client/rust/public/docs/AccountLimits.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **peg_cap** | Option<**u64**> | Represents the current sBTC limits. | [optional] **per_deposit_cap** | Option<**u64**> | Per deposit cap. If none then the cap is the same as the global per deposit cap. | [optional] +**per_deposit_minimum** | Option<**u64**> | Per deposit minimum. If none then there is no minimum. | [optional] **per_withdrawal_cap** | Option<**u64**> | Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/.generated-sources/emily/client/rust/public/docs/Limits.md b/.generated-sources/emily/client/rust/public/docs/Limits.md index 17af8e938..07404e825 100644 --- a/.generated-sources/emily/client/rust/public/docs/Limits.md +++ b/.generated-sources/emily/client/rust/public/docs/Limits.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **account_caps** | [**std::collections::HashMap**](AccountLimits.md) | Represents the individual limits for requests coming from different accounts. | **peg_cap** | Option<**u64**> | Represents the total cap for all pegged-in BTC/sBTC. | [optional] **per_deposit_cap** | Option<**u64**> | Per deposit cap. If none then there is no cap. | [optional] +**per_deposit_minimum** | Option<**u64**> | Per deposit minimum. If none then there is no minimum. | [optional] **per_withdrawal_cap** | Option<**u64**> | Per withdrawal cap. If none then there is no cap. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/.generated-sources/emily/client/rust/public/src/models/account_limits.rs b/.generated-sources/emily/client/rust/public/src/models/account_limits.rs index 45be51084..ed77256bb 100644 --- a/.generated-sources/emily/client/rust/public/src/models/account_limits.rs +++ b/.generated-sources/emily/client/rust/public/src/models/account_limits.rs @@ -30,6 +30,14 @@ pub struct AccountLimits { skip_serializing_if = "Option::is_none" )] pub per_deposit_cap: Option>, + /// Per deposit minimum. If none then there is no minimum. + #[serde( + rename = "perDepositMinimum", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. #[serde( rename = "perWithdrawalCap", @@ -46,6 +54,7 @@ impl AccountLimits { AccountLimits { peg_cap: None, per_deposit_cap: None, + per_deposit_minimum: None, per_withdrawal_cap: None, } } diff --git a/.generated-sources/emily/client/rust/public/src/models/limits.rs b/.generated-sources/emily/client/rust/public/src/models/limits.rs index 117f50891..a1c51485a 100644 --- a/.generated-sources/emily/client/rust/public/src/models/limits.rs +++ b/.generated-sources/emily/client/rust/public/src/models/limits.rs @@ -33,6 +33,14 @@ pub struct Limits { skip_serializing_if = "Option::is_none" )] pub per_deposit_cap: Option>, + /// Per deposit minimum. If none then there is no minimum. + #[serde( + rename = "perDepositMinimum", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then there is no cap. #[serde( rename = "perWithdrawalCap", @@ -50,6 +58,7 @@ impl Limits { account_caps, peg_cap: None, per_deposit_cap: None, + per_deposit_minimum: None, per_withdrawal_cap: None, } } diff --git a/.generated-sources/emily/client/rust/testing/docs/AccountLimits.md b/.generated-sources/emily/client/rust/testing/docs/AccountLimits.md index 00aab8f84..a66fa9a87 100644 --- a/.generated-sources/emily/client/rust/testing/docs/AccountLimits.md +++ b/.generated-sources/emily/client/rust/testing/docs/AccountLimits.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **peg_cap** | Option<**u64**> | Represents the current sBTC limits. | [optional] **per_deposit_cap** | Option<**u64**> | Per deposit cap. If none then the cap is the same as the global per deposit cap. | [optional] +**per_deposit_minimum** | Option<**u64**> | Per deposit minimum. If none then there is no minimum. | [optional] **per_withdrawal_cap** | Option<**u64**> | Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/.generated-sources/emily/client/rust/testing/docs/Limits.md b/.generated-sources/emily/client/rust/testing/docs/Limits.md index 17af8e938..07404e825 100644 --- a/.generated-sources/emily/client/rust/testing/docs/Limits.md +++ b/.generated-sources/emily/client/rust/testing/docs/Limits.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **account_caps** | [**std::collections::HashMap**](AccountLimits.md) | Represents the individual limits for requests coming from different accounts. | **peg_cap** | Option<**u64**> | Represents the total cap for all pegged-in BTC/sBTC. | [optional] **per_deposit_cap** | Option<**u64**> | Per deposit cap. If none then there is no cap. | [optional] +**per_deposit_minimum** | Option<**u64**> | Per deposit minimum. If none then there is no minimum. | [optional] **per_withdrawal_cap** | Option<**u64**> | Per withdrawal cap. If none then there is no cap. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs b/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs index 45be51084..ed77256bb 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs @@ -30,6 +30,14 @@ pub struct AccountLimits { skip_serializing_if = "Option::is_none" )] pub per_deposit_cap: Option>, + /// Per deposit minimum. If none then there is no minimum. + #[serde( + rename = "perDepositMinimum", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. #[serde( rename = "perWithdrawalCap", @@ -46,6 +54,7 @@ impl AccountLimits { AccountLimits { peg_cap: None, per_deposit_cap: None, + per_deposit_minimum: None, per_withdrawal_cap: None, } } diff --git a/.generated-sources/emily/client/rust/testing/src/models/limits.rs b/.generated-sources/emily/client/rust/testing/src/models/limits.rs index 117f50891..a1c51485a 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/limits.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/limits.rs @@ -33,6 +33,14 @@ pub struct Limits { skip_serializing_if = "Option::is_none" )] pub per_deposit_cap: Option>, + /// Per deposit minimum. If none then there is no minimum. + #[serde( + rename = "perDepositMinimum", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then there is no cap. #[serde( rename = "perWithdrawalCap", @@ -50,6 +58,7 @@ impl Limits { account_caps, peg_cap: None, per_deposit_cap: None, + per_deposit_minimum: None, per_withdrawal_cap: None, } } diff --git a/.generated-sources/emily/openapi/generated-specs/private-emily-openapi-spec.json b/.generated-sources/emily/openapi/generated-specs/private-emily-openapi-spec.json index 68c3e45a0..36f2ba90d 100644 --- a/.generated-sources/emily/openapi/generated-specs/private-emily-openapi-spec.json +++ b/.generated-sources/emily/openapi/generated-specs/private-emily-openapi-spec.json @@ -1715,6 +1715,13 @@ "nullable": true, "minimum": 0 }, + "perDepositMinimum": { + "type": "integer", + "format": "int64", + "description": "Per deposit minimum. If none then there is no minimum.", + "nullable": true, + "minimum": 0 + }, "perWithdrawalCap": { "type": "integer", "format": "int64", @@ -2181,6 +2188,13 @@ "nullable": true, "minimum": 0 }, + "perDepositMinimum": { + "type": "integer", + "format": "int64", + "description": "Per deposit minimum. If none then there is no minimum.", + "nullable": true, + "minimum": 0 + }, "perWithdrawalCap": { "type": "integer", "format": "int64", diff --git a/.generated-sources/emily/openapi/generated-specs/public-emily-openapi-spec.json b/.generated-sources/emily/openapi/generated-specs/public-emily-openapi-spec.json index 1a496b085..a8e13245b 100644 --- a/.generated-sources/emily/openapi/generated-specs/public-emily-openapi-spec.json +++ b/.generated-sources/emily/openapi/generated-specs/public-emily-openapi-spec.json @@ -1515,6 +1515,13 @@ "nullable": true, "minimum": 0 }, + "perDepositMinimum": { + "type": "integer", + "format": "int64", + "description": "Per deposit minimum. If none then there is no minimum.", + "nullable": true, + "minimum": 0 + }, "perWithdrawalCap": { "type": "integer", "format": "int64", @@ -1981,6 +1988,13 @@ "nullable": true, "minimum": 0 }, + "perDepositMinimum": { + "type": "integer", + "format": "int64", + "description": "Per deposit minimum. If none then there is no minimum.", + "nullable": true, + "minimum": 0 + }, "perWithdrawalCap": { "type": "integer", "format": "int64", diff --git a/.generated-sources/emily/openapi/generated-specs/testing-emily-openapi-spec.json b/.generated-sources/emily/openapi/generated-specs/testing-emily-openapi-spec.json index 501494028..9bcf0fffb 100644 --- a/.generated-sources/emily/openapi/generated-specs/testing-emily-openapi-spec.json +++ b/.generated-sources/emily/openapi/generated-specs/testing-emily-openapi-spec.json @@ -1769,6 +1769,13 @@ "nullable": true, "minimum": 0 }, + "perDepositMinimum": { + "type": "integer", + "format": "int64", + "description": "Per deposit minimum. If none then there is no minimum.", + "nullable": true, + "minimum": 0 + }, "perWithdrawalCap": { "type": "integer", "format": "int64", @@ -2235,6 +2242,13 @@ "nullable": true, "minimum": 0 }, + "perDepositMinimum": { + "type": "integer", + "format": "int64", + "description": "Per deposit minimum. If none then there is no minimum.", + "nullable": true, + "minimum": 0 + }, "perWithdrawalCap": { "type": "integer", "format": "int64", diff --git a/emily/handler/src/api/handlers/limits.rs b/emily/handler/src/api/handlers/limits.rs index 916729323..45591aaf6 100644 --- a/emily/handler/src/api/handlers/limits.rs +++ b/emily/handler/src/api/handlers/limits.rs @@ -71,6 +71,7 @@ pub async fn set_limits(context: EmilyContext, limits: Limits) -> impl warp::rep SystemTime::now(), &AccountLimits { peg_cap: limits.peg_cap, + per_deposit_minimum: limits.per_deposit_minimum, per_deposit_cap: limits.per_deposit_cap, per_withdrawal_cap: limits.per_withdrawal_cap, }, diff --git a/emily/handler/src/api/models/limits.rs b/emily/handler/src/api/models/limits.rs index 30dbf1133..11857a363 100644 --- a/emily/handler/src/api/models/limits.rs +++ b/emily/handler/src/api/models/limits.rs @@ -11,6 +11,8 @@ use utoipa::{ToResponse, ToSchema}; pub struct Limits { /// Represents the total cap for all pegged-in BTC/sBTC. pub peg_cap: Option, + /// Per deposit minimum. If none then there is no minimum. + pub per_deposit_minimum: Option, /// Per deposit cap. If none then there is no cap. pub per_deposit_cap: Option, /// Per withdrawal cap. If none then there is no cap. @@ -38,6 +40,8 @@ pub struct Limits { pub struct AccountLimits { /// Represents the current sBTC limits. pub peg_cap: Option, + /// Per deposit minimum. If none then there is no minimum. + pub per_deposit_minimum: Option, /// Per deposit cap. If none then the cap is the same as the global per deposit cap. pub per_deposit_cap: Option, /// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. diff --git a/emily/handler/src/context.rs b/emily/handler/src/context.rs index 3b922d8ae..120f3de63 100644 --- a/emily/handler/src/context.rs +++ b/emily/handler/src/context.rs @@ -74,6 +74,10 @@ impl Settings { .ok() .map(|v| v.parse()) .transpose()?, + per_deposit_minimum: env::var("DEFAULT_PER_DEPOSIT_MINIMUM") + .ok() + .map(|v| v.parse()) + .transpose()?, per_deposit_cap: env::var("DEFAULT_PER_DEPOSIT_CAP") .ok() .map(|v| v.parse()) diff --git a/emily/handler/src/database/accessors.rs b/emily/handler/src/database/accessors.rs index 0d1e875e9..5fb4ff7b0 100644 --- a/emily/handler/src/database/accessors.rs +++ b/emily/handler/src/database/accessors.rs @@ -633,6 +633,7 @@ pub async fn get_limits(context: &EmilyContext) -> Result { timestamp: 0, }, 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_cap: default_global_cap.per_withdrawal_cap, }; @@ -669,6 +670,7 @@ pub async fn get_limits(context: &EmilyContext) -> Result { // Get the global limit for the whole thing. Ok(Limits { peg_cap: global_cap.peg_cap, + per_deposit_minimum: global_cap.per_deposit_minimum, per_deposit_cap: global_cap.per_deposit_cap, per_withdrawal_cap: global_cap.per_withdrawal_cap, account_caps, diff --git a/emily/handler/src/database/entries/limits.rs b/emily/handler/src/database/entries/limits.rs index 5302cb13a..120e60bc1 100644 --- a/emily/handler/src/database/entries/limits.rs +++ b/emily/handler/src/database/entries/limits.rs @@ -32,6 +32,8 @@ pub struct LimitEntry { pub key: LimitEntryKey, /// Represents the current sBTC limits. pub peg_cap: Option, + /// Per deposit minimum. If none then there is no minimum. + pub per_deposit_minimum: Option, /// Per deposit cap. If none then the cap is the same as the global per deposit cap. pub per_deposit_cap: Option, /// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. @@ -43,6 +45,7 @@ impl From for AccountLimits { fn from(limit_entry: LimitEntry) -> Self { 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_cap: limit_entry.per_withdrawal_cap, } @@ -66,6 +69,7 @@ impl LimitEntry { .as_secs(), }, peg_cap: account_limit.peg_cap, + per_deposit_minimum: account_limit.per_deposit_minimum, per_deposit_cap: account_limit.per_deposit_cap, per_withdrawal_cap: account_limit.per_withdrawal_cap, } diff --git a/emily/handler/tests/integration/limits.rs b/emily/handler/tests/integration/limits.rs index 66f1a4d96..865b58325 100644 --- a/emily/handler/tests/integration/limits.rs +++ b/emily/handler/tests/integration/limits.rs @@ -14,6 +14,7 @@ async fn empty_default_is_as_expected() { let expected_empty_default = models::Limits { peg_cap: Some(None), + per_deposit_minimum: Some(None), per_deposit_cap: Some(None), per_withdrawal_cap: Some(None), account_caps: HashMap::new(), @@ -38,6 +39,7 @@ async fn adding_and_then_updating_single_accout_limit_works() { "test_account", AccountLimits { peg_cap: Some(Some(100)), + per_deposit_minimum: Some(Some(100)), per_deposit_cap: Some(Some(100)), per_withdrawal_cap: Some(Some(100)), }, @@ -46,6 +48,7 @@ async fn adding_and_then_updating_single_accout_limit_works() { "test_account_2", AccountLimits { peg_cap: Some(Some(1200)), + per_deposit_minimum: Some(Some(1200)), per_deposit_cap: Some(Some(1200)), per_withdrawal_cap: Some(Some(1200)), }, @@ -54,6 +57,7 @@ async fn adding_and_then_updating_single_accout_limit_works() { "test_account_2", AccountLimits { peg_cap: Some(Some(100)), + per_deposit_minimum: Some(Some(200)), per_deposit_cap: Some(Some(300)), per_withdrawal_cap: Some(Some(500)), }, @@ -62,6 +66,7 @@ async fn adding_and_then_updating_single_accout_limit_works() { "test_account_2", AccountLimits { peg_cap: Some(Some(200)), + per_deposit_minimum: Some(Some(200)), per_deposit_cap: Some(Some(200)), per_withdrawal_cap: Some(Some(200)), }, @@ -70,6 +75,7 @@ async fn adding_and_then_updating_single_accout_limit_works() { "test_account", AccountLimits { peg_cap: Some(Some(300)), + per_deposit_minimum: Some(Some(300)), per_deposit_cap: Some(Some(300)), per_withdrawal_cap: Some(Some(300)), }, @@ -83,6 +89,7 @@ async fn adding_and_then_updating_single_accout_limit_works() { "test_account_2", AccountLimits { peg_cap: Some(Some(200)), + per_deposit_minimum: Some(Some(200)), per_deposit_cap: Some(Some(200)), per_withdrawal_cap: Some(Some(200)), }, @@ -91,6 +98,7 @@ async fn adding_and_then_updating_single_accout_limit_works() { "test_account", AccountLimits { peg_cap: Some(Some(300)), + per_deposit_minimum: Some(Some(300)), per_deposit_cap: Some(Some(300)), per_withdrawal_cap: Some(Some(300)), }, @@ -103,6 +111,7 @@ async fn adding_and_then_updating_single_accout_limit_works() { // The global limits should show the latest account caps. let expected_limits = Limits { peg_cap: Some(None), + per_deposit_minimum: Some(None), per_deposit_cap: Some(None), per_withdrawal_cap: Some(None), account_caps: expected_account_caps.clone(), @@ -155,6 +164,7 @@ async fn test_updating_account_limits_via_global_limit_works() { "test_account_1", AccountLimits { peg_cap: Some(Some(100)), + per_deposit_minimum: Some(Some(100)), per_deposit_cap: Some(Some(100)), per_withdrawal_cap: Some(Some(100)), }, @@ -163,6 +173,7 @@ async fn test_updating_account_limits_via_global_limit_works() { "test_account_2", AccountLimits { peg_cap: Some(Some(150)), + per_deposit_minimum: Some(Some(150)), per_deposit_cap: Some(Some(150)), per_withdrawal_cap: Some(Some(150)), }, @@ -171,6 +182,7 @@ async fn test_updating_account_limits_via_global_limit_works() { "test_account_4", AccountLimits { peg_cap: Some(Some(150)), + per_deposit_minimum: Some(Some(150)), per_deposit_cap: Some(Some(150)), per_withdrawal_cap: Some(Some(150)), }, @@ -184,6 +196,7 @@ async fn test_updating_account_limits_via_global_limit_works() { "test_account_2", AccountLimits { peg_cap: Some(Some(200)), + per_deposit_minimum: Some(Some(200)), per_deposit_cap: Some(Some(200)), per_withdrawal_cap: Some(Some(200)), }, @@ -192,6 +205,7 @@ async fn test_updating_account_limits_via_global_limit_works() { "test_account_3", AccountLimits { peg_cap: Some(Some(300)), + per_deposit_minimum: Some(Some(300)), per_deposit_cap: Some(Some(300)), per_withdrawal_cap: Some(Some(300)), }, @@ -202,6 +216,7 @@ async fn test_updating_account_limits_via_global_limit_works() { "test_account_4", AccountLimits { peg_cap: Some(None), + per_deposit_minimum: Some(None), per_deposit_cap: Some(None), per_withdrawal_cap: Some(None), }, @@ -212,6 +227,7 @@ async fn test_updating_account_limits_via_global_limit_works() { .collect(); let global_limits_to_set = Limits { peg_cap: Some(Some(123)), + per_deposit_minimum: Some(Some(654)), per_deposit_cap: Some(Some(456)), per_withdrawal_cap: Some(Some(789)), account_caps: account_limits_to_set_globally.clone(), @@ -224,6 +240,7 @@ async fn test_updating_account_limits_via_global_limit_works() { "test_account_1", AccountLimits { peg_cap: Some(Some(100)), + per_deposit_minimum: Some(Some(100)), per_deposit_cap: Some(Some(100)), per_withdrawal_cap: Some(Some(100)), }, @@ -232,6 +249,7 @@ async fn test_updating_account_limits_via_global_limit_works() { "test_account_2", AccountLimits { peg_cap: Some(Some(200)), + per_deposit_minimum: Some(Some(200)), per_deposit_cap: Some(Some(200)), per_withdrawal_cap: Some(Some(200)), }, @@ -240,6 +258,7 @@ async fn test_updating_account_limits_via_global_limit_works() { "test_account_3", AccountLimits { peg_cap: Some(Some(300)), + per_deposit_minimum: Some(Some(300)), per_deposit_cap: Some(Some(300)), per_withdrawal_cap: Some(Some(300)), }, @@ -250,6 +269,7 @@ async fn test_updating_account_limits_via_global_limit_works() { .collect(); let expected_global_limits = Limits { peg_cap: Some(Some(123)), + per_deposit_minimum: Some(Some(654)), per_deposit_cap: Some(Some(456)), per_withdrawal_cap: Some(Some(789)), account_caps: expected_global_account_limits.clone(),