-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VC Issuance] Use persistent storage for VCs and Revocations (#181)
* Update vc_issuance_contract * Update Readme * Update CI to coverage
- Loading branch information
1 parent
f77d75e
commit 31507bc
Showing
7 changed files
with
85 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
use soroban_sdk::{contracttype, String}; | ||
use crate::error::ContractError; | ||
use crate::storage; | ||
use soroban_sdk::{contracttype, panic_with_error, Env, String}; | ||
|
||
#[contracttype] | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct Revocation { | ||
pub vc_id: String, | ||
pub date: String, | ||
} | ||
|
||
pub fn revoke_vc(e: &Env, vc_id: String, date: String) { | ||
let mut revocations = storage::read_vcs_revocations(e); | ||
|
||
if revocations.contains_key(vc_id.clone()) { | ||
panic_with_error!(e, ContractError::VCAlreadyRevoked) | ||
} | ||
revocations.set(vc_id.clone(), Revocation { vc_id, date }); | ||
storage::write_vcs_revocations(e, &revocations); | ||
} |
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