Source Code
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers.
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | ||||
|---|---|---|---|---|---|---|---|
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272821 | 16 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX | |||||
| 31272801 | 17 mins ago | 0 FRAX |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
FraxswapOracle
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 10000 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.23;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ |
// | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ |
// | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ |
// | |
// ====================================================================
// =========================== FraxswapOracle =========================
// ====================================================================
// Gets token0 and token1 prices from a Fraxswap pair
import { FixedPoint } from "./libraries/FixedPoint.sol";
import { UQ112x112 } from "./libraries/UQ112x112.sol";
import { IFraxswapPair } from "dev-fraxswap/src/contracts/core/interfaces/IFraxswapPair.sol";
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import { IFraxswapOracle } from "./interfaces/IFraxswapOracle.sol";
contract FraxswapOracle is IFraxswapOracle {
using UQ112x112 for uint224;
using FixedPoint for *;
using SafeCast for *;
/// @notice Gets the prices for token0 and token1 from a Fraxswap pool
/// @param pool The LP contract
/// @param period The minimum size of the period between observations, in seconds
/// @param rounds 2 ^ rounds # of blocks to search
/// @param maxDiffPerc Max price change from last value
/// @return result0 The price for token0
/// @return result1 The price for token1
function getPrice(
IFraxswapPair pool,
uint256 period,
uint256 rounds,
uint256 maxDiffPerc
) public view returns (uint256 result0, uint256 result1) {
uint256 lastObservationIndex = pool.getTWAPHistoryLength() - 1;
IFraxswapPair.TWAPObservation memory lastObservation = pool.TWAPObservationHistory(lastObservationIndex);
// Update last observation up to the current block
if (lastObservation.timestamp < block.timestamp) {
// Update the reserves
(uint112 _reserve0, uint112 _reserve1, ) = pool.getReserves();
uint32 blockTimestamp = uint32(block.timestamp % 2 ** 32);
// Get the latest observed prices
unchecked {
uint32 timeElapsed = blockTimestamp - uint32(lastObservation.timestamp);
lastObservation.price0CumulativeLast +=
uint256(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) *
timeElapsed;
lastObservation.price1CumulativeLast +=
uint256(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) *
timeElapsed;
lastObservation.timestamp = blockTimestamp;
}
}
bool found;
// Search for an observation via binary search within the last 2^round number of observations
IFraxswapPair.TWAPObservation memory foundObservation;
uint256 step = 2 ** rounds;
uint256 min = (lastObservationIndex + 2 > step) ? (lastObservationIndex + 2 - step) : 0;
while (step > 1) {
step = step >> 1; // divide by 2
uint256 pos = min + step - 1;
if (pos <= lastObservationIndex) {
IFraxswapPair.TWAPObservation memory observation = pool.TWAPObservationHistory(pos);
unchecked {
if (lastObservation.timestamp - observation.timestamp > period) {
found = true;
foundObservation = observation;
min = pos + 1;
}
}
}
}
// Reverts when a matching period can not be found
require(found, "Period too long");
// Get the price results 1E34 based
uint256 encoded0;
uint256 encoded1;
unchecked {
encoded0 =
(lastObservation.price0CumulativeLast - foundObservation.price0CumulativeLast) /
uint32(lastObservation.timestamp - foundObservation.timestamp);
encoded1 =
(lastObservation.price1CumulativeLast - foundObservation.price1CumulativeLast) /
uint32(lastObservation.timestamp - foundObservation.timestamp);
}
// Handwave unit conversion given: https://github.com/Uniswap/v2-periphery/blob/0335e8f7e1bd1e8d8329fd300aea2ef2f36dd19f/contracts/examples/ExampleSlidingWindowOracle.sol#L99
result0 = mulDecode(encoded0.toUint224());
result1 = mulDecode(encoded1.toUint224());
// Revert if the price changed too much
uint256 checkResult0 = 1e68 / result1;
uint256 diff = (checkResult0 > result0 ? checkResult0 - result0 : result0 - checkResult0);
uint256 diffPerc = (diff * 10_000) / result0;
if (diffPerc > maxDiffPerc) revert("Max diff");
}
/// @notice Gets the prices for token0 from a Fraxswap pool
/// @param pool The LP contract
/// @param period The minimum size of the period between observations, in seconds
/// @param rounds 2 ^ rounds # of blocks to search
/// @param maxDiffPerc Max price change from last value
/// @return result0 The price for token0
function getPrice0(
IFraxswapPair pool,
uint256 period,
uint256 rounds,
uint256 maxDiffPerc
) external view returns (uint256 result0) {
(result0, ) = getPrice(pool, period, rounds, maxDiffPerc);
}
/// @notice Gets the price for token1 from a Fraxswap pool
/// @param pool The LP contract
/// @param period The minimum size of the period between observations, in seconds
/// @param rounds 2 ^ rounds # of blocks to search
/// @param maxDiffPerc Max price change from last value
/// @return result1 The price for token1
function getPrice1(
IFraxswapPair pool,
uint256 period,
uint256 rounds,
uint256 maxDiffPerc
) external view returns (uint256 result1) {
(, result1) = getPrice(pool, period, rounds, maxDiffPerc);
}
// multiplies the uq112x112 with 1E34 without overflowing and then converting it to uint.
function mulDecode(uint224 value) public pure returns (uint256 result) {
if (value < type(uint224).max / 1e34) {
result = FixedPoint.uq112x112(value).mul(1e34).decode144();
} else if (value < type(uint224).max / 1e17) {
result = uint256(FixedPoint.uq112x112(value).mul(1e17).decode144()) * 1e17;
} else {
result = uint256(FixedPoint.uq112x112(value).decode()) * 1e34;
}
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
import { FullMath } from "./FullMath.sol";
import { BitMath } from "./BitMath.sol";
import { Math } from "dev-fraxswap/src/contracts/core/libraries/Math.sol";
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
library FixedPoint {
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
struct uq112x112 {
uint224 _x;
}
// range: [0, 2**144 - 1]
// resolution: 1 / 2**112
struct uq144x112 {
uint256 _x;
}
uint8 public constant RESOLUTION = 112;
uint256 public constant Q112 = 0x10000000000000000000000000000; // 2**112
uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000; // 2**224
uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)
// encode a uint112 as a UQ112x112
function encode(uint112 x) internal pure returns (uq112x112 memory) {
return uq112x112(uint224(x) << RESOLUTION);
}
// encodes a uint144 as a UQ144x112
function encode144(uint144 x) internal pure returns (uq144x112 memory) {
return uq144x112(uint256(x) << RESOLUTION);
}
// decode a UQ112x112 into a uint112 by truncating after the radix point
function decode(uq112x112 memory self) internal pure returns (uint112) {
return uint112(self._x >> RESOLUTION);
}
// decode a UQ144x112 into a uint144 by truncating after the radix point
function decode144(uq144x112 memory self) internal pure returns (uint144) {
return uint144(self._x >> RESOLUTION);
}
// multiply a UQ112x112 by a uint, returning a UQ144x112
// reverts on overflow
function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) {
uint256 z = 0;
require(y == 0 || (z = self._x * y) / y == self._x, "FixedPoint::mul: overflow");
return uq144x112(z);
}
// multiply a UQ112x112 by an int and decode, returning an int
// reverts on overflow
function muli(uq112x112 memory self, int256 y) internal pure returns (int256) {
uint256 z = FullMath.mulDiv(self._x, uint256(y < 0 ? -y : y), Q112);
require(z < 2 ** 255, "FixedPoint::muli: overflow");
return y < 0 ? -int256(z) : int256(z);
}
// multiply a UQ112x112 by a UQ112x112, returning a UQ112x112
// lossy
function muluq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) {
if (self._x == 0 || other._x == 0) {
return uq112x112(0);
}
uint112 upper_self = uint112(self._x >> RESOLUTION); // * 2^0
uint112 lower_self = uint112(self._x & LOWER_MASK); // * 2^-112
uint112 upper_other = uint112(other._x >> RESOLUTION); // * 2^0
uint112 lower_other = uint112(other._x & LOWER_MASK); // * 2^-112
// partial products
uint224 upper = uint224(upper_self) * upper_other; // * 2^0
uint224 lower = uint224(lower_self) * lower_other; // * 2^-224
uint224 uppers_lowero = uint224(upper_self) * lower_other; // * 2^-112
uint224 uppero_lowers = uint224(upper_other) * lower_self; // * 2^-112
// so the bit shift does not overflow
require(upper <= type(uint112).max, "FixedPoint::muluq: upper overflow");
// this cannot exceed 256 bits, all values are 224 bits
uint256 sum = uint256(upper << RESOLUTION) + uppers_lowero + uppero_lowers + (lower >> RESOLUTION);
// so the cast does not overflow
require(sum <= type(uint224).max, "FixedPoint::muluq: sum overflow");
return uq112x112(uint224(sum));
}
// divide a UQ112x112 by a UQ112x112, returning a UQ112x112
function divuq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) {
require(other._x > 0, "FixedPoint::divuq: division by zero");
if (self._x == other._x) {
return uq112x112(uint224(Q112));
}
if (self._x <= type(uint144).max) {
uint256 value = (uint256(self._x) << RESOLUTION) / other._x;
require(value <= type(uint224).max, "FixedPoint::divuq: overflow");
return uq112x112(uint224(value));
}
uint256 result = FullMath.mulDiv(Q112, self._x, other._x);
require(result <= type(uint224).max, "FixedPoint::divuq: overflow");
return uq112x112(uint224(result));
}
// returns a UQ112x112 which represents the ratio of the numerator to the denominator
// can be lossy
function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, "FixedPoint::fraction: division by zero");
if (numerator == 0) return FixedPoint.uq112x112(0);
if (numerator <= type(uint144).max) {
uint256 result = (numerator << RESOLUTION) / denominator;
require(result <= type(uint224).max, "FixedPoint::fraction: overflow");
return uq112x112(uint224(result));
} else {
uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
require(result <= type(uint224).max, "FixedPoint::fraction: overflow");
return uq112x112(uint224(result));
}
}
// take the reciprocal of a UQ112x112
// reverts on overflow
// lossy
function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) {
require(self._x != 0, "FixedPoint::reciprocal: reciprocal of zero");
require(self._x != 1, "FixedPoint::reciprocal: overflow");
return uq112x112(uint224(Q224 / self._x));
}
// square root of a UQ112x112
// lossy between 0/1 and 40 bits
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
if (self._x <= type(uint144).max) {
return uq112x112(uint224(Math.sqrt(uint256(self._x) << 112)));
}
uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
safeShiftBits -= safeShiftBits % 2;
return uq112x112(uint224(Math.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));
}
}pragma solidity >=0.8.0;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2 ** 112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import { IUniswapV2Pair } from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
/// @dev Fraxswap LP Pair Interface
interface IFraxswapPair is IUniswapV2Pair {
// TWAMM
struct TWAPObservation {
uint256 timestamp;
uint256 price0CumulativeLast;
uint256 price1CumulativeLast;
}
function TWAPObservationHistory(uint256 index) external view returns (TWAPObservation memory);
event LongTermSwap0To1(address indexed addr, uint256 orderId, uint256 amount0In, uint256 numberOfTimeIntervals);
event LongTermSwap1To0(address indexed addr, uint256 orderId, uint256 amount1In, uint256 numberOfTimeIntervals);
event CancelLongTermOrder(
address indexed addr,
uint256 orderId,
address sellToken,
uint256 unsoldAmount,
address buyToken,
uint256 purchasedAmount
);
event WithdrawProceedsFromLongTermOrder(
address indexed addr,
uint256 orderId,
address indexed proceedToken,
uint256 proceeds,
bool orderExpired
);
function fee() external view returns (uint256);
function longTermSwapFrom0To1(uint256 amount0In, uint256 numberOfTimeIntervals) external returns (uint256 orderId);
function longTermSwapFrom1To0(uint256 amount1In, uint256 numberOfTimeIntervals) external returns (uint256 orderId);
function cancelLongTermSwap(uint256 orderId) external;
function withdrawProceedsFromLongTermSwap(
uint256 orderId
) external returns (bool is_expired, address rewardTkn, uint256 totalReward);
function executeVirtualOrders(uint256 blockTimestamp) external;
function getAmountOut(uint256 amountIn, address tokenIn) external view returns (uint256);
function getAmountIn(uint256 amountOut, address tokenOut) external view returns (uint256);
function orderTimeInterval() external returns (uint256);
function getTWAPHistoryLength() external view returns (uint256);
function getTwammReserves()
external
view
returns (
uint112 _reserve0,
uint112 _reserve1,
uint32 _blockTimestampLast,
uint112 _twammReserve0,
uint112 _twammReserve1,
uint256 _fee
);
function getReserveAfterTwamm(
uint256 blockTimestamp
)
external
view
returns (
uint112 _reserve0,
uint112 _reserve1,
uint256 lastVirtualOrderTimestamp,
uint112 _twammReserve0,
uint112 _twammReserve1
);
function getNextOrderID() external view returns (uint256);
function getOrderIDsForUser(address user) external view returns (uint256[] memory);
function getOrderIDsForUserLength(address user) external view returns (uint256);
function twammUpToDate() external view returns (bool);
function getTwammState()
external
view
returns (
uint256 token0Rate,
uint256 token1Rate,
uint256 lastVirtualOrderTimestamp,
uint256 orderTimeInterval_rtn,
uint256 rewardFactorPool0,
uint256 rewardFactorPool1
);
function getTwammSalesRateEnding(
uint256 _blockTimestamp
) external view returns (uint256 orderPool0SalesRateEnding, uint256 orderPool1SalesRateEnding);
function getTwammRewardFactor(
uint256 _blockTimestamp
) external view returns (uint256 rewardFactorPool0AtTimestamp, uint256 rewardFactorPool1AtTimestamp);
function getTwammOrder(
uint256 orderId
)
external
view
returns (
uint256 id,
uint256 creationTimestamp,
uint256 expirationTimestamp,
uint256 saleRate,
address owner,
address sellTokenAddr,
address buyTokenAddr
);
function getTwammOrderProceedsView(
uint256 orderId,
uint256 blockTimestamp
) external view returns (bool orderExpired, uint256 totalReward);
function getTwammOrderProceeds(uint256 orderId) external returns (bool orderExpired, uint256 totalReward);
function togglePauseNewSwaps() external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.20;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeCast {
/**
* @dev Value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
/**
* @dev An int value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedIntToUint(int256 value);
/**
* @dev Value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);
/**
* @dev An uint value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedUintToInt(uint256 value);
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toUint248(uint256 value) internal pure returns (uint248) {
if (value > type(uint248).max) {
revert SafeCastOverflowedUintDowncast(248, value);
}
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toUint240(uint256 value) internal pure returns (uint240) {
if (value > type(uint240).max) {
revert SafeCastOverflowedUintDowncast(240, value);
}
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toUint232(uint256 value) internal pure returns (uint232) {
if (value > type(uint232).max) {
revert SafeCastOverflowedUintDowncast(232, value);
}
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toUint224(uint256 value) internal pure returns (uint224) {
if (value > type(uint224).max) {
revert SafeCastOverflowedUintDowncast(224, value);
}
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toUint216(uint256 value) internal pure returns (uint216) {
if (value > type(uint216).max) {
revert SafeCastOverflowedUintDowncast(216, value);
}
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toUint208(uint256 value) internal pure returns (uint208) {
if (value > type(uint208).max) {
revert SafeCastOverflowedUintDowncast(208, value);
}
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toUint200(uint256 value) internal pure returns (uint200) {
if (value > type(uint200).max) {
revert SafeCastOverflowedUintDowncast(200, value);
}
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toUint192(uint256 value) internal pure returns (uint192) {
if (value > type(uint192).max) {
revert SafeCastOverflowedUintDowncast(192, value);
}
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toUint184(uint256 value) internal pure returns (uint184) {
if (value > type(uint184).max) {
revert SafeCastOverflowedUintDowncast(184, value);
}
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toUint176(uint256 value) internal pure returns (uint176) {
if (value > type(uint176).max) {
revert SafeCastOverflowedUintDowncast(176, value);
}
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toUint168(uint256 value) internal pure returns (uint168) {
if (value > type(uint168).max) {
revert SafeCastOverflowedUintDowncast(168, value);
}
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toUint160(uint256 value) internal pure returns (uint160) {
if (value > type(uint160).max) {
revert SafeCastOverflowedUintDowncast(160, value);
}
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toUint152(uint256 value) internal pure returns (uint152) {
if (value > type(uint152).max) {
revert SafeCastOverflowedUintDowncast(152, value);
}
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toUint136(uint256 value) internal pure returns (uint136) {
if (value > type(uint136).max) {
revert SafeCastOverflowedUintDowncast(136, value);
}
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
if (value > type(uint128).max) {
revert SafeCastOverflowedUintDowncast(128, value);
}
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toUint120(uint256 value) internal pure returns (uint120) {
if (value > type(uint120).max) {
revert SafeCastOverflowedUintDowncast(120, value);
}
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toUint112(uint256 value) internal pure returns (uint112) {
if (value > type(uint112).max) {
revert SafeCastOverflowedUintDowncast(112, value);
}
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toUint104(uint256 value) internal pure returns (uint104) {
if (value > type(uint104).max) {
revert SafeCastOverflowedUintDowncast(104, value);
}
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toUint96(uint256 value) internal pure returns (uint96) {
if (value > type(uint96).max) {
revert SafeCastOverflowedUintDowncast(96, value);
}
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toUint88(uint256 value) internal pure returns (uint88) {
if (value > type(uint88).max) {
revert SafeCastOverflowedUintDowncast(88, value);
}
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toUint80(uint256 value) internal pure returns (uint80) {
if (value > type(uint80).max) {
revert SafeCastOverflowedUintDowncast(80, value);
}
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
if (value > type(uint64).max) {
revert SafeCastOverflowedUintDowncast(64, value);
}
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toUint56(uint256 value) internal pure returns (uint56) {
if (value > type(uint56).max) {
revert SafeCastOverflowedUintDowncast(56, value);
}
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toUint48(uint256 value) internal pure returns (uint48) {
if (value > type(uint48).max) {
revert SafeCastOverflowedUintDowncast(48, value);
}
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toUint40(uint256 value) internal pure returns (uint40) {
if (value > type(uint40).max) {
revert SafeCastOverflowedUintDowncast(40, value);
}
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
if (value > type(uint32).max) {
revert SafeCastOverflowedUintDowncast(32, value);
}
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toUint24(uint256 value) internal pure returns (uint24) {
if (value > type(uint24).max) {
revert SafeCastOverflowedUintDowncast(24, value);
}
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toUint8(uint256 value) internal pure returns (uint8) {
if (value > type(uint8).max) {
revert SafeCastOverflowedUintDowncast(8, value);
}
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
if (value < 0) {
revert SafeCastOverflowedIntToUint(value);
}
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(248, value);
}
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(240, value);
}
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(232, value);
}
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(224, value);
}
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(216, value);
}
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(208, value);
}
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(200, value);
}
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(184, value);
}
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(176, value);
}
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(168, value);
}
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(160, value);
}
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(152, value);
}
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(144, value);
}
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(136, value);
}
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(128, value);
}
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(120, value);
}
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(112, value);
}
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(104, value);
}
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(96, value);
}
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(88, value);
}
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(80, value);
}
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(72, value);
}
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(64, value);
}
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(56, value);
}
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(48, value);
}
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(40, value);
}
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(32, value);
}
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(24, value);
}
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(8, value);
}
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
if (value > uint256(type(int256).max)) {
revert SafeCastOverflowedUintToInt(value);
}
return int256(value);
}
}pragma solidity ^0.8.0;
import { IFraxswapPair } from "dev-fraxswap/src/contracts/core/interfaces/IFraxswapPair.sol";
interface IFraxswapOracle {
function getPrice(
IFraxswapPair pool,
uint256 period,
uint256 rounds,
uint256 maxDiffPerc
) external view returns (uint256 result0, uint256 result1);
function getPrice0(
IFraxswapPair pool,
uint256 period,
uint256 rounds,
uint256 maxDiffPerc
) external view returns (uint256 result0);
function getPrice1(
IFraxswapPair pool,
uint256 period,
uint256 rounds,
uint256 maxDiffPerc
) external view returns (uint256 result1);
function mulDecode(uint224 value) external pure returns (uint256 result);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/// @notice Math library that facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision.
/// @author Adapted from https://github.com/Uniswap/uniswap-v3-core/blob/main/contracts/libraries/FullMath.sol.
/// @dev Handles "phantom overflow", i.e., allows multiplication and division where an intermediate value overflows 256 bits.
library FullMath {
/// @notice Calculates floor(a×b÷denominator) with full precision - throws if result overflows an uint256 or denominator == 0.
/// @param a The multiplicand.
/// @param b The multiplier.
/// @param denominator The divisor.
/// @return result The 256-bit result.
/// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.
function mulDiv(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = a * b.
// Compute the product mod 2**256 and mod 2**256 - 1,
// then use the Chinese Remainder Theorem to reconstruct
// the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2**256 + prod0.
uint256 prod0; // Least significant 256 bits of the product.
uint256 prod1; // Most significant 256 bits of the product.
assembly {
let mm := mulmod(a, b, not(0))
prod0 := mul(a, b)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
require(denominator > 0);
assembly {
result := div(prod0, denominator)
}
return result;
}
// Make sure the result is less than 2**256 -
// also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0] -
// compute remainder using mulmod.
uint256 remainder;
assembly {
remainder := mulmod(a, b, denominator)
}
// Subtract 256 bit number from 512 bit number.
assembly {
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator -
// compute largest power of two divisor of denominator
// (always >= 1).
uint256 twos = uint256(-int256(denominator)) & denominator;
// Divide denominator by power of two.
assembly {
denominator := div(denominator, twos)
}
// Divide [prod1 prod0] by the factors of two.
assembly {
prod0 := div(prod0, twos)
}
// Shift in bits from prod1 into prod0. For this we need
// to flip `twos` such that it is 2**256 / twos -
// if twos is zero, then it becomes one.
assembly {
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
// Invert denominator mod 2**256 -
// now that denominator is an odd number, it has an inverse
// modulo 2**256 such that denominator * inv = 1 mod 2**256.
// Compute the inverse by starting with a seed that is correct
// for four bits. That is, denominator * inv = 1 mod 2**4.
uint256 inv = (3 * denominator) ^ 2;
// Now use Newton-Raphson iteration to improve the precision.
// Thanks to Hensel's lifting lemma, this also works in modular
// arithmetic, doubling the correct bits in each step.
inv *= 2 - denominator * inv; // Inverse mod 2**8.
inv *= 2 - denominator * inv; // Inverse mod 2**16.
inv *= 2 - denominator * inv; // Inverse mod 2**32.
inv *= 2 - denominator * inv; // Inverse mod 2**64.
inv *= 2 - denominator * inv; // Inverse mod 2**128.
inv *= 2 - denominator * inv; // Inverse mod 2**256.
// Because the division is now exact we can divide by multiplying
// with the modular inverse of denominator. This will give us the
// correct result modulo 2**256. Since the precoditions guarantee
// that the outcome is less than 2**256, this is the final result.
// We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inv;
return result;
}
}
/// @notice Calculates ceil(a×b÷denominator) with full precision - throws if result overflows an uint256 or denominator == 0.
/// @param a The multiplicand.
/// @param b The multiplier.
/// @param denominator The divisor.
/// @return result The 256-bit result.
function mulDivRoundingUp(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result) {
result = mulDiv(a, b, denominator);
unchecked {
if (mulmod(a, b, denominator) != 0) {
require(result < type(uint256).max);
result++;
}
}
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
library BitMath {
// returns the 0 indexed position of the most significant bit of the input x
// s.t. x >= 2**msb and x < 2**(msb+1)
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, "BitMath::mostSignificantBit: zero");
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
r += 64;
}
if (x >= 0x100000000) {
x >>= 32;
r += 32;
}
if (x >= 0x10000) {
x >>= 16;
r += 16;
}
if (x >= 0x100) {
x >>= 8;
r += 8;
}
if (x >= 0x10) {
x >>= 4;
r += 4;
}
if (x >= 0x4) {
x >>= 2;
r += 2;
}
if (x >= 0x2) r += 1;
}
// returns the 0 indexed position of the least significant bit of the input x
// s.t. (x & 2**lsb) != 0 and (x & (2**(lsb) - 1)) == 0)
// i.e. the bit at the index is set and the mask of all lower bits is 0
function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, "BitMath::leastSignificantBit: zero");
r = 255;
if (x & type(uint128).max > 0) {
r -= 128;
} else {
x >>= 128;
}
if (x & type(uint64).max > 0) {
r -= 64;
} else {
x >>= 64;
}
if (x & type(uint32).max > 0) {
r -= 32;
} else {
x >>= 32;
}
if (x & type(uint16).max > 0) {
r -= 16;
} else {
x >>= 16;
}
if (x & type(uint8).max > 0) {
r -= 8;
} else {
x >>= 8;
}
if (x & 0xf > 0) {
r -= 4;
} else {
x >>= 4;
}
if (x & 0x3 > 0) {
r -= 2;
} else {
x >>= 2;
}
if (x & 0x1 > 0) r -= 1;
}
}// SPDX-Licence-Identifier: MIT
pragma solidity ^0.8.0;
// a library for performing various math operations
library Math {
function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint256 y) internal pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}{
"remappings": [
"frax-std/=node_modules/frax-standard-solidity/src/",
"@prb/test/=node_modules/@prb/test/",
"forge-std/=node_modules/forge-std/src/",
"ds-test/=node_modules/ds-test/src/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@uniswap/=node_modules/@uniswap/",
"dev-fraxswap/=node_modules/dev-fraxswap/",
"frax-standard-solidity/=node_modules/frax-standard-solidity/",
"solidity-bytes-utils/=node_modules/solidity-bytes-utils/",
"solmate/=node_modules/solmate/"
],
"optimizer": {
"enabled": true,
"runs": 10000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": false
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "shanghai",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"contract IFraxswapPair","name":"pool","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"rounds","type":"uint256"},{"internalType":"uint256","name":"maxDiffPerc","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"result0","type":"uint256"},{"internalType":"uint256","name":"result1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IFraxswapPair","name":"pool","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"rounds","type":"uint256"},{"internalType":"uint256","name":"maxDiffPerc","type":"uint256"}],"name":"getPrice0","outputs":[{"internalType":"uint256","name":"result0","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IFraxswapPair","name":"pool","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"rounds","type":"uint256"},{"internalType":"uint256","name":"maxDiffPerc","type":"uint256"}],"name":"getPrice1","outputs":[{"internalType":"uint256","name":"result1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint224","name":"value","type":"uint224"}],"name":"mulDecode","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"pure","type":"function"}]Contract Creation Code
608060405234801561000f575f80fd5b50610ddf8061001d5f395ff3fe608060405234801561000f575f80fd5b506004361061004a575f3560e01c806336968ca41461004e5780638f4bb32a1461007457806393e2ae7c1461009c5780639c59bc53146100af575b5f80fd5b61006161005c3660046109ee565b6100c2565b6040519081526020015b60405180910390f35b6100876100823660046109ee565b6100d9565b6040805192835260208301919091520161006b565b6100616100aa3660046109ee565b61063b565b6100616100bd366004610a3e565b610652565b5f6100cf858585856100d9565b9695505050505050565b5f805f60018773ffffffffffffffffffffffffffffffffffffffff16637fa2ee6e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610127573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061014b9190610a79565b6101559190610abd565b6040517f27e73836000000000000000000000000000000000000000000000000000000008152600481018290529091505f9073ffffffffffffffffffffffffffffffffffffffff8916906327e7383690602401606060405180830381865afa1580156101c3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101e79190610ad0565b905042815f01511015610334575f808973ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561023f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102639190610b6c565b5090925090505f61027964010000000042610be5565b8451909150810363ffffffff81166102b88561029486610872565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169061089c565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16028560200181815101915081815250508063ffffffff166102fa8461029487610872565b6040870180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190525063ffffffff16835250505b5f61035660405180606001604052805f81526020015f81526020015f81525090565b5f610362896002610d16565b90505f81610371876002610d21565b1161037c575f610392565b81610388876002610d21565b6103929190610abd565b90505b600182111561047857600191821c915f906103b08484610d21565b6103ba9190610abd565b9050868111610472576040517f27e73836000000000000000000000000000000000000000000000000000000008152600481018290525f9073ffffffffffffffffffffffffffffffffffffffff8f16906327e7383690602401606060405180830381865afa15801561042e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104529190610ad0565b8051885191925090038d101561047057600195508094508160010192505b505b50610395565b836104e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f506572696f6420746f6f206c6f6e67000000000000000000000000000000000060448201526064015b60405180910390fd5b5f80845f0151875f01510363ffffffff1685602001518860200151038161050d5761050d610bb8565b049150845f0151875f01510363ffffffff1685604001518860400151038161053757610537610bb8565b0490506105466100bd836108be565b99506105546100bd826108be565b98505f61057e8a7c03b58e88c75313ec9d329eaaa18fb92f75215b17100000000000000000610d34565b90505f8b821161059757610592828d610abd565b6105a1565b6105a18c83610abd565b90505f8c6105b183612710610d47565b6105bb9190610d34565b90508d811115610627576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600860248201527f4d6178206469666600000000000000000000000000000000000000000000000060448201526064016104db565b505050505050505050505094509492505050565b5f610648858585856100d9565b5095945050505050565b5f6106886e01ed09bead87c0378d8e64000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff610d5e565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1610156107355760408051602081019091527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316815261071b90610714906e01ed09bead87c0378d8e6400000000610923565b5160701c90565b71ffffffffffffffffffffffffffffffffffff1692915050565b61076367016345785d8a00007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff610d5e565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1610156108145760408051602081019091527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681526107e8906107149067016345785d8a0000610923565b61080e9071ffffffffffffffffffffffffffffffffffff1667016345785d8a0000610d47565b92915050565b60408051602081019091527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316905261080e6dffffffffffffffffffffffffffff607084901c166e01ed09bead87c0378d8e6400000000610d47565b919050565b5f61080e6e0100000000000000000000000000006dffffffffffffffffffffffffffff8416610d98565b5f6108b76dffffffffffffffffffffffffffff831684610d5e565b9392505050565b5f7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff82111561091f576040517f6dfcc65000000000000000000000000000000000000000000000000000000000815260e06004820152602481018390526044016104db565b5090565b60408051602081019091525f81525f821580610973575083517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16836109658183610d47565b92506109719083610d34565b145b6109d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4669786564506f696e743a3a6d756c3a206f766572666c6f770000000000000060448201526064016104db565b60408051602081019091529081529392505050565b5f805f8060808587031215610a01575f80fd5b843573ffffffffffffffffffffffffffffffffffffffff81168114610a24575f80fd5b966020860135965060408601359560600135945092505050565b5f60208284031215610a4e575f80fd5b81357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146108b7575f80fd5b5f60208284031215610a89575f80fd5b5051919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8181038181111561080e5761080e610a90565b5f60608284031215610ae0575f80fd5b6040516060810181811067ffffffffffffffff82111715610b28577f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b80604052508251815260208301516020820152604083015160408201528091505092915050565b80516dffffffffffffffffffffffffffff8116811461086d575f80fd5b5f805f60608486031215610b7e575f80fd5b610b8784610b4f565b9250610b9560208501610b4f565b9150604084015163ffffffff81168114610bad575f80fd5b809150509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f82610bf357610bf3610bb8565b500690565b600181815b80851115610c5157817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610c3757610c37610a90565b80851615610c4457918102915b93841c9390800290610bfd565b509250929050565b5f82610c675750600161080e565b81610c7357505f61080e565b8160018114610c895760028114610c9357610caf565b600191505061080e565b60ff841115610ca457610ca4610a90565b50506001821b61080e565b5060208310610133831016604e8410600b8410161715610cd2575081810a61080e565b610cdc8383610bf8565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610d0e57610d0e610a90565b029392505050565b5f6108b78383610c59565b8082018082111561080e5761080e610a90565b5f82610d4257610d42610bb8565b500490565b808202811582820484141761080e5761080e610a90565b5f7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff80841680610d8c57610d8c610bb8565b92169190910492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff828116828216818102831692918115828504821417610dd657610dd6610a90565b5050509291505056
Deployed Bytecode
0x608060405234801561000f575f80fd5b506004361061004a575f3560e01c806336968ca41461004e5780638f4bb32a1461007457806393e2ae7c1461009c5780639c59bc53146100af575b5f80fd5b61006161005c3660046109ee565b6100c2565b6040519081526020015b60405180910390f35b6100876100823660046109ee565b6100d9565b6040805192835260208301919091520161006b565b6100616100aa3660046109ee565b61063b565b6100616100bd366004610a3e565b610652565b5f6100cf858585856100d9565b9695505050505050565b5f805f60018773ffffffffffffffffffffffffffffffffffffffff16637fa2ee6e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610127573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061014b9190610a79565b6101559190610abd565b6040517f27e73836000000000000000000000000000000000000000000000000000000008152600481018290529091505f9073ffffffffffffffffffffffffffffffffffffffff8916906327e7383690602401606060405180830381865afa1580156101c3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101e79190610ad0565b905042815f01511015610334575f808973ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561023f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102639190610b6c565b5090925090505f61027964010000000042610be5565b8451909150810363ffffffff81166102b88561029486610872565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169061089c565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16028560200181815101915081815250508063ffffffff166102fa8461029487610872565b6040870180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190525063ffffffff16835250505b5f61035660405180606001604052805f81526020015f81526020015f81525090565b5f610362896002610d16565b90505f81610371876002610d21565b1161037c575f610392565b81610388876002610d21565b6103929190610abd565b90505b600182111561047857600191821c915f906103b08484610d21565b6103ba9190610abd565b9050868111610472576040517f27e73836000000000000000000000000000000000000000000000000000000008152600481018290525f9073ffffffffffffffffffffffffffffffffffffffff8f16906327e7383690602401606060405180830381865afa15801561042e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104529190610ad0565b8051885191925090038d101561047057600195508094508160010192505b505b50610395565b836104e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f506572696f6420746f6f206c6f6e67000000000000000000000000000000000060448201526064015b60405180910390fd5b5f80845f0151875f01510363ffffffff1685602001518860200151038161050d5761050d610bb8565b049150845f0151875f01510363ffffffff1685604001518860400151038161053757610537610bb8565b0490506105466100bd836108be565b99506105546100bd826108be565b98505f61057e8a7c03b58e88c75313ec9d329eaaa18fb92f75215b17100000000000000000610d34565b90505f8b821161059757610592828d610abd565b6105a1565b6105a18c83610abd565b90505f8c6105b183612710610d47565b6105bb9190610d34565b90508d811115610627576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600860248201527f4d6178206469666600000000000000000000000000000000000000000000000060448201526064016104db565b505050505050505050505094509492505050565b5f610648858585856100d9565b5095945050505050565b5f6106886e01ed09bead87c0378d8e64000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff610d5e565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1610156107355760408051602081019091527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316815261071b90610714906e01ed09bead87c0378d8e6400000000610923565b5160701c90565b71ffffffffffffffffffffffffffffffffffff1692915050565b61076367016345785d8a00007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff610d5e565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1610156108145760408051602081019091527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681526107e8906107149067016345785d8a0000610923565b61080e9071ffffffffffffffffffffffffffffffffffff1667016345785d8a0000610d47565b92915050565b60408051602081019091527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316905261080e6dffffffffffffffffffffffffffff607084901c166e01ed09bead87c0378d8e6400000000610d47565b919050565b5f61080e6e0100000000000000000000000000006dffffffffffffffffffffffffffff8416610d98565b5f6108b76dffffffffffffffffffffffffffff831684610d5e565b9392505050565b5f7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff82111561091f576040517f6dfcc65000000000000000000000000000000000000000000000000000000000815260e06004820152602481018390526044016104db565b5090565b60408051602081019091525f81525f821580610973575083517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16836109658183610d47565b92506109719083610d34565b145b6109d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4669786564506f696e743a3a6d756c3a206f766572666c6f770000000000000060448201526064016104db565b60408051602081019091529081529392505050565b5f805f8060808587031215610a01575f80fd5b843573ffffffffffffffffffffffffffffffffffffffff81168114610a24575f80fd5b966020860135965060408601359560600135945092505050565b5f60208284031215610a4e575f80fd5b81357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146108b7575f80fd5b5f60208284031215610a89575f80fd5b5051919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8181038181111561080e5761080e610a90565b5f60608284031215610ae0575f80fd5b6040516060810181811067ffffffffffffffff82111715610b28577f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b80604052508251815260208301516020820152604083015160408201528091505092915050565b80516dffffffffffffffffffffffffffff8116811461086d575f80fd5b5f805f60608486031215610b7e575f80fd5b610b8784610b4f565b9250610b9560208501610b4f565b9150604084015163ffffffff81168114610bad575f80fd5b809150509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f82610bf357610bf3610bb8565b500690565b600181815b80851115610c5157817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610c3757610c37610a90565b80851615610c4457918102915b93841c9390800290610bfd565b509250929050565b5f82610c675750600161080e565b81610c7357505f61080e565b8160018114610c895760028114610c9357610caf565b600191505061080e565b60ff841115610ca457610ca4610a90565b50506001821b61080e565b5060208310610133831016604e8410600b8410161715610cd2575081810a61080e565b610cdc8383610bf8565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610d0e57610d0e610a90565b029392505050565b5f6108b78383610c59565b8082018082111561080e5761080e610a90565b5f82610d4257610d42610bb8565b500490565b808202811582820484141761080e5761080e610a90565b5f7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff80841680610d8c57610d8c610bb8565b92169190910492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff828116828216818102831692918115828504821417610dd657610dd6610a90565b5050509291505056
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in FRAX
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.