Contract 524d179cd9d5dba6d6eec897559ffc50e3826a0c5de444918302ff69bbac45a2

← Back to Index 📥 Download WASM

Meta

cliver 23.2.1#496ac35be7a7d8d923fcde9bbbc650ee593d1f6f
rssdkver 22.0.7#211569aa49c8d896877dfca1f2eb4fe9071121c8
rsver 1.91.1

Instances

  • CA75NIV5UJI4SIKECH2V2OWJJAZY3WFE2P6GDQL4LRSHGHC4QZLJ3N5P
  • CA7MPDP6627XMHHEMGPXKFD3GB4P7ECHZL7TMTJG5Y4DAD6CTAI4EOJH
  • CADPDVBPKWA3Y7OTBHANO3R54IXXMAK4UDFWBXIYE5QITILTZ5VVCWBF
  • CAGIVIM3KWNOSNYLY7TFSFFON6KRWNK46CEXALWFCPMR5LUVVOKVM3S6
  • CAGZPJLKJ2ON4K3XYDMM5ESES2ULEEOU37TDUBWISIZE4HABYFWEQHFL
  • CAI2TRXFTFHBOIYYCP622UOJ4YHC2YMRVNUOHWWMKTIR6SV6ATRUN4UO
  • CAJAF5VKEEF73HA6B6M3WXYA43GY4W2U4ENUKN6XH5BMLR4VHWFMM63O
  • CAM4JGECUYWDBXQFW6CUNYQZ7IDHC4YRTQZEHOMZX2MLFI5QIQ6KROYC
  • CAO6JM6JGWNSUC7BXAUKXKE6ZCHTVWWYK4Q7M6XTSJDZF7Y332RE35I5
  • CAUABDDUGLUO62CC3IJYSNNJPGUIOQIFDNTQ4HKJ5G6AE5AX2QUKHKJ7
  • CAV4MC7LGCFED5D52OEDCNPFF5QWMX6Z43GMRZHEM24ZGPY3ZDURBA2A
  • CAY3CTUI3ZP2HFYTE7BC7UG6QTVUHC4WJGHURK576L6WGEZ6IBW76OY2
  • CAYPSY5AHJYMOXTFRRBQXUFSE737OYU2N3SYNSV5ZTZIQZDLUOYZP4JK
  • CAZT5JRR3NKK2OEQEVNNPOXCINMA3JQTXL3MPQQ4FBAYZT5XEIS5J7GS
  • CB6YYC4ICAOFZ5SNW4IFWKGJSGY3DKERJZMYEEMZC7SRJLPXLBUCUGEB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AD5WM3GBSH256S6OGAA
  • CDNBDYH6VBG54SQ3YM7KAV63JJ4TFU6QZYECE4FDIAHUXWM3VO2HSON7
  • CDQNHRHCJYNONXDGRAHGGK5DIUWHJ63GU2RLQWIJZEL6EE7SKMRYARCW
  • CDXSNLALEARZ4S7LZT4URJZQVOUE24M25M3P2ICWGR27GELUOYTGRCE6

Interface

fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
fn version(env: soroban_sdk::Env) -> u32
fn initialize(
    env: soroban_sdk::Env,
    multi_sig: Option,
    usd_token: Option,
    defa: Option,
    invoices_ids: soroban_sdk::Vec,
    borrower_addresses: soroban_sdk::Vec,
    amounts: soroban_sdk::Vec,
    min_amounts: soroban_sdk::Vec,
    pool_values: soroban_sdk::Vec,
) -> (u128, u128)
  • @notice Allows a borrower to repay their loan linked to a specific invoice.
    • @dev Repayment can be either full or partial. The function updates the
    •  outstanding balance of the invoice and adjusts pool state accordingly.
      
    • @param invoice_id Unique identifier of the invoice tied to the loan.
    • @param amount Amount being repaid (can be less than or equal to the outstanding loan).
fn repay_loan(env: soroban_sdk::Env, invoice_id: soroban_sdk::String, amount: u128)
  • @notice Allows a lender to participate in the pool by contributing USD tokens.
    • @dev
      • Transfers USD tokens from the lender to the pool.
      • Issues LP tokens to the lender proportional to their contribution.
      • Updates pool state including total raised amount and lender details.
    • @param lender The address of the lender providing funds.
    • @param amount The amount of USD tokens the lender contributes.
fn participate(env: soroban_sdk::Env, lender: soroban_sdk::Address, amount: u128)
  • @notice Accept the admin role.
    • @dev Can only be called by the pending admin proposed earlier via propose_new_admin().
    •  Once accepted, the pending admin becomes the active admin,
      
    •  and the pending slot is reset to zero.
      
fn accept_admin(env: soroban_sdk::Env)
  • @notice Executes a pool by allocating funds to the specified invoices.
    • @dev Used when the pool becomes active. Distributes or locks capital
    •  against the provided invoice IDs with their respective amounts.
      
    • @param invoicesids Array of invoice identifiers to be executed within the pool.
    • @param amounts Array of amounts to be allocated for each corresponding invoice.
fn execute_pool(
    env: soroban_sdk::Env,
    invoicesids: soroban_sdk::Vec,
    amounts: soroban_sdk::Vec,
)
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    im_reciver: soroban_sdk::Address,
    logger_contract: soroban_sdk::Address,
    token_multiplier: u128,
)
  • @notice Allows a lender to claim their LP tokens after repayment.
    • @dev Once borrowers repay, lenders can claim LP tokens that represent
    •  their share of the repayment and yield. The distribution is done
      
    •  proportionally based on each lender’s pool share.
      
    • @param lender_addr Address of the lender claiming their LP tokens.
fn claim_lp_token(env: soroban_sdk::Env, lender_addr: soroban_sdk::Address)
  • @notice Fills the insurance fund for specific invoices.
    • @dev Only callable by the admin (secured with onlyAdminSafe).
    •  The insurance amount is funded from the admin/treasury wallet
      
    •  and credited to the pool contract. These funds act as protection
      
    •  for lenders in case of borrower default.
      
    • @param invoices Array of invoice identifiers that will be insured.
    • @param amounts Array of insurance amounts allocated to each corresponding invoice.
fn fill_insurance(
    env: soroban_sdk::Env,
    invoices: soroban_sdk::Vec,
    amounts: soroban_sdk::Vec,
)
  • @notice Returns the total claimable amount for a given lender.
    • @param lender Address of the lender whose claimable amount is queried.
    • @return u128 The total claimable amount for the lender.
fn get_claimables(env: soroban_sdk::Env, lender: soroban_sdk::Address) -> u128
fn pause_contract(env: soroban_sdk::Env)
  • @notice Allows a lender to claim insurance compensation from the pool.
    • @dev Can be called when a borrower defaults and the pool has
    •  allocated insurance funds. The function transfers the
      
    •  insured portion of the lender’s loss back to their wallet.
      
    • @param lender_addr Address of the lender claiming insurance coverage.
fn claim_insurance(env: soroban_sdk::Env, lender_addr: soroban_sdk::Address)
  • @notice Allows a lender to claim their liquidity back from the pool.
    • @dev Typically called after borrower repayments.
    • @param lender_addr Address of the lender claiming their liquidity share.
fn claim_liquidity(env: soroban_sdk::Env, lender_addr: soroban_sdk::Address)
  • @notice Sets the pool APY and (IM) APY.
    • @dev Can only be called by the admin before the pool is executed.
    •  Both values are scaled by 1e10 for precision in calculations.
      
    •  Emits an {UpdatePercentage} event after updating.
      
    • @param per1 Base pool APY (annual percentage yield).
    • @param per2 IM APY.
fn set_percentages(env: soroban_sdk::Env, per1: u128, per2: u128)
fn get_pool_metrics(env: soroban_sdk::Env) -> PoolMetrics
  • @notice Reconstructs an existing pool with updated parameters.
    • @dev Used when borrowers fail to fully repay within the original terms,
    •  or when the pool needs restructuring. Updates invoices with new APYs,
      
    •  durations, user states, and IM APYs. New LP tokens or capital
      
    •  adjustments may also be applied depending on the pool logic.
      
    • @param invoice_ids Array of invoice identifiers to be restructured.
    • @param new_apys Array of updated APYs (annual percentage yields)
    •                   applied to each corresponding invoice.
      
    • @param new_durations Array of updated pool durations for each invoice.
    • @param user_states Array of boolean flags indicating borrower states
    •                   (e.g., active, defaulted, or restructured).
      
    • @param new_im_apys Array of updated IM APY values for each invoice.
fn reconstruct_pool(
    env: soroban_sdk::Env,
    invoice_ids: soroban_sdk::Vec,
    new_apys: soroban_sdk::Vec,
    new_durations: soroban_sdk::Vec,
    user_states: soroban_sdk::Vec,
    new_im_apys: soroban_sdk::Vec,
)
fn unpause_contract(env: soroban_sdk::Env)
  • @notice Returns the total claimable DLPs amount for a given lender.
    • @dev Reads the claimAbleAmount stored in the lender’s details.
    •  This represents the amount the lender is entitled to withdraw DLPs
      
    •  (e.g., from repayments, yield, or insurance depending on logic).
      
    • @param _lender Address of the lender whose claimable amount is queried.
    • @return u128 The total claimable amount for the lender.
fn get_claimable_lps(env: soroban_sdk::Env, lender: soroban_sdk::Address) -> u128
  • @notice Returns the shareholding percentage of a lender in the pool.
    • @dev Calculates the lender’s share relative to the total amount raised.
    •  Formula: (lender.poolShare * percentDivider) / amountRaised
      
    •  where `percentDivider` is typically a constant 100* 1e10
      
    •  for precision in percentage calculations.
      
    • @param lender_addr Address of the lender whose shareholding is queried.
    • @return shareHolding Lender’s shareholding expressed as a percentage
    •                     (scaled by `percentDivider`).
      
fn get_share_holding(env: soroban_sdk::Env, lender_addr: soroban_sdk::Address) -> u128
fn initiate_transfer(env: soroban_sdk::Env, to: soroban_sdk::Address, value: u128)
  • @notice Propose a new admin for the contract.
    • @dev Only the current admin can call this function.
    •  The new admin must later accept the role by calling `accept_admin()`.
      
    • @param new_admin The address proposed to become the new admin.
fn propose_new_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
fn emergency_withdraw(env: soroban_sdk::Env, token: soroban_sdk::Address, amount: u128)
fn get_lender_address(
    env: soroban_sdk::Env,
    start: u32,
    end: u32,
) -> soroban_sdk::Vec
  • @notice Returns details of a specific lender in the pool. *
    • @param lender Address of the lender.
    • @return poolShare Lender’s share of the pool.
    • @return claimedLpToken LP tokens already claimed.
    • @return claimedInsurance Insurance already claimed.
    • @return claimedAmount Stablecoin amount already claimed.
    • @return isExists Whether lender record exists.
fn get_lender_details(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
) -> LenderDetails
fn update_im_receiver(
    env: soroban_sdk::Env,
    new_receiver: Option,
)
  • @notice Returns borrower and funding details of a specific invoice. *
    • @param invoice_id Unique identifier of the invoice.
    • @return borrower Borrower address linked to the invoice.
    • @return principalAmount Total principal requested in the invoice.
    • @return minAmount Minimum required funding amount.
    • @return loanStartTime Timestamp when the loan started.
    • @return isExists Whether the invoice record exists.
    • @return amountAllocated Capital allocated from the pool to this invoice.
    • @return repaidAmount Total amount repaid so far.
    • @return fullyPaid Whether the invoice has been fully repaid.
    • @return fundsReceived Whether borrower has received the funds.
fn get_invoice_details(
    env: soroban_sdk::Env,
    invoice_id: soroban_sdk::String,
) -> InvoiceDetails
  • @notice Calculates the total repayment amount for a given invoice. *
    • @param invoice_id Unique identifier of the invoice.
    • @return u128 The repayment amount.
fn get_total_repayment(env: soroban_sdk::Env, invoice_id: soroban_sdk::String) -> u128
fn emergency_close_pool(env: soroban_sdk::Env)
fn get_granted_invoices(env: soroban_sdk::Env) -> soroban_sdk::Vec
  • @notice Updates the LP token contract address used in the pool.
    • @dev Only callable by the treasury wallet. This function can be used in case
    •  of contract upgrades, migrations, or if the LP token address needs to be changed.
      
    •  Cannot be called after any funds have been raised (`AmountRaised > 0`).
      
    • @param lp Address of the new LP token contract.
fn update_token_address(env: soroban_sdk::Env, lp: soroban_sdk::Address)
  • @notice Returns the total claimable Insurance for a given lender.
    • @param _lender Address of the lender whose claimable amount is queried.
    • @return u128 The total claimable amount for the lender.
fn get_claimable_insurance(env: soroban_sdk::Env, lender: soroban_sdk::Address) -> u128
fn update_token_multiplier(env: soroban_sdk::Env, multiplier: u128)
  • @notice Returns payment-related details of a specific invoice.
    • @dev Excludes the nested _invoiceRepaidAmount mapping.
    • @param invoice_id Unique identifier of the invoice.
    • @return _principalToRepay Principal amount that must be repaid.
    • @return _apyToRepay Accrued APY to be repaid.
    • @return _imApyToRepay Invoimate APY fee to be repaid.
    • @return _isDefault Whether the invoice is marked as defaulted.
    • @return _isInsured Whether the invoice is covered by insurance.
    • @return _endTime End time (maturity) of the invoice.
    • @return _amountInsured Amount covered under insurance for this invoice.
fn get_invocie_payment_details(
    env: soroban_sdk::Env,
    invoice_id: soroban_sdk::String,
) -> InvoicePaymentDetails

Imports

WebAssembly Text (WAT) ▶