🔋
Ionic Docs
  • Welcome to Ionic
  • Ionic pools
  • Yield-Bearing Vaults (ERC-4626)
  • Partner & Pool Operator Documents
    • Overview
    • Ionic For Partners
      • Long-tail and exotic asset support
      • Liquid Staking Tokens
      • Forex Markets & Non-US Centric DeFi
      • Delta-Neutral Strategies
      • AMM LP Pools
    • Advanced Features
    • Getting Started
    • Pool Customisations
      • The Markets
      • The Yield
      • Pool Parameters
  • Security
    • Security Outline
      • Oracle Security
      • Yield Bearing 4626 Strategy Risk Scoring
      • Liquidity Monitoring
    • Audit
  • Developers
    • Ionic SDK
      • Chain Configuration and Addresses
      • Data Fetching & Pool Introspection
      • Funding Operations
      • Advanced Use-Cases
      • Liquidations
      • Putting It All Together
      • API Reference, Typing & Interfaces
    • Deployed Contract Addresses
  • Support
    • Media Kit
    • DeFi Terms Glossary
    • FAQ
  • Documents
    • Privacy Policy
    • Terms and Conditions
Powered by GitBook
On this page
  • supply
  • borrow
  • repay
  • withdraw
  1. Developers
  2. Ionic SDK

Funding Operations

These are the core actions that enable users to actually use their funds within the protocol.

Enabling programmatic control of these operations offers a powerful shorthand to developers interested in integrating with Ionic.

The functions here shown enable the typical interactions with a Money Market:

  • Depositing collateral to a pool

  • Borrow funds against the deposited collateral

  • Repay the borrowed funds

  • Withdraw collateral from a pool

With these, protocol developers can seamlessly add a Borrow and Lending page to their web applications, and have a very concise interface with which they can enable users to perform the major operations against a lending & borrowing pool

supply

Supply assets to a pool, with the option of enabling them to be used as collateral

Arguments:

  • cTokenAddress: string: the address of the cToken to be supplied

  • underlyingTokenAddress: string: the address of the underling token of the cToken to be borrowed

  • comptrollerAddress: string: the comptroller e.g., the pool's address

  • enableAsCollateral: boolean: whether the deposited underlying should be enabled to be used as collateral

  • amount: BigNumber: amount in BigNumber format

  • options: { from: string }: address from which to perform the funding

Returns:

  • {tx: ContractTransaction, errorCode: number | null}

borrow

After having deposited into a pool and marked an asset as enabled for collateralization, you may perform a borrow against that asset

Arguments:

  • cTokenAddress: string: the address of the cToken to be borrowed

  • amount: BigNumber: amount to be borrowed in BigNumber format

  • options: { from: string }: address from which to perform the borrowing

Returns:

  • {tx: ContractTransaction, errorCode: number | null}

repay

Repay a borrow action, with the option of repaying the full amount instead of specifying an amount.

Arguments:

  • cTokenAddress: string: the address of the cToken to be repaied

  • underlyingTokenAddress: string: the address of the underling token of the cToken to be repaid

  • isRepayingMax: boolean: whether the maximum amount is being tried to be repaid

  • amount: BigNumber: amount to be repaid in BigNumber format

  • options: { from: string }: address from which to perform the repayment

Returns:

  • {tx: ContractTransaction, errorCode: number | null}

withdraw

Withdraw deposited funds from the pool. This redeems the underlying tokens deposited from the cTokens that belong to your account, and are currently not being used to collateralised a loan.

Arguments:

  • cTokenAddress: string: the address of the cToken to be withdrawn

  • amount: BigNumber: amount to be withdrawn in BigNumber format

  • options: { from: string }: address from which to perform the withdrawal

Returns:

  • {tx: ContractTransaction, errorCode: number | null}

PreviousData Fetching & Pool IntrospectionNextAdvanced Use-Cases

Last updated 1 year ago