error.rs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. //! Errors
  2. use std::fmt;
  3. use cashu::{CurrencyUnit, PaymentMethod};
  4. use serde::{Deserialize, Deserializer, Serialize, Serializer};
  5. use serde_json::Value;
  6. use thiserror::Error;
  7. use crate::nuts::Id;
  8. use crate::util::hex;
  9. #[cfg(feature = "wallet")]
  10. use crate::wallet::WalletKey;
  11. use crate::Amount;
  12. /// CDK Error
  13. #[derive(Debug, Error)]
  14. pub enum Error {
  15. /// Mint does not have a key for amount
  16. #[error("No Key for Amount")]
  17. AmountKey,
  18. /// Keyset is not known
  19. #[error("Keyset id not known: `{0}`")]
  20. KeysetUnknown(Id),
  21. /// Unsupported unit
  22. #[error("Unit unsupported")]
  23. UnsupportedUnit,
  24. /// Payment failed
  25. #[error("Payment failed")]
  26. PaymentFailed,
  27. /// Payment pending
  28. #[error("Payment pending")]
  29. PaymentPending,
  30. /// Invoice already paid
  31. #[error("Request already paid")]
  32. RequestAlreadyPaid,
  33. /// Invalid payment request
  34. #[error("Invalid payment request")]
  35. InvalidPaymentRequest,
  36. /// Bolt11 invoice does not have amount
  37. #[error("Invoice Amount undefined")]
  38. InvoiceAmountUndefined,
  39. /// Split Values must be less then or equal to amount
  40. #[error("Split Values must be less then or equal to amount")]
  41. SplitValuesGreater,
  42. /// Amount overflow
  43. #[error("Amount Overflow")]
  44. AmountOverflow,
  45. /// Witness missing or invalid
  46. #[error("Signature missing or invalid")]
  47. SignatureMissingOrInvalid,
  48. /// Amountless Invoice Not supported
  49. #[error("Amount Less Invoice is not allowed")]
  50. AmountLessNotAllowed,
  51. /// Multi-Part Internal Melt Quotes are not supported
  52. #[error("Multi-Part Internal Melt Quotes are not supported")]
  53. InternalMultiPartMeltQuote,
  54. /// Multi-Part Payment not supported for unit and method
  55. #[error("Multi-Part payment is not supported for unit `{0}` and method `{1}`")]
  56. MppUnitMethodNotSupported(CurrencyUnit, PaymentMethod),
  57. // Mint Errors
  58. /// Minting is disabled
  59. #[error("Minting is disabled")]
  60. MintingDisabled,
  61. /// Quote is not known
  62. #[error("Unknown quote")]
  63. UnknownQuote,
  64. /// Quote is expired
  65. #[error("Expired quote: Expired: `{0}`, Time: `{1}`")]
  66. ExpiredQuote(u64, u64),
  67. /// Amount is outside of allowed range
  68. #[error("Amount must be between `{0}` and `{1}` is `{2}`")]
  69. AmountOutofLimitRange(Amount, Amount, Amount),
  70. /// Quote is not paiud
  71. #[error("Quote not paid")]
  72. UnpaidQuote,
  73. /// Quote is pending
  74. #[error("Quote pending")]
  75. PendingQuote,
  76. /// ecash already issued for quote
  77. #[error("Quote already issued")]
  78. IssuedQuote,
  79. /// Quote has already been paid
  80. #[error("Quote is already paid")]
  81. PaidQuote,
  82. /// Payment state is unknown
  83. #[error("Payment state is unknown")]
  84. UnknownPaymentState,
  85. /// Melting is disabled
  86. #[error("Minting is disabled")]
  87. MeltingDisabled,
  88. /// Unknown Keyset
  89. #[error("Unknown Keyset")]
  90. UnknownKeySet,
  91. /// BlindedMessage is already signed
  92. #[error("Blinded Message is already signed")]
  93. BlindedMessageAlreadySigned,
  94. /// Inactive Keyset
  95. #[error("Inactive Keyset")]
  96. InactiveKeyset,
  97. /// Transaction unbalanced
  98. #[error("Inputs: `{0}`, Outputs: `{1}`, Expected Fee: `{2}`")]
  99. TransactionUnbalanced(u64, u64, u64),
  100. /// Duplicate proofs provided
  101. #[error("Duplicate Inputs")]
  102. DuplicateInputs,
  103. /// Duplicate output
  104. #[error("Duplicate outputs")]
  105. DuplicateOutputs,
  106. /// Multiple units provided
  107. #[error("Cannot have multiple units")]
  108. MultipleUnits,
  109. /// Unit mismatch
  110. #[error("Input unit must match output")]
  111. UnitMismatch,
  112. /// Sig all cannot be used in melt
  113. #[error("Sig all cannot be used in melt")]
  114. SigAllUsedInMelt,
  115. /// Token is already spent
  116. #[error("Token Already Spent")]
  117. TokenAlreadySpent,
  118. /// Token is already pending
  119. #[error("Token Pending")]
  120. TokenPending,
  121. /// Internal Error
  122. #[error("Internal Error")]
  123. Internal,
  124. // Wallet Errors
  125. /// P2PK spending conditions not met
  126. #[error("P2PK condition not met `{0}`")]
  127. P2PKConditionsNotMet(String),
  128. /// Spending Locktime not provided
  129. #[error("Spending condition locktime not provided")]
  130. LocktimeNotProvided,
  131. /// Invalid Spending Conditions
  132. #[error("Invalid spending conditions: `{0}`")]
  133. InvalidSpendConditions(String),
  134. /// Incorrect Wallet
  135. #[error("Incorrect wallet: `{0}`")]
  136. IncorrectWallet(String),
  137. /// Unknown Wallet
  138. #[error("Unknown wallet: `{0}`")]
  139. #[cfg(feature = "wallet")]
  140. UnknownWallet(WalletKey),
  141. /// Max Fee Ecxeded
  142. #[error("Max fee exceeded")]
  143. MaxFeeExceeded,
  144. /// Url path segments could not be joined
  145. #[error("Url path segments could not be joined")]
  146. UrlPathSegments,
  147. /// Unknown error response
  148. #[error("Unknown error response: `{0}`")]
  149. UnknownErrorResponse(String),
  150. /// Invalid DLEQ proof
  151. #[error("Could not verify DLEQ proof")]
  152. CouldNotVerifyDleq,
  153. /// Incorrect Mint
  154. /// Token does not match wallet mint
  155. #[error("Token does not match wallet mint")]
  156. IncorrectMint,
  157. /// Receive can only be used with tokens from single mint
  158. #[error("Multiple mint tokens not supported by receive. Please deconstruct the token and use receive with_proof")]
  159. MultiMintTokenNotSupported,
  160. /// Preimage not provided
  161. #[error("Preimage not provided")]
  162. PreimageNotProvided,
  163. /// Insufficient Funds
  164. #[error("Insufficient funds")]
  165. InsufficientFunds,
  166. /// Unexpected proof state
  167. #[error("Unexpected proof state")]
  168. UnexpectedProofState,
  169. /// No active keyset
  170. #[error("No active keyset")]
  171. NoActiveKeyset,
  172. /// Incorrect quote amount
  173. #[error("Incorrect quote amount")]
  174. IncorrectQuoteAmount,
  175. /// Invoice Description not supported
  176. #[error("Invoice Description not supported")]
  177. InvoiceDescriptionUnsupported,
  178. /// Custom Error
  179. #[error("`{0}`")]
  180. Custom(String),
  181. // External Error conversions
  182. /// Parse invoice error
  183. #[error(transparent)]
  184. Invoice(#[from] lightning_invoice::ParseOrSemanticError),
  185. /// Bip32 error
  186. #[error(transparent)]
  187. Bip32(#[from] bitcoin::bip32::Error),
  188. /// Parse int error
  189. #[error(transparent)]
  190. ParseInt(#[from] std::num::ParseIntError),
  191. /// Parse 9rl Error
  192. #[error(transparent)]
  193. UrlParseError(#[from] url::ParseError),
  194. /// Utf8 parse error
  195. #[error(transparent)]
  196. Utf8ParseError(#[from] std::string::FromUtf8Error),
  197. /// Serde Json error
  198. #[error(transparent)]
  199. SerdeJsonError(#[from] serde_json::Error),
  200. /// Base64 error
  201. #[error(transparent)]
  202. Base64Error(#[from] bitcoin::base64::DecodeError),
  203. /// From hex error
  204. #[error(transparent)]
  205. HexError(#[from] hex::Error),
  206. /// Http transport error
  207. #[error("Http transport error: {0}")]
  208. HttpError(String),
  209. // Crate error conversions
  210. /// Cashu Url Error
  211. #[error(transparent)]
  212. CashuUrl(#[from] crate::mint_url::Error),
  213. /// Secret error
  214. #[error(transparent)]
  215. Secret(#[from] crate::secret::Error),
  216. /// Amount Error
  217. #[error(transparent)]
  218. AmountError(#[from] crate::amount::Error),
  219. /// DHKE Error
  220. #[error(transparent)]
  221. DHKE(#[from] crate::dhke::Error),
  222. /// NUT00 Error
  223. #[error(transparent)]
  224. NUT00(#[from] crate::nuts::nut00::Error),
  225. /// Nut01 error
  226. #[error(transparent)]
  227. NUT01(#[from] crate::nuts::nut01::Error),
  228. /// NUT02 error
  229. #[error(transparent)]
  230. NUT02(#[from] crate::nuts::nut02::Error),
  231. /// NUT03 error
  232. #[error(transparent)]
  233. NUT03(#[from] crate::nuts::nut03::Error),
  234. /// NUT04 error
  235. #[error(transparent)]
  236. NUT04(#[from] crate::nuts::nut04::Error),
  237. /// NUT05 error
  238. #[error(transparent)]
  239. NUT05(#[from] crate::nuts::nut05::Error),
  240. /// NUT11 Error
  241. #[error(transparent)]
  242. NUT11(#[from] crate::nuts::nut11::Error),
  243. /// NUT12 Error
  244. #[error(transparent)]
  245. NUT12(#[from] crate::nuts::nut12::Error),
  246. /// NUT13 Error
  247. #[error(transparent)]
  248. #[cfg(feature = "wallet")]
  249. NUT13(#[from] crate::nuts::nut13::Error),
  250. /// NUT14 Error
  251. #[error(transparent)]
  252. NUT14(#[from] crate::nuts::nut14::Error),
  253. /// NUT18 Error
  254. #[error(transparent)]
  255. NUT18(#[from] crate::nuts::nut18::Error),
  256. /// NUT20 Error
  257. #[error(transparent)]
  258. NUT20(#[from] crate::nuts::nut20::Error),
  259. /// Database Error
  260. #[error(transparent)]
  261. Database(#[from] crate::database::Error),
  262. /// Payment Error
  263. #[error(transparent)]
  264. #[cfg(feature = "mint")]
  265. Payment(#[from] crate::payment::Error),
  266. }
  267. /// CDK Error Response
  268. ///
  269. /// See NUT definition in [00](https://github.com/cashubtc/nuts/blob/main/00.md)
  270. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
  271. #[cfg_attr(feature = "swagger", derive(utoipa::ToSchema))]
  272. pub struct ErrorResponse {
  273. /// Error Code
  274. pub code: ErrorCode,
  275. /// Human readable Text
  276. pub error: Option<String>,
  277. /// Longer human readable description
  278. pub detail: Option<String>,
  279. }
  280. impl fmt::Display for ErrorResponse {
  281. fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  282. write!(
  283. f,
  284. "code: {}, error: {}, detail: {}",
  285. self.code,
  286. self.error.clone().unwrap_or_default(),
  287. self.detail.clone().unwrap_or_default()
  288. )
  289. }
  290. }
  291. impl ErrorResponse {
  292. /// Create new [`ErrorResponse`]
  293. pub fn new(code: ErrorCode, error: Option<String>, detail: Option<String>) -> Self {
  294. Self {
  295. code,
  296. error,
  297. detail,
  298. }
  299. }
  300. /// Error response from json
  301. pub fn from_json(json: &str) -> Result<Self, serde_json::Error> {
  302. let value: Value = serde_json::from_str(json)?;
  303. Self::from_value(value)
  304. }
  305. /// Error response from json Value
  306. pub fn from_value(value: Value) -> Result<Self, serde_json::Error> {
  307. match serde_json::from_value::<ErrorResponse>(value.clone()) {
  308. Ok(res) => Ok(res),
  309. Err(_) => Ok(Self {
  310. code: ErrorCode::Unknown(999),
  311. error: Some(value.to_string()),
  312. detail: None,
  313. }),
  314. }
  315. }
  316. }
  317. impl From<Error> for ErrorResponse {
  318. fn from(err: Error) -> ErrorResponse {
  319. match err {
  320. Error::TokenAlreadySpent => ErrorResponse {
  321. code: ErrorCode::TokenAlreadySpent,
  322. error: Some(err.to_string()),
  323. detail: None,
  324. },
  325. Error::UnsupportedUnit => ErrorResponse {
  326. code: ErrorCode::UnsupportedUnit,
  327. error: Some(err.to_string()),
  328. detail: None,
  329. },
  330. Error::PaymentFailed => ErrorResponse {
  331. code: ErrorCode::LightningError,
  332. error: Some(err.to_string()),
  333. detail: None,
  334. },
  335. Error::RequestAlreadyPaid => ErrorResponse {
  336. code: ErrorCode::InvoiceAlreadyPaid,
  337. error: Some("Invoice already paid.".to_string()),
  338. detail: None,
  339. },
  340. Error::TransactionUnbalanced(inputs_total, outputs_total, fee_expected) => {
  341. ErrorResponse {
  342. code: ErrorCode::TransactionUnbalanced,
  343. error: Some(format!(
  344. "Inputs: {}, Outputs: {}, expected_fee: {}",
  345. inputs_total, outputs_total, fee_expected,
  346. )),
  347. detail: Some("Transaction inputs should equal outputs less fee".to_string()),
  348. }
  349. }
  350. Error::MintingDisabled => ErrorResponse {
  351. code: ErrorCode::MintingDisabled,
  352. error: Some(err.to_string()),
  353. detail: None,
  354. },
  355. Error::BlindedMessageAlreadySigned => ErrorResponse {
  356. code: ErrorCode::BlindedMessageAlreadySigned,
  357. error: Some(err.to_string()),
  358. detail: None,
  359. },
  360. Error::InsufficientFunds => ErrorResponse {
  361. code: ErrorCode::TransactionUnbalanced,
  362. error: Some(err.to_string()),
  363. detail: None,
  364. },
  365. Error::AmountOutofLimitRange(_min, _max, _amount) => ErrorResponse {
  366. code: ErrorCode::AmountOutofLimitRange,
  367. error: Some(err.to_string()),
  368. detail: None,
  369. },
  370. Error::ExpiredQuote(_, _) => ErrorResponse {
  371. code: ErrorCode::QuoteExpired,
  372. error: Some(err.to_string()),
  373. detail: None,
  374. },
  375. Error::PendingQuote => ErrorResponse {
  376. code: ErrorCode::QuotePending,
  377. error: Some(err.to_string()),
  378. detail: None,
  379. },
  380. Error::TokenPending => ErrorResponse {
  381. code: ErrorCode::TokenPending,
  382. error: Some(err.to_string()),
  383. detail: None,
  384. },
  385. Error::NUT20(err) => ErrorResponse {
  386. code: ErrorCode::WitnessMissingOrInvalid,
  387. error: Some(err.to_string()),
  388. detail: None,
  389. },
  390. Error::DuplicateInputs => ErrorResponse {
  391. code: ErrorCode::DuplicateInputs,
  392. error: Some(err.to_string()),
  393. detail: None,
  394. },
  395. Error::DuplicateOutputs => ErrorResponse {
  396. code: ErrorCode::DuplicateOutputs,
  397. error: Some(err.to_string()),
  398. detail: None,
  399. },
  400. Error::MultipleUnits => ErrorResponse {
  401. code: ErrorCode::MultipleUnits,
  402. error: Some(err.to_string()),
  403. detail: None,
  404. },
  405. Error::UnitMismatch => ErrorResponse {
  406. code: ErrorCode::UnitMismatch,
  407. error: Some(err.to_string()),
  408. detail: None,
  409. },
  410. _ => ErrorResponse {
  411. code: ErrorCode::Unknown(9999),
  412. error: Some(err.to_string()),
  413. detail: None,
  414. },
  415. }
  416. }
  417. }
  418. impl From<ErrorResponse> for Error {
  419. fn from(err: ErrorResponse) -> Error {
  420. match err.code {
  421. ErrorCode::TokenAlreadySpent => Self::TokenAlreadySpent,
  422. ErrorCode::QuoteNotPaid => Self::UnpaidQuote,
  423. ErrorCode::QuotePending => Self::PendingQuote,
  424. ErrorCode::QuoteExpired => Self::ExpiredQuote(0, 0),
  425. ErrorCode::KeysetNotFound => Self::UnknownKeySet,
  426. ErrorCode::KeysetInactive => Self::InactiveKeyset,
  427. ErrorCode::BlindedMessageAlreadySigned => Self::BlindedMessageAlreadySigned,
  428. ErrorCode::UnsupportedUnit => Self::UnsupportedUnit,
  429. ErrorCode::TransactionUnbalanced => Self::TransactionUnbalanced(0, 0, 0),
  430. ErrorCode::MintingDisabled => Self::MintingDisabled,
  431. ErrorCode::InvoiceAlreadyPaid => Self::RequestAlreadyPaid,
  432. ErrorCode::TokenNotVerified => Self::DHKE(crate::dhke::Error::TokenNotVerified),
  433. ErrorCode::LightningError => Self::PaymentFailed,
  434. ErrorCode::AmountOutofLimitRange => {
  435. Self::AmountOutofLimitRange(Amount::default(), Amount::default(), Amount::default())
  436. }
  437. ErrorCode::TokenPending => Self::TokenPending,
  438. ErrorCode::WitnessMissingOrInvalid => Self::SignatureMissingOrInvalid,
  439. ErrorCode::DuplicateInputs => Self::DuplicateInputs,
  440. ErrorCode::DuplicateOutputs => Self::DuplicateOutputs,
  441. ErrorCode::MultipleUnits => Self::MultipleUnits,
  442. ErrorCode::UnitMismatch => Self::UnitMismatch,
  443. _ => Self::UnknownErrorResponse(err.to_string()),
  444. }
  445. }
  446. }
  447. /// Possible Error Codes
  448. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
  449. #[cfg_attr(feature = "swagger", derive(utoipa::ToSchema))]
  450. pub enum ErrorCode {
  451. /// Token is already spent
  452. TokenAlreadySpent,
  453. /// Token Pending
  454. TokenPending,
  455. /// Quote is not paid
  456. QuoteNotPaid,
  457. /// Quote is not expired
  458. QuoteExpired,
  459. /// Quote Pending
  460. QuotePending,
  461. /// Keyset is not found
  462. KeysetNotFound,
  463. /// Keyset inactive
  464. KeysetInactive,
  465. /// Blinded Message Already signed
  466. BlindedMessageAlreadySigned,
  467. /// Unsupported unit
  468. UnsupportedUnit,
  469. /// Token already issed for quote
  470. TokensAlreadyIssued,
  471. /// Minting Disabled
  472. MintingDisabled,
  473. /// Invoice Already Paid
  474. InvoiceAlreadyPaid,
  475. /// Token Not Verified
  476. TokenNotVerified,
  477. /// Lightning Error
  478. LightningError,
  479. /// Unbalanced Error
  480. TransactionUnbalanced,
  481. /// Amount outside of allowed range
  482. AmountOutofLimitRange,
  483. /// Witness missing or invalid
  484. WitnessMissingOrInvalid,
  485. /// Duplicate Inputs
  486. DuplicateInputs,
  487. /// Duplicate Outputs
  488. DuplicateOutputs,
  489. /// Multiple Units
  490. MultipleUnits,
  491. /// Input unit does not match output
  492. UnitMismatch,
  493. /// Unknown error code
  494. Unknown(u16),
  495. }
  496. impl ErrorCode {
  497. /// Error code from u16
  498. pub fn from_code(code: u16) -> Self {
  499. match code {
  500. 10002 => Self::BlindedMessageAlreadySigned,
  501. 10003 => Self::TokenNotVerified,
  502. 11001 => Self::TokenAlreadySpent,
  503. 11002 => Self::TransactionUnbalanced,
  504. 11005 => Self::UnsupportedUnit,
  505. 11006 => Self::AmountOutofLimitRange,
  506. 11007 => Self::DuplicateInputs,
  507. 11008 => Self::DuplicateOutputs,
  508. 11009 => Self::MultipleUnits,
  509. 11010 => Self::UnitMismatch,
  510. 11012 => Self::TokenPending,
  511. 12001 => Self::KeysetNotFound,
  512. 12002 => Self::KeysetInactive,
  513. 20000 => Self::LightningError,
  514. 20001 => Self::QuoteNotPaid,
  515. 20002 => Self::TokensAlreadyIssued,
  516. 20003 => Self::MintingDisabled,
  517. 20005 => Self::QuotePending,
  518. 20006 => Self::InvoiceAlreadyPaid,
  519. 20007 => Self::QuoteExpired,
  520. 20008 => Self::WitnessMissingOrInvalid,
  521. _ => Self::Unknown(code),
  522. }
  523. }
  524. /// Error code to u16
  525. pub fn to_code(&self) -> u16 {
  526. match self {
  527. Self::BlindedMessageAlreadySigned => 10002,
  528. Self::TokenNotVerified => 10003,
  529. Self::TokenAlreadySpent => 11001,
  530. Self::TransactionUnbalanced => 11002,
  531. Self::UnsupportedUnit => 11005,
  532. Self::AmountOutofLimitRange => 11006,
  533. Self::DuplicateInputs => 11007,
  534. Self::DuplicateOutputs => 11008,
  535. Self::MultipleUnits => 11009,
  536. Self::UnitMismatch => 11010,
  537. Self::TokenPending => 11012,
  538. Self::KeysetNotFound => 12001,
  539. Self::KeysetInactive => 12002,
  540. Self::LightningError => 20000,
  541. Self::QuoteNotPaid => 20001,
  542. Self::TokensAlreadyIssued => 20002,
  543. Self::MintingDisabled => 20003,
  544. Self::QuotePending => 20005,
  545. Self::InvoiceAlreadyPaid => 20006,
  546. Self::QuoteExpired => 20007,
  547. Self::WitnessMissingOrInvalid => 20008,
  548. Self::Unknown(code) => *code,
  549. }
  550. }
  551. }
  552. impl Serialize for ErrorCode {
  553. fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
  554. where
  555. S: Serializer,
  556. {
  557. serializer.serialize_u16(self.to_code())
  558. }
  559. }
  560. impl<'de> Deserialize<'de> for ErrorCode {
  561. fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
  562. where
  563. D: Deserializer<'de>,
  564. {
  565. let code = u16::deserialize(deserializer)?;
  566. Ok(ErrorCode::from_code(code))
  567. }
  568. }
  569. impl fmt::Display for ErrorCode {
  570. fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  571. write!(f, "{}", self.to_code())
  572. }
  573. }