radix_engine_interface/blueprints/pool/one_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 ONE_RESOURCE_POOL_BLUEPRINT: &str = "OneResourcePool";
9
10define_type_marker!(Some(POOL_PACKAGE), OneResourcePool);
11
12define_invocation! {
13    blueprint_name: OneResourcePool,
14    function_name: instantiate,
15    input: struct {
16        owner_role: OwnerRole,
17        pool_manager_rule: AccessRule,
18        resource_address: ResourceAddress,
19        address_reservation: Option<GlobalAddressReservation>
20    },
21    output: type Global<OneResourcePoolMarker>,
22    manifest_input: struct {
23        owner_role: ManifestOwnerRole,
24        pool_manager_rule: ManifestAccessRule,
25        resource_address: ManifestResourceAddress,
26        address_reservation: Option<ManifestAddressReservation>
27    }
28}
29
30define_invocation! {
31    blueprint_name: OneResourcePool,
32    function_name: contribute,
33    input: struct {
34        bucket: Bucket
35    },
36    output: type Bucket,
37    manifest_input: struct {
38        bucket: ManifestBucket
39    }
40}
41
42define_invocation! {
43    blueprint_name: OneResourcePool,
44    function_name: redeem,
45    input: struct {
46        bucket: Bucket
47    },
48    output: type Bucket,
49    manifest_input: struct {
50        bucket: ManifestBucket
51    }
52}
53
54define_invocation! {
55    blueprint_name: OneResourcePool,
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: OneResourcePool,
68    function_name: protected_withdraw,
69    input: struct {
70        amount: Decimal,
71        withdraw_strategy: WithdrawStrategy
72    },
73    output: type Bucket,
74    manifest_input: struct {
75        amount: Decimal,
76        withdraw_strategy: WithdrawStrategy
77    }
78}
79
80define_invocation! {
81    blueprint_name: OneResourcePool,
82    function_name: get_redemption_value,
83    input: struct {
84        amount_of_pool_units: Decimal
85    },
86    output: type Decimal,
87    manifest_input: struct {
88        amount_of_pool_units: Decimal
89    }
90}
91
92define_invocation! {
93    blueprint_name: OneResourcePool,
94    function_name: get_vault_amount,
95    input: struct {},
96    output: type Decimal,
97    manifest_input: struct {}
98}