fireblocks_sdk/models/
contract_template_dto.rs

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