radix_engine/blueprints/pool/v1/
errors.rs1use crate::errors::*;
2use crate::internal_prelude::*;
3
4pub mod one_resource_pool {
5 use super::*;
6
7 #[derive(Debug, Clone, PartialEq, Eq, ScryptoSbor)]
8 pub enum Error {
9 NonFungibleResourcesAreNotAccepted {
10 resource_address: ResourceAddress,
11 },
12 NonZeroPoolUnitSupplyButZeroReserves,
13 InvalidPoolUnitResource {
14 expected: ResourceAddress,
15 actual: ResourceAddress,
16 },
17 ContributionOfEmptyBucketError,
18 DecimalOverflowError,
19 InvalidGetRedemptionAmount,
20 ZeroPoolUnitsMinted,
21 RedeemedZeroTokens,
22 ResourceDoesNotBelongToPool {
23 resource_address: ResourceAddress,
24 },
25 }
26
27 impl From<Error> for RuntimeError {
28 fn from(error: Error) -> Self {
29 Self::ApplicationError(ApplicationError::OneResourcePoolError(error))
30 }
31 }
32}
33
34pub mod two_resource_pool {
35 use super::*;
36
37 #[derive(Debug, Clone, PartialEq, Eq, ScryptoSbor)]
38 pub enum Error {
39 NonFungibleResourcesAreNotAccepted {
40 resource_address: ResourceAddress,
41 },
42 NonZeroPoolUnitSupplyButZeroReserves,
43 InvalidPoolUnitResource {
44 expected: ResourceAddress,
45 actual: ResourceAddress,
46 },
47 ResourceDoesNotBelongToPool {
48 resource_address: ResourceAddress,
49 },
50 PoolCreationWithSameResource,
51 ContributionOfEmptyBucketError,
52 DecimalOverflowError,
53 InvalidGetRedemptionAmount,
54 ZeroPoolUnitsMinted,
55 LargerContributionRequiredToMeetRatio,
56 }
57
58 impl From<Error> for RuntimeError {
59 fn from(error: Error) -> Self {
60 Self::ApplicationError(ApplicationError::TwoResourcePoolError(error))
61 }
62 }
63}
64
65pub mod multi_resource_pool {
66 use super::*;
67
68 #[derive(Debug, Clone, PartialEq, Eq, ScryptoSbor)]
69 pub enum Error {
70 NonFungibleResourcesAreNotAccepted {
71 resource_address: ResourceAddress,
72 },
73 NonZeroPoolUnitSupplyButZeroReserves,
74 InvalidPoolUnitResource {
75 expected: ResourceAddress,
76 actual: ResourceAddress,
77 },
78 ResourceDoesNotBelongToPool {
79 resource_address: ResourceAddress,
80 },
81 MissingOrEmptyBuckets {
82 resource_addresses: IndexSet<ResourceAddress>,
83 },
84 PoolCreationWithSameResource,
85 ContributionOfEmptyBucketError,
86 CantCreatePoolWithLessThanOneResource,
87 DecimalOverflowError,
88 InvalidGetRedemptionAmount,
89 NoMinimumRatio,
90 ZeroPoolUnitsMinted,
91 LargerContributionRequiredToMeetRatio,
92 }
93
94 impl From<Error> for RuntimeError {
95 fn from(error: Error) -> Self {
96 Self::ApplicationError(ApplicationError::MultiResourcePoolError(error))
97 }
98 }
99}