VulpeFI Docs
  • Whitepaper
  • VulpeFI Overview
  • Wallet VulpeFI
    • Wallet auto-connect
  • Aggregation Protocol
    • Introduction
    • Guide
      • Quick start
    • API
      • Swagger
        • Binance Smart Chain
        • Ethereum Network
        • BASE
        • Arbitrum
        • Polygon
      • Swap params
      • Quote params
    • Smart contracts
      • Aggregation VulpeFI
      • ClipperRouter
      • LimitOrderProtocol
      • UnoswapRouter
    • Limit order protocol
      • Introduction
      • Limit vs. RFQ Orders
      • Smart contracts
        • LimitOrderProtocol
        • LimitOrderProtocolPro
        • OrderLib
        • OrderMixin
        • OrderRFQMixin
        • helpers
          • AmountCalculator
          • ChainlinkCalculator
          • ERC1155Proxy
          • ERC721Proxy
          • ERC721ProxySafe
          • ImmutableOwner
          • NonceManager
          • PredicateHelper
          • SeriesNonceManager
          • WethUnwrapper
        • Interfaces
          • IDaiLikePermit
          • IWithdrawable
          • Interaction
          • PostInteraction
          • PreInteraction
      • Liquidity Source and API
        • Ethereum Network
        • Binance Smart Chain
        • Polygon
        • Avalanche
        • Gnosis Chain
    • Spot Price aggregator
      • Examples
      • Spot Price Aggregator
Powered by GitBook
On this page
  • Functions​
  • singlePrice​
  • doublePrice​
  1. Aggregation Protocol
  2. Limit order protocol
  3. Smart contracts
  4. helpers

ChainlinkCalculator

PreviousAmountCalculatorNextERC1155Proxy

Last updated 1 year ago

A helper contract for interactions with

Functions

singlePrice

function singlePrice(
  contract AggregatorV3Interface oracle,
  uint256 inverseAndSpread,
  uint256 amount
) external returns (uint256)

Calculates price of token relative to oracle unit (ETH or USD)

Parameters:

Name
Type
Description

oracle

contract AggregatorV3Interface

concatenated inverse flag and spread. Lowest 254 bits specify spread amount. Spread is scaled by 1e9, i.e. 101% = 1.01e9, 99% = 0.99e9. Highest bit is set when oracle price should be inverted, e.g. for DAI-ETH oracle, inverse=false means that we request DAI price in ETH and inverse=true means that we request ETH price in DAI

inverseAndSpread

uint256

amount

uint256

Return Values:

Name
Type
Description

Amount

uint256

spread oracle price

doublePrice

function doublePrice(
  contract AggregatorV3Interface oracle1,
  contract AggregatorV3Interface oracle2,
  uint256 spread,
  int256 decimalsScale,
  uint256 amount
) external returns (uint256)

Calculates price of token A relative to token B. Note that order is important

Name
Type
Description

oracle1

contract AggregatorV3Interface

oracle2

contract AggregatorV3Interface

spread

uint256

decimalsScale

int256

amount

uint256

Name
Type
Description

Result

uint256

Token A relative price times amount

Parameters:

Return Values:

https://docs.chain.link
​
​
​
​
​
​
​