Skip to content

Commit

Permalink
feature: working on possibility of checking attestation
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Apr 30, 2024
1 parent 1a4dc91 commit 46eaeef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions crates/erc20_payment_lib/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub struct Attestation {
pub time: DateTime<Utc>,
pub expiration_time: Option<DateTime<Utc>>,
pub revocation_time: Option<DateTime<Utc>>,
pub refUID: H256,
pub ref_uid: H256,
pub recipient: Address,
pub attester: Address,
pub revocable: bool,
Expand Down Expand Up @@ -222,7 +222,7 @@ pub async fn get_attestation_details(
.ok_or(err_custom_create!("Attestation timestamp out of range"))?,
expiration_time: datetime_from_u256_with_option(decoded[3].clone().into_uint().unwrap()),
revocation_time: datetime_from_u256_with_option(decoded[4].clone().into_uint().unwrap()),
refUID: H256::from_slice(decoded[5].clone().into_fixed_bytes().unwrap().as_slice()),
ref_uid: H256::from_slice(decoded[5].clone().into_fixed_bytes().unwrap().as_slice()),
recipient: decoded[6].clone().into_address().unwrap(),
attester: decoded[7].clone().into_address().unwrap(),
revocable: decoded[8].clone().into_bool().unwrap(),
Expand Down
4 changes: 1 addition & 3 deletions crates/erc20_payment_lib/src/server/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ struct AttestationItemInfo {

#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct AttestationCheckResult {
pub struct AttestationCheckResult {
chain_id: u64,
chain: String,
attestation: Attestation,
Expand All @@ -1246,8 +1246,6 @@ pub async fn check_attestation(
data: Data<Box<ServerData>>,
req: HttpRequest,
) -> actix_web::Result<web::Json<AttestationCheckResult>> {
let _my_data = data.shared_state.lock().unwrap();

let attestation_uid = req.match_info().get("uid").unwrap_or("");
let chain_name = req.match_info().get("chain").unwrap_or("");
let chain: &ChainSetup = data
Expand Down
5 changes: 2 additions & 3 deletions src/actions/attestation/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,13 @@ pub async fn check_attestation_local(

let items = attestation_schema
.schema
.split(",")
.into_iter()
.split(',')
.collect::<Vec<&str>>();
log::debug!("There are {} items in the schema", items.len());
let mut param_types = Vec::new();
let mut param_names = Vec::new();
for item in items {
let items2 = item.trim().split(" ").into_iter().collect::<Vec<&str>>();
let items2 = item.trim().split(' ').collect::<Vec<&str>>();
if items2.len() != 2 {
log::error!("Invalid item in schema: {}", item);
return Err(err_custom_create!("Invalid item in schema: {}", item));
Expand Down

0 comments on commit 46eaeef

Please sign in to comment.