Math
Math
Scripting · Math · Calculation

Math is the substrate every plan onchain is made of: the chain keeps its books in fixed point integers, and every rate, price, balance, and share that matters is a number some contract multiplied and divided at a scale no desk calculator was built for. Eighteen decimal WADs, twenty seven decimal RAYs, basis points, raw token units: this is the arithmetic the entire market already runs on, every block, without exception.

A plug computes in that native register directly. Sums, differences, products, quotients, remainders, powers, floors and caps over full width integers. Proportions taken in percent, basis points, WAD, or RAY without ever leaving the scale the protocol prices in. Multiplication fused with division so precision never dies in an intermediate value, with the rounding direction chosen deliberately rather than inherited by accident. Roots, logarithms, and exponentials for the curves that lending rates and AMM invariants are actually built from.

The numbers that matter are computed in the same transaction that acts on them. An order sized as a fraction of a balance the moment the balance is read, not the value it had when a person last looked. A repayment proportional to exactly how far a threshold was crossed. A yield split at precise basis points between destinations. Nothing copied out of a spreadsheet, nothing rounded by hand, nothing stale by the time it lands.

Every strategy that holds up under real money is arithmetic first and conviction second, and the arithmetic is the part a person gets wrong at four in the morning. A plug does not.

  • Get Chainlink Token Value (USD)

    plug
    math
  • Card: Buy $50 WBTC With USDC Once a Week

    time
    values
    math
  • Card: Buy an 18 Dec Token With X% of USDC

    plug
    evm
    math
  • Card: Sell X% of an 18 Dec Token for USDC

    plug
    evm
    math
  • Card: Sell 18 Dec Token for USDC

    plug
    chainlink
    math
  • Card: Sell 8 Dec Token for USDC

    plug
    chainlink
    math
  • Card: Buy 8 Dec Token With USDC

    plug
    chainlink
    values
  • Card: Buy 18 Dec Token With USDC

    plug
    chainlink
    values
  • Card: Sell 10% of ETH for USDC

    evm
    math
    chainlink
  • Card: Buy ETH With 10% of USDC

    evm
    math
    chainlink
  • Card: Sell $25 ETH for USDC

    values
    math
    chainlink
  • Card: Buy $25 ETH With USDC

    values
    math
    chainlink
  • 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
  • Exit Morpho at Epoch End

    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
  • Swarm: Loop WETH/USDC at Target HF

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

    database
    boolean
    aave
  • Borrow + Term Repayment Schedule

    time
    database
    boolean
  • Loop at Target HF + Borrow Rate Exit Guard

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

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

    aave
    boolean
    evm
  • Morpho: Collateral Value to Borrow Capacity

    plug
    math
    evm
  • Get Weight Target

    plug
    values
    math
  • Morpho: Get Health Factor

    plug
    boolean
    evm

Posts · 10