Source Code
Overview
S Balance
S Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Ramm
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.18;
import "@openzeppelin/contracts-v4/security/ReentrancyGuard.sol";
import "../../abstract/MasterAwareV2.sol";
import "../../interfaces/IMCR.sol";
import "../../interfaces/IPool.sol";
import "../../interfaces/IRamm.sol";
import "../../interfaces/ITokenController.sol";
import "../../libraries/Math.sol";
import "../../libraries/SafeUintCast.sol";
contract Ramm is IRamm, MasterAwareV2, ReentrancyGuard {
using SafeUintCast for uint;
using Math for uint;
/* ========== STATE VARIABLES ========== */
Slot0 public slot0;
Slot1 public slot1;
// one slot per array item
Observation[3] public observations;
// circuit breakers slot
uint96 public ethReleased;
uint32 public ethLimit;
uint96 public nxmReleased;
uint32 public nxmLimit;
/* ========== CONSTANTS ========== */
uint public constant LIQ_SPEED_PERIOD = 1 days;
uint public constant RATCHET_PERIOD = 1 days;
uint public constant RATCHET_DENOMINATOR = 10_000;
uint public constant PRICE_BUFFER = 100;
uint public constant PRICE_BUFFER_DENOMINATOR = 10_000;
uint public constant GRANULARITY = 3;
uint public constant PERIOD_SIZE = 3 days;
uint public constant FAST_LIQUIDITY_SPEED = 1_500 ether;
uint public constant TARGET_LIQUIDITY = 5_000 ether;
uint public constant LIQ_SPEED_A = 100 ether;
uint public constant LIQ_SPEED_B = 100 ether;
uint public constant NORMAL_RATCHET_SPEED = 400;
uint public constant FAST_RATCHET_SPEED = 5_000;
uint internal constant INITIAL_LIQUIDITY = 5_000 ether;
uint internal constant INITIAL_BUDGET = 43_835 ether;
// circuit breakers
uint internal constant INITIAL_ETH_LIMIT = 22_000;
uint internal constant INITIAL_NXM_LIMIT = 250_000;
/* ========== IMMUTABLES ========== */
uint internal immutable SPOT_PRICE_B;
/* ========== CONSTRUCTOR ========== */
constructor(uint spotPriceB) {
SPOT_PRICE_B = spotPriceB;
}
function loadState() public view returns (State memory) {
return State(
slot0.nxmReserveA,
slot0.nxmReserveB,
slot1.ethReserve,
slot1.budget,
slot1.budget == 0 ? NORMAL_RATCHET_SPEED : FAST_RATCHET_SPEED,
slot1.updatedAt
);
}
function storeState(State memory state) internal {
// slot 0
slot0.nxmReserveA = state.nxmA.toUint128();
slot0.nxmReserveB = state.nxmB.toUint128();
// slot 1
slot1.ethReserve = state.eth.toUint128();
slot1.budget = state.budget.toUint88();
slot1.updatedAt = state.timestamp.toUint32();
}
function ratchetSpeedB() external view returns (uint) {
return slot1.budget == 0 ? NORMAL_RATCHET_SPEED : FAST_RATCHET_SPEED;
}
function swapPaused() external view returns (bool) {
return slot1.swapPaused;
}
/**
* @notice Swaps nxmIn tokens for ETH or ETH sent for NXM tokens
* @param nxmIn The amount of NXM tokens to swap (set to 0 when swapping ETH for NXM)
* @param minAmountOut The minimum amount to receive in the swap (reverts with InsufficientAmountOut if not met)
* @param deadline The deadline for the swap to be executed (reverts with SwapExpired if deadline is surpassed)
* @return amountOut The amount received in the swap
*/
function swap(
uint nxmIn,
uint minAmountOut,
uint deadline
) external payable nonReentrant returns (uint) {
if (msg.value > 0 && nxmIn > 0) {
revert OneInputOnly();
}
if (msg.value == 0 && nxmIn == 0) {
revert OneInputRequired();
}
if (block.timestamp > deadline) {
revert SwapExpired(deadline, block.timestamp);
}
Context memory context = Context(
pool().getPoolValueInEth(), // capital
tokenController().totalSupply(), // supply
mcr().getMCR() // mcr
);
State memory initialState = loadState();
if (master.isPause()) {
revert SystemPaused();
}
if (slot1.swapPaused) {
revert SwapPaused();
}
uint amountOut = msg.value > 0
? swapEthForNxm(msg.value, minAmountOut, context, initialState)
: swapNxmForEth(nxmIn, minAmountOut, context, initialState);
if (msg.value > 0) {
nxmReleased = (nxmReleased + amountOut).toUint96();
if (nxmLimit > 0 && nxmReleased > uint(nxmLimit) * 1 ether) {
revert NxmCircuitBreakerHit();
}
} else {
ethReleased = (ethReleased + amountOut).toUint96();
if (ethLimit > 0 && ethReleased > uint(ethLimit) * 1 ether) {
revert EthCircuitBreakerHit();
}
}
mcr().updateMCRInternal(false);
return amountOut;
}
/**
* @dev should only be called by swap
*/
function swapEthForNxm(
uint ethIn,
uint minAmountOut,
Context memory context,
State memory initialState
) internal returns (uint nxmOut) {
Observation[3] memory _observations = observations;
// current state
(
State memory state,
uint injected,
uint extracted
) = _getReserves(initialState, context, block.timestamp);
_observations = _updateTwap(initialState, _observations, context, block.timestamp);
{
uint k = state.eth * state.nxmA;
uint newEth = state.eth + ethIn;
uint newNxmA = k / newEth;
uint newNxmB = state.nxmB * newEth / state.eth;
nxmOut = state.nxmA - newNxmA;
if (nxmOut < minAmountOut) {
revert InsufficientAmountOut(nxmOut, minAmountOut);
}
// edge case: below goes over bv due to eth-dai price changing
state.nxmA = newNxmA;
state.nxmB = newNxmB;
state.eth = newEth;
state.timestamp = block.timestamp;
}
storeState(state);
if (injected > 0) {
emit EthInjected(injected);
}
if (extracted > 0) {
emit EthExtracted(extracted);
}
for (uint i = 0; i < _observations.length; i++) {
observations[i] = _observations[i];
}
// transfer assets
(bool ok,) = address(pool()).call{value: msg.value}("");
if (ok != true) {
revert EthTransferFailed();
}
tokenController().mint(msg.sender, nxmOut);
emit EthSwappedForNxm(msg.sender, ethIn, nxmOut);
return nxmOut;
}
/**
* @dev should only be called by swap
*/
function swapNxmForEth(
uint nxmIn,
uint minAmountOut,
Context memory context,
State memory initialState
) internal returns (uint ethOut) {
Observation[3] memory _observations = observations;
// current state
(
State memory state,
uint injected,
uint extracted
) = _getReserves(initialState, context, block.timestamp);
_observations = _updateTwap(initialState, _observations, context, block.timestamp);
{
uint k = state.eth * state.nxmB;
uint newNxmB = state.nxmB + nxmIn;
uint newEth = k / newNxmB;
uint newNxmA = state.nxmA * newEth / state.eth;
ethOut = state.eth - newEth;
if (ethOut < minAmountOut) {
revert InsufficientAmountOut(ethOut, minAmountOut);
}
if (context.capital - ethOut < context.mcr) {
revert NoSwapsInBufferZone();
}
// update storage
state.nxmA = newNxmA;
state.nxmB = newNxmB;
state.eth = newEth;
state.timestamp = block.timestamp;
}
storeState(state);
if (injected > 0) {
emit EthInjected(injected);
}
if (extracted > 0) {
emit EthExtracted(extracted);
}
for (uint i = 0; i < _observations.length; i++) {
observations[i] = _observations[i];
}
tokenController().burnFrom(msg.sender, nxmIn);
pool().sendEth(msg.sender, ethOut);
emit NxmSwappedForEth(msg.sender, nxmIn, ethOut);
return ethOut;
}
/**
* @notice Sets the budget to 0
* @dev Can only be called by governance
*/
function removeBudget() external onlyGovernance {
slot1.budget = 0;
emit BudgetRemoved();
}
/**
* @notice Sets swap emergency pause
* @dev Can only be called by the emergency admin
* @param _swapPaused to toggle swap emergency pause ON/OFF
*/
function setEmergencySwapPause(bool _swapPaused) external onlyEmergencyAdmin {
slot1.swapPaused = _swapPaused;
emit SwapPauseConfigured(_swapPaused);
}
function setCircuitBreakerLimits(
uint _ethLimit,
uint _nxmLimit
) external onlyEmergencyAdmin {
ethLimit = _ethLimit.toUint32();
nxmLimit = _nxmLimit.toUint32();
}
/* ============== VIEWS ============= */
/**
* @notice Retrieves the current reserves of the RAMM contract
* @return _ethReserve The current ETH reserve
* @return nxmA The current NXM buy price
* @return nxmB The current NXM sell price
* @return _budget The current ETH budget used for injection
*/
function getReserves() external view returns (uint _ethReserve, uint nxmA, uint nxmB, uint _budget) {
Context memory context = Context(
pool().getPoolValueInEth(), // capital
tokenController().totalSupply(), // supply
mcr().getMCR() // mcr
);
(
State memory state,
/* injected */,
/* extracted */
) = _getReserves(loadState(), context, block.timestamp);
return (state.eth, state.nxmA, state.nxmB, state.budget);
}
function calculateInjected(
uint eth,
uint budget,
Context memory context,
uint elapsed
) internal pure returns (uint) {
uint timeLeftOnBudget = budget * LIQ_SPEED_PERIOD / FAST_LIQUIDITY_SPEED;
uint maxToInject = (context.capital > context.mcr + TARGET_LIQUIDITY)
? Math.min(TARGET_LIQUIDITY - eth, context.capital - context.mcr - TARGET_LIQUIDITY)
: 0;
if (elapsed <= timeLeftOnBudget) {
return Math.min(elapsed * FAST_LIQUIDITY_SPEED / LIQ_SPEED_PERIOD, maxToInject);
}
uint injectedFast = timeLeftOnBudget * FAST_LIQUIDITY_SPEED / LIQ_SPEED_PERIOD;
uint injectedSlow = (elapsed - timeLeftOnBudget) * LIQ_SPEED_B / LIQ_SPEED_PERIOD;
return Math.min(maxToInject, injectedFast + injectedSlow);
}
function adjustEth(
uint eth,
uint budget,
Context memory context,
uint elapsed
) internal pure returns (uint /* new eth */, uint /* new budget */, uint injected, uint extracted) {
if (eth < TARGET_LIQUIDITY) {
injected = calculateInjected(eth, budget, context, elapsed);
eth += injected;
budget = budget > injected ? budget - injected : 0;
} else {
extracted = Math.min((elapsed * LIQ_SPEED_A) / LIQ_SPEED_PERIOD, eth - TARGET_LIQUIDITY);
eth -= extracted;
}
return (eth, budget, injected, extracted);
}
function calculateNxm(
State memory state,
uint eth,
uint elapsed,
Context memory context,
bool isAbove
) internal pure returns (uint) {
uint stateNxm = isAbove ? state.nxmA : state.nxmB;
uint nxm = stateNxm * eth / state.eth;
uint buffer = isAbove ? PRICE_BUFFER_DENOMINATOR + PRICE_BUFFER : PRICE_BUFFER_DENOMINATOR - PRICE_BUFFER;
uint bufferedCapital = context.capital * buffer / PRICE_BUFFER_DENOMINATOR;
if (isAbove) {
// ratchet above
// cap*n*(1+r) > e*sup
// cap*n + cap*n*r > e*sup
// ? set n(new) = n(BV)
// : set n(new) = n(R)
return bufferedCapital * nxm + bufferedCapital * nxm * elapsed * NORMAL_RATCHET_SPEED / RATCHET_PERIOD / RATCHET_DENOMINATOR > eth * context.supply
? eth * context.supply / bufferedCapital // bv
: eth * nxm / (eth - context.capital * nxm * elapsed * NORMAL_RATCHET_SPEED / context.supply / RATCHET_PERIOD / RATCHET_DENOMINATOR); // ratchet
}
// ratchet below
// check if we should be using the ratchet or the book value price using:
// Nbv > Nr <=>
// ... <=>
// cap*n < e*sup + cap*n*r
// ? set n(new) = n(BV)
// : set n(new) = n(R)
return bufferedCapital * nxm < eth * context.supply + context.capital * nxm * elapsed * state.ratchetSpeedB / RATCHET_PERIOD / RATCHET_DENOMINATOR
? eth * context.supply / bufferedCapital // bv
: eth * nxm / (eth + context.capital * nxm * elapsed * state.ratchetSpeedB/ context.supply / RATCHET_PERIOD / RATCHET_DENOMINATOR); // ratchet
}
function _getReserves(
State memory state,
Context memory context,
uint currentTimestamp
) public pure returns (State memory /* new state */, uint injected, uint extracted) {
uint eth = state.eth;
uint budget = state.budget;
uint elapsed = currentTimestamp - state.timestamp;
(eth, budget, injected, extracted) = adjustEth(eth, budget, context, elapsed);
uint nxmA = calculateNxm(state, eth, elapsed, context, true);
uint nxmB = calculateNxm(state, eth, elapsed, context, false);
return (
State(nxmA, nxmB, eth, budget, state.ratchetSpeedB, currentTimestamp),
injected,
extracted
);
}
/**
* @notice Retrieves the current NXM spot prices
* @return spotPriceA The current NXM buy price
* @return spotPriceB The current NXM sell price
*/
function getSpotPrices() external view returns (uint spotPriceA, uint spotPriceB) {
Context memory context = Context(
pool().getPoolValueInEth(), // capital
tokenController().totalSupply(), // supply
mcr().getMCR() // mcr
);
(
State memory state,
/* injected */,
/* extracted */
) = _getReserves(loadState(), context, block.timestamp);
return (
1 ether * state.eth / state.nxmA,
1 ether * state.eth / state.nxmB
);
}
/**
* @notice Retrieves the current NXM book value
* @return bookValue the current NXM book value
*/
function getBookValue() external view returns (uint bookValue) {
uint capital = pool().getPoolValueInEth();
uint supply = tokenController().totalSupply();
return 1 ether * capital / supply;
}
/* ========== ORACLE ========== */
function observationIndexOf(uint timestamp) internal pure returns (uint index) {
return timestamp.divCeil(PERIOD_SIZE) % GRANULARITY;
}
function calculateTimeOnRatchetAndBV(
State memory previousState,
uint timeElapsed,
uint stateRatchetSpeedB,
uint supply,
uint capital,
bool isAbove
) internal pure returns (uint timeOnRatchet, uint timeOnBV) {
// Formula to find out how much time it takes for ratchet price to hit BV + buffer
//
// above:
// inner = (eth * supply) - (buffer * capital * nxm)
//
// below:
// inner = (buffer * capital * nxm) - (eth * supply)
//
// [inner * denom * period] / (capital * nxm * speed)
uint prevNxm = isAbove ? previousState.nxmA : previousState.nxmB;
uint currentRatchetSpeed = isAbove ? NORMAL_RATCHET_SPEED : stateRatchetSpeedB;
uint bufferMultiplier = isAbove
? (PRICE_BUFFER_DENOMINATOR + PRICE_BUFFER)
: (PRICE_BUFFER_DENOMINATOR - PRICE_BUFFER);
uint inner;
{
uint ethTerm = previousState.eth * supply;
uint nxmTerm = bufferMultiplier * capital * prevNxm / PRICE_BUFFER_DENOMINATOR;
uint innerLeft = isAbove ? ethTerm : nxmTerm;
uint innerRight = isAbove ? nxmTerm : ethTerm;
inner = innerLeft > innerRight ? innerLeft - innerRight : 0;
}
uint maxTimeOnRatchet = inner != 0
? (inner * RATCHET_DENOMINATOR * RATCHET_PERIOD) / (capital * prevNxm * currentRatchetSpeed)
: 0;
timeOnRatchet = Math.min(timeElapsed, maxTimeOnRatchet);
timeOnBV = timeElapsed - timeOnRatchet;
return (timeOnRatchet, timeOnBV);
}
function calculatePriceCumulative(
State memory previousState,
State memory state,
uint timeElapsed,
uint capital,
uint supply,
bool isAbove
) internal pure returns (uint) {
// average price
// pe - previous eth
// pn - previous nxm
// ce - current eth
// cn - current nxm
//
// P = (pe / pn + ce / cn) / 2
// = (pe * cn + ce * pn) / (2 * pn * cn)
//
// cumulative price = P * time_on_ratchet
// = (pe * cn + ce * pn) * time_on_ratchet / (2 * pn * cn)
// cumulative price on bv +- buffer
// (time_total - time_on_ratchet) * bv * buffer
uint cumulativePrice = 0;
(uint timeOnRatchet, uint timeOnBV) = calculateTimeOnRatchetAndBV(
previousState,
timeElapsed,
state.ratchetSpeedB,
supply,
capital,
isAbove
);
if (timeOnRatchet != 0) {
uint prevNxm = isAbove ? previousState.nxmA : previousState.nxmB;
uint currentNxm = isAbove ? state.nxmA : state.nxmB;
cumulativePrice += 1 ether * (previousState.eth * currentNxm + state.eth * prevNxm) * timeOnRatchet / (prevNxm * currentNxm * 2);
}
if (timeOnBV != 0) {
uint bufferMultiplier = isAbove ? (PRICE_BUFFER_DENOMINATOR + PRICE_BUFFER) : (PRICE_BUFFER_DENOMINATOR - PRICE_BUFFER);
cumulativePrice += 1 ether * timeOnBV * capital * bufferMultiplier / (supply * PRICE_BUFFER_DENOMINATOR);
}
return cumulativePrice;
}
function getObservation(
State memory previousState,
State memory state,
Observation memory previousObservation,
uint capital,
uint supply
) public pure returns (Observation memory) {
uint timeElapsed = state.timestamp - previousState.timestamp;
uint priceCumulativeAbove = calculatePriceCumulative(
previousState,
state,
timeElapsed,
capital,
supply,
true
);
uint priceCumulativeBelow = calculatePriceCumulative(
previousState,
state,
timeElapsed,
capital,
supply,
false
);
return Observation(
state.timestamp.toUint32(),
// casting unsafely to allow overflow
uint112(priceCumulativeAbove + previousObservation.priceCumulativeAbove),
uint112(priceCumulativeBelow + previousObservation.priceCumulativeBelow)
);
}
function getInitialObservations(
uint initialPriceA,
uint initialPriceB,
uint timestamp
) public pure returns (Observation[3] memory initialObservations) {
uint priceCumulativeAbove;
uint priceCumulativeBelow;
uint endIdx = timestamp.divCeil(PERIOD_SIZE);
uint previousTimestamp = (endIdx - 11) * PERIOD_SIZE; // 27 days | 3 days | until the deployments
for (uint idx = endIdx - 2; idx <= endIdx; idx++) {
uint observationTimestamp = Math.min(timestamp, idx * PERIOD_SIZE);
uint observationIndex = idx % GRANULARITY;
uint timeElapsed = observationTimestamp - previousTimestamp;
priceCumulativeAbove += initialPriceA * timeElapsed;
priceCumulativeBelow += initialPriceB * timeElapsed;
initialObservations[observationIndex] = Observation(
observationTimestamp.toUint32(),
uint112(priceCumulativeAbove),
uint112(priceCumulativeBelow)
);
previousTimestamp = observationTimestamp;
}
return initialObservations;
}
/**
* @notice Updates the Time-Weighted Average Price (TWAP) by registering new price observations
*/
function updateTwap() external {
State memory initialState = loadState();
if (initialState.timestamp == block.timestamp) {
// already updated
return;
}
Context memory context = Context(
pool().getPoolValueInEth(), // capital
tokenController().totalSupply(), // supply
mcr().getMCR() // mcr
);
Observation[3] memory _observations = observations;
// current state
(
State memory state,
uint injected,
uint extracted
) = _getReserves(initialState, context, block.timestamp);
_observations = _updateTwap(initialState, _observations, context, block.timestamp);
for (uint i = 0; i < _observations.length; i++) {
observations[i] = _observations[i];
emit ObservationUpdated(
observations[i].timestamp,
observations[i].priceCumulativeAbove,
observations[i].priceCumulativeBelow
);
}
storeState(state);
if (injected > 0) {
emit EthInjected(injected);
}
if (extracted > 0) {
emit EthExtracted(extracted);
}
}
function _updateTwap(
State memory initialState,
Observation[3] memory _observations,
Context memory context,
uint currentStateTimestamp
) public pure returns (Observation[3] memory) {
uint endIdx = currentStateTimestamp.divCeil(PERIOD_SIZE);
State memory previousState = initialState;
Observation memory previousObservation = _observations[observationIndexOf(initialState.timestamp)];
Observation[3] memory newObservations;
for (uint idx = endIdx - 2; idx <= endIdx; idx++) {
uint observationTimestamp = Math.min(currentStateTimestamp, idx * PERIOD_SIZE);
uint observationIndex = idx % GRANULARITY;
if (observationTimestamp <= previousState.timestamp) {
newObservations[observationIndex] = Observation(
_observations[observationIndex].timestamp,
_observations[observationIndex].priceCumulativeAbove,
_observations[observationIndex].priceCumulativeBelow
);
continue;
}
(
State memory state,
/* injected */,
/* extracted */
) = _getReserves(previousState, context, observationTimestamp);
newObservations[observationIndex] = getObservation(
previousState,
state,
previousObservation,
context.capital,
context.supply
);
previousState = state;
previousObservation = newObservations[observationIndex];
}
return newObservations;
}
function getInternalPriceAndUpdateTwap() external returns (uint internalPrice) {
Context memory context = Context(
pool().getPoolValueInEth(), // capital
tokenController().totalSupply(), // supply
mcr().getMCR() // mcr
);
State memory initialState = loadState();
Observation[3] memory _observations = observations;
// current state
(
State memory state,
uint injected,
uint extracted
) = _getReserves(initialState, context, block.timestamp);
_observations = _updateTwap(initialState, _observations, context, block.timestamp);
// sstore observations and state
for (uint i = 0; i < _observations.length; i++) {
observations[i] = _observations[i];
emit ObservationUpdated(
observations[i].timestamp,
observations[i].priceCumulativeAbove,
observations[i].priceCumulativeBelow
);
}
storeState(state);
if (injected > 0) {
emit EthInjected(injected);
}
if (extracted > 0) {
emit EthExtracted(extracted);
}
return _getInternalPrice(state, _observations, context.capital, context.supply, block.timestamp);
}
function _getInternalPrice(
State memory state,
Observation[3] memory _observations,
uint capital,
uint supply,
uint timestamp
) public pure returns (uint) {
uint currentIdx = observationIndexOf(timestamp);
// index of first observation in window = current - 2
// adding 1 and applying modulo gives the same result avoiding underflow
Observation memory firstObservation = _observations[(currentIdx + 1) % GRANULARITY];
Observation memory currentObservation = _observations[currentIdx];
uint spotPriceA = 1 ether * state.eth / state.nxmA;
uint spotPriceB = 1 ether * state.eth / state.nxmB;
uint internalPrice;
// underflow is desired
unchecked {
uint elapsed = timestamp - firstObservation.timestamp;
uint averagePriceA = uint(currentObservation.priceCumulativeAbove - firstObservation.priceCumulativeAbove) / elapsed;
uint averagePriceB = uint(currentObservation.priceCumulativeBelow - firstObservation.priceCumulativeBelow) / elapsed;
// keeping min/max inside unchecked scope to avoid stack too deep error
uint priceA = Math.min(averagePriceA, spotPriceA);
uint priceB = Math.max(averagePriceB, spotPriceB);
internalPrice = priceA + priceB - 1 ether * capital / supply;
}
uint maxPrice = 3 * 1 ether * capital / supply; // 300% BV
uint minPrice = 35 * 1 ether * capital / supply / 100; // 35% BV
internalPrice = Math.max(Math.min(internalPrice, maxPrice), minPrice);
return internalPrice;
}
function getInternalPrice() external view returns (uint internalPrice) {
Context memory context = Context(
pool().getPoolValueInEth(), // capital
tokenController().totalSupply(), // supply
mcr().getMCR() // mcr
);
State memory initialState = loadState();
Observation[3] memory _observations = observations;
(
State memory state,
/* injected */,
/* extracted */
) = _getReserves(initialState, context, block.timestamp);
_observations = _updateTwap(initialState, _observations, context, block.timestamp);
return _getInternalPrice(state, _observations, context.capital, context.supply, block.timestamp);
}
/* ========== DEPENDENCIES ========== */
function pool() internal view returns (IPool) {
return IPool(internalContracts[uint(ID.P1)]);
}
function mcr() internal view returns (IMCR) {
return IMCR(internalContracts[uint(ID.MC)]);
}
function tokenController() internal view returns (ITokenController) {
return ITokenController(internalContracts[uint(ID.TC)]);
}
function changeDependentContractAddress() external override {
internalContracts[uint(ID.P1)] = master.getLatestAddress("P1");
internalContracts[uint(ID.TC)] = master.getLatestAddress("TC");
internalContracts[uint(ID.MC)] = master.getLatestAddress("MC");
initialize();
}
function initialize() internal {
if (slot1.updatedAt != 0) {
// already initialized
return;
}
uint capital = pool().getPoolValueInEth();
uint supply = tokenController().totalSupply();
uint bondingCurvePrice = pool().getTokenPrice();
uint initialPriceA = bondingCurvePrice + 1 ether * capital * PRICE_BUFFER / PRICE_BUFFER_DENOMINATOR / supply;
uint initialPriceB = 1 ether * capital * (PRICE_BUFFER_DENOMINATOR - PRICE_BUFFER) / PRICE_BUFFER_DENOMINATOR / supply;
uint128 nxmReserveA = (INITIAL_LIQUIDITY * 1 ether / initialPriceA).toUint128();
uint128 nxmReserveB = (INITIAL_LIQUIDITY * 1 ether / SPOT_PRICE_B).toUint128();
uint128 ethReserve = INITIAL_LIQUIDITY.toUint128();
uint88 budget = INITIAL_BUDGET.toUint88();
uint _ratchetSpeedB = FAST_RATCHET_SPEED;
uint32 updatedAt = block.timestamp.toUint32();
ethLimit = INITIAL_ETH_LIMIT.toUint32();
nxmLimit = INITIAL_NXM_LIMIT.toUint32();
// start paused
slot1.swapPaused = true;
State memory state = State(
nxmReserveA,
nxmReserveB,
ethReserve,
budget,
_ratchetSpeedB,
updatedAt
);
storeState(state);
Observation[3] memory _observations = getInitialObservations(initialPriceA, initialPriceB, updatedAt);
for (uint i = 0; i < _observations.length; i++) {
observations[i] = _observations[i];
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.18;
import "../interfaces/ISAFURAMaster.sol";
import "../interfaces/IMasterAwareV2.sol";
import "../interfaces/IMemberRoles.sol";
abstract contract MasterAwareV2 is IMasterAwareV2 {
ISAFURAMaster public master;
mapping(uint => address payable) public internalContracts;
modifier onlyMember {
require(
IMemberRoles(internalContracts[uint(ID.MR)]).checkRole(
msg.sender,
uint(IMemberRoles.Role.Member)
),
"Caller is not a member"
);
_;
}
modifier onlyAdvisoryBoard {
require(
IMemberRoles(internalContracts[uint(ID.MR)]).checkRole(
msg.sender,
uint(IMemberRoles.Role.AdvisoryBoard)
),
"Caller is not an advisory board member"
);
_;
}
modifier onlyInternal {
require(master.isInternal(msg.sender), "Caller is not an internal contract");
_;
}
modifier onlyMaster {
if (address(master) != address(0)) {
require(address(master) == msg.sender, "Not master");
}
_;
}
modifier onlyGovernance {
require(
master.checkIsAuthToGoverned(msg.sender),
"Caller is not authorized to govern"
);
_;
}
modifier onlyEmergencyAdmin {
require(
msg.sender == master.emergencyAdmin(),
"Caller is not emergency admin"
);
_;
}
modifier whenPaused {
require(master.isPause(), "System is not paused");
_;
}
modifier whenNotPaused {
require(!master.isPause(), "System is paused");
_;
}
function getInternalContractAddress(ID id) internal view returns (address payable) {
return internalContracts[uint(id)];
}
function changeMasterAddress(address masterAddress) public onlyMaster {
master = ISAFURAMaster(masterAddress);
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.0;
interface IMasterAwareV2 {
// TODO: if you update this enum, update lib/constants.js as well
enum ID {
TC, // TokenController.sol
P1, // Pool.sol
MR, // MemberRoles.sol
MC, // MCR.sol
CO, // Cover.sol
SP, // StakingProducts.sol
PS, // LegacyPooledStaking.sol
GV, // Governance.sol
GW, // LegacyGateway.sol - removed
CL, // CoverMigrator.sol - removed
AS, // Assessment.sol
CI, // IndividualClaims.sol - Claims for Individuals
CG, // YieldTokenIncidents.sol - Claims for Groups
RA, // Ramm.sol
ST, // SafeTracker.sol
CP // CoverProducts.sol
}
function changeMasterAddress(address masterAddress) external;
function changeDependentContractAddress() external;
function internalContracts(uint) external view returns (address payable);
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.0;
interface IMCR {
function updateMCRInternal(bool forceUpdate) external;
function getMCR() external view returns (uint);
function mcr() external view returns (uint80);
function desiredMCR() external view returns (uint80);
function lastUpdateTime() external view returns (uint32);
function maxMCRIncrement() external view returns (uint16);
function gearingFactor() external view returns (uint24);
function minUpdateTime() external view returns (uint16);
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.0;
interface IMemberRoles {
enum Role {Unassigned, AdvisoryBoard, Member, Owner, Auditor}
function join(address _userAddress, uint nonce, bytes calldata signature) external payable;
function switchMembership(address _newAddress) external;
function switchMembershipAndAssets(
address newAddress,
uint[] calldata coverIds,
uint[] calldata stakingTokenIds
) external;
function switchMembershipOf(address member, address _newAddress) external;
function totalRoles() external view returns (uint256);
function changeAuthorized(uint _roleId, address _newAuthorized) external;
function setKycAuthAddress(address _add) external;
function members(uint _memberRoleId) external view returns (uint, address[] memory memberArray);
function numberOfMembers(uint _memberRoleId) external view returns (uint);
function authorized(uint _memberRoleId) external view returns (address);
function roles(address _memberAddress) external view returns (uint[] memory);
function checkRole(address _memberAddress, uint _roleId) external view returns (bool);
function getMemberLengthForAllRoles() external view returns (uint[] memory totalMembers);
function memberAtIndex(uint _memberRoleId, uint index) external view returns (address, bool);
function membersLength(uint _memberRoleId) external view returns (uint);
event MemberRole(uint256 indexed roleId, bytes32 roleName, string roleDescription);
event MemberJoined(address indexed newMember, uint indexed nonce);
event switchedMembership(address indexed previousMember, address indexed newMember, uint timeStamp);
event MembershipWithdrawn(address indexed member, uint timestamp);
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.0;
import "./IPriceFeedOracle.sol";
struct SwapDetails {
uint104 minAmount;
uint104 maxAmount;
uint32 lastSwapTime;
// 2 decimals of precision. 0.01% -> 0.0001 -> 1e14
uint16 maxSlippageRatio;
}
struct Asset {
address assetAddress;
bool isCoverAsset;
bool isAbandoned;
}
interface IPool {
function swapOperator() external view returns (address);
function getAsset(uint assetId) external view returns (Asset memory);
function getAssets() external view returns (Asset[] memory);
function transferAssetToSwapOperator(address asset, uint amount) external;
function setSwapDetailsLastSwapTime(address asset, uint32 lastSwapTime) external;
function getAssetSwapDetails(address assetAddress) external view returns (SwapDetails memory);
function sendPayout(uint assetIndex, address payable payoutAddress, uint amount, uint ethDepositAmount) external;
function sendEth(address payoutAddress, uint amount) external;
function upgradeCapitalPool(address payable newPoolAddress) external;
function priceFeedOracle() external view returns (IPriceFeedOracle);
function getPoolValueInEth() external view returns (uint);
function calculateMCRRatio(uint totalAssetValue, uint mcrEth) external pure returns (uint);
function getInternalTokenPriceInAsset(uint assetId) external view returns (uint tokenPrice);
function getInternalTokenPriceInAssetAndUpdateTwap(uint assetId) external returns (uint tokenPrice);
function getTokenPrice() external view returns (uint tokenPrice);
function getMCRRatio() external view returns (uint);
function setSwapValue(uint value) external;
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.0;
interface Aggregator {
function decimals() external view returns (uint8);
function latestAnswer() external view returns (int);
}
interface IPriceFeedOracle {
struct OracleAsset {
Aggregator aggregator;
uint8 decimals;
}
function ETH() external view returns (address);
function assets(address) external view returns (Aggregator, uint8);
function getAssetToEthRate(address asset) external view returns (uint);
function getAssetForEth(address asset, uint ethIn) external view returns (uint);
function getEthForAsset(address asset, uint amount) external view returns (uint);
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.0;
import "./IPool.sol";
import "./ISAFURAToken.sol";
import "./ITokenController.sol";
interface IRamm {
// storage structs
struct Slot0 {
uint128 nxmReserveA;
uint128 nxmReserveB;
}
struct Slot1 {
uint128 ethReserve;
uint88 budget;
uint32 updatedAt;
bool swapPaused; // emergency pause
}
struct Observation {
uint32 timestamp;
uint112 priceCumulativeAbove;
uint112 priceCumulativeBelow;
}
// memory structs
struct State {
uint nxmA;
uint nxmB;
uint eth;
uint budget;
uint ratchetSpeedB;
uint timestamp;
}
struct Context {
uint capital;
uint supply;
uint mcr;
}
struct CumulativePriceCalculationProps {
uint previousEthReserve;
uint currentEthReserve;
uint previousNxmA;
uint currentNxmA;
uint previousNxmB;
uint currentNxmB;
uint previousTimestamp;
uint observationTimestamp;
}
struct CumulativePriceCalculationTimes {
uint secondsUntilBVAbove;
uint secondsUntilBVBelow;
uint timeElapsed;
uint bvTimeBelow;
uint bvTimeAbove;
uint ratchetTimeAbove;
uint ratchetTimeBelow;
}
/* ========== VIEWS ========== */
function getReserves() external view returns (
uint ethReserve,
uint nxmA,
uint nxmB,
uint remainingBudget
);
function getSpotPrices() external view returns (uint spotPriceA, uint spotPriceB);
function getBookValue() external view returns (uint bookValue);
function getInternalPrice() external view returns (uint internalPrice);
/* ==== MUTATIVE FUNCTIONS ==== */
function updateTwap() external;
function getInternalPriceAndUpdateTwap() external returns (uint internalPrice);
function swap(uint nxmIn, uint minAmountOut, uint deadline) external payable returns (uint amountOut);
function removeBudget() external;
function setEmergencySwapPause(bool _swapPaused) external;
/* ========== EVENTS AND ERRORS ========== */
event EthSwappedForNxm(address indexed member, uint ethIn, uint nxmOut);
event NxmSwappedForEth(address indexed member, uint nxmIn, uint ethOut);
event ObservationUpdated(uint32 timestamp, uint112 priceCumulativeAbove, uint112 priceCumulativeBelow);
event BudgetRemoved();
event SwapPauseConfigured(bool paused);
event EthInjected(uint value);
event EthExtracted(uint value);
// Pause
error SystemPaused();
error SwapPaused();
// Input
error OneInputOnly();
error OneInputRequired();
// Expiry
error SwapExpired(uint deadline, uint blockTimestamp);
// Insufficient amount out
error InsufficientAmountOut(uint amountOut, uint minAmountOut);
// Buffer Zone
error NoSwapsInBufferZone();
// ETH Transfer
error EthTransferFailed();
// Circuit breakers
error EthCircuitBreakerHit();
error NxmCircuitBreakerHit();
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.0;
interface ISAFURAMaster {
function tokenAddress() external view returns (address);
function owner() external view returns (address);
function emergencyAdmin() external view returns (address);
function masterInitialized() external view returns (bool);
function isInternal(address _add) external view returns (bool);
function isPause() external view returns (bool check);
function isMember(address _add) external view returns (bool);
function checkIsAuthToGoverned(address _add) external view returns (bool);
function getLatestAddress(bytes2 _contractName) external view returns (address payable contractAddress);
function contractAddresses(bytes2 code) external view returns (address payable);
function upgradeMultipleContracts(
bytes2[] calldata _contractCodes,
address payable[] calldata newAddresses
) external;
function removeContracts(bytes2[] calldata contractCodesToRemove) external;
function addNewInternalContracts(
bytes2[] calldata _contractCodes,
address payable[] calldata newAddresses,
uint[] calldata _types
) external;
function updateOwnerParameters(bytes8 code, address payable val) external;
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.0;
interface ISAFURAToken {
function burn(uint256 amount) external returns (bool);
function burnFrom(address from, uint256 value) external returns (bool);
function operatorTransfer(address from, uint256 value) external returns (bool);
function mint(address account, uint256 amount) external;
function isLockedForMV(address member) external view returns (uint);
function whiteListed(address member) external view returns (bool);
function addToWhiteList(address _member) external returns (bool);
function removeFromWhiteList(address _member) external returns (bool);
function changeOperator(address _newOperator) external returns (bool);
function lockForMemberVote(address _of, uint _days) external;
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.0;
import "./ISAFURAToken.sol";
interface ITokenController {
struct StakingPoolNXMBalances {
uint128 rewards;
uint128 deposits;
}
struct CoverInfo {
uint16 claimCount;
bool hasOpenClaim;
bool hasAcceptedClaim;
uint96 requestedPayoutAmount;
// note: still 128 bits available here, can be used later
}
struct StakingPoolOwnershipOffer {
address proposedManager;
uint96 deadline;
}
function coverInfo(uint id) external view returns (
uint16 claimCount,
bool hasOpenClaim,
bool hasAcceptedClaim,
uint96 requestedPayoutAmount
);
function withdrawCoverNote(
address _of,
uint[] calldata _coverIds,
uint[] calldata _indexes
) external;
function changeOperator(address _newOperator) external;
function operatorTransfer(address _from, address _to, uint _value) external returns (bool);
function burnFrom(address _of, uint amount) external returns (bool);
function addToWhitelist(address _member) external;
function removeFromWhitelist(address _member) external;
function mint(address _member, uint _amount) external;
function lockForMemberVote(address _of, uint _days) external;
function withdrawClaimAssessmentTokens(address[] calldata users) external;
function getLockReasons(address _of) external view returns (bytes32[] memory reasons);
function totalSupply() external view returns (uint);
function totalBalanceOf(address _of) external view returns (uint amount);
function totalBalanceOfWithoutDelegations(address _of) external view returns (uint amount);
function getTokenPrice() external view returns (uint tokenPrice);
function token() external view returns (ISAFURAToken);
function getStakingPoolManager(uint poolId) external view returns (address manager);
function getManagerStakingPools(address manager) external view returns (uint[] memory poolIds);
function isStakingPoolManager(address member) external view returns (bool);
function getStakingPoolOwnershipOffer(uint poolId) external view returns (address proposedManager, uint deadline);
function transferStakingPoolsOwnership(address from, address to) external;
function assignStakingPoolManager(uint poolId, address manager) external;
function createStakingPoolOwnershipOffer(uint poolId, address proposedManager, uint deadline) external;
function acceptStakingPoolOwnershipOffer(uint poolId) external;
function cancelStakingPoolOwnershipOffer(uint poolId) external;
function mintStakingPoolNXMRewards(uint amount, uint poolId) external;
function burnStakingPoolNXMRewards(uint amount, uint poolId) external;
function depositStakedNXM(address from, uint amount, uint poolId) external;
function withdrawNXMStakeAndRewards(address to, uint stakeToWithdraw, uint rewardsToWithdraw, uint poolId) external;
function burnStakedNXM(uint amount, uint poolId) external;
function stakingPoolNXMBalances(uint poolId) external view returns(uint128 rewards, uint128 deposits);
function tokensLocked(address _of, bytes32 _reason) external view returns (uint256 amount);
function getWithdrawableCoverNotes(
address coverOwner
) external view returns (
uint[] memory coverIds,
bytes32[] memory lockReasons,
uint withdrawableAmount
);
function getPendingRewards(address member) external view returns (uint);
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.18;
/**
* @dev Simple library that defines min, max and babylonian sqrt functions
*/
library Math {
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
function max(uint a, uint b) internal pure returns (uint) {
return a > b ? a : b;
}
function sum(uint[] memory items) internal pure returns (uint) {
uint count = items.length;
uint total;
for (uint i = 0; i < count; i++) {
total += items[i];
}
return total;
}
function divRound(uint a, uint b) internal pure returns (uint) {
return (a + b / 2) / b;
}
function divCeil(uint a, uint b) internal pure returns (uint) {
return (a + b - 1) / b;
}
function roundUp(uint a, uint b) internal pure returns (uint) {
return divCeil(a, b) * b;
}
// babylonian method
function sqrt(uint y) internal pure returns (uint) {
if (y > 3) {
uint z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
return z;
}
if (y != 0) {
return 1;
}
return 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
/**
* @dev Wrappers over Solidity's uintXX casting operators with added overflow
* checks.
*
* Downcasting from uint256 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 SafeUintCast {
/**
* @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) {
require(value < 2**248, "SafeCast: value doesn\'t fit in 248 bits");
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) {
require(value < 2**240, "SafeCast: value doesn\'t fit in 240 bits");
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) {
require(value < 2**232, "SafeCast: value doesn\'t fit in 232 bits");
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) {
require(value < 2**224, "SafeCast: value doesn\'t fit in 224 bits");
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) {
require(value < 2**216, "SafeCast: value doesn\'t fit in 216 bits");
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) {
require(value < 2**208, "SafeCast: value doesn\'t fit in 208 bits");
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) {
require(value < 2**200, "SafeCast: value doesn\'t fit in 200 bits");
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) {
require(value < 2**192, "SafeCast: value doesn\'t fit in 192 bits");
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) {
require(value < 2**184, "SafeCast: value doesn\'t fit in 184 bits");
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) {
require(value < 2**176, "SafeCast: value doesn\'t fit in 176 bits");
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) {
require(value < 2**168, "SafeCast: value doesn\'t fit in 168 bits");
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) {
require(value < 2**160, "SafeCast: value doesn\'t fit in 160 bits");
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) {
require(value < 2**152, "SafeCast: value doesn\'t fit in 152 bits");
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) {
require(value < 2**144, "SafeCast: value doesn\'t fit in 144 bits");
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) {
require(value < 2**136, "SafeCast: value doesn\'t fit in 136 bits");
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) {
require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
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) {
require(value < 2**120, "SafeCast: value doesn\'t fit in 120 bits");
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) {
require(value < 2**112, "SafeCast: value doesn\'t fit in 112 bits");
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) {
require(value < 2**104, "SafeCast: value doesn\'t fit in 104 bits");
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 `uint104` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toUint96(uint256 value) internal pure returns (uint96) {
require(value < 2**96, "SafeCast: value doesn\'t fit in 96 bits");
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 `uint104` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toUint88(uint256 value) internal pure returns (uint88) {
require(value < 2**88, "SafeCast: value doesn\'t fit in 88 bits");
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 `uint104` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toUint80(uint256 value) internal pure returns (uint80) {
require(value < 2**80, "SafeCast: value doesn\'t fit in 80 bits");
return uint80(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) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
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) {
require(value < 2**56, "SafeCast: value doesn\'t fit in 56 bits");
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) {
require(value < 2**48, "SafeCast: value doesn\'t fit in 48 bits");
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) {
require(value < 2**40, "SafeCast: value doesn\'t fit in 40 bits");
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) {
require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
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) {
require(value < 2**24, "SafeCast: value doesn\'t fit in 24 bits");
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) {
require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
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) {
require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
return uint8(value);
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"spotPriceB","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EthCircuitBreakerHit","type":"error"},{"inputs":[],"name":"EthTransferFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"}],"name":"InsufficientAmountOut","type":"error"},{"inputs":[],"name":"NoSwapsInBufferZone","type":"error"},{"inputs":[],"name":"NxmCircuitBreakerHit","type":"error"},{"inputs":[],"name":"OneInputOnly","type":"error"},{"inputs":[],"name":"OneInputRequired","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"SwapExpired","type":"error"},{"inputs":[],"name":"SwapPaused","type":"error"},{"inputs":[],"name":"SystemPaused","type":"error"},{"anonymous":false,"inputs":[],"name":"BudgetRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"EthExtracted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"EthInjected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"uint256","name":"ethIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nxmOut","type":"uint256"}],"name":"EthSwappedForNxm","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"uint256","name":"nxmIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ethOut","type":"uint256"}],"name":"NxmSwappedForEth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"timestamp","type":"uint32"},{"indexed":false,"internalType":"uint112","name":"priceCumulativeAbove","type":"uint112"},{"indexed":false,"internalType":"uint112","name":"priceCumulativeBelow","type":"uint112"}],"name":"ObservationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"SwapPauseConfigured","type":"event"},{"inputs":[],"name":"FAST_LIQUIDITY_SPEED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FAST_RATCHET_SPEED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GRANULARITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIQ_SPEED_A","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIQ_SPEED_B","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIQ_SPEED_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NORMAL_RATCHET_SPEED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERIOD_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE_BUFFER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE_BUFFER_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATCHET_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATCHET_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TARGET_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"nxmA","type":"uint256"},{"internalType":"uint256","name":"nxmB","type":"uint256"},{"internalType":"uint256","name":"eth","type":"uint256"},{"internalType":"uint256","name":"budget","type":"uint256"},{"internalType":"uint256","name":"ratchetSpeedB","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct IRamm.State","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint112","name":"priceCumulativeAbove","type":"uint112"},{"internalType":"uint112","name":"priceCumulativeBelow","type":"uint112"}],"internalType":"struct IRamm.Observation[3]","name":"_observations","type":"tuple[3]"},{"internalType":"uint256","name":"capital","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"_getInternalPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"nxmA","type":"uint256"},{"internalType":"uint256","name":"nxmB","type":"uint256"},{"internalType":"uint256","name":"eth","type":"uint256"},{"internalType":"uint256","name":"budget","type":"uint256"},{"internalType":"uint256","name":"ratchetSpeedB","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct IRamm.State","name":"state","type":"tuple"},{"components":[{"internalType":"uint256","name":"capital","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint256","name":"mcr","type":"uint256"}],"internalType":"struct IRamm.Context","name":"context","type":"tuple"},{"internalType":"uint256","name":"currentTimestamp","type":"uint256"}],"name":"_getReserves","outputs":[{"components":[{"internalType":"uint256","name":"nxmA","type":"uint256"},{"internalType":"uint256","name":"nxmB","type":"uint256"},{"internalType":"uint256","name":"eth","type":"uint256"},{"internalType":"uint256","name":"budget","type":"uint256"},{"internalType":"uint256","name":"ratchetSpeedB","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct IRamm.State","name":"","type":"tuple"},{"internalType":"uint256","name":"injected","type":"uint256"},{"internalType":"uint256","name":"extracted","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"nxmA","type":"uint256"},{"internalType":"uint256","name":"nxmB","type":"uint256"},{"internalType":"uint256","name":"eth","type":"uint256"},{"internalType":"uint256","name":"budget","type":"uint256"},{"internalType":"uint256","name":"ratchetSpeedB","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct IRamm.State","name":"initialState","type":"tuple"},{"components":[{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint112","name":"priceCumulativeAbove","type":"uint112"},{"internalType":"uint112","name":"priceCumulativeBelow","type":"uint112"}],"internalType":"struct IRamm.Observation[3]","name":"_observations","type":"tuple[3]"},{"components":[{"internalType":"uint256","name":"capital","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint256","name":"mcr","type":"uint256"}],"internalType":"struct IRamm.Context","name":"context","type":"tuple"},{"internalType":"uint256","name":"currentStateTimestamp","type":"uint256"}],"name":"_updateTwap","outputs":[{"components":[{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint112","name":"priceCumulativeAbove","type":"uint112"},{"internalType":"uint112","name":"priceCumulativeBelow","type":"uint112"}],"internalType":"struct IRamm.Observation[3]","name":"","type":"tuple[3]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"changeDependentContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"masterAddress","type":"address"}],"name":"changeMasterAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ethLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethReleased","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBookValue","outputs":[{"internalType":"uint256","name":"bookValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"initialPriceA","type":"uint256"},{"internalType":"uint256","name":"initialPriceB","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getInitialObservations","outputs":[{"components":[{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint112","name":"priceCumulativeAbove","type":"uint112"},{"internalType":"uint112","name":"priceCumulativeBelow","type":"uint112"}],"internalType":"struct IRamm.Observation[3]","name":"initialObservations","type":"tuple[3]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getInternalPrice","outputs":[{"internalType":"uint256","name":"internalPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInternalPriceAndUpdateTwap","outputs":[{"internalType":"uint256","name":"internalPrice","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"nxmA","type":"uint256"},{"internalType":"uint256","name":"nxmB","type":"uint256"},{"internalType":"uint256","name":"eth","type":"uint256"},{"internalType":"uint256","name":"budget","type":"uint256"},{"internalType":"uint256","name":"ratchetSpeedB","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct IRamm.State","name":"previousState","type":"tuple"},{"components":[{"internalType":"uint256","name":"nxmA","type":"uint256"},{"internalType":"uint256","name":"nxmB","type":"uint256"},{"internalType":"uint256","name":"eth","type":"uint256"},{"internalType":"uint256","name":"budget","type":"uint256"},{"internalType":"uint256","name":"ratchetSpeedB","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct IRamm.State","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint112","name":"priceCumulativeAbove","type":"uint112"},{"internalType":"uint112","name":"priceCumulativeBelow","type":"uint112"}],"internalType":"struct IRamm.Observation","name":"previousObservation","type":"tuple"},{"internalType":"uint256","name":"capital","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"}],"name":"getObservation","outputs":[{"components":[{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint112","name":"priceCumulativeAbove","type":"uint112"},{"internalType":"uint112","name":"priceCumulativeBelow","type":"uint112"}],"internalType":"struct IRamm.Observation","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint256","name":"_ethReserve","type":"uint256"},{"internalType":"uint256","name":"nxmA","type":"uint256"},{"internalType":"uint256","name":"nxmB","type":"uint256"},{"internalType":"uint256","name":"_budget","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSpotPrices","outputs":[{"internalType":"uint256","name":"spotPriceA","type":"uint256"},{"internalType":"uint256","name":"spotPriceB","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"internalContracts","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"loadState","outputs":[{"components":[{"internalType":"uint256","name":"nxmA","type":"uint256"},{"internalType":"uint256","name":"nxmB","type":"uint256"},{"internalType":"uint256","name":"eth","type":"uint256"},{"internalType":"uint256","name":"budget","type":"uint256"},{"internalType":"uint256","name":"ratchetSpeedB","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct IRamm.State","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"master","outputs":[{"internalType":"contract ISAFURAMaster","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nxmLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nxmReleased","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint112","name":"priceCumulativeAbove","type":"uint112"},{"internalType":"uint112","name":"priceCumulativeBelow","type":"uint112"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ratchetSpeedB","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeBudget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ethLimit","type":"uint256"},{"internalType":"uint256","name":"_nxmLimit","type":"uint256"}],"name":"setCircuitBreakerLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_swapPaused","type":"bool"}],"name":"setEmergencySwapPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slot0","outputs":[{"internalType":"uint128","name":"nxmReserveA","type":"uint128"},{"internalType":"uint128","name":"nxmReserveB","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"slot1","outputs":[{"internalType":"uint128","name":"ethReserve","type":"uint128"},{"internalType":"uint88","name":"budget","type":"uint88"},{"internalType":"uint32","name":"updatedAt","type":"uint32"},{"internalType":"bool","name":"swapPaused","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nxmIn","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"swapPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateTwap","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a06040523480156200001157600080fd5b50604051620044ea380380620044ea833981016040819052620000349162000042565b60016002556080526200005c565b6000602082840312156200005557600080fd5b5051919050565b608051614472620000786000396000612def01526144726000f3fe6080604052600436106102515760003560e01c80638516e6dc11610139578063d46655f4116100b6578063ecb296e51161007a578063ecb296e5146105ba578063ee6e35fe146107b4578063ee97f7f3146107d6578063f636c89614610686578063f8917434146107f6578063fc9654ab1461080b57600080fd5b8063d46655f414610707578063d8e7c7171461066f578063dd8cf96314610727578063e002566414610751578063eb9623601461076657600080fd5b8063b738a307116100fd578063b738a3071461066f578063b7cc16d814610686578063c5461250146106a3578063c8795538146106c7578063cc4d0ee6146106e757600080fd5b80638516e6dc146105f05780638ac684fe146106055780639cf299511461061a5780639d9892cd1461062f578063adf6ce451461064257600080fd5b8063309f627c116101d257806351e8b5c61161019657806351e8b5c61461050f5780635c448777146105485780635c95eb521461055d5780635e37b9aa1461057b5780635e61f586146105ba5780636142c906146105d057600080fd5b8063309f627c1461044257806330e134dc14610462578063379377a9146104775780633850c7bd146104a45780634a53f3c5146104ef57600080fd5b80631bf7aa89116102195780631bf7aa891461030f5780631f457cb514610325578063245a4e72146103af578063252c09d7146103d95780632b4186761461042557600080fd5b80630902f1ac1461025657806309f221ee146102905780630c474d22146102b45780630ea9c984146102e357806318d45834146102fa575b600080fd5b34801561026257600080fd5b5061026b610822565b6040805194855260208501939093529183015260608201526080015b60405180910390f35b34801561029c57600080fd5b506102a661019081565b604051908152602001610287565b3480156102c057600080fd5b506102d46102cf366004613edc565b6109b6565b60405161028793929190613f1c565b3480156102ef57600080fd5b506102f8610a8e565b005b34801561030657600080fd5b506102a6610cac565b34801561031b57600080fd5b506102a661138881565b34801561033157600080fd5b50600454610370906001600160801b03811690600160801b81046001600160581b031690600160d81b810463ffffffff1690600160f81b900460ff1684565b604080516001600160801b0390951685526001600160581b03909316602085015263ffffffff9091169183019190915215156060820152608001610287565b3480156103bb57600080fd5b50600454600160f81b900460ff166040519015158152602001610287565b3480156103e557600080fd5b506103f96103f4366004613f71565b611067565b6040805163ffffffff90941684526001600160701b039283166020850152911690820152606001610287565b34801561043157600080fd5b506102a6685150ae84a8cdf0000081565b34801561044e57600080fd5b506102a661045d36600461405b565b61109f565b34801561046e57600080fd5b506102a6606481565b34801561048357600080fd5b506104976104923660046140ae565b611264565b60405161028791906140ff565b3480156104b057600080fd5b506003546104cf906001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610287565b3480156104fb57600080fd5b506102f861050a366004614165565b611419565b34801561051b57600080fd5b5060085461053390600160601b900463ffffffff1681565b60405163ffffffff9091168152602001610287565b34801561055457600080fd5b506102f8611549565b34801561056957600080fd5b506102a669010f0cf064dd5920000081565b34801561058757600080fd5b506008546105a290600160801b90046001600160601b031681565b6040516001600160601b039091168152602001610287565b3480156105c657600080fd5b506102a661271081565b3480156105dc57600080fd5b506102f86105eb366004614198565b61164e565b3480156105fc57600080fd5b506102f861177d565b34801561061157600080fd5b506102a6600381565b34801561062657600080fd5b506102a6611b2d565b6102a661063d3660046141b5565b611b56565b34801561064e57600080fd5b5061066261065d3660046141e1565b612060565b604051610287919061423d565b34801561067b57600080fd5b506102a66201518081565b34801561069257600080fd5b506102a668056bc75e2d6310000081565b3480156106af57600080fd5b5060085461053390600160e01b900463ffffffff1681565b3480156106d357600080fd5b506008546105a2906001600160601b031681565b3480156106f357600080fd5b506104976107023660046141b5565b612136565b34801561071357600080fd5b506102f8610722366004614289565b612259565b34801561073357600080fd5b5061073c6122d3565b60408051928352602083019190915201610287565b34801561075d57600080fd5b506102a6612492565b34801561077257600080fd5b5061079c610781366004613f71565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610287565b3480156107c057600080fd5b506107c96126a5565b60405161028791906142a6565b3480156107e257600080fd5b5060005461079c906001600160a01b031681565b34801561080257600080fd5b506102a661275b565b34801561081757600080fd5b506102a66203f48081565b6000806000806000604051806060016040528061083d61285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa15801561087a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089e91906142e9565b81526020016108ab612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090c91906142e9565b815260200161091961288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa158015610956573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097a91906142e9565b90529050600061099261098b6126a5565b83426109b6565b50506040810151815160208301516060909301519199909850919650945092505050565b6109ef6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040840151606085015160a0860151600092839290918390610a119088614318565b9050610a1f83838a84612897565b909750955090935091506000610a398a85848c600161293e565b90506000610a4b8b86858d600061293e565b90506040518060c001604052808381526020018281526020018681526020018581526020018c6080015181526020018a8152509750505050505093509350939050565b6000546040516227050b60e31b815261503160f01b60048201526001600160a01b0390911690630138285890602401602060405180830381865afa158015610ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afe919061432b565b600160008181526020919091527fcc69885fda6bcc1a4ace058b4a62bf5e179ea78fd58a1ccd71c22cc9b688792f80546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b815261544360f01b6004820152911690630138285890602401602060405180830381865afa158015610b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bad919061432b565b600080805260016020527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4980546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b8152614d4360f01b6004820152911690630138285890602401602060405180830381865afa158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c59919061432b565b600360005260016020527f7dfe757ecd65cbd7922a9c0161e935dd7fdbcc0e999689c7d31633896b1fc60b80546001600160a01b0319166001600160a01b0392909216919091179055610caa612bd0565b565b6000806040518060600160405280610cc261285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2391906142e9565b8152602001610d30612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9191906142e9565b8152602001610d9e61288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dff91906142e9565b905290506000610e0d6126a5565b60408051606081019091529091506000906005600383835b82821015610e7c57604080516060810182528386015463ffffffff811682526001600160701b03600160201b82048116602080850191909152600160901b9092041692820192909252825260019092019101610e25565b5050505090506000806000610e928587426109b6565b925092509250610ea485858842611264565b935060005b6003811015610fed57848160038110610ec457610ec4614348565b602002015160058260038110610edc57610edc614348565b825191018054602084015160409094015163ffffffff9093166001600160901b031990911617600160201b6001600160701b0394851602176001600160901b0316600160901b93909216929092021790557f398b51c40083342613440c91c6ec440c0944beb5d27769ea6cc90efe16cca34d60058260038110610f6157610f61614348565b015463ffffffff1660058360038110610f7c57610f7c614348565b0154600160201b90046001600160701b031660058460038110610fa157610fa1614348565b01546040805163ffffffff90941684526001600160701b039283166020850152600160901b9091049091169082015260600160405180910390a180610fe58161435e565b915050610ea9565b50610ff783612fe3565b811561101f5760405182815260008051602061441d8339815191529060200160405180910390a15b8015611047576040518181526000805160206143fd8339815191529060200160405180910390a15b61105c8385886000015189602001514261109f565b965050505050505090565b6005816003811061107757600080fd5b015463ffffffff811691506001600160701b03600160201b8204811691600160901b90041683565b6000806110ab836130da565b905060008660036110bd846001614377565b6110c791906143a0565b600381106110d7576110d7614348565b6020020151905060008783600381106110f2576110f2614348565b6020020151895160408b015191925060009161111690670de0b6b3a76400006143b4565b61112091906143cb565b905060008a602001518b60400151670de0b6b3a764000061114191906143b4565b61114b91906143cb565b9050600080856000015163ffffffff168903905060008187602001518760200151036001600160701b0316816111835761118361438a565b04905060008288604001518860400151036001600160701b0316816111aa576111aa61438a565b04905060006111b983886130fb565b905060006111c78388613113565b90508d8f670de0b6b3a764000002816111e2576111e261438a565b049101039350600092508b915061120390508c6729a2241af62c00006143b4565b61120d91906143cb565b9050600060648b6112278e6801e5b8fa8fe2ac00006143b4565b61123191906143cb565b61123b91906143cb565b905061125061124a84846130fb565b82613113565b985050505050505050505b95945050505050565b61126c613daa565b600061127b836203f480613122565b905060008690506000866112928960a001516130da565b600381106112a2576112a2614348565b602002015190506112b1613daa565b60006112be600286614318565b90505b84811161140a5760006112e0886112db6203f480856143b4565b6130fb565b905060006112ef6003846143a0565b90508560a00151821161139b5760405180606001604052808c836003811061131957611319614348565b60200201516000015163ffffffff1681526020018c836003811061133f5761133f614348565b6020020151602001516001600160701b031681526020018c836003811061136857611368614348565b6020020151604001516001600160701b0316905284826003811061138e5761138e614348565b6020020152506113f89050565b60006113a8878c856109b6565b505090506113c18782888e600001518f60200151612060565b8583600381106113d3576113d3614348565b60200201529550858482600381106113ed576113ed614348565b602002015195505050505b806114028161435e565b9150506112c1565b5093505050505b949350505050565b60008054906101000a90046001600160a01b03166001600160a01b03166370905dce6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561146a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148e919061432b565b6001600160a01b0316336001600160a01b0316146114f35760405162461bcd60e51b815260206004820152601d60248201527f43616c6c6572206973206e6f7420656d657267656e63792061646d696e00000060448201526064015b60405180910390fd5b6114fc82613145565b6008600c6101000a81548163ffffffff021916908363ffffffff16021790555061152581613145565b6008601c6101000a81548163ffffffff021916908363ffffffff1602179055505050565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa158015611591573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b591906143df565b61160c5760405162461bcd60e51b815260206004820152602260248201527f43616c6c6572206973206e6f7420617574686f72697a656420746f20676f7665604482015261393760f11b60648201526084016114ea565b600480546affffffffffffffffffffff60801b191690556040517f2ca46d19fadde10b652ba2cceb5540c374dd95ed6c3799a78846066c044b294190600090a1565b60008054906101000a90046001600160a01b03166001600160a01b03166370905dce6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561169f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c3919061432b565b6001600160a01b0316336001600160a01b0316146117235760405162461bcd60e51b815260206004820152601d60248201527f43616c6c6572206973206e6f7420656d657267656e63792061646d696e00000060448201526064016114ea565b60048054821515600160f81b026001600160f81b039091161790556040517f55c7b3ec166bc5f2c12cbc5052f03ed7ce65c9cf9ab2af20484352f6a4a740a09061177290831515815260200190565b60405180910390a150565b60006117876126a5565b9050428160a00151036117975750565b600060405180606001604052806117ac61285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180d91906142e9565b815260200161181a612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611857573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061187b91906142e9565b815260200161188861288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e991906142e9565b905260408051606081019091529091506000906005600383835b8282101561195a57604080516060810182528386015463ffffffff811682526001600160701b03600160201b82048116602080850191909152600160901b9092041692820192909252825260019092019101611903565b50505050905060008060006119708686426109b6565b92509250925061198286858742611264565b935060005b6003811015611acb578481600381106119a2576119a2614348565b6020020151600582600381106119ba576119ba614348565b825191018054602084015160409094015163ffffffff9093166001600160901b031990911617600160201b6001600160701b0394851602176001600160901b0316600160901b93909216929092021790557f398b51c40083342613440c91c6ec440c0944beb5d27769ea6cc90efe16cca34d60058260038110611a3f57611a3f614348565b015463ffffffff1660058360038110611a5a57611a5a614348565b0154600160201b90046001600160701b031660058460038110611a7f57611a7f614348565b01546040805163ffffffff90941684526001600160701b039283166020850152600160901b9091049091169082015260600160405180910390a180611ac38161435e565b915050611987565b50611ad583612fe3565b8115611afd5760405182815260008051602061441d8339815191529060200160405180910390a15b8015611b25576040518181526000805160206143fd8339815191529060200160405180910390a15b505050505050565b600454600090600160801b90046001600160581b031615611b4f575061138890565b5061019090565b60006002805403611ba95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016114ea565b600280553415801590611bbc5750600084115b15611bda576040516349f67f3160e11b815260040160405180910390fd5b34158015611be6575083155b15611c045760405163d695701160e01b815260040160405180910390fd5b81421115611c2e576040516327132a1d60e11b8152600481018390524260248201526044016114ea565b60006040518060600160405280611c4361285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca491906142e9565b8152602001611cb1612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1291906142e9565b8152602001611d1f61288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8091906142e9565b905290506000611d8e6126a5565b905060008054906101000a90046001600160a01b03166001600160a01b031663ff0938a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611de1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0591906143df565b15611e23576040516301ca793160e61b815260040160405180910390fd5b600454600160f81b900460ff1615611e4e5760405163026d6c1b60e11b815260040160405180910390fd5b6000803411611e6857611e63878785856131ad565b611e74565b611e7434878585613546565b90503415611f4657600854611ea390611e9e908390600160801b90046001600160601b0316614377565b6138b0565b600880546001600160601b0392909216600160801b026bffffffffffffffffffffffff60801b19909216919091179081905563ffffffff600160e01b9091041615801590611f235750600854611f0e90600160e01b900463ffffffff16670de0b6b3a76400006143b4565b600854600160801b90046001600160601b0316115b15611f415760405163c1ea2d8f60e01b815260040160405180910390fd5b611fec565b600854611f6190611e9e9083906001600160601b0316614377565b600880546bffffffffffffffffffffffff19166001600160601b03929092169190911790819055600160601b900463ffffffff1615801590611fce5750600854611fc090600160601b900463ffffffff16670de0b6b3a76400006143b4565b6008546001600160601b0316115b15611fec5760405163ca765dab60e01b815260040160405180910390fd5b611ff461288b565b604051631b2622ff60e11b8152600060048201526001600160a01b03919091169063364c45fe90602401600060405180830381600087803b15801561203857600080fd5b505af115801561204c573d6000803e3d6000fd5b505060016002555090979650505050505050565b604080516060810182526000808252602082018190529181019190915260008660a001518660a001516120939190614318565b905060006120a688888488886001613914565b905060006120b989898589896000613914565b905060405180606001604052806120d38a60a00151613145565b63ffffffff16815260200188602001516001600160701b0316846120f79190614377565b6001600160701b0316815260200188604001516001600160701b03168361211e9190614377565b6001600160701b031690529998505050505050505050565b61213e613daa565b6000808061214f856203f480613122565b905060006203f480612162600b84614318565b61216c91906143b4565b9050600061217b600284614318565b90505b82811161224d576000612198886112db6203f480856143b4565b905060006121a76003846143a0565b905060006121b58584614318565b90506121c1818d6143b4565b6121cb9089614377565b97506121d7818c6143b4565b6121e19088614377565b965060405180606001604052806121f785613145565b63ffffffff168152602001896001600160701b03168152602001886001600160701b031681525089836003811061223057612230614348565b6020020152509092508190506122458161435e565b91505061217e565b50505050509392505050565b6000546001600160a01b0316156122b1576000546001600160a01b031633146122b15760405162461bcd60e51b815260206004820152600a6024820152692737ba1036b0b9ba32b960b11b60448201526064016114ea565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080600060405180606001604052806122eb61285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa158015612328573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234c91906142e9565b8152602001612359612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ba91906142e9565b81526020016123c761288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa158015612404573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061242891906142e9565b90529050600061243961098b6126a5565b5050805160408201519192509061245890670de0b6b3a76400006143b4565b61246291906143cb565b6020820151604083015161247e90670de0b6b3a76400006143b4565b61248891906143cb565b9350935050509091565b60008060405180606001604052806124a861285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250991906142e9565b8152602001612516612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612553573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257791906142e9565b815260200161258461288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e591906142e9565b9052905060006125f36126a5565b60408051606081019091529091506000906005600383835b8282101561266257604080516060810182528386015463ffffffff811682526001600160701b03600160201b82048116602080850191909152600160901b909204169282019290925282526001909201910161260b565b50505050905060006126758385426109b6565b5050905061268583838642611264565b915061269c8183866000015187602001514261109f565b94505050505090565b6126de6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040805160c0810182526003546001600160801b038082168352600160801b9182900481166020840152600454908116938301939093529091046001600160581b03166060820181905260808201901561273a5761138861273e565b6101905b8152600454600160d81b900463ffffffff16602090910152919050565b60008061276661285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c791906142e9565b905060006127d3612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612810573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283491906142e9565b90508061284983670de0b6b3a76400006143b4565b61285391906143cb565b9250505090565b6000600181815b81526020810191909152604001600020546001600160a01b0316919050565b600060018180612861565b60006001816003612861565b60008060008069010f0cf064dd592000008810156128e8576128bb88888888613a65565b91506128c78289614377565b97508187116128d75760006128e1565b6128e18288614318565b965061292f565b6129206201518061290268056bc75e2d63100000886143b4565b61290c91906143cb565b6112db69010f0cf064dd592000008b614318565b905061292c8189614318565b97505b96979596909590945092505050565b60008082612950578660200151612953565b86515b905060008760400151878361296891906143b4565b61297291906143cb565b905060008461298d576129886064612710614318565b61299a565b61299a6064612710614377565b905060006127108288600001516129b191906143b4565b6129bb91906143cb565b90508515612ac35760208701516129d2908a6143b4565b612710620151806101908b6129e788876143b4565b6129f191906143b4565b6129fb91906143b4565b612a0591906143cb565b612a0f91906143cb565b612a1985846143b4565b612a239190614377565b11612a9d576127106201518088602001516101908b878c60000151612a4891906143b4565b612a5291906143b4565b612a5c91906143b4565b612a6691906143cb565b612a7091906143cb565b612a7a91906143cb565b612a84908a614318565b612a8e848b6143b4565b612a9891906143cb565b612ab8565b8087602001518a612aae91906143b4565b612ab891906143cb565b94505050505061125b565b612710620151808b608001518a868b60000151612ae091906143b4565b612aea91906143b4565b612af491906143b4565b612afe91906143cb565b612b0891906143cb565b6020880151612b17908b6143b4565b612b219190614377565b612b2b84836143b4565b10612ba7576127106201518088602001518c608001518b878c60000151612b5291906143b4565b612b5c91906143b4565b612b6691906143b4565b612b7091906143cb565b612b7a91906143cb565b612b8491906143cb565b612b8e908a614377565b612b98848b6143b4565b612ba291906143cb565b612bc2565b8087602001518a612bb891906143b4565b612bc291906143cb565b9a9950505050505050505050565b600454600160d81b900463ffffffff1615612be757565b6000612bf161285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c5291906142e9565b90506000612c5e612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cbf91906142e9565b90506000612ccb61285a565b6001600160a01b0316634b94f50e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d2c91906142e9565b90506000826127106064612d4887670de0b6b3a76400006143b4565b612d5291906143b4565b612d5c91906143cb565b612d6691906143cb565b612d709083614377565b9050600083612710612d83606482614318565b612d9588670de0b6b3a76400006143b4565b612d9f91906143b4565b612da991906143cb565b612db391906143cb565b90506000612de683612dd769010f0cf064dd59200000670de0b6b3a76400006143b4565b612de191906143cb565b613b9e565b90506000612e2a7f0000000000000000000000000000000000000000000000000000000000000000612dd769010f0cf064dd59200000670de0b6b3a76400006143b4565b90506000612e4169010f0cf064dd59200000613b9e565b90506000612e586909484cd41c37600c0000613c03565b90506113886000612e6842613145565b9050612e756155f0613145565b6008600c6101000a81548163ffffffff021916908363ffffffff160217905550612ea16203d090613145565b6008805463ffffffff928316600160e01b026001600160e01b03909116179055600480546001600160f81b0316600160f81b1790556040805160c0810182526001600160801b03808a16825288811660208301528716918101919091526001600160581b03851660608201526080810184905290821660a0820152612f2581612fe3565b6000612f388a8a8563ffffffff16612136565b905060005b6003811015612fd357818160038110612f5857612f58614348565b602002015160058260038110612f7057612f70614348565b825191018054602084015160409094015163ffffffff9093166001600160901b031990911617600160201b6001600160701b0394851602176001600160901b0316600160901b939092169290920217905580612fcb8161435e565b915050612f3d565b5050505050505050505050505050565b8051612fee90613b9e565b600380546001600160801b0319166001600160801b0392909216919091179055602081015161301c90613b9e565b600380546001600160801b03928316600160801b029216919091179055604081015161304790613b9e565b600480546001600160801b0319166001600160801b0392909216919091179055606081015161307590613c03565b600480546001600160581b0392909216600160801b026affffffffffffffffffffff60801b1990921691909117905560a08101516130b290613145565b6004805463ffffffff92909216600160d81b0263ffffffff60d81b1990921691909117905550565b600060036130eb836203f480613122565b6130f591906143a0565b92915050565b600081831061310a578161310c565b825b9392505050565b600081831161310a578161310c565b60008160016131318286614377565b61313b9190614318565b61310c91906143cb565b6000600160201b82106131a95760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b60648201526084016114ea565b5090565b604080516060810190915260009081906005600383835b8282101561321b57604080516060810182528386015463ffffffff811682526001600160701b03600160201b82048116602080850191909152600160901b90920416928201929092528252600190920191016131c4565b50505050905060008060006132318688426109b6565b92509250925061324386858942611264565b935060008360200151846040015161325b91906143b4565b905060008a856020015161326f9190614377565b9050600061327d82846143cb565b90506000866040015182886000015161329691906143b4565b6132a091906143cb565b90508187604001516132b29190614318565b98508b8910156132df5760405163126c3c7360e21b8152600481018a9052602481018d90526044016114ea565b60408b01518b516132f1908b90614318565b1015613310576040516359426e8360e11b815260040160405180910390fd5b865260208601919091526040850152504260a084015261332f83612fe3565b81156133575760405182815260008051602061441d8339815191529060200160405180910390a15b801561337f576040518181526000805160206143fd8339815191529060200160405180910390a15b60005b60038110156134185784816003811061339d5761339d614348565b6020020151600582600381106133b5576133b5614348565b825191018054602084015160409094015163ffffffff9093166001600160901b031990911617600160201b6001600160701b0394851602176001600160901b0316600160901b9390921692909202179055806134108161435e565b915050613382565b50613421612880565b60405163079cc67960e41b8152336004820152602481018b90526001600160a01b0391909116906379cc6790906044016020604051808303816000875af1158015613470573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061349491906143df565b5061349d61285a565b6040516324ee5e2f60e11b8152336004820152602481018790526001600160a01b0391909116906349dcbc5e90604401600060405180830381600087803b1580156134e757600080fd5b505af11580156134fb573d6000803e3d6000fd5b5050604080518c8152602081018990523393507f4dc7f7059e30a400ff6a542834c87dab3774e0a9ac02346b928bfc336f1f7bf392500160405180910390a250505050949350505050565b604080516060810190915260009081906005600383835b828210156135b457604080516060810182528386015463ffffffff811682526001600160701b03600160201b82048116602080850191909152600160901b909204169282019290925282526001909201910161355d565b50505050905060008060006135ca8688426109b6565b9250925092506135dc86858942611264565b93506000836000015184604001516135f491906143b4565b905060008a85604001516136089190614377565b9050600061361682846143cb565b90506000866040015183886020015161362f91906143b4565b61363991906143cb565b8751909150613649908390614318565b98508b8910156136765760405163126c3c7360e21b8152600481018a9052602481018d90526044016114ea565b90865260208601526040850152504260a084015261369383612fe3565b81156136bb5760405182815260008051602061441d8339815191529060200160405180910390a15b80156136e3576040518181526000805160206143fd8339815191529060200160405180910390a15b60005b600381101561377c5784816003811061370157613701614348565b60200201516005826003811061371957613719614348565b825191018054602084015160409094015163ffffffff9093166001600160901b031990911617600160201b6001600160701b0394851602176001600160901b0316600160901b9390921692909202179055806137748161435e565b9150506136e6565b50600061378761285a565b6001600160a01b03163460405160006040518083038185875af1925050503d80600081146137d1576040519150601f19603f3d011682016040523d82523d6000602084013e6137d6565b606091505b50909150506001811515146137fe57604051630db2c7f160e31b815260040160405180910390fd5b613806612880565b6040516340c10f1960e01b8152336004820152602481018890526001600160a01b0391909116906340c10f1990604401600060405180830381600087803b15801561385057600080fd5b505af1158015613864573d6000803e3d6000fd5b5050604080518d8152602081018a90523393507f11db3d568555307b53f9e9d32403ae0f696e7bcbd25fb61788d32e064b49387c92500160405180910390a25050505050949350505050565b6000600160601b82106131a95760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203960448201526536206269747360d01b60648201526084016114ea565b600080600090506000806139308a898b60800151898b8a613c67565b91509150816000146139dd5760008561394d578a60200151613950565b8a515b9050600086613963578a60200151613966565b8a515b905061397281836143b4565b61397d9060026143b4565b84838d6040015161398e91906143b4565b838f6040015161399e91906143b4565b6139a89190614377565b6139ba90670de0b6b3a76400006143b4565b6139c491906143b4565b6139ce91906143cb565b6139d89086614377565b945050505b8015613a57576000856139fc576139f76064612710614318565b613a09565b613a096064612710614377565b9050613a17612710886143b4565b8189613a2b85670de0b6b3a76400006143b4565b613a3591906143b4565b613a3f91906143b4565b613a4991906143cb565b613a539085614377565b9350505b509098975050505050505050565b600080685150ae84a8cdf00000613a7f62015180876143b4565b613a8991906143cb565b9050600069010f0cf064dd592000008560400151613aa79190614377565b855111613ab5576000613af2565b613af2613acc8869010f0cf064dd59200000614318565b6040870151875169010f0cf064dd5920000091613ae891614318565b6112db9190614318565b9050818411613b2e57613b2562015180613b15685150ae84a8cdf00000876143b4565b613b1f91906143cb565b826130fb565b92505050611411565b600062015180613b47685150ae84a8cdf00000856143b4565b613b5191906143cb565b905060006201518068056bc75e2d63100000613b6d8689614318565b613b7791906143b4565b613b8191906143cb565b9050613b91836112db8385614377565b9998505050505050505050565b6000600160801b82106131a95760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b60648201526084016114ea565b6000600160581b82106131a95760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203860448201526538206269747360d01b60648201526084016114ea565b600080600083613c7b578860200151613c7e565b88515b9050600084613c8d5787613c91565b6101905b9050600085613cac57613ca76064612710614318565b613cb9565b613cb96064612710614377565b9050600080898d60400151613cce91906143b4565b9050600061271086613ce08c876143b4565b613cea91906143b4565b613cf491906143cb565b9050600089613d035781613d05565b825b905060008a613d145783613d16565b825b9050808211613d26576000613d30565b613d308183614318565b945050505050600081600003613d47576000613d80565b83613d52868b6143b4565b613d5c91906143b4565b62015180613d6c612710856143b4565b613d7691906143b4565b613d8091906143cb565b9050613d8c8c826130fb565b9650613d98878d614318565b95505050505050965096945050505050565b60405180606001604052806003905b6040805160608101825260008082526020808301829052928201528252600019909201910181613db95790505090565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff81118282101715613e2257613e22613de9565b60405290565b600060c08284031215613e3a57600080fd5b60405160c0810181811067ffffffffffffffff82111715613e5d57613e5d613de9565b8060405250809150823581526020830135602082015260408301356040820152606083013560608201526080830135608082015260a083013560a08201525092915050565b600060608284031215613eb457600080fd5b613ebc613dff565b905081358152602082013560208201526040820135604082015292915050565b60008060006101408486031215613ef257600080fd5b613efc8585613e28565b9250613f0b8560c08601613ea2565b915061012084013590509250925092565b6101008101613f608286805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a08301525050565b60c082019390935260e00152919050565b600060208284031215613f8357600080fd5b5035919050565b80356001600160701b0381168114613fa157600080fd5b919050565b600060608284031215613fb857600080fd5b613fc0613dff565b9050813563ffffffff81168114613fd657600080fd5b8152613fe460208301613f8a565b6020820152613ff560408301613f8a565b604082015292915050565b600082601f83011261401157600080fd5b614019613dff565b8061012084018581111561402c57600080fd5b845b81811015614050576140408782613fa6565b845260209093019260600161402e565b509095945050505050565b6000806000806000610240868803121561407457600080fd5b61407e8787613e28565b945061408d8760c08801614000565b94979496505050506101e08301359261020081013592610220909101359150565b60008060008061026085870312156140c557600080fd5b6140cf8686613e28565b93506140de8660c08701614000565b92506140ee866101e08701613ea2565b939692955092936102400135925050565b6101208101818360005b600381101561415c57614146838351805163ffffffff1682526020808201516001600160701b039081169184019190915260409182015116910152565b6060929092019160209190910190600101614109565b50505092915050565b6000806040838503121561417857600080fd5b50508035926020909101359150565b801515811461419557600080fd5b50565b6000602082840312156141aa57600080fd5b813561310c81614187565b6000806000606084860312156141ca57600080fd5b505081359360208301359350604090920135919050565b600080600080600061022086880312156141fa57600080fd5b6142048787613e28565b94506142138760c08801613e28565b9350614223876101808801613fa6565b949793965093946101e08101359450610200013592915050565b606081016130f58284805163ffffffff1682526020808201516001600160701b039081169184019190915260409182015116910152565b6001600160a01b038116811461419557600080fd5b60006020828403121561429b57600080fd5b813561310c81614274565b60c081016130f58284805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a08301525050565b6000602082840312156142fb57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156130f5576130f5614302565b60006020828403121561433d57600080fd5b815161310c81614274565b634e487b7160e01b600052603260045260246000fd5b60006001820161437057614370614302565b5060010190565b808201808211156130f5576130f5614302565b634e487b7160e01b600052601260045260246000fd5b6000826143af576143af61438a565b500690565b80820281158282048414176130f5576130f5614302565b6000826143da576143da61438a565b500490565b6000602082840312156143f157600080fd5b815161310c8161418756fe77dcabf770d7a83dccad1ada406e9f6803698e89a0366ffd861ea37f8b0c62b60c34fd976d4acba944a797150ed7a2bbb31bae33aaeced825ee7680972b594e4a26469706673582212203d957b3d635c6d09de77aa8b24b02b18248e4cbb86d334c0ab21b1a4dd40ad5164736f6c6343000812003300000000000000000000000000000000000000000000000000886c98b7600000
Deployed Bytecode
0x6080604052600436106102515760003560e01c80638516e6dc11610139578063d46655f4116100b6578063ecb296e51161007a578063ecb296e5146105ba578063ee6e35fe146107b4578063ee97f7f3146107d6578063f636c89614610686578063f8917434146107f6578063fc9654ab1461080b57600080fd5b8063d46655f414610707578063d8e7c7171461066f578063dd8cf96314610727578063e002566414610751578063eb9623601461076657600080fd5b8063b738a307116100fd578063b738a3071461066f578063b7cc16d814610686578063c5461250146106a3578063c8795538146106c7578063cc4d0ee6146106e757600080fd5b80638516e6dc146105f05780638ac684fe146106055780639cf299511461061a5780639d9892cd1461062f578063adf6ce451461064257600080fd5b8063309f627c116101d257806351e8b5c61161019657806351e8b5c61461050f5780635c448777146105485780635c95eb521461055d5780635e37b9aa1461057b5780635e61f586146105ba5780636142c906146105d057600080fd5b8063309f627c1461044257806330e134dc14610462578063379377a9146104775780633850c7bd146104a45780634a53f3c5146104ef57600080fd5b80631bf7aa89116102195780631bf7aa891461030f5780631f457cb514610325578063245a4e72146103af578063252c09d7146103d95780632b4186761461042557600080fd5b80630902f1ac1461025657806309f221ee146102905780630c474d22146102b45780630ea9c984146102e357806318d45834146102fa575b600080fd5b34801561026257600080fd5b5061026b610822565b6040805194855260208501939093529183015260608201526080015b60405180910390f35b34801561029c57600080fd5b506102a661019081565b604051908152602001610287565b3480156102c057600080fd5b506102d46102cf366004613edc565b6109b6565b60405161028793929190613f1c565b3480156102ef57600080fd5b506102f8610a8e565b005b34801561030657600080fd5b506102a6610cac565b34801561031b57600080fd5b506102a661138881565b34801561033157600080fd5b50600454610370906001600160801b03811690600160801b81046001600160581b031690600160d81b810463ffffffff1690600160f81b900460ff1684565b604080516001600160801b0390951685526001600160581b03909316602085015263ffffffff9091169183019190915215156060820152608001610287565b3480156103bb57600080fd5b50600454600160f81b900460ff166040519015158152602001610287565b3480156103e557600080fd5b506103f96103f4366004613f71565b611067565b6040805163ffffffff90941684526001600160701b039283166020850152911690820152606001610287565b34801561043157600080fd5b506102a6685150ae84a8cdf0000081565b34801561044e57600080fd5b506102a661045d36600461405b565b61109f565b34801561046e57600080fd5b506102a6606481565b34801561048357600080fd5b506104976104923660046140ae565b611264565b60405161028791906140ff565b3480156104b057600080fd5b506003546104cf906001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610287565b3480156104fb57600080fd5b506102f861050a366004614165565b611419565b34801561051b57600080fd5b5060085461053390600160601b900463ffffffff1681565b60405163ffffffff9091168152602001610287565b34801561055457600080fd5b506102f8611549565b34801561056957600080fd5b506102a669010f0cf064dd5920000081565b34801561058757600080fd5b506008546105a290600160801b90046001600160601b031681565b6040516001600160601b039091168152602001610287565b3480156105c657600080fd5b506102a661271081565b3480156105dc57600080fd5b506102f86105eb366004614198565b61164e565b3480156105fc57600080fd5b506102f861177d565b34801561061157600080fd5b506102a6600381565b34801561062657600080fd5b506102a6611b2d565b6102a661063d3660046141b5565b611b56565b34801561064e57600080fd5b5061066261065d3660046141e1565b612060565b604051610287919061423d565b34801561067b57600080fd5b506102a66201518081565b34801561069257600080fd5b506102a668056bc75e2d6310000081565b3480156106af57600080fd5b5060085461053390600160e01b900463ffffffff1681565b3480156106d357600080fd5b506008546105a2906001600160601b031681565b3480156106f357600080fd5b506104976107023660046141b5565b612136565b34801561071357600080fd5b506102f8610722366004614289565b612259565b34801561073357600080fd5b5061073c6122d3565b60408051928352602083019190915201610287565b34801561075d57600080fd5b506102a6612492565b34801561077257600080fd5b5061079c610781366004613f71565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610287565b3480156107c057600080fd5b506107c96126a5565b60405161028791906142a6565b3480156107e257600080fd5b5060005461079c906001600160a01b031681565b34801561080257600080fd5b506102a661275b565b34801561081757600080fd5b506102a66203f48081565b6000806000806000604051806060016040528061083d61285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa15801561087a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089e91906142e9565b81526020016108ab612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090c91906142e9565b815260200161091961288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa158015610956573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097a91906142e9565b90529050600061099261098b6126a5565b83426109b6565b50506040810151815160208301516060909301519199909850919650945092505050565b6109ef6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040840151606085015160a0860151600092839290918390610a119088614318565b9050610a1f83838a84612897565b909750955090935091506000610a398a85848c600161293e565b90506000610a4b8b86858d600061293e565b90506040518060c001604052808381526020018281526020018681526020018581526020018c6080015181526020018a8152509750505050505093509350939050565b6000546040516227050b60e31b815261503160f01b60048201526001600160a01b0390911690630138285890602401602060405180830381865afa158015610ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afe919061432b565b600160008181526020919091527fcc69885fda6bcc1a4ace058b4a62bf5e179ea78fd58a1ccd71c22cc9b688792f80546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b815261544360f01b6004820152911690630138285890602401602060405180830381865afa158015610b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bad919061432b565b600080805260016020527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4980546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b8152614d4360f01b6004820152911690630138285890602401602060405180830381865afa158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c59919061432b565b600360005260016020527f7dfe757ecd65cbd7922a9c0161e935dd7fdbcc0e999689c7d31633896b1fc60b80546001600160a01b0319166001600160a01b0392909216919091179055610caa612bd0565b565b6000806040518060600160405280610cc261285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2391906142e9565b8152602001610d30612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9191906142e9565b8152602001610d9e61288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dff91906142e9565b905290506000610e0d6126a5565b60408051606081019091529091506000906005600383835b82821015610e7c57604080516060810182528386015463ffffffff811682526001600160701b03600160201b82048116602080850191909152600160901b9092041692820192909252825260019092019101610e25565b5050505090506000806000610e928587426109b6565b925092509250610ea485858842611264565b935060005b6003811015610fed57848160038110610ec457610ec4614348565b602002015160058260038110610edc57610edc614348565b825191018054602084015160409094015163ffffffff9093166001600160901b031990911617600160201b6001600160701b0394851602176001600160901b0316600160901b93909216929092021790557f398b51c40083342613440c91c6ec440c0944beb5d27769ea6cc90efe16cca34d60058260038110610f6157610f61614348565b015463ffffffff1660058360038110610f7c57610f7c614348565b0154600160201b90046001600160701b031660058460038110610fa157610fa1614348565b01546040805163ffffffff90941684526001600160701b039283166020850152600160901b9091049091169082015260600160405180910390a180610fe58161435e565b915050610ea9565b50610ff783612fe3565b811561101f5760405182815260008051602061441d8339815191529060200160405180910390a15b8015611047576040518181526000805160206143fd8339815191529060200160405180910390a15b61105c8385886000015189602001514261109f565b965050505050505090565b6005816003811061107757600080fd5b015463ffffffff811691506001600160701b03600160201b8204811691600160901b90041683565b6000806110ab836130da565b905060008660036110bd846001614377565b6110c791906143a0565b600381106110d7576110d7614348565b6020020151905060008783600381106110f2576110f2614348565b6020020151895160408b015191925060009161111690670de0b6b3a76400006143b4565b61112091906143cb565b905060008a602001518b60400151670de0b6b3a764000061114191906143b4565b61114b91906143cb565b9050600080856000015163ffffffff168903905060008187602001518760200151036001600160701b0316816111835761118361438a565b04905060008288604001518860400151036001600160701b0316816111aa576111aa61438a565b04905060006111b983886130fb565b905060006111c78388613113565b90508d8f670de0b6b3a764000002816111e2576111e261438a565b049101039350600092508b915061120390508c6729a2241af62c00006143b4565b61120d91906143cb565b9050600060648b6112278e6801e5b8fa8fe2ac00006143b4565b61123191906143cb565b61123b91906143cb565b905061125061124a84846130fb565b82613113565b985050505050505050505b95945050505050565b61126c613daa565b600061127b836203f480613122565b905060008690506000866112928960a001516130da565b600381106112a2576112a2614348565b602002015190506112b1613daa565b60006112be600286614318565b90505b84811161140a5760006112e0886112db6203f480856143b4565b6130fb565b905060006112ef6003846143a0565b90508560a00151821161139b5760405180606001604052808c836003811061131957611319614348565b60200201516000015163ffffffff1681526020018c836003811061133f5761133f614348565b6020020151602001516001600160701b031681526020018c836003811061136857611368614348565b6020020151604001516001600160701b0316905284826003811061138e5761138e614348565b6020020152506113f89050565b60006113a8878c856109b6565b505090506113c18782888e600001518f60200151612060565b8583600381106113d3576113d3614348565b60200201529550858482600381106113ed576113ed614348565b602002015195505050505b806114028161435e565b9150506112c1565b5093505050505b949350505050565b60008054906101000a90046001600160a01b03166001600160a01b03166370905dce6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561146a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148e919061432b565b6001600160a01b0316336001600160a01b0316146114f35760405162461bcd60e51b815260206004820152601d60248201527f43616c6c6572206973206e6f7420656d657267656e63792061646d696e00000060448201526064015b60405180910390fd5b6114fc82613145565b6008600c6101000a81548163ffffffff021916908363ffffffff16021790555061152581613145565b6008601c6101000a81548163ffffffff021916908363ffffffff1602179055505050565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa158015611591573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b591906143df565b61160c5760405162461bcd60e51b815260206004820152602260248201527f43616c6c6572206973206e6f7420617574686f72697a656420746f20676f7665604482015261393760f11b60648201526084016114ea565b600480546affffffffffffffffffffff60801b191690556040517f2ca46d19fadde10b652ba2cceb5540c374dd95ed6c3799a78846066c044b294190600090a1565b60008054906101000a90046001600160a01b03166001600160a01b03166370905dce6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561169f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c3919061432b565b6001600160a01b0316336001600160a01b0316146117235760405162461bcd60e51b815260206004820152601d60248201527f43616c6c6572206973206e6f7420656d657267656e63792061646d696e00000060448201526064016114ea565b60048054821515600160f81b026001600160f81b039091161790556040517f55c7b3ec166bc5f2c12cbc5052f03ed7ce65c9cf9ab2af20484352f6a4a740a09061177290831515815260200190565b60405180910390a150565b60006117876126a5565b9050428160a00151036117975750565b600060405180606001604052806117ac61285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180d91906142e9565b815260200161181a612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611857573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061187b91906142e9565b815260200161188861288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e991906142e9565b905260408051606081019091529091506000906005600383835b8282101561195a57604080516060810182528386015463ffffffff811682526001600160701b03600160201b82048116602080850191909152600160901b9092041692820192909252825260019092019101611903565b50505050905060008060006119708686426109b6565b92509250925061198286858742611264565b935060005b6003811015611acb578481600381106119a2576119a2614348565b6020020151600582600381106119ba576119ba614348565b825191018054602084015160409094015163ffffffff9093166001600160901b031990911617600160201b6001600160701b0394851602176001600160901b0316600160901b93909216929092021790557f398b51c40083342613440c91c6ec440c0944beb5d27769ea6cc90efe16cca34d60058260038110611a3f57611a3f614348565b015463ffffffff1660058360038110611a5a57611a5a614348565b0154600160201b90046001600160701b031660058460038110611a7f57611a7f614348565b01546040805163ffffffff90941684526001600160701b039283166020850152600160901b9091049091169082015260600160405180910390a180611ac38161435e565b915050611987565b50611ad583612fe3565b8115611afd5760405182815260008051602061441d8339815191529060200160405180910390a15b8015611b25576040518181526000805160206143fd8339815191529060200160405180910390a15b505050505050565b600454600090600160801b90046001600160581b031615611b4f575061138890565b5061019090565b60006002805403611ba95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016114ea565b600280553415801590611bbc5750600084115b15611bda576040516349f67f3160e11b815260040160405180910390fd5b34158015611be6575083155b15611c045760405163d695701160e01b815260040160405180910390fd5b81421115611c2e576040516327132a1d60e11b8152600481018390524260248201526044016114ea565b60006040518060600160405280611c4361285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca491906142e9565b8152602001611cb1612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1291906142e9565b8152602001611d1f61288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8091906142e9565b905290506000611d8e6126a5565b905060008054906101000a90046001600160a01b03166001600160a01b031663ff0938a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611de1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0591906143df565b15611e23576040516301ca793160e61b815260040160405180910390fd5b600454600160f81b900460ff1615611e4e5760405163026d6c1b60e11b815260040160405180910390fd5b6000803411611e6857611e63878785856131ad565b611e74565b611e7434878585613546565b90503415611f4657600854611ea390611e9e908390600160801b90046001600160601b0316614377565b6138b0565b600880546001600160601b0392909216600160801b026bffffffffffffffffffffffff60801b19909216919091179081905563ffffffff600160e01b9091041615801590611f235750600854611f0e90600160e01b900463ffffffff16670de0b6b3a76400006143b4565b600854600160801b90046001600160601b0316115b15611f415760405163c1ea2d8f60e01b815260040160405180910390fd5b611fec565b600854611f6190611e9e9083906001600160601b0316614377565b600880546bffffffffffffffffffffffff19166001600160601b03929092169190911790819055600160601b900463ffffffff1615801590611fce5750600854611fc090600160601b900463ffffffff16670de0b6b3a76400006143b4565b6008546001600160601b0316115b15611fec5760405163ca765dab60e01b815260040160405180910390fd5b611ff461288b565b604051631b2622ff60e11b8152600060048201526001600160a01b03919091169063364c45fe90602401600060405180830381600087803b15801561203857600080fd5b505af115801561204c573d6000803e3d6000fd5b505060016002555090979650505050505050565b604080516060810182526000808252602082018190529181019190915260008660a001518660a001516120939190614318565b905060006120a688888488886001613914565b905060006120b989898589896000613914565b905060405180606001604052806120d38a60a00151613145565b63ffffffff16815260200188602001516001600160701b0316846120f79190614377565b6001600160701b0316815260200188604001516001600160701b03168361211e9190614377565b6001600160701b031690529998505050505050505050565b61213e613daa565b6000808061214f856203f480613122565b905060006203f480612162600b84614318565b61216c91906143b4565b9050600061217b600284614318565b90505b82811161224d576000612198886112db6203f480856143b4565b905060006121a76003846143a0565b905060006121b58584614318565b90506121c1818d6143b4565b6121cb9089614377565b97506121d7818c6143b4565b6121e19088614377565b965060405180606001604052806121f785613145565b63ffffffff168152602001896001600160701b03168152602001886001600160701b031681525089836003811061223057612230614348565b6020020152509092508190506122458161435e565b91505061217e565b50505050509392505050565b6000546001600160a01b0316156122b1576000546001600160a01b031633146122b15760405162461bcd60e51b815260206004820152600a6024820152692737ba1036b0b9ba32b960b11b60448201526064016114ea565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080600060405180606001604052806122eb61285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa158015612328573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234c91906142e9565b8152602001612359612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ba91906142e9565b81526020016123c761288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa158015612404573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061242891906142e9565b90529050600061243961098b6126a5565b5050805160408201519192509061245890670de0b6b3a76400006143b4565b61246291906143cb565b6020820151604083015161247e90670de0b6b3a76400006143b4565b61248891906143cb565b9350935050509091565b60008060405180606001604052806124a861285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250991906142e9565b8152602001612516612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612553573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257791906142e9565b815260200161258461288b565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e591906142e9565b9052905060006125f36126a5565b60408051606081019091529091506000906005600383835b8282101561266257604080516060810182528386015463ffffffff811682526001600160701b03600160201b82048116602080850191909152600160901b909204169282019290925282526001909201910161260b565b50505050905060006126758385426109b6565b5050905061268583838642611264565b915061269c8183866000015187602001514261109f565b94505050505090565b6126de6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040805160c0810182526003546001600160801b038082168352600160801b9182900481166020840152600454908116938301939093529091046001600160581b03166060820181905260808201901561273a5761138861273e565b6101905b8152600454600160d81b900463ffffffff16602090910152919050565b60008061276661285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c791906142e9565b905060006127d3612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612810573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283491906142e9565b90508061284983670de0b6b3a76400006143b4565b61285391906143cb565b9250505090565b6000600181815b81526020810191909152604001600020546001600160a01b0316919050565b600060018180612861565b60006001816003612861565b60008060008069010f0cf064dd592000008810156128e8576128bb88888888613a65565b91506128c78289614377565b97508187116128d75760006128e1565b6128e18288614318565b965061292f565b6129206201518061290268056bc75e2d63100000886143b4565b61290c91906143cb565b6112db69010f0cf064dd592000008b614318565b905061292c8189614318565b97505b96979596909590945092505050565b60008082612950578660200151612953565b86515b905060008760400151878361296891906143b4565b61297291906143cb565b905060008461298d576129886064612710614318565b61299a565b61299a6064612710614377565b905060006127108288600001516129b191906143b4565b6129bb91906143cb565b90508515612ac35760208701516129d2908a6143b4565b612710620151806101908b6129e788876143b4565b6129f191906143b4565b6129fb91906143b4565b612a0591906143cb565b612a0f91906143cb565b612a1985846143b4565b612a239190614377565b11612a9d576127106201518088602001516101908b878c60000151612a4891906143b4565b612a5291906143b4565b612a5c91906143b4565b612a6691906143cb565b612a7091906143cb565b612a7a91906143cb565b612a84908a614318565b612a8e848b6143b4565b612a9891906143cb565b612ab8565b8087602001518a612aae91906143b4565b612ab891906143cb565b94505050505061125b565b612710620151808b608001518a868b60000151612ae091906143b4565b612aea91906143b4565b612af491906143b4565b612afe91906143cb565b612b0891906143cb565b6020880151612b17908b6143b4565b612b219190614377565b612b2b84836143b4565b10612ba7576127106201518088602001518c608001518b878c60000151612b5291906143b4565b612b5c91906143b4565b612b6691906143b4565b612b7091906143cb565b612b7a91906143cb565b612b8491906143cb565b612b8e908a614377565b612b98848b6143b4565b612ba291906143cb565b612bc2565b8087602001518a612bb891906143b4565b612bc291906143cb565b9a9950505050505050505050565b600454600160d81b900463ffffffff1615612be757565b6000612bf161285a565b6001600160a01b0316632f04d7986040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c5291906142e9565b90506000612c5e612880565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cbf91906142e9565b90506000612ccb61285a565b6001600160a01b0316634b94f50e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d2c91906142e9565b90506000826127106064612d4887670de0b6b3a76400006143b4565b612d5291906143b4565b612d5c91906143cb565b612d6691906143cb565b612d709083614377565b9050600083612710612d83606482614318565b612d9588670de0b6b3a76400006143b4565b612d9f91906143b4565b612da991906143cb565b612db391906143cb565b90506000612de683612dd769010f0cf064dd59200000670de0b6b3a76400006143b4565b612de191906143cb565b613b9e565b90506000612e2a7f00000000000000000000000000000000000000000000000000886c98b7600000612dd769010f0cf064dd59200000670de0b6b3a76400006143b4565b90506000612e4169010f0cf064dd59200000613b9e565b90506000612e586909484cd41c37600c0000613c03565b90506113886000612e6842613145565b9050612e756155f0613145565b6008600c6101000a81548163ffffffff021916908363ffffffff160217905550612ea16203d090613145565b6008805463ffffffff928316600160e01b026001600160e01b03909116179055600480546001600160f81b0316600160f81b1790556040805160c0810182526001600160801b03808a16825288811660208301528716918101919091526001600160581b03851660608201526080810184905290821660a0820152612f2581612fe3565b6000612f388a8a8563ffffffff16612136565b905060005b6003811015612fd357818160038110612f5857612f58614348565b602002015160058260038110612f7057612f70614348565b825191018054602084015160409094015163ffffffff9093166001600160901b031990911617600160201b6001600160701b0394851602176001600160901b0316600160901b939092169290920217905580612fcb8161435e565b915050612f3d565b5050505050505050505050505050565b8051612fee90613b9e565b600380546001600160801b0319166001600160801b0392909216919091179055602081015161301c90613b9e565b600380546001600160801b03928316600160801b029216919091179055604081015161304790613b9e565b600480546001600160801b0319166001600160801b0392909216919091179055606081015161307590613c03565b600480546001600160581b0392909216600160801b026affffffffffffffffffffff60801b1990921691909117905560a08101516130b290613145565b6004805463ffffffff92909216600160d81b0263ffffffff60d81b1990921691909117905550565b600060036130eb836203f480613122565b6130f591906143a0565b92915050565b600081831061310a578161310c565b825b9392505050565b600081831161310a578161310c565b60008160016131318286614377565b61313b9190614318565b61310c91906143cb565b6000600160201b82106131a95760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b60648201526084016114ea565b5090565b604080516060810190915260009081906005600383835b8282101561321b57604080516060810182528386015463ffffffff811682526001600160701b03600160201b82048116602080850191909152600160901b90920416928201929092528252600190920191016131c4565b50505050905060008060006132318688426109b6565b92509250925061324386858942611264565b935060008360200151846040015161325b91906143b4565b905060008a856020015161326f9190614377565b9050600061327d82846143cb565b90506000866040015182886000015161329691906143b4565b6132a091906143cb565b90508187604001516132b29190614318565b98508b8910156132df5760405163126c3c7360e21b8152600481018a9052602481018d90526044016114ea565b60408b01518b516132f1908b90614318565b1015613310576040516359426e8360e11b815260040160405180910390fd5b865260208601919091526040850152504260a084015261332f83612fe3565b81156133575760405182815260008051602061441d8339815191529060200160405180910390a15b801561337f576040518181526000805160206143fd8339815191529060200160405180910390a15b60005b60038110156134185784816003811061339d5761339d614348565b6020020151600582600381106133b5576133b5614348565b825191018054602084015160409094015163ffffffff9093166001600160901b031990911617600160201b6001600160701b0394851602176001600160901b0316600160901b9390921692909202179055806134108161435e565b915050613382565b50613421612880565b60405163079cc67960e41b8152336004820152602481018b90526001600160a01b0391909116906379cc6790906044016020604051808303816000875af1158015613470573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061349491906143df565b5061349d61285a565b6040516324ee5e2f60e11b8152336004820152602481018790526001600160a01b0391909116906349dcbc5e90604401600060405180830381600087803b1580156134e757600080fd5b505af11580156134fb573d6000803e3d6000fd5b5050604080518c8152602081018990523393507f4dc7f7059e30a400ff6a542834c87dab3774e0a9ac02346b928bfc336f1f7bf392500160405180910390a250505050949350505050565b604080516060810190915260009081906005600383835b828210156135b457604080516060810182528386015463ffffffff811682526001600160701b03600160201b82048116602080850191909152600160901b909204169282019290925282526001909201910161355d565b50505050905060008060006135ca8688426109b6565b9250925092506135dc86858942611264565b93506000836000015184604001516135f491906143b4565b905060008a85604001516136089190614377565b9050600061361682846143cb565b90506000866040015183886020015161362f91906143b4565b61363991906143cb565b8751909150613649908390614318565b98508b8910156136765760405163126c3c7360e21b8152600481018a9052602481018d90526044016114ea565b90865260208601526040850152504260a084015261369383612fe3565b81156136bb5760405182815260008051602061441d8339815191529060200160405180910390a15b80156136e3576040518181526000805160206143fd8339815191529060200160405180910390a15b60005b600381101561377c5784816003811061370157613701614348565b60200201516005826003811061371957613719614348565b825191018054602084015160409094015163ffffffff9093166001600160901b031990911617600160201b6001600160701b0394851602176001600160901b0316600160901b9390921692909202179055806137748161435e565b9150506136e6565b50600061378761285a565b6001600160a01b03163460405160006040518083038185875af1925050503d80600081146137d1576040519150601f19603f3d011682016040523d82523d6000602084013e6137d6565b606091505b50909150506001811515146137fe57604051630db2c7f160e31b815260040160405180910390fd5b613806612880565b6040516340c10f1960e01b8152336004820152602481018890526001600160a01b0391909116906340c10f1990604401600060405180830381600087803b15801561385057600080fd5b505af1158015613864573d6000803e3d6000fd5b5050604080518d8152602081018a90523393507f11db3d568555307b53f9e9d32403ae0f696e7bcbd25fb61788d32e064b49387c92500160405180910390a25050505050949350505050565b6000600160601b82106131a95760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203960448201526536206269747360d01b60648201526084016114ea565b600080600090506000806139308a898b60800151898b8a613c67565b91509150816000146139dd5760008561394d578a60200151613950565b8a515b9050600086613963578a60200151613966565b8a515b905061397281836143b4565b61397d9060026143b4565b84838d6040015161398e91906143b4565b838f6040015161399e91906143b4565b6139a89190614377565b6139ba90670de0b6b3a76400006143b4565b6139c491906143b4565b6139ce91906143cb565b6139d89086614377565b945050505b8015613a57576000856139fc576139f76064612710614318565b613a09565b613a096064612710614377565b9050613a17612710886143b4565b8189613a2b85670de0b6b3a76400006143b4565b613a3591906143b4565b613a3f91906143b4565b613a4991906143cb565b613a539085614377565b9350505b509098975050505050505050565b600080685150ae84a8cdf00000613a7f62015180876143b4565b613a8991906143cb565b9050600069010f0cf064dd592000008560400151613aa79190614377565b855111613ab5576000613af2565b613af2613acc8869010f0cf064dd59200000614318565b6040870151875169010f0cf064dd5920000091613ae891614318565b6112db9190614318565b9050818411613b2e57613b2562015180613b15685150ae84a8cdf00000876143b4565b613b1f91906143cb565b826130fb565b92505050611411565b600062015180613b47685150ae84a8cdf00000856143b4565b613b5191906143cb565b905060006201518068056bc75e2d63100000613b6d8689614318565b613b7791906143b4565b613b8191906143cb565b9050613b91836112db8385614377565b9998505050505050505050565b6000600160801b82106131a95760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b60648201526084016114ea565b6000600160581b82106131a95760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203860448201526538206269747360d01b60648201526084016114ea565b600080600083613c7b578860200151613c7e565b88515b9050600084613c8d5787613c91565b6101905b9050600085613cac57613ca76064612710614318565b613cb9565b613cb96064612710614377565b9050600080898d60400151613cce91906143b4565b9050600061271086613ce08c876143b4565b613cea91906143b4565b613cf491906143cb565b9050600089613d035781613d05565b825b905060008a613d145783613d16565b825b9050808211613d26576000613d30565b613d308183614318565b945050505050600081600003613d47576000613d80565b83613d52868b6143b4565b613d5c91906143b4565b62015180613d6c612710856143b4565b613d7691906143b4565b613d8091906143cb565b9050613d8c8c826130fb565b9650613d98878d614318565b95505050505050965096945050505050565b60405180606001604052806003905b6040805160608101825260008082526020808301829052928201528252600019909201910181613db95790505090565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff81118282101715613e2257613e22613de9565b60405290565b600060c08284031215613e3a57600080fd5b60405160c0810181811067ffffffffffffffff82111715613e5d57613e5d613de9565b8060405250809150823581526020830135602082015260408301356040820152606083013560608201526080830135608082015260a083013560a08201525092915050565b600060608284031215613eb457600080fd5b613ebc613dff565b905081358152602082013560208201526040820135604082015292915050565b60008060006101408486031215613ef257600080fd5b613efc8585613e28565b9250613f0b8560c08601613ea2565b915061012084013590509250925092565b6101008101613f608286805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a08301525050565b60c082019390935260e00152919050565b600060208284031215613f8357600080fd5b5035919050565b80356001600160701b0381168114613fa157600080fd5b919050565b600060608284031215613fb857600080fd5b613fc0613dff565b9050813563ffffffff81168114613fd657600080fd5b8152613fe460208301613f8a565b6020820152613ff560408301613f8a565b604082015292915050565b600082601f83011261401157600080fd5b614019613dff565b8061012084018581111561402c57600080fd5b845b81811015614050576140408782613fa6565b845260209093019260600161402e565b509095945050505050565b6000806000806000610240868803121561407457600080fd5b61407e8787613e28565b945061408d8760c08801614000565b94979496505050506101e08301359261020081013592610220909101359150565b60008060008061026085870312156140c557600080fd5b6140cf8686613e28565b93506140de8660c08701614000565b92506140ee866101e08701613ea2565b939692955092936102400135925050565b6101208101818360005b600381101561415c57614146838351805163ffffffff1682526020808201516001600160701b039081169184019190915260409182015116910152565b6060929092019160209190910190600101614109565b50505092915050565b6000806040838503121561417857600080fd5b50508035926020909101359150565b801515811461419557600080fd5b50565b6000602082840312156141aa57600080fd5b813561310c81614187565b6000806000606084860312156141ca57600080fd5b505081359360208301359350604090920135919050565b600080600080600061022086880312156141fa57600080fd5b6142048787613e28565b94506142138760c08801613e28565b9350614223876101808801613fa6565b949793965093946101e08101359450610200013592915050565b606081016130f58284805163ffffffff1682526020808201516001600160701b039081169184019190915260409182015116910152565b6001600160a01b038116811461419557600080fd5b60006020828403121561429b57600080fd5b813561310c81614274565b60c081016130f58284805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a08301525050565b6000602082840312156142fb57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156130f5576130f5614302565b60006020828403121561433d57600080fd5b815161310c81614274565b634e487b7160e01b600052603260045260246000fd5b60006001820161437057614370614302565b5060010190565b808201808211156130f5576130f5614302565b634e487b7160e01b600052601260045260246000fd5b6000826143af576143af61438a565b500690565b80820281158282048414176130f5576130f5614302565b6000826143da576143da61438a565b500490565b6000602082840312156143f157600080fd5b815161310c8161418756fe77dcabf770d7a83dccad1ada406e9f6803698e89a0366ffd861ea37f8b0c62b60c34fd976d4acba944a797150ed7a2bbb31bae33aaeced825ee7680972b594e4a26469706673582212203d957b3d635c6d09de77aa8b24b02b18248e4cbb86d334c0ab21b1a4dd40ad5164736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000886c98b7600000
-----Decoded View---------------
Arg [0] : spotPriceB (uint256): 38400000000000000
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000886c98b7600000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
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.