-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implemented check of members in Context contract and updated tests
- Loading branch information
1 parent
cf5a494
commit ce422bd
Showing
8 changed files
with
472 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
use candid::CandidType; | ||
use serde::{Deserialize, Serialize}; | ||
use proxy_contract::types::{ICContextId, ICContextIdentity, ICSignerId}; | ||
|
||
#[derive(CandidType, Serialize, Deserialize, Debug, Clone)] | ||
pub struct Request { | ||
pub kind: RequestKind, | ||
pub signer_id: ICSignerId, | ||
pub timestamp_ms: u64, | ||
} | ||
|
||
#[derive(CandidType, Serialize, Deserialize, Debug, Clone)] | ||
pub enum RequestKind { | ||
Context(ContextRequest), | ||
} | ||
|
||
#[derive(CandidType, Serialize, Deserialize, Debug, Clone)] | ||
pub struct ContextRequest { | ||
pub context_id: ICContextId, | ||
pub kind: ContextRequestKind, | ||
} | ||
|
||
#[derive(CandidType, Serialize, Deserialize, Debug, Clone)] | ||
pub enum ContextRequestKind { | ||
Add { | ||
author_id: ICContextIdentity, | ||
application: ICApplication, | ||
}, | ||
AddMembers { | ||
members: Vec<ICContextIdentity>, | ||
}, | ||
} | ||
|
||
#[derive(CandidType, Serialize, Deserialize, Debug, Clone)] | ||
pub struct ICApplication { | ||
pub id: ICApplicationId, | ||
pub blob: ICBlobId, | ||
pub size: u64, | ||
pub source: String, | ||
pub metadata: Vec<u8>, | ||
} | ||
|
||
#[derive(CandidType, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] | ||
pub struct ICApplicationId(pub [u8; 32]); | ||
|
||
#[derive(CandidType, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] | ||
pub struct ICBlobId(pub [u8; 32]); | ||
|
||
impl ICApplicationId { | ||
pub fn new(bytes: [u8; 32]) -> Self { | ||
Self(bytes) | ||
} | ||
} | ||
|
||
impl ICBlobId { | ||
pub fn new(bytes: [u8; 32]) -> Self { | ||
Self(bytes) | ||
} | ||
} |
Oops, something went wrong.