Sepolia Testnet

Contract

0x37984b6aDAe5a223fbc4CE3F7C8B9eB210e78FBC

Overview

ETH Balance

0 ETH

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Bridge Synth72341622024-12-08 3:22:482 mins ago1733628168IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000495671.50002827
Bridge Synth72339652024-12-08 2:41:0044 mins ago1733625660IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000000330.00102394
Bridge Synth72335032024-12-08 1:03:482 hrs ago1733619828IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000495681.50000003
Bridge Synth72333342024-12-08 0:28:362 hrs ago1733617716IN
0x37984b6a...210e78FBC
0.00263789 ETH0.000000580.00120001
Bridge Synth72333332024-12-08 0:28:242 hrs ago1733617704IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000000390.00120001
Bridge Synth72331962024-12-07 23:59:363 hrs ago1733615976IN
0x37984b6a...210e78FBC
0.00263789 ETH0.000736081.50000001
Bridge Synth72329632024-12-07 23:09:364 hrs ago1733612976IN
0x37984b6a...210e78FBC
0.00544793 ETH0.000000160.00101001
Bridge Synth72328992024-12-07 22:55:244 hrs ago1733612124IN
0x37984b6a...210e78FBC
0.00544793 ETH0.000000160.00101001
Bridge Synth72328942024-12-07 22:54:244 hrs ago1733612064IN
0x37984b6a...210e78FBC
0.00544793 ETH0.000000160.00101001
Bridge Synth72328042024-12-07 22:35:244 hrs ago1733610924IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000495661.50000001
Bridge Synth72327832024-12-07 22:31:124 hrs ago1733610672IN
0x37984b6a...210e78FBC
0.00544793 ETH0.000245021.50000001
Bridge Synth72325732024-12-07 21:47:485 hrs ago1733608068IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000000360.00110273
Bridge Synth72324682024-12-07 21:25:126 hrs ago1733606712IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000495681.50005842
Bridge Synth72324332024-12-07 21:18:006 hrs ago1733606280IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000495711.50012935
Bridge Synth72323352024-12-07 20:57:006 hrs ago1733605020IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000000460.0013929
Bridge Synth72322382024-12-07 20:35:366 hrs ago1733603736IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000495821.5003009
Bridge Synth72322102024-12-07 20:29:246 hrs ago1733603364IN
0x37984b6a...210e78FBC
0.00081393 ETH0.00000070.00212634
Bridge Synth72320102024-12-07 19:47:007 hrs ago1733600820IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000495811.50037967
Bridge Synth72319972024-12-07 19:44:247 hrs ago1733600664IN
0x37984b6a...210e78FBC
0.00263789 ETH0.00073631.50043156
Bridge Synth72319572024-12-07 19:36:247 hrs ago1733600184IN
0x37984b6a...210e78FBC
0.00130948 ETH0.000736331.50056106
Bridge Synth72317682024-12-07 18:56:248 hrs ago1733597784IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000496571.50268997
Bridge Synth72315672024-12-07 18:14:129 hrs ago1733595252IN
0x37984b6a...210e78FBC
0.00130948 ETH0.000497091.01304877
Bridge Synth72315632024-12-07 18:13:249 hrs ago1733595204IN
0x37984b6a...210e78FBC
0.0199345 ETH0.000193071.01278421
Bridge Synth72314552024-12-07 17:50:369 hrs ago1733593836IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000014380.04351699
Bridge Synth72312992024-12-07 17:18:2410 hrs ago1733591904IN
0x37984b6a...210e78FBC
0.00081393 ETH0.000079670.24112339
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
72341622024-12-08 3:22:482 mins ago1733628168
0x37984b6a...210e78FBC
0.00081393 ETH
72339652024-12-08 2:41:0044 mins ago1733625660
0x37984b6a...210e78FBC
0.00081393 ETH
72335032024-12-08 1:03:482 hrs ago1733619828
0x37984b6a...210e78FBC
0.00081393 ETH
72333342024-12-08 0:28:362 hrs ago1733617716
0x37984b6a...210e78FBC
0.00263789 ETH
72333332024-12-08 0:28:242 hrs ago1733617704
0x37984b6a...210e78FBC
0.00081393 ETH
72331962024-12-07 23:59:363 hrs ago1733615976
0x37984b6a...210e78FBC
0.00263789 ETH
72329632024-12-07 23:09:364 hrs ago1733612976
0x37984b6a...210e78FBC
0.00544793 ETH
72328992024-12-07 22:55:244 hrs ago1733612124
0x37984b6a...210e78FBC
0.00544793 ETH
72328942024-12-07 22:54:244 hrs ago1733612064
0x37984b6a...210e78FBC
0.00544793 ETH
72328042024-12-07 22:35:244 hrs ago1733610924
0x37984b6a...210e78FBC
0.00081393 ETH
72327832024-12-07 22:31:124 hrs ago1733610672
0x37984b6a...210e78FBC
0.00544793 ETH
72325732024-12-07 21:47:485 hrs ago1733608068
0x37984b6a...210e78FBC
0.00081393 ETH
72324682024-12-07 21:25:126 hrs ago1733606712
0x37984b6a...210e78FBC
0.00081393 ETH
72324332024-12-07 21:18:006 hrs ago1733606280
0x37984b6a...210e78FBC
0.00081393 ETH
72323352024-12-07 20:57:006 hrs ago1733605020
0x37984b6a...210e78FBC
0.00081393 ETH
72322382024-12-07 20:35:366 hrs ago1733603736
0x37984b6a...210e78FBC
0.00081393 ETH
72322102024-12-07 20:29:246 hrs ago1733603364
0x37984b6a...210e78FBC
0.00081393 ETH
72320102024-12-07 19:47:007 hrs ago1733600820
0x37984b6a...210e78FBC
0.00081393 ETH
72319972024-12-07 19:44:247 hrs ago1733600664
0x37984b6a...210e78FBC
0.00263789 ETH
72319572024-12-07 19:36:247 hrs ago1733600184
0x37984b6a...210e78FBC
0.00130948 ETH
72317682024-12-07 18:56:248 hrs ago1733597784
0x37984b6a...210e78FBC
0.00081393 ETH
72315672024-12-07 18:14:129 hrs ago1733595252
0x37984b6a...210e78FBC
0.00130948 ETH
72315632024-12-07 18:13:249 hrs ago1733595204
0x37984b6a...210e78FBC
0.0199345 ETH
72314552024-12-07 17:50:369 hrs ago1733593836
0x37984b6a...210e78FBC
0.00081393 ETH
72312992024-12-07 17:18:2410 hrs ago1733591904
0x37984b6a...210e78FBC
0.00081393 ETH
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xbDb0c8fB...12e01b085
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
SynthrIssuerLightChain

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 21 : SynthrIssuerLightChain.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

// Inheritance
import "./Owned.sol";
import "./MixinSystemSettings.sol";
import "../interfaces/IIssuer.sol";

// Libraries
import "./SafeCast.sol";
import "./SafeDecimalMath.sol";

// Internal references
import "../interfaces/ISynth.sol";
import "../interfaces/ISynthrSwap.sol";
import "../interfaces/ISynthrSwapWithDex.sol";
import "../interfaces/IWrappedSynthr.sol";
import "../interfaces/IExchangeRates.sol";
import "../interfaces/IExchanger.sol";
import "../interfaces/IERC20.sol";
import "../interfaces/ISynthRedeemer.sol";
import "../interfaces/ISystemStatus.sol";
import "../interfaces/ISynthrBridgeLightChain.sol";

contract SynthrIssuerLightChain is Owned, MixinSystemSettings {
    using SafeMath for uint256;
    using SafeDecimalMath for uint256;

    bytes32 public constant CONTRACT_NAME = "Issuer";

    // SIP-165: Circuit breaker for Debt Synthesis
    uint256 public constant CIRCUIT_BREAKER_SUSPENSION_REASON = 165;
    address internal constant NULL_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    // Available Synths which can be used with the system
    ISynth[] public availableSynths;
    mapping(bytes32 => ISynth) public synths;
    mapping(address => bytes32) public synthsByAddress;

    uint256 public lastDebtRatio;

    /* ========== ENCODED NAMES ========== */

    bytes32 internal constant sUSD = "sUSD";
    bytes32 internal constant sETH = "sETH";

    // Flexible storage names

    bytes32 internal constant LAST_ISSUE_EVENT = "lastIssueEvent";

    /* ========== ADDRESS RESOLVER CONFIGURATION ========== */

    bytes32 private constant CONTRACT_WRAPPED_SYNTHR = "WrappedSynthr";
    bytes32 private constant CONTRACT_EXRATES = "ExchangeRates";
    bytes32 private constant CONTRACT_EXCHANGER = "Exchanger";
    bytes32 private constant CONTRACT_SYNTHREDEEMER = "SynthRedeemer";
    bytes32 private constant CONTRACT_SYSTEMSTATUS = "SystemStatus";
    bytes32 private constant CONTRACT_SYNTHR_SWAP = "SynthrSwap";
    bytes32 private constant CONTRACT_SYNTHR_SWAP_WITH_DEX = "SynthrSwapWithDex";

    // LZ Packet types
    uint16 internal constant PT_BRIDGE_SYNTH = 7;

    constructor(address _owner, address _resolver) Owned(_owner) MixinSystemSettings(_resolver) {}

    /* ========== VIEWS ========== */
    function resolverAddressesRequired() public view override returns (bytes32[] memory addresses) {
        bytes32[] memory existingAddresses = MixinSystemSettings.resolverAddressesRequired();
        bytes32[] memory newAddresses = new bytes32[](7);
        newAddresses[0] = CONTRACT_EXRATES;
        newAddresses[1] = CONTRACT_SYNTHREDEEMER;
        newAddresses[2] = CONTRACT_SYSTEMSTATUS;
        newAddresses[3] = CONTRACT_WRAPPED_SYNTHR;
        newAddresses[4] = CONTRACT_EXCHANGER;
        newAddresses[5] = CONTRACT_SYNTHR_SWAP;
        newAddresses[6] = CONTRACT_SYNTHR_SWAP_WITH_DEX;
        return combineArrays(existingAddresses, newAddresses);
    }

    function exchangeRates() internal view returns (IExchangeRates) {
        return IExchangeRates(requireAndGetAddress(CONTRACT_EXRATES));
    }

    function exchanger() internal view returns (IExchanger) {
        return IExchanger(requireAndGetAddress(CONTRACT_EXCHANGER));
    }

    function synthRedeemer() internal view returns (ISynthRedeemer) {
        return ISynthRedeemer(requireAndGetAddress(CONTRACT_SYNTHREDEEMER));
    }

    function systemStatus() internal view returns (ISystemStatus) {
        return ISystemStatus(requireAndGetAddress(CONTRACT_SYSTEMSTATUS));
    }

    function synthrSwap() internal view returns (ISynthrSwap) {
        return ISynthrSwap(requireAndGetAddress(CONTRACT_SYNTHR_SWAP));
    }

    function synthrSwapWithDex() internal view returns (ISynthrSwapWithDex) {
        return ISynthrSwapWithDex(requireAndGetAddress(CONTRACT_SYNTHR_SWAP_WITH_DEX));
    }

    function synthrBridge(bytes32 _bridgeName) internal view returns (ISynthrBridge) {
        return ISynthrBridge(resolver.getAvailableBridge(_bridgeName));
    }

    function _availableCurrencyKeys() internal view returns (bytes32[] memory) {
        bytes32[] memory currencyKeys = new bytes32[](availableSynths.length);

        for (uint256 i = 0; i < availableSynths.length; i++) {
            currencyKeys[i] = synthsByAddress[address(availableSynths[i])];
        }
        return currencyKeys;
    }

    function availableCurrencyKeys() external view returns (bytes32[] memory) {
        return _availableCurrencyKeys();
    }

    function availableSynthCount() external view returns (uint256) {
        return availableSynths.length;
    }

    function getSynths(bytes32[] calldata currencyKeys) external view returns (ISynth[] memory) {
        uint256 numKeys = currencyKeys.length;
        ISynth[] memory addresses = new ISynth[](numKeys);

        for (uint256 i = 0; i < numKeys; i++) {
            addresses[i] = synths[currencyKeys[i]];
        }

        return addresses;
    }

    function getSendBridgeSynthGasFee(
        address _account,
        bytes32 _synthKey,
        uint256 _synthAmount,
        bytes32 _bridgeName,
        uint16 _destChainId
    ) external view returns (uint256) {
        if (_destChainId != 0) {
            bytes memory lzPayload = abi.encode(
                PT_BRIDGE_SYNTH,
                abi.encodePacked(_account),
                _synthKey,
                _synthAmount,
                _destChainId
            );
            return synthrBridge(_bridgeName).calcFee(lzPayload, PT_BRIDGE_SYNTH, _destChainId);
        }
        return 0;
    }

    /* ========== MUTATIVE FUNCTIONS ========== */

    function _addSynth(ISynth synth) internal {
        bytes32 currencyKey = synth.currencyKey();
        require(synths[currencyKey] == ISynth(address(0)), "Synth exists");
        require(synthsByAddress[address(synth)] == bytes32(0), "Synth address already exists");

        availableSynths.push(synth);
        synths[currencyKey] = synth;
        synthsByAddress[address(synth)] = currencyKey;

        emit SynthAdded(currencyKey, address(synth));
    }

    /**
     * @dev Adds a new synthetic asset to the SynthrIssuer contract.
     * @param synth The address of the synthetic asset contract to be added.
     * @notice The caller must be the owner of the contract.
     */
    function addSynth(ISynth synth) external onlyOwner {
        _addSynth(synth);
    }

    function _removeSynth(bytes32 currencyKey) internal {
        address synthToRemove = address(synths[currencyKey]);
        require(synthToRemove != address(0), "Synth does not exist");
        require(currencyKey != sUSD, "Cannot remove synth");

        uint256 synthSupply = IERC20(synthToRemove).totalSupply();

        if (synthSupply > 0) {
            (uint256 amountOfsUSD, uint256 rateToRedeem, ) = exchangeRates().effectiveValueAndRates(
                currencyKey,
                synthSupply,
                "sUSD"
            );
            require(rateToRedeem > 0, "Cannot remove synth to redeem without rate");
            ISynthRedeemer _synthRedeemer = synthRedeemer();
            synths[sUSD].issue(address(_synthRedeemer), amountOfsUSD);
            _synthRedeemer.deprecate(IERC20(synthToRemove), rateToRedeem);
        }

        // Remove the synth from the availableSynths array.
        for (uint256 i = 0; i < availableSynths.length; i++) {
            if (address(availableSynths[i]) == synthToRemove) {
                // Copy the last synth into the place of the one we just deleted
                // If there's only one synth, this is synths[0] = synths[0].
                // If we're deleting the last one, it's also a NOOP in the same way.
                availableSynths[i] = availableSynths[availableSynths.length - 1];
                availableSynths.pop();

                break;
            }
        }

        // And remove it from the synths mapping
        delete synthsByAddress[synthToRemove];
        delete synths[currencyKey];

        emit SynthRemoved(currencyKey, synthToRemove);
    }

    /**
     * @dev Removes a synthetic asset from the SynthrIssuer contract.
     * Can only be called by the contract owner.
     * @param currencyKey The currency key of the synthetic asset to be removed.
     */
    function removeSynth(bytes32 currencyKey) external onlyOwner {
        _removeSynth(currencyKey);
    }

    /**
     * @dev Issues synthetic tokens to a specified account from the SynthrSwap contract.
     * @param _account The address of the account to receive the synthetic tokens.
     * @param _synthKey The key of the synthetic token to be issued.
     * @param _synthAmount The amount of synthetic tokens to be issued.
     */
    function synthIssueFromSynthrSwap(
        address _account,
        bytes32 _synthKey,
        uint256 _synthAmount
    ) external systemActive onlySynthrSwap {
        synths[_synthKey].issue(_account, _synthAmount);
    }

    /**
     * @dev Burns deprecated Synths for redemption.
     * @param deprecatedSynth The address of the deprecated Synth.
     * @param account The address of the account to burn Synths from.
     * @param balance The amount of Synths to burn.
     */
    function burnForRedemption(
        address deprecatedSynth,
        address account,
        uint256 balance
    ) external onlySynthRedeemer {
        ISynth(deprecatedSynth).burn(account, balance);
    }

    /**
     * @dev Burns Synths for a given account.
     * @param _account The address of the account to burn Synths from.
     * @param _synthKey The key of the Synth to burn.
     * @param _amount The amount of Synths to burn.
     * @return The amount of Synths burned, along with three additional values (0, 0, 0).
     */
    function burnSynths(
        address _account,
        bytes32 _synthKey,
        uint256 _amount
    ) external systemActive onlyWrappedSynthr returns (uint256, uint256, uint256, uint256) {
        require(synths[_synthKey] != ISynth(address(0)), "No Synth exists");
        require(
            synths[_synthKey].balanceOf(_account) >= _amount,
            "Insufficient synth amount to burn"
        );
        synths[_synthKey].burn(_account, _amount);
        return (_amount, 0, 0, 0);
    }

    /**
     * @dev Bridges Synths to another chain.
     * @param _account The address of the account to bridge Synths from.
     * @param _synthKey The key of the Synth to bridge.
     * @param _amount The amount of Synths to bridge.
     * @param _bridgeName The name of the bridge contract.
     * @param _destChainId The ID of the destination chain.
     * @param _erc20Payment A boolean indicating if the payment is in ERC20 tokens.
     * @return A boolean indicating if the bridging was successful.
     */
    function bridgeSynth(
        address _account,
        bytes32 _synthKey,
        uint256 _amount,
        bytes32 _bridgeName,
        uint16 _destChainId,
        bool _erc20Payment
    ) external payable systemActive returns (bool) {
        require(synths[_synthKey] != ISynth(address(0)), "No Synth exists");
        require(
            synths[_synthKey].balanceOf(_account) >= _amount,
            "Insufficient synth amount to bridge"
        );
        synths[_synthKey].burn(_account, _amount);
        synthrBridge(_bridgeName).sendBridgeSyToken{value: msg.value}(
            _account,
            _synthKey,
            _amount,
            _destChainId,
            _erc20Payment
        );
        emit BurnSynthForBridge(_account, _synthKey, _amount, _destChainId);
        return true;
    }

    /**
     * @dev Issues Synths on the destination chain.
     * @param _account The address of the account to issue Synths to.
     * @param _synthKey The key of the Synth to issue.
     * @param _synthAmount The amount of Synths to issue.
     */
    function destIssue(
        address _account,
        bytes32 _synthKey,
        uint256 _synthAmount
    ) external onlySynthrBridge {
        synths[_synthKey].issue(_account, _synthAmount);
        emit DestIssue(_account, _synthKey, _synthAmount);
    }

    /**
     * @dev Transfers margin from an account.
     * @param account The address of the account to transfer margin from.
     * @param marginDelta The change in margin.
     * @return The amount of margin transferred.
     */
    function transferMargin(
        address account,
        uint256 marginDelta
    ) external onlyWrappedSynthr returns (uint256) {
        // Exchanger.settle ensures synth is active
        (uint256 reclaimed, , ) = exchanger().settle(account, sUSD);

        uint256 balanceAfter = marginDelta;
        if (reclaimed > 0) {
            balanceAfter = IERC20(address(synths[sUSD])).balanceOf(account);
        }

        // Reduce the value to burn if balance is insufficient after reclamation
        uint256 amount = balanceAfter < marginDelta ? balanceAfter : marginDelta;

        synths[sUSD].burn(account, amount);

        return amount;
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    function _requireRatesNotInvalid(bool anyRateIsInvalid) internal pure {
        require(!anyRateIsInvalid, "A synth or collateral rate is invalid");
    }

    /* ========== MODIFIERS ========== */
    function _onlySynthRedeemer() internal view {
        require(
            msg.sender == address(synthRedeemer()),
            "Issuer: Only the SynthRedeemer contract can perform this action"
        );
    }

    modifier onlySynthRedeemer() {
        _onlySynthRedeemer();
        _;
    }

    modifier onlySynthrBridge() {
        require(
            resolver.isBridge(msg.sender),
            "Issuer: Only the SynthrBridge contract can perform this action"
        );
        _;
    }

    modifier onlyWrappedSynthr() {
        require(
            msg.sender == address(requireAndGetAddress(CONTRACT_WRAPPED_SYNTHR)),
            "Issuer: Only the WrappedSynthr contract can perform this action"
        );
        _;
    }

    modifier systemActive() {
        _systemActive();
        _;
    }

    function _systemActive() private view {
        systemStatus().requireSystemActive();
    }

    modifier issuanceActive() {
        _issuanceActive();
        _;
    }

    function _issuanceActive() private view {
        systemStatus().requireIssuanceActive();
    }

    modifier synthActive(bytes32 currencyKey) {
        _synthActive(currencyKey);
        _;
    }

    function _synthActive(bytes32 currencyKey) private view {
        systemStatus().requireSynthActive(currencyKey);
    }

    modifier onlySynthrSwap() {
        require(
            msg.sender == address(synthrSwap()) || msg.sender == address(synthrSwapWithDex()),
            "Issuer: Only the SynthrSwap contract can perform this action"
        );
        _;
    }

    /* ========== EVENTS ========== */

    event SynthAdded(bytes32 currencyKey, address synth);
    event SynthRemoved(bytes32 currencyKey, address synth);
    event DestIssue(address indexed account, bytes32 currencyKey, uint256 synthAmount);
    event BurnSynthForBridge(
        address indexed account,
        bytes32 currencyKey,
        uint256 synthAmount,
        uint16 destChainId
    );
}

File 2 of 21 : SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

/**
 * @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, 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");
        uint256 c = a - b;

        return c;
    }

    /**
     * @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) {
        // 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-solidity/pull/522
        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. Reverts 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) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, "SafeMath: division by zero");
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts 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;
    }
}

File 3 of 21 : IAddressResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

interface IAddressResolver {
    function getAddress(bytes32 name) external view returns (address);

    function getSynth(bytes32 key) external view returns (address);

    function getAvailableBridge(bytes32 bridgeName) external view returns (address);

    function getBridgeList() external view returns (bytes32[] memory);

    function requireAndGetAddress(
        bytes32 name,
        string calldata reason
    ) external view returns (address);
}

File 4 of 21 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

interface IERC20 {
    // ERC20 Optional Views
    function name() external view returns (string memory);

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

    function decimals() external view returns (uint8);

    // Views
    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

    function allowance(address owner, address spender) external view returns (uint256);

    // Mutative functions
    function transfer(address to, uint256 value) external returns (bool);

    function approve(address spender, uint256 value) external returns (bool);

    function transferFrom(address from, address to, uint256 value) external returns (bool);

    // Events
    event Transfer(address indexed from, address indexed to, uint256 value);

    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 5 of 21 : IExchanger.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

interface IExchanger {
    struct ExchangeEntrySettlement {
        bytes32 src;
        uint256 amount;
        bytes32 dest;
        uint256 reclaim;
        uint256 rebate;
        uint256 srcRoundIdAtPeriodEnd;
        uint256 destRoundIdAtPeriodEnd;
        uint256 timestamp;
    }

    struct ExchangeEntry {
        uint256 sourceRate;
        uint256 destinationRate;
        uint256 destinationAmount;
        uint256 exchangeFeeRate;
        uint256 exchangeDynamicFeeRate;
        uint256 roundIdForSrc;
        uint256 roundIdForDest;
    }

    struct ExchangeArgs {
        address fromAccount;
        address destAccount;
        bytes32 sourceCurrencyKey;
        bytes32 destCurrencyKey;
        uint256 sourceAmount;
        uint256 destAmount;
        uint256 fee;
        uint256 reclaimed;
        uint256 refunded;
        uint16 destChainId;
        bool erc20Payment;
    }

    // Views
    function calculateAmountAfterSettlement(
        address from,
        bytes32 currencyKey,
        uint256 amount,
        uint256 refunded
    ) external view returns (uint256 amountAfterSettlement);

    function isSynthRateInvalid(bytes32 currencyKey) external view returns (bool);

    function maxSecsLeftInWaitingPeriod(
        address account,
        bytes32 currencyKey
    ) external view returns (uint256);

    function settlementOwing(
        address account,
        bytes32 currencyKey
    ) external view returns (uint256 reclaimAmount, uint256 rebateAmount, uint256 numEntries);

    // function hasWaitingPeriodOrSettlementOwing(address account, bytes32 currencyKey) external view returns (bool);

    function feeRateForExchange(
        bytes32 sourceCurrencyKey,
        bytes32 destinationCurrencyKey
    ) external view returns (uint256);

    function dynamicFeeRateForExchange(
        bytes32 sourceCurrencyKey,
        bytes32 destinationCurrencyKey
    ) external view returns (uint256 feeRate, bool tooVolatile);

    function getAmountsForExchange(
        uint256 sourceAmount,
        bytes32 sourceCurrencyKey,
        bytes32 destinationCurrencyKey
    ) external view returns (uint256 amountReceived, uint256 fee, uint256 exchangeFeeRate);

    // function priceDeviationThresholdFactor() external view returns (uint256);

    // function waitingPeriodSecs() external view returns (uint256);

    // function lastExchangeRate(bytes32 currencyKey) external view returns (uint256);

    // Mutative functions
    function exchange(
        ExchangeArgs calldata args,
        bytes32 bridgeName
    ) external payable returns (uint256 amountReceived);

    function exchangeAtomically(
        uint256 minAmount,
        ExchangeArgs calldata args,
        bytes32 bridgeName
    ) external payable returns (uint256 amountReceived);

    function settle(
        address from,
        bytes32 currencyKey
    ) external returns (uint256 reclaimed, uint256 refunded, uint256 numEntries);

    function suspendSynthWithInvalidRate(bytes32 currencyKey) external;

    function updateDestinationForExchange(
        address recipient,
        bytes32 destinationKey,
        uint256 destinationAmount
    ) external;
}

File 6 of 21 : IExchangeRates.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

interface IExchangeRates {
    // Structs
    struct RateAndUpdatedTime {
        uint216 rate;
        uint40 time;
    }

    // Views
    function aggregators(bytes32 currencyKey) external view returns (address);

    function aggregatorWarningFlags() external view returns (address);

    function anyRateIsInvalid(bytes32[] calldata currencyKeys) external view returns (bool);

    function anyRateIsInvalidAtRound(
        bytes32[] calldata currencyKeys,
        uint256[] calldata roundIds
    ) external view returns (bool);

    function currenciesUsingAggregator(address aggregator) external view returns (bytes32[] memory);

    function effectiveValue(
        bytes32 sourceCurrencyKey,
        uint256 sourceAmount,
        bytes32 destinationCurrencyKey
    ) external view returns (uint256 value);

    function effectiveValueAndRates(
        bytes32 sourceCurrencyKey,
        uint256 sourceAmount,
        bytes32 destinationCurrencyKey
    ) external view returns (uint256 value, uint256 sourceRate, uint256 destinationRate);

    function effectiveValueAndRatesAtRound(
        bytes32 sourceCurrencyKey,
        uint256 sourceAmount,
        bytes32 destinationCurrencyKey,
        uint256 roundIdForSrc,
        uint256 roundIdForDest
    ) external view returns (uint256 value, uint256 sourceRate, uint256 destinationRate);

    function effectiveAtomicValueAndRates(
        bytes32 sourceCurrencyKey,
        uint256 sourceAmount,
        bytes32 destinationCurrencyKey
    )
        external
        view
        returns (
            uint256 value,
            uint256 systemValue,
            uint256 systemSourceRate,
            uint256 systemDestinationRate
        );

    function getCurrentRoundId(bytes32 currencyKey) external view returns (uint256);

    function getLastRoundIdBeforeElapsedSecs(
        bytes32 currencyKey,
        uint256 startingRoundId,
        uint256 startingTimestamp,
        uint256 timediff
    ) external view returns (uint256);

    function lastRateUpdateTimes(bytes32 currencyKey) external view returns (uint256);

    function rateAndTimestampAtRound(
        bytes32 currencyKey,
        uint256 roundId
    ) external view returns (uint256 rate, uint256 time);

    function rateAndUpdatedTime(
        bytes32 currencyKey
    ) external view returns (uint256 rate, uint256 time);

    function rateAndInvalid(
        bytes32 currencyKey
    ) external view returns (uint256 rate, bool isInvalid);

    function rateForCurrency(bytes32 currencyKey) external view returns (uint256);

    function rateIsFlagged(bytes32 currencyKey) external view returns (bool);

    function rateIsInvalid(bytes32 currencyKey) external view returns (bool);

    function rateIsStale(bytes32 currencyKey) external view returns (bool);

    function rateStalePeriod() external view returns (uint256);

    function ratesAndUpdatedTimeForCurrencyLastNRounds(
        bytes32 currencyKey,
        uint256 numRounds,
        uint256 roundId
    ) external view returns (uint256[] memory rates, uint256[] memory times);

    function ratesAndInvalidForCurrencies(
        bytes32[] calldata currencyKeys
    ) external view returns (uint256[] memory rates, bool anyRateInvalid);

    function ratesForCurrencies(
        bytes32[] calldata currencyKeys
    ) external view returns (uint256[] memory);

    function synthTooVolatileForAtomicExchange(bytes32 currencyKey) external view returns (bool);

    function rateWithSafetyChecks(
        bytes32 currencyKey
    ) external returns (uint256 rate, bool broken, bool invalid);
}

File 7 of 21 : IFlexibleStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

interface IFlexibleStorage {
    // Views
    function getUIntValue(bytes32 contractName, bytes32 record) external view returns (uint256);

    function getUIntValues(
        bytes32 contractName,
        bytes32[] calldata records
    ) external view returns (uint256[] memory);

    function getIntValue(bytes32 contractName, bytes32 record) external view returns (int256);

    function getIntValues(
        bytes32 contractName,
        bytes32[] calldata records
    ) external view returns (int256[] memory);

    function getAddressValue(bytes32 contractName, bytes32 record) external view returns (address);

    function getAddressValues(
        bytes32 contractName,
        bytes32[] calldata records
    ) external view returns (address[] memory);

    function getBoolValue(bytes32 contractName, bytes32 record) external view returns (bool);

    function getBoolValues(
        bytes32 contractName,
        bytes32[] calldata records
    ) external view returns (bool[] memory);

    function getBytes32Value(bytes32 contractName, bytes32 record) external view returns (bytes32);

    function getBytes32Values(
        bytes32 contractName,
        bytes32[] calldata records
    ) external view returns (bytes32[] memory);

    // Mutative functions
    function deleteUIntValue(bytes32 contractName, bytes32 record) external;

    function deleteIntValue(bytes32 contractName, bytes32 record) external;

    function deleteAddressValue(bytes32 contractName, bytes32 record) external;

    function deleteBoolValue(bytes32 contractName, bytes32 record) external;

    function deleteBytes32Value(bytes32 contractName, bytes32 record) external;

    function setUIntValue(bytes32 contractName, bytes32 record, uint256 value) external;

    function setUIntValues(
        bytes32 contractName,
        bytes32[] calldata records,
        uint256[] calldata values
    ) external;

    function setIntValue(bytes32 contractName, bytes32 record, int256 value) external;

    function setIntValues(
        bytes32 contractName,
        bytes32[] calldata records,
        int256[] calldata values
    ) external;

    function setAddressValue(bytes32 contractName, bytes32 record, address value) external;

    function setAddressValues(
        bytes32 contractName,
        bytes32[] calldata records,
        address[] calldata values
    ) external;

    function setBoolValue(bytes32 contractName, bytes32 record, bool value) external;

    function setBoolValues(
        bytes32 contractName,
        bytes32[] calldata records,
        bool[] calldata values
    ) external;

    function setBytes32Value(bytes32 contractName, bytes32 record, bytes32 value) external;

    function setBytes32Values(
        bytes32 contractName,
        bytes32[] calldata records,
        bytes32[] calldata values
    ) external;
}

File 8 of 21 : IIssuer.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

import "../interfaces/ISynth.sol";

interface IIssuer {
    // Views

    function allNetworksDebtInfo() external view returns (uint256 debt, uint256 sharesSupply);

    function availableCurrencyKeys() external view returns (bytes32[] memory);

    function availableSynthCount() external view returns (uint256);

    function availableSynths(uint256 index) external view returns (ISynth);

    function canBurnSynths(address account) external view returns (bool);

    function collateral(address account) external view returns (uint256);

    function collateralisationRatio(address issuer) external view returns (uint256);

    function collateralisationRatioAndAnyRatesInvalid(
        address _issuer
    ) external view returns (uint256 cratio, bool anyRateIsInvalid);

    function debtBalanceOf(address issuer) external view returns (uint256 debtBalance);

    function issuanceRatio() external view returns (uint256);

    function lastIssueEvent(address account) external view returns (uint256);

    function maxIssuableSynths(address issuer) external view returns (uint256 maxIssuable);

    function minimumStakeTime() external view returns (uint256);

    function remainingIssuableSynths(
        address issuer
    ) external view returns (uint256 maxIssuable, uint256 alreadyIssued, uint256 totalSystemDebt);

    function synths(bytes32 currencyKey) external view returns (ISynth);

    function getSynths(bytes32[] calldata currencyKeys) external view returns (ISynth[] memory);

    function synthsByAddress(address synthAddress) external view returns (bytes32);

    function totalIssuedSynths(bytes32 currencyKey) external view returns (uint256);

    function checkFreeCollateral(
        address _issuer,
        bytes32 _collateralKey,
        uint16 _chainId
    ) external view returns (uint256 withdrawableSynthr);

    function issueSynths(
        address from,
        uint256 amount,
        uint256 destChainId
    ) external returns (uint256 synthAmount, uint256 debtShare);

    function issueMaxSynths(
        address from,
        uint256 destChainId
    ) external returns (uint256 synthAmount, uint256 debtShare);

    function burnSynths(
        address from,
        bytes32 synthKey,
        uint256 amount
    )
        external
        returns (uint256 synthAmount, uint256 debtShare, uint256 reclaimed, uint256 refunded);

    function burnSynthsToTarget(
        address from,
        bytes32 synthKey
    )
        external
        returns (uint256 synthAmount, uint256 debtShare, uint256 reclaimed, uint256 refunded);

    function burnForRedemption(
        address deprecatedSynthProxy,
        address account,
        uint256 balance
    ) external;

    function burnSynthsWithoutDebt(
        bytes32 currencyKey,
        address from,
        uint amount
    ) external returns (uint256 burnAmount);

    function synthIssueFromSynthrSwap(
        address _account,
        bytes32 _synthKey,
        uint256 _synthAmount
    ) external;

    function liquidateAccount(
        address account,
        bytes32 collateralKey,
        uint16 chainId,
        bool isSelfLiquidation
    ) external returns (uint256 totalRedeemed, uint256 amountToLiquidate, uint256 sharesToRemove);

    function destIssue(address _account, bytes32 _synthKey, uint256 _synthAmount) external;

    function destBurn(
        address _account,
        bytes32 _synthKey,
        uint256 _synthAmount
    ) external returns (uint256);

    function transferMargin(address account, uint256 marginDelta) external returns (uint256);

    function destTransferMargin(
        address _account,
        uint256 _marginDelta,
        bytes32 _marketKey
    ) external returns (bool);

    function setCurrentPeriodId(uint128 periodId) external;
}

File 9 of 21 : ISynth.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

interface ISynth {
    // Views
    function balanceOf(address _account) external view returns (uint256);

    function currencyKey() external view returns (bytes32);

    function transferableSynths(address account) external view returns (uint256);

    // Mutative functions
    function transferAndSettle(address to, uint256 value) external payable returns (bool);

    function transferFromAndSettle(
        address from,
        address to,
        uint256 value
    ) external payable returns (bool);

    function burn(address account, uint256 amount) external;

    function issue(address account, uint256 amount) external;
}

File 10 of 21 : ISynthrBridgeLightChain.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

import "./IExchanger.sol";

interface ISynthrBridge {
    /* ========== MUTATIVE FUNCTIONS ========== */
    function sendDepositCollateral(
        address account,
        bytes32 collateralKey,
        uint256 amount,
        bool erc20Payment
    ) external payable;

    function sendBurn(
        address account,
        bytes32 synthKey,
        uint256 amount,
        bool erc20Payment
    ) external payable;

    function sendExchange(
        address account,
        bytes32 srcSynthKey,
        bytes32 dstSynthKey,
        uint256 srcAmount,
        uint256 dstAmount,
        uint256 reclaimed,
        uint256 refunded,
        uint256 fee,
        uint16 dstChainId,
        bool erc20Payment
    ) external payable;

    function sendBridgeSyToken(
        address account,
        bytes32 synthKey,
        uint256 amount,
        uint16 dstChainId,
        bool erc20Payment
    ) external payable;

    function sendTransferMargin(
        address account,
        uint256 amount,
        bytes32 marketKey,
        bool erc20Payment
    ) external payable;

    function sendCrossSwapSyAssetToNative(
        address account,
        bytes32 srcKey,
        uint256 srcAmount,
        bytes32 dstKey,
        uint256 dstAmount,
        uint16 dstChainId,
        uint256 fee,
        bytes calldata dexPayload,
        address dexAddress,
        bool erc20Payment
    ) external payable;

    function sendCrossSwapNativeToSyAsset(
        address account,
        bytes32 srcKey,
        uint256 srcAmount,
        bytes32 dstKey,
        uint256 dstAmount,
        uint16 dstChainId,
        uint256 fee,
        bool erc20Payment
    ) external payable;

    function sendCrossSwapNativeToNative(
        address account,
        bytes32 srcKey,
        uint256 srcAmount,
        bytes32 dstKey,
        uint256 dstAmount,
        uint16 dstChainId,
        uint256 fee,
        address dexAddress,
        bytes calldata dexPayload,
        bool erc20Payment
    ) external payable;

    function sendCrossSwapSyAssetToNativeWithDex(
        address account,
        bytes32 srcKey,
        uint256 srcAmount,
        bytes32 dstKey,
        uint256 dstAmount,
        uint16 dstChainId,
        uint256 fee,
        bool erc20Payment
    ) external payable;

    function sendCrossSwapNativeToNativeWithDex(
        address account,
        bytes32 srcKey,
        uint256 srcAmount,
        bytes32 dstKey,
        uint256 dstAmount,
        uint16 dstChainId,
        uint256 fee,
        bool erc20Payment
    ) external payable;

    // function sendExchange(IExchanger.ExchangeArgs calldata args) external payable;

    function calcFee(
        bytes memory lzPayload,
        uint16 packetType,
        uint16 dstChainId
    ) external view returns (uint256 lzFee);
}

File 11 of 21 : ISynthRedeemer.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

import "./IERC20.sol";

interface ISynthRedeemer {
    // Rate of redemption - 0 for none
    function redemptions(address synthProxy) external view returns (uint256 redeemRate);

    // sUSD balance of deprecated token holder
    function balanceOf(
        IERC20 synthProxy,
        address account
    ) external view returns (uint256 balanceOfInsUSD);

    // Full sUSD supply of token
    function totalSupply(IERC20 synthProxy) external view returns (uint256 totalSupplyInsUSD);

    function redeem(IERC20 synthProxy) external;

    function redeemAll(IERC20[] calldata synthProxies) external;

    function redeemPartial(IERC20 synthProxy, uint256 amountOfSynth) external;

    // Restricted to Issuer
    function deprecate(IERC20 synthProxy, uint256 rateToRedeem) external;
}

File 12 of 21 : ISynthrSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

interface ISynthrSwap {
    function swapSynthToNative(
        uint256 _sourceAmount,
        bytes32 _sourceKey,
        bytes32 _destKey,
        address _target,
        bytes memory _data,
        uint16 _chainId
    ) external payable;

    function destSwapSynthToNative(
        address _account,
        bytes32 _sourceKey,
        uint256 _sourceAmount,
        bytes32 _destKey,
        uint256 _destAmount,
        address _target,
        bytes memory _data
    ) external returns (bool);

    function swapNtiveToSynth(
        uint256 _sourceNativeAmount,
        bytes32 _sourceNativeKey,
        bytes32 _destSynthKey,
        address _target,
        bytes memory _data,
        uint16 _chainId
    ) external payable;

    function destSwapNativeToSynth(
        address _account,
        bytes32 _sourceKey,
        uint256 _sourceAmount,
        bytes32 _destKey,
        uint256 _destAmount
    ) external;
}

File 13 of 21 : ISynthrSwapWithDex.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

interface ISynthrSwapWithDex {
    function swapSynthToNative(
        uint256 _sourceAmount,
        bytes32 _sourceKey,
        bytes32 _destKey,
        address _target,
        bytes memory _data,
        uint16 _chainId
    ) external payable;

    function destSwapSynthToNative(
        address _account,
        bytes32 _sourceKey,
        uint256 _sourceAmount,
        bytes32 _destKey,
        uint256 _destAmount,
        address _target,
        bytes memory _data
    ) external returns (bool);

    function swapNtiveToSynth(
        uint256 _sourceNativeAmount,
        bytes32 _sourceNativeKey,
        bytes32 _destSynthKey,
        address _target,
        bytes memory _data,
        uint16 _chainId
    ) external payable;

    function destSwapNativeToSynth(
        address _account,
        bytes32 _sourceKey,
        uint256 _sourceAmount,
        bytes32 _destKey,
        uint256 _destAmount
    ) external;
}

File 14 of 21 : ISystemStatus.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

interface ISystemStatus {
    struct Status {
        bool canSuspend;
        bool canResume;
    }

    struct Suspension {
        bool suspended;
        // reason is an integer code,
        // 0 => no reason, 1 => upgrading, 2+ => defined by system usage
        uint248 reason;
    }

    // Views
    function accessControl(
        bytes32 section,
        address account
    ) external view returns (bool canSuspend, bool canResume);

    function requireSystemActive() external view;

    function systemSuspended() external view returns (bool);

    function requireIssuanceActive() external view;

    function requireExchangeActive() external view;

    function requireFuturesActive() external view;

    function requireFuturesMarketActive(bytes32 marketKey) external view;

    function requireExchangeBetweenSynthsAllowed(
        bytes32 sourceCurrencyKey,
        bytes32 destinationCurrencyKey
    ) external view;

    function requireSynthActive(bytes32 currencyKey) external view;

    function synthSuspended(bytes32 currencyKey) external view returns (bool);

    function requireSynthsActive(
        bytes32 sourceCurrencyKey,
        bytes32 destinationCurrencyKey
    ) external view;

    function systemSuspension() external view returns (bool suspended, uint248 reason);

    function issuanceSuspension() external view returns (bool suspended, uint248 reason);

    function exchangeSuspension() external view returns (bool suspended, uint248 reason);

    function futuresSuspension() external view returns (bool suspended, uint248 reason);

    function synthExchangeSuspension(
        bytes32 currencyKey
    ) external view returns (bool suspended, uint248 reason);

    function synthSuspension(
        bytes32 currencyKey
    ) external view returns (bool suspended, uint248 reason);

    function futuresMarketSuspension(
        bytes32 marketKey
    ) external view returns (bool suspended, uint248 reason);

    function getSynthExchangeSuspensions(
        bytes32[] calldata synths
    ) external view returns (bool[] memory exchangeSuspensions, uint256[] memory reasons);

    function getSynthSuspensions(
        bytes32[] calldata synths
    ) external view returns (bool[] memory suspensions, uint256[] memory reasons);

    function getFuturesMarketSuspensions(
        bytes32[] calldata marketKeys
    ) external view returns (bool[] memory suspensions, uint256[] memory reasons);

    // Restricted functions
    function suspendIssuance(uint256 reason) external;

    function suspendSynth(bytes32 currencyKey, uint256 reason) external;

    function suspendFuturesMarket(bytes32 marketKey, uint256 reason) external;

    function updateAccessControl(
        bytes32 section,
        address account,
        bool canSuspend,
        bool canResume
    ) external;
}

File 15 of 21 : IWrappedSynthr.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

import "./ISynth.sol";

interface IWrappedSynthr {
    // Views
    function isWaitingPeriod(bytes32 currencyKey) external view returns (bool);

    function chainBalanceOf(address account, uint16 _chainId) external view returns (uint256);

    function chainBalanceOfPerKey(
        address _account,
        bytes32 _collateralKey,
        uint16 _chainId
    ) external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);

    function collateralCurrency(bytes32 _collateralKey) external view returns (address);

    function getAvailableCollaterals() external view returns (bytes32[] memory);

    // Mutative Functions
    function burnSynths(uint256 amount, bytes32 synthKey) external;

    function withdrawCollateral(bytes32 collateralKey, uint256 collateralAmount) external;

    function burnSynthsToTarget(bytes32 synthKey) external;

    function destBurn(address _account, bytes32 _synthKey, uint256 _synthAmount) external;

    function exchange(
        bytes32 sourceCurrencyKey,
        uint256 sourceAmount,
        bytes32 destinationCurrencyKey,
        uint16 destChainId
    ) external returns (uint256 amountReceived);

    function exchangeWithTracking(
        bytes32 sourceCurrencyKey,
        uint256 sourceAmount,
        bytes32 destinationCurrencyKey,
        address rewardAddress,
        bytes32 trackingCode,
        uint16 destChainId
    ) external payable returns (uint256 amountReceived);

    // function exchangeWithTrackingForInitiator(
    //     bytes32 sourceCurrencyKey,
    //     uint256 sourceAmount,
    //     bytes32 destinationCurrencyKey,
    //     address rewardAddress,
    //     bytes32 trackingCode,
    //     uint16 destChainId
    // ) external payable returns (uint256 amountReceived);

    function exchangeOnBehalfWithTracking(
        address exchangeForAddress,
        bytes32 sourceCurrencyKey,
        uint256 sourceAmount,
        bytes32 destinationCurrencyKey,
        address rewardAddress,
        bytes32 trackingCode,
        uint16 destChainId
    ) external returns (uint256 amountReceived);

    function exchangeAtomically(
        bytes32 sourceCurrencyKey,
        uint256 sourceAmount,
        bytes32 destinationCurrencyKey,
        bytes32 trackingCode,
        uint256 minAmount,
        uint16 destChainId
    ) external payable returns (uint256 amountReceived);

    function issueMaxSynths(uint16 destChainId) external payable;

    function issueSynths(
        bytes32 currencyKey,
        uint256 amount,
        uint256 synthToMint,
        uint16 destChainId
    ) external payable;

    // Liquidations
    function liquidateDelinquentAccount(
        address account,
        bytes32 collateralKey
    ) external returns (bool);

    function liquidateSelf(bytes32 collateralKey) external returns (bool);
}

File 16 of 21 : AddressResolverLightChain.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

// Inheritance
import "./Owned.sol";
import "../interfaces/IAddressResolver.sol";

// Internal references
import "../interfaces/IIssuer.sol";
import "./MixinResolver.sol";

contract AddressResolverLightChain is Owned, IAddressResolver {
    mapping(bytes32 => address) public repository;
    mapping(bytes32 => address) public availableBridge;
    mapping(address => bool) public isBridge;

    bytes32[] public bridgeList;

    constructor(address _owner) Owned(_owner) {}

    /* ========== RESTRICTED FUNCTIONS ========== */

    function importAddresses(
        bytes32[] calldata names,
        address[] calldata destinations
    ) external onlyOwner {
        require(names.length == destinations.length, "Input lengths must match");

        for (uint256 i = 0; i < names.length; i++) {
            bytes32 name = names[i];
            address destination = destinations[i];
            repository[name] = destination;
            emit AddressImported(name, destination);
        }
    }

    function addAvailableBridge(bytes32 bridgeName, address bridgeAddress) external onlyOwner {
        _addAvailableBridge(bridgeName, bridgeAddress);
    }

    function removeAvailableBridge(bytes32 bridgeName) external onlyOwner {
        _removeAvailableBridge(bridgeName);
    }

    /* ========= PUBLIC FUNCTIONS ========== */

    function rebuildCaches(MixinResolver[] calldata destinations) external {
        for (uint256 i = 0; i < destinations.length; i++) {
            destinations[i].rebuildCache();
        }
    }

    /* ========== PRIVATE FUNCTIONS ========== */
    function _addAvailableBridge(bytes32 bridgeName, address bridgeAddress) private {
        if (availableBridge[bridgeName] != address(0)) {
            _removeAvailableBridge(bridgeName);
        }
        availableBridge[bridgeName] = bridgeAddress;
        isBridge[bridgeAddress] = true;
        bridgeList.push(bridgeName);
        emit AddBridge(bridgeName, bridgeAddress);
    }

    function _removeAvailableBridge(bytes32 bridgeName) private {
        require(availableBridge[bridgeName] != address(0), "The bridge no exist.");
        uint lastBridgeNumber = bridgeList.length - 1;
        for (uint ii = 0; ii <= lastBridgeNumber; ii++) {
            if (bridgeList[ii] == bridgeName) {
                bridgeList[ii] = bridgeList[lastBridgeNumber];
                bridgeList.pop();
                break;
            }
        }
        address bridgeToRemove = availableBridge[bridgeName];
        delete availableBridge[bridgeName];
        delete isBridge[bridgeToRemove];
        emit RemoveBridge(bridgeName, bridgeToRemove);
    }

    /* ========== VIEWS ========== */

    function areAddressesImported(
        bytes32[] calldata names,
        address[] calldata destinations
    ) external view returns (bool) {
        for (uint256 i = 0; i < names.length; i++) {
            if (repository[names[i]] != destinations[i]) {
                return false;
            }
        }
        return true;
    }

    function getAddress(bytes32 name) external view returns (address) {
        return repository[name];
    }

    function requireAndGetAddress(
        bytes32 name,
        string calldata reason
    ) external view returns (address) {
        address _foundAddress = repository[name];
        require(_foundAddress != address(0), reason);
        return _foundAddress;
    }

    function getSynth(bytes32 key) external view returns (address) {
        IIssuer issuer = IIssuer(repository["Issuer"]);
        require(address(issuer) != address(0), "Cannot find Issuer address");
        return address(issuer.synths(key));
    }

    function getAvailableBridge(bytes32 bridgeName) external view returns (address) {
        return availableBridge[bridgeName];
    }

    function getBridgeList() external view returns (bytes32[] memory) {
        return bridgeList;
    }

    /* ========== EVENTS ========== */

    event AddressImported(bytes32 name, address destination);
    event AddBridge(bytes32 indexed bridgeName, address bridgeAddress);
    event RemoveBridge(bytes32 indexed bridgeName, address bridgeAddress);
}

File 17 of 21 : MixinResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

// Internal references
import "./AddressResolverLightChain.sol";

contract MixinResolver {
    AddressResolverLightChain public resolver;

    mapping(bytes32 => address) private addressCache;

    constructor(address _resolver) {
        resolver = AddressResolverLightChain(_resolver);
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    function combineArrays(
        bytes32[] memory first,
        bytes32[] memory second
    ) internal pure returns (bytes32[] memory combination) {
        combination = new bytes32[](first.length + second.length);

        for (uint256 i = 0; i < first.length; i++) {
            combination[i] = first[i];
        }

        for (uint256 j = 0; j < second.length; j++) {
            combination[first.length + j] = second[j];
        }
    }

    /* ========== PUBLIC FUNCTIONS ========== */

    // Note: this function is public not external in order for it to be overridden and invoked via super in subclasses
    function resolverAddressesRequired() public view virtual returns (bytes32[] memory addresses) {}

    function rebuildCache() public {
        bytes32[] memory requiredAddresses = resolverAddressesRequired();
        // The resolver must call this function whenver it updates its state
        for (uint256 i = 0; i < requiredAddresses.length; i++) {
            bytes32 name = requiredAddresses[i];
            // Note: can only be invoked once the resolver has all the targets needed added
            address destination = resolver.requireAndGetAddress(
                name,
                string(abi.encodePacked("Resolver missing target: ", name))
            );
            addressCache[name] = destination;
            emit CacheUpdated(name, destination);
        }
    }

    /* ========== VIEWS ========== */

    function isResolverCached() external view returns (bool) {
        bytes32[] memory requiredAddresses = resolverAddressesRequired();
        for (uint256 i = 0; i < requiredAddresses.length; i++) {
            bytes32 name = requiredAddresses[i];
            // false if our cache is invalid or if the resolver doesn't have the required address
            if (
                resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)
            ) {
                return false;
            }
        }

        return true;
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    function requireAndGetAddress(bytes32 name) internal view returns (address) {
        address _foundAddress = addressCache[name];
        require(_foundAddress != address(0), string(abi.encodePacked("Missing address: ", name)));
        return _foundAddress;
    }

    /* ========== EVENTS ========== */

    event CacheUpdated(bytes32 name, address destination);
}

File 18 of 21 : MixinSystemSettings.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

import "./MixinResolver.sol";

// Internal references
import "../interfaces/IFlexibleStorage.sol";

contract MixinSystemSettings is MixinResolver {
    // must match the one defined SystemSettingsLib, defined in both places due to sol v0.5 limitations
    bytes32 internal constant SETTING_CONTRACT_NAME = "SystemSettings";

    bytes32 internal constant SETTING_WAITING_PERIOD_SECS = "waitingPeriodSecs";
    bytes32 internal constant SETTING_PRICE_DEVIATION_THRESHOLD_FACTOR =
        "priceDeviationThresholdFactor";
    bytes32 internal constant SETTING_RATE_STALE_PERIOD = "rateStalePeriod";
    /* ========== Exchange Fees Related ========== */
    bytes32 internal constant SETTING_EXCHANGE_FEE_RATE = "exchangeFeeRate";
    bytes32 internal constant SETTING_EXCHANGE_DYNAMIC_FEE_THRESHOLD =
        "exchangeDynamicFeeThreshold";
    bytes32 internal constant SETTING_EXCHANGE_DYNAMIC_FEE_WEIGHT_DECAY =
        "exchangeDynamicFeeWeightDecay";
    bytes32 internal constant SETTING_EXCHANGE_DYNAMIC_FEE_ROUNDS = "exchangeDynamicFeeRounds";
    bytes32 internal constant SETTING_EXCHANGE_MAX_DYNAMIC_FEE = "exchangeMaxDynamicFee";
    /* ========== End Exchange Fees Related ========== */
    bytes32 internal constant SETTING_AGGREGATOR_WARNING_FLAGS = "aggregatorWarningFlags";
    bytes32 internal constant SETTING_ATOMIC_MAX_VOLUME_PER_BLOCK = "atomicMaxVolumePerBlock";
    bytes32 internal constant SETTING_ATOMIC_TWAP_WINDOW = "atomicTwapWindow";
    bytes32 internal constant SETTING_ATOMIC_EQUIVALENT_FOR_DEX_PRICING =
        "atomicEquivalentForDexPricing";
    bytes32 internal constant SETTING_ATOMIC_EXCHANGE_FEE_RATE = "atomicExchangeFeeRate";
    bytes32 internal constant SETTING_ATOMIC_VOLATILITY_CONSIDERATION_WINDOW =
        "atomicVolConsiderationWindow";
    bytes32 internal constant SETTING_ATOMIC_VOLATILITY_UPDATE_THRESHOLD =
        "atomicVolUpdateThreshold";
    bytes32 internal constant SETTING_PURE_CHAINLINK_PRICE_FOR_ATOMIC_SWAPS_ENABLED =
        "pureChainlinkForAtomicsEnabled";

    bytes32 internal constant CONTRACT_FLEXIBLESTORAGE = "FlexibleStorage";

    struct DynamicFeeConfig {
        uint256 threshold;
        uint256 weightDecay;
        uint256 rounds;
        uint256 maxFee;
    }

    constructor(address _resolver) MixinResolver(_resolver) {}

    function resolverAddressesRequired()
        public
        view
        virtual
        override
        returns (bytes32[] memory addresses)
    {
        addresses = new bytes32[](1);
        addresses[0] = CONTRACT_FLEXIBLESTORAGE;
    }

    function flexibleStorage() internal view returns (IFlexibleStorage) {
        return IFlexibleStorage(requireAndGetAddress(CONTRACT_FLEXIBLESTORAGE));
    }

    function getWaitingPeriodSecs() internal view returns (uint256) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_WAITING_PERIOD_SECS);
    }

    function getPriceDeviationThresholdFactor() internal view returns (uint256) {
        return
            flexibleStorage().getUIntValue(
                SETTING_CONTRACT_NAME,
                SETTING_PRICE_DEVIATION_THRESHOLD_FACTOR
            );
    }

    function getRateStalePeriod() internal view returns (uint256) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_RATE_STALE_PERIOD);
    }

    /* ========== Exchange Related Fees ========== */
    function getExchangeFeeRate(bytes32 currencyKey) internal view returns (uint256) {
        return
            flexibleStorage().getUIntValue(
                SETTING_CONTRACT_NAME,
                keccak256(abi.encodePacked(SETTING_EXCHANGE_FEE_RATE, currencyKey))
            );
    }

    /// @notice Get exchange dynamic fee related keys
    /// @return threshold, weight decay, rounds, and max fee
    function getExchangeDynamicFeeConfig() internal view returns (DynamicFeeConfig memory) {
        bytes32[] memory keys = new bytes32[](4);
        keys[0] = SETTING_EXCHANGE_DYNAMIC_FEE_THRESHOLD;
        keys[1] = SETTING_EXCHANGE_DYNAMIC_FEE_WEIGHT_DECAY;
        keys[2] = SETTING_EXCHANGE_DYNAMIC_FEE_ROUNDS;
        keys[3] = SETTING_EXCHANGE_MAX_DYNAMIC_FEE;
        uint256[] memory values = flexibleStorage().getUIntValues(SETTING_CONTRACT_NAME, keys);
        return
            DynamicFeeConfig({
                threshold: values[0],
                weightDecay: values[1],
                rounds: values[2],
                maxFee: values[3]
            });
    }

    /* ========== End Exchange Related Fees ========== */

    function getAggregatorWarningFlags() internal view returns (address) {
        return
            flexibleStorage().getAddressValue(
                SETTING_CONTRACT_NAME,
                SETTING_AGGREGATOR_WARNING_FLAGS
            );
    }

    function getAtomicMaxVolumePerBlock() internal view returns (uint256) {
        return
            flexibleStorage().getUIntValue(
                SETTING_CONTRACT_NAME,
                SETTING_ATOMIC_MAX_VOLUME_PER_BLOCK
            );
    }

    function getAtomicTwapWindow() internal view returns (uint256) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ATOMIC_TWAP_WINDOW);
    }

    function getAtomicEquivalentForDexPricing(bytes32 currencyKey) internal view returns (address) {
        return
            flexibleStorage().getAddressValue(
                SETTING_CONTRACT_NAME,
                keccak256(abi.encodePacked(SETTING_ATOMIC_EQUIVALENT_FOR_DEX_PRICING, currencyKey))
            );
    }

    function getAtomicExchangeFeeRate(bytes32 currencyKey) internal view returns (uint256) {
        return
            flexibleStorage().getUIntValue(
                SETTING_CONTRACT_NAME,
                keccak256(abi.encodePacked(SETTING_ATOMIC_EXCHANGE_FEE_RATE, currencyKey))
            );
    }

    function getAtomicVolatilityConsiderationWindow(
        bytes32 currencyKey
    ) internal view returns (uint256) {
        return
            flexibleStorage().getUIntValue(
                SETTING_CONTRACT_NAME,
                keccak256(
                    abi.encodePacked(SETTING_ATOMIC_VOLATILITY_CONSIDERATION_WINDOW, currencyKey)
                )
            );
    }

    function getAtomicVolatilityUpdateThreshold(
        bytes32 currencyKey
    ) internal view returns (uint256) {
        return
            flexibleStorage().getUIntValue(
                SETTING_CONTRACT_NAME,
                keccak256(abi.encodePacked(SETTING_ATOMIC_VOLATILITY_UPDATE_THRESHOLD, currencyKey))
            );
    }

    function getPureChainlinkPriceForAtomicSwapsEnabled(
        bytes32 currencyKey
    ) internal view returns (bool) {
        return
            flexibleStorage().getBoolValue(
                SETTING_CONTRACT_NAME,
                keccak256(
                    abi.encodePacked(
                        SETTING_PURE_CHAINLINK_PRICE_FOR_ATOMIC_SWAPS_ENABLED,
                        currencyKey
                    )
                )
            );
    }
}

File 19 of 21 : Owned.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

contract Owned {
    address public owner;
    address public nominatedOwner;

    constructor(address _owner) {
        require(_owner != address(0), "Owner address cannot be 0");
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    function acceptOwnership() external {
        require(
            msg.sender == nominatedOwner,
            "You must be nominated before you can accept ownership"
        );
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    modifier onlyOwner() {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == owner, "Only the contract owner may perform this action");
    }

    event OwnerNominated(address newOwner);
    event OwnerChanged(address oldOwner, address newOwner);
}

File 20 of 21 : SafeCast.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

/**
 * @dev Wrappers over Solidity's uintXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value < 2 ** 128, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value < 2 ** 64, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value < 2 ** 32, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value < 2 ** 16, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value < 2 ** 8, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        require(value < 2 ** 255, "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 21 of 21 : SafeDecimalMath.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;

// Libraries
// import "openzeppelin-solidity-2.3.0/contracts/math/SafeMath.sol";
import "../externals/openzeppelin/SafeMath.sol";

library SafeDecimalMath {
    using SafeMath for uint256;

    /* Number of decimal places in the representations. */
    uint8 public constant decimals = 18;
    uint8 public constant highPrecisionDecimals = 27;

    /* The number representing 1.0. */
    uint256 public constant UNIT = 10 ** uint256(decimals);

    /* The number representing 1.0 for higher fidelity numbers. */
    uint256 public constant PRECISE_UNIT = 10 ** uint256(highPrecisionDecimals);
    uint256 private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR =
        10 ** uint256(highPrecisionDecimals - decimals);

    /**
     * @return Provides an interface to UNIT.
     */
    function unit() external pure returns (uint256) {
        return UNIT;
    }

    /**
     * @return Provides an interface to PRECISE_UNIT.
     */
    function preciseUnit() external pure returns (uint256) {
        return PRECISE_UNIT;
    }

    /**
     * @return The result of multiplying x and y, interpreting the operands as fixed-point
     * decimals.
     *
     * @dev A unit factor is divided out after the product of x and y is evaluated,
     * so that product must be less than 2**256. As this is an integer division,
     * the internal division always rounds down. This helps save on gas. Rounding
     * is more expensive on gas.
     */
    function multiplyDecimal(uint256 x, uint256 y) internal pure returns (uint256) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        return x.mul(y) / UNIT;
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of the specified precision unit.
     *
     * @dev The operands should be in the form of a the specified unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function _multiplyDecimalRound(
        uint256 x,
        uint256 y,
        uint256 precisionUnit
    ) private pure returns (uint256) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        uint256 quotientTimesTen = x.mul(y) / (precisionUnit / 10);

        if (quotientTimesTen % 10 >= 5) {
            quotientTimesTen += 10;
        }

        return quotientTimesTen / 10;
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of a precise unit.
     *
     * @dev The operands should be in the precise unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function multiplyDecimalRoundPrecise(uint256 x, uint256 y) internal pure returns (uint256) {
        return _multiplyDecimalRound(x, y, PRECISE_UNIT);
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of a standard unit.
     *
     * @dev The operands should be in the standard unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function multiplyDecimalRound(uint256 x, uint256 y) internal pure returns (uint256) {
        return _multiplyDecimalRound(x, y, UNIT);
    }

    /**
     * @return The result of safely dividing x and y. The return value is a high
     * precision decimal.
     *
     * @dev y is divided after the product of x and the standard precision unit
     * is evaluated, so the product of x and UNIT must be less than 2**256. As
     * this is an integer division, the result is always rounded down.
     * This helps save on gas. Rounding is more expensive on gas.
     */
    function divideDecimal(uint256 x, uint256 y) internal pure returns (uint256) {
        /* Reintroduce the UNIT factor that will be divided out by y. */
        return x.mul(UNIT).div(y);
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * decimal in the precision unit specified in the parameter.
     *
     * @dev y is divided after the product of x and the specified precision unit
     * is evaluated, so the product of x and the specified precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function _divideDecimalRound(
        uint256 x,
        uint256 y,
        uint256 precisionUnit
    ) private pure returns (uint256) {
        uint256 resultTimesTen = x.mul(precisionUnit * 10).div(y);

        if (resultTimesTen % 10 >= 5) {
            resultTimesTen += 10;
        }

        return resultTimesTen / 10;
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * standard precision decimal.
     *
     * @dev y is divided after the product of x and the standard precision unit
     * is evaluated, so the product of x and the standard precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function divideDecimalRound(uint256 x, uint256 y) internal pure returns (uint256) {
        return _divideDecimalRound(x, y, UNIT);
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * high precision decimal.
     *
     * @dev y is divided after the product of x and the high precision unit
     * is evaluated, so the product of x and the high precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function divideDecimalRoundPrecise(uint256 x, uint256 y) internal pure returns (uint256) {
        return _divideDecimalRound(x, y, PRECISE_UNIT);
    }

    /**
     * @dev Convert a standard decimal representation to a high precision one.
     */
    function decimalToPreciseDecimal(uint256 i) internal pure returns (uint256) {
        return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
    }

    /**
     * @dev Convert a high precision decimal to a standard decimal representation.
     */
    function preciseDecimalToDecimal(uint256 i) internal pure returns (uint256) {
        uint256 quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10);

        if (quotientTimesTen % 10 >= 5) {
            quotientTimesTen += 10;
        }

        return quotientTimesTen / 10;
    }

    // Computes `a - b`, setting the value to 0 if b > a.
    function floorsub(uint256 a, uint256 b) internal pure returns (uint256) {
        return b >= a ? 0 : a - b;
    }

    /* ---------- Utilities ---------- */
    /*
     * Absolute value of the input, returned as a signed number.
     */
    function signedAbs(int256 x) internal pure returns (int256) {
        return x < 0 ? -x : x;
    }

    /*
     * Absolute value of the input, returned as an unsigned number.
     */
    function abs(int256 x) internal pure returns (uint256) {
        return uint256(signedAbs(x));
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_resolver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"synthAmount","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"destChainId","type":"uint16"}],"name":"BurnSynthForBridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"CacheUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"synthAmount","type":"uint256"}],"name":"DestIssue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"synth","type":"address"}],"name":"SynthAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"synth","type":"address"}],"name":"SynthRemoved","type":"event"},{"inputs":[],"name":"CIRCUIT_BREAKER_SUSPENSION_REASON","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONTRACT_NAME","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISynth","name":"synth","type":"address"}],"name":"addSynth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableCurrencyKeys","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"availableSynthCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"availableSynths","outputs":[{"internalType":"contract ISynth","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bytes32","name":"_synthKey","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes32","name":"_bridgeName","type":"bytes32"},{"internalType":"uint16","name":"_destChainId","type":"uint16"},{"internalType":"bool","name":"_erc20Payment","type":"bool"}],"name":"bridgeSynth","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"deprecatedSynth","type":"address"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"burnForRedemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bytes32","name":"_synthKey","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burnSynths","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bytes32","name":"_synthKey","type":"bytes32"},{"internalType":"uint256","name":"_synthAmount","type":"uint256"}],"name":"destIssue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bytes32","name":"_synthKey","type":"bytes32"},{"internalType":"uint256","name":"_synthAmount","type":"uint256"},{"internalType":"bytes32","name":"_bridgeName","type":"bytes32"},{"internalType":"uint16","name":"_destChainId","type":"uint16"}],"name":"getSendBridgeSynthGasFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"currencyKeys","type":"bytes32[]"}],"name":"getSynths","outputs":[{"internalType":"contract ISynth[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isResolverCached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastDebtRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebuildCache","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"removeSynth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resolver","outputs":[{"internalType":"contract AddressResolverLightChain","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"resolverAddressesRequired","outputs":[{"internalType":"bytes32[]","name":"addresses","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bytes32","name":"_synthKey","type":"bytes32"},{"internalType":"uint256","name":"_synthAmount","type":"uint256"}],"name":"synthIssueFromSynthrSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"synths","outputs":[{"internalType":"contract ISynth","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"synthsByAddress","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"marginDelta","type":"uint256"}],"name":"transferMargin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x6080604052600436106101815760003560e01c806374185360116100d15780638da5cb5b1161008a578063ba0a462111610064578063ba0a462114610464578063d686c06c146104a4578063dbf63340146104c4578063f3445c03146104d957600080fd5b80638da5cb5b1461041157806393fe11ff14610431578063a91aaf4a1461044457600080fd5b8063741853601461037257806379ba5097146103875780637f9240c11461039c578063835e119c146103bc578063849cf588146103dc578063899ffef4146103fc57600080fd5b8063326080391161013e57806353a47bb71161011857806353a47bb7146102f3578063614d08f814610313578063692b26fc1461033057806372cb051f1461035057600080fd5b8063326080391461027b5780633b6afe40146102b15780633fa70f45146102de57600080fd5b806304f3bcec146101865780630b887dae146101c357806314d49413146101e55780631627540c1461020957806316b2213f146102295780632af64bd314610256575b600080fd5b34801561019257600080fd5b506002546101a6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101cf57600080fd5b506101e36101de366004612185565b6104f9565b005b3480156101f157600080fd5b506101fb60075481565b6040519081526020016101ba565b34801561021557600080fd5b506101e36102243660046121b3565b61050d565b34801561023557600080fd5b506101fb6102443660046121b3565b60066020526000908152604090205481565b34801561026257600080fd5b5061026b610569565b60405190151581526020016101ba565b34801561028757600080fd5b506101a6610296366004612185565b6005602052600090815260409020546001600160a01b031681565b3480156102bd57600080fd5b506102d16102cc3660046121d7565b610670565b6040516101ba919061224c565b3480156102ea57600080fd5b506101fb60a581565b3480156102ff57600080fd5b506001546101a6906001600160a01b031681565b34801561031f57600080fd5b506101fb6524b9b9bab2b960d11b81565b34801561033c57600080fd5b506101e361034b366004612299565b610741565b34801561035c57600080fd5b506103656108e0565b6040516101ba91906122ce565b34801561037e57600080fd5b506101e36108ef565b34801561039357600080fd5b506101e3610a69565b3480156103a857600080fd5b506101e36103b7366004612299565b610b53565b3480156103c857600080fd5b506101a66103d7366004612185565b610c85565b3480156103e857600080fd5b506101e36103f73660046121b3565b610caf565b34801561040857600080fd5b50610365610cc0565b34801561041d57600080fd5b506000546101a6906001600160a01b031681565b61026b61043f36600461232b565b610e51565b34801561045057600080fd5b506101fb61045f366004612390565b6110dd565b34801561047057600080fd5b5061048461047f366004612299565b61130c565b6040805194855260208501939093529183015260608201526080016101ba565b3480156104b057600080fd5b506101e36104bf3660046123bc565b611511565b3480156104d057600080fd5b506004546101fb565b3480156104e557600080fd5b506101fb6104f43660046123fd565b61154e565b610501611643565b61050a816116b7565b50565b610515611643565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229060200160405180910390a150565b600080610574610cc0565b905060005b81518110156106675760008282815181106105965761059661244f565b602090810291909101810151600081815260039092526040918290205460025492516321f8a72160e01b8152600481018390529193506001600160a01b039081169216906321f8a72190602401602060405180830381865afa158015610600573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106249190612465565b6001600160a01b031614158061064f57506000818152600360205260409020546001600160a01b0316155b1561065e576000935050505090565b50600101610579565b50600191505090565b60608160008167ffffffffffffffff81111561068e5761068e612482565b6040519080825280602002602001820160405280156106b7578160200160208202803683370190505b50905060005b8281101561073657600560008787848181106106db576106db61244f565b90506020020135815260200190815260200160002060009054906101000a90046001600160a01b03168282815181106107165761071661244f565b6001600160a01b03909216602092830291909101909101526001016106bd565b509150505b92915050565b600254604051633933006760e11b81523360048201526001600160a01b039091169063726600ce90602401602060405180830381865afa158015610789573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ad9190612498565b6108245760405162461bcd60e51b815260206004820152603e60248201527f4973737565723a204f6e6c79207468652053796e74687242726964676520636f60448201527f6e74726163742063616e20706572666f726d207468697320616374696f6e000060648201526084015b60405180910390fd5b6000828152600560205260409081902054905163219e412d60e21b81526001600160a01b038581166004830152602482018490529091169063867904b490604401600060405180830381600087803b15801561087f57600080fd5b505af1158015610893573d6000803e3d6000fd5b505060408051858152602081018590526001600160a01b03871693507f202da6c2722ee959428782559eb328b80668e3267ce37f597343103ecee7096d92500160405180910390a2505050565b60606108ea611b36565b905090565b60006108f9610cc0565b905060005b8151811015610a6557600082828151811061091b5761091b61244f565b602002602001015190506000600260009054906101000a90046001600160a01b03166001600160a01b031663dacb2d01838460405160200161098991907f5265736f6c766572206d697373696e67207461726765743a20000000000000008152601981019190915260390190565b6040516020818303038152906040526040518363ffffffff1660e01b81526004016109b59291906124fb565b602060405180830381865afa1580156109d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f69190612465565b60008381526003602090815260409182902080546001600160a01b0319166001600160a01b0385169081179091558251868152918201529192507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa68910160405180910390a150506001016108fe565b5050565b6001546001600160a01b03163314610ae15760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b606482015260840161081b565b600054600154604080516001600160a01b0393841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b610b5b611bf9565b610b63611c53565b6001600160a01b0316336001600160a01b03161480610b9a5750610b85611c6b565b6001600160a01b0316336001600160a01b0316145b610c0c5760405162461bcd60e51b815260206004820152603c60248201527f4973737565723a204f6e6c79207468652053796e7468725377617020636f6e7460448201527f726163742063616e20706572666f726d207468697320616374696f6e00000000606482015260840161081b565b6000828152600560205260409081902054905163219e412d60e21b81526001600160a01b038581166004830152602482018490529091169063867904b4906044015b600060405180830381600087803b158015610c6857600080fd5b505af1158015610c7c573d6000803e3d6000fd5b50505050505050565b60048181548110610c9557600080fd5b6000918252602090912001546001600160a01b0316905081565b610cb7611643565b61050a81611c8a565b60606000610ccc611e59565b6040805160078082526101008201909252919250600091906020820160e0803683370190505090506c45786368616e6765526174657360981b81600081518110610d1857610d1861244f565b6020026020010181815250506c29bcb73a342932b232b2b6b2b960991b81600181518110610d4857610d4861244f565b6020026020010181815250506b53797374656d53746174757360a01b81600281518110610d7757610d7761244f565b6020026020010181815250506c2bb930b83832b229bcb73a343960991b81600381518110610da757610da761244f565b6020026020010181815250506822bc31b430b733b2b960b91b81600481518110610dd357610dd361244f565b60200260200101818152505069053796e746872537761760b41b81600581518110610e0057610e0061244f565b602002602001018181525050700a6f2dce8d0e4a6eec2e0aed2e8d088caf607b1b81600681518110610e3457610e3461244f565b602002602001018181525050610e4a8282611eb0565b9250505090565b6000610e5b611bf9565b6000868152600560205260409020546001600160a01b0316610eb15760405162461bcd60e51b815260206004820152600f60248201526e4e6f2053796e74682065786973747360881b604482015260640161081b565b600086815260056020526040908190205490516370a0823160e01b81526001600160a01b038981166004830152879216906370a0823190602401602060405180830381865afa158015610f08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2c919061251c565b1015610f865760405162461bcd60e51b815260206004820152602360248201527f496e73756666696369656e742073796e746820616d6f756e7420746f2062726960448201526264676560e81b606482015260840161081b565b60008681526005602052604090819020549051632770a7eb60e21b81526001600160a01b0389811660048301526024820188905290911690639dc29fac90604401600060405180830381600087803b158015610fe157600080fd5b505af1158015610ff5573d6000803e3d6000fd5b5050505061100284611fae565b60405163bcc44cb160e01b81526001600160a01b038981166004830152602482018990526044820188905261ffff861660648301528415156084830152919091169063bcc44cb190349060a4016000604051808303818588803b15801561106857600080fd5b505af115801561107c573d6000803e3d6000fd5b5050604080518a8152602081018a905261ffff88168183015290516001600160a01b038c1694507fc1e18b2a3583b6bc0879a3f3f657c41adfb512076938208ec0b389d6d19874cb9350908190036060019150a25060019695505050505050565b60006110f86c2bb930b83832b229bcb73a343960991b61201b565b6001600160a01b0316336001600160a01b0316146111285760405162461bcd60e51b815260040161081b90612535565b6000611132612090565b6040516306c5a00b60e21b81526001600160a01b038681166004830152631cd554d160e21b60248301529190911690631b16802c906044016060604051808303816000875af1158015611189573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ad9190612592565b50909150839050811561125a57631cd554d160e21b60005260056020527f74c62d09fbc50aefae0794a9a068f786a692826fbdfe63828ec23a875865823f546040516370a0823160e01b81526001600160a01b038781166004830152909116906370a0823190602401602060405180830381865afa158015611233573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611257919061251c565b90505b6000848210611269578461126b565b815b631cd554d160e21b60005260056020527f74c62d09fbc50aefae0794a9a068f786a692826fbdfe63828ec23a875865823f54604051632770a7eb60e21b81526001600160a01b03898116600483015260248201849052929350911690639dc29fac90604401600060405180830381600087803b1580156112ea57600080fd5b505af11580156112fe573d6000803e3d6000fd5b509298975050505050505050565b60008060008061131a611bf9565b6113336c2bb930b83832b229bcb73a343960991b61201b565b6001600160a01b0316336001600160a01b0316146113635760405162461bcd60e51b815260040161081b90612535565b6000868152600560205260409020546001600160a01b03166113b95760405162461bcd60e51b815260206004820152600f60248201526e4e6f2053796e74682065786973747360881b604482015260640161081b565b600086815260056020526040908190205490516370a0823160e01b81526001600160a01b038981166004830152879216906370a0823190602401602060405180830381865afa158015611410573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611434919061251c565b101561148c5760405162461bcd60e51b815260206004820152602160248201527f496e73756666696369656e742073796e746820616d6f756e7420746f206275726044820152603760f91b606482015260840161081b565b60008681526005602052604090819020549051632770a7eb60e21b81526001600160a01b0389811660048301526024820188905290911690639dc29fac90604401600060405180830381600087803b1580156114e757600080fd5b505af11580156114fb573d6000803e3d6000fd5b5096996000995089985088975095505050505050565b6115196120a7565b604051632770a7eb60e21b81526001600160a01b03838116600483015260248201839052841690639dc29fac90604401610c4e565b600061ffff821615611636576040516bffffffffffffffffffffffff19606088901b16602082015260009060079060340160408051601f19818403018152908290526115a392918990899088906020016125c0565b60405160208183030381529060405290506115bd84611fae565b6001600160a01b0316632bb821bd826007866040518463ffffffff1660e01b81526004016115ed939291906125fd565b602060405180830381865afa15801561160a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162e919061251c565b91505061163a565b5060005b95945050505050565b6000546001600160a01b031633146116b55760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b606482015260840161081b565b565b6000818152600560205260409020546001600160a01b0316806117135760405162461bcd60e51b815260206004820152601460248201527314de5b9d1a08191bd95cc81b9bdd08195e1a5cdd60621b604482015260640161081b565b631cd554d160e21b820361175f5760405162461bcd60e51b8152602060048201526013602482015272086c2dcdcdee840e4cadadeecca40e6f2dce8d606b1b604482015260640161081b565b6000816001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561179f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c3919061251c565b905080156119c4576000806117d6612135565b60405163414a80b560e11b81526004810187905260248101859052631cd554d160e21b60448201526001600160a01b039190911690638295016a90606401606060405180830381865afa158015611831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118559190612592565b5091509150600081116118bd5760405162461bcd60e51b815260206004820152602a60248201527f43616e6e6f742072656d6f76652073796e746820746f2072656465656d20776960448201526974686f7574207261746560b01b606482015260840161081b565b60006118c7612150565b631cd554d160e21b60005260056020527f74c62d09fbc50aefae0794a9a068f786a692826fbdfe63828ec23a875865823f5460405163219e412d60e21b81526001600160a01b0380841660048301526024820187905292935091169063867904b490604401600060405180830381600087803b15801561194657600080fd5b505af115801561195a573d6000803e3d6000fd5b5050604051630e9c166760e21b81526001600160a01b0388811660048301526024820186905284169250633a70599c9150604401600060405180830381600087803b1580156119a857600080fd5b505af11580156119bc573d6000803e3d6000fd5b505050505050505b60005b600454811015611ac257826001600160a01b0316600482815481106119ee576119ee61244f565b6000918252602090912001546001600160a01b031603611aba5760048054611a1890600190612641565b81548110611a2857611a2861244f565b600091825260209091200154600480546001600160a01b039092169183908110611a5457611a5461244f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506004805480611a9357611a93612654565b600082815260209020810160001990810180546001600160a01b0319169055019055611ac2565b6001016119c7565b506001600160a01b0382166000818152600660209081526040808320839055868352600582529182902080546001600160a01b03191690558151868152908101929092527f6166f5c475cc1cd535c6cdf14a6d5edb811e34117031fc2863392a136eb655d0910160405180910390a1505050565b60045460609060009067ffffffffffffffff811115611b5757611b57612482565b604051908082528060200260200182016040528015611b80578160200160208202803683370190505b50905060005b600454811015611bf3576006600060048381548110611ba757611ba761244f565b60009182526020808320909101546001600160a01b031683528201929092526040019020548251839083908110611be057611be061244f565b6020908102919091010152600101611b86565b50919050565b611c0161216b565b6001600160a01b031663086dabd16040518163ffffffff1660e01b815260040160006040518083038186803b158015611c3957600080fd5b505afa158015611c4d573d6000803e3d6000fd5b50505050565b60006108ea69053796e746872537761760b41b61201b565b60006108ea700a6f2dce8d0e4a6eec2e0aed2e8d088caf607b1b61201b565b6000816001600160a01b031663dbd06c856040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cee919061251c565b6000818152600560205260409020549091506001600160a01b031615611d455760405162461bcd60e51b815260206004820152600c60248201526b53796e74682065786973747360a01b604482015260640161081b565b6001600160a01b03821660009081526006602052604090205415611dab5760405162461bcd60e51b815260206004820152601c60248201527f53796e7468206164647265737320616c72656164792065786973747300000000604482015260640161081b565b60048054600181019091557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0384166001600160a01b0319918216811790925560008381526005602090815260408083208054909416851790935583825260068152908290208490558151848152908101929092527f0a2b6ebf143b3e9fcd67e17748ad315174746100c27228468b2c98c302c62884910160405180910390a15050565b604080516001808252818301909252606091602080830190803683370190505090506e466c657869626c6553746f7261676560881b81600081518110611ea157611ea161244f565b60200260200101818152505090565b606081518351611ec0919061266a565b67ffffffffffffffff811115611ed857611ed8612482565b604051908082528060200260200182016040528015611f01578160200160208202803683370190505b50905060005b8351811015611f4f57838181518110611f2257611f2261244f565b6020026020010151828281518110611f3c57611f3c61244f565b6020908102919091010152600101611f07565b5060005b8251811015611fa757828181518110611f6e57611f6e61244f565b602002602001015182828651611f84919061266a565b81518110611f9457611f9461244f565b6020908102919091010152600101611f53565b5092915050565b60025460405162c8ac9760e41b8152600481018390526000916001600160a01b031690630c8ac97090602401602060405180830381865afa158015611ff7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073b9190612465565b600081815260036020908152604080832054905170026b4b9b9b4b7339030b2323932b9b99d1607d1b92810192909252603182018490526001600160a01b0316908115159060510160405160208183030381529060405290611fa75760405162461bcd60e51b815260040161081b919061267d565b60006108ea6822bc31b430b733b2b960b91b61201b565b6120af612150565b6001600160a01b0316336001600160a01b0316146116b55760405162461bcd60e51b815260206004820152603f60248201527f4973737565723a204f6e6c79207468652053796e746852656465656d6572206360448201527f6f6e74726163742063616e20706572666f726d207468697320616374696f6e00606482015260840161081b565b60006108ea6c45786368616e6765526174657360981b61201b565b60006108ea6c29bcb73a342932b232b2b6b2b960991b61201b565b60006108ea6b53797374656d53746174757360a01b61201b565b60006020828403121561219757600080fd5b5035919050565b6001600160a01b038116811461050a57600080fd5b6000602082840312156121c557600080fd5b81356121d08161219e565b9392505050565b600080602083850312156121ea57600080fd5b823567ffffffffffffffff8082111561220257600080fd5b818501915085601f83011261221657600080fd5b81358181111561222557600080fd5b8660208260051b850101111561223a57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b8181101561228d5783516001600160a01b031683529284019291840191600101612268565b50909695505050505050565b6000806000606084860312156122ae57600080fd5b83356122b98161219e565b95602085013595506040909401359392505050565b6020808252825182820181905260009190848201906040850190845b8181101561228d578351835292840192918401916001016122ea565b803561ffff8116811461231857600080fd5b919050565b801515811461050a57600080fd5b60008060008060008060c0878903121561234457600080fd5b863561234f8161219e565b955060208701359450604087013593506060870135925061237260808801612306565b915060a08701356123828161231d565b809150509295509295509295565b600080604083850312156123a357600080fd5b82356123ae8161219e565b946020939093013593505050565b6000806000606084860312156123d157600080fd5b83356123dc8161219e565b925060208401356123ec8161219e565b929592945050506040919091013590565b600080600080600060a0868803121561241557600080fd5b85356124208161219e565b945060208601359350604086013592506060860135915061244360808701612306565b90509295509295909350565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561247757600080fd5b81516121d08161219e565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156124aa57600080fd5b81516121d08161231d565b6000815180845260005b818110156124db576020818501810151868301820152016124bf565b506000602082860101526020601f19601f83011685010191505092915050565b82815260406020820152600061251460408301846124b5565b949350505050565b60006020828403121561252e57600080fd5b5051919050565b6020808252603f908201527f4973737565723a204f6e6c7920746865205772617070656453796e746872206360408201527f6f6e74726163742063616e20706572666f726d207468697320616374696f6e00606082015260800190565b6000806000606084860312156125a757600080fd5b8351925060208401519150604084015190509250925092565b600061ffff808816835260a060208401526125de60a08401886124b5565b6040840196909652606083019490945250911660809091015292915050565b60608152600061261060608301866124b5565b61ffff94851660208401529290931660409091015292915050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561073b5761073b61262b565b634e487b7160e01b600052603160045260246000fd5b8082018082111561073b5761073b61262b565b6020815260006121d060208301846124b556fea2646970667358221220cb26dfafc69a7cc1a11a959b912ae77eaaea46986b88e9e9508d08416fc63a7164736f6c63430008180033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ 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.