Exactly Protocol
  • Getting started
    • 🔔Welcome
    • ➡️Introduction
    • ❔FAQ
    • 🔗Quick Links
  • Governance
    • 🏛️Exactly Protocol Governance
      • ✍️Proposals and Voting
      • ⚡Snapshot
      • 📄Exactly Improvement Proposal (EXAIP) Template
    • ⚫Exactly Protocol (EXA)
      • 📊EXA Tokenomics
      • ⚪EscrowedEXA (esEXA)
      • EXA Staking Program (stEXA)
  • EXA APP
    • The Exa App
    • How the Exa App works
    • The Exa App Webauthn Owner Plugin
    • Exa Plugin
    • Exa App FAQs
  • Guides
    • ⚙️Protocol
      • Auditor
      • MarketETHRouter
      • Market
        • ERC-4626
      • PriceFeedWrapper
      • PriceFeedDouble
      • InterestRateModel
      • RewardsController
    • 🛰️Peripheral Contracts
      • 🌀DebtManager
      • ⚫EXA
      • ⚪esEXA
      • 🪂Airdrop
      • 👀Previewer (read-only)
      • 👓DebtPreviewer (read-only)
      • RatePreviewer (read-only)
    • ✨Features
      • Bad Debt Clearing
      • Dynamic Close Factor
      • Earnings Accumulator
      • Cross-Asset Leverager & Deleverager
      • Liquidity Reserve
      • Rewards Distribution Model
      • Rate Manipulation Prevention
      • Rollover
    • 💲Fixed Rate Operations
      • 📥Deposits
      • 📤Borrows
    • 🔢Parameters
    • 📈Interest Rates Curves
    • ♻️Liquidations
      • 🤖Exactly's Bot
    • ⛓️Smart Contract Addresses
    • 🌐The Graph
    • 🔮Chainlink Price Feeds
  • Security
    • 🔎Audits
    • 🔑Access Control
    • 🛡️Hypernative
    • 🧪Testing
    • 🧯Emergency Procedure
    • 🐛Bug Bounty Program
  • Resources
    • 📃White Paper
    • 🔣Math Paper v1
    • 🔣Math Paper v2
    • 🤝Partnerships
    • 📺Presentations
    • 📣Brand Assets
  • Legal
    • ⚖️Terms and Conditions of Use
    • 🔏Privacy Policy
    • 🍪Cookies Policy
Powered by GitBook
On this page
  • Public State Variables
  • market
  • weth
  • Write Methods
  • borrow
  • borrowAtMaturity
  • deposit
  • depositAtMaturity
  • redeem
  • refund
  • repay
  • repayAtMaturity
  • withdraw
  • withdrawAtMaturity

Was this helpful?

  1. Guides
  2. Protocol

MarketETHRouter

To be used by Exactly’s web-app, so accounts can operate with ETH on MarketWETH. Wraps ETH or unwraps WETH before and after interacting with MarketWETH. It saves one step for the user.

Public State Variables

market

function market() external view returns (contract Market)

weth

function weth() external view returns (contract WETH

Write Methods

borrow

function borrow(uint256 assets) external nonpayable returns (uint256 borrowShares)

Unwraps WETH from the floating pool and borrows to caller.

Parameters

Name
Type
Description

assets

uint256

amount of assets to borrow.

Returns

Name
Type
Description

borrowShares

uint256

number of borrowed shares.

borrowAtMaturity

function borrowAtMaturity(uint256 maturity, uint256 assets, uint256 maxAssetsAllowed) external nonpayable returns (uint256 assetsOwed)

Unwraps WETH from a maturity and borrows to caller.

Parameters

Name
Type
Description

maturity

uint256

maturity date for repayment.

assets

uint256

amount to be sent to caller.

maxAssetsAllowed

uint256

maximum amount of debt that the caller is willing to accept.

Returns

Name
Type
Description

assetsOwed

uint256

total amount of assets (principal + fee) to be repaid at maturity.

deposit

function deposit() external payable returns (uint256 shares)

Wraps ETH and deposits WETH into the floating pool's market.

Returns

Name
Type
Description

shares

uint256

number of minted shares.

depositAtMaturity

function depositAtMaturity(uint256 maturity, uint256 minAssetsRequired) external payable returns (uint256 maturityAssets)

Wraps ETH and deposits to a maturity.

Parameters

Name
Type
Description

maturity

uint256

maturity date where the assets will be deposited.

minAssetsRequired

uint256

minimum amount of assets required by the caller for the transaction to be accepted.

Returns

Name
Type
Description

maturityAssets

uint256

total amount of assets (principal + fee) to be withdrawn at maturity.

redeem

function redeem(uint256 shares) external nonpayable returns (uint256 assets)

Unwraps WETH from the floating pool and withdraws to caller.

Parameters

Name
Type
Description

shares

uint256

amount of shares to be burned in exchange of assets.

Returns

Name
Type
Description

assets

uint256

amount of assets withdrawn.

refund

function refund(uint256 borrowShares) external payable returns (uint256 repaidAssets, uint256 actualShares)

Wraps ETH and repays to the floating pool.

Parameters

Name
Type
Description

borrowShares

uint256

shares to be subtracted from the caller's debt.

Returns

Name
Type
Description

repaidAssets

uint256

number of repaid assets.

actualShares

uint256

number of borrowed shares subtracted from the debt (can be lower than borrowShares).

repay

function repay(uint256 assets) external payable returns (uint256 repaidAssets, uint256 borrowShares)

Wraps ETH and repays to the floating pool.

Parameters

Name
Type
Description

assets

uint256

amount of assets to repay.

Returns

Name
Type
Description

repaidAssets

uint256

number of repaid assets (can be lower than assets).

borrowShares

uint256

number of borrowed shares subtracted from the debt.

repayAtMaturity

function repayAtMaturity(uint256 maturity, uint256 assets) external payable returns (uint256 repaidAssets)

Wraps ETH and repays to a maturity.

Parameters

Name
Type
Description

maturity

uint256

maturity date where the assets will be repaid.

assets

uint256

amount to be paid for the caller's debt.

Returns

Name
Type
Description

repaidAssets

uint256

the actual amount that was transferred into the Market.

withdraw

function withdraw(uint256 assets) external nonpayable returns (uint256 shares)

Unwraps WETH from the floating pool and withdraws to caller.

Parameters

Name
Type
Description

assets

uint256

amount of assets to withdraw.

Returns

Name
Type
Description

shares

uint256

number of burned shares.

withdrawAtMaturity

function withdrawAtMaturity(uint256 maturity, uint256 assets, uint256 minAssetsRequired) external nonpayable returns (uint256 actualAssets)

Unwraps WETH from a maturity and withdraws to caller.

Parameters

Name
Type
Description

maturity

uint256

maturity date where the assets will be withdrawn.

assets

uint256

position size to be reduced.

minAssetsRequired

uint256

minimum amount required by the caller (if discount included for early withdrawal).

Returns

Name
Type
Description

actualAssets

uint256

amount of assets withdrawn (can include a discount for early withdraw).

PreviousAuditorNextMarket

Last updated 1 year ago

Was this helpful?

⚙️