Contract feec0fc9b566c20928c326339eb20e931b46abfb162e7791ff7d25db1f7069a5

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.6#0c47dcfa187069d241f11fb082730f667b55e802
rsver 1.91.1

Instances

  • CD3K23UGNZACGXKZRS3VKZ7TSN2RU3D5EHA5YAACBW2TDQ4XPXARHUL2

Interface

Adds a role member to a project.

Arguments

  • caller: owner address.
  • project_id: project identifier.
  • role: one of "super_admin", "admin", "ngo", "vendor", "beneficiary".
  • new_member: address to add.

Errors

  • ContractError::InvalidRole
  • ContractError::RoleAlreadyExists
  • ContractError::RoleLimitExceeded
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
fn add_role(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    project_id: soroban_sdk::String,
    role: soroban_sdk::String,
    new_member: soroban_sdk::Address,
) -> Result<(), ContractError>

Gets roles for a project.

Arguments

  • project_id: project identifier.
fn get_roles(env: soroban_sdk::Env, project_id: soroban_sdk::String) -> Roles

Initializes the contract owner.

Arguments

  • owner: address to set as the owner.

Errors

  • ContractError::Unauthorized
  • ContractError::AlreadyInitialized
fn initialize(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
) -> Result<(), ContractError>

Removes a role member from a project.

Arguments

  • caller: owner address.
  • project_id: project identifier.
  • role: role name.
  • member_to_remove: address to remove.

Errors

  • ContractError::InvalidRole
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
fn remove_role(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    project_id: soroban_sdk::String,
    role: soroban_sdk::String,
    member_to_remove: soroban_sdk::Address,
) -> Result<(), ContractError>

Pauses the contract for a short window.

Arguments

  • caller: owner or contract admin.

Errors

  • ContractError::Unauthorized
fn pause_contract(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ContractError>

Unpauses the contract immediately.

Arguments

  • caller: owner or contract admin.

Errors

  • ContractError::Unauthorized
fn unpause_contract(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ContractError>

Adds a global contract admin.

Arguments

  • caller: owner or contract admin.
  • new_admin: address to grant admin rights.

Errors

  • ContractError::RoleAlreadyExists
  • ContractError::RoleLimitExceeded
  • ContractError::Unauthorized
  • ContractError::InvalidInput
fn add_contract_admin(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    new_admin: soroban_sdk::Address,
) -> Result<(), ContractError>

Gets a cash allowance.

Arguments

  • project_id: project identifier.
  • allowee: address.
  • currency: currency code.

Errors

  • ContractError::AllowanceNotFound
  • ContractError::InvalidInput
fn get_cash_allowance(
    env: soroban_sdk::Env,
    project_id: soroban_sdk::String,
    allowee: soroban_sdk::Address,
    currency: soroban_sdk::String,
) -> Result

Gets an item allowance.

Arguments

  • project_id: project identifier.
  • allowee: address.
  • item_id: item identifier.

Errors

  • ContractError::AllowanceNotFound
  • ContractError::InvalidInput
fn get_item_allowance(
    env: soroban_sdk::Env,
    project_id: soroban_sdk::String,
    allowee: soroban_sdk::Address,
    item_id: soroban_sdk::String,
) -> Result

Redeems cash claims credited to a vendor.

Arguments

  • vendor: vendor address.
  • project_id: optional project id (defaults to "default_project").
  • currency: currency code.
  • amount: amount to redeem.

Errors

  • ContractError::AllowanceNotFound
  • ContractError::InsufficientFunds
  • ContractError::ContractPaused
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
fn redeem_cash_claims(
    env: soroban_sdk::Env,
    vendor: soroban_sdk::Address,
    project_id: Option,
    currency: soroban_sdk::String,
    amount: u64,
) -> Result<(), ContractError>

Redeems item claims credited to a vendor.

Arguments

  • vendor: vendor address.
  • project_id: optional project id (defaults to "default_project").
  • item_id: item identifier.
  • quantity: quantity to redeem.

Errors

  • ContractError::AllowanceNotFound
  • ContractError::InsufficientFunds
  • ContractError::ContractPaused
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
fn redeem_item_claims(
    env: soroban_sdk::Env,
    vendor: soroban_sdk::Address,
    project_id: Option,
    item_id: soroban_sdk::String,
    quantity: u64,
) -> Result<(), ContractError>

Claims a cash allowance, optionally crediting a vendor.

Arguments

  • caller: beneficiary address.
  • project_id: project identifier.
  • currency: currency code.
  • amount: positive amount.
  • vendor: optional vendor to credit.

Errors

  • ContractError::AllowanceNotFound
  • ContractError::ExpiredAllowance
  • ContractError::InsufficientFunds
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
fn claim_cash_allowance(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    project_id: soroban_sdk::String,
    currency: soroban_sdk::String,
    amount: u64,
    vendor: Option,
) -> Result<(), ContractError>

Claims an item allowance and credits a vendor.

Arguments

  • caller: beneficiary address.
  • vendor: vendor address.
  • project_id: project identifier.
  • item_id: item identifier.
  • quantity: positive quantity.

Errors

  • ContractError::AllowanceNotFound
  • ContractError::ExpiredAllowance
  • ContractError::InsufficientFunds
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
fn claim_item_allowance(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    vendor: soroban_sdk::Address,
    project_id: soroban_sdk::String,
    item_id: soroban_sdk::String,
    quantity: u64,
) -> Result<(), ContractError>

Removes a global contract admin.

Arguments

  • caller: owner or contract admin.
  • admin: admin address to remove.

Errors

  • ContractError::Unauthorized
fn remove_contract_admin(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    admin: soroban_sdk::Address,
) -> Result<(), ContractError>

Allocates a cash allowance.

Arguments

  • caller: ngo address.
  • project_id: project identifier.
  • allowee: beneficiary/vendor.
  • amount: positive amount.
  • currency: currency code.
  • expiry: future timestamp or none.

Errors

  • ContractError::ContractPaused
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
fn allocate_cash_allowance(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    project_id: soroban_sdk::String,
    allowee: soroban_sdk::Address,
    amount: u64,
    currency: soroban_sdk::String,
    expiry: Option,
) -> Result<(), ContractError>

Allocates an item allowance.

Arguments

  • caller: ngo address.
  • project_id: project identifier.
  • allowee: beneficiary/vendor.
  • item_id: item identifier.
  • quantity: positive quantity.
  • expiry: future timestamp or none.

Errors

  • ContractError::ContractPaused
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
fn allocate_item_allowance(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    project_id: soroban_sdk::String,
    allowee: soroban_sdk::Address,
    item_id: soroban_sdk::String,
    quantity: u64,
    expiry: Option,
) -> Result<(), ContractError>

Lists all cash allowances for a project.

Arguments

  • project_id: project identifier.
fn get_all_cash_allowances(
    env: soroban_sdk::Env,
    project_id: soroban_sdk::String,
) -> soroban_sdk::Map<(soroban_sdk::Address, soroban_sdk::String), CashAllowance>

Lists all item allowances for a project.

Arguments

  • project_id: project identifier.
fn get_all_item_allowances(
    env: soroban_sdk::Env,
    project_id: soroban_sdk::String,
) -> soroban_sdk::Map<(soroban_sdk::Address, soroban_sdk::String), ItemAllowance>

Transfers a cash allowance to another address.

Arguments

  • caller: beneficiary address.
  • project_id: project identifier.
  • new_allowee: recipient address.
  • currency: currency code.
  • amount: positive amount.

Errors

  • ContractError::AllowanceNotFound
  • ContractError::InsufficientFunds
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
  • ContractError::ExpiredAllowance
fn transfer_cash_allowance(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    project_id: soroban_sdk::String,
    new_allowee: soroban_sdk::Address,
    currency: soroban_sdk::String,
    amount: u64,
) -> Result<(), ContractError>

Transfers an item allowance to another address.

Arguments

  • caller: beneficiary address.
  • project_id: project identifier.
  • new_allowee: recipient address.
  • item_id: item identifier.
  • quantity: positive quantity.

Errors

  • ContractError::AllowanceNotFound
  • ContractError::InsufficientFunds
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
  • ContractError::ExpiredAllowance
fn transfer_item_allowance(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    project_id: soroban_sdk::String,
    new_allowee: soroban_sdk::Address,
    item_id: soroban_sdk::String,
    quantity: u64,
) -> Result<(), ContractError>

Sums total cash allowance across projects for a beneficiary.

Arguments

  • beneficiary: address.
  • project_ids: list of project identifiers.

Errors

  • ContractError::InvalidInput if overflow occurs or validation fails
fn get_total_cash_allowance(
    env: soroban_sdk::Env,
    beneficiary: soroban_sdk::Address,
    project_ids: soroban_sdk::Vec,
) -> Result

Sums total item allowance across projects for a beneficiary.

Arguments

  • beneficiary: address.
  • project_ids: list of project identifiers.

Errors

  • ContractError::InvalidInput if overflow occurs or validation fails
fn get_total_item_allowance(
    env: soroban_sdk::Env,
    beneficiary: soroban_sdk::Address,
    project_ids: soroban_sdk::Vec,
) -> Result

Allocates multiple cash allowances.

Arguments

  • caller: ngo address.
  • project_id: project identifier.
  • allowances: tuples of (allowee, currency, amount, expiry).

Errors

  • ContractError::ContractPaused
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
fn allocate_cash_allowances_batch(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    project_id: soroban_sdk::String,
    allowances: soroban_sdk::Vec<
        (soroban_sdk::Address, soroban_sdk::String, u64, Option),
    >,
) -> Result<(), ContractError>

Allocates multiple item allowances.

Arguments

  • caller: ngo address.
  • project_id: project identifier.
  • allowances: tuples of (allowee, item_id, quantity, expiry).

Errors

  • ContractError::ContractPaused
  • ContractError::InvalidInput
  • ContractError::Unauthorized
  • ContractError::ReentrancyDetected
fn allocate_item_allowances_batch(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    project_id: soroban_sdk::String,
    allowances: soroban_sdk::Vec<
        (soroban_sdk::Address, soroban_sdk::String, u64, Option),
    >,
) -> Result<(), ContractError>

Imports

WebAssembly Text (WAT) ▶