Compare commits

..

1 Commits

Author SHA1 Message Date
89d40a07ee
add support for operators 2025-02-13 19:41:27 +02:00
3 changed files with 5 additions and 10 deletions

@ -285,7 +285,7 @@ impl BrainData {
operator: &str, operator: &str,
uuid: &str, uuid: &str,
reason: &str, reason: &str,
) -> Result<u64, Error> { ) -> Result<(), Error> {
let contract = self.find_contract_by_uuid(uuid)?; let contract = self.find_contract_by_uuid(uuid)?;
let mut operator_data = self let mut operator_data = self
.operators .operators
@ -332,7 +332,7 @@ impl BrainData {
}) })
.await?; .await?;
Ok(refund_ammount) Ok(())
} }
pub fn ban_user(&self, operator: &str, user: &str) { pub fn ban_user(&self, operator: &str, user: &str) {

@ -301,14 +301,14 @@ impl BrainCli for BrainCliMock {
} }
} }
async fn kick_contract(&self, req: Request<KickReq>) -> Result<Response<KickResp>, Status> { async fn kick_contract(&self, req: Request<KickReq>) -> Result<Response<Empty>, Status> {
let req = check_sig_from_req(req)?; let req = check_sig_from_req(req)?;
match self match self
.data .data
.kick_contract(&req.operator_wallet, &req.contract_uuid, &req.reason) .kick_contract(&req.operator_wallet, &req.contract_uuid, &req.reason)
.await .await
{ {
Ok(nano_lp) => Ok(Response::new(KickResp { nano_lp })), Ok(()) => Ok(Response::new(Empty {})),
Err(e) => Err(Status::permission_denied(e.to_string())), Err(e) => Err(Status::permission_denied(e.to_string())),
} }
} }

@ -244,11 +244,6 @@ message BanUserReq {
string user_wallet = 2; string user_wallet = 2;
} }
message KickResp {
uint64 nano_lp = 1;
}
service BrainCli { service BrainCli {
rpc GetBalance (Pubkey) returns (AccountBalance); rpc GetBalance (Pubkey) returns (AccountBalance);
rpc NewVm (NewVmReq) returns (NewVmResp); rpc NewVm (NewVmReq) returns (NewVmResp);
@ -262,7 +257,7 @@ service BrainCli {
rpc ListOperators (Empty) returns (stream ListOperatorsResp); rpc ListOperators (Empty) returns (stream ListOperatorsResp);
rpc InspectOperator (Pubkey) returns (InspectOperatorResp); rpc InspectOperator (Pubkey) returns (InspectOperatorResp);
rpc RegisterOperator (RegOperatorReq) returns (Empty); rpc RegisterOperator (RegOperatorReq) returns (Empty);
rpc KickContract (KickReq) returns (KickResp); rpc KickContract (KickReq) returns (Empty);
rpc BanUser (BanUserReq) returns (Empty); rpc BanUser (BanUserReq) returns (Empty);
// admin commands // admin commands
rpc Airdrop (AirdropReq) returns (Empty); rpc Airdrop (AirdropReq) returns (Empty);