-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
76 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use crate::contracts::{generated::summa_contract::AddressOwnershipProof, signer::SummaSigner}; | ||
use ethers::types::Address; | ||
use std::{error::Error, result::Result}; | ||
|
||
use super::csv_parser::parse_signature_csv; | ||
|
||
pub struct AddressOwnership { | ||
address_ownership_proofs: Vec<AddressOwnershipProof>, | ||
signer: SummaSigner, | ||
} | ||
|
||
impl AddressOwnership { | ||
pub fn new( | ||
signer_key: &str, | ||
chain_id: u64, | ||
rpc_url: &str, | ||
summa_sc_address: Address, | ||
signature_csv_path: &str, | ||
) -> Result<AddressOwnership, Box<dyn Error>> { | ||
let address_ownership_proofs = parse_signature_csv(signature_csv_path)?; | ||
|
||
Ok(AddressOwnership { | ||
address_ownership_proofs, | ||
signer: SummaSigner::new(&[], signer_key, chain_id, rpc_url, summa_sc_address), | ||
}) | ||
} | ||
|
||
// This function dispatches the proof of address ownership. Before calling this function, | ||
// ensure externally that the provided `addresses` in `address_ownership_proof` are not already registered | ||
// on the Summa contract. | ||
pub async fn dispatch_proof_of_address_ownership(&mut self) -> Result<(), Box<dyn Error>> { | ||
self.signer | ||
.submit_proof_of_address_ownership(self.address_ownership_proofs.clone()) | ||
.await?; | ||
|
||
Ok(()) | ||
} | ||
} |
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,4 +1,3 @@ | ||
address;signature | ||
0x70997970C51812dc3A010C7d01b50e0d17dc79C8;0xb17a9e25265d3b88de7bfad81e7accad6e3d5612308ff83cc0fef76a34152b0444309e8fc3dea5139e49b6fc83a8553071a7af3d0cfd3fb8c1aea2a4c171729c1c | ||
0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC;0x089b32327d332c295dc3b8873c205b72153211de6dc1c51235782b091cefb9d06d6df2661b86a7d441cd322f125b84901486b150e684221a7b7636eb8182af551b | ||
0x90F79bf6EB2c4f870365E785982E1f101E93b906;0xeb648c7409f45ba9064707d22bdae23dff15517aaf0942b8507b60b9a924bbeb4c8f2ceafc26ede9fd9eb3232cc138500ded3e3c7b8555fa43b995bd15c234ff1c | ||
chain;address;signature;message | ||
ETH;0x70997970C51812dc3A010C7d01b50e0d17dc79C8;0x089b32327d332c295dc3b8873c205b72153211de6dc1c51235782b091cefb9d06d6df2661b86a7d441cd322f125b84901486b150e684221a7b7636eb8182af551b;Summa proof of solvency for CryptoExchange | ||
ETH;0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC;0xb17a9e25265d3b88de7bfad81e7accad6e3d5612308ff83cc0fef76a34152b0444309e8fc3dea5139e49b6fc83a8553071a7af3d0cfd3fb8c1aea2a4c171729c1c;Summa proof of solvency for CryptoExchange |
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,4 +1,4 @@ | ||
pub mod address_ownership; | ||
mod csv_parser; | ||
mod fetch; | ||
pub mod ownership; | ||
pub mod round; |
This file was deleted.
Oops, something went wrong.
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