Contract c7f454de6029276c48af0047647ac195d0ccfb81a4ac13265f59e1dde19aeef0

← Back to Index 📥 Download WASM

Meta

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

Instances

  • CA6AIESMERKJ4U36D72S2VBZTZQ6AVWATQ54CWGB3PFPWXRH3WIURW6W
  • CA7OL6MYDROFEFFER6YSDJ5COIOOYLWRIX72LSX3V5FEIWADMUXE3RKH
  • CACL4TSTBWNAU5HPGAALWOUSGUDUZQMQUPB2J4YYMTB5BJ7DYHT2NFDC
  • CAKPW35WFUUUCEN25CZO5C243UAEYO4SFPJPEPG7PZLMSURVB5K3I34F
  • CALHECCZO3WZEVNLHQMAW5XRTOYQYBGQE5CCDA3DVPBXEXUUDGMJBDLK
  • CALKNP5YRDU4GX25I6LEHDKLMRBOFPXWLMZ4IIZAAIE3QYVMZ6T4EV2C
  • CAVZ3BKH45RWWAIAJ234N4VNQVP4BQKLMBTOLRKBITXAUYJA2B7TNOWB
  • CB32J4CVURY2EBTTKJXWWIATMQY3CFMEY57BRTXOWMLVYBVSYX5TPBKO
  • CB4B6XWVGWZCXGDXRGFPISTDDFXBIGOMLLO7RXKAXPMKAE6VDR2UNHRE
  • CBAY7EWG6O5F3BTOFCT3Z23AD5QP55HNF7PEQZKTXCXXWJI7OODQTHPA
  • CBCAX7LKYQJW5I7JEWITZU6NFP6JHXN65QIUZ6CVPIW2BR3RCC6AG7JN
  • CBDG7WKUXPU6NXIZOXVDHFGNMM3HXI7WEOZA4ZO4SNF5UMSMGI7Q22K6
  • CBDQD6GUBSQC4Q2UIASPTFR3VRUDUMI6II4TLATO3WKN6JZKSCAUVRGZ
  • CBEY7QIBRGUTB7GZXDDCM3HCYOFVYF4IMS2K7ZI445KVO442DTI5L4QM
  • CBICHN6ZMZWZB427QNCQKGFU6PXAIQZNTLJWOAA6GEN6ZNALMYXEHJIJ
  • CBJ72CBZVWCJRXNTCAX6UB6VJLXFLSS3M4QR7FW6LJZKB6L35WEJXOCE
  • CBJVFA57DU5B6DUMVU6TZ4CLSDARQIGMB7KQZ6PJEGJVKJ7MVQJ2PTEL
  • CBK2IH27KICX25SFXRJDYFK3KDDK5NCBWQ24LUV6N7ZFKQPBHYPBYPJA
  • CBM53CKZTQTUXUPU6TSX5TGABLW4XGOW243RIH4HSV4RDB3DDENCH73O
  • CBMKVLAAMUM36RHQ5YALZPY22LVDVNETJJCY6NSIFGIBHT4TA27USQKJ
  • CBRNUMSABSIP6TLCGGGXHAK347KIXP6DX6IHJ4EXIMX7SNLWURMCCYHS
  • CBVOSSPS55PO22UYOEJIM3QE3S7ORE347TCA5XWOSSTAM36QOVBUH74Z
  • CC4OP6WRRHXB6SRZEJ6X4WCR4QQROEBPRBXHJIF3BOJCHMR3XEO4DSQW
  • CCEKRIINFSDBYZJ3AHYBKEGLKMAL76V2SEUSTM23FFCRUYTIDNHOBTLG
  • CCH62Q4E4XEPGRP7JKQUY4CI2JUP6R6PKJQCIC66U4LAKGWCXJXCWYM2
  • CCKY5XJPSC2PAWS5V5SXR3HWYISOVYDUA6MFTX3WSIULDYYC2UMJUPUO
  • CCTKUO4JTXOHVHKOC2SFWFU754WLLGVYCTZNOQ4IQHVFTHOINDSIOPNO
  • CCXZN3ACDDGIITZW6ASZ44ZKYT3I5SFCFXUNY6JK62VGYH2T7J52YEG3
  • CD2OSFFJYYTGKLPE3YLL3SN6Z75RX2UT5T4M42NYAFJ3Z4RNEHYMFZO4
  • CD4PGUYWTEGJTWDQW52RRIMNTPV3P3K4KBXQBIC74QBCDQPKXRZVPSVH
  • CDCCNVDQUDTUCSGAUMVN3Y4R6C72FZT7AHXL5DNSH233QVX4CQPNU3SJ
  • CDH4AOC33KWLEFHM4URLC4TKFP7Q3NNSVFN77SP5D2TXYHCMPCTUAIOF
  • CDKTGRW6QTNXYYQWKSQLLZX6LMD3KVBQT6YHSHXM2RPGG7LN2F4NQFOS
  • CDLIZQMISI35QYPZG6FT6NIXW4LP2MWB5JR3KZHBONLY23CEU5GI4VWN
  • CDNL5SZTE2MDEHJQTJC3YHBZ4LVOZFFWBPRTVLIIJKL3JGLTFI3TTCFY
  • CDPGB4HQMSTV7IX5MTJZZ4XF5FI27KKNA477CW4JS7M2R7UUMTRS5M2F
  • CDPVE6JAIPI263EMDAAOGPNQBJR7UFNQYYH2YB6HGYLCGD6FWWEE5OXQ
  • CDSOMXRHTIOGL2AXTPMRUBIBHR5YJFP4XN2DRFQTUH3DWCOHQB6NFUQ4
  • CDTXQD5R6O2AZMFZAMLPWNZADGOGM3RWTCNHHSXNJNL24455L7PCZZV5

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,
    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) ▶