Add app argument for RLN Smart contract address

This commit is contained in:
sydhds
2025-06-06 15:06:31 +02:00
parent 8992557443
commit 0d390f23b2
3 changed files with 7 additions and 4 deletions

View File

@@ -17,11 +17,13 @@ pub struct AppArgs {
)]
pub(crate) port: u16,
#[arg(
short = 'r',
short = 'u',
long = "ws_rpc_url",
help = "Websocket rpc url (e.g. wss://eth-mainnet.g.alchemy.com/v2/your-api-key)"
)]
pub(crate) ws_rpc_url: Url,
#[arg(short = 'k', long = "ksc", help = "Karma smart contract address")]
pub(crate) ksc_address: Address,
#[arg(short = 'r', long = "rlnsc", help = "RLN smart contract address")]
pub(crate) rlnsc_address: Address,
}

View File

@@ -292,6 +292,7 @@ pub(crate) struct GrpcProverService {
pub rln_identifier: RlnIdentifier,
pub user_db: UserDb,
pub karma_sc_info: (Url, Address),
pub rln_sc_info: (Url, Address),
}
impl GrpcProverService {
@@ -299,7 +300,7 @@ impl GrpcProverService {
let karma_sc =
KarmaSCInstance::try_new(self.karma_sc_info.0.clone(), self.karma_sc_info.1).await?;
let karma_rln_sc =
KarmaRLNSCInstance::try_new(self.karma_sc_info.0.clone(), self.karma_sc_info.1).await?;
KarmaRLNSCInstance::try_new(self.rln_sc_info.0.clone(), self.rln_sc_info.1).await?;
let prover_service = ProverService {
proof_sender: self.proof_sender.clone(),

View File

@@ -68,7 +68,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
);
// Smart contract
// let karma_sc_address = address!("1f9840a85d5aF5bf1D1762F925BDADdC4201F984");
let registry_listener = RegistryListener::new(
app_args.ws_rpc_url.as_str(),
@@ -95,7 +94,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
addr,
rln_identifier,
user_db: user_db_service.get_user_db(),
karma_sc_info: (app_args.ws_rpc_url, app_args.ksc_address),
karma_sc_info: (app_args.ws_rpc_url.clone(), app_args.ksc_address),
rln_sc_info: (app_args.ws_rpc_url, app_args.rlnsc_address),
};
let mut set = JoinSet::new();