BasisOS
  • INTRODUCTION
    • What is BasisOS
    • Key Concepts in Basis Trading
    • Vision and Value Proposition
  • Basis Vaults
    • Architecture Overview
    • Components and Interactions
    • Managed Approach
    • Execution Flow
  • BASISOS AGENT
    • Overview
    • Core Components
    • System Design and Interactions
    • Agentic Roadmap
      • Stage 0: Assistant
      • Stage 1: Maintainer
      • Stage 2: Curator
      • Stage 3: Sovereign
  • TOKENOMICS
    • Token Distribution
    • Liquidity Mining
      • Distribution Mechanics
      • Rewards Schedule
    • Mindshare Mining
      • Distribution Mechanics
      • Rewards Schedule
  • CORE PROTOCOL
    • LogarithmVault
    • BasisStrategy
    • SpotManager
    • OffchainPositionManager
    • GmxV2PositionManager
    • LogarithmOracle
      • Oracle Provider
    • Contract Addresses
  • RISK MANAGEMENT
    • Funding Risk
    • Liquidity Risk
    • Risk Framework
      • Margin Treasury
      • Maximum Leverage
      • Asset Clustering
      • Strategy Capacity
    • Backtests
Powered by GitBook
On this page
  • State Variables
  • Functions
  • Events
  • Structs
  1. CORE PROTOCOL

LogarithmOracle

Inherits: UUPSUpgradeable, Ownable2StepUpgradeable, IOracle Author: Logarithm Labs

The LogarithmOracle is a price oracle contract that provides price feeds for various assets using Chainlink price feeds. It implements the UUPS upgradeable pattern and includes ownership controls. The contract serves as a centralized price oracle that manages price feeds for different assets, handles price feed heartbeat monitoring, provides price conversion between different assets, and maintains asset decimal information.

State Variables

LogarithmOracleStorageLocation

bytes32 private constant LogarithmOracleStorageLocation =
    0x2c93e30cf348944d3203d68cfbfc99aa913023170c5de2049def7c26b25c6400;

Functions

_getLogarithmOracleStorage

function _getLogarithmOracleStorage() private pure returns (LogarithmOracleStorage storage $)

initialize

function initialize(address owner_) external initializer

setPriceFeeds

Updates price feeds for multiple assets.

function setPriceFeeds(address[] calldata assets, address[] calldata feeds) external onlyOwner

setAssetDecimals

Sets decimals of non-existing assets on this chain.

function setAssetDecimals(address[] calldata assets, uint8[] calldata decimals) external onlyOwner

setHeartbeats

Configures heartbeat durations for price feeds.

function setHeartbeats(address[] calldata feeds, uint256[] calldata heartbeats) external onlyOwner

getPriceFeed

Returns the price feed address for an asset.

function getPriceFeed(address asset) external view returns (address)

getAssetPrice

Returns the normalized price of an asset (30 decimals).

function getAssetPrice(address asset) public view override returns (uint256)

convertTokenAmount

Converts amount between different assets.

function convertTokenAmount(address from, address to, uint256 amount) external view returns (uint256)

assetDecimals

Returns the decimal places for an asset.

function assetDecimals(address asset) public view returns (uint8)

_setAssetDecimal

Internal function to set asset decimals.

function _setAssetDecimal(address asset, uint8 decimal) internal

Events

PriceFeedUpdated

Emitted when a price feed is updated.

event PriceFeedUpdated(address asset, address feed)

HeartBeatUpdated

Emitted when a heartbeat duration is updated.

event HeartBeatUpdated(address asset, uint256 heartbeatDuration)

AssetDecimalInitiated

Emitted when asset decimals are set.

event AssetDecimalInitiated(address asset, uint8 decimals)

Structs

LogarithmOracleStorage

struct LogarithmOracleStorage {
    mapping(address asset => IPriceFeed) priceFeeds;
    mapping(address priceFeed => uint256) heartbeatDurations;
    mapping(address asset => uint8) decimals;
}
PreviousGmxV2PositionManagerNextOracle Provider

Last updated 27 days ago