Constructor
Initializes the contract.
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.
e: The environment.String: The name of the contract.fn name(env: soroban_sdk::Env) -> soroban_sdk::String
Version
Gets the version of the contract.
e: The environment.String: The version of the contract.fn version(env: soroban_sdk::Env) -> soroban_sdk::String
Upgrade
Upgrades the contract.
e: The environment.upgrader: The address of the upgrader.new_wasm_hash: The hash of the new WASM.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.
e: The environment.account: The address of the account.role: The role to check.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.
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.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.
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.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.
e: The environment.u128: The total number of invoices.fn get_invoices_count(env: soroban_sdk::Env) -> u128
Get Invoice
Gets an invoice by its ID.
e: The environment.invoice_id: The ID of the invoice.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.
e: The environment.token_id: The address of the token.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.
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.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.
e: The environment.admin: The address of the admin removing the config.token_id: The address of the token.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.
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.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.
e: The environment.invoice_id: The ID of the invoice to be refunded.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.
e: The environment.u128: The total number of deals.fn get_deals_count(env: soroban_sdk::Env) -> u128
Get Deal
Gets a deal by its ID.
e: The environment.deal_id: The ID of the deal.Result<Deal, Error>: The deal or an error.fn get_deal(env: soroban_sdk::Env, deal_id: u128) -> Result
Create Deal
Creates a deal.
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.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.
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.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.
e: The environment.deal_id: The ID of the deal to be canceled.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.
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.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>