Nabla Docs
  • Nabla Finance
    • The problem Nabla solves
    • Benefits of using Nabla
  • Protocol Overview
    • Swap Algorithm
    • Liquidity Pools
      • Swap Pools
      • Backstop Pool
    • Oracle Details
      • Architecture
      • Pyth
      • Chainlink
      • EV:GO
  • Roadmap
  • Protocol-owned Liquidity (POL)
    • Trading Fees and LP Incentives
    • Nabla as an autonomous protocol
  • Security
    • Audits
    • Bug Bounty Program
  • Mainnet Alpha
    • Risks and Benefits of being a Mainnet Alpha LP
  • Monad Testnet
    • Add Monad Testnet to Metamask
    • Get Monad Test Tokens
    • Monad Testnet Tasks
  • Testnet Beta
    • Connect Wallet to Base Sepolia
    • Testnet Beta Tasks
    • Obtaining Base Sepolia Ether for Gas
    • Test Assets
    • Connect Wallet to Base Sepolia Testnet
    • Performing a Swap
    • Managing Swap Pool Liquidity
    • Redeem Swap Pool Shares via Backstop Pool
    • Managing Backstop Pool Liquidity
    • Withdraw Backstop Pool Liquidity via Excess Swap Pool
  • Testnet Alpha
    • Testnet Alpha Results
    • Whitelisting for testnet
      • Whitelist Campaigns List
      • $PYTH Stakers Whitelist
    • Connect Wallet to Sepolia Testnet
    • Requesting Testnet Gas
    • How to contribute to testing
    • Performing a Swap
    • Managing Swap Pool Liquidity
    • How to swap into a swap pool that is depleted
    • Managing Backstop Pool Liquidity
    • Redeem Swap Pool Shares via Backstop Pool
    • Withdraw Backstop Pool Liquidity via Excess Swap Pool
  • Liquidity Provision
  • $NABLA
    • $sNABLA Token Utility
    • Staking Mechanism
    • Fee Distribution
    • Tokenomics
    • Token Utility Summary
    • Governance
      • Initial Governance Implementation
      • Governance structure
      • Discussion and Proposal process
      • Voting process
      • Transparency and record-keeping
      • Code of conduct
      • Amendments to the Governance Framework
      • Template for a vote
  • $AMBER Onchain Points Program
    • Mainnet Alpha Rewards
      • Arbitrum-Mainnet Alpha Rewards
      • Base-Mainnet Alpha Rewards
    • $AMBER FAQ
  • 💻Developers
    • Integration Guide
    • NablaPortal
    • NablaRouter
    • SwapPool
    • GenericPool
    • NablaBackstopPool
    • PythAdapter
    • ISlippageCurve
    • Contract addresses
      • Arbitrum One
      • Base
      • Monad Testnet
    • Contract errors
  • Community
    • Linktree
    • Twitter
    • Discord
    • Telegram
  • Whitepaper
  • Legal
    • Privacy Policy
    • Terms of Service
Powered by GitBook
On this page
  • Events
  • PythContractAddressSet
  • PriceFeedRegistered
  • PriceFeedUnregistered
  • PriceMaxAgeSet
  • PriceMinConfidenceRatioSet
  • PriceFeedsUpdated
  • Functions
  • updatePriceFeeds
  • getAssetPrice
  • getPythContractAddress
  • isPriceFeedRegistered
  • getPriceFeedIdByAsset
  • getUpdateFee
  • getValidTimePeriod
  • getPriceMaxAge
  • getPriceMinConfidenceRatio
  1. Developers

PythAdapter

Price oracle adapter that uses Pyth price feeds (https://pyth.network)

Events

PythContractAddressSet

event PythContractAddressSet(address sender, address pythContractAddress)

PriceFeedRegistered

event PriceFeedRegistered(address sender, address asset, bytes32 priceFeedId)

PriceFeedUnregistered

event PriceFeedUnregistered(address sender, address asset)

PriceMaxAgeSet

event PriceMaxAgeSet(address sender, uint256 newPriceMaxAge)

PriceMinConfidenceRatioSet

event PriceMinConfidenceRatioSet(address owner, address asset, uint256 oldPriceMinConfidenceRatio, uint256 newPriceMinConfidenceRatio)

PriceFeedsUpdated

event PriceFeedsUpdated(address sender, uint256 updateFee)

Functions

updatePriceFeeds

function updatePriceFeeds(bytes[] _priceUpdateData) external payable returns (bool success_)

Updates one or more Pyth price feeds

This function needs to be called right before calling getAssetPrice()

Parameters

Name
Type
Description

_priceUpdateData

bytes[]

Pyth price update data

Return Values

Name
Type
Description

success_

bool

Confirmation of success

getAssetPrice

function getAssetPrice(address _asset) external view returns (uint256 assetPrice_)

Returns the asset price

This function reverts with a StalePrice error if the on-chain price has not been updated within the last getValidTimePeriod() seconds via updatePriceFeeds()

Parameters

Name
Type
Description

_asset

address

ERC-20 token address

Return Values

Name
Type
Description

assetPrice_

uint256

Asset price in USD with 18 decimal places

getPythContractAddress

function getPythContractAddress() external view returns (address pythContractAddress_)

Returns the Pyth contract address

Return Values

Name
Type
Description

pythContractAddress_

address

Pyth contract address

isPriceFeedRegistered

function isPriceFeedRegistered(address _asset) public view returns (bool isRegistered_)

Check if Pyth price feed is registered

Parameters

Name
Type
Description

_asset

address

ERC-20 token address

Return Values

Name
Type
Description

isRegistered_

bool

Confirmation of registration

getPriceFeedIdByAsset

function getPriceFeedIdByAsset(address _asset) public view returns (bytes32 priceFeedId_)

Returns the Pyth price feed id for an asset

Parameters

Name
Type
Description

_asset

address

ERC-20 token address

Return Values

Name
Type
Description

priceFeedId_

bytes32

Pyth price feed id

getUpdateFee

function getUpdateFee(bytes[] _updateData) public view returns (uint256 updateFee_)

Returns the required fee to update an array of price updates

Parameters

Name
Type
Description

_updateData

bytes[]

Array of price update data

Return Values

Name
Type
Description

updateFee_

uint256

Update fee in Wei

getValidTimePeriod

function getValidTimePeriod() external view returns (uint256 validTimePeriod_)

Returns the period (in seconds) that a price feed is considered valid since its publish time

Return Values

Name
Type
Description

validTimePeriod_

uint256

Valid time period in seconds

getPriceMaxAge

function getPriceMaxAge() external view returns (uint256)

Returns the maximum age of a price feed in seconds

Return Values

Name
Type
Description

[0]

uint256

priceMaxAge Maximum age of a price feed in seconds

getPriceMinConfidenceRatio

function getPriceMinConfidenceRatio(address _asset) external view returns (uint256 priceMinConfidenceRatio_)

Returns the minimum confidence ratio for an asset

Parameters

Name
Type
Description

_asset

address

ERC-20 token address

Return Values

Name
Type
Description

priceMinConfidenceRatio_

uint256

Minimum confidence ratio for the asset

PreviousNablaBackstopPoolNextISlippageCurve

Last updated 6 months ago

💻