fireblocks_sdk/models/
contract_upload_request.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 ContractUploadRequest {
16    /// The name of the contract template
17    #[serde(rename = "name")]
18    pub name: String,
19    /// A short description of the contract template
20    #[serde(rename = "description")]
21    pub description: String,
22    /// A full description of the contract template. May contain   to break the
23    /// lines
24    #[serde(rename = "longDescription", skip_serializing_if = "Option::is_none")]
25    pub long_description: Option<String>,
26    /// The compiled artifact of this smart contract. Used for deployment of
27    /// this contract template
28    #[serde(rename = "bytecode")]
29    pub bytecode: String,
30    /// The source code of the contract. Optional.
31    #[serde(rename = "sourcecode", skip_serializing_if = "Option::is_none")]
32    pub sourcecode: Option<String>,
33    /// The type of the contract template
34    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
35    pub r#type: Option<Type>,
36    /// A `natspec` compliant documentation json. Can be retrieved from the
37    /// output json after compilation
38    #[serde(rename = "docs", skip_serializing_if = "Option::is_none")]
39    pub docs: Option<models::ContractDoc>,
40    #[serde(rename = "abi")]
41    pub abi: Vec<Vec<models::AbiFunction>>,
42    /// The attributes related to this contract template. It will be displayed
43    /// in the tokenization page
44    #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")]
45    pub attributes: Option<models::ContractAttributes>,
46}
47
48impl ContractUploadRequest {
49    pub fn new(
50        name: String,
51        description: String,
52        bytecode: String,
53        abi: Vec<Vec<models::AbiFunction>>,
54    ) -> ContractUploadRequest {
55        ContractUploadRequest {
56            name,
57            description,
58            long_description: None,
59            bytecode,
60            sourcecode: None,
61            r#type: None,
62            docs: None,
63            abi,
64            attributes: None,
65        }
66    }
67}
68/// The type of the contract template
69#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
70pub enum Type {
71    #[serde(rename = "FUNGIBLE_TOKEN")]
72    FungibleToken,
73    #[serde(rename = "NON_FUNGIBLE_TOKEN")]
74    NonFungibleToken,
75    #[serde(rename = "TOKEN_UTILITY")]
76    TokenUtility,
77}
78
79impl Default for Type {
80    fn default() -> Type {
81        Self::FungibleToken
82    }
83}