Skip to content

Commit 169f509

Browse files
committed
add field documents for DrawdownData structure for future bulk upload flow
1 parent 7d07f3a commit 169f509

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

pallets/proxy-financial/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub mod pallet {
219219
_,
220220
Identity,
221221
[u8;32], // Key drawdown id
222-
DrawdownData, // Value DrawdownData<T>
222+
DrawdownData<T>, // Value DrawdownData<T>
223223
OptionQuery,
224224
>;
225225

pallets/proxy-financial/src/types.rs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub type Documents<T> = BoundedVec<(FieldName,CID), <T as Config>::MaxDocuments>
1313
#[derive(CloneNoBound, Encode, Decode, RuntimeDebugNoBound, TypeInfo, MaxEncodedLen,)]
1414
#[scale_info(skip_type_params(T))]
1515
#[codec(mel_bound())]
16-
pub struct ProjectData<T: Config>{
16+
pub struct ProjectData<T: Config> {
1717
pub developer: Option<BoundedVec<T::AccountId, T::MaxDevelopersPerProject>>,
1818
pub investor: Option<BoundedVec<T::AccountId, T::MaxInvestorsPerProject>>,
1919
pub issuer: Option<BoundedVec<T::AccountId, T::MaxIssuersPerProject>>,
@@ -30,18 +30,18 @@ pub struct ProjectData<T: Config>{
3030
}
3131

3232
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, MaxEncodedLen, TypeInfo, Copy)]
33-
pub enum ProjectStatus{
33+
pub enum ProjectStatus {
3434
Started,
3535
Completed,
3636
}
37-
impl Default for ProjectStatus{
37+
impl Default for ProjectStatus {
3838
fn default() -> Self {
3939
ProjectStatus::Started
4040
}
4141
}
4242

4343
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, MaxEncodedLen, TypeInfo, Copy)]
44-
pub enum ProjectType{
44+
pub enum ProjectType {
4545
Construction,
4646
ConstructionOperation,
4747
ConstructionBridge,
@@ -52,7 +52,7 @@ pub enum ProjectType{
5252
#[derive(CloneNoBound, Encode, Decode, RuntimeDebugNoBound, TypeInfo, MaxEncodedLen,)]
5353
#[scale_info(skip_type_params(T))]
5454
#[codec(mel_bound())]
55-
pub struct UserData<T: Config>{
55+
pub struct UserData<T: Config> {
5656
pub name: FieldName,
5757
pub role: ProxyRole,
5858
pub image: CID,
@@ -62,7 +62,7 @@ pub struct UserData<T: Config>{
6262
}
6363

6464
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, MaxEncodedLen, TypeInfo, Copy)]
65-
pub enum ProxyRole{
65+
pub enum ProxyRole {
6666
Administrator,
6767
Developer,
6868
Investor,
@@ -82,14 +82,14 @@ pub struct ExpenditureData {
8282
}
8383

8484
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, MaxEncodedLen, TypeInfo, Copy)]
85-
pub enum ExpenditureType{
85+
pub enum ExpenditureType {
8686
HardCost,
8787
SoftCost,
8888
Operational,
8989
Others,
9090
}
9191

92-
impl Default for ExpenditureType{
92+
impl Default for ExpenditureType {
9393
fn default() -> Self {
9494
ExpenditureType::HardCost
9595
}
@@ -105,40 +105,42 @@ pub struct BudgetData {
105105
}
106106

107107

108-
#[derive(CloneNoBound, Encode, Decode, RuntimeDebugNoBound, Default, TypeInfo, MaxEncodedLen)]
109-
pub struct DrawdownData {
108+
#[derive(CloneNoBound, Encode, Decode, RuntimeDebugNoBound, TypeInfo, MaxEncodedLen,)]
109+
#[scale_info(skip_type_params(T))]
110+
#[codec(mel_bound())]
111+
pub struct DrawdownData<T: Config> {
110112
pub project_id: [u8;32],
111113
pub drawdown_number: u32,
112114
pub drawdown_type: DrawdownType,
113115
pub total_amount: u64,
114116
pub status: DrawdownStatus,
115-
//TODO: add Option<Files> -> Bulk Upload
117+
pub documents: Option<Documents<T>>,
116118
pub created_date: u64,
117119
pub close_date: u64,
118120
}
119121

120122
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, MaxEncodedLen, TypeInfo, Copy)]
121-
pub enum DrawdownType{
123+
pub enum DrawdownType {
122124
EB5,
123125
ConstructionLoan,
124126
DeveloperEquity,
125127
}
126128

127-
impl Default for DrawdownType{
129+
impl Default for DrawdownType {
128130
fn default() -> Self {
129131
DrawdownType::EB5
130132
}
131133
}
132134

133135
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, MaxEncodedLen, TypeInfo, Copy)]
134-
pub enum DrawdownStatus{
136+
pub enum DrawdownStatus {
135137
Draft,
136138
Submitted,
137139
Approved,
138140
Rejected,
139141
}
140142

141-
impl Default for DrawdownStatus{
143+
impl Default for DrawdownStatus {
142144
fn default() -> Self {
143145
DrawdownStatus::Draft
144146
}
@@ -147,7 +149,7 @@ impl Default for DrawdownStatus{
147149
#[derive(CloneNoBound, Encode, Decode, RuntimeDebugNoBound, TypeInfo, MaxEncodedLen,)]
148150
#[scale_info(skip_type_params(T))]
149151
#[codec(mel_bound())]
150-
pub struct TransactionData<T: Config>{
152+
pub struct TransactionData<T: Config> {
151153
pub project_id: [u8;32],
152154
pub drawdown_id: [u8;32],
153155
pub expenditure_id: [u8;32],
@@ -161,14 +163,14 @@ pub struct TransactionData<T: Config>{
161163
}
162164

163165
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, MaxEncodedLen, TypeInfo, Copy)]
164-
pub enum TransactionStatus{
166+
pub enum TransactionStatus {
165167
Draft,
166168
Submitted,
167169
Approved,
168170
Rejected,
169171
}
170172

171-
impl Default for TransactionStatus{
173+
impl Default for TransactionStatus {
172174
fn default() -> Self {
173175
TransactionStatus::Draft
174176
}
@@ -182,7 +184,7 @@ pub enum CURD {
182184
Delete,
183185
}
184186

185-
impl ProxyRole{
187+
impl ProxyRole {
186188
pub fn to_vec(self) -> Vec<u8>{
187189
match self{
188190
//TOREVIEW: optimization (?)
@@ -210,7 +212,7 @@ impl ProxyRole{
210212

211213
/// Extrinsics which require previous authorization to call them
212214
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, MaxEncodedLen, TypeInfo, Copy)]
213-
pub enum ProxyPermission{
215+
pub enum ProxyPermission {
214216
RegisterUser, // users_register_user
215217
UpdateUser, // users_update_user
216218
DeleteUser, // users_delete_user
@@ -221,7 +223,7 @@ pub enum ProxyPermission{
221223
UnassignUser, // projects_unassign_user
222224
}
223225

224-
impl ProxyPermission{
226+
impl ProxyPermission {
225227
pub fn to_vec(self) -> Vec<u8>{
226228
match self{
227229
Self::RegisterUser => "RegisterUser".as_bytes().to_vec(),

0 commit comments

Comments
 (0)