Calculate
Calculate

Math · Reads onchain state

Applies a binary arithmetic operation to two values and returns the result. Operations are add, subtract, multiply, divide, modulo, power, minimum, and maximum. Operand decimals are reconciled so a token amount and a price combine correctly, and division truncates. Power returns a raw integer. Reach for it to derive the next step's input from earlier reads: a repay sized as debt minus a buffer, a min of a target and available liquidity, or a value split into a fraction.

Get Chainlink Token Value (USD)

plug
math
5actions
  1. 1·Take

    Opening with a declared parameter, token is left for the caller to supply at execution time, naming the asset to be valued.

  2. 2·Take

    A second parameter, amount, is declared as caller-supplied, giving the quantity that the price will be applied to.

  3. 3·Use

    Composing the Get Chainlink Price (USD) plug pulls its price-reading logic into this one, returning the token's USD rate.

  4. 4·Calculate

    Multiplying the composed price by amount converts the supplied quantity into its USD value.

  5. 5·Bubble

    Surfacing that product returns the computed USD value as the output of this plug.

Take
Take
Use where
tokenis
Calculate
Bubble
  • Get Chainlink Token Value (USD)

    plug
    math
  • Expected Amount to Minimum Received

    plug
    math
    values
  • Raw Weights to Percents

    plug
    evm
    boolean
  • Get Simple Moving Average

    plug
    time
    chainlink
  • Get Price Running Total

    plug
    values
    math
  • Rebalance Holdings to Target

    plug
    values
    evm
  • Get Total Holdings Value

    plug
    evm
    boolean
  • Get Target Balance

    plug
    math
    evm
  • Get Holding Value

    plug
    evm
    math
  • Swap at Floor

    plug
    evm
    values
  • Morpho: Auto Leverage Trigger

    plug
    morpho
    math
  • Swap

    plug
    values
    evm
  • Check Required Amount

    plug
    math
    evm
  • Morpho Pendle Expiry Deleveraging

    pendle
    time
    boolean
  • Morpho: Get Market Liquidity

    plug
    morpho
    math
  • Morpho: Get Borrow APR

    plug
    values
    math
  • Find Value Delta

    plug
    boolean
    evm
  • Morpho: Collateral Amount to Collateral Value

    plug
    math
  • Morpho: Borrow Shares to Borrow Assets

    plug
    math
    evm
  • Aave: Wind or Unwind Position

    plug
    boolean
    aave
  • Value to Token Amount

    plug
    aave
    math
  • Target Debt to Debt Delta

    plug
    aave
    boolean
  • Wind

    plug
    aave
    evm
  • Unwind

    plug
    aave
    evm
  • Wind or Unwind to Maintain Target HF

    plug
    aave
    math
  • Loop WETH/USDC at Target HF

    aave
    evm
    boolean
  • Borrow + Term Repayment Schedule

    time
    database
    boolean
  • Trailing Stop Loss (WETH/USDC Loop)

    boolean
    aave
    evm
  • Loop at Target HF + Borrow Rate Exit Guard

    database
    boolean
    aave
  • Loop at Target HF + Borrow Rate Entry & Exit Guard

    aave
    boolean
    evm
  • Loop at Target HF + Trailing Stop Loss

    database
    boolean
    aave
  • Swarm: Loop WETH/USDC at Target HF

    boolean
    aave
    evm