Contract 0x7859b01bbf675d67da8cd128a50d155cd881b576 7

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x621bf3482495936679e7750a95cf987d7692eeda9062422cad4daa9b5d2f35c3Approve147187762022-01-27 2:11:1145 mins ago0xde60a60f122cdd11063a0400f887060e2ec9fcb4 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x6a54872abd644281cb6f28f6fa05d587086ff10583626f4710c77a43d724b349Approve147184682022-01-27 1:55:471 hr ago0xc3422b1e8286b1fd18ba535cfff1cb422a811b13 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x023f8ad46305ce3ef0f66d7cfa60959487d502e90eceeb8cbfc1fb4daeb39947Approve147179502022-01-27 1:29:441 hr 26 mins ago0x6b4b6420a114ef30812a41adbe06e6800a2dbc9f IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x6e5a9c6159b1ec9248750a10fd78db87236cd192596220c3a8a88d202e0af6d4Approve147175962022-01-27 1:12:021 hr 44 mins ago0x1fac31e8027c843a354e18030f5d7f6a9811f69d IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x0cc99c753816a00e85ec92590febd97d94e2c94803c10662e7c4dba1030b4cadTransfer147174552022-01-27 1:04:591 hr 51 mins ago0x7f274cbb19943cadc10cf44e44e8ecdc04493707 IN  Mars Ecosystem: XMS Token0 BNB0.000330828
0x2ddf514a422257e02b1871b934a351c496a80acab89e1d1d07b4d7b946a1a694Approve147170222022-01-27 0:43:202 hrs 12 mins ago0x3cb5377b3fd48932ab44abf2ba165b6afdab7345 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x6862e368a59efbc9d7e4318594cb780fea6a757d4f0c117059b57960c70bd69eApprove147168772022-01-27 0:36:052 hrs 20 mins ago0x88aebe29d679400b07cd620c0caf6faf0db9eca7 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0xcc25f23f7a8f94876023c71721763627eef962c1b59dac90008cb13b35087afcApprove147165852022-01-27 0:21:292 hrs 34 mins ago0x75c281a1cead60f3e773bd60d7cf0e93b2be15e0 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x5bf7031c8db95e6861b4bf6578e2b280fffc8ec4b5ebc2209af7dc83de445e1cApprove147162182022-01-27 0:03:082 hrs 53 mins ago0x1ab0f6a6af812e48d8e6f46c5fd95bf2319865c5 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x873aa5aa5785c2b93198f4137667fd0fe50fbbfaa3272110a0a81d62947230eaTransfer147157462022-01-26 23:39:323 hrs 16 mins ago0x1abe7f510dd4cc2b017ef78f4757b83ae334862d IN  Mars Ecosystem: XMS Token0 BNB0.00012587
0x6ceda37f6db5457fee914af968b377da035679ee2038fa989f7941fc664441eeTransfer147157212022-01-26 23:38:173 hrs 17 mins ago0x33bf611f7d92117a0875f4d7628017bbcd6e45b5 IN  Mars Ecosystem: XMS Token0 BNB0.00020087
0x6b97cf3b89ce473c0467e32dfbf7cc72b2357f0daaf6eb044badc337711353b9Approve147156282022-01-26 23:33:383 hrs 22 mins ago0xbaf93dbdae5e6ed6f8c656cefb7aa71818be1919 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x64cf5b6034f38207fbae4223f2e1b4af826423dd5895952059ada0066cf52376Approve147155892022-01-26 23:31:413 hrs 24 mins ago0x5b7e7e396a5b9308d6c68271e056396c5f63dda0 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0xf00033d085d9eed9ec849e3650778a711d7dd65c038a307cf3fec673ea3665bfApprove147155732022-01-26 23:30:533 hrs 25 mins ago0x5b7e7e396a5b9308d6c68271e056396c5f63dda0 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x39c4b119224b5ca6309d8fd2c7cef271479d95b115cd4e8441ad0f0fc22704c2Approve147155422022-01-26 23:29:203 hrs 26 mins ago0x5b7e7e396a5b9308d6c68271e056396c5f63dda0 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0xed51640301bedb8cb3c675ad417e528357a8b86314ae0e3afc631d624b4b7142Approve147154362022-01-26 23:24:023 hrs 32 mins ago0xaa30c4ddb764caf3b06dbed6a6e0f080304acc0b IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x038673965d8eb7d5989b20958e1cef275be5e692829533e51b7f54c9e2cc7562Approve147150792022-01-26 23:06:113 hrs 50 mins ago0xfb2fd7970e6209cd8ca08ab05508ce42d2cdb41e IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x057bed8676854298ae27cf6db79164a01c467c70cf9166071230d456059f3b33Approve147144972022-01-26 22:37:054 hrs 19 mins ago0xe3ea91d0b1fdc771e01759315287e9f6653cd0bf IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0xd1e8294c32cc303eab79fd8e7bd9e99c4ea4a00063d1bd2e921d0e1862074dbbTransfer147143652022-01-26 22:30:294 hrs 25 mins ago0x42687ecb9be7afa7ab01ceaf5182d939748dc552 IN  Mars Ecosystem: XMS Token0 BNB0.00012581
0x02c208c37d527558086ad55754a1f7e0631b406a76ba2df012fa0c2f2d239624Approve147143602022-01-26 22:30:144 hrs 25 mins ago0x5563a7c1cb8085c3042dbf1f938a719a319a1886 IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x48e46d34ad96249d139f40b5a5851699c286f04f6c078099ff8b358ab70cb77fTransfer147143542022-01-26 22:29:564 hrs 26 mins ago0x8eac036efd6c42ff695e6f2b95489d2e3f647452 IN  Mars Ecosystem: XMS Token0 BNB0.00012581
0xd568b4302e5c8dc11989791da4f88a30082a749310ee8bc5005aecfc27c1eeceApprove147141462022-01-26 22:19:324 hrs 36 mins ago0x2cd83a691d6540d7afb917e996eb8a7901dc3f3d IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0xe232775b60f3cc2358aeaa7dbdce5249e54efd07863c0d2771b3cd0828659ab1Approve147140062022-01-26 22:12:324 hrs 43 mins ago0xaf7a0436163b33f63ae97e63e7656a54f5697a8d IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0x31aeb9ee74441bf7a5246a042380ab7bb0da2321974e9e860bc7d8bbce28d7b7Approve147139482022-01-26 22:09:384 hrs 46 mins ago0xe40f5138bbd565380fdcc7bb225650d7419a48ca IN  Mars Ecosystem: XMS Token0 BNB0.000226035
0xe99c450ea57559e4872473b681559a668e0e5e35b5c6969a3529d2ee19b299d9Transfer147137502022-01-26 21:59:444 hrs 56 mins ago0x1b9b159e9c280c906a114b30a0f5bad88c1e0712 IN  Mars Ecosystem: XMS Token0 BNB0.00020087
[ Download CSV Export 

OVERVIEW

Mars Ecosystem builds the central bank and reserve currency for DeFi.

Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
XMSToken

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 12 : XMSToken.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

import "../interfaces/IXMSToken.sol";
import "../refs/CoreRef.sol";

// XMSToken with Governance.
contract XMSToken is IXMSToken, CoreRef {
    string public constant override name = "Mars Ecosystem Token";

    string public constant override symbol = "XMS";

    uint8 public constant override decimals = 18;

    /// @notice Total number of tokens in circulation
    uint256 public override totalSupply = 1_000_000_000e18;

    // Allowance amounts on behalf of others
    mapping(address => mapping(address => uint96)) internal _allowances;

    // Official record of token balances for each account
    mapping(address => uint96) internal _balances;

    /// @notice A record of each accounts delegate
    mapping(address => address) public override delegates;

    /// @notice A record of votes checkpoints for each account, by index
    mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;

    /// @notice The number of checkpoints for each account
    mapping(address => uint32) public numCheckpoints;

    /// @notice The EIP-712 typehash for the contract's domain
    bytes32 public constant DOMAIN_TYPEHASH =
        keccak256(
            "EIP712Domain(string name,uint256 chainId,address verifyingContract)"
        );

    /// @notice The EIP-712 typehash for the delegation struct used by the contract
    bytes32 public constant DELEGATION_TYPEHASH =
        keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

    /// @notice The EIP-712 typehash for the permit struct used by the contract
    bytes32 public constant PERMIT_TYPEHASH =
        keccak256(
            "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
        );

    /// @notice A record of states for signing / validating signatures
    mapping(address => uint256) public nonces;

    constructor(address _treasury, address _core) CoreRef(_core) {
        _balances[_treasury] = uint96(totalSupply);
        emit Transfer(address(0), _treasury, totalSupply);
    }

    function mint(address _to, uint256 _amount) external override onlyGovernor {
        require(_to != address(0), "XMSToken::mint: Zero address");
        uint96 amount =
            safe96(_amount, "XMSToken::mint: Amount exceeds 96 bits");
        uint96 safeSupply =
            safe96(totalSupply, "XMSToken::mint: TotalSupply exceeds 96 bits");
        totalSupply = add96(
            safeSupply,
            amount,
            "XMSToken::mint: TotalSupply exceeds 96 bits"
        );

        // transfer the amount to the recipient
        _balances[_to] = add96(
            _balances[_to],
            amount,
            "XMSToken::mint: Transfer amount overflows"
        );
        emit Transfer(address(0), _to, amount);

        // move delegates
        _moveDelegates(address(0), delegates[_to], amount);
    }

    /**
     * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
     * @param account The address of the account holding the funds
     * @param spender The address of the account spending the funds
     * @return The number of tokens approved
     */
    function allowance(address account, address spender)
        external
        view
        override
        returns (uint256)
    {
        return _allowances[account][spender];
    }

    /**
     * @notice Approve `spender` to transfer up to `amount` from `msg.sender`
     * @dev This will overwrite the approval amount for `spender`
     *  and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
     * @param spender The address of the account which may transfer tokens
     * @param amount The number of tokens that are approved (2^256-1 means infinite)
     * @return Whether or not the approval succeeded
     */
    function approve(address spender, uint256 amount)
        external
        override
        returns (bool)
    {
        uint96 amount_;
        if (amount == uint256(-1)) {
            amount_ = uint96(-1);
        } else {
            amount_ = safe96(
                amount,
                "XMSToken::approve: Amount exceeds 96 bits"
            );
        }

        _allowances[msg.sender][spender] = amount_;

        emit Approval(msg.sender, spender, amount_);
        return true;
    }

    /**
     * @notice Triggers an approval from owner to spends
     * @param owner The address to approve from
     * @param spender The address to be approved
     * @param amount The number of tokens that are approved (2^256-1 means infinite)
     * @param expiry The time at which to expire the signature
     * @param v The recovery byte of the signature
     * @param r Half of the ECDSA signature pair
     * @param s Half of the ECDSA signature pair
     */
    function permit(
        address owner,
        address spender,
        uint256 amount,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external override {
        uint96 amount_;
        if (amount == uint256(-1)) {
            amount_ = uint96(-1);
        } else {
            amount_ = safe96(
                amount,
                "XMSToken::permit: Amount exceeds 96 bits"
            );
        }
        bytes32 domainSeparator =
            keccak256(
                abi.encode(
                    DOMAIN_TYPEHASH,
                    keccak256(bytes(name)),
                    getChainId(),
                    address(this)
                )
            );

        bytes32 digest =
            keccak256(
                abi.encodePacked(
                    "\x19\x01",
                    domainSeparator,
                    keccak256(
                        abi.encode(
                            PERMIT_TYPEHASH,
                            owner,
                            spender,
                            amount,
                            nonce,
                            expiry
                        )
                    )
                )
            );
        address signatory = ecrecover(digest, v, r, s);
        require(signatory == owner, "XMSToken::permit: Unauthorized");
        require(nonce == nonces[owner]++, "XMSToken::permit: Invalid nonce");
        require(signatory != address(0), "XMSToken::permit: Invalid signature");

        require(
            block.timestamp <= expiry,
            "XMSToken::permit: Signature expired"
        );
        _allowances[owner][spender] = amount_;

        emit Approval(owner, spender, amount_);
    }

    /**
     * @notice Get the number of tokens held by the `account`
     * @param account The address of the account to get the balance of
     * @return The number of tokens held
     */
    function balanceOf(address account)
        external
        view
        override
        returns (uint256)
    {
        return _balances[account];
    }

    /**
     * @notice Transfer `amount` tokens from `msg.sender` to `to`
     * @param to The address of the destination account
     * @param rawAmount The number of tokens to transfer
     * @return Whether or not the transfer succeeded
     */
    function transfer(address to, uint256 rawAmount)
        external
        override
        returns (bool)
    {
        uint96 amount =
            safe96(rawAmount, "XMSToken::transfer: Amount exceeds 96 bits");
        _transferTokens(msg.sender, to, amount);
        return true;
    }

    /**
     * @notice Transfer `amount` tokens from `from` to `to`
     * @param from The address of the source account
     * @param to The address of the destination account
     * @param rawAmount The number of tokens to transfer
     * @return Whether or not the transfer succeeded
     */
    function transferFrom(
        address from,
        address to,
        uint256 rawAmount
    ) external override returns (bool) {
        address spender = msg.sender;
        uint96 spenderAllowance = _allowances[from][spender];
        uint96 amount =
            safe96(rawAmount, "XMSToken::transferFrom: Amount exceeds 96 bits");

        if (spender != from && spenderAllowance != uint96(-1)) {
            uint96 newAllowance =
                sub96(
                    spenderAllowance,
                    amount,
                    "XMSToken::transferFrom: Transfer amount exceeds spender allowance"
                );
            _allowances[from][spender] = newAllowance;

            emit Approval(from, spender, newAllowance);
        }

        _transferTokens(from, to, amount);
        return true;
    }

    /**
     * @notice Delegate votes from `msg.sender` to `delegatee`
     * @param delegatee The address to delegate votes to
     */
    function delegate(address delegatee) external override {
        return _delegate(msg.sender, delegatee);
    }

    /**
     * @notice Delegates votes from signatory to `delegatee`
     * @param delegatee The address to delegate votes to
     * @param nonce The contract state required to match the signature
     * @param expiry The time at which to expire the signature
     * @param v The recovery byte of the signature
     * @param r Half of the ECDSA signature pair
     * @param s Half of the ECDSA signature pair
     */
    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external override {
        bytes32 domainSeparator =
            keccak256(
                abi.encode(
                    DOMAIN_TYPEHASH,
                    keccak256(bytes(name)),
                    getChainId(),
                    address(this)
                )
            );

        bytes32 structHash =
            keccak256(
                abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)
            );

        bytes32 digest =
            keccak256(
                abi.encodePacked("\x19\x01", domainSeparator, structHash)
            );

        address signatory = ecrecover(digest, v, r, s);
        require(
            signatory != address(0),
            "XMSToken::delegateBySig: Invalid signature"
        );
        require(
            nonce == nonces[signatory]++,
            "XMSToken::delegateBySig: Invalid nonce"
        );
        require(
            block.timestamp <= expiry,
            "XMSToken::delegateBySig: Signature expired"
        );
        return _delegate(signatory, delegatee);
    }

    /**
     * @notice Gets the current votes balance for `account`
     * @param account The address to get votes balance
     * @return The number of current votes for `account`
     */
    function getCurrentVotes(address account)
        external
        view
        override
        returns (uint96)
    {
        uint32 nCheckpoints = numCheckpoints[account];
        return
            nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
    }

    /**
     * @notice Determine the prior number of votes for an account as of a block number
     * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
     * @param account The address of the account to check
     * @param blockNumber The block number to get the vote balance at
     * @return The number of votes the account had as of the given block
     */
    function getPriorVotes(address account, uint256 blockNumber)
        external
        view
        override
        returns (uint96)
    {
        require(
            blockNumber < block.number,
            "XMSToken::getPriorVotes: Not yet determined"
        );

        uint32 nCheckpoints = numCheckpoints[account];
        if (nCheckpoints == 0) {
            return 0;
        }

        // First check most recent balance
        if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
            return checkpoints[account][nCheckpoints - 1].votes;
        }

        // Next check implicit zero balance
        if (checkpoints[account][0].fromBlock > blockNumber) {
            return 0;
        }

        uint32 lower = 0;
        uint32 upper = nCheckpoints - 1;
        while (upper > lower) {
            uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
            Checkpoint memory cp = checkpoints[account][center];
            if (cp.fromBlock == blockNumber) {
                return cp.votes;
            } else if (cp.fromBlock < blockNumber) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return checkpoints[account][lower].votes;
    }

    function _delegate(address delegator, address delegatee) internal {
        address currentDelegate = delegates[delegator];
        uint96 delegatorBalance = _balances[delegator];
        delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);

        _moveDelegates(currentDelegate, delegatee, delegatorBalance);
    }

    function _transferTokens(
        address from,
        address to,
        uint96 amount
    ) internal {
        require(
            from != address(0),
            "XMSToken::_transferTokens: Cannot transfer from the zero address"
        );
        require(
            to != address(0),
            "XMSToken::_transferTokens: Cannot transfer to the zero address"
        );

        _balances[from] = sub96(
            _balances[from],
            amount,
            "XMSToken::_transferTokens: Transfer amount exceeds balance"
        );
        _balances[to] = add96(
            _balances[to],
            amount,
            "XMSToken::_transferTokens: Transfer amount overflows"
        );
        emit Transfer(from, to, amount);

        _moveDelegates(delegates[from], delegates[to], amount);
    }

    function _moveDelegates(
        address srcRep,
        address dstRep,
        uint96 amount
    ) internal {
        if (srcRep != dstRep && amount > 0) {
            if (srcRep != address(0)) {
                uint32 srcRepNum = numCheckpoints[srcRep];
                uint96 srcRepOld =
                    srcRepNum > 0
                        ? checkpoints[srcRep][srcRepNum - 1].votes
                        : 0;
                uint96 srcRepNew =
                    sub96(
                        srcRepOld,
                        amount,
                        "XMSToken::_moveDelegates: Vote amount overflows"
                    );
                _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
            }

            if (dstRep != address(0)) {
                uint32 dstRepNum = numCheckpoints[dstRep];
                uint96 dstRepOld =
                    dstRepNum > 0
                        ? checkpoints[dstRep][dstRepNum - 1].votes
                        : 0;
                uint96 dstRepNew =
                    add96(
                        dstRepOld,
                        amount,
                        "XMSToken::_moveDelegates: Vote amount overflows"
                    );
                _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
            }
        }
    }

    function _writeCheckpoint(
        address delegatee,
        uint32 nCheckpoints,
        uint96 oldVotes,
        uint96 newVotes
    ) internal {
        uint32 blockNumber =
            safe32(
                block.number,
                "XMSToken::_writeCheckpoint: Block number exceeds 32 bits"
            );

        if (
            nCheckpoints > 0 &&
            checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber
        ) {
            checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
        } else {
            checkpoints[delegatee][nCheckpoints] = Checkpoint(
                blockNumber,
                newVotes
            );
            numCheckpoints[delegatee] = nCheckpoints + 1;
        }

        emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
    }

    function safe32(uint256 n, string memory errorMessage)
        internal
        pure
        returns (uint32)
    {
        require(n < 2**32, errorMessage);
        return uint32(n);
    }

    function safe96(uint256 n, string memory errorMessage)
        internal
        pure
        returns (uint96)
    {
        require(n < 2**96, errorMessage);
        return uint96(n);
    }

    function add96(
        uint96 a,
        uint96 b,
        string memory errorMessage
    ) internal pure returns (uint96) {
        uint96 c = a + b;
        require(c >= a, errorMessage);
        return c;
    }

    function sub96(
        uint96 a,
        uint96 b,
        string memory errorMessage
    ) internal pure returns (uint96) {
        require(b <= a, errorMessage);
        return a - b;
    }

    function getChainId() internal pure returns (uint256) {
        uint256 chainId;
        assembly {
            chainId := chainid()
        }
        return chainId;
    }
}

File 2 of 12 : ICore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;

import "./IPermissions.sol";
import "../interfaces/IXMSToken.sol";
import "../interfaces/IUSDMToken.sol";

/// @title Core Interface
/// @author USDM Protocol
interface ICore is IPermissions {
    // ----------- Events -----------

    event XMSSupportRatioUpdate(uint256 _xmsSupportRatio);
    event USDMUpdate(address indexed _usdm);
    event XMSUpdate(address indexed _xms);
    event GenesisGroupUpdate(address indexed _genesisGroup);
    event TokenAllocation(address indexed _to, uint256 _amount);
    event TokenApprove(address indexed _to, uint256 _amount);
    event GenesisPeriodComplete(uint256 _timestamp);

    // ----------- Governor only state changing api -----------

    function setXMSSupportRatio(uint256 _xmsSupportRatio) external;

    function setUSDM(address token) external;

    function setXMS(address token) external;

    function setGenesisGroup(address _genesisGroup) external;

    function allocateXMS(address to, uint256 amount) external;

    function allocateToken(
        address token,
        address to,
        uint256 amount
    ) external;

    function approveXMS(address to, uint256 amount) external;

    function approveToken(
        address token,
        address to,
        uint256 amount
    ) external;

    function setApprovedPairAndContract(address _pair, address _contract)
        external;

    function removeApprovedPairAndContract(address _pair, address _contract)
        external;

    // ----------- Genesis Group only state changing api -----------

    function completeGenesisGroup() external;

    // ----------- Getters -----------

    function getApprovedPairsLength() external view returns (uint256);

    function getApprovedContractsLength(address _pair)
        external
        view
        returns (uint256);

    function approvedPairs(uint256 idx) external view returns (address);

    function approvedPairExisted(address pair) external view returns (bool);

    function approvedContracts(address pair, uint256 idx)
        external
        view
        returns (address);

    function approvedContractExisted(address pair, address _contract)
        external
        view
        returns (bool);

    function xmsSupportRatio() external view returns (uint256);

    function xmsSupportRatioPrecision() external view returns (uint256);

    function usdm() external view returns (IUSDMToken);

    function xms() external view returns (IXMSToken);

    function genesisGroup() external view returns (address);

    function hasGenesisGroupCompleted() external view returns (bool);
}

File 3 of 12 : ICoreRef.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;

import "./ICore.sol";

/// @title CoreRef interface
/// @author USDM Protocol
interface ICoreRef {
    // ----------- Events -----------

    event CoreUpdate(address indexed _core);

    // ----------- Governor only state changing api -----------

    function setCore(address core_) external;

    function pause() external;

    function unpause() external;

    // ----------- Getters -----------

    function core() external view returns (ICore);

    function usdm() external view returns (IUSDMToken);

    function xms() external view returns (IXMSToken);

    function usdmBalance() external view returns (uint256);

    function xmsBalance() external view returns (uint256);

    function getUSDMAmountGovernance() external view returns (uint256);
}

File 4 of 12 : IPermissions.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;

/// @title Permissions interface
/// @author USDM Protocol
interface IPermissions {
    // ----------- Governor only state changing api -----------

    function createRole(bytes32 role, bytes32 adminRole) external;

    function grantMinter(address minter) external;

    function grantBurner(address burner) external;

    function grantPCVController(address pcvController) external;

    function grantGovernor(address governor) external;

    function grantGuardian(address guardian) external;

    function revokeMinter(address minter) external;

    function revokeBurner(address burner) external;

    function revokePCVController(address pcvController) external;

    function revokeGovernor(address governor) external;

    function revokeGuardian(address guardian) external;

    // ----------- Revoker only state changing api -----------

    function revokeOverride(bytes32 role, address account) external;

    // ----------- Getters -----------

    function isBurner(address _address) external view returns (bool);

    function isMinter(address _address) external view returns (bool);

    function isGovernor(address _address) external view returns (bool);

    function isGuardian(address _address) external view returns (bool);

    function isPCVController(address _address) external view returns (bool);
}

File 5 of 12 : IUSDMToken.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IUSDMToken is IERC20 {
    // ----------- Minter State changing api -----------

    function mint(address _to, uint256 _amount) external;

    // ----------- Burner State changing api -----------

    // ----------- State changing api -----------

    function burn(uint256 _amount) external;

    function permit(
        address owner,
        address spender,
        uint256 amount,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

File 6 of 12 : IXMSToken.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IXMSToken is IERC20 {
    struct Checkpoint {
        uint32 fromBlock;
        uint96 votes;
    }

    // ----------- Events -----------

    /// @notice An event thats emitted when an account changes its delegate
    event DelegateChanged(
        address indexed delegator,
        address indexed fromDelegate,
        address indexed toDelegate
    );

    /// @notice An event thats emitted when a delegate account's vote balance changes
    event DelegateVotesChanged(
        address indexed delegate,
        uint256 previousBalance,
        uint256 newBalance
    );

    // ----------- Minter State changing api -----------

    function mint(address _to, uint256 _amount) external;

    // ----------- State changing api -----------

    function permit(
        address owner,
        address spender,
        uint256 amount,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    function delegates(address delegator) external view returns (address);

    function delegate(address delegatee) external;

    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    // ----------- Getters -----------

    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function getCurrentVotes(address account) external view returns (uint96);

    function getPriorVotes(address account, uint256 blockNumber)
        external
        view
        returns (uint96);
}

File 7 of 12 : CoreRef.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;

import "../interfaces/ICoreRef.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";

/// @title A Reference to Core
/// @author USDM Protocol
/// @notice Defines some modifiers and utilities around interacting with Core
abstract contract CoreRef is ICoreRef, Pausable {
    using SafeMath for uint256;

    ICore private _core;

    /// @notice CoreRef constructor
    /// @param core_ USDM Core to reference
    constructor(address core_) {
        _core = ICore(core_);
    }

    modifier ifMinterSelf() {
        if (_core.isMinter(address(this))) {
            _;
        }
    }

    modifier ifBurnerSelf() {
        if (_core.isBurner(address(this))) {
            _;
        }
    }

    modifier onlyMinter() {
        require(
            _core.isMinter(msg.sender),
            "CoreRef::onlyMinter: Caller is not a minter"
        );
        _;
    }

    modifier onlyBurner() {
        require(
            _core.isBurner(msg.sender),
            "CoreRef::onlyBurner: Caller is not a burner"
        );
        _;
    }

    modifier onlyPCVController() {
        require(
            _core.isPCVController(msg.sender),
            "CoreRef::onlyPCVController: Caller is not a PCV controller"
        );
        _;
    }

    modifier onlyGovernor() {
        require(
            _core.isGovernor(msg.sender),
            "CoreRef::onlyGovernor: Caller is not a governor"
        );
        _;
    }

    modifier onlyGuardianOrGovernor() {
        require(
            _core.isGovernor(msg.sender) || _core.isGuardian(msg.sender),
            "CoreRef::onlyGuardianOrGovernor: Caller is not a guardian or governor"
        );
        _;
    }

    modifier onlyUSDM() {
        require(
            msg.sender == address(usdm()),
            "CoreRef::onlyUSDM: Caller is not USDM"
        );
        _;
    }

    modifier onlyGenesisGroup() {
        require(
            msg.sender == _core.genesisGroup(),
            "CoreRef::onlyGenesisGroup: Caller is not GenesisGroup"
        );
        _;
    }

    modifier postGenesis() {
        require(
            _core.hasGenesisGroupCompleted(),
            "CoreRef::postGenesis: Still in genesis period"
        );
        _;
    }

    modifier nonContract() {
        require(
            !Address.isContract(msg.sender),
            "CoreRef::nonContract: Caller is a contract"
        );
        _;
    }

    /// @notice Set new Core reference address
    /// @param core_ The new core address
    function setCore(address core_) external override onlyGovernor {
        _core = ICore(core_);
        emit CoreUpdate(core_);
    }

    /// @notice Set pausable methods to paused
    function pause() public override onlyGuardianOrGovernor {
        _pause();
    }

    /// @notice Set pausable methods to unpaused
    function unpause() public override onlyGuardianOrGovernor {
        _unpause();
    }

    /// @notice Address of the Core contract referenced
    /// @return ICore implementation address
    function core() public view override returns (ICore) {
        return _core;
    }

    /// @notice Address of the USDM contract referenced by Core
    /// @return IUSDMToken implementation address
    function usdm() public view override returns (IUSDMToken) {
        return _core.usdm();
    }

    /// @notice Address of the XMS contract referenced by Core
    /// @return IUSDMToken implementation address
    function xms() public view override returns (IXMSToken) {
        return _core.xms();
    }

    /// @notice USDM balance of contract
    /// @return USDM amount held
    function usdmBalance() public view override returns (uint256) {
        return usdm().balanceOf(address(this));
    }

    /// @notice XMS balance of contract
    /// @return XMS amount held
    function xmsBalance() public view override returns (uint256) {
        return xms().balanceOf(address(this));
    }

    /// @notice Calculate the usdm amount of governance
    function getUSDMAmountGovernance()
        public
        view
        override
        returns (uint256 usdmAmount)
    {
        address pair;
        address _contract;
        for (uint256 i; i < core().getApprovedPairsLength(); i++) {
            pair = core().approvedPairs(i);
            for (uint256 j; j < core().getApprovedContractsLength(pair); j++) {
                _contract = core().approvedContracts(pair, j);
                usdmAmount += core()
                    .usdm()
                    .balanceOf(pair)
                    .mul(IERC20(pair).balanceOf(_contract))
                    .div(IERC20(pair).totalSupply());
            }
        }
    }

    function _burnUSDMHeld() internal {
        usdm().burn(usdmBalance());
    }

    function _mintUSDM(uint256 amount) internal {
        usdm().mint(address(this), amount);
    }
}

File 8 of 12 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 9 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 10 of 12 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 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://diligence.consensys.net/posts/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.5.11/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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 11 of 12 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 12 of 12 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./Context.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 Pausable is Context {
    /**
     * @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.
     */
    constructor () internal {
        _paused = false;
    }

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

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

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        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());
    }
}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "istanbul",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_core","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_core","type":"address"}],"name":"CoreUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DELEGATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"checkpoints","outputs":[{"internalType":"uint32","name":"fromBlock","type":"uint32"},{"internalType":"uint96","name":"votes","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"core","outputs":[{"internalType":"contract ICore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getCurrentVotes","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getPriorVotes","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUSDMAmountGovernance","outputs":[{"internalType":"uint256","name":"usdmAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"core_","type":"address"}],"name":"setCore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"rawAmount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"rawAmount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdm","outputs":[{"internalType":"contract IUSDMToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdmBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xms","outputs":[{"internalType":"contract IXMSToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xmsBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040526b033b2e3c9fd0803ce800000060015534801561002057600080fd5b50604051612efe380380612efe8339818101604052604081101561004357600080fd5b508051602091820151600080546001600160a81b0319166101006001600160a01b03808516919091029190911782556001805491851680845260038752604080852080546001600160601b0319166001600160601b03909516949094179093559054825190815291519495939490937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a35050612e13806100eb6000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c806370a082311161010f578063b4b5ea57116100a2578063e7a324dc11610071578063e7a324dc1461061e578063ee138d0f14610626578063f1127ed81461062e578063f2f4eb2614610688576101f0565b8063b4b5ea571461052b578063c3cda52014610551578063dbaef5e014610598578063dd62ed3e146105f0576101f0565b8063835c5cbb116100de578063835c5cbb146104e75780638456cb59146104ef57806395d89b41146104f7578063a9059cbb146104ff576101f0565b806370a082311461042d578063782d6fe1146104535780637ecebe001461049b57806380009630146104c1576101f0565b806330adf81f11610187578063587cde1e11610156578063587cde1e1461037e5780635c19a95c146103c05780635c975abb146103e65780636fcfff45146103ee576101f0565b806330adf81f14610322578063313ce5671461032a5780633f4ba83a1461034857806340c10f1914610352576101f0565b806320606b70116101c357806320606b70146102d457806323b872dd146102dc57806326f87c01146103125780632e6e35b91461031a576101f0565b806306fdde03146101f5578063095ea7b3146102725780630f057c23146102b257806318160ddd146102cc575b600080fd5b6101fd610690565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561023757818101518382015260200161021f565b50505050905090810190601f1680156102645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61029e6004803603604081101561028857600080fd5b506001600160a01b0381351690602001356106c0565b604080519115158252519081900360200190f35b6102ba61077e565b60408051918252519081900360200190f35b6102ba610808565b6102ba61080e565b61029e600480360360608110156102f257600080fd5b506001600160a01b03813581169160208101359091169060400135610832565b6102ba610977565b6102ba610da4565b6102ba610dae565b610332610dd2565b6040805160ff9092168252519081900360200190f35b610350610dd7565b005b6103506004803603604081101561036857600080fd5b506001600160a01b038135169060200135610f14565b6103a46004803603602081101561039457600080fd5b50356001600160a01b0316611169565b604080516001600160a01b039092168252519081900360200190f35b610350600480360360208110156103d657600080fd5b50356001600160a01b0316611184565b61029e611191565b6104146004803603602081101561040457600080fd5b50356001600160a01b031661119a565b6040805163ffffffff9092168252519081900360200190f35b6102ba6004803603602081101561044357600080fd5b50356001600160a01b03166111b2565b61047f6004803603604081101561046957600080fd5b506001600160a01b0381351690602001356111d6565b604080516001600160601b039092168252519081900360200190f35b6102ba600480360360208110156104b157600080fd5b50356001600160a01b03166113fe565b610350600480360360208110156104d757600080fd5b50356001600160a01b0316611410565b6103a4611500565b610350611587565b6101fd6116b9565b61029e6004803603604081101561051557600080fd5b506001600160a01b0381351690602001356116d8565b61047f6004803603602081101561054157600080fd5b50356001600160a01b0316611714565b610350600480360360c081101561056757600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a00135611785565b61035060048036036101008110156105af57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060ff60a0820135169060c08101359060e00135611a36565b6102ba6004803603604081101561060657600080fd5b506001600160a01b0381358116916020013516611e66565b6102ba611e9a565b6103a4611ebe565b6106606004803603604081101561064457600080fd5b5080356001600160a01b0316906020013563ffffffff16611f0d565b6040805163ffffffff90931683526001600160601b0390911660208301528051918290030190f35b6103a4611f42565b6040518060400160405280601481526020017326b0b9399022b1b7b9bcb9ba32b6902a37b5b2b760611b81525081565b6000806000198314156106d657506000196106fb565b6106f883604051806060016040528060298152602001612d1260299139611f56565b90505b3360008181526002602090815260408083206001600160a01b0389168085529083529281902080546001600160601b0319166001600160601b038716908117909155815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a360019150505b92915050565b6000610788611ebe565b6001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016107b39190612915565b60206040518083038186803b1580156107cb57600080fd5b505afa1580156107df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080391906128fd565b905090565b60015481565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6001600160a01b03831660009081526002602090815260408083203380855290835281842054825160608101909352602e80845291936001600160601b0390911692859261088a9288929190612b6290830139611f56565b9050866001600160a01b0316836001600160a01b0316141580156108b757506001600160601b0382811614155b1561095f5760006108e18383604051806080016040528060418152602001612b2160419139611ff0565b6001600160a01b038981166000818152600260209081526040808320948a168084529482529182902080546001600160601b0319166001600160601b03871690811790915582519081529151949550929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592918290030190a3505b61096a87878361205d565b5060019695505050505050565b6000806000805b610986611f42565b6001600160a01b031663d200a2186040518163ffffffff1660e01b815260040160206040518083038186803b1580156109be57600080fd5b505afa1580156109d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f691906128fd565b811015610d9e57610a05611f42565b6001600160a01b03166379c9679b826040518263ffffffff1660e01b8152600401610a3091906129fc565b60206040518083038186803b158015610a4857600080fd5b505afa158015610a5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8091906128c1565b925060005b610a8d611f42565b6001600160a01b03166380e2b70e856040518263ffffffff1660e01b8152600401610ab89190612915565b60206040518083038186803b158015610ad057600080fd5b505afa158015610ae4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0891906128fd565b811015610d9557610b17611f42565b6001600160a01b031663a0a01d9d85836040518363ffffffff1660e01b8152600401610b44929190612929565b60206040518083038186803b158015610b5c57600080fd5b505afa158015610b70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9491906128c1565b9250610d89846001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a91906128fd565b6040516370a0823160e01b8152610d83906001600160a01b038816906370a0823190610c3a908990600401612915565b60206040518083038186803b158015610c5257600080fd5b505afa158015610c66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8a91906128fd565b610c92611f42565b6001600160a01b031663ee138d0f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610cca57600080fd5b505afa158015610cde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0291906128c1565b6001600160a01b03166370a08231896040518263ffffffff1660e01b8152600401610d2d9190612915565b60206040518083038186803b158015610d4557600080fd5b505afa158015610d59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7d91906128fd565b90612242565b9061229b565b90940193600101610a85565b5060010161097e565b50505090565b6000610788611500565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b600054604051631c86b03760e31b81526101009091046001600160a01b03169063e43581b890610e0b903390600401612915565b60206040518083038186803b158015610e2357600080fd5b505afa158015610e37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5b91906128dd565b80610ee55750600054604051630c68ba2160e01b81526101009091046001600160a01b031690630c68ba2190610e95903390600401612915565b60206040518083038186803b158015610ead57600080fd5b505afa158015610ec1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee591906128dd565b610f0a5760405162461bcd60e51b8152600401610f0190612991565b60405180910390fd5b610f12612302565b565b600054604051631c86b03760e31b81526101009091046001600160a01b03169063e43581b890610f48903390600401612915565b60206040518083038186803b158015610f6057600080fd5b505afa158015610f74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9891906128dd565b610fb45760405162461bcd60e51b8152600401610f0190612942565b6001600160a01b03821661100f576040805162461bcd60e51b815260206004820152601c60248201527f584d53546f6b656e3a3a6d696e743a205a65726f206164647265737300000000604482015290519081900360640190fd5b600061103382604051806060016040528060268152602001612db860269139611f56565b9050600061105b6001546040518060600160405280602b8152602001612abe602b9139611f56565b905061108081836040518060600160405280602b8152602001612abe602b91396123a2565b6001600160601b039081166001556001600160a01b0385166000908152600360209081526040918290205482516060810190935260298084526110d39491909116928692909190612bba908301396123a2565b6001600160a01b038516600081815260036020908152604080832080546001600160601b0319166001600160601b039687161790558051948716855251929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a36001600160a01b0380851660009081526004602052604081205461116392168461240c565b50505050565b6004602052600090815260409020546001600160a01b031681565b61118e338261259e565b50565b60005460ff1690565b60066020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600360205260409020546001600160601b031690565b60004382106112165760405162461bcd60e51b815260040180806020018281038252602b815260200180612a55602b913960400191505060405180910390fd5b6001600160a01b03831660009081526006602052604090205463ffffffff1680611244576000915050610778565b6001600160a01b038416600090815260056020908152604080832063ffffffff6000198601811685529252909120541683106112c0576001600160a01b03841660009081526005602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b03169050610778565b6001600160a01b038416600090815260056020908152604080832083805290915290205463ffffffff168310156112fb576000915050610778565b600060001982015b8163ffffffff168163ffffffff1611156113b9576000600263ffffffff848403166001600160a01b038916600090815260056020908152604080832094909304860363ffffffff818116845294825291839020835180850190945254938416808452600160201b9094046001600160601b031690830152925090871415611394576020015194506107789350505050565b805163ffffffff168711156113ab578193506113b2565b6001820392505b5050611303565b506001600160a01b038516600090815260056020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60076020526000908152604090205481565b600054604051631c86b03760e31b81526101009091046001600160a01b03169063e43581b890611444903390600401612915565b60206040518083038186803b15801561145c57600080fd5b505afa158015611470573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149491906128dd565b6114b05760405162461bcd60e51b8152600401610f0190612942565b60008054610100600160a81b0319166101006001600160a01b03841690810291909117825560405190917fad9400e618eb1344fde53db22397a1b82c765527ecbba3a5c86bcac15090828b91a250565b60008060019054906101000a90046001600160a01b03166001600160a01b031663835c5cbb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561154f57600080fd5b505afa158015611563573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080391906128c1565b600054604051631c86b03760e31b81526101009091046001600160a01b03169063e43581b8906115bb903390600401612915565b60206040518083038186803b1580156115d357600080fd5b505afa1580156115e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160b91906128dd565b806116955750600054604051630c68ba2160e01b81526101009091046001600160a01b031690630c68ba2190611645903390600401612915565b60206040518083038186803b15801561165d57600080fd5b505afa158015611671573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061169591906128dd565b6116b15760405162461bcd60e51b8152600401610f0190612991565b610f12612622565b60405180604001604052806003815260200162584d5360e81b81525081565b6000806116fd836040518060600160405280602a8152602001612c30602a9139611f56565b905061170a33858361205d565b5060019392505050565b6001600160a01b03811660009081526006602052604081205463ffffffff168061173f57600061177e565b6001600160a01b0383166000908152600560209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03165b9392505050565b60408051808201909152601481527326b0b9399022b1b7b9bcb9ba32b6902a37b5b2b760611b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fe59041d2f68de3427e75b26a4f72e5df2c500f8e230c11eafa42bb95fd34d2016117fd6126a5565b60408051602080820195909552808201939093526060830191909152306080808401919091528151808403909101815260a0830182528051908401207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c08401526001600160a01b038b1660e084015261010083018a90526101208084018a9052825180850390910181526101408401835280519085012061190160f01b6101608501526101628401829052610182808501829052835180860390910181526101a285018085528151918701919091206000918290526101c2860180865281905260ff8b166101e287015261020286018a90526102228601899052935192965090949293909260019261024280840193601f198301929081900390910190855afa158015611930573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166119825760405162461bcd60e51b815260040180806020018281038252602a815260200180612c06602a913960400191505060405180910390fd5b6001600160a01b038116600090815260076020526040902080546001810190915589146119e05760405162461bcd60e51b8152600401808060200182810382526026815260200180612d926026913960400191505060405180910390fd5b87421115611a1f5760405162461bcd60e51b815260040180806020018281038252602a815260200180612b90602a913960400191505060405180910390fd5b611a29818b61259e565b505050505b505050505050565b6000600019871415611a4b5750600019611a70565b611a6d87604051806060016040528060288152602001612c5a60289139611f56565b90505b60408051808201909152601481527326b0b9399022b1b7b9bcb9ba32b6902a37b5b2b760611b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fe59041d2f68de3427e75b26a4f72e5df2c500f8e230c11eafa42bb95fd34d201611ae86126a5565b60408051602080820195909552808201939093526060830191909152306080808401919091528151808403909101815260a0830182528051908401207f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c960c08401526001600160a01b038e811660e08501528d1661010084015261012083018c905261014083018b90526101608084018b9052825180850390910181526101808401835280519085012061190160f01b6101a08501526101a284018290526101c280850191909152825180850390910181526101e28401808452815191860191909120600091829052610202850180855281905260ff8b1661022286015261024285018a90526102628501899052925191955091939192600192610282808301939192601f198301929081900390910190855afa158015611c2d573d6000803e3d6000fd5b5050506020604051035190508b6001600160a01b0316816001600160a01b031614611c9f576040805162461bcd60e51b815260206004820152601e60248201527f584d53546f6b656e3a3a7065726d69743a20556e617574686f72697a65640000604482015290519081900360640190fd5b6001600160a01b038c1660009081526007602052604090208054600181019091558914611d13576040805162461bcd60e51b815260206004820152601f60248201527f584d53546f6b656e3a3a7065726d69743a20496e76616c6964206e6f6e636500604482015290519081900360640190fd5b6001600160a01b038116611d585760405162461bcd60e51b8152600401808060200182810382526023815260200180612d6f6023913960400191505060405180910390fd5b87421115611d975760405162461bcd60e51b8152600401808060200182810382526023815260200180612be36023913960400191505060405180910390fd5b83600260008e6001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055508a6001600160a01b03168c6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258660405180826001600160601b0316815260200191505060405180910390a3505050505050505050505050565b6001600160a01b0391821660009081526002602090815260408083209390941682529190915220546001600160601b031690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b60008060019054906101000a90046001600160a01b03166001600160a01b031663ee138d0f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561154f57600080fd5b600560209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b60005461010090046001600160a01b031690565b600081600160601b8410611fe85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611fad578181015183820152602001611f95565b50505050905090810190601f168015611fda5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509192915050565b6000836001600160601b0316836001600160601b0316111582906120555760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611fad578181015183820152602001611f95565b505050900390565b6001600160a01b0383166120a25760405162461bcd60e51b8152600401808060200182810382526040815260200180612c826040913960400191505060405180910390fd5b6001600160a01b0382166120e75760405162461bcd60e51b815260040180806020018281038252603e815260200180612a80603e913960400191505060405180910390fd5b6001600160a01b03831660009081526003602090815260409182902054825160608101909352603a808452612132936001600160601b039092169285929190612a1b90830139611ff0565b6001600160a01b03848116600090815260036020908152604080832080546001600160601b0319166001600160601b0396871617905592861682529082902054825160608101909352603480845261219a9491909116928592909190612d3b908301396123a2565b6001600160a01b0383811660008181526003602090815260409182902080546001600160601b0319166001600160601b039687161790558151948616855290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a36001600160a01b0380841660009081526004602052604080822054858416835291205461223d9291821691168361240c565b505050565b60008261225157506000610778565b8282028284828161225e57fe5b041461177e5760405162461bcd60e51b8152600401808060200182810382526021815260200180612cf16021913960400191505060405180910390fd5b60008082116122f1576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816122fa57fe5b049392505050565b61230a611191565b612352576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6123856126a9565b604080516001600160a01b039092168252519081900360200190a1565b6000838301826001600160601b0380871690831610156124035760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611fad578181015183820152602001611f95565b50949350505050565b816001600160a01b0316836001600160a01b03161415801561243757506000816001600160601b0316115b1561223d576001600160a01b038316156124ef576001600160a01b03831660009081526006602052604081205463ffffffff1690816124775760006124b6565b6001600160a01b0385166000908152600560209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006124dd82856040518060600160405280602f8152602001612cc2602f9139611ff0565b90506124eb868484846126ad565b5050505b6001600160a01b0382161561223d576001600160a01b03821660009081526006602052604081205463ffffffff16908161252a576000612569565b6001600160a01b0384166000908152600560209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061259082856040518060600160405280602f8152602001612cc2602f91396123a2565b9050611a2e858484846126ad565b6001600160a01b03808316600081815260046020818152604080842080546003845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461116382848361240c565b61262a611191565b1561266f576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586123856126a9565b4690565b3390565b60006126d143604051806060016040528060388152602001612ae96038913961286c565b905060008463ffffffff1611801561271a57506001600160a01b038516600090815260056020908152604080832063ffffffff6000198901811685529252909120548282169116145b15612779576001600160a01b0385166000908152600560209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b03851602179055612818565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600583528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600690935292909220805460018801909316929091169190911790555b604080516001600160601b0380861682528416602082015281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b600081600160201b8410611fe85760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611fad578181015183820152602001611f95565b6000602082840312156128d2578081fd5b815161177e81612a05565b6000602082840312156128ee578081fd5b8151801515811461177e578182fd5b60006020828403121561290e578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252602f908201527f436f72655265663a3a6f6e6c79476f7665726e6f723a2043616c6c657220697360408201526e103737ba10309033b7bb32b93737b960891b606082015260800190565b60208082526045908201527f436f72655265663a3a6f6e6c79477561726469616e4f72476f7665726e6f723a60408201527f2043616c6c6572206973206e6f74206120677561726469616e206f7220676f7660608201526432b93737b960d91b608082015260a00190565b90815260200190565b6001600160a01b038116811461118e57600080fdfe584d53546f6b656e3a3a5f7472616e73666572546f6b656e733a205472616e7366657220616d6f756e7420657863656564732062616c616e6365584d53546f6b656e3a3a6765745072696f72566f7465733a204e6f74207965742064657465726d696e6564584d53546f6b656e3a3a5f7472616e73666572546f6b656e733a2043616e6e6f74207472616e7366657220746f20746865207a65726f2061646472657373584d53546f6b656e3a3a6d696e743a20546f74616c537570706c7920657863656564732039362062697473584d53546f6b656e3a3a5f7772697465436865636b706f696e743a20426c6f636b206e756d62657220657863656564732033322062697473584d53546f6b656e3a3a7472616e7366657246726f6d3a205472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365584d53546f6b656e3a3a7472616e7366657246726f6d3a20416d6f756e7420657863656564732039362062697473584d53546f6b656e3a3a64656c656761746542795369673a205369676e61747572652065787069726564584d53546f6b656e3a3a6d696e743a205472616e7366657220616d6f756e74206f766572666c6f7773584d53546f6b656e3a3a7065726d69743a205369676e61747572652065787069726564584d53546f6b656e3a3a64656c656761746542795369673a20496e76616c6964207369676e6174757265584d53546f6b656e3a3a7472616e736665723a20416d6f756e7420657863656564732039362062697473584d53546f6b656e3a3a7065726d69743a20416d6f756e7420657863656564732039362062697473584d53546f6b656e3a3a5f7472616e73666572546f6b656e733a2043616e6e6f74207472616e736665722066726f6d20746865207a65726f2061646472657373584d53546f6b656e3a3a5f6d6f766544656c6567617465733a20566f746520616d6f756e74206f766572666c6f7773536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77584d53546f6b656e3a3a617070726f76653a20416d6f756e7420657863656564732039362062697473584d53546f6b656e3a3a5f7472616e73666572546f6b656e733a205472616e7366657220616d6f756e74206f766572666c6f7773584d53546f6b656e3a3a7065726d69743a20496e76616c6964207369676e6174757265584d53546f6b656e3a3a64656c656761746542795369673a20496e76616c6964206e6f6e6365584d53546f6b656e3a3a6d696e743a20416d6f756e7420657863656564732039362062697473a2646970667358221220bfeaf4134bc6100fd84d8a11eb0155066b0ab42b49189d86ceb0a3d4f68574e464736f6c634300070600330000000000000000000000004596486669c23fedcafe2da6dd8daebd37bb8dcf00000000000000000000000000789cfb69499c65ac9a3a68fb4917c9b4fca2a7

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

0000000000000000000000004596486669c23fedcafe2da6dd8daebd37bb8dcf00000000000000000000000000789cfb69499c65ac9a3a68fb4917c9b4fca2a7

-----Decoded View---------------
Arg [0] : _treasury (address): 0x4596486669c23fedcafe2da6dd8daebd37bb8dcf
Arg [1] : _core (address): 0x00789cfb69499c65ac9a3a68fb4917c9b4fca2a7

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000004596486669c23fedcafe2da6dd8daebd37bb8dcf
Arg [1] : 00000000000000000000000000789cfb69499c65ac9a3a68fb4917c9b4fca2a7


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.