Contract d2dec36170317d81aebaee3efdc7df87fe5c72bb87bc85f5f8cd1ef1e057eff9

← Back to Index 📥 Download WASM

Meta

authors The Aha Company <help@theaha.co>
binver 1.0.0
contract true
name xasset
rssdkver 23.1.1#f4573f94c8f8c1972459a03fe589f116e38c4cf1
rsver 1.89.0
scaffold_version 0.0.18
source_repo github:EquitXCompany/equitx-project

Instances

  • CA3BB35F2EK4ADN4SI3QJAKWG2OQ3S5NKLFRV4H24FEHZ3CA2GHNDGAK
  • CADEEC4LGLNIZN5NCAFHPUIW4PUBI4ABMQBYTAYLDPC4KOEGHP4UBPIT
  • CCAKOTMHZ63UZIFRCWWABLIX5VP4DST2JANHFJLUR7CK4SGIKUPUDBA6
  • CD22WL57UVA33SWE6ELDVUV2UJ5YNP7NXDHYDBASKZK7OVVOXCKCOVHY
  • CDA4KYX6WPHG5VJCFFIBYZI23ON755IGTCT6IOJ5OAK3Y7IBFEUE3FDD
  • CDGMUH4MP7BOTRV5JLAZHY6WQDSWX3RIJXD4JKGKXXLMXTT7MVO7OOKW
  • CDQAQVWDCYX6S46KVVYQI3D6X2ODEJP6DK6SM5366FZ5KSJTRIUIX5QI
  • CDXLRXM5TMYNTOEQYXRDHARX6JSS32PTK76Z475RNDYFGJVHF4AUUDRQ
  • CDXPUKGX5UFCEV77EVK6ZUG5GLSKZHIGSN6Z75TZOFAYKPZ62Y4K5FFD

Interface

fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    xlm_sac: soroban_sdk::Address,
    xlm_contract: soroban_sdk::Address,
    asset_contract: soroban_sdk::Address,
    pegged_asset: soroban_sdk::Symbol,
    min_collat_ratio: u32,
    name: soroban_sdk::String,
    symbol: soroban_sdk::String,
    decimals: u32,
    annual_interest_rate: u32,
)

Upgrade the contract to new wasm. Admin-only.

fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)

Increase the allowance that one address can spend on behalf of another address.

fn increase_allowance(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
)

Decrease the allowance that one address can spend on behalf of another address.

fn decrease_allowance(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
)

Return the spendable balance of tokens for a specific address

fn spendable_balance(env: soroban_sdk::Env, id: soroban_sdk::Address) -> i128

Check if a specific address is authorized

fn authorized(env: soroban_sdk::Env, id: soroban_sdk::Address) -> bool
fn set_authorized(env: soroban_sdk::Env, id: soroban_sdk::Address, authorize: bool)
fn clawback(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)

Return the allowance for spender to transfer from from.

fn allowance(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128

Set the allowance by amount for spender to transfer/burn from from

fn approve(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    live_until_ledger: u32,
)

Return the balance of id

fn balance(env: soroban_sdk::Env, id: soroban_sdk::Address) -> i128

Transfer amount from from to to

fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::MuxedAddress,
    amount: i128,
)

Transfer amount from from to to, consuming the allowance of spender

fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Burn amount from from

fn burn(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)

Burn amount from from, consuming the allowance of spender

fn burn_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    amount: i128,
)

Return the number of decimals used to represent amounts of this token

fn decimals(env: soroban_sdk::Env) -> u32

Return the name for this token

fn name(env: soroban_sdk::Env) -> soroban_sdk::String

Return the symbol for this token

fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String

Oracle contract used for this contract's XLM price feed. Example: CBJSHY5PQQ4LS7VMHI4BJODEDP5MLANRNUSHKNSVKK7BQ4Y6LSTBDGMR

fn xlm_contract(env: soroban_sdk::Env) -> soroban_sdk::Address

Stellar asset contract address

fn xlm_sac(env: soroban_sdk::Env) -> soroban_sdk::Address

Oracle contract used for this contract's pegged asset. Example: CBJSHY5PQQ4LS7VMHI4BJODEDP5MLANRNUSHKNSVKK7BQ4Y6LSTBDGMR

fn asset_contract(env: soroban_sdk::Env) -> soroban_sdk::Address

Which asset from Oracle this tracks. For --asset '{"Other":"USD"}' on asset contract, set to USD

fn pegged_asset(env: soroban_sdk::Env) -> soroban_sdk::Symbol

Basis points. Default: 110%

fn minimum_collateralization_ratio(env: soroban_sdk::Env) -> u32

Get the most recent price for XLM

fn lastprice_xlm(env: soroban_sdk::Env) -> Result

Get the most recent price for the pegged asset

fn lastprice_asset(env: soroban_sdk::Env) -> Result

Get the number of decimals used by the xlm oracle contract. This is NOT the same as the number of decimals used by the XLM Stellar Asset Contract.

fn decimals_xlm_feed(env: soroban_sdk::Env) -> Result

Get the number of decimals used by the asset oracle contract. This is NOT the same as the number of decimals used by the xAsset Fungible Token contract.

fn decimals_asset_feed(env: soroban_sdk::Env) -> Result

Open a new Collateralized Debt Position (CDP) by depositing collateral and minting xAsset

fn open_cdp(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
    collateral: i128,
    asset_lent: i128,
) -> Result<(), soroban_sdk::Error>

Retrieve the CDP information for a specific lender

fn cdp(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
) -> Result

Freeze a CDP if its Collateralization Ratio (CR) is below the xAsset's Minimum Collateralization Ratio (MCR). A frozen CDP is no longer usable or interactable by its former owner.

fn freeze_cdp(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Increase the Collateralization Ratio (CR) by depositing more collateral to an existing CDP.

fn add_collateral(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>

Lower the Collateralization Ratio (CR) by withdrawing part or all of the collateral from a CDP. Collateral cannot be withdrawn if it brings CR below the xAsset's MCR.

fn withdraw_collateral(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>

Lower the Collateralization Ratio (CR) by minting additional xAsset against existing collateral

fn borrow_xasset(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>

Increase the Collateralization Ratio (CR) by repaying debt in the form of xAsset

fn repay_debt(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>

Liquidate a frozen CDP. Upon liquidation, CDP debt is repaid by withdrawing xAsset from a Stability Pool

fn liquidate_cdp(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
) -> Result<(i128, i128, CDPStatus), soroban_sdk::Error>

Merge two or more frozen CDPs into one CDP

fn merge_cdps(
    env: soroban_sdk::Env,
    lenders: soroban_sdk::Vec,
) -> Result<(), soroban_sdk::Error>

Close a CDP when its Collateralization Ratio (CR) value is zero, having no collateral or debt

fn close_cdp(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Update and return the accrued interest on a CDP

fn get_accrued_interest(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
) -> Result

Pay the accrued interest (but not principal) on a CDP.

fn pay_interest(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
    amount_in_xasset: i128,
) -> Result

Set the address of the XLM contract

fn set_xlm_sac(env: soroban_sdk::Env, to: soroban_sdk::Address)

Set the oracle price feed contract for xlm

fn set_xlm_contract(env: soroban_sdk::Env, to: soroban_sdk::Address)

Set the oracle price feed contract for xAsset

fn set_asset_contract(env: soroban_sdk::Env, to: soroban_sdk::Address)

Set the asset the xAsset is pegged to

fn set_pegged_asset(env: soroban_sdk::Env, to: soroban_sdk::Symbol)

Set minimum collateralization ratio

fn set_min_collat_ratio(env: soroban_sdk::Env, to: u32) -> u32

Set annual interest rate

fn set_interest_rate(env: soroban_sdk::Env, new_rate: u32) -> u32

Get annual interest rate

fn get_interest_rate(env: soroban_sdk::Env) -> u32

Get total interest collected

fn get_total_interest_collected(env: soroban_sdk::Env) -> i128

Report the version of this contract

fn version(env: soroban_sdk::Env) -> soroban_sdk::String

Deposit xasset tokens into the Stability Pool

fn deposit(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>

Withdraw xasset tokens from the Stability Pool

fn withdraw(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>

Process a liquidation event for a CDP, returning the amount of debt and collateral liquidated and the CDP status

fn liquidate(
    env: soroban_sdk::Env,
    lender: soroban_sdk::Address,
) -> Result<(i128, i128, CDPStatus), soroban_sdk::Error>

Claim a user's share of collateral rewards

fn claim_rewards(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
) -> Result

Retrieve the current deposit amount for a given address

fn get_staker_deposit_amount(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
) -> Result

Retrieve the total amount of xasset tokens in the Stability Pool

fn get_total_xasset(env: soroban_sdk::Env) -> i128

Retrieve the total amount of collateral rewards in the Stability Pool

fn get_total_collateral(env: soroban_sdk::Env) -> i128

Add a stake to the pool

fn stake(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>

Remove a user's stake from the pool

fn unstake(
    env: soroban_sdk::Env,
    staker: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

View a user's available xasset and rewards

fn get_available_assets(
    env: soroban_sdk::Env,
    staker: soroban_sdk::Address,
) -> Result

View a user's current position

fn get_position(
    env: soroban_sdk::Env,
    staker: soroban_sdk::Address,
) -> Result

View the stability pool's current constants

fn get_constants(env: soroban_sdk::Env) -> StakerPosition

Imports

WebAssembly Text (WAT) ▶