OpenAgentID documentation
Source referencesRust module referenceopenagent-aegis-policy

openagent-aegis-policy · contract

Declared module signatures, types, configuration, and source documentation.

Source: aegis/openagent-aegis-policy/src/contract.rs. SHA-256: 9d21e57d47b6f7c9f646d2cf8eba95976db130f12ab31b6a297e6482e9951c03.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

contract::ContractPolicy

Contract interaction policy dimensions.

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct ContractPolicy {
/// Allowed contract addresses. Empty list means all contracts are permitted.

pub contract_allowlist: Vec<String>,
/// Allowed function names. Empty list means all functions are permitted.

pub function_allowlist: Vec<String>,
/// Allowed blockchain chains. Empty list means all chains are permitted.

pub chain_allowlist: Vec<String>,
/// Maximum gas allowed for the interaction. None means no gas limit.

pub gas_limit: Option<u64>
}

Source line: 15.

contract::ContractInteraction

A contract interaction to evaluate against policy.

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct ContractInteraction {
/// The target contract address.

pub contract_address: String,
/// The function being called.

pub function_name: String,
/// The blockchain chain for this interaction.

pub chain: String,
/// Estimated gas usage. None if unknown.

pub gas_estimate: Option<u64>
}

Source line: 28.

contract::ContractPolicyEvaluator

Evaluates contract interaction policy constraints.

pub struct ContractPolicyEvaluator;

Source line: 40.

contract::ContractPolicyEvaluator::evaluate

Evaluate a contract interaction against the given policy.

Checks the following dimensions in order:

  1. Contract allowlist -- the contract address must be in the allowed set.
  2. Function allowlist -- the function name must be in the allowed set.
  3. Chain allowlist -- the chain must be in the allowed set.
  4. Gas limit -- the gas estimate must not exceed the limit.

Empty allowlists are permissive (all values accepted). Returns a deny PolicyDecision with reason on the first violation found. Returns an allow PolicyDecision on success.

pub fn evaluate(
        policy: &ContractPolicy,
        interaction: &ContractInteraction,
    ) -> Result<PolicyDecision, PolicyError>;

Source line: 54.

On this page