Returns the admin address.
fn get_admin(env: soroban_sdk::Env) -> Option
Check if contract is currently paused
fn is_paused(env: soroban_sdk::Env) -> bool
Initialize the contract with an admin address. Can only be called once.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), ContractError>
Check if a credential has expired.
fn is_expired(env: soroban_sdk::Env, worker: soroban_sdk::Address) -> bool
Check if a specific credential has been revoked.
fn is_revoked(env: soroban_sdk::Env, worker: soroban_sdk::Address) -> bool
Step 2: Proposed admin accepts the role.
fn accept_admin(env: soroban_sdk::Env) -> Result<(), ContractError>
Admin-only: manually set a worker to Admin-Verified (highest tier).
fn admin_verify(
env: soroban_sdk::Env,
worker: soroban_sdk::Address,
) -> Result<(), ContractError>
Admin-only: revoke multiple credentials in a single transaction. Limited to MAX_BATCH_SIZE to prevent gas exhaustion.
fn batch_revoke(
env: soroban_sdk::Env,
workers: soroban_sdk::Vec,
) -> Result
Step 1: Current admin proposes a new admin.
fn propose_admin(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
) -> Result<(), ContractError>
Return credential data if it exists and is not revoked.
fn get_credential(
env: soroban_sdk::Env,
worker: soroban_sdk::Address,
) -> Option
Simple existence check (includes revoked).
fn has_credential(env: soroban_sdk::Env, worker: soroban_sdk::Address) -> bool
Emergency pause for the entire contract system in case of active attack.
fn pause_contract(env: soroban_sdk::Env) -> Result<(), ContractError>
Resume the contract after an emergency.
fn resume_contract(env: soroban_sdk::Env) -> Result<(), ContractError>
Returns current active (non-revoked) credential count.
fn get_active_count(env: soroban_sdk::Env) -> u32
Mint a new soulbound credential for a worker. Validates all input lengths. Worker must authenticate. Credential expires after 1 year automatically.
fn issue_credential(
env: soroban_sdk::Env,
worker: soroban_sdk::Address,
name: soroban_sdk::String,
skill: soroban_sdk::String,
city: soroban_sdk::String,
exp: u32,
bio: soroban_sdk::String,
) -> Result<(), ContractError>
Worker can renew their credential before or after expiry. Extends validity by another year from current time.
fn renew_credential(
env: soroban_sdk::Env,
worker: soroban_sdk::Address,
) -> Result<(), ContractError>
Admin-only: revoke a worker's credential.
fn revoke_credential(
env: soroban_sdk::Env,
worker: soroban_sdk::Address,
) -> Result<(), ContractError>
Worker-only: update own credential data. Cannot update if revoked or expired.
fn update_credential(
env: soroban_sdk::Env,
worker: soroban_sdk::Address,
name: soroban_sdk::String,
skill: soroban_sdk::String,
city: soroban_sdk::String,
exp: u32,
bio: soroban_sdk::String,
) -> Result<(), ContractError>
Extend TTL of core contract state (admin, counters, etc.).
fn extend_instance_ttl(env: soroban_sdk::Env)
Returns true if a credential exists and is not revoked and not expired.
fn is_credential_valid(env: soroban_sdk::Env, worker: soroban_sdk::Address) -> bool
Returns total number of credentials ever issued.
fn get_credential_count(env: soroban_sdk::Env) -> u32
Upgrade a worker's verification level based on endorsement metrics. Called externally (e.g., by reputation contract or frontend).
fn upgrade_verification(
env: soroban_sdk::Env,
worker: soroban_sdk::Address,
endorsement_count: u32,
avg_rating: u32,
) -> Result
Extend the TTL of a worker's credential storage. Important for Soroban persistent storage lifecycle.
fn extend_credential_ttl(
env: soroban_sdk::Env,
worker: soroban_sdk::Address,
) -> Result<(), ContractError>
Returns the verification level of a worker (0-3).
fn get_verification_level(env: soroban_sdk::Env, worker: soroban_sdk::Address) -> u32