PERI Finance2021
  • PERI Finance
  • PERI Finance
    • What is PERI Finance?
    • dApps
      • PERI Staking
      • PERI DEX
    • PERI Tokenomics
    • Token Contract Addresses
    • Token Contract Addresses(Testnet)
    • Guides
      • ETH-Polygon Bridge Guide
      • Staking dApp — 1. Setting/Stake-Mint
      • Staking dApp — 2. Burn
      • Staking dApp — 3. Reward
      • Staking dApp— 4. Earn(LP Reward)
      • PERI Token Swap Guide - Pancakeswap
      • PERI Finance LP Rewards Program
      • Details of APY — PERI Finance dApp
      • Pynths DEX Guide - Bridge
      • Pynths DEX Setting — Exchange
      • Pynths DEX Guide - Assets
      • Pynths DEX Guide (Testnet)
      • Guide(Testnet)
        • Pynths DEX Setting(Testnet) — Add Moonbase Alpha Testnet
        • Pynths DEX Setting(Testnet) — Get Testnet PERI Tokens on Moonbase Alpha
        • Pynths DEX Setting(Testnet) — Get DEV tokens from Moonbase community
    • Security & Audits
    • FAQs
  • Development Resources
    • Protocol
      • VALUE RECEPIENTS
      • PERI STAKING REWARDS
      • PROTOCOL CORE EQUATIONS
    • Deployed Contract
      • MAINNET
        • ETHEREUM MAINNET
        • BSC MAINNET
        • POLYGON MAINNET
      • TESTNET
        • ETHEREUM KOVAN TESTNET
        • POLYGON TESTNET
        • BSC TESTNET
    • Protocol Integrations
      • INTEGRATED PROJECT
      • PERI FINANCE HISTORICAL DATA
      • PERI FINANCE STAKING
        • STAKING PERI
    • Smart Contract Architecture
    • Deployment Procedure
    • Common Transactions
    • Source Code Description
      • SOLIDITY CONTRACT
        • AddressResolver
        • BaseDebtCache
        • BasePeriFinance
        • BaseRewardEscrowV2
        • BinaryOption
        • BinaryOptionMarket
        • BinaryOptionMarketData
        • BinaryOptionMarketFactory
        • BinaryOptionMarketManager
        • BlacklistManager
        • BridgeState
        • Collateral
        • CollateralErc20
        • CollateralEth
        • CollateralManager
        • CollateralManagerState
        • CollateralShort
        • CollateralState
        • ContractStorage
        • DappMaintenance
        • DebtCache
        • DelegateApprovals
        • Depot
        • EmptyCollateralManager
        • EmptyEtherCollateral
        • EscrowChecker
        • EternalStorage
        • EtherCollateral
        • EtherCollateralpUSD
        • ExchangeRates
        • ExchangeRatesWithoutInvPricing
        • ExchangeState
        • Exchanger
        • ExchangerWithVirtualPynth
        • ExternStateToken
        • ExternalRateAggregator
        • ExternalTokenStakeManager
        • FeePool
        • FeePoolEternalStorage
        • FeePoolState
        • FlexibleStorage
        • ImportableRewardEscrowV2
        • Issuer
        • IssuerWithoutLiquidations
        • LimitedSetup
        • Liquidations
        • Math
        • MintablePeriFinance
        • MixinResolver
        • MixinSystemSettings
        • MultiCollateralPynth
        • Owned
        • Pausable
        • PeriFinance
        • PeriFinanceBridgeToBase
        • PeriFinanceBridgeToOptimism
        • PeriFinanceEscrow
        • PeriFinanceState
        • PeriFinanceStateWithLimitedSetup
        • PeriFinanceToBSC
        • PeriFinanceToEthereum
        • PeriFinanceToPolygon
        • Proxy
        • ProxyERC20
        • Proxyable
        • PurgeablePynth
        • Pynth
        • PynthUtil
        • ReadProxy
        • RealtimeDebtCache
        • RewardEscrow
        • RewardEscrowV2
        • RewardsDistribution
        • RewardsDistributionRecipient
        • SafeDecimalMath
        • ShortingRewards
        • StakingRewards
        • StakingState
        • StakingStateUSDC
        • State
        • SupplySchedule
        • SystemSettings
        • SystemStatus
        • TokenState
        • TradingRewards
        • VirtualPynth
      • SOLIDITY INTERFACES
        • IAddressResolver
        • IBinaryOption
        • IBinaryOptionMarket
        • IBinaryOptionMarketManager
        • IBridgeState
        • ICollateralErc20
        • ICollateralEth
        • ICollateralLoan
        • ICollateralManager
        • IDebtCache
        • IDelegateApprovals
        • IDepot
        • IERC20
        • IEtherCollateral
        • IEtherCollateralpUSD
        • IExchangeRates
        • IExchangeState
        • IExchanger
        • IExternalTokenStakeManager
        • IFeePool
        • IFlexibleStorage
        • IHasBalance
        • IIssuer
        • ILiquidations
        • IPeriFinance
        • IPeriFinanceBridgeToBase
        • IPeriFinanceBridgeToOptimism
        • IPeriFinanceState
        • IPynth
        • IRewardEscrow
        • IRewardEscrowV2
        • IRewardsDistribution
        • IShortingRewards
        • IStakingRewards
        • IStakingState
        • IStakingStateUSDC
        • ISupplySchedule
        • ISystemSettings
        • ISystemStatus
        • ITradingRewards
        • IVirtualPynth
      • SOLIDITY LIBRARIES
        • AddressSetLib
        • Bytes32SetLib
        • Math
        • SafeDecimalMath
        • SafeMath
  • Resources
    • Whitepaper
      • English
    • Media Kit
      • Logo with Texts
      • Logo Only
      • Text Only
      • .ai files
      • .svg files
Powered by GitBook
On this page
  • Description
  • Internal Functions
  1. Development Resources
  2. Source Code Description
  3. SOLIDITY LIBRARIES

Math

PreviousBytes32SetLibNextSafeDecimalMath

Last updated 3 years ago

Description

This is a library contract that provides math functions on fractional numbers, performing arithmetic with unsigned .

Math uses OpenZeppelin's SafeMath library and SafeDecimalMath library for most of its basic arithmetic operations in order to protect from arithmetic overflows and zero divisions.

Source: contracts/Math.sol

Internal Functions

powDecimal

Source

Returns the exponentiation of the base (x) integer by the n^th power to precision of 18 decimals. Function calculates the result using exponentiation by squaring, handling preciison loss by truncation and removes the order of magnitude introduced with integer arithmetics each time the base is squared.

fixed-point decimals