Mangrove
Developper
Developper
  • Welcome
  • Protocol
    • Introduction
    • Technical References
      • Overview
      • Ticks, ratios, and prices
      • Offer-list
        • Views on offers
      • Market-order
        • Delegation
      • Creating & Updating offers
        • Maker contract
        • Offer provisions
        • Gas requirement
        • Public data structures
        • Executing offers
      • Cleaning offers
      • Governance-parameters
        • Global variables
        • Local variables
        • Data structures and views
      • Periphery Contracts
        • MgvReader
        • MgvOracle
      • Literate Source Code
    • Background
      • Taking available liquidity
      • Making liquidity available
      • Reneging on offers
  • Strat Lib
    • What is the Strat Library?
    • Getting-started
      • Set Up Your Local Environment
      • Post a Smart Offer
    • Guides
      • Unlocking liquidity
      • Reposting an offer in the posthook
      • Using last look to renege trades
      • Determining gas requirements
      • Creating a Direct contract
      • Deploying your contract
      • Testing a maker contract
      • Safe offer logic guidelines
      • Approvals
    • Technical references
      • Principal hooks
      • Liquidity routing
      • API preferences
        • Core
          • SRC
            • IMangrove
        • Strats
          • SRC
            • Strategies
              • MangroveOffer
              • MangroveOrder
              • Integrations
                • AaveV3Borrower
                • AaveV3BorrowerImplementation
                • AaveV3BorrowerStorage
                • AaveV3Lender
                • CompoundModule
              • Interfaces
                • IForwarder
                • ILiquidityProvider
                • IOfferLogic
                • IOrderLogic
              • Offer_forwarder
                • Abstract
                  • Forwarder
              • Offer_maker
                • Abstract
                  • Direct
                • Market_making
                  • Kandel
                    • AaveKandel
                    • AaveKandelSeeder
                    • KandelSeeder
                    • Abstract
                      • AbstractKandelSeeder
                      • CoreKandel
                      • DirectWithBidsAndAsksDistribution
                      • GeometricKandel
                      • HasIndexedBidsAndAsks
                      • KandelLib
                      • TradesBaseQuotePair
              • Routeurs
                • SimpleRouter
                • Abstract
                  • AbstractRouter
                • Integrations
                  • AavePooledRouter
                  • HasAaveBalanceMemoizer
              • Utils
                • AccessControlled
              • Vendor
                • AAVE
                  • V3
                    • Contracts
                      • Dependencies
                        • Oppenzeppelin
                          • Contracts
                            • IERC20
                      • Interfaces
                        • IAToken
                        • IAaveIncentivesController
                        • IAaveOracle
                        • ICreditDelegationToken
                        • IInitializableAToken
                        • IPool
                        • IPoolAddressesProvider
                        • IPriceOracleGetter
                        • IScaledBalanceToken
                      • Protocol
                        • Libraries
                          • Configurations
                            • ReserveConfiguration
                          • Helpers
                            • Errors
                          • Types
                            • DataTypes
                    • Periphery
                      • Contracts
                        • MISC
                          • Interfaces
                            • IEACAggregatorProxy
                        • Rewards
                          • Interfaces
                            • IRewardsController
                            • IRewardsDistributor
                            • ITransferStrategyBase
                          • Libraries
                            • RewardsDataTypes
                • Compound
                  • CarefulMath
                  • Exponential
                  • ExponentialNoError
                  • ICompound
    • Background
      • Building Blocks
        • MangroveOffer
        • Direct
        • Forwarder
  • Vaults
    • Understanding vaults
      • Oracles
    • Managing a vault (CLI)
      • Deploying an oracle
      • Creating a vault
      • Monitoring the vault
      • Setting the vault position
      • Setting the fee data
      • Rebalancing
      • Adding or removing liquidity
    • Custom interactions
      • Oracles
      • Vault Factory
      • Managing a vault
        • Setting the position
        • Rebalancing
        • Setting a manager
        • Setting fee
  • Keeper Bots
    • Keeper Bots
    • Guides
      • Using borrowed funds for cleaning
    • Backgroud
      • The role of cleaning bots in Mangrove
      • The role of gas price updater bots in Mangrove
  • Adresses
    • Deployment Addresses
  • Quick Links
    • Glossary
    • Website
    • Whitepaper
Powered by GitBook
On this page
  • expScale
  • doubleScale
  • halfExpScale
  • mantissaOne
  • Exp
  • Double
  • truncate
  • mul_ScalarTruncate
  • mul_ScalarTruncateAddUInt
  • lessThanExp
  • lessThanOrEqualExp
  • greaterThanExp
  • isZeroExp
  • safe224
  • safe32
  • add_
  • add_
  • add_
  • add_
  • sub_
  • sub_
  • sub_
  • sub_
  • mul_
  • mul_
  • mul_
  • mul_
  • mul_
  • mul_
  • mul_
  • mul_
  • div_
  • div_
  • div_
  • div_
  • div_
  • div_
  • div_
  • div_
  • fraction
  1. Strat Lib
  2. Technical references
  3. API preferences
  4. Strats
  5. SRC
  6. Strategies
  7. Vendor
  8. Compound

ExponentialNoError

Exp is a struct which stores decimals with a fixed precision of 18 decimal places. Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:Exp({mantissa: 5100000000000000000}).

expScale

uint256 expScale

doubleScale

uint256 doubleScale

halfExpScale

uint256 halfExpScale

mantissaOne

uint256 mantissaOne

Exp

struct Exp {
  uint256 mantissa;
}

Double

struct Double {
  uint256 mantissa;
}

truncate

function truncate(struct ExponentialNoError.Exp exp) internal pure returns (uint256)

Truncates the given exp to a whole number value. For example, truncate(Exp{mantissa: 15 * expScale}) = 15

mul_ScalarTruncate

function mul_ScalarTruncate(struct ExponentialNoError.Exp a, uint256 scalar) internal pure returns (uint256)

Multiply an Exp by a scalar, then truncate to return an unsigned integer.

mul_ScalarTruncateAddUInt

function mul_ScalarTruncateAddUInt(struct ExponentialNoError.Exp a, uint256 scalar, uint256 addend) internal pure returns (uint256)

Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.

lessThanExp

function lessThanExp(struct ExponentialNoError.Exp left, struct ExponentialNoError.Exp right) internal pure returns (bool)

Checks if first Exp is less than second Exp.

lessThanOrEqualExp

function lessThanOrEqualExp(struct ExponentialNoError.Exp left, struct ExponentialNoError.Exp right) internal pure returns (bool)

Checks if left Exp <= right Exp.

greaterThanExp

function greaterThanExp(struct ExponentialNoError.Exp left, struct ExponentialNoError.Exp right) internal pure returns (bool)

Checks if left Exp > right Exp.

isZeroExp

function isZeroExp(struct ExponentialNoError.Exp value) internal pure returns (bool)

returns true if Exp is exactly zero

safe224

function safe224(uint256 n, string errorMessage) internal pure returns (uint224)

safe32

function safe32(uint256 n, string errorMessage) internal pure returns (uint32)

add_

function add_(struct ExponentialNoError.Exp a, struct ExponentialNoError.Exp b) internal pure returns (struct ExponentialNoError.Exp)

add_

function add_(struct ExponentialNoError.Double a, struct ExponentialNoError.Double b) internal pure returns (struct ExponentialNoError.Double)

add_

function add_(uint256 a, uint256 b) internal pure returns (uint256)

add_

function add_(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)

sub_

function sub_(struct ExponentialNoError.Exp a, struct ExponentialNoError.Exp b) internal pure returns (struct ExponentialNoError.Exp)

sub_

function sub_(struct ExponentialNoError.Double a, struct ExponentialNoError.Double b) internal pure returns (struct ExponentialNoError.Double)

sub_

function sub_(uint256 a, uint256 b) internal pure returns (uint256)

sub_

function sub_(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)

mul_

function mul_(struct ExponentialNoError.Exp a, struct ExponentialNoError.Exp b) internal pure returns (struct ExponentialNoError.Exp)

mul_

function mul_(struct ExponentialNoError.Exp a, uint256 b) internal pure returns (struct ExponentialNoError.Exp)

mul_

function mul_(uint256 a, struct ExponentialNoError.Exp b) internal pure returns (uint256)

mul_

function mul_(struct ExponentialNoError.Double a, struct ExponentialNoError.Double b) internal pure returns (struct ExponentialNoError.Double)

mul_

function mul_(struct ExponentialNoError.Double a, uint256 b) internal pure returns (struct ExponentialNoError.Double)

mul_

function mul_(uint256 a, struct ExponentialNoError.Double b) internal pure returns (uint256)

mul_

function mul_(uint256 a, uint256 b) internal pure returns (uint256)

mul_

function mul_(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)

div_

function div_(struct ExponentialNoError.Exp a, struct ExponentialNoError.Exp b) internal pure returns (struct ExponentialNoError.Exp)

div_

function div_(struct ExponentialNoError.Exp a, uint256 b) internal pure returns (struct ExponentialNoError.Exp)

div_

function div_(uint256 a, struct ExponentialNoError.Exp b) internal pure returns (uint256)

div_

function div_(struct ExponentialNoError.Double a, struct ExponentialNoError.Double b) internal pure returns (struct ExponentialNoError.Double)

div_

function div_(struct ExponentialNoError.Double a, uint256 b) internal pure returns (struct ExponentialNoError.Double)

div_

function div_(uint256 a, struct ExponentialNoError.Double b) internal pure returns (uint256)

div_

function div_(uint256 a, uint256 b) internal pure returns (uint256)

div_

function div_(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)

fraction

function fraction(uint256 a, uint256 b) internal pure returns (struct ExponentialNoError.Double)
PreviousExponentialNextICompound