ETH Price: $3,419.67 (-0.00%)
Gas: 48 Gwei

Contract

0xBbBe37FE58e9859b6943AC53bDf4d0827f7F0034
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Initialize179876242023-08-24 22:45:59190 days ago1692917159IN
0xBbBe37FE...27f7F0034
0 ETH0.0011728822.98235413
0x60808060179876232023-08-24 22:45:47190 days ago1692917147IN
 Create: ExchangeRateRegistry
0 ETH0.02632421.85881478

Latest 25 internal transactions (View All)

Advanced mode:
Parent Txn Hash Block From To Value
193134532024-02-26 18:14:234 days ago1708971263
0xBbBe37FE...27f7F0034
0 ETH
193134532024-02-26 18:14:234 days ago1708971263
0xBbBe37FE...27f7F0034
0 ETH
193134532024-02-26 18:14:234 days ago1708971263
0xBbBe37FE...27f7F0034
0 ETH
193134532024-02-26 18:14:234 days ago1708971263
0xBbBe37FE...27f7F0034
0 ETH
193134532024-02-26 18:14:234 days ago1708971263
0xBbBe37FE...27f7F0034
0 ETH
193134432024-02-26 18:12:234 days ago1708971143
0xBbBe37FE...27f7F0034
0 ETH
193134432024-02-26 18:12:234 days ago1708971143
0xBbBe37FE...27f7F0034
0 ETH
193134432024-02-26 18:12:234 days ago1708971143
0xBbBe37FE...27f7F0034
0 ETH
193134432024-02-26 18:12:234 days ago1708971143
0xBbBe37FE...27f7F0034
0 ETH
193134432024-02-26 18:12:234 days ago1708971143
0xBbBe37FE...27f7F0034
0 ETH
192958052024-02-24 6:58:357 days ago1708757915
0xBbBe37FE...27f7F0034
0 ETH
192958052024-02-24 6:58:357 days ago1708757915
0xBbBe37FE...27f7F0034
0 ETH
192958052024-02-24 6:58:357 days ago1708757915
0xBbBe37FE...27f7F0034
0 ETH
192958052024-02-24 6:58:357 days ago1708757915
0xBbBe37FE...27f7F0034
0 ETH
192958052024-02-24 6:58:357 days ago1708757915
0xBbBe37FE...27f7F0034
0 ETH
192957572024-02-24 6:48:597 days ago1708757339
0xBbBe37FE...27f7F0034
0 ETH
192957572024-02-24 6:48:597 days ago1708757339
0xBbBe37FE...27f7F0034
0 ETH
192957572024-02-24 6:48:597 days ago1708757339
0xBbBe37FE...27f7F0034
0 ETH
192957572024-02-24 6:48:597 days ago1708757339
0xBbBe37FE...27f7F0034
0 ETH
192957572024-02-24 6:48:597 days ago1708757339
0xBbBe37FE...27f7F0034
0 ETH
192891482024-02-23 8:37:478 days ago1708677467
0xBbBe37FE...27f7F0034
0 ETH
192891482024-02-23 8:37:478 days ago1708677467
0xBbBe37FE...27f7F0034
0 ETH
192891482024-02-23 8:37:478 days ago1708677467
0xBbBe37FE...27f7F0034
0 ETH
192891482024-02-23 8:37:478 days ago1708677467
0xBbBe37FE...27f7F0034
0 ETH
192891482024-02-23 8:37:478 days ago1708677467
0xBbBe37FE...27f7F0034
0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ExchangeRateRegistry

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 10000 runs

Other Settings:
paris EvmVersion
File 1 of 9 : ExchangeRateRegistry.sol
// SPDX-License-Identifier: BUSL-1.1
/*
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•¦β•β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•¦β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β•šβ•β•β–‘β–ˆβ–ˆβ•‘
β•šβ•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β–‘β–‘β•šβ•β•β•β•β•β–‘β•šβ•β•β–‘β–‘β–‘β–‘β–‘β•šβ•β•
*/

pragma solidity 0.8.19;

import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol";

import "../interfaces/IBPSFeed.sol";
import "../interfaces/IBloomPool.sol";

/**
 * @title ExchangeRateRegistry
 * @notice Manage tokens and exchange rates
 * @dev This contract stores:
 * 1. Address of all TBYs
 * 2. Exchange rate of each TBY
 * 3. If TBY is active or not
 */
contract ExchangeRateRegistry is Ownable {
    using EnumerableSet for EnumerableSet.AddressSet;

    uint256 public constant INITIAL_FEED_RATE = 1e4;
    uint256 public constant BASE_RATE = 1e18;
    uint256 public constant ONE_YEAR = 360 days;
    uint256 public constant SCALER = 1e14;

    struct TokenInfo {
        bool registered;
        bool active;
        address pool;
        uint256 createdAt;
    }

    /**
     * @notice Mapping of token to TokenInfo
     */
    mapping(address => TokenInfo) public tokenInfos;

    /**
     * @dev Group of active tokens
     */
    EnumerableSet.AddressSet internal _activeTokens;

    /**
     * @dev Group of inactive tokens
     */
    EnumerableSet.AddressSet internal _inactiveTokens;

    /**
     * @dev Indicates that the contract has been _initialized
     */
    bool internal _initialized;

    /**
     * @notice Emitted when token is registered
     * @param token The token address to register
     * @param pool The pool associated with the token
     * @param createdAt Timestamp of the token creation
     */
    event TokenRegistered(
        address indexed token,
        address pool,
        uint256 createdAt
    );

    /**
     * @notice Emitted when token is activated
     * @param token The token address
     */
    event TokenActivated(address token);

    /**
     * @notice Emitted when token is inactivated
     * @param token The token address
     */
    event TokenInactivated(address token);

    /**
     * @dev Function to initialize the contract
     * @dev Can an only be called once by the deployer of the contract
     * @dev The caller is responsible for ensuring that both the new owner and the token contract are configured correctly
     * @param newOwner The address of the new owner of the exchange rate updater contract, can either be an EOA or a contract
     */
    function initialize(address newOwner) external onlyOwner {
        require(
            !_initialized,
            "ExchangeRateRegistry: contract is already initialized"
        );
        require(
            newOwner != address(0),
            "ExchangeRateRegistry: owner is the zero address"
        );
        transferOwnership(newOwner);
        _initialized = true;
    }

    /**
     * @notice Register new token to the registry
     * @param token The token address to register
     * @param pool The pool associated with the token
     */
    function registerToken(
        address token,
        address pool
    ) external onlyOwner {
        IBloomPool poolContract = IBloomPool(pool);
        uint256 createdAt = poolContract.COMMIT_PHASE_END();

        TokenInfo storage info = tokenInfos[token];
        require(
            !info.registered,
            "ExchangeRateRegistry: token already registered"
        );

        info.registered = true;
        info.active = true;
        info.pool = pool;
        info.createdAt = createdAt;

        _activeTokens.add(token);

        emit TokenRegistered(token, pool, createdAt);
    }

    /**
     * @notice Activate the token
     * @param token The token address to activate
     */
    function activateToken(address token) external onlyOwner {
        TokenInfo storage info = tokenInfos[token];
        require(info.registered, "ExchangeRateRegistry: token not registered");
        require(!info.active, "ExchangeRateRegistry: token is active");

        info.active = true;

        _activeTokens.add(token);
        _inactiveTokens.remove(token);

        emit TokenActivated(token);
    }

    /**
     * @notice Inactivate the token
     * @param token The token address to inactivate
     */
    function inactivateToken(address token) external onlyOwner {
        TokenInfo storage info = tokenInfos[token];
        require(info.active, "ExchangeRateRegistry: token is inactive");

        info.active = false;

        _activeTokens.remove(token);
        _inactiveTokens.add(token);

        emit TokenInactivated(token);
    }

    /**
     * @notice Return list of active tokens
     */
    function getActiveTokens() external view returns (address[] memory) {
        return _activeTokens.values();
    }

    /**
     * @notice Return list of inactive tokens
     */
    function getInactiveTokens() external view returns (address[] memory) {
        return _inactiveTokens.values();
    }

    /**
     * @notice Return true if the registry has been initialized
     */
    function isRegistryInitialized() external view returns (bool) {
        return _initialized;
    }

    /**
     * @notice Returns the current exchange rate of the given token
     * @param token The token address
     * @return The current exchange rate of the given token
     */
    function getExchangeRate(address token) external view returns (uint256) {
        return _getExchangeRate(token);
    }

    function _getExchangeRate(address token) internal view returns (uint256) {
        TokenInfo storage info = tokenInfos[token];
        require(info.registered, "ExchangeRateRegistry: token not registered");

        IBloomPool pool = IBloomPool(info.pool);
        uint256 lenderFee = pool.LENDER_RETURN_FEE();
        uint256 duration = pool.POOL_PHASE_DURATION();
        IBPSFeed bpsFeed = IBPSFeed(pool.LENDER_RETURN_BPS_FEED());

        uint256 rate = (bpsFeed.getWeightedRate() - INITIAL_FEED_RATE) * SCALER;
        uint256 timeElapsed = block.timestamp - info.createdAt;
        if (timeElapsed > duration) {
            timeElapsed = duration;
        }
        uint256 adjustedLenderFee = (lenderFee * SCALER);
        
        uint256 delta = ((rate * (BASE_RATE - adjustedLenderFee) / 1e18) * timeElapsed) / 
            ONE_YEAR;

        return BASE_RATE + delta;
    }
}

File 2 of 9 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

File 3 of 9 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

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

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }
}

File 4 of 9 : IBPSFeed.sol
// SPDX-License-Identifier: BUSL-1.1
/*
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•¦β•β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•¦β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β•šβ•β•β–‘β–ˆβ–ˆβ•‘
β•šβ•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β–‘β–‘β•šβ•β•β•β•β•β–‘β•šβ•β•β–‘β–‘β–‘β–‘β–‘β•šβ•β•
*/

pragma solidity ^0.8.0;

interface IBPSFeed {
    error InvalidRate();

    event UpdateRate(uint256 currentRate);

    /// @notice Returns weighted rate
    function getWeightedRate() external view returns (uint256);

    /// @notice Returns current rate
    function currentRate() external view returns (uint256);

    /// @notice Returns last timestamp the rate was set
    function lastTimestamp() external view returns (uint256);

    /// @notice Sets new rate
    /// @param rate New rate
    function updateRate(uint256 rate) external;
}

File 5 of 9 : IBloomPool.sol
// SPDX-License-Identifier: BUSL-1.1
/*
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•¦β•β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•¦β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β•šβ•β•β–‘β–ˆβ–ˆβ•‘
β•šβ•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β–‘β–‘β•šβ•β•β•β•β•β–‘β•šβ•β•β–‘β–‘β–‘β–‘β–‘β•šβ•β•
*/

pragma solidity 0.8.19;

import {AssetCommitment} from "../lib/CommitmentsLib.sol";
import {IWhitelist} from "../interfaces/IWhitelist.sol";

enum State {
    Other,
    Commit,
    ReadyPreHoldSwap,
    PendingPreHoldSwap,
    Holding,
    ReadyPostHoldSwap,
    PendingPostHoldSwap,
    EmergencyExit,
    FinalWithdraw
}

interface IBloomPool {
    // Initialization errors
    error ZeroAddress();

    error NotSwapFacility();
    error InvalidOutToken(address outToken);

    error NotWhitelisted();
    error NoCommitToProcess();
    error CommitTooSmall();

    error CanOnlyWithdrawProcessedCommit(uint256 id);
    error NoCommitToWithdraw();

    error InvalidState(State current);

    error NotEmergencyHandler();

    event BorrowerCommit(address indexed owner, uint256 indexed id, uint256 amount, uint256 cumulativeAmountEnd);
    event LenderCommit(address indexed owner, uint256 indexed id, uint256 amount, uint256 cumulativeAmountEnd);
    event BorrowerCommitmentProcessed(
        address indexed owner, uint256 indexed id, uint256 includedAmount, uint256 excludedAmount
    );
    event LenderCommitmentProcessed(
        address indexed owner, uint256 indexed id, uint256 includedAmount, uint256 excludedAmount
    );
    event ExplictStateTransition(State prevState, State newState);
    event BorrowerWithdraw(address indexed owner, uint256 indexed id, uint256 amount);
    event LenderWithdraw(address indexed owner, uint256 sharesRedeemed, uint256 amount);

    event EmergencyWithdraw(address indexed to);

    /// @notice Initiates the pre-hold swap.
    function initiatePreHoldSwap() external;

    /// @notice Initiates the post-hold swap.
    function initiatePostHoldSwap() external;

    /**
     * @notice Deposits funds from the borrower committing them for the duration of the commit
     * phase.
     * @param amount The amount of tokens to deposit.
     * @param proof The whitelist proof data, format dependent on implementation.
     * @return newCommitmentId The commitment ID for the borrower's new deposit.
     */
    function depositBorrower(uint256 amount, bytes32[] calldata proof) external returns (uint256 newCommitmentId);
    /**
     * @notice Deposits funds from the lender committing them for the duration of the commit phase.
     * @param amount The amount of stablecoins to deposit.
     * @return newCommitmentId The commitment ID for the lender deposit.
     */
    function depositLender(uint256 amount) external returns (uint256 newCommitmentId);

    /**
     * @notice Processes a borrower's commit, calculates the included and excluded amounts, and refunds any unmatched amounts.
     * @param commitId The borrower's commitment ID.
     */
    function processBorrowerCommit(uint256 commitId) external;

    /**
     * @notice Processes a lender's commit, calculates the included and excluded amounts, mints shares, and refunds any unmatched amounts.
     * @param commitId The lender's commitment ID.
     */
    function processLenderCommit(uint256 commitId) external;

    /**
     * @notice Allows borrowers to withdraw their share of the returned stablecoins after the pool phase has ended and swaps have been completed.
     * @param id The borrower's commitment ID.
     */
    function withdrawBorrower(uint256 id) external;

    /**
     * @notice Allows lenders to withdraw their share of the returned stablecoins and earned interest after the pool phase has ended and swaps have been completed.
     * @param shares The number of lender shares to withdraw.
     */
    function withdrawLender(uint256 shares) external;

    function UNDERLYING_TOKEN() external view returns (address);
    function BILL_TOKEN() external view returns (address);
    function WHITELIST() external view returns (IWhitelist);
    function SWAP_FACILITY() external view returns (address);
    function TREASURY() external view returns (address);
    function LENDER_RETURN_BPS_FEED() external view returns (address);
    function LEVERAGE_BPS() external view returns (uint256);
    function MIN_BORROW_DEPOSIT() external view returns (uint256);
    function COMMIT_PHASE_END() external view returns (uint256);
    function PRE_HOLD_SWAP_TIMEOUT_END() external view returns (uint256);
    function POOL_PHASE_END() external view returns (uint256);
    function POOL_PHASE_DURATION() external view returns (uint256);
    function LENDER_RETURN_FEE() external view returns (uint256);
    function BORROWER_RETURN_FEE() external view returns (uint256);

    function state() external view returns (State currentState);
    function totalMatchAmount() external view returns (uint256);

    function getBorrowCommitment(uint256 id) external view returns (AssetCommitment memory);
    function getLenderCommitment(uint256 id) external view returns (AssetCommitment memory);

    function getTotalBorrowCommitment()
        external
        view
        returns (uint256 totalAssetsCommited, uint256 totalCommitmentCount);
    function getTotalLendCommitment()
        external
        view
        returns (uint256 totalAssetsCommited, uint256 totalCommitmentCount);

    function getDistributionInfo()
        external
        view
        returns (
            uint128 borrowerDistribution,
            uint128 totalBorrowerShares,
            uint128 lenderDistribution,
            uint128 totalLenderShares
        );
}

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

pragma solidity ^0.8.0;

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

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

File 7 of 9 : CommitmentsLib.sol
// SPDX-License-Identifier: BUSL-1.1
/*
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•¦β•β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•¦β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β•šβ•β•β–‘β–ˆβ–ˆβ•‘
β•šβ•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β–‘β–‘β•šβ•β•β•β•β•β–‘β•šβ•β•β–‘β–‘β–‘β–‘β–‘β•šβ•β•
*/

pragma solidity 0.8.19;

import {SafeCastLib} from "solady/utils/SafeCastLib.sol";

struct AssetCommitment {
    address owner;
    uint128 committedAmount;
    uint128 cumulativeAmountEnd;
}

struct Commitments {
    mapping(uint256 => AssetCommitment) commitments;
    uint64 commitmentCount;
    uint192 totalAssetsCommitted;
}


library CommitmentsLib {
    using SafeCastLib for uint256;

    error NonexistentCommit();

    function add(Commitments storage commitments, address owner, uint256 amount)
        internal
        returns (uint256 newCommitmendId, uint256 cumulativeAmountEnd)
    {
        uint256 commitmentCount = commitments.commitmentCount;
        unchecked {
            newCommitmendId = commitmentCount++;
        }
        cumulativeAmountEnd = commitments.totalAssetsCommitted + amount;
        commitments.commitments[newCommitmendId] = AssetCommitment({
            owner: owner,
            committedAmount: uint128(amount),
            cumulativeAmountEnd: cumulativeAmountEnd.toUint128()
        });
        commitments.commitmentCount = commitmentCount.toUint64();
        // If safe cast to uint128 did not fail cast to uint192 cannot truncate.
        commitments.totalAssetsCommitted = uint192(cumulativeAmountEnd);
    }

    function getAmountSplit(AssetCommitment storage commitment, uint256 totalIncludedAmount)
        internal
        view
        returns (uint256 includedAmount, uint256 excludedAmount)
    {
        uint256 committedAmount = commitment.committedAmount;
        uint256 cumulativeAmountEnd = commitment.cumulativeAmountEnd;
        if (totalIncludedAmount >= cumulativeAmountEnd) {
            includedAmount = committedAmount;
            excludedAmount = 0;
        } else {
            uint256 cumulativeAmountStart = cumulativeAmountEnd - committedAmount;
            if (cumulativeAmountStart > totalIncludedAmount) {
                includedAmount = 0;
                excludedAmount = committedAmount;
            } else {
                unchecked {
                    includedAmount = totalIncludedAmount - cumulativeAmountStart;
                    excludedAmount = committedAmount - includedAmount;
                }
            }
        }
    }

    function get(Commitments storage commitments, uint256 id) internal view returns (AssetCommitment storage) {
        if (id >= commitments.commitmentCount) {
            revert NonexistentCommit();
        }
        return commitments.commitments[id];
    }
}

File 8 of 9 : IWhitelist.sol
// SPDX-License-Identifier: BUSL-1.1
/*
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•¦β•β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•¦β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β•šβ•β•β–‘β–ˆβ–ˆβ•‘
β•šβ•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β–‘β–‘β•šβ•β•β•β•β•β–‘β•šβ•β•β–‘β–‘β–‘β–‘β–‘β•šβ•β•
*/

pragma solidity 0.8.19;

interface IWhitelist {
    event NewWhitelistRoot(bytes32 newRoot);

    function setRoot(bytes32 newRoot) external;

    function isWhitelisted(address member, bytes32[] calldata proof) external returns (bool);
}

File 9 of 9 : SafeCastLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Safe integer casting library that reverts on overflow.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeCastLib.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)
library SafeCastLib {
    /*´:°β€’.°+.*β€’´.*:˚.°*.Λšβ€’´.°:°β€’.°β€’.*β€’´.*:˚.°*.Λšβ€’´.°:°β€’.°+.*β€’´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.β€’°:°.´+˚.*°.˚:*.´β€’*.+°.β€’°:´*.´β€’*.β€’°.β€’°:°.´:β€’Λš°.*°.˚:*.´+°.β€’*/

    error Overflow();

    /*´:°β€’.°+.*β€’´.*:˚.°*.Λšβ€’´.°:°β€’.°β€’.*β€’´.*:˚.°*.Λšβ€’´.°:°β€’.°+.*β€’´.*:*/
    /*          UNSIGNED INTEGER SAFE CASTING OPERATIONS          */
    /*.β€’°:°.´+˚.*°.˚:*.´β€’*.+°.β€’°:´*.´β€’*.β€’°.β€’°:°.´:β€’Λš°.*°.˚:*.´+°.β€’*/

    function toUint8(uint256 x) internal pure returns (uint8) {
        if (x >= 1 << 8) _revertOverflow();
        return uint8(x);
    }

    function toUint16(uint256 x) internal pure returns (uint16) {
        if (x >= 1 << 16) _revertOverflow();
        return uint16(x);
    }

    function toUint24(uint256 x) internal pure returns (uint24) {
        if (x >= 1 << 24) _revertOverflow();
        return uint24(x);
    }

    function toUint32(uint256 x) internal pure returns (uint32) {
        if (x >= 1 << 32) _revertOverflow();
        return uint32(x);
    }

    function toUint40(uint256 x) internal pure returns (uint40) {
        if (x >= 1 << 40) _revertOverflow();
        return uint40(x);
    }

    function toUint48(uint256 x) internal pure returns (uint48) {
        if (x >= 1 << 48) _revertOverflow();
        return uint48(x);
    }

    function toUint56(uint256 x) internal pure returns (uint56) {
        if (x >= 1 << 56) _revertOverflow();
        return uint56(x);
    }

    function toUint64(uint256 x) internal pure returns (uint64) {
        if (x >= 1 << 64) _revertOverflow();
        return uint64(x);
    }

    function toUint72(uint256 x) internal pure returns (uint72) {
        if (x >= 1 << 72) _revertOverflow();
        return uint72(x);
    }

    function toUint80(uint256 x) internal pure returns (uint80) {
        if (x >= 1 << 80) _revertOverflow();
        return uint80(x);
    }

    function toUint88(uint256 x) internal pure returns (uint88) {
        if (x >= 1 << 88) _revertOverflow();
        return uint88(x);
    }

    function toUint96(uint256 x) internal pure returns (uint96) {
        if (x >= 1 << 96) _revertOverflow();
        return uint96(x);
    }

    function toUint104(uint256 x) internal pure returns (uint104) {
        if (x >= 1 << 104) _revertOverflow();
        return uint104(x);
    }

    function toUint112(uint256 x) internal pure returns (uint112) {
        if (x >= 1 << 112) _revertOverflow();
        return uint112(x);
    }

    function toUint120(uint256 x) internal pure returns (uint120) {
        if (x >= 1 << 120) _revertOverflow();
        return uint120(x);
    }

    function toUint128(uint256 x) internal pure returns (uint128) {
        if (x >= 1 << 128) _revertOverflow();
        return uint128(x);
    }

    function toUint136(uint256 x) internal pure returns (uint136) {
        if (x >= 1 << 136) _revertOverflow();
        return uint136(x);
    }

    function toUint144(uint256 x) internal pure returns (uint144) {
        if (x >= 1 << 144) _revertOverflow();
        return uint144(x);
    }

    function toUint152(uint256 x) internal pure returns (uint152) {
        if (x >= 1 << 152) _revertOverflow();
        return uint152(x);
    }

    function toUint160(uint256 x) internal pure returns (uint160) {
        if (x >= 1 << 160) _revertOverflow();
        return uint160(x);
    }

    function toUint168(uint256 x) internal pure returns (uint168) {
        if (x >= 1 << 168) _revertOverflow();
        return uint168(x);
    }

    function toUint176(uint256 x) internal pure returns (uint176) {
        if (x >= 1 << 176) _revertOverflow();
        return uint176(x);
    }

    function toUint184(uint256 x) internal pure returns (uint184) {
        if (x >= 1 << 184) _revertOverflow();
        return uint184(x);
    }

    function toUint192(uint256 x) internal pure returns (uint192) {
        if (x >= 1 << 192) _revertOverflow();
        return uint192(x);
    }

    function toUint200(uint256 x) internal pure returns (uint200) {
        if (x >= 1 << 200) _revertOverflow();
        return uint200(x);
    }

    function toUint208(uint256 x) internal pure returns (uint208) {
        if (x >= 1 << 208) _revertOverflow();
        return uint208(x);
    }

    function toUint216(uint256 x) internal pure returns (uint216) {
        if (x >= 1 << 216) _revertOverflow();
        return uint216(x);
    }

    function toUint224(uint256 x) internal pure returns (uint224) {
        if (x >= 1 << 224) _revertOverflow();
        return uint224(x);
    }

    function toUint232(uint256 x) internal pure returns (uint232) {
        if (x >= 1 << 232) _revertOverflow();
        return uint232(x);
    }

    function toUint240(uint256 x) internal pure returns (uint240) {
        if (x >= 1 << 240) _revertOverflow();
        return uint240(x);
    }

    function toUint248(uint256 x) internal pure returns (uint248) {
        if (x >= 1 << 248) _revertOverflow();
        return uint248(x);
    }

    /*´:°β€’.°+.*β€’´.*:˚.°*.Λšβ€’´.°:°β€’.°β€’.*β€’´.*:˚.°*.Λšβ€’´.°:°β€’.°+.*β€’´.*:*/
    /*           SIGNED INTEGER SAFE CASTING OPERATIONS           */
    /*.β€’°:°.´+˚.*°.˚:*.´β€’*.+°.β€’°:´*.´β€’*.β€’°.β€’°:°.´:β€’Λš°.*°.˚:*.´+°.β€’*/

    function toInt8(int256 x) internal pure returns (int8) {
        int8 y = int8(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt16(int256 x) internal pure returns (int16) {
        int16 y = int16(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt24(int256 x) internal pure returns (int24) {
        int24 y = int24(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt32(int256 x) internal pure returns (int32) {
        int32 y = int32(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt40(int256 x) internal pure returns (int40) {
        int40 y = int40(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt48(int256 x) internal pure returns (int48) {
        int48 y = int48(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt56(int256 x) internal pure returns (int56) {
        int56 y = int56(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt64(int256 x) internal pure returns (int64) {
        int64 y = int64(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt72(int256 x) internal pure returns (int72) {
        int72 y = int72(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt80(int256 x) internal pure returns (int80) {
        int80 y = int80(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt88(int256 x) internal pure returns (int88) {
        int88 y = int88(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt96(int256 x) internal pure returns (int96) {
        int96 y = int96(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt104(int256 x) internal pure returns (int104) {
        int104 y = int104(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt112(int256 x) internal pure returns (int112) {
        int112 y = int112(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt120(int256 x) internal pure returns (int120) {
        int120 y = int120(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt128(int256 x) internal pure returns (int128) {
        int128 y = int128(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt136(int256 x) internal pure returns (int136) {
        int136 y = int136(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt144(int256 x) internal pure returns (int144) {
        int144 y = int144(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt152(int256 x) internal pure returns (int152) {
        int152 y = int152(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt160(int256 x) internal pure returns (int160) {
        int160 y = int160(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt168(int256 x) internal pure returns (int168) {
        int168 y = int168(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt176(int256 x) internal pure returns (int176) {
        int176 y = int176(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt184(int256 x) internal pure returns (int184) {
        int184 y = int184(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt192(int256 x) internal pure returns (int192) {
        int192 y = int192(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt200(int256 x) internal pure returns (int200) {
        int200 y = int200(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt208(int256 x) internal pure returns (int208) {
        int208 y = int208(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt216(int256 x) internal pure returns (int216) {
        int216 y = int216(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt224(int256 x) internal pure returns (int224) {
        int224 y = int224(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt232(int256 x) internal pure returns (int232) {
        int232 y = int232(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt240(int256 x) internal pure returns (int240) {
        int240 y = int240(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt248(int256 x) internal pure returns (int248) {
        int248 y = int248(x);
        if (x != y) _revertOverflow();
        return y;
    }

    /*´:°β€’.°+.*β€’´.*:˚.°*.Λšβ€’´.°:°β€’.°β€’.*β€’´.*:˚.°*.Λšβ€’´.°:°β€’.°+.*β€’´.*:*/
    /*                      PRIVATE HELPERS                       */
    /*.β€’°:°.´+˚.*°.˚:*.´β€’*.+°.β€’°:´*.´β€’*.β€’°.β€’°:°.´:β€’Λš°.*°.˚:*.´+°.β€’*/

    function _revertOverflow() private pure {
        /// @solidity memory-safe-assembly
        assembly {
            // Store the function selector of `Overflow()`.
            mstore(0x00, 0x35278d12)
            // Revert with (offset, size).
            revert(0x1c, 0x04)
        }
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-safe/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-safe/=lib/forge-safe/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "solady/=lib/solady/src/",
    "solidity-stringutils/=lib/forge-safe/lib/surl/lib/solidity-stringutils/",
    "solmate/=lib/solmate/src/",
    "surl/=lib/forge-safe/lib/surl/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "metadata": {
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"TokenActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"TokenInactivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"createdAt","type":"uint256"}],"name":"TokenRegistered","type":"event"},{"inputs":[],"name":"BASE_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INITIAL_FEED_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONE_YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SCALER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"activateToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getActiveTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getExchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInactiveTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"inactivateToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isRegistryInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"pool","type":"address"}],"name":"registerToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenInfos","outputs":[{"internalType":"bool","name":"registered","type":"bool"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"createdAt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080806040523461005b5760008054336001600160a01b0319821681178355916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a361148b90816100618239f35b600080fdfe6080604081815260048036101561001557600080fd5b600092833560e01c90816307a32b3914610dd5575080630d1ce2d214610c9157806316d3bfbb14610c725780632b19224714610c4e5780632e131cf914610b1057806341910f9014610aed5780634739f7e5146109085780635f5817e31461088e578063715018a6146108105780638da5cb5b146107dd578063ba46ae721461076d578063c4d66de8146105de578063e49e803e14610558578063efb7601d146101ca578063f003f2c0146101a55763f2fde38b146100d357600080fd5b346101a15760206003193601126101a1576100ec610df1565b916100f5610e6a565b73ffffffffffffffffffffffffffffffffffffffff83161561011e578361011b84610ee9565b80f35b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b5050346101c657816003193601126101c65760209051655af3107a40008152f35b5080fd5b5090346101a157602092836003193601126105555773ffffffffffffffffffffffffffffffffffffffff92836101fe610df1565b168252600185528282209380855461021860ff821661116e565b60101c169084517fb9bd4e5a00000000000000000000000000000000000000000000000000000000815287818581865afa9081156104a6578591610528575b508551927f8ac732a600000000000000000000000000000000000000000000000000000000845288848681845afa9384156104ec5785918a9188966104f6575b508851928380927fcbc9bdda0000000000000000000000000000000000000000000000000000000082525afa9081156104ec5790899187916104b0575b50858851809581937f01e66bcf000000000000000000000000000000000000000000000000000000008352165afa9182156104a6578592610473575b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8f082019182116103e757655af3107a4000968783029280840489149015171561044757600101544203924284116104475780841161043f575b5086810296818804149015171561041357670de0b6b3a7640000958603908682116103e75791866103a36103a9936301da9c0095611413565b04611413565b0484018094116103bb57505051908152f35b9060116024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024856011867f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024846011857f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b92503861036a565b6024866011877f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b9091508781813d831161049f575b61048b8183610f56565b8101031261049b57519038610310565b8480fd5b503d610481565b86513d87823e3d90fd5b82819392503d83116104e5575b6104c78183610f56565b810103126104e1575182811681036104e1578890386102d4565b8580fd5b503d6104bd565b87513d88823e3d90fd5b9250945081813d8311610521575b61050e8183610f56565b810103126104e157888591519438610297565b503d610504565b90508781813d831161054e575b61053f8183610f56565b8101031261049b575138610257565b503d610535565b80fd5b509190346101c657816003193601126101c6578051918284549081815260208091019583527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b92905b8282106105c7576105c386866105b9828b0383610f56565b5191829182610e19565b0390f35b8354875295860195600193840193909101906105a1565b50346101a15760206003193601126101a1576105f8610df1565b91610601610e6a565b60ff600654166106ea5773ffffffffffffffffffffffffffffffffffffffff831615610667578361063984610634610e6a565b610ee9565b60017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00600654161760065580f35b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602f60248201527f45786368616e67655261746552656769737472793a206f776e6572206973207460448201527f6865207a65726f206164647265737300000000000000000000000000000000006064820152fd5b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152603560248201527f45786368616e67655261746552656769737472793a20636f6e7472616374206960448201527f7320616c726561647920696e697469616c697a656400000000000000000000006064820152fd5b5050346101c65760206003193601126101c6576080918173ffffffffffffffffffffffffffffffffffffffff91826107a3610df1565b16815260016020522091600183549301549181519360ff81161515855260ff8160081c161515602086015260101c16908301526060820152f35b5050346101c657816003193601126101c65773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b8334610555578060031936011261055557610829610e6a565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b8284346105555780600319360112610555578151918291600254808552602080950194600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace92905b8282106108f1576105c386866105b9828b0383610f56565b8354875295860195600193840193909101906108d9565b508290346101c657826003193601126101c657610923610df1565b926024359373ffffffffffffffffffffffffffffffffffffffff808616918287036104e157610950610e6a565b8351917fe6d0c48900000000000000000000000000000000000000000000000000000000835260209182848881885afa938415610ae3578894610ab0575b501694858752600182528487209788549160ff8316610a2e57507ff8e444c42a5a7ea760a42d30d8fa8ccd8915208c2fb7dfe353501d7322d2e13296979861010185937fffffffffffffffffffff0000000000000000000000000000000000000000000075ffffffffffffffffffffffffffffffffffffffff000060019560101b169116171781550155610a2186611063565b508351928352820152a280f35b608490848851917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602e60248201527f45786368616e67655261746552656769737472793a20746f6b656e20616c726560448201527f61647920726567697374657265640000000000000000000000000000000000006064820152fd5b9093508281813d8311610adc575b610ac88183610f56565b81010312610ad85751928961098e565b8780fd5b503d610abe565b86513d8a823e3d90fd5b5050346101c657816003193601126101c65760209051670de0b6b3a76400008152f35b5090346101a15760206003193601126101a15773ffffffffffffffffffffffffffffffffffffffff610b40610df1565b610b48610e6a565b169182845260016020528184209081549060ff8260081c1615610bcb57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690557f65aac865e0d58610ea97c315e01d54aefcc67970686385e918d4b536bf95b83091602091610bb88261134c565b50610bc28261111c565b5051908152a180f35b60849060208551917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602760248201527f45786368616e67655261746552656769737472793a20746f6b656e206973206960448201527f6e616374697665000000000000000000000000000000000000000000000000006064820152fd5b5050346101c657816003193601126101c65760209060ff6006541690519015158152f35b5050346101c657816003193601126101c657602090516301da9c008152f35b5090346101a15760206003193601126101a15773ffffffffffffffffffffffffffffffffffffffff610cc1610df1565b610cc9610e6a565b1691828452600160205281842090815490610ce660ff831661116e565b60ff8260081c16610d5257507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790557f8745618cc29c4ac0cb23d9a7a8d5663f9739c8171e613d3c755e23307f74c10691602091610d4882611063565b50610bc2826111f9565b60849060208551917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f45786368616e67655261746552656769737472793a20746f6b656e206973206160448201527f63746976650000000000000000000000000000000000000000000000000000006064820152fd5b8490346101c657816003193601126101c6578061271060209252f35b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610e1457565b600080fd5b6020908160408183019282815285518094520193019160005b828110610e40575050505090565b835173ffffffffffffffffffffffffffffffffffffffff1685529381019392810192600101610e32565b73ffffffffffffffffffffffffffffffffffffffff600054163303610e8b57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6000549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610f9757604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600254811015610ffd5760026000527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0190600090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600454811015610ffd5760046000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0190600090565b60008181526003602052604081205461111757600254680100000000000000008110156110ea5790826110d66110a184600160409601600255610fc6565b81939154907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060031b92831b921b19161790565b905560025492815260036020522055600190565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b905090565b60008181526005602052604081205461111757600454680100000000000000008110156110ea57908261115a6110a18460016040960160045561102c565b905560045492815260056020522055600190565b1561117557565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f45786368616e67655261746552656769737472793a20746f6b656e206e6f742060448201527f72656769737465726564000000000000000000000000000000000000000000006064820152fd5b6000818152600560205260408120549091908015611347577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9081810181811161131a57600454908382019182116112ed578082036112b9575b505050600454801561128c5781019061126b8261102c565b909182549160031b1b19169055600455815260056020526040812055600190565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b6112d76112c86110a19361102c565b90549060031b1c92839261102c565b9055845260056020526040842055388080611253565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b505090565b6000818152600360205260408120549091908015611347577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9081810181811161131a57600254908382019182116112ed578082036113df575b505050600254801561128c578101906113be82610fc6565b909182549160031b1b19169055600255815260036020526040812055600190565b6113fd6113ee6110a193610fc6565b90549060031b1c928392610fc6565b90558452600360205260408420553880806113a6565b8181029291811591840414171561142657565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220731caa55a937adf092c1c98780e2d661c3ad61c38f5521ad210be08fd5b0ce1364736f6c63430008130033

Deployed Bytecode

0x6080604081815260048036101561001557600080fd5b600092833560e01c90816307a32b3914610dd5575080630d1ce2d214610c9157806316d3bfbb14610c725780632b19224714610c4e5780632e131cf914610b1057806341910f9014610aed5780634739f7e5146109085780635f5817e31461088e578063715018a6146108105780638da5cb5b146107dd578063ba46ae721461076d578063c4d66de8146105de578063e49e803e14610558578063efb7601d146101ca578063f003f2c0146101a55763f2fde38b146100d357600080fd5b346101a15760206003193601126101a1576100ec610df1565b916100f5610e6a565b73ffffffffffffffffffffffffffffffffffffffff83161561011e578361011b84610ee9565b80f35b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b5050346101c657816003193601126101c65760209051655af3107a40008152f35b5080fd5b5090346101a157602092836003193601126105555773ffffffffffffffffffffffffffffffffffffffff92836101fe610df1565b168252600185528282209380855461021860ff821661116e565b60101c169084517fb9bd4e5a00000000000000000000000000000000000000000000000000000000815287818581865afa9081156104a6578591610528575b508551927f8ac732a600000000000000000000000000000000000000000000000000000000845288848681845afa9384156104ec5785918a9188966104f6575b508851928380927fcbc9bdda0000000000000000000000000000000000000000000000000000000082525afa9081156104ec5790899187916104b0575b50858851809581937f01e66bcf000000000000000000000000000000000000000000000000000000008352165afa9182156104a6578592610473575b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8f082019182116103e757655af3107a4000968783029280840489149015171561044757600101544203924284116104475780841161043f575b5086810296818804149015171561041357670de0b6b3a7640000958603908682116103e75791866103a36103a9936301da9c0095611413565b04611413565b0484018094116103bb57505051908152f35b9060116024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024856011867f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024846011857f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b92503861036a565b6024866011877f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b9091508781813d831161049f575b61048b8183610f56565b8101031261049b57519038610310565b8480fd5b503d610481565b86513d87823e3d90fd5b82819392503d83116104e5575b6104c78183610f56565b810103126104e1575182811681036104e1578890386102d4565b8580fd5b503d6104bd565b87513d88823e3d90fd5b9250945081813d8311610521575b61050e8183610f56565b810103126104e157888591519438610297565b503d610504565b90508781813d831161054e575b61053f8183610f56565b8101031261049b575138610257565b503d610535565b80fd5b509190346101c657816003193601126101c6578051918284549081815260208091019583527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b92905b8282106105c7576105c386866105b9828b0383610f56565b5191829182610e19565b0390f35b8354875295860195600193840193909101906105a1565b50346101a15760206003193601126101a1576105f8610df1565b91610601610e6a565b60ff600654166106ea5773ffffffffffffffffffffffffffffffffffffffff831615610667578361063984610634610e6a565b610ee9565b60017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00600654161760065580f35b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602f60248201527f45786368616e67655261746552656769737472793a206f776e6572206973207460448201527f6865207a65726f206164647265737300000000000000000000000000000000006064820152fd5b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152603560248201527f45786368616e67655261746552656769737472793a20636f6e7472616374206960448201527f7320616c726561647920696e697469616c697a656400000000000000000000006064820152fd5b5050346101c65760206003193601126101c6576080918173ffffffffffffffffffffffffffffffffffffffff91826107a3610df1565b16815260016020522091600183549301549181519360ff81161515855260ff8160081c161515602086015260101c16908301526060820152f35b5050346101c657816003193601126101c65773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b8334610555578060031936011261055557610829610e6a565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b8284346105555780600319360112610555578151918291600254808552602080950194600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace92905b8282106108f1576105c386866105b9828b0383610f56565b8354875295860195600193840193909101906108d9565b508290346101c657826003193601126101c657610923610df1565b926024359373ffffffffffffffffffffffffffffffffffffffff808616918287036104e157610950610e6a565b8351917fe6d0c48900000000000000000000000000000000000000000000000000000000835260209182848881885afa938415610ae3578894610ab0575b501694858752600182528487209788549160ff8316610a2e57507ff8e444c42a5a7ea760a42d30d8fa8ccd8915208c2fb7dfe353501d7322d2e13296979861010185937fffffffffffffffffffff0000000000000000000000000000000000000000000075ffffffffffffffffffffffffffffffffffffffff000060019560101b169116171781550155610a2186611063565b508351928352820152a280f35b608490848851917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602e60248201527f45786368616e67655261746552656769737472793a20746f6b656e20616c726560448201527f61647920726567697374657265640000000000000000000000000000000000006064820152fd5b9093508281813d8311610adc575b610ac88183610f56565b81010312610ad85751928961098e565b8780fd5b503d610abe565b86513d8a823e3d90fd5b5050346101c657816003193601126101c65760209051670de0b6b3a76400008152f35b5090346101a15760206003193601126101a15773ffffffffffffffffffffffffffffffffffffffff610b40610df1565b610b48610e6a565b169182845260016020528184209081549060ff8260081c1615610bcb57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690557f65aac865e0d58610ea97c315e01d54aefcc67970686385e918d4b536bf95b83091602091610bb88261134c565b50610bc28261111c565b5051908152a180f35b60849060208551917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602760248201527f45786368616e67655261746552656769737472793a20746f6b656e206973206960448201527f6e616374697665000000000000000000000000000000000000000000000000006064820152fd5b5050346101c657816003193601126101c65760209060ff6006541690519015158152f35b5050346101c657816003193601126101c657602090516301da9c008152f35b5090346101a15760206003193601126101a15773ffffffffffffffffffffffffffffffffffffffff610cc1610df1565b610cc9610e6a565b1691828452600160205281842090815490610ce660ff831661116e565b60ff8260081c16610d5257507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790557f8745618cc29c4ac0cb23d9a7a8d5663f9739c8171e613d3c755e23307f74c10691602091610d4882611063565b50610bc2826111f9565b60849060208551917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f45786368616e67655261746552656769737472793a20746f6b656e206973206160448201527f63746976650000000000000000000000000000000000000000000000000000006064820152fd5b8490346101c657816003193601126101c6578061271060209252f35b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610e1457565b600080fd5b6020908160408183019282815285518094520193019160005b828110610e40575050505090565b835173ffffffffffffffffffffffffffffffffffffffff1685529381019392810192600101610e32565b73ffffffffffffffffffffffffffffffffffffffff600054163303610e8b57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6000549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610f9757604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600254811015610ffd5760026000527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0190600090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600454811015610ffd5760046000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0190600090565b60008181526003602052604081205461111757600254680100000000000000008110156110ea5790826110d66110a184600160409601600255610fc6565b81939154907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060031b92831b921b19161790565b905560025492815260036020522055600190565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b905090565b60008181526005602052604081205461111757600454680100000000000000008110156110ea57908261115a6110a18460016040960160045561102c565b905560045492815260056020522055600190565b1561117557565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f45786368616e67655261746552656769737472793a20746f6b656e206e6f742060448201527f72656769737465726564000000000000000000000000000000000000000000006064820152fd5b6000818152600560205260408120549091908015611347577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9081810181811161131a57600454908382019182116112ed578082036112b9575b505050600454801561128c5781019061126b8261102c565b909182549160031b1b19169055600455815260056020526040812055600190565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b6112d76112c86110a19361102c565b90549060031b1c92839261102c565b9055845260056020526040842055388080611253565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b505090565b6000818152600360205260408120549091908015611347577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9081810181811161131a57600254908382019182116112ed578082036113df575b505050600254801561128c578101906113be82610fc6565b909182549160031b1b19169055600255815260036020526040812055600190565b6113fd6113ee6110a193610fc6565b90549060031b1c928392610fc6565b90558452600360205260408420553880806113a6565b8181029291811591840414171561142657565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220731caa55a937adf092c1c98780e2d661c3ad61c38f5521ad210be08fd5b0ce1364736f6c63430008130033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.