pub struct DeploymentGuard { /* private fields */ }Expand description
The deployment guard enforces pre-deployment security checks.
Implementations§
Source§impl DeploymentGuard
impl DeploymentGuard
Sourcepub fn new(
config: &ProjectConfig,
security_engine: &SecurityEngine,
) -> Result<Self, ForgeGuardError>
pub fn new( config: &ProjectConfig, security_engine: &SecurityEngine, ) -> Result<Self, ForgeGuardError>
Create a new deployment guard.
Sourcepub fn run_pre_deployment_checks(
&self,
config: &ProjectConfig,
chain_registry: &ChainRegistry,
) -> Result<Vec<Finding>, ForgeGuardError>
pub fn run_pre_deployment_checks( &self, config: &ProjectConfig, chain_registry: &ChainRegistry, ) -> Result<Vec<Finding>, ForgeGuardError>
Run all pre-deployment checks and return findings.
Sourcepub fn can_deploy(
&self,
findings: &[Finding],
overall_score: u8,
risk_level: RiskLevel,
) -> bool
pub fn can_deploy( &self, findings: &[Finding], overall_score: u8, risk_level: RiskLevel, ) -> bool
Determine if deployment should be allowed.
Sourcepub fn calculate_overall_score(&self, scores: &SecurityScores) -> u8
pub fn calculate_overall_score(&self, scores: &SecurityScores) -> u8
Calculate overall security score.
Sourcepub fn determine_risk_level(&self, score: u8, findings: &[Finding]) -> RiskLevel
pub fn determine_risk_level(&self, score: u8, findings: &[Finding]) -> RiskLevel
Determine risk level from score and findings.
Sourcepub fn build_result(
&self,
findings: Vec<Finding>,
scores: SecurityScores,
overall_score: u8,
risk_level: RiskLevel,
source_count: usize,
) -> AuditResult
pub fn build_result( &self, findings: Vec<Finding>, scores: SecurityScores, overall_score: u8, risk_level: RiskLevel, source_count: usize, ) -> AuditResult
Build a deployment decision result.
Sourcepub fn verify_contract(
&self,
address: &str,
contract_name: &str,
constructor_args: Option<&str>,
) -> Result<VerificationResult, ForgeGuardError>
pub fn verify_contract( &self, address: &str, contract_name: &str, constructor_args: Option<&str>, ) -> Result<VerificationResult, ForgeGuardError>
Verify a contract after deployment.
Returns Ok(true) if verification passed, Ok(false) if not required,
or an error if verification failed.
Sourcepub fn verify_bytecode(
&self,
address: &str,
contract_name: &str,
rpc_url: &str,
) -> VerificationResult
pub fn verify_bytecode( &self, address: &str, contract_name: &str, rpc_url: &str, ) -> VerificationResult
Verify bytecode match via RPC.
Auto Trait Implementations§
impl !RefUnwindSafe for DeploymentGuard
impl !UnwindSafe for DeploymentGuard
impl Freeze for DeploymentGuard
impl Send for DeploymentGuard
impl Sync for DeploymentGuard
impl Unpin for DeploymentGuard
impl UnsafeUnpin for DeploymentGuard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more