Get constant
Get constant

Values · Reads onchain state

Holds a well-known constant as a named value: max uint256, WAD, RAY, basis points, one, or zero. The value is echoed into a slot with the matching decimal tag, so it reads as 1e18 or 10,000 rather than a raw literal. Reach for it to feed a scale into a calculation, such as dividing by WAD after a multiply, or to pass max uint256 as an unlimited amount.

Card: Sell $25 ETH for USDC

values
math
chainlink
17actions
  1. 1·Get constant

    The basis-point denominator of 10,000 is loaded as a named constant for the proportional math further down.

  2. 2·Calculate

    From a scaled figure, fifty is subtracted, producing that value minus a plain fifty for use downstream.

  3. 3·Get constant

    A named constant WAD equal to 1e18 is loaded for 18-decimal scaling.

  4. 4·Calculate

    Twenty-five is multiplied by the value in slot 2.0, scaling twenty-five by that figure.

  5. 5·Get price

    Reading Chainlink, the latest price of ETH in USD is fetched, normalized to 18 decimals.

  6. 6·Multiply then divide

    Multiplying the WAD constant by the value in slot 2.0 and dividing by the ETH price, rounding down, computes a scaled expected amount.

  7. 7·Calculate

    Twenty-five is multiplied by 1000000, producing twenty-five in six-decimal base units to match USDC.

  8. 8·Calculate proportional value

    Applying the value in slot 1.0 as basis points to the slot 6.0 figure takes a proportion of it, giving a slippage-adjusted target.

  9. 9·Get token balance

    Before any swap, the socket's own USDC balance is read to establish the pre-swap baseline.

  10. 10·Get address

    The solver address is held as a named value to serve as the transfer destination.

  11. 11·Transfer tokens

    The value in slot 5.0 of ETH is transferred to the solver address held just before.

  12. 12·Get solution

    The solver takes the transferred ETH, routes it, and the outcome is verified.

  13. 13·Get token balance

    After routing, the socket's USDC balance is read again to capture the post-swap holding.

  14. 14·Calculate

    Subtracting the pre-swap USDC baseline from the post-swap balance yields the USDC actually received.

  15. 15·Predicate

    A requirement enforces that the USDC received is greater than or equal to the twenty-five-in-six-decimals target, reverting otherwise.

  16. 16·End block

    The open block is closed here.

  17. 17·Bubble

    The USDC received amount is surfaced as the output of this plug.

Get constant
Calculate
Get constant
Calculate
Get price of in
Calculate times divided by rounded
Calculate
Calculate of
Get balance of held by
Get
Transfer to
Get solution
Get balance of held by
Calculate
End block
Bubble
  • 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
  • Get Weight Target

    plug
    values
    math