radix_engine_interface/blueprints/pool/multi_resource_pool/
invocations.rs

1use crate::blueprints::component::*;
2use crate::blueprints::macros::*;
3use crate::blueprints::resource::*;
4use radix_common::data::manifest::model::*;
5use radix_common::math::*;
6use radix_common::prelude::*;
7
8pub const MULTI_RESOURCE_POOL_BLUEPRINT: &str = "MultiResourcePool";
9
10define_type_marker!(Some(POOL_PACKAGE), MultiResourcePool);
11
12define_invocation! {
13    blueprint_name: MultiResourcePool,
14    function_name: instantiate,
15    input: struct {
16        owner_role: OwnerRole,
17        pool_manager_rule: AccessRule,
18        resource_addresses: IndexSet<ResourceAddress>,
19        address_reservation: Option<GlobalAddressReservation>
20    },
21    output: type Global<MultiResourcePoolMarker>,
22    manifest_input: struct {
23        owner_role: ManifestOwnerRole,
24        pool_manager_rule: ManifestAccessRule,
25        resource_addresses: IndexSet<ManifestResourceAddress>,
26        address_reservation: Option<ManifestAddressReservation>
27    }
28}
29
30define_invocation! {
31    blueprint_name: MultiResourcePool,
32    function_name: contribute,
33    input: struct {
34        buckets: Vec<Bucket>
35    },
36    output: type (Bucket, Vec<Bucket>),
37    manifest_input: struct {
38        buckets: ManifestBucketBatch
39    }
40}
41
42define_invocation! {
43    blueprint_name: MultiResourcePool,
44    function_name: redeem,
45    input: struct {
46        bucket: Bucket
47    },
48    output: type Vec<Bucket>,
49    manifest_input: struct {
50        bucket: ManifestBucket
51    }
52}
53
54define_invocation! {
55    blueprint_name: MultiResourcePool,
56    function_name: protected_deposit,
57    input: struct {
58        bucket: Bucket
59    },
60    output: type (),
61    manifest_input: struct {
62        bucket: ManifestBucket
63    }
64}
65
66define_invocation! {
67    blueprint_name: MultiResourcePool,
68    function_name: protected_withdraw,
69    input: struct {
70        resource_address: ResourceAddress,
71        amount: Decimal,
72        withdraw_strategy: WithdrawStrategy
73    },
74    output: type Bucket,
75    manifest_input: struct {
76        resource_address: ManifestResourceAddress,
77        amount: Decimal,
78        withdraw_strategy: WithdrawStrategy
79    }
80}
81
82define_invocation! {
83    blueprint_name: MultiResourcePool,
84    function_name: get_redemption_value,
85    input: struct {
86        amount_of_pool_units: Decimal
87    },
88    output: type IndexMap<ResourceAddress, Decimal>,
89    manifest_input: struct {
90        amount_of_pool_units: Decimal
91    }
92}
93
94define_invocation! {
95    blueprint_name: MultiResourcePool,
96    function_name: get_vault_amounts,
97    input: struct {},
98    output: type IndexMap<ResourceAddress, Decimal>,
99    manifest_input: struct {}
100}