S Price: $0.061593 (+0.13%)
Gas: 55 Gwei

Contract

0xf8021C37b20a0C5BaD67b67Cc79Dd98e7eF82f6B

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Transfer Ownersh...449025192025-08-28 17:31:45155 days ago1756402305IN
0xf8021C37...e7eF82f6B
0 S0.002458750.0001
Remove Vault446012252025-08-26 13:00:08157 days ago1756213208IN
0xf8021C37...e7eF82f6B
0 S0.0018363153.87143826
Set Buy Fee444645312025-08-25 13:52:32158 days ago1756129952IN
0xf8021C37...e7eF82f6B
0 S0.0017015550.0001
Set Buy Fee Para...444644332025-08-25 13:51:41158 days ago1756129901IN
0xf8021C37...e7eF82f6B
0 S0.002446150.0001
Set Constant Rem...441266682025-08-22 18:15:50161 days ago1755886550IN
0xf8021C37...e7eF82f6B
0 S0.0015171550.0001
Add Vault439575772025-08-21 13:13:51162 days ago1755782031IN
0xf8021C37...e7eF82f6B
0 S0.004786850
Remove Vault439575692025-08-21 13:13:45162 days ago1755782025IN
0xf8021C37...e7eF82f6B
0 S0.0017043550
Set Printer438113242025-08-20 13:10:15163 days ago1755695415IN
0xf8021C37...e7eF82f6B
0 S0.0015477550
Accept Ownership437903822025-08-20 9:49:10163 days ago1755683350IN
0xf8021C37...e7eF82f6B
0 S0.0014490550.0001
Transfer Ownersh...387848942025-07-16 16:37:47198 days ago1752683867IN
0xf8021C37...e7eF82f6B
0 S0.002458750.0001
Set Printer379108992025-07-10 17:40:20204 days ago1752169220IN
0xf8021C37...e7eF82f6B
0 S0.002423350
Set Decay Values377551762025-07-09 16:15:44205 days ago1752077744IN
0xf8021C37...e7eF82f6B
0 S0.00243450
Set Buy Fee377550752025-07-09 16:14:45205 days ago1752077685IN
0xf8021C37...e7eF82f6B
0 S0.001766450
Set Sell Fee377550602025-07-09 16:14:36205 days ago1752077676IN
0xf8021C37...e7eF82f6B
0 S0.00182450
Add Vault377503572025-07-09 15:27:01205 days ago1752074821IN
0xf8021C37...e7eF82f6B
0 S0.0056008158.50270988

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VaultManager

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 100 runs

Other Settings:
shanghai EvmVersion
File 1 of 35 : VaultManager.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

import "@openzeppelin/contracts_5.0.2/access/Ownable2Step.sol";
import "@openzeppelin/contracts_5.0.2/utils/structs/EnumerableSet.sol";
import "@uniswap/v3-core/contracts/libraries/FullMath.sol";
import "../interfaces/IVaultManager.sol";
import "../interfaces/INumaVault.sol";

import "../Numa.sol";

import "../interfaces/INuAssetManager.sol";
import "../interfaces/INumaPrinter.sol";

import "../utils/constants.sol";
import "../interfaces/IOFTBridgedSupplyManager.sol";



contract VaultManager is IVaultManager, Ownable2Step {
    using EnumerableSet for EnumerableSet.AddressSet;
    EnumerableSet.AddressSet vaultsList;

    INuAssetManager public nuAssetManager;
    INumaPrinter public printer;
    NUMA public immutable numa;

    uint public initialRemovedSupply;
    uint public initialLPRemovedSupply;

    uint public constantRemovedSupply;

    //address public oftAdapter;
    IOFTBridgedSupplyManager public bridgedSupplyManager;

    bool public islockedSupply;
    uint public lockedSupply;

    // uint public decayPeriod;
    // uint public decayPeriodLP;

    // uint public startTime;
    // bool public isDecaying;

    uint constant max_vault = 50;

    // sell fee
    uint public sell_fee = 0.95 ether; // 5%
    uint sell_fee_withPID = 0.95 ether;

    // buy fee
    uint public buy_fee = 0.95 ether; // 5%
    // min numa price in Eth - extra security to prevent division by zero
    uint minNumaPriceEth = 0.0000000000001 ether;

    uint public cf_liquid_severe = 50;// 5%
    uint public sell_fee_debaseValue = 0.01 ether;
    uint public sell_fee_rebaseValue = 0.01 ether;
    uint public sell_fee_minimum = 0.5 ether;
    uint public sell_fee_minimum_critical = 0.2 ether;
    uint public sell_fee_deltaRebase = 24 hours;
    uint public sell_fee_deltaDebase = 24 hours;
    uint public sell_fee_criticalMultiplier = 10000; // base 1000

    uint lastBlockTime_sell_fee;
    //uint public sell_fee_update_blocknumber;

    // synth minting/burning parameters
    uint public cf_critical = 1010;
    uint public cf_severe = 1050;
    uint public cf_warning = 1100;
    //
    uint public debaseValue = 0.02 ether; 
    uint public rebaseValue = 0.02 ether; 
    uint public minimumScale = 0.5 ether;
    uint public criticalDebaseMult = 1100; //base 1000
    uint public deltaRebase = 24 hours;
    uint public deltaDebase = 24 hours;
    uint lastSynthPID = BASE_SCALE;
    uint lastBlockTime;

    


    // the amount by which buyFee_PID increments/decrements at each event
    // uint public buyPID_decAmt = 0.000001 ether; //0.0001%
    // uint public buyPID_incAmt = 0.000001 ether; //0.0001%
    // using eth amounts
    uint public buyPID_decAmt = 0.003 ether; //0.0001%
    uint public buyPID_incAmt = 0.006 ether; //0.0006%

    uint public buyPID_decMultiplier = 10;

    // the maximum percent % differential that TWAP price must be from numa_buyPrice to trigger an increment event
    uint public buyPID_incTriggerPct = 20; // 2%

    //uint buyPID_decTriggerPct = 1.66%
    uint public buyPID_decTriggerPct = 25; //2.5%

    // is the maximum rate at which PID can increment in a xhr period. Default to the buyFee_base.
    uint public buyPID_incMaxRate = 0.0166 ether; //1.66%
    //
    uint public buyFee_max = 0.1 ether; //90%
    uint32 twapPID = 900; // 15min twp

    //
    uint public buy_fee_PID = 0;
    uint public buyPIDXhrAgo = 0;
    uint public nextCheckBlock;
    //uint public nextCheckBlockWindowDelta = 4 hours;
    uint public nextCheckBlockWindowDelta = 20 minutes;

    //
    event SetOFTAdapterAddress(address);
    event SetNuAssetManager(address nuAssetManager);
    event RemovedVault(address);
    event AddedVault(address);
    event SetMinimumNumaPriceEth(uint _minimumPriceEth);
    event SellFeeUpdated(uint sellFee);
    event BuyFeeUpdated(uint buyFee);
    event SetScalingParameters(
        uint cf_critical,
        uint cf_warning,
        uint cf_severe,
        uint debaseValue,
        uint rebaseValue,
        uint deltaDebase,
        uint deltaRebase,
        uint minimumScale,
        uint criticalDebaseMult
    );

    event SetSellFeeParameters(
        uint _cf_liquid_severe,
        uint _sell_fee_debaseValue,
        uint _sell_fee_rebaseValue,
        uint _sell_fee_deltaDebase,
        uint _sell_fee_deltaRebase,
        uint _sell_fee_minimum,
        uint _sell_fee_minimum_critical,
        uint _sell_fee_criticalMultiplier
    );

    constructor(
        address _numaAddress,
        address _nuAssetManagerAddress
    ) Ownable(msg.sender) {
        numa = NUMA(_numaAddress);
        nuAssetManager = INuAssetManager(_nuAssetManagerAddress);

        uint blocktime = block.timestamp;
        lastBlockTime_sell_fee = blocktime;
        lastBlockTime = blocktime;
        //sell_fee_update_blocknumber = blocknumber;
        //synth_scaling_update_blocknumber = blocknumber;
    }

    function getNuAssetManager() external view returns (INuAssetManager) {
        return nuAssetManager;
    }

    // function startDecay() external onlyOwner {
    //     startTime = block.timestamp;
    //     isDecaying = true;
    // }


    function setMinimumNumaPriceEth(uint _minimumPriceEth) external onlyOwner {
        minNumaPriceEth = _minimumPriceEth;
        emit SetMinimumNumaPriceEth(_minimumPriceEth);
    }

    function setOftAdapterAddress(address _oftAdapterAddress) external onlyOwner {
        //oftAdapter = _oftAdapterAddress;
        bridgedSupplyManager = IOFTBridgedSupplyManager(_oftAdapterAddress);
        emit SetOFTAdapterAddress(_oftAdapterAddress);
    }

    function setConstantRemovedSupply(
        uint _constantRemovedSupply
    ) external onlyOwner {
        constantRemovedSupply = _constantRemovedSupply;
    }

    function setScalingParameters(
        uint _cf_critical,
        uint _cf_warning,
        uint _cf_severe,
        uint _debaseValue,
        uint _rebaseValue,
        uint _deltaDebase,
        uint _deltaRebase,
        uint _minimumScale,
        uint _criticalDebaseMult
    ) external onlyOwner {
        getSynthScalingUpdate();
        cf_critical = _cf_critical;
        cf_warning = _cf_warning;
        cf_severe = _cf_severe;
        debaseValue = _debaseValue;
        rebaseValue = _rebaseValue;
        deltaRebase = _deltaRebase;
        deltaDebase = _deltaDebase;
        minimumScale = _minimumScale;
        criticalDebaseMult = _criticalDebaseMult;
        emit SetScalingParameters(
            _cf_critical,
            _cf_warning,
            _cf_severe,
            _debaseValue,
            _rebaseValue,
            _deltaDebase,
            _deltaRebase,
            _minimumScale,
            _criticalDebaseMult
        );
    }

    function setBuyFeeParameters(
        uint _buyPID_incAmt,
        uint _buyPID_incTriggerPct,
        uint _buyPID_decAmt,
        uint _buyPID_decTriggerPct,
        uint _buyPID_decMultiplier,
        uint _buyPID_incMaxRate,
        uint _buyFee_max,
        uint32 _twapPID,
        uint _nextCheckBlockWindowDelta
    ) external onlyOwner {
        buyPID_incAmt = _buyPID_incAmt;
        buyPID_incTriggerPct = _buyPID_incTriggerPct;
        buyPID_decAmt = _buyPID_decAmt;
        buyPID_decTriggerPct = _buyPID_decTriggerPct;
        buyPID_decMultiplier = _buyPID_decMultiplier;
        buyPID_incMaxRate = _buyPID_incMaxRate;
        buyFee_max = _buyFee_max;
        twapPID = _twapPID;
        nextCheckBlockWindowDelta = _nextCheckBlockWindowDelta;
    }

    function setSellFeeParameters(
        uint _cf_liquid_severe,
        uint _sell_fee_debaseValue,
        uint _sell_fee_rebaseValue,
        uint _sell_fee_deltaDebase,
        uint _sell_fee_deltaRebase,
        uint _sell_fee_minimum,
        uint _sell_fee_minimum_critical,
        uint _sell_fee_criticalMultiplier
    ) external onlyOwner {
        getSellFeeScalingUpdate();
        cf_liquid_severe = _cf_liquid_severe;
        sell_fee_debaseValue = _sell_fee_debaseValue;
        sell_fee_rebaseValue = _sell_fee_rebaseValue;
        sell_fee_deltaDebase = _sell_fee_deltaDebase;
        sell_fee_deltaRebase = _sell_fee_deltaRebase;
        sell_fee_minimum = _sell_fee_minimum;
        sell_fee_minimum_critical = _sell_fee_minimum_critical;
        sell_fee_criticalMultiplier = _sell_fee_criticalMultiplier;

        emit SetSellFeeParameters(
            _cf_liquid_severe,
            _sell_fee_debaseValue,
            _sell_fee_rebaseValue,
            _sell_fee_deltaDebase,
            _sell_fee_deltaRebase,
            _sell_fee_minimum,
            _sell_fee_minimum_critical,
            _sell_fee_criticalMultiplier
        );
    }

    /**
     * @dev Set Sell fee percentage (exemple: 5% fee --> fee = 950)
     */
    function setSellFee(uint _fee) external onlyOwner {
        require(_fee <= 1 ether, "fee too high");
        sell_fee = _fee;

        // careful
        // changing sell fee will reset sell_fee scaling
        sell_fee_withPID = sell_fee;
        lastBlockTime_sell_fee = block.timestamp;
        //sell_fee_update_blocknumber = block.number;

        emit SellFeeUpdated(_fee);
    }

    /**
     * @dev Set Buy fee percentage (exemple: 5% fee --> fee = 950)
     */
    function setBuyFee(uint _fee) external onlyOwner {
        require(_fee <= 1 ether, "fee too high");
        // we do not reset PID, it will adapt on his own
        // but we need to ensure buy_fee stays in bounds
        require(_fee > (buyFee_max + buy_fee_PID), "fee too high");

        buy_fee = _fee;
        emit BuyFeeUpdated(_fee);
    }

    function getBuyFee() public view returns (uint) {
        return buy_fee - buy_fee_PID;
    }

    function getSellFeeOriginal() external view returns (uint) {
        return sell_fee;
    }

    function getWarningCF() external view returns (uint) {
        return cf_warning;
    }

    /**
     * @dev updates the buy_fee, only called from specific actions
     */
    function updateBuyFeePID(uint _numaAmount, bool _isVaultBuy) external {
        if (_numaAmount == 0) {
            return;
        }

        uint currentBlockts = block.timestamp;
        if (nextCheckBlock == 0) {
            nextCheckBlock = currentBlockts + nextCheckBlockWindowDelta;
        }
        // when delta time is reached or PID is below last reference we reset reference
        else if (currentBlockts > nextCheckBlock) {
            //reset the increment max rate params
            buyPIDXhrAgo = buy_fee_PID;
            //set new block height +xhrs from now
            nextCheckBlock = currentBlockts + nextCheckBlockWindowDelta;
        }

        if (address(printer) == address(0x0)) {
            buy_fee_PID = 0;
        } else {
            require(
                isVault(msg.sender) || (msg.sender == address(printer)),
                "only vault&printer"
            );
            uint _priceTWAP = printer.getTWAPPriceInEth(1 ether, twapPID);
            uint _vaultBuyPrice = numaToEth(1 ether, PriceType.BuyPrice);

            // we use amount in Eth
            uint ethAmount = (_numaAmount * _vaultBuyPrice) / (1 ether);

            uint pctFromBuyPrice;
            if (_priceTWAP < _vaultBuyPrice) {
                //percentage down from buyPrice  in base 1000
                pctFromBuyPrice = 1000 - (1000 * _priceTWAP) / _vaultBuyPrice;
            }

            if ((pctFromBuyPrice < buyPID_incTriggerPct) && _isVaultBuy) {
                //_price is within incTriggerPct% of buyPrice, and is a vault buy
                uint buyPID_adj = (ethAmount * buyPID_incAmt) / (1 ether);
                buy_fee_PID = buy_fee_PID + buyPID_adj; //increment buyPID

                if (buy_fee_PID > buyPIDXhrAgo) {
                    if (((buy_fee_PID - buyPIDXhrAgo) > buyPID_incMaxRate)) {
                        //does change exceed max rate over Xhrs?
                        buy_fee_PID = buyPIDXhrAgo + buyPID_incMaxRate; //cap to max rate over 4hrs
                    }
                }

                if (buy_fee < (buyFee_max + buy_fee_PID)) {
                    //buyFee above maximum allowable = clip
                    buy_fee_PID = buy_fee - buyFee_max;
                }
            } else if (
                (pctFromBuyPrice > buyPID_decTriggerPct) && (!_isVaultBuy)
            ) {
                //LP15minTWAP is below decTriggerPct% from buyPrice.

                // if pctFromBuyPrice is more than 2 x buyfee, we use our decrease multiplier
                uint basefee = 1 ether - buy_fee;
                uint buyPID_multTriggerPct = (2 * basefee * 1000) / 1 ether;
                uint buyPID_adj = (ethAmount * buyPID_decAmt) / (1 ether);

                if (pctFromBuyPrice > buyPID_multTriggerPct) {
                    // do bigger reduction
                    buyPID_adj = buyPID_adj * buyPID_decMultiplier;
                }
                if (buyPID_adj < buy_fee_PID) {
                    buy_fee_PID -= buyPID_adj;
                } else {
                    buy_fee_PID = 0;
                }
            }

            // if PID is below last reference we reset reference
            if ((buy_fee_PID < buyPIDXhrAgo)) {
                //reset the increment max rate params
                buyPIDXhrAgo = buy_fee_PID;
                nextCheckBlock = currentBlockts + nextCheckBlockWindowDelta; //set new block height +xhrs from now
            }
        }
    }

    /**
     * @dev updates the sell_fee, only called from specific actions
     */
    function getSellFeeScalingUpdate() public returns (uint sell_fee_result) {
        (
            uint result,
            uint blockTime,
            uint sell_fee_debase
        ) = getSellFeeScaling();
        // return
        sell_fee_result = result;

        // save current PID and blocktime
        sell_fee_withPID = sell_fee_debase;
        lastBlockTime_sell_fee = blockTime;
        //sell_fee_update_blocknumber = blockNumber;
    }

    /**
     * @dev returns the updated sell_fee
     */
    function getSellFeeScaling() public view returns (uint, uint, uint) {
        uint blockTime = block.timestamp;
        uint lastSellFee = sell_fee_withPID;
        // if PID/debase has already been updated in that block, no need to compute, we can use what's stored
        if (blockTime != lastBlockTime_sell_fee) {
            // synth scaling
            uint currentLiquidCF = getGlobalLiquidCF();
            if (currentLiquidCF < cf_liquid_severe) {
                // we need to debase
                // debase linearly
                uint ndebase = ((blockTime - lastBlockTime_sell_fee) *
                    sell_fee_debaseValue) / (sell_fee_deltaDebase);

                if (ndebase <= 0) {
                    // not enough time has passed to get some debase, so we reset our time reference
                    blockTime = lastBlockTime_sell_fee;
                } else {
                    if (lastSellFee > ndebase) {
                        lastSellFee = lastSellFee - ndebase;
                        // clip to minimum
                        if (lastSellFee < sell_fee_minimum)
                            lastSellFee = sell_fee_minimum;
                    } else lastSellFee = sell_fee_minimum;
                }
            } else {
                if (sell_fee_withPID < sell_fee) {
                    // we have debased so we need to rebase
                    uint nrebase = ((blockTime - lastBlockTime_sell_fee) *
                        sell_fee_rebaseValue) / (sell_fee_deltaRebase);
                    if (nrebase <= 0) {
                        // not enough time has passed to get some rebase, so we reset our time reference
                        blockTime = lastBlockTime_sell_fee;
                    } else {
                        lastSellFee = lastSellFee + nrebase;
                        if (lastSellFee > sell_fee) lastSellFee = sell_fee;
                    }
                }
            }
        }

        // Sell fee increase also considers synthetics critical scaling.
        // So, if synthetics are debased 4% in critical, then the sell fee should be 9% (5% + 4%)
        // Whichever sell fee is greater should be used at any given time
        // we use criticalScaleForNumaPriceAndSellFee because we want to use this scale in our sell_fee only when cf_critical is reached
        (, , uint criticalScaleForNumaPriceAndSellFee, ) = getSynthScaling();

        uint sell_fee_increaseCriticalCF = ((BASE_SCALE -
            criticalScaleForNumaPriceAndSellFee) * 1 ether) / BASE_SCALE;
        // add a multiplier on top
        sell_fee_increaseCriticalCF =
            (sell_fee_increaseCriticalCF * sell_fee_criticalMultiplier) /
            BASE_1000;

        // here we use original fee value increase by this factor
        uint sell_fee_criticalCF;

        if (sell_fee > sell_fee_increaseCriticalCF)
            sell_fee_criticalCF = sell_fee - sell_fee_increaseCriticalCF;

        // clip it by min value
        if (sell_fee_criticalCF < sell_fee_minimum_critical)
            sell_fee_criticalCF = sell_fee_minimum_critical;

        uint sell_fee_result = lastSellFee;
        // Whichever sell fee is greater should be used at any given time
        if (sell_fee_criticalCF < sell_fee_result)
            sell_fee_result = sell_fee_criticalCF;

        return (sell_fee_result, blockTime, lastSellFee);
    }

   /**
     * @dev updates synth scaling only called from specific actions
     */
    function getSynthScalingUpdate()
        public
        returns (uint scaleSynthBurn, uint criticalScaleForNumaPriceAndSellFee)
    {
        uint scalePID;
        uint blockTime;
        (
            scaleSynthBurn,
            scalePID,
            criticalScaleForNumaPriceAndSellFee,
            blockTime
        ) = getSynthScaling();
        // save
        lastSynthPID = scalePID;
        lastBlockTime = blockTime;
    }


    function getSynthScaling()
        public
        view
        virtual
        returns (
            uint,
            uint,
            uint,
            uint // virtual for test&overrides
        )
    {
        uint blockTime = block.timestamp;
        uint syntheticsCurrentPID = lastSynthPID;
        uint currentCF = getGlobalCF();
        // if it has already been updated in that block, no need to compute, we can use what's stored
        if (blockTime != lastBlockTime) {
            // synth scaling
            if (currentCF < cf_severe) {
                // we need to debase

                // debase linearly
                uint ndebase = ((blockTime - lastBlockTime) * debaseValue) /
                    (deltaDebase);
                if (ndebase <= 0) {
                    // not enough time has passed to get some debase, so we reset our time reference
                    blockTime = lastBlockTime;
                } else {
                    if (syntheticsCurrentPID > ndebase) {
                        syntheticsCurrentPID = syntheticsCurrentPID - ndebase;
                        if (syntheticsCurrentPID < minimumScale)
                            syntheticsCurrentPID = minimumScale;
                    } else syntheticsCurrentPID = minimumScale;
                }
            } else {
                if (syntheticsCurrentPID < BASE_SCALE) {
                    // rebase linearly
                    uint nrebase = ((blockTime - lastBlockTime) * rebaseValue) /
                        (deltaRebase);

                    if (nrebase <= 0) {
                        // not enough time has passed to get some rebase, so we reset our time reference
                        blockTime = lastBlockTime;
                    } else {
                        syntheticsCurrentPID = syntheticsCurrentPID + nrebase;

                        if (syntheticsCurrentPID > BASE_SCALE)
                            syntheticsCurrentPID = BASE_SCALE;
                    }
                }
            }
        }
        // apply scale to synth burn price
        uint scaleSynthBurn = syntheticsCurrentPID; // PID
        uint criticalScaleForNumaPriceAndSellFee = BASE_SCALE;
        // CRITICAL_CF
        if (currentCF < cf_critical) {
            // scale such that currentCF = cf_critical
            uint criticalDebaseFactor = (currentCF * BASE_SCALE) / cf_critical;

            // when reaching CF_CRITICAL, we use that criticalDebaseFactor in numa price so that numa price is clipped by this lower limit
            criticalScaleForNumaPriceAndSellFee = criticalDebaseFactor;

            // we apply this multiplier on the factor for when it's used on synthetics burning price
            criticalDebaseFactor =
                (criticalDebaseFactor * 1000) /
                criticalDebaseMult;

            // for burning price we take the min between PID and criticalDebaseFactor

            if (criticalDebaseFactor < scaleSynthBurn)
                scaleSynthBurn = criticalDebaseFactor;
        }
        return (
            scaleSynthBurn,
            syntheticsCurrentPID,
            criticalScaleForNumaPriceAndSellFee,
            blockTime
        );
    }

    /**
     * @dev updates sell fee and synth scaling only called from specific actions
     */
    function updateDebasings()
        public
        returns (
            uint scale,
            uint criticalScaleForNumaPriceAndSellFee,
            uint sell_fee_result
        )
    {
        (scale, criticalScaleForNumaPriceAndSellFee) = getSynthScalingUpdate();
        (sell_fee_result) = getSellFeeScalingUpdate();
    }

    /**
     * @notice lock numa supply in case of a flashloan so that numa price does not change
     */
    function lockSupplyFlashloan(bool _lock) external {
        require(isVault(msg.sender), "only vault");
        if (_lock) {
            lockedSupply = getNumaSupply();
        }
        islockedSupply = _lock;
    }

    // function setDecayValues(
    //     uint _initialRemovedSupply,
    //     uint _decayPeriod,
    //     uint _initialRemovedSupplyLP,
    //     uint _decayPeriodLP,
    //     uint _constantRemovedSupply
    // ) external onlyOwner {
    //     initialRemovedSupply = _initialRemovedSupply;
    //     initialLPRemovedSupply = _initialRemovedSupplyLP;
    //     constantRemovedSupply = _constantRemovedSupply;
    //     decayPeriod = _decayPeriod;
    //     decayPeriodLP = _decayPeriodLP;
    //     // start decay will have to be called again
    //     // CAREFUL: IF DECAYING, ALL VAULTS HAVE TO BE PAUSED WHEN CHANGING THESE VALUES, UNTIL startDecay IS CALLED
    //     isDecaying = false;
    // }



    function setDecayValues(
        uint _constantRemovedSupply
    ) external onlyOwner {
        constantRemovedSupply = _constantRemovedSupply;
    }

    function isVault(address _addy) public view returns (bool) {
        return (vaultsList.contains(_addy));
    }

    /**
     * @dev set the INumaPrinter address (for TWAP prices)
     */
    function setPrinter(address _printerAddress) external onlyOwner {
        require(_printerAddress != address(0x0), "zero address");
        printer = INumaPrinter(_printerAddress);
    }

    /**
     * @dev set the INuAssetManager address (used to compute synth value in Eth)
     */
    function setNuAssetManager(address _nuAssetManager) external onlyOwner {
        require(_nuAssetManager != address(0x0), "zero address");
        nuAssetManager = INuAssetManager(_nuAssetManager);
        emit SetNuAssetManager(_nuAssetManager);
    }

    /**
     * @dev How many Numas from lst token amount using vault manager pricing
     */
    function tokenToNuma(
        uint _inputAmount,
        uint _refValueWei,
        uint _decimals,
        uint _synthScaling
    ) public view returns (uint256) {
        uint EthBalance = getTotalBalanceEth();
        require(EthBalance > 0, "empty vaults");
        uint256 EthValue = FullMath.mulDiv(
            _refValueWei,
            _inputAmount,
            _decimals
        );

        uint synthValueInEth = getTotalSynthValueEth();
        synthValueInEth = (synthValueInEth * _synthScaling) / BASE_SCALE;
        uint circulatingNuma = getNumaSupply();

        uint result;
        if (EthBalance <= synthValueInEth) {
            // extreme case use minim numa price in Eth
            result = FullMath.mulDiv(
                EthValue,
                1 ether, // 1 ether because numa has 18 decimals
                minNumaPriceEth
            );
        } else {
            uint numaPrice = FullMath.mulDiv(
                1 ether,
                EthBalance - synthValueInEth,
                circulatingNuma
            );

            if (numaPrice < minNumaPriceEth) {
                // extreme case use minim numa price in Eth
                result = FullMath.mulDiv(
                    EthValue,
                    1 ether, // 1 ether because numa has 18 decimals
                    minNumaPriceEth
                );
            } else {
                result = FullMath.mulDiv(
                    EthValue,
                    circulatingNuma,
                    (EthBalance - synthValueInEth)
                );
            }
        }
        return result;
    }

    /**
     * @dev How many lst tokens from numa amount using vault manager pricing
     */
    function numaToToken(
        uint _inputAmount,
        uint _refValueWei,
        uint _decimals,
        uint _synthScaling
    ) public view returns (uint256) {
        uint EthBalance = getTotalBalanceEth();
        require(EthBalance > 0, "empty vaults");

        uint synthValueInEth = getTotalSynthValueEth();

        synthValueInEth = (synthValueInEth * _synthScaling) / BASE_SCALE;

        uint circulatingNuma = getNumaSupply();

        require(circulatingNuma > 0, "no numa in circulation");


        uint result;
        if (EthBalance <= synthValueInEth) {
            result = FullMath.mulDiv(
                FullMath.mulDiv(
                    _inputAmount,
                    minNumaPriceEth,
                    1 ether // 1 ether because numa has 18 decimals
                ),
                _decimals,
                _refValueWei
            );
        } else {
            uint numaPrice = FullMath.mulDiv(
                1 ether,
                EthBalance - synthValueInEth,
                circulatingNuma
            );

            if (numaPrice < minNumaPriceEth) {
                result = FullMath.mulDiv(
                    FullMath.mulDiv(
                        _inputAmount,
                        minNumaPriceEth,
                        1 ether // 1 ether because numa has 18 decimals
                    ),
                    _decimals,
                    _refValueWei
                );
            } else {
                // using snaphot price
                result = FullMath.mulDiv(
                    FullMath.mulDiv(
                        _inputAmount,
                        EthBalance - synthValueInEth,
                        circulatingNuma
                    ),
                    _decimals,
                    _refValueWei
                );
            }
        }
        return result;
    }

    /**
     * @dev numa to eth using vaultmanager pricing
     */

    function numaToEth(
        uint _inputAmount,
        PriceType _t
    ) public view returns (uint256) {
        (, , uint criticalScaleForNumaPriceAndSellFee, ) = getSynthScaling();
        uint result = numaToToken(
            _inputAmount,
            1 ether,
            1 ether,
            criticalScaleForNumaPriceAndSellFee
        );
        if (_t == PriceType.BuyPrice) {
            result = (result * 1 ether) / getBuyFee();
        } else if (_t == PriceType.SellPrice) {
            (uint sellfee, , ) = getSellFeeScaling();
            result = (result * sellfee) / 1 ether;
        }
        return result;
    }

    /**
     * @dev eth to numa using vaultmanager pricing
     */
    function ethToNuma(
        uint _inputAmount,
        PriceType _t
    ) external view returns (uint256) {
        (, , uint criticalScaleForNumaPriceAndSellFee, ) = getSynthScaling();
        uint result = tokenToNuma(
            _inputAmount,
            1 ether,
            1 ether,
            criticalScaleForNumaPriceAndSellFee
        );
        if (_t == PriceType.BuyPrice) {
            result = (result * getBuyFee()) / 1 ether;
        } else if (_t == PriceType.SellPrice) {
            (uint sellfee, , ) = getSellFeeScaling();
            result = (result * 1 ether) / sellfee;
        }
        return result;
    }

    /**
     * @dev Total synth value in Eth
     */
    function getTotalSynthValueEth() public view returns (uint256) {
        require(
            address(nuAssetManager) != address(0),
            "nuAssetManager not set"
        );
        return nuAssetManager.getTotalSynthValueEth();
    }

    /**
     * @dev total numa supply without wallet's list balances
     * @notice for another vault, either we use this function from this vault, either we need to set list in the other vault too
     */
    function getNumaSupply() public view returns (uint) {
        if (islockedSupply) return lockedSupply;

        uint circulatingNuma = numa.totalSupply();
        // uint currentRemovedSupply = initialRemovedSupply;
        // uint currentLPRemovedSupply = initialLPRemovedSupply;

        // uint currentTime = block.timestamp;
        // if (isDecaying && (currentTime > startTime)) {
        //     if (decayPeriod > 0) {
        //         if (currentTime >= startTime + decayPeriod) {
        //             currentRemovedSupply = 0;
        //         } else {
        //             uint delta = ((currentTime - startTime) *
        //                 initialRemovedSupply) / decayPeriod;
        //             currentRemovedSupply -= (delta);
        //         }
        //     }
        //     if (decayPeriodLP > 0) {
        //         if (currentTime >= startTime + decayPeriodLP) {
        //             currentLPRemovedSupply = 0;
        //         } else {
        //             uint delta = ((currentTime - startTime) *
        //                 initialLPRemovedSupply) / decayPeriodLP;
        //             currentLPRemovedSupply -= (delta);
        //         }
        //     }
        // }
        uint numaLockedOFT = 0;
        if (address(bridgedSupplyManager) != address(0)) {
            //numaLockedOFT = numa.balanceOf(oftAdapter);
            numaLockedOFT = bridgedSupplyManager.getBridgedSupply();
        }


        circulatingNuma =
            circulatingNuma -
            //currentRemovedSupply -
            //currentLPRemovedSupply -
            constantRemovedSupply - 
            numaLockedOFT;// numa locked in adapter is removed as it's considered bridged
        
        // adding 1 to avoid division by 0, in case no numa have been minted yet
        if (circulatingNuma == 0) 
            circulatingNuma = 1;
        return circulatingNuma;
    }

    /**
     * @dev returns vaults list
     */
    function getVaults() external view returns (address[] memory) {
        return vaultsList.values();
    }

    /**
     * @dev adds a vault to the list
     */
    function addVault(address _vault) external onlyOwner {
        require(vaultsList.length() < max_vault, "too many vaults");
        require(vaultsList.add(_vault), "already in list");
        emit AddedVault(_vault);
    }

    /**
     * @dev removes a vault from the list
     */
    function removeVault(address _vault) external onlyOwner {
        require(vaultsList.contains(_vault), "not in list");
        vaultsList.remove(_vault);
        emit RemovedVault(_vault);
    }

    /**
     * @dev sum of all vaults balances in Eth including debts
     */
    function getTotalBalanceEth() public view returns (uint256) {
        uint result;
        uint256 nbVaults = vaultsList.length();
        require(nbVaults <= max_vault, "too many vaults in list");

        for (uint256 i = 0; i < nbVaults; i++) {
            result += INumaVault(vaultsList.at(i)).getEthBalance();
        }
        return result;
    }

    /**
     * @dev sum of all vaults balances in Eth excluding debts
     */
    function getTotalBalanceEthNoDebt() public view returns (uint256) {
        uint result;
        uint256 nbVaults = vaultsList.length();
        require(nbVaults <= max_vault, "too many vaults in list");

        for (uint256 i = 0; i < nbVaults; i++) {
            result += INumaVault(vaultsList.at(i)).getEthBalanceNoDebt();
        }
        return result;
    }

    /**
     * @dev update all vaults
     */
    function updateVaults() external {
        uint256 nbVaults = vaultsList.length();
        require(nbVaults <= max_vault, "too many vaults in list");

        for (uint256 i = 0; i < nbVaults; i++) {
            INumaVault(vaultsList.at(i)).updateVault();
        }
    }

    /**
     * @dev global CF considering all vaults
     */
    function getGlobalCF() public view returns (uint) {
        uint EthBalance = getTotalBalanceEth();
        uint synthValue = nuAssetManager.getTotalSynthValueEth();

        if (synthValue > 0) {
            return (EthBalance * BASE_1000) / synthValue;
        } else {
            return MAX_CF;
        }
    }

    /**
     * @dev liquid CF (liquid meaning excluding debt) considering all vaults
     */
    function getGlobalLiquidCF() public view returns (uint) {
        uint EthBalance = getTotalBalanceEthNoDebt();
        uint synthValue = nuAssetManager.getTotalSynthValueEth();

        if (synthValue > 0) {
            return (EthBalance * BASE_1000) / synthValue;
        } else {
            return MAX_CF;
        }
    }

    function numaBorrowAllowed() external view returns (bool allowed)
    {
        allowed = true;
       
        // is numa borrow allowed
        uint currentCF = getGlobalCF();
 
        if (currentCF < cf_severe)
        {
             allowed = false;
        }      
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {Ownable} from "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        return _pendingOwner;
    }

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position is the index of the value in the `values` array plus 1.
        // Position 0 is used to mean a value is not in the set.
        mapping(bytes32 value => uint256) _positions;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._positions[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We cache the value's position to prevent multiple reads from the same storage slot
        uint256 position = set._positions[value];

        if (position != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 valueIndex = position - 1;
            uint256 lastIndex = set._values.length - 1;

            if (valueIndex != lastIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._positions[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
    /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
    function mulDiv(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = a * b
            // Compute the product mod 2**256 and mod 2**256 - 1
            // then use the Chinese Remainder Theorem to reconstruct
            // the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2**256 + prod0
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(a, b, not(0))
                prod0 := mul(a, b)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division
            if (prod1 == 0) {
                require(denominator > 0);
                assembly {
                    result := div(prod0, denominator)
                }
                return result;
            }

            // Make sure the result is less than 2**256.
            // Also prevents denominator == 0
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0]
            // Compute remainder using mulmod
            uint256 remainder;
            assembly {
                remainder := mulmod(a, b, denominator)
            }
            // Subtract 256 bit number from 512 bit number
            assembly {
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator
            // Compute largest power of two divisor of denominator.
            // Always >= 1.
            uint256 twos = (0 - denominator) & denominator;
            // Divide denominator by power of two
            assembly {
                denominator := div(denominator, twos)
            }

            // Divide [prod1 prod0] by the factors of two
            assembly {
                prod0 := div(prod0, twos)
            }
            // Shift in bits from prod1 into prod0. For this we need
            // to flip `twos` such that it is 2**256 / twos.
            // If twos is zero, then it becomes one
            assembly {
                twos := add(div(sub(0, twos), twos), 1)
            }
            prod0 |= prod1 * twos;

            // Invert denominator mod 2**256
            // Now that denominator is an odd number, it has an inverse
            // modulo 2**256 such that denominator * inv = 1 mod 2**256.
            // Compute the inverse by starting with a seed that is correct
            // correct for four bits. That is, denominator * inv = 1 mod 2**4
            uint256 inv = (3 * denominator) ^ 2;
            // Now use Newton-Raphson iteration to improve the precision.
            // Thanks to Hensel's lifting lemma, this also works in modular
            // arithmetic, doubling the correct bits in each step.
            inv *= 2 - denominator * inv; // inverse mod 2**8
            inv *= 2 - denominator * inv; // inverse mod 2**16
            inv *= 2 - denominator * inv; // inverse mod 2**32
            inv *= 2 - denominator * inv; // inverse mod 2**64
            inv *= 2 - denominator * inv; // inverse mod 2**128
            inv *= 2 - denominator * inv; // inverse mod 2**256

            // Because the division is now exact we can divide by multiplying
            // with the modular inverse of denominator. This will give us the
            // correct result modulo 2**256. Since the precoditions guarantee
            // that the outcome is less than 2**256, this is the final result.
            // We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inv;
            return result;
        }
    }

    /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    function mulDivRoundingUp(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            result = mulDiv(a, b, denominator);
            if (mulmod(a, b, denominator) > 0) {
                require(result < type(uint256).max);
                result++;
            }
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface IVaultManager {
    // Enum representing shipping status
    enum PriceType {
        NoFeePrice,
        BuyPrice,
        SellPrice
    }

    function getBuyFee() external view returns (uint);
    function getSellFeeOriginal() external view returns (uint);
    function getSellFeeScaling() external view returns (uint, uint, uint);
    function getSellFeeScalingUpdate() external returns (uint);
    function getTotalBalanceEth() external view returns (uint256);
    function getTotalBalanceEthNoDebt() external view returns (uint256);

    function numaToEth(
        uint _amount,
        PriceType _t
    ) external view returns (uint256);

    function ethToNuma(
        uint _amount,
        PriceType _t
    ) external view returns (uint256);

    function tokenToNuma(
        uint _inputAmount,
        uint _refValueWei,
        uint _decimals,
        uint _currentDebase
    ) external view returns (uint256);

    function numaToToken(
        uint _inputAmount,
        uint _refValueWei,
        uint _decimals,
        uint _currentDebase
    ) external view returns (uint256);

    function getTotalSynthValueEth() external view returns (uint256);
    function isVault(address _addy) external view returns (bool);
    function lockSupplyFlashloan(bool _lock) external;
    function getGlobalCF() external view returns (uint);
    function updateVaults() external;
    function updateBuyFeePID(uint _numaAmount, bool _isVaultBuy) external;
    function updateDebasings() external returns (uint, uint, uint);

    function getSynthScaling() external view returns (uint, uint, uint, uint);
    function getWarningCF() external view returns (uint);
    function numaBorrowAllowed() external view returns (bool allowed);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface INumaVault {
    function buy(uint, uint, address) external returns (uint);
    function sell(uint, uint, address) external returns (uint);
    function getDebt() external view returns (uint);
    function repay(uint amount) external;
    function borrow(uint amount) external;
    function getEthBalance() external view returns (uint256);
    function getEthBalanceNoDebt() external view returns (uint256);
    function getMaxBorrow(bool _useCapParameter) external view returns (uint256);
    function numaToLst(uint256 _amount) external view returns (uint256);
    function lstToNuma(uint256 _amount) external view returns (uint256);
    function repayLeverage(bool _closePosition) external;
    function borrowLeverage(uint _amount, bool _closePosition) external;

    function updateVault() external;
    function getcNumaAddress() external view returns (address);
    function getcLstAddress() external view returns (address);

    function getMinBorrowAmountAllowPartialLiquidation(address) external view returns (uint);
    function borrowAllowed(address _ctokenAddress) external returns (bool);

}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "./NumaStore.sol";

contract NUMA is
    NumaStore,
    Initializable,
    ERC20Upgradeable,
    ERC20BurnableUpgradeable,
    PausableUpgradeable,
    AccessControlUpgradeable,
    UUPSUpgradeable
{
    bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initialize() public initializer {
        __ERC20_init("NUMA", "NUMA");
        __ERC20Burnable_init();
        __Pausable_init();
        __AccessControl_init();
        __UUPSUpgradeable_init();

        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(PAUSER_ROLE, msg.sender);
        _grantRole(MINTER_ROLE, msg.sender);
        _grantRole(UPGRADER_ROLE, msg.sender);
    }

    function SetFee(uint _newFeeBips) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_newFeeBips <= 10000, "Fee percentage must be 100 or less");
        NumaStorage storage ns = numaStorage();
        ns.sellFeeBips = _newFeeBips;
    }

    function SetFeeTriggerer(
        address _dexAddress,
        bool _isFee
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        NumaStorage storage ns = numaStorage();
        ns.isIncludedInFees[_dexAddress] = _isFee;
    }
    function SetWlSpender(
        address _address,
        bool _isWl
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        NumaStorage storage ns = numaStorage();
        ns.wlSpenders[_address] = _isWl;
    }

    function pause() public onlyRole(PAUSER_ROLE) {
        _pause();
    }

    function unpause() public onlyRole(PAUSER_ROLE) {
        _unpause();
    }

    function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
        _mint(to, amount);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal override whenNotPaused {
        super._beforeTokenTransfer(from, to, amount);
    }

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        NumaStorage storage ns = numaStorage();
        uint fee = ns.sellFeeBips;
        // spend allowance
        _spendAllowance(from, spender, value);
        // cancel fee for some spenders. Typically, this will be used for UniswapV2Router which is used when adding liquidity
        if ((!ns.wlSpenders[spender]) && (fee > 0) && ns.isIncludedInFees[to]) {
            _transferWithFee(from, to, value, fee);
        } else {
            super._transfer(from, to, value);
        }

        return true;
    }
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override {
        // uniswap sell fee
        NumaStorage storage ns = numaStorage();
        uint fee = ns.sellFeeBips;
        // apply (burn) fee on some receivers. Typically, the UniswapV2Pair, to apply fee when selling on Uniswap.
        if ((fee > 0) && ns.isIncludedInFees[to]) {
            _transferWithFee(from, to, amount, fee);
        } else {
            super._transfer(from, to, amount);
        }
    }
    function _transferWithFee(
        address from,
        address to,
        uint256 amount,
        uint256 fee
    ) internal virtual {
        uint256 amountToBurn = (amount * fee) / 10000;
        amount -= amountToBurn;
        _burn(from, amountToBurn);
        super._transfer(from, to, amount);
    }

    function _authorizeUpgrade(
        address newImplementation
    ) internal override onlyRole(UPGRADER_ROLE) {}
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface INuAssetManager {
    function getTotalSynthValueEth() external view returns (uint256);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface INumaPrinter {
    function getTWAPPriceInEth(
        uint _numaAmount,
        uint32 _interval
    ) external view returns (uint256);
}

File 10 of 35 : constants.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;


uint constant BASE_SCALE = 1 ether;
uint constant BASE_1000 = 1000;
uint constant MAX_CF = 100000;

File 11 of 35 : IOFTBridgedSupplyManager.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface IOFTBridgedSupplyManager {
    function getBridgedSupply() external view returns (uint);

}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[45] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.0;

import "../ERC20Upgradeable.sol";
import "../../../utils/ContextUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable {
    function __ERC20Burnable_init() internal onlyInitializing {
    }

    function __ERC20Burnable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        _spendAllowance(account, _msgSender(), amount);
        _burn(account, amount);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(account),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
        _;
    }

    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
        return _IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeTo(address newImplementation) public virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 19 of 35 : NumaStore.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

contract NumaStore {
    struct NumaStorage {
        uint sellFeeBips;
        mapping(address => bool) isIncludedInFees;
        mapping(address => bool) wlSpenders;
    }

    bytes32 private constant STORAGE_SLOT = keccak256("numa.erc20.storage");

    // Creates and returns the storage pointer to the struct.
    function numaStorage() internal pure returns (NumaStorage storage ns) {
        bytes32 position = STORAGE_SLOT;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            ns.slot := position
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = MathUpgradeable.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, MathUpgradeable.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 28 of 35 : draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822ProxiableUpgradeable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/IERC1967Upgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {
    function __ERC1967Upgrade_init() internal onlyInitializing {
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            AddressUpgradeable.functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUpgradeable {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMathUpgradeable {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 33 of 35 : IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 34 of 35 : IERC1967Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 *
 * _Available since v4.8.3._
 */
interface IERC1967Upgradeable {
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

Settings
{
  "remappings": [
    "@chainlink/=node_modules/@chainlink/",
    "@eth-optimism/=node_modules/@chainlink/contracts/node_modules/@eth-optimism/",
    "@layerzerolabs/=node_modules/@layerzerolabs/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@uniswap/=node_modules/@uniswap/",
    "base64-sol/=node_modules/base64-sol/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std/=lib/forge-std/src/",
    "hardhat/=node_modules/hardhat/",
    "uniV3periphery/=node_modules/uniV3periphery/",
    "uniswap-v3-periphery-0.8/=node_modules/uniswap-v3-periphery-0.8/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 100
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "shanghai",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_numaAddress","type":"address"},{"internalType":"address","name":"_nuAssetManagerAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"AddedVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"buyFee","type":"uint256"}],"name":"BuyFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"RemovedVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"sellFee","type":"uint256"}],"name":"SellFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_minimumPriceEth","type":"uint256"}],"name":"SetMinimumNumaPriceEth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nuAssetManager","type":"address"}],"name":"SetNuAssetManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"SetOFTAdapterAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cf_critical","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cf_warning","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cf_severe","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"debaseValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rebaseValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"deltaDebase","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"deltaRebase","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minimumScale","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"criticalDebaseMult","type":"uint256"}],"name":"SetScalingParameters","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_cf_liquid_severe","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_sell_fee_debaseValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_sell_fee_rebaseValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_sell_fee_deltaDebase","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_sell_fee_deltaRebase","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_sell_fee_minimum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_sell_fee_minimum_critical","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_sell_fee_criticalMultiplier","type":"uint256"}],"name":"SetSellFeeParameters","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"addVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bridgedSupplyManager","outputs":[{"internalType":"contract IOFTBridgedSupplyManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyFee_max","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyPIDXhrAgo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyPID_decAmt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyPID_decMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyPID_decTriggerPct","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyPID_incAmt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyPID_incMaxRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyPID_incTriggerPct","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buy_fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buy_fee_PID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cf_critical","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cf_liquid_severe","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cf_severe","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cf_warning","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"constantRemovedSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"criticalDebaseMult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"debaseValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deltaDebase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deltaRebase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_inputAmount","type":"uint256"},{"internalType":"enum IVaultManager.PriceType","name":"_t","type":"uint8"}],"name":"ethToNuma","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBuyFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGlobalCF","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGlobalLiquidCF","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNuAssetManager","outputs":[{"internalType":"contract INuAssetManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumaSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSellFeeOriginal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSellFeeScaling","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSellFeeScalingUpdate","outputs":[{"internalType":"uint256","name":"sell_fee_result","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getSynthScaling","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSynthScalingUpdate","outputs":[{"internalType":"uint256","name":"scaleSynthBurn","type":"uint256"},{"internalType":"uint256","name":"criticalScaleForNumaPriceAndSellFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getTotalBalanceEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalBalanceEthNoDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalSynthValueEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaults","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWarningCF","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialLPRemovedSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialRemovedSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addy","type":"address"}],"name":"isVault","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"islockedSupply","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_lock","type":"bool"}],"name":"lockSupplyFlashloan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockedSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumScale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextCheckBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextCheckBlockWindowDelta","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nuAssetManager","outputs":[{"internalType":"contract INuAssetManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numa","outputs":[{"internalType":"contract NUMA","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numaBorrowAllowed","outputs":[{"internalType":"bool","name":"allowed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_inputAmount","type":"uint256"},{"internalType":"enum IVaultManager.PriceType","name":"_t","type":"uint8"}],"name":"numaToEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_inputAmount","type":"uint256"},{"internalType":"uint256","name":"_refValueWei","type":"uint256"},{"internalType":"uint256","name":"_decimals","type":"uint256"},{"internalType":"uint256","name":"_synthScaling","type":"uint256"}],"name":"numaToToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"printer","outputs":[{"internalType":"contract INumaPrinter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebaseValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"removeVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sell_fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sell_fee_criticalMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sell_fee_debaseValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sell_fee_deltaDebase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sell_fee_deltaRebase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sell_fee_minimum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sell_fee_minimum_critical","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sell_fee_rebaseValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setBuyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_buyPID_incAmt","type":"uint256"},{"internalType":"uint256","name":"_buyPID_incTriggerPct","type":"uint256"},{"internalType":"uint256","name":"_buyPID_decAmt","type":"uint256"},{"internalType":"uint256","name":"_buyPID_decTriggerPct","type":"uint256"},{"internalType":"uint256","name":"_buyPID_decMultiplier","type":"uint256"},{"internalType":"uint256","name":"_buyPID_incMaxRate","type":"uint256"},{"internalType":"uint256","name":"_buyFee_max","type":"uint256"},{"internalType":"uint32","name":"_twapPID","type":"uint32"},{"internalType":"uint256","name":"_nextCheckBlockWindowDelta","type":"uint256"}],"name":"setBuyFeeParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_constantRemovedSupply","type":"uint256"}],"name":"setConstantRemovedSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_constantRemovedSupply","type":"uint256"}],"name":"setDecayValues","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minimumPriceEth","type":"uint256"}],"name":"setMinimumNumaPriceEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nuAssetManager","type":"address"}],"name":"setNuAssetManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oftAdapterAddress","type":"address"}],"name":"setOftAdapterAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_printerAddress","type":"address"}],"name":"setPrinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cf_critical","type":"uint256"},{"internalType":"uint256","name":"_cf_warning","type":"uint256"},{"internalType":"uint256","name":"_cf_severe","type":"uint256"},{"internalType":"uint256","name":"_debaseValue","type":"uint256"},{"internalType":"uint256","name":"_rebaseValue","type":"uint256"},{"internalType":"uint256","name":"_deltaDebase","type":"uint256"},{"internalType":"uint256","name":"_deltaRebase","type":"uint256"},{"internalType":"uint256","name":"_minimumScale","type":"uint256"},{"internalType":"uint256","name":"_criticalDebaseMult","type":"uint256"}],"name":"setScalingParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setSellFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cf_liquid_severe","type":"uint256"},{"internalType":"uint256","name":"_sell_fee_debaseValue","type":"uint256"},{"internalType":"uint256","name":"_sell_fee_rebaseValue","type":"uint256"},{"internalType":"uint256","name":"_sell_fee_deltaDebase","type":"uint256"},{"internalType":"uint256","name":"_sell_fee_deltaRebase","type":"uint256"},{"internalType":"uint256","name":"_sell_fee_minimum","type":"uint256"},{"internalType":"uint256","name":"_sell_fee_minimum_critical","type":"uint256"},{"internalType":"uint256","name":"_sell_fee_criticalMultiplier","type":"uint256"}],"name":"setSellFeeParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_inputAmount","type":"uint256"},{"internalType":"uint256","name":"_refValueWei","type":"uint256"},{"internalType":"uint256","name":"_decimals","type":"uint256"},{"internalType":"uint256","name":"_synthScaling","type":"uint256"}],"name":"tokenToNuma","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_numaAmount","type":"uint256"},{"internalType":"bool","name":"_isVaultBuy","type":"bool"}],"name":"updateBuyFeePID","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateDebasings","outputs":[{"internalType":"uint256","name":"scale","type":"uint256"},{"internalType":"uint256","name":"criticalScaleForNumaPriceAndSellFee","type":"uint256"},{"internalType":"uint256","name":"sell_fee_result","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateVaults","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a034620001ef57601f62002da738819003918201601f19168301916001600160401b03831184841017620001f3578084926040948552833981010312620001ef576200005a6020620000528362000207565b920162000207565b3315620001d75760018060a01b03199081600154166001555f908154338482161783556040519460018060a01b03938492833391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a3670d2f13f7789f000080600b5580600c55600d55620186a0600e556032600f55662386f26fc10000806010556011556706f05b59d3b20000806012556702c68af0bb140000601355620151809081601455816015556127106016556103f260185561041a60195561044c9081601a5566470de4df82000080601b55601c55601d55601e5580601f55602055670de0b6b3a7640000602155660aa87bee538000602355661550f7dca70000602455600a60255560146026556019602755663af99caf45800060285567016345785d8a000060295561038463ffffffff19602a541617602a5580602b55602c556104b0602e5516608052169060045416176004554260175542602255612b8a90816200021d8239608051818181610e3b015261238b0152f35b604051631e4fbdf760e01b81525f6004820152602490fd5b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b0382168203620001ef5756fe60406080815260049081361015610014575f80fd5b5f91823560e01c9081629ca3eb146119ac5781630ba31236146119775781630cc835a3146118fc5781630f38d798146118dd578163162b51fc146118be57816317a5af7a146118a1578163188c3c4e146118825781631a6719a5146118655781631b47a159146117f75781631b6e557b146117d85781631bafd940146116735781631d25645b1461070e5781631d3a0c981461164a578163240700351461162b5781632457092a1461160c578163256b5a021461152c578163289537cd1461150d5781632910a5aa146114555781632e10633c146114365781632fce668714611417578163314cd793146113f857816333748e4b146113d95781633822f65c146113b25781633c5c2f551461136457816340cb767e1461129e5781634290768a14610adb5781634470d3201461127357816344d00f82146111b757816345718e811461101d578163488f79ee146110005781634ee2b90b14610f1457816354aa10f514610ed95781635923885f14610e895781635959640814610e6a5781635992c23e14610e26578163652b9b4114610dde57816367bdf64014610dc1578163682fd92414610da25781636ea2843914610d835781636fb99a9314610d64578163715018a614610cff57816371f26cce14610ce157816378469b1314610cc257816379ba509714610c3f5781637c5b12de14610c205781637f81c5e014610bee57816384e5092514610bcf578163865ecff114610bb05781638b4cee0814610b465781638da5cb5b14610b1e5781638f818b9014610afa578163960fd08814610adb5781639616c22114610abc5781639e47ae6714610a9d578163a29272ce14610485578163a49e178314610a7e578163a74109ae14610a5f578163abc9276214610a42578163abd545bf14610a23578163b0b1ae00146109fa578163b16e0b7f1461098c578163b4c99a621461096f578163ba1aa6dd14610950578163c12059ff14610926578163c511fad9146108cd578163ca5c7b91146108ae578163ceb68c23146107fb578163d3fb0ad414610755578163d7a7554214610736578163d8003d961461070e578163d8d037a1146106ef578163e30c3978146106c6578163e9ae03fc1461064b578163ea5494b11461062c578163f2fde38b146105c1578163f541d33114610504578163f5d92c86146104e5578163f88b25d9146104c6578163fabe769b146104a7578163fc6a6c161461048557508063fd6bc9ee146103c65763fd7d9baf146103a5575f80fd5b346103c257816003193601126103c257602090600b549051908152f35b5080fd5b50346103c257610405610413602093670de0b6b3a76400006103e736611a09565b95926103f49792976124ef565b9761040089151561227c565b612ac2565b9361040e6122b7565b611ac6565b0461041c61235e565b915080841161043d5750506104359150600e5490612943565b905b51908152f35b6104508261044b8387611a83565b6128ba565b93600e548095105f14610470575050509061046a91612943565b90610437565b61046a94509061047f91611a83565b91612ac2565b8390346103c25760203660031901126103c2576104a0612700565b3560085580f35b5050346103c257816003193601126103c257602090602d549051908152f35b5050346103c257816003193601126103c2576020906015549051908152f35b5050346103c257816003193601126103c257602090602e549051908152f35b919050346105bd57826003193601126105bd5760025490610528603283111561249b565b835b828110610535578480f35b8461053f8261272b565b905460039190911b1c6001600160a01b0316803b156103c257819086855180948193637196e84160e01b83525af180156105b357610587575b50610582906124e1565b61052a565b67ffffffffffffffff81116105a0578252610582610578565b634e487b7160e01b865260418552602486fd5b83513d88823e3d90fd5b8280fd5b8390346103c25760203660031901126103c257356001600160a01b03818116918290036105bd576105f0612700565b600180546001600160a01b031916831790558254167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b5050346103c257816003193601126103c2576020906019549051908152f35b9050346105bd5760203660031901126105bd5780356001600160a01b038116908190036106c2577fd4513cbafbb6291e8ded2d01415d8900b184d555f258b7b730e0b12f0529857b9260209261069f612700565b6106aa831515612241565b80546001600160a01b0319168317905551908152a180f35b8380fd5b5050346103c257816003193601126103c25760015490516001600160a01b039091168152602090f35b5050346103c257816003193601126103c2576020906026549051908152f35b9050346105bd57826003193601126105bd575490516001600160a01b03909116815260209150f35b5050346103c257816003193601126103c2576020906023549051908152f35b9050346105bd5760203660031901126105bd57803590811515928383036107f75761078b335f52600360205260405f2054151590565b156107c75750506107b7575b6009805460ff60a01b191660a09290921b60ff60a01b1691909117905580f35b6107bf61235e565b600a55610797565b906020606492519162461bcd60e51b8352820152600a6024820152691bdb9b1e481d985d5b1d60b21b6044820152fd5b8480fd5b919050346105bd5760203660031901126105bd5781356001600160a01b03811692908390036106c25761082c612700565b610841835f52600360205260405f2054151590565b1561087e5750816020916108757fa40a7d97cd4243d8bcd193dc4d709afc3717750c5996d9e7216d1a5e0288c494946127d2565b5051908152a180f35b6020606492519162461bcd60e51b8352820152600b60248201526a1b9bdd081a5b881b1a5cdd60aa1b6044820152fd5b5050346103c257816003193601126103c257602090600a549051908152f35b5050346103c257816003193601126103c257610922906108eb6120c6565b90949293916021556022556108fe611f35565b600c9392935560175551938493846040919493926060820195825260208201520152565b0390f35b5050346103c257816003193601126103c257602090610943611f35565b600c556017559051908152f35b5050346103c257816003193601126103c2576020906014549051908152f35b5050346103c257816003193601126103c25760209061043561265c565b8390346103c2576101203660031901126103c25760e4359063ffffffff82168092036105bd576109ba612700565b3560245560243560265560443560235560643560275560843560255560a43560285560c43560295563ffffffff19602a541617602a5561010435602e5580f35b5050346103c257816003193601126103c25760095490516001600160a01b039091168152602090f35b5050346103c257816003193601126103c257602090600b549051908152f35b5050346103c257816003193601126103c25760209061043561235e565b5050346103c257816003193601126103c257602090601d549051908152f35b5050346103c257816003193601126103c257602090600f549051908152f35b5050346103c257816003193601126103c257602090601e549051908152f35b5050346103c257816003193601126103c2576020906008549051908152f35b5050346103c257816003193601126103c257602090601a549051908152f35b5050346103c257816003193601126103c257602090610435600d54602b5490611a83565b5050346103c257816003193601126103c257905490516001600160a01b039091168152602090f35b9050346105bd5760203660031901126105bd577f495ee53ee22006979ebc689a00ed737d7c13b6419142f82dcaea4ed95ac1e780916020913590610b88612700565b610b9c670de0b6b3a7640000831115611a27565b81600b5581600c554260175551908152a180f35b5050346103c257816003193601126103c257602090601c549051908152f35b5050346103c257816003193601126103c257602090602c549051908152f35b828434610c1d5780600319360112610c1d5750610c096120c6565b909160215560225582519182526020820152f35b80fd5b5050346103c257816003193601126103c2576020906027549051908152f35b919050346105bd57826003193601126105bd57600154916001600160a01b03913383851603610cab5750506001600160a01b031991821660015582543392811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60249250519063118cdaa760e01b82523390820152fd5b5050346103c257816003193601126103c257602090601f549051908152f35b5050346103c257816003193601126103c25760209081549051908152f35b8334610c1d5780600319360112610c1d57610d18612700565b600180546001600160a01b03199081169091558154908116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5050346103c257816003193601126103c2576020906012549051908152f35b5050346103c257816003193601126103c2576020906024549051908152f35b5050346103c257816003193601126103c2576020906010549051908152f35b5050346103c257816003193601126103c2576020906104356124ef565b9050346105bd5760203660031901126105bd57356001600160a01b0381169290839003610c1d5750610e1d6020925f52600360205260405f2054151590565b90519015158152f35b5050346103c257816003193601126103c257517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5050346103c257816003193601126103c2576020906013549051908152f35b8390346103c25760203660031901126103c257356001600160a01b038116908190036103c257610eb7612700565b610ec2811515612241565b600580546001600160a01b03191691909117905580f35b5050346103c257816003193601126103c25790602091600191610efa61265c565b60195411610f0c575b50519015158152f35b91505f610f03565b828434610c1d57610f2436611a09565b93670de0b6b3a7640000610f51610f3d959394956124ef565b96610f4988151561227c565b61040e6122b7565b04610f5a61235e565b918215610fc4575060209750808611610f80575050600e54610435945061040091612a14565b610f8e8261044b8389611a83565b95600e548097105f14610fab5750505061046a9361040091612a14565b61046a96506104009391610fbe91611a83565b90612ac2565b875162461bcd60e51b81526020818b01526016602482015275373790373ab6b09034b71031b4b931bab630ba34b7b760511b6044820152606490fd5b5050346103c257816003193601126103c2576020906104356126f8565b9050346105bd579161106892611032366119e6565b9061103b6120c6565b50929150506110486124ef565b9161105483151561227c565b670de0b6b3a764000097889161040e6122b7565b0461107161235e565b90811561117b57808411611138575050600e54611097925061109291612a14565b612a74565b8091600381101561112557600181036110ec5750508481029481860414901517156110d95750506104356020926110d3600d54602b5490611a83565b90611ad9565b634e487b7160e01b825260119052602490fd5b60029192959450602096935014611105575b5050610437565b61111c91929350611114611f35565b505090611ac6565b04905f806110fe565b634e487b7160e01b855260218452602485fd5b6111468261044b8387611a83565b93600e548095105f14611168575050506111639161109291612a14565b611097565b61116394506110929391610fbe91611a83565b875162461bcd60e51b81526020818801526016602482015275373790373ab6b09034b71031b4b931bab630ba34b7b760511b6044820152606490fd5b828434610c1d5780600319360112610c1d578151600280548083529083526020939284830192909183907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90845b81811061125f575050508161121b910382611a90565b83519485948186019282875251809352850193925b82811061123f57505050500390f35b83516001600160a01b031685528695509381019392810192600101611230565b825484529288019260019283019201611205565b919050346105bd573660031901126103c25760243580151581036105bd5761129b9135611af7565b80f35b919050346105bd5761012090816003193601126106c2577f82ea5fbf6e533ccf976ca5dd2b77121e801aa05ad66a8d48da3a59b3f07dc5379235906024359060443560643560843560a4359160c4359360e4359561010435976112ff612700565b6113076120c6565b9250506021556022558960185580601a558260195583601b5584601c5586601f558560205587601d5588601e558151998a5260208a01528801526060870152608086015260a085015260c084015260e0830152610100820152a180f35b9050346105bd5760203660031901126105bd577f903d8785355abe961ce896292e5d35d80eab24d8c56adc7f84ab630bbfbefb729160209135906113a6612700565b81600e5551908152a180f35b5050346103c257816003193601126103c25760209060ff60095460a01c1690519015158152f35b5050346103c257816003193601126103c2576020906029549051908152f35b5050346103c257816003193601126103c2576020906028549051908152f35b5050346103c257816003193601126103c2576020906007549051908152f35b5050346103c257816003193601126103c257602090602b549051908152f35b919050346105bd5761010090816003193601126106c2577fe97d817c9b58abf9a2fde0a2b7ca642f75348e0c7162150b13e78571bcb54063923590602435906044356064356084359060a4359260c4359460e435966114b2612700565b6114ba611f35565b909150600c5560175588600f5580601055826011558360155584601455856012558660135587601655815198895260208901528701526060860152608085015260a084015260c083015260e0820152a180f35b5050346103c257816003193601126103c2576020906006549051908152f35b919050346105bd5760203660031901126105bd5781356001600160a01b03811692908390036106c25761155d612700565b603260025410156115d85761157183612757565b156115a457507f557ddd0a3222ab95619c812e02380d7432b0801e123d7833cdeec5b15f5c00589160209151908152a180f35b6020606492519162461bcd60e51b8352820152600f60248201526e185b1c9958591e481a5b881b1a5cdd608a1b6044820152fd5b6020606492519162461bcd60e51b8352820152600f60248201526e746f6f206d616e79207661756c747360881b6044820152fd5b5050346103c257816003193601126103c2576020906016549051908152f35b5050346103c257816003193601126103c257602090601b549051908152f35b5050346103c257816003193601126103c25760055490516001600160a01b039091168152602090f35b9050346105bd576116c690611687366119e6565b94906116916120c6565b509150506116b16116a06124ef565b926116ac84151561227c565b6129bf565b90670de0b6b3a764000095869161040e6122b7565b046116cf61235e565b9080841161179b5750506116e79150600e5490612943565b905b819560038110156117885760018103611723575050505061171b602093611715600d54602b5490611a83565b90611ac6565b049051908152f35b92959493919260021461173d575b50505060209250610437565b909192935061174a611f35565b5050928281029281840414901517156117755750602093509061176c91611ad9565b905f8080611731565b634e487b7160e01b815260118552602490fd5b634e487b7160e01b825260218452602482fd5b6117a98261044b8387611a83565b93600e548095105f146117c957505050906117c391612943565b906116e9565b6117c394509061047f91611a83565b5050346103c257816003193601126103c2576020906018549051908152f35b9050346105bd5760203660031901126105bd57356001600160a01b03811691908290036105bd577f7732dd2ef80f6e8992e256b1ed10eb61aec7c86a2fbf2829c58d75248cee6e309160209161184b612700565b600980546001600160a01b0319168317905551908152a180f35b5050346103c257816003193601126103c2576020906104356122b7565b5050346103c257816003193601126103c2576020906011549051908152f35b5050346103c257816003193601126103c2576020906104356125ad565b5050346103c257816003193601126103c257602090600d549051908152f35b5050346103c257816003193601126103c2576020906025549051908152f35b9050346105bd5760203660031901126105bd577f7c1445c98b278c9970d007fca6048704bcb25af7cc4a04eb56565d9a9f149ca391602091359061193e612700565b611952670de0b6b3a7640000831115611a27565b61196b611964602954602b5490611a62565b8311611a27565b81600d5551908152a180f35b5050346103c257816003193601126103c2576080906119946120c6565b92939091815194855260208501528301526060820152f35b5050346103c257816003193601126103c257610922906119ca611f35565b9251918252602082015260408101919091529081906060820190565b6040906003190112611a0557600435906024356003811015611a055790565b5f80fd5b6080906003190112611a055760043590602435906044359060643590565b15611a2e57565b60405162461bcd60e51b815260206004820152600c60248201526b0cccaca40e8dede40d0d2ced60a31b6044820152606490fd5b91908201809211611a6f57565b634e487b7160e01b5f52601160045260245ffd5b91908203918211611a6f57565b90601f8019910116810190811067ffffffffffffffff821117611ab257604052565b634e487b7160e01b5f52604160045260245ffd5b81810292918115918404141715611a6f57565b8115611ae3570490565b634e487b7160e01b5f52601260045260245ffd5b8015611f3157602d5480611f105750611b12602e5442611a62565b602d555b6005546001600160a01b03169081611b31575050505f602b55565b611b46335f52600360205260405f2054151590565b8015611f07575b15611ecd5763ffffffff602a541691604051906301a0a9eb60e01b8252670de0b6b3a76400009260208360448160049588878301526024998a8301525afa928315611ec2575f93611e8f575b50611ba26120c6565b5091505084611bbe611bb26124ef565b92610f4984151561227c565b04611bc761235e565b908115611e5357808311611e1057505050611be6611092600e546129bf565b905b84820291808304861490151715611dfe57600d54602b9786611c1a611c138b54966110d38887611a83565b8095611ac6565b04955f93808210611daa575b5050602654831080611da3575b15611cda575050505050611c4c90611c54935490611ac6565b048254611a62565b808255602c5490818111611cb3575b5050600d54602954611c76835482611a62565b8210611ca1575b50505b54602c548110611c8d5750565b602c55611c9c602e5442611a62565b602d55565b611caa91611a83565b81555f80611c7d565b81611cbd91611a83565b60285480911115611c6357611cd191611a62565b81555f80611c63565b6027979295939694975486119081611d9a575b50611cff575b50505050505050611c80565b830395838711611d8957600187901b966001600160ff1b03811603611d89576103e896878102978189041490151715611d89575050611d42829160235490611ac6565b04930410611d75575b811015611d6c57611d5d908254611a83565b81555b5f808080808080611cf3565b505f8155611d60565b90611d839060255490611ac6565b90611d4b565b601190634e487b7160e01b5f52525ffd5b9050155f611ced565b5080611c33565b6103e894919294928084029084820403611dec5790611dc891611ad9565b8203918211611dda5750915f80611c26565b634e487b7160e01b8152601186528890fd5b634e487b7160e01b8352601188528a83fd5b85601184634e487b7160e01b5f52525ffd5b611e1e8261044b8386611a83565b92600e548094105f14611e4057505050611092611e3a916129bf565b90611be8565b611e3a9350611092929161044b91611a83565b60405162461bcd60e51b81526020818701526016818a015275373790373ab6b09034b71031b4b931bab630ba34b7b760511b6044820152606490fd5b90926020823d8211611eba575b81611ea960209383611a90565b81010312610c1d575051915f611b99565b3d9150611e9c565b6040513d5f823e3d90fd5b60405162461bcd60e51b815260206004820152601260248201527137b7363c903b30bab63a13383934b73a32b960711b6044820152606490fd5b50813314611b4d565b421115611b1657602b54602c55611f29602e5442611a62565b602d55611b16565b5050565b4290600c5490601754808403611fd7575b50611f4f6120c6565b50915050670de0b6b3a764000081810391818311611a6f5781830292830482149082141715611a6f576103e891611f8a916016549104611ac6565b045f90600b54818111611fc6575b5050601354808210611fbe575b508290838110611fb6575b50929190565b90505f611fb0565b90505f611fa5565b611fd09250611a83565b5f80611f98565b9092611fe16126f8565b600f5411156120575761200c612003611ffa8484611a83565b60105490611ac6565b60155490611ad9565b8061201b575050915b5f611f46565b90939291508082111561204c5761203191611a83565b9081601254809110612044575b50612015565b91505f61203e565b505060125490612015565b9290600b5480841061206b575b5050612015565b61209061208761207e8488959698611a83565b60115490611ac6565b60145490611ad9565b806120a157505050915b5f80612064565b90936120af92959350611a62565b918083116120be575b5061209a565b91505f6120b8565b60215490426120d361265c565b91602254808303612151575b5083670de0b6b3a764000093601854908181106120ff575b505093929190565b858196939602928184041490151715611a6f5761211b91611ad9565b926103e8808502908582041485151715611a6f57601e5461213b91611ad9565b858110612149575b806120f7565b90505f612143565b909160195484105f146121cc5761218061217761216e8484611a83565b601b5490611ac6565b60205490611ad9565b8061218f575050905b5f6120df565b85819294969350115f146121c1576121a691611a83565b9283601d548091106121b9575b50612189565b93505f6121b3565b5050601d5492612189565b9190670de0b6b3a76400008086106121e6575b5050612189565b90919261220b6122026121f98584611a83565b601c5490611ac6565b601f5490611ad9565b8061221c57505050905b5f806121df565b9093925061222a9195611a62565b93808511612239575b50612215565b93505f612233565b1561224857565b60405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b6044820152606490fd5b1561228357565b60405162461bcd60e51b815260206004820152600c60248201526b656d707479207661756c747360a01b6044820152606490fd5b6004546001600160a01b0316801561232057602060049160405192838092631a6719a560e01b82525afa908115611ec2575f916122f2575090565b906020823d8211612318575b8161230b60209383611a90565b81010312610c1d57505190565b3d91506122fe565b60405162461bcd60e51b81526020600482015260166024820152751b9d505cdcd95d13585b9859d95c881b9bdd081cd95d60521b6044820152606490fd5b60095460ff8160a01c16612494576040516318160ddd60e01b81529060206001600160a01b0381846004817f000000000000000000000000000000000000000000000000000000000000000085165afa938415611ec2575f94612465575b505f9216806123ec575b50506123d86123dd9260085490611a83565b611a83565b80156123e65790565b50600190565b9181600492936040519384809263fe7f56f760e01b82525afa928315612458578193612423575b506123d891506123dd90506123c6565b9091809350813d8311612451575b61243b8183611a90565b81010312610c1d5750516123d86123dd5f612413565b503d612431565b50604051903d90823e3d90fd5b90938282813d831161248d575b61247c8183611a90565b81010312610c1d575051925f6123bc565b503d612472565b50600a5490565b156124a257565b60405162461bcd60e51b81526020600482015260176024820152761d1bdbc81b585b9e481d985d5b1d1cc81a5b881b1a5cdd604a1b6044820152606490fd5b5f198114611a6f5760010190565b5f600254612500603282111561249b565b81905b80821061250f57505090565b909161251a8361272b565b905460408051633876856d60e11b81529092909160209182918491600491839160031b1c6001600160a01b03165afa9283156125a457505f92612573575b50506125679061256d92611a62565b926124e1565b90612503565b81819392933d831161259d575b61258a8183611a90565b81010312610c1d57505181612567612558565b503d612580565b513d5f823e3d90fd5b5f6002546125be603282111561249b565b81905b8082106125cd57505090565b90916125d88361272b565b9054604080516321eb60eb60e01b81529092909160209182918491600491839160031b1c6001600160a01b03165afa9283156125a457505f9261262b575b50506125679061262592611a62565b906125c1565b81819392933d8311612655575b6126428183611a90565b81010312610c1d57505181612567612616565b503d612638565b6126646124ef565b60048054604051631a6719a560e01b81529160209183919082906001600160a01b03165afa908115611ec2575f916126c7575b5080156126be576103e891828102928184041490151715611a6f576126bb91611ad9565b90565b5050620186a090565b906020823d82116126f0575b816126e060209383611a90565b81010312610c1d5750515f612697565b3d91506126d3565b6126646125ad565b5f546001600160a01b0316330361271357565b60405163118cdaa760e01b8152336004820152602490fd5b6002548110156127435760025f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b5f818152600360205260408120546127cd57600254600160401b8110156127b95790826127a561278f8460016040960160025561272b565b819391549060031b91821b915f19901b19161790565b905560025492815260036020522055600190565b634e487b7160e01b82526041600452602482fd5b905090565b5f8181526003602052604081205490919080156128b5575f19908082018181116128a1576002549083820191821161288d57818103612859575b5050506002548015612845578101906128248261272b565b909182549160031b1b19169055600255815260036020526040812055600190565b634e487b7160e01b84526031600452602484fd5b61287761286861278f9361272b565b90549060031b1c92839261272b565b90558452600360205260408420555f808061280c565b634e487b7160e01b86526011600452602486fd5b634e487b7160e01b85526011600452602485fd5b505090565b670de0b6b3a7640000915f1982840992828102928380861095039480860395146129355784831115611a055782910981805f0316809204600280826003021880830282030280830282030280830282030280830282030280830282030280920290030293600183805f03040190848311900302920304170290565b505080925015611a05570490565b90670de0b6b3a7640000905f1982840992828102928380861095039480860395146129355784831115611a055782910981805f0316809204600280826003021880830282030280830282030280830282030280830282030280830282030280920290030293600183805f03040190848311900302920304170290565b670de0b6b3a76400005f1982820982820291828083109203918083039214612a0d5781811115611a05575f80516020612b3583398151915293810990828211900360ee1b910360121c170290565b9250500490565b905f1981830981830291828083109203918083039214612a6357670de0b6b3a76400009082821115611a05575f80516020612b35833981519152940990828211900360ee1b910360121c170290565b5050670de0b6b3a764000091500490565b670de0b6b3a76400005f1981830981830291828083109203918083039214612a0d5781811115611a0557805f80516020612b35833981519152940990828211900360ee1b910360121c170290565b915f1982840992828102928380861095039480860395146129355784831115611a055782910981805f0316809204600280826003021880830282030280830282030280830282030280830282030280830282030280920290030293600183805f0304019084831190030292030417029056feaccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac10669a264697066735822122050738e55ca9a8f27b37e7d3f356ab901e365d77e65ae5e397249506425dacaba64736f6c6343000814003300000000000000000000000083a6d8d9aa761e7e08ebe0ba5399970f9e8f61d9000000000000000000000000f9832b3d082fbf45ec737e2759aff0a16fb18bbf

Deployed Bytecode

0x60406080815260049081361015610014575f80fd5b5f91823560e01c9081629ca3eb146119ac5781630ba31236146119775781630cc835a3146118fc5781630f38d798146118dd578163162b51fc146118be57816317a5af7a146118a1578163188c3c4e146118825781631a6719a5146118655781631b47a159146117f75781631b6e557b146117d85781631bafd940146116735781631d25645b1461070e5781631d3a0c981461164a578163240700351461162b5781632457092a1461160c578163256b5a021461152c578163289537cd1461150d5781632910a5aa146114555781632e10633c146114365781632fce668714611417578163314cd793146113f857816333748e4b146113d95781633822f65c146113b25781633c5c2f551461136457816340cb767e1461129e5781634290768a14610adb5781634470d3201461127357816344d00f82146111b757816345718e811461101d578163488f79ee146110005781634ee2b90b14610f1457816354aa10f514610ed95781635923885f14610e895781635959640814610e6a5781635992c23e14610e26578163652b9b4114610dde57816367bdf64014610dc1578163682fd92414610da25781636ea2843914610d835781636fb99a9314610d64578163715018a614610cff57816371f26cce14610ce157816378469b1314610cc257816379ba509714610c3f5781637c5b12de14610c205781637f81c5e014610bee57816384e5092514610bcf578163865ecff114610bb05781638b4cee0814610b465781638da5cb5b14610b1e5781638f818b9014610afa578163960fd08814610adb5781639616c22114610abc5781639e47ae6714610a9d578163a29272ce14610485578163a49e178314610a7e578163a74109ae14610a5f578163abc9276214610a42578163abd545bf14610a23578163b0b1ae00146109fa578163b16e0b7f1461098c578163b4c99a621461096f578163ba1aa6dd14610950578163c12059ff14610926578163c511fad9146108cd578163ca5c7b91146108ae578163ceb68c23146107fb578163d3fb0ad414610755578163d7a7554214610736578163d8003d961461070e578163d8d037a1146106ef578163e30c3978146106c6578163e9ae03fc1461064b578163ea5494b11461062c578163f2fde38b146105c1578163f541d33114610504578163f5d92c86146104e5578163f88b25d9146104c6578163fabe769b146104a7578163fc6a6c161461048557508063fd6bc9ee146103c65763fd7d9baf146103a5575f80fd5b346103c257816003193601126103c257602090600b549051908152f35b5080fd5b50346103c257610405610413602093670de0b6b3a76400006103e736611a09565b95926103f49792976124ef565b9761040089151561227c565b612ac2565b9361040e6122b7565b611ac6565b0461041c61235e565b915080841161043d5750506104359150600e5490612943565b905b51908152f35b6104508261044b8387611a83565b6128ba565b93600e548095105f14610470575050509061046a91612943565b90610437565b61046a94509061047f91611a83565b91612ac2565b8390346103c25760203660031901126103c2576104a0612700565b3560085580f35b5050346103c257816003193601126103c257602090602d549051908152f35b5050346103c257816003193601126103c2576020906015549051908152f35b5050346103c257816003193601126103c257602090602e549051908152f35b919050346105bd57826003193601126105bd5760025490610528603283111561249b565b835b828110610535578480f35b8461053f8261272b565b905460039190911b1c6001600160a01b0316803b156103c257819086855180948193637196e84160e01b83525af180156105b357610587575b50610582906124e1565b61052a565b67ffffffffffffffff81116105a0578252610582610578565b634e487b7160e01b865260418552602486fd5b83513d88823e3d90fd5b8280fd5b8390346103c25760203660031901126103c257356001600160a01b03818116918290036105bd576105f0612700565b600180546001600160a01b031916831790558254167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b5050346103c257816003193601126103c2576020906019549051908152f35b9050346105bd5760203660031901126105bd5780356001600160a01b038116908190036106c2577fd4513cbafbb6291e8ded2d01415d8900b184d555f258b7b730e0b12f0529857b9260209261069f612700565b6106aa831515612241565b80546001600160a01b0319168317905551908152a180f35b8380fd5b5050346103c257816003193601126103c25760015490516001600160a01b039091168152602090f35b5050346103c257816003193601126103c2576020906026549051908152f35b9050346105bd57826003193601126105bd575490516001600160a01b03909116815260209150f35b5050346103c257816003193601126103c2576020906023549051908152f35b9050346105bd5760203660031901126105bd57803590811515928383036107f75761078b335f52600360205260405f2054151590565b156107c75750506107b7575b6009805460ff60a01b191660a09290921b60ff60a01b1691909117905580f35b6107bf61235e565b600a55610797565b906020606492519162461bcd60e51b8352820152600a6024820152691bdb9b1e481d985d5b1d60b21b6044820152fd5b8480fd5b919050346105bd5760203660031901126105bd5781356001600160a01b03811692908390036106c25761082c612700565b610841835f52600360205260405f2054151590565b1561087e5750816020916108757fa40a7d97cd4243d8bcd193dc4d709afc3717750c5996d9e7216d1a5e0288c494946127d2565b5051908152a180f35b6020606492519162461bcd60e51b8352820152600b60248201526a1b9bdd081a5b881b1a5cdd60aa1b6044820152fd5b5050346103c257816003193601126103c257602090600a549051908152f35b5050346103c257816003193601126103c257610922906108eb6120c6565b90949293916021556022556108fe611f35565b600c9392935560175551938493846040919493926060820195825260208201520152565b0390f35b5050346103c257816003193601126103c257602090610943611f35565b600c556017559051908152f35b5050346103c257816003193601126103c2576020906014549051908152f35b5050346103c257816003193601126103c25760209061043561265c565b8390346103c2576101203660031901126103c25760e4359063ffffffff82168092036105bd576109ba612700565b3560245560243560265560443560235560643560275560843560255560a43560285560c43560295563ffffffff19602a541617602a5561010435602e5580f35b5050346103c257816003193601126103c25760095490516001600160a01b039091168152602090f35b5050346103c257816003193601126103c257602090600b549051908152f35b5050346103c257816003193601126103c25760209061043561235e565b5050346103c257816003193601126103c257602090601d549051908152f35b5050346103c257816003193601126103c257602090600f549051908152f35b5050346103c257816003193601126103c257602090601e549051908152f35b5050346103c257816003193601126103c2576020906008549051908152f35b5050346103c257816003193601126103c257602090601a549051908152f35b5050346103c257816003193601126103c257602090610435600d54602b5490611a83565b5050346103c257816003193601126103c257905490516001600160a01b039091168152602090f35b9050346105bd5760203660031901126105bd577f495ee53ee22006979ebc689a00ed737d7c13b6419142f82dcaea4ed95ac1e780916020913590610b88612700565b610b9c670de0b6b3a7640000831115611a27565b81600b5581600c554260175551908152a180f35b5050346103c257816003193601126103c257602090601c549051908152f35b5050346103c257816003193601126103c257602090602c549051908152f35b828434610c1d5780600319360112610c1d5750610c096120c6565b909160215560225582519182526020820152f35b80fd5b5050346103c257816003193601126103c2576020906027549051908152f35b919050346105bd57826003193601126105bd57600154916001600160a01b03913383851603610cab5750506001600160a01b031991821660015582543392811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60249250519063118cdaa760e01b82523390820152fd5b5050346103c257816003193601126103c257602090601f549051908152f35b5050346103c257816003193601126103c25760209081549051908152f35b8334610c1d5780600319360112610c1d57610d18612700565b600180546001600160a01b03199081169091558154908116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5050346103c257816003193601126103c2576020906012549051908152f35b5050346103c257816003193601126103c2576020906024549051908152f35b5050346103c257816003193601126103c2576020906010549051908152f35b5050346103c257816003193601126103c2576020906104356124ef565b9050346105bd5760203660031901126105bd57356001600160a01b0381169290839003610c1d5750610e1d6020925f52600360205260405f2054151590565b90519015158152f35b5050346103c257816003193601126103c257517f00000000000000000000000083a6d8d9aa761e7e08ebe0ba5399970f9e8f61d96001600160a01b03168152602090f35b5050346103c257816003193601126103c2576020906013549051908152f35b8390346103c25760203660031901126103c257356001600160a01b038116908190036103c257610eb7612700565b610ec2811515612241565b600580546001600160a01b03191691909117905580f35b5050346103c257816003193601126103c25790602091600191610efa61265c565b60195411610f0c575b50519015158152f35b91505f610f03565b828434610c1d57610f2436611a09565b93670de0b6b3a7640000610f51610f3d959394956124ef565b96610f4988151561227c565b61040e6122b7565b04610f5a61235e565b918215610fc4575060209750808611610f80575050600e54610435945061040091612a14565b610f8e8261044b8389611a83565b95600e548097105f14610fab5750505061046a9361040091612a14565b61046a96506104009391610fbe91611a83565b90612ac2565b875162461bcd60e51b81526020818b01526016602482015275373790373ab6b09034b71031b4b931bab630ba34b7b760511b6044820152606490fd5b5050346103c257816003193601126103c2576020906104356126f8565b9050346105bd579161106892611032366119e6565b9061103b6120c6565b50929150506110486124ef565b9161105483151561227c565b670de0b6b3a764000097889161040e6122b7565b0461107161235e565b90811561117b57808411611138575050600e54611097925061109291612a14565b612a74565b8091600381101561112557600181036110ec5750508481029481860414901517156110d95750506104356020926110d3600d54602b5490611a83565b90611ad9565b634e487b7160e01b825260119052602490fd5b60029192959450602096935014611105575b5050610437565b61111c91929350611114611f35565b505090611ac6565b04905f806110fe565b634e487b7160e01b855260218452602485fd5b6111468261044b8387611a83565b93600e548095105f14611168575050506111639161109291612a14565b611097565b61116394506110929391610fbe91611a83565b875162461bcd60e51b81526020818801526016602482015275373790373ab6b09034b71031b4b931bab630ba34b7b760511b6044820152606490fd5b828434610c1d5780600319360112610c1d578151600280548083529083526020939284830192909183907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90845b81811061125f575050508161121b910382611a90565b83519485948186019282875251809352850193925b82811061123f57505050500390f35b83516001600160a01b031685528695509381019392810192600101611230565b825484529288019260019283019201611205565b919050346105bd573660031901126103c25760243580151581036105bd5761129b9135611af7565b80f35b919050346105bd5761012090816003193601126106c2577f82ea5fbf6e533ccf976ca5dd2b77121e801aa05ad66a8d48da3a59b3f07dc5379235906024359060443560643560843560a4359160c4359360e4359561010435976112ff612700565b6113076120c6565b9250506021556022558960185580601a558260195583601b5584601c5586601f558560205587601d5588601e558151998a5260208a01528801526060870152608086015260a085015260c084015260e0830152610100820152a180f35b9050346105bd5760203660031901126105bd577f903d8785355abe961ce896292e5d35d80eab24d8c56adc7f84ab630bbfbefb729160209135906113a6612700565b81600e5551908152a180f35b5050346103c257816003193601126103c25760209060ff60095460a01c1690519015158152f35b5050346103c257816003193601126103c2576020906029549051908152f35b5050346103c257816003193601126103c2576020906028549051908152f35b5050346103c257816003193601126103c2576020906007549051908152f35b5050346103c257816003193601126103c257602090602b549051908152f35b919050346105bd5761010090816003193601126106c2577fe97d817c9b58abf9a2fde0a2b7ca642f75348e0c7162150b13e78571bcb54063923590602435906044356064356084359060a4359260c4359460e435966114b2612700565b6114ba611f35565b909150600c5560175588600f5580601055826011558360155584601455856012558660135587601655815198895260208901528701526060860152608085015260a084015260c083015260e0820152a180f35b5050346103c257816003193601126103c2576020906006549051908152f35b919050346105bd5760203660031901126105bd5781356001600160a01b03811692908390036106c25761155d612700565b603260025410156115d85761157183612757565b156115a457507f557ddd0a3222ab95619c812e02380d7432b0801e123d7833cdeec5b15f5c00589160209151908152a180f35b6020606492519162461bcd60e51b8352820152600f60248201526e185b1c9958591e481a5b881b1a5cdd608a1b6044820152fd5b6020606492519162461bcd60e51b8352820152600f60248201526e746f6f206d616e79207661756c747360881b6044820152fd5b5050346103c257816003193601126103c2576020906016549051908152f35b5050346103c257816003193601126103c257602090601b549051908152f35b5050346103c257816003193601126103c25760055490516001600160a01b039091168152602090f35b9050346105bd576116c690611687366119e6565b94906116916120c6565b509150506116b16116a06124ef565b926116ac84151561227c565b6129bf565b90670de0b6b3a764000095869161040e6122b7565b046116cf61235e565b9080841161179b5750506116e79150600e5490612943565b905b819560038110156117885760018103611723575050505061171b602093611715600d54602b5490611a83565b90611ac6565b049051908152f35b92959493919260021461173d575b50505060209250610437565b909192935061174a611f35565b5050928281029281840414901517156117755750602093509061176c91611ad9565b905f8080611731565b634e487b7160e01b815260118552602490fd5b634e487b7160e01b825260218452602482fd5b6117a98261044b8387611a83565b93600e548095105f146117c957505050906117c391612943565b906116e9565b6117c394509061047f91611a83565b5050346103c257816003193601126103c2576020906018549051908152f35b9050346105bd5760203660031901126105bd57356001600160a01b03811691908290036105bd577f7732dd2ef80f6e8992e256b1ed10eb61aec7c86a2fbf2829c58d75248cee6e309160209161184b612700565b600980546001600160a01b0319168317905551908152a180f35b5050346103c257816003193601126103c2576020906104356122b7565b5050346103c257816003193601126103c2576020906011549051908152f35b5050346103c257816003193601126103c2576020906104356125ad565b5050346103c257816003193601126103c257602090600d549051908152f35b5050346103c257816003193601126103c2576020906025549051908152f35b9050346105bd5760203660031901126105bd577f7c1445c98b278c9970d007fca6048704bcb25af7cc4a04eb56565d9a9f149ca391602091359061193e612700565b611952670de0b6b3a7640000831115611a27565b61196b611964602954602b5490611a62565b8311611a27565b81600d5551908152a180f35b5050346103c257816003193601126103c2576080906119946120c6565b92939091815194855260208501528301526060820152f35b5050346103c257816003193601126103c257610922906119ca611f35565b9251918252602082015260408101919091529081906060820190565b6040906003190112611a0557600435906024356003811015611a055790565b5f80fd5b6080906003190112611a055760043590602435906044359060643590565b15611a2e57565b60405162461bcd60e51b815260206004820152600c60248201526b0cccaca40e8dede40d0d2ced60a31b6044820152606490fd5b91908201809211611a6f57565b634e487b7160e01b5f52601160045260245ffd5b91908203918211611a6f57565b90601f8019910116810190811067ffffffffffffffff821117611ab257604052565b634e487b7160e01b5f52604160045260245ffd5b81810292918115918404141715611a6f57565b8115611ae3570490565b634e487b7160e01b5f52601260045260245ffd5b8015611f3157602d5480611f105750611b12602e5442611a62565b602d555b6005546001600160a01b03169081611b31575050505f602b55565b611b46335f52600360205260405f2054151590565b8015611f07575b15611ecd5763ffffffff602a541691604051906301a0a9eb60e01b8252670de0b6b3a76400009260208360448160049588878301526024998a8301525afa928315611ec2575f93611e8f575b50611ba26120c6565b5091505084611bbe611bb26124ef565b92610f4984151561227c565b04611bc761235e565b908115611e5357808311611e1057505050611be6611092600e546129bf565b905b84820291808304861490151715611dfe57600d54602b9786611c1a611c138b54966110d38887611a83565b8095611ac6565b04955f93808210611daa575b5050602654831080611da3575b15611cda575050505050611c4c90611c54935490611ac6565b048254611a62565b808255602c5490818111611cb3575b5050600d54602954611c76835482611a62565b8210611ca1575b50505b54602c548110611c8d5750565b602c55611c9c602e5442611a62565b602d55565b611caa91611a83565b81555f80611c7d565b81611cbd91611a83565b60285480911115611c6357611cd191611a62565b81555f80611c63565b6027979295939694975486119081611d9a575b50611cff575b50505050505050611c80565b830395838711611d8957600187901b966001600160ff1b03811603611d89576103e896878102978189041490151715611d89575050611d42829160235490611ac6565b04930410611d75575b811015611d6c57611d5d908254611a83565b81555b5f808080808080611cf3565b505f8155611d60565b90611d839060255490611ac6565b90611d4b565b601190634e487b7160e01b5f52525ffd5b9050155f611ced565b5080611c33565b6103e894919294928084029084820403611dec5790611dc891611ad9565b8203918211611dda5750915f80611c26565b634e487b7160e01b8152601186528890fd5b634e487b7160e01b8352601188528a83fd5b85601184634e487b7160e01b5f52525ffd5b611e1e8261044b8386611a83565b92600e548094105f14611e4057505050611092611e3a916129bf565b90611be8565b611e3a9350611092929161044b91611a83565b60405162461bcd60e51b81526020818701526016818a015275373790373ab6b09034b71031b4b931bab630ba34b7b760511b6044820152606490fd5b90926020823d8211611eba575b81611ea960209383611a90565b81010312610c1d575051915f611b99565b3d9150611e9c565b6040513d5f823e3d90fd5b60405162461bcd60e51b815260206004820152601260248201527137b7363c903b30bab63a13383934b73a32b960711b6044820152606490fd5b50813314611b4d565b421115611b1657602b54602c55611f29602e5442611a62565b602d55611b16565b5050565b4290600c5490601754808403611fd7575b50611f4f6120c6565b50915050670de0b6b3a764000081810391818311611a6f5781830292830482149082141715611a6f576103e891611f8a916016549104611ac6565b045f90600b54818111611fc6575b5050601354808210611fbe575b508290838110611fb6575b50929190565b90505f611fb0565b90505f611fa5565b611fd09250611a83565b5f80611f98565b9092611fe16126f8565b600f5411156120575761200c612003611ffa8484611a83565b60105490611ac6565b60155490611ad9565b8061201b575050915b5f611f46565b90939291508082111561204c5761203191611a83565b9081601254809110612044575b50612015565b91505f61203e565b505060125490612015565b9290600b5480841061206b575b5050612015565b61209061208761207e8488959698611a83565b60115490611ac6565b60145490611ad9565b806120a157505050915b5f80612064565b90936120af92959350611a62565b918083116120be575b5061209a565b91505f6120b8565b60215490426120d361265c565b91602254808303612151575b5083670de0b6b3a764000093601854908181106120ff575b505093929190565b858196939602928184041490151715611a6f5761211b91611ad9565b926103e8808502908582041485151715611a6f57601e5461213b91611ad9565b858110612149575b806120f7565b90505f612143565b909160195484105f146121cc5761218061217761216e8484611a83565b601b5490611ac6565b60205490611ad9565b8061218f575050905b5f6120df565b85819294969350115f146121c1576121a691611a83565b9283601d548091106121b9575b50612189565b93505f6121b3565b5050601d5492612189565b9190670de0b6b3a76400008086106121e6575b5050612189565b90919261220b6122026121f98584611a83565b601c5490611ac6565b601f5490611ad9565b8061221c57505050905b5f806121df565b9093925061222a9195611a62565b93808511612239575b50612215565b93505f612233565b1561224857565b60405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b6044820152606490fd5b1561228357565b60405162461bcd60e51b815260206004820152600c60248201526b656d707479207661756c747360a01b6044820152606490fd5b6004546001600160a01b0316801561232057602060049160405192838092631a6719a560e01b82525afa908115611ec2575f916122f2575090565b906020823d8211612318575b8161230b60209383611a90565b81010312610c1d57505190565b3d91506122fe565b60405162461bcd60e51b81526020600482015260166024820152751b9d505cdcd95d13585b9859d95c881b9bdd081cd95d60521b6044820152606490fd5b60095460ff8160a01c16612494576040516318160ddd60e01b81529060206001600160a01b0381846004817f00000000000000000000000083a6d8d9aa761e7e08ebe0ba5399970f9e8f61d985165afa938415611ec2575f94612465575b505f9216806123ec575b50506123d86123dd9260085490611a83565b611a83565b80156123e65790565b50600190565b9181600492936040519384809263fe7f56f760e01b82525afa928315612458578193612423575b506123d891506123dd90506123c6565b9091809350813d8311612451575b61243b8183611a90565b81010312610c1d5750516123d86123dd5f612413565b503d612431565b50604051903d90823e3d90fd5b90938282813d831161248d575b61247c8183611a90565b81010312610c1d575051925f6123bc565b503d612472565b50600a5490565b156124a257565b60405162461bcd60e51b81526020600482015260176024820152761d1bdbc81b585b9e481d985d5b1d1cc81a5b881b1a5cdd604a1b6044820152606490fd5b5f198114611a6f5760010190565b5f600254612500603282111561249b565b81905b80821061250f57505090565b909161251a8361272b565b905460408051633876856d60e11b81529092909160209182918491600491839160031b1c6001600160a01b03165afa9283156125a457505f92612573575b50506125679061256d92611a62565b926124e1565b90612503565b81819392933d831161259d575b61258a8183611a90565b81010312610c1d57505181612567612558565b503d612580565b513d5f823e3d90fd5b5f6002546125be603282111561249b565b81905b8082106125cd57505090565b90916125d88361272b565b9054604080516321eb60eb60e01b81529092909160209182918491600491839160031b1c6001600160a01b03165afa9283156125a457505f9261262b575b50506125679061262592611a62565b906125c1565b81819392933d8311612655575b6126428183611a90565b81010312610c1d57505181612567612616565b503d612638565b6126646124ef565b60048054604051631a6719a560e01b81529160209183919082906001600160a01b03165afa908115611ec2575f916126c7575b5080156126be576103e891828102928184041490151715611a6f576126bb91611ad9565b90565b5050620186a090565b906020823d82116126f0575b816126e060209383611a90565b81010312610c1d5750515f612697565b3d91506126d3565b6126646125ad565b5f546001600160a01b0316330361271357565b60405163118cdaa760e01b8152336004820152602490fd5b6002548110156127435760025f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b5f818152600360205260408120546127cd57600254600160401b8110156127b95790826127a561278f8460016040960160025561272b565b819391549060031b91821b915f19901b19161790565b905560025492815260036020522055600190565b634e487b7160e01b82526041600452602482fd5b905090565b5f8181526003602052604081205490919080156128b5575f19908082018181116128a1576002549083820191821161288d57818103612859575b5050506002548015612845578101906128248261272b565b909182549160031b1b19169055600255815260036020526040812055600190565b634e487b7160e01b84526031600452602484fd5b61287761286861278f9361272b565b90549060031b1c92839261272b565b90558452600360205260408420555f808061280c565b634e487b7160e01b86526011600452602486fd5b634e487b7160e01b85526011600452602485fd5b505090565b670de0b6b3a7640000915f1982840992828102928380861095039480860395146129355784831115611a055782910981805f0316809204600280826003021880830282030280830282030280830282030280830282030280830282030280920290030293600183805f03040190848311900302920304170290565b505080925015611a05570490565b90670de0b6b3a7640000905f1982840992828102928380861095039480860395146129355784831115611a055782910981805f0316809204600280826003021880830282030280830282030280830282030280830282030280830282030280920290030293600183805f03040190848311900302920304170290565b670de0b6b3a76400005f1982820982820291828083109203918083039214612a0d5781811115611a05575f80516020612b3583398151915293810990828211900360ee1b910360121c170290565b9250500490565b905f1981830981830291828083109203918083039214612a6357670de0b6b3a76400009082821115611a05575f80516020612b35833981519152940990828211900360ee1b910360121c170290565b5050670de0b6b3a764000091500490565b670de0b6b3a76400005f1981830981830291828083109203918083039214612a0d5781811115611a0557805f80516020612b35833981519152940990828211900360ee1b910360121c170290565b915f1982840992828102928380861095039480860395146129355784831115611a055782910981805f0316809204600280826003021880830282030280830282030280830282030280830282030280830282030280920290030293600183805f0304019084831190030292030417029056feaccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac10669a264697066735822122050738e55ca9a8f27b37e7d3f356ab901e365d77e65ae5e397249506425dacaba64736f6c63430008140033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000083a6d8d9aa761e7e08ebe0ba5399970f9e8f61d9000000000000000000000000f9832b3d082fbf45ec737e2759aff0a16fb18bbf

-----Decoded View---------------
Arg [0] : _numaAddress (address): 0x83a6d8D9aa761e7e08EBE0BA5399970f9e8F61D9
Arg [1] : _nuAssetManagerAddress (address): 0xF9832B3D082FBF45Ec737E2759AFf0A16Fb18bbf

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000083a6d8d9aa761e7e08ebe0ba5399970f9e8f61d9
Arg [1] : 000000000000000000000000f9832b3d082fbf45ec737e2759aff0a16fb18bbf


Block Transaction Gas Used Reward
view all blocks ##produced##

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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.