1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Fireblocks API
//
// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain. - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
//
// The version of the OpenAPI document: 1.8.0
// Contact: developers@fireblocks.com
// Generated by: https://openapi-generator.tech
use {
crate::models,
serde::{Deserialize, Serialize},
};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ContractTemplateDto {
/// The unique identifier of the contract template
#[serde(rename = "id")]
pub id: String,
/// The name of the contract template
#[serde(rename = "name")]
pub name: String,
/// A short description of the contract template
#[serde(rename = "description")]
pub description: String,
/// A full description of the contract template. May contain to break the
/// lines
#[serde(rename = "longDescription", skip_serializing_if = "Option::is_none")]
pub long_description: Option<String>,
#[serde(rename = "abi")]
pub abi: Vec<Vec<models::AbiFunction>>,
/// The attributes related to this contract template. It will be displayed
/// in the tokenization page
#[serde(rename = "attributes", skip_serializing_if = "Option::is_none")]
pub attributes: Option<models::ContractAttributes>,
/// A `natspec` compliant documentation json. Can be retrieved from the
/// output json after compilation
#[serde(rename = "docs", skip_serializing_if = "Option::is_none")]
pub docs: Option<models::ContractDoc>,
/// The workspace id of the owner of this contract template. If it's a
/// private contract, only this workspace will be allowed to deploy it
#[serde(rename = "owner", skip_serializing_if = "Option::is_none")]
pub owner: Option<String>,
/// The details of the vendor of this contract template. Applicable only for
/// public contract templates
#[serde(rename = "vendor", skip_serializing_if = "Option::is_none")]
pub vendor: Option<models::VendorDto>,
/// Is this a contract that is viewable by all fireblocks's users or is it
/// visible only for this workspace
#[serde(rename = "isPublic")]
pub is_public: bool,
/// True if the workspace allowed to deploy this contract, false otherwise
#[serde(rename = "canDeploy", skip_serializing_if = "Option::is_none")]
pub can_deploy: Option<bool>,
/// The type of the contract template
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub r#type: Option<Type>,
#[serde(
rename = "implementationContractId",
skip_serializing_if = "Option::is_none"
)]
pub implementation_contract_id: Option<String>,
/// For standalone contracts use ON_DEPLOYMENT and for contracts that are
/// behind proxies use POST_DEPLOYMENT
#[serde(rename = "initializationPhase")]
pub initialization_phase: InitializationPhase,
}
impl ContractTemplateDto {
pub fn new(
id: String,
name: String,
description: String,
abi: Vec<Vec<models::AbiFunction>>,
is_public: bool,
initialization_phase: InitializationPhase,
) -> ContractTemplateDto {
ContractTemplateDto {
id,
name,
description,
long_description: None,
abi,
attributes: None,
docs: None,
owner: None,
vendor: None,
is_public,
can_deploy: None,
r#type: None,
implementation_contract_id: None,
initialization_phase,
}
}
}
/// The type of the contract template
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "FUNGIBLE_TOKEN")]
FungibleToken,
#[serde(rename = "NON_FUNGIBLE_TOKEN")]
NonFungibleToken,
#[serde(rename = "TOKEN_UTILITY")]
TokenUtility,
}
impl Default for Type {
fn default() -> Type {
Self::FungibleToken
}
}
/// For standalone contracts use ON_DEPLOYMENT and for contracts that are behind
/// proxies use POST_DEPLOYMENT
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum InitializationPhase {
#[serde(rename = "ON_DEPLOYMENT")]
OnDeployment,
#[serde(rename = "POST_DEPLOYMENT")]
PostDeployment,
}
impl Default for InitializationPhase {
fn default() -> InitializationPhase {
Self::OnDeployment
}
}