Contract b8b1d1284572d91015f94fcecc8a4b1bcaf0f7931260bb5fa35dcd681b8ca15c

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.4#1d4afb3b981a4f4b2bbc19f0ce38af85c4ab316a
rsver 1.85.1

Instances

  • CCVD36CDZ4QQDDIPI7BNGJBXALP6X7ZAK7JFHDDNXROKQTO6ORTASQIY

Interface

Constructor

Initializes the contract.

Parameters

  • e: The environment.
  • admin: The address of the admin.
fn __constructor(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Name

Gets the name of the contract.

Parameters

  • e: The environment.

Returns

  • String: The name of the contract.
fn name(env: soroban_sdk::Env) -> soroban_sdk::String

Version

Gets the version of the contract.

Parameters

  • e: The environment.

Returns

  • String: The version of the contract.
fn version(env: soroban_sdk::Env) -> soroban_sdk::String

Upgrade

Upgrades the contract.

Parameters

  • e: The environment.
  • upgrader: The address of the upgrader.
  • new_wasm_hash: The hash of the new WASM.

Returns

  • Result<(), Error>: The result of the upgrade operation.
fn upgrade(
    env: soroban_sdk::Env,
    upgrader: soroban_sdk::Address,
    new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>

Has Role

Checks if an account has a role.

Parameters

  • e: The environment.
  • account: The address of the account.
  • role: The role to check.

Returns

  • bool: True if the account has the role, false otherwise.
fn has_role(env: soroban_sdk::Env, account: soroban_sdk::Address, role: Role) -> bool

Grant Role

Grants a role to an account.

Parameters

  • e: The environment.
  • admin: The address of the admin granting the role.
  • account: The address of the account receiving the role.
  • role: The role to be granted.

Returns

  • Result<(), Error>: The result of the grant operation.
fn grant_role(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    account: soroban_sdk::Address,
    role: Role,
) -> Result<(), soroban_sdk::Error>

Revoke Role

Revokes a role from an account.

Parameters

  • e: The environment.
  • admin: The address of the admin revoking the role.
  • account: The address of the account losing the role.
  • role: The role to be revoked.

Returns

  • Result<(), Error>: The result of the revoke operation.
fn revoke_role(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    account: soroban_sdk::Address,
    role: Role,
) -> Result<(), soroban_sdk::Error>

Get Invoices Count

Gets the total number of invoices.

Parameters

  • e: The environment.

Returns

  • u128: The total number of invoices.
fn get_invoices_count(env: soroban_sdk::Env) -> u128

Get Invoice

Gets an invoice by its ID.

Parameters

  • e: The environment.
  • invoice_id: The ID of the invoice.

Returns

  • Result<Invoice, Error>: The invoice or an error.
fn get_invoice(
    env: soroban_sdk::Env,
    invoice_id: u128,
) -> Result

Get Invoice Token Config

Gets the invoice token config.

Parameters

  • e: The environment.
  • token_id: The address of the token.

Returns

  • InvoiceTokenConfig: The invoices config.
fn get_invoice_token_config(
    env: soroban_sdk::Env,
    token_id: soroban_sdk::Address,
) -> Result

Set Invoice Token Config

Sets the invoice token config.

Parameters

  • e: The environment.
  • admin: The address of the admin setting the config.
  • token_id: The address of the token.
  • min_amount: The new minimum amount for invoices.

Returns

  • Result<(), Error>: The result of the set operation.
fn set_invoice_token_config(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token_id: soroban_sdk::Address,
    min_amount: i128,
) -> Result<(), soroban_sdk::Error>

Remove Invoice Token Config

Removes the invoice token config.

Parameters

  • e: The environment.
  • admin: The address of the admin removing the config.
  • token_id: The address of the token.

Returns

  • Result<(), Error>: The result of the remove operation.
fn remove_invoice_token_config(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token_id: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Send Invoice

Sends an invoice.

Parameters

  • e: The environment.
  • sender: The address of the sender.
  • token_id: The address of the token.
  • amount: The amount of the invoice.
  • managers: A list of manager addresses controlling the invoice.
  • expiration_ledger: The expiration ledger for approving the invoice.

Returns

  • Result<(), Error>: The empty result or an error.
fn send_invoice(
    env: soroban_sdk::Env,
    invoice_id: u128,
    sender: soroban_sdk::Address,
    token_id: soroban_sdk::Address,
    amount: i128,
    managers: soroban_sdk::Vec,
    expiration_ledger: u32,
) -> Result<(), soroban_sdk::Error>

Refund Invoice

Refunds an invoice.

Parameters

  • e: The environment.
  • invoice_id: The ID of the invoice to be refunded.

Returns

  • Result<(), Error>: The result of the refund operation.
fn refund_invoice(
    env: soroban_sdk::Env,
    invoice_id: u128,
) -> Result<(), soroban_sdk::Error>

Get Deals Count

Gets the total number of deals.

Parameters

  • e: The environment.

Returns

  • u128: The total number of deals.
fn get_deals_count(env: soroban_sdk::Env) -> u128

Get Deal

Gets a deal by its ID.

Parameters

  • e: The environment.
  • deal_id: The ID of the deal.

Returns

  • Result<Deal, Error>: The deal or an error.
fn get_deal(env: soroban_sdk::Env, deal_id: u128) -> Result

Create Deal

Creates a deal.

Parameters

  • e: The environment.
  • deal_id: The ID of the deal.
  • manager: The address of the manager creating the deal.
  • type_: The type of the deal.
  • metadata_uri: The URI of the deal metadata.
  • metadata_hash: The hash of the deal metadata.
  • invoice_ids: A list of invoice IDs associated with the deal.

Returns

  • Result<(), Error>: The empty result or an error.
fn create_deal(
    env: soroban_sdk::Env,
    deal_id: u128,
    manager: soroban_sdk::Address,
    type_: DealType,
    metadata_uri: soroban_sdk::String,
    metadata_hash: soroban_sdk::BytesN<32>,
    invoice_ids: soroban_sdk::Vec,
) -> Result<(), soroban_sdk::Error>

Update Deal

Updates a deal.

Parameters

  • e: The environment.
  • deal_id: The ID of the deal to be updated.
  • new_status: The new status of the deal.
  • new_metadata_uri: The new URI of the deal metadata.
  • new_metadata_hash: The new hash of the deal metadata.

Returns

  • Result<(), Error>: The result of the update operation.
fn update_deal(
    env: soroban_sdk::Env,
    deal_id: u128,
    new_status: DealStatus,
    new_metadata_uri: soroban_sdk::String,
    new_metadata_hash: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>

Cancel Deal

Cancels a deal.

Parameters

  • e: The environment.
  • deal_id: The ID of the deal to be canceled.

Returns

  • Result<(), Error>: The result of the cancel operation.
fn cancel_deal(env: soroban_sdk::Env, deal_id: u128) -> Result<(), soroban_sdk::Error>

Payout Deal

Payouts a deal.

Parameters

  • e: The environment.
  • deal_id: The ID of the deal to be paid out.
  • system_wallet: The address of the system wallet.
  • system_fee_amount: The system fee amount.
  • broker_wallet: The address of the broker wallet.
  • broker_fee_amount: The broker fee amount.
  • remaining_wallet: The address of the remaining wallet.

Returns

  • Result<(), Error>: The result of the payout operation.
fn payout_deal(
    env: soroban_sdk::Env,
    deal_id: u128,
    system_wallet: soroban_sdk::Address,
    system_fee_amounts: soroban_sdk::Vec,
    broker_wallet: soroban_sdk::Address,
    broker_fee_amounts: soroban_sdk::Vec,
    remaining_wallet: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Imports

WebAssembly Text (WAT) ▶