S Price: $0.687212 (-14.90%)

Contract

0x525A330f22F5A2d886f6622d352b06EF9829cAA5

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Parent Transaction Hash Block From To
97799552025-02-24 10:07:4021 hrs ago1740391660  Contract Creation0 S
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CompositePriceFeed

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
london EvmVersion
File 1 of 8 : CompositePriceFeed.sol
// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;

import {PriceFeedParams} from "./PriceFeedParams.sol";
import {PriceFeedType} from "@gearbox-protocol/sdk-gov/contracts/PriceFeedType.sol";
import {IPriceFeed} from "@gearbox-protocol/core-v2/contracts/interfaces/IPriceFeed.sol";
import {PriceFeedValidationTrait} from "@gearbox-protocol/core-v3/contracts/traits/PriceFeedValidationTrait.sol";
import {SanityCheckTrait} from "@gearbox-protocol/core-v3/contracts/traits/SanityCheckTrait.sol";

/// @title Composite price feed
/// @notice Computes target asset USD price as product of target/base price times base/USD price
contract CompositePriceFeed is IPriceFeed, PriceFeedValidationTrait, SanityCheckTrait {
    PriceFeedType public constant override priceFeedType = PriceFeedType.COMPOSITE_ORACLE;
    uint256 public constant override version = 3_00;
    uint8 public constant override decimals = 8; // U:[CPF-2]
    bool public constant override skipPriceCheck = true; // U:[CPF-2]

    /// @notice Price feed that returns target asset price denominated in base asset
    address public immutable priceFeed0;
    uint32 public immutable stalenessPeriod0;

    /// @notice Price feed that returns base price denominated in USD
    address public immutable priceFeed1;
    uint32 public immutable stalenessPeriod1;
    bool public immutable skipCheck1;

    /// @notice Scale of answers in target/base price feed
    int256 public immutable targetFeedScale;

    /// @notice Constructor
    /// @param priceFeeds Array with two price feeds, where the first one returns target asset price
    ///        denominated in base asset, and the second one returns base price denominated in USD
    constructor(PriceFeedParams[2] memory priceFeeds)
        nonZeroAddress(priceFeeds[0].priceFeed) // U:[CPF-1]
        nonZeroAddress(priceFeeds[1].priceFeed) // U:[CPF-1]
    {
        priceFeed0 = priceFeeds[0].priceFeed; // U:[CPF-1]
        priceFeed1 = priceFeeds[1].priceFeed; // U:[CPF-1]

        stalenessPeriod0 = priceFeeds[0].stalenessPeriod; // U:[CPF-1]
        stalenessPeriod1 = priceFeeds[1].stalenessPeriod; // U:[CPF-1]

        targetFeedScale = int256(10 ** IPriceFeed(priceFeed0).decimals()); // U:[CPF-1]
        // target/base price feed validation is omitted because it will fail if feed has other than 8 decimals
        skipCheck1 = _validatePriceFeed(priceFeed1, stalenessPeriod1); // U:[CPF-1]
    }

    /// @notice Price feed description
    function description() external view override returns (string memory) {
        return string(
            abi.encodePacked(
                IPriceFeed(priceFeed0).description(),
                " * ",
                IPriceFeed(priceFeed1).description(),
                " composite price feed"
            )
        ); // U:[CPF-2]
    }

    /// @notice Returns the USD price of the target asset, computed as target/base price times base/USD price
    function latestRoundData() external view override returns (uint80, int256 answer, uint256, uint256, uint80) {
        answer = _getValidatedPrice(priceFeed0, stalenessPeriod0, false); // U:[CPF-3]
        int256 answer2 = _getValidatedPrice(priceFeed1, stalenessPeriod1, skipCheck1); // U:[CPF-3]
        answer = (answer * answer2) / targetFeedScale; // U:[CPF-3]
        return (0, answer, 0, 0, 0);
    }
}

File 2 of 8 : PriceFeedParams.sol
// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;

struct PriceFeedParams {
    address priceFeed;
    uint32 stalenessPeriod;
}

File 3 of 8 : PriceFeedType.sol
// SPDX-License-Identifier: UNLICENSED
// Gearbox. Generalized leverage protocol that allows to take leverage and then use it across other DeFi protocols and platforms in a composable way.
// (c) Gearbox Foundation, 2023
pragma solidity ^0.8.17;

enum PriceFeedType {
    CHAINLINK_ORACLE,
    YEARN_ORACLE,
    CURVE_2LP_ORACLE,
    CURVE_3LP_ORACLE,
    CURVE_4LP_ORACLE,
    ZERO_ORACLE,
    WSTETH_ORACLE,
    BOUNDED_ORACLE,
    COMPOSITE_ORACLE,
    WRAPPED_AAVE_V2_ORACLE,
    COMPOUND_V2_ORACLE,
    BALANCER_STABLE_LP_ORACLE,
    BALANCER_WEIGHTED_LP_ORACLE,
    CURVE_CRYPTO_ORACLE,
    THE_SAME_AS,
    REDSTONE_ORACLE,
    ERC4626_VAULT_ORACLE,
    NETWORK_DEPENDENT,
    CURVE_USD_ORACLE,
    PYTH_ORACLE,
    MELLOW_LRT_ORACLE,
    PENDLE_PT_TWAP_ORACLE
}

File 4 of 8 : IPriceFeed.sol
// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.0;

import { PriceFeedType } from "@gearbox-protocol/sdk-gov/contracts/PriceFeedType.sol";

/// @title Price feed interface
interface IPriceFeed {
    function priceFeedType() external view returns (PriceFeedType);

    function version() external view returns (uint256);

    function decimals() external view returns (uint8);

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

    function skipPriceCheck() external view returns (bool);

    function latestRoundData()
        external
        view
        returns (uint80, int256 answer, uint256, uint256 updatedAt, uint80);
}

/// @title Updatable price feed interface
interface IUpdatablePriceFeed is IPriceFeed {
    function updatable() external view returns (bool);

    function updatePrice(bytes calldata data) external;
}

File 5 of 8 : PriceFeedValidationTrait.sol
// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;

import {Address} from "@openzeppelin/contracts/utils/Address.sol";

import {
    AddressIsNotContractException,
    IncorrectParameterException,
    IncorrectPriceException,
    IncorrectPriceFeedException,
    PriceFeedDoesNotExistException,
    StalePriceException
} from "../interfaces/IExceptions.sol";
import {IPriceFeed, IUpdatablePriceFeed} from "@gearbox-protocol/core-v2/contracts/interfaces/IPriceFeed.sol";

/// @title Price feed validation trait
abstract contract PriceFeedValidationTrait {
    using Address for address;

    /// @dev Ensures that price is positive and not stale
    function _checkAnswer(int256 price, uint256 updatedAt, uint32 stalenessPeriod) internal view {
        if (price <= 0) revert IncorrectPriceException();
        if (block.timestamp >= updatedAt + stalenessPeriod) revert StalePriceException();
    }

    /// @dev Valites that `priceFeed` is a contract that adheres to Chainlink interface and passes sanity checks
    /// @dev Some price feeds return stale prices unless updated right before querying their answer, which causes
    ///      issues during deployment and configuration, so for such price feeds staleness check is skipped, and
    ///      special care must be taken to ensure all parameters are in tune.
    function _validatePriceFeed(address priceFeed, uint32 stalenessPeriod) internal view returns (bool skipCheck) {
        if (!priceFeed.isContract()) revert AddressIsNotContractException(priceFeed); // U:[PO-5]

        try IPriceFeed(priceFeed).decimals() returns (uint8 _decimals) {
            if (_decimals != 8) revert IncorrectPriceFeedException(); // U:[PO-5]
        } catch {
            revert IncorrectPriceFeedException(); // U:[PO-5]
        }

        try IPriceFeed(priceFeed).skipPriceCheck() returns (bool _skipCheck) {
            skipCheck = _skipCheck; // U:[PO-5]
        } catch {}

        try IPriceFeed(priceFeed).latestRoundData() returns (uint80, int256 answer, uint256, uint256 updatedAt, uint80)
        {
            if (skipCheck) {
                if (stalenessPeriod != 0) revert IncorrectParameterException(); // U:[PO-5]
            } else {
                if (stalenessPeriod == 0) revert IncorrectParameterException(); // U:[PO-5]

                bool updatable;
                try IUpdatablePriceFeed(priceFeed).updatable() returns (bool _updatable) {
                    updatable = _updatable;
                } catch {}
                if (!updatable) _checkAnswer(answer, updatedAt, stalenessPeriod); // U:[PO-5]
            }
        } catch {
            revert IncorrectPriceFeedException(); // U:[PO-5]
        }
    }

    /// @dev Returns answer from a price feed with optional sanity and staleness checks
    function _getValidatedPrice(address priceFeed, uint32 stalenessPeriod, bool skipCheck)
        internal
        view
        returns (int256 answer)
    {
        uint256 updatedAt;
        (, answer,, updatedAt,) = IPriceFeed(priceFeed).latestRoundData(); // U:[PO-1]
        if (!skipCheck) _checkAnswer(answer, updatedAt, stalenessPeriod); // U:[PO-1]
    }
}

File 6 of 8 : SanityCheckTrait.sol
// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;

import {ZeroAddressException} from "../interfaces/IExceptions.sol";

/// @title Sanity check trait
abstract contract SanityCheckTrait {
    /// @dev Ensures that passed address is non-zero
    modifier nonZeroAddress(address addr) {
        _revertIfZeroAddress(addr);
        _;
    }

    /// @dev Reverts if address is zero
    function _revertIfZeroAddress(address addr) private pure {
        if (addr == address(0)) revert ZeroAddressException();
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 8 : IExceptions.sol
// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;

// ------- //
// GENERAL //
// ------- //

/// @notice Thrown on attempting to set an important address to zero address
error ZeroAddressException();

/// @notice Thrown when attempting to pass a zero amount to a funding-related operation
error AmountCantBeZeroException();

/// @notice Thrown on incorrect input parameter
error IncorrectParameterException();

/// @notice Thrown when balance is insufficient to perform an operation
error InsufficientBalanceException();

/// @notice Thrown if parameter is out of range
error ValueOutOfRangeException();

/// @notice Thrown when trying to send ETH to a contract that is not allowed to receive ETH directly
error ReceiveIsNotAllowedException();

/// @notice Thrown on attempting to set an EOA as an important contract in the system
error AddressIsNotContractException(address);

/// @notice Thrown on attempting to receive a token that is not a collateral token or was forbidden
error TokenNotAllowedException();

/// @notice Thrown on attempting to add a token that is already in a collateral list
error TokenAlreadyAddedException();

/// @notice Thrown when attempting to use quota-related logic for a token that is not quoted in quota keeper
error TokenIsNotQuotedException();

/// @notice Thrown on attempting to interact with an address that is not a valid target contract
error TargetContractNotAllowedException();

/// @notice Thrown if function is not implemented
error NotImplementedException();

// ------------------ //
// CONTRACTS REGISTER //
// ------------------ //

/// @notice Thrown when an address is expected to be a registered credit manager, but is not
error RegisteredCreditManagerOnlyException();

/// @notice Thrown when an address is expected to be a registered pool, but is not
error RegisteredPoolOnlyException();

// ---------------- //
// ADDRESS PROVIDER //
// ---------------- //

/// @notice Reverts if address key isn't found in address provider
error AddressNotFoundException();

// ----------------- //
// POOL, PQK, GAUGES //
// ----------------- //

/// @notice Thrown by pool-adjacent contracts when a credit manager being connected has a wrong pool address
error IncompatibleCreditManagerException();

/// @notice Thrown when attempting to set an incompatible successor staking contract
error IncompatibleSuccessorException();

/// @notice Thrown when attempting to vote in a non-approved contract
error VotingContractNotAllowedException();

/// @notice Thrown when attempting to unvote more votes than there are
error InsufficientVotesException();

/// @notice Thrown when attempting to borrow more than the second point on a two-point curve
error BorrowingMoreThanU2ForbiddenException();

/// @notice Thrown when a credit manager attempts to borrow more than its limit in the current block, or in general
error CreditManagerCantBorrowException();

/// @notice Thrown when attempting to connect a quota keeper to an incompatible pool
error IncompatiblePoolQuotaKeeperException();

/// @notice Thrown when the quota is outside of min/max bounds
error QuotaIsOutOfBoundsException();

// -------------- //
// CREDIT MANAGER //
// -------------- //

/// @notice Thrown on failing a full collateral check after multicall
error NotEnoughCollateralException();

/// @notice Thrown if an attempt to approve a collateral token to adapter's target contract fails
error AllowanceFailedException();

/// @notice Thrown on attempting to perform an action for a credit account that does not exist
error CreditAccountDoesNotExistException();

/// @notice Thrown on configurator attempting to add more than 255 collateral tokens
error TooManyTokensException();

/// @notice Thrown if more than the maximum number of tokens were enabled on a credit account
error TooManyEnabledTokensException();

/// @notice Thrown when attempting to execute a protocol interaction without active credit account set
error ActiveCreditAccountNotSetException();

/// @notice Thrown when trying to update credit account's debt more than once in the same block
error DebtUpdatedTwiceInOneBlockException();

/// @notice Thrown when trying to repay all debt while having active quotas
error DebtToZeroWithActiveQuotasException();

/// @notice Thrown when a zero-debt account attempts to update quota
error UpdateQuotaOnZeroDebtAccountException();

/// @notice Thrown when attempting to close an account with non-zero debt
error CloseAccountWithNonZeroDebtException();

/// @notice Thrown when value of funds remaining on the account after liquidation is insufficient
error InsufficientRemainingFundsException();

/// @notice Thrown when Credit Facade tries to write over a non-zero active Credit Account
error ActiveCreditAccountOverridenException();

// ------------------- //
// CREDIT CONFIGURATOR //
// ------------------- //

/// @notice Thrown on attempting to use a non-ERC20 contract or an EOA as a token
error IncorrectTokenContractException();

/// @notice Thrown if the newly set LT if zero or greater than the underlying's LT
error IncorrectLiquidationThresholdException();

/// @notice Thrown if borrowing limits are incorrect: minLimit > maxLimit or maxLimit > blockLimit
error IncorrectLimitsException();

/// @notice Thrown if the new expiration date is less than the current expiration date or current timestamp
error IncorrectExpirationDateException();

/// @notice Thrown if a contract returns a wrong credit manager or reverts when trying to retrieve it
error IncompatibleContractException();

/// @notice Thrown if attempting to forbid an adapter that is not registered in the credit manager
error AdapterIsNotRegisteredException();

// ------------- //
// CREDIT FACADE //
// ------------- //

/// @notice Thrown when attempting to perform an action that is forbidden in whitelisted mode
error ForbiddenInWhitelistedModeException();

/// @notice Thrown if credit facade is not expirable, and attempted aciton requires expirability
error NotAllowedWhenNotExpirableException();

/// @notice Thrown if a selector that doesn't match any allowed function is passed to the credit facade in a multicall
error UnknownMethodException();

/// @notice Thrown when trying to close an account with enabled tokens
error CloseAccountWithEnabledTokensException();

/// @notice Thrown if a liquidator tries to liquidate an account with a health factor above 1
error CreditAccountNotLiquidatableException();

/// @notice Thrown if too much new debt was taken within a single block
error BorrowedBlockLimitException();

/// @notice Thrown if the new debt principal for a credit account falls outside of borrowing limits
error BorrowAmountOutOfLimitsException();

/// @notice Thrown if a user attempts to open an account via an expired credit facade
error NotAllowedAfterExpirationException();

/// @notice Thrown if expected balances are attempted to be set twice without performing a slippage check
error ExpectedBalancesAlreadySetException();

/// @notice Thrown if attempting to perform a slippage check when excepted balances are not set
error ExpectedBalancesNotSetException();

/// @notice Thrown if balance of at least one token is less than expected during a slippage check
error BalanceLessThanExpectedException();

/// @notice Thrown when trying to perform an action that is forbidden when credit account has enabled forbidden tokens
error ForbiddenTokensException();

/// @notice Thrown when new forbidden tokens are enabled during the multicall
error ForbiddenTokenEnabledException();

/// @notice Thrown when enabled forbidden token balance is increased during the multicall
error ForbiddenTokenBalanceIncreasedException();

/// @notice Thrown when the remaining token balance is increased during the liquidation
error RemainingTokenBalanceIncreasedException();

/// @notice Thrown if `botMulticall` is called by an address that is not approved by account owner or is forbidden
error NotApprovedBotException();

/// @notice Thrown when attempting to perform a multicall action with no permission for it
error NoPermissionException(uint256 permission);

/// @notice Thrown when attempting to give a bot unexpected permissions
error UnexpectedPermissionsException();

/// @notice Thrown when a custom HF parameter lower than 10000 is passed into the full collateral check
error CustomHealthFactorTooLowException();

/// @notice Thrown when submitted collateral hint is not a valid token mask
error InvalidCollateralHintException();

// ------ //
// ACCESS //
// ------ //

/// @notice Thrown on attempting to call an access restricted function not as credit account owner
error CallerNotCreditAccountOwnerException();

/// @notice Thrown on attempting to call an access restricted function not as configurator
error CallerNotConfiguratorException();

/// @notice Thrown on attempting to call an access-restructed function not as account factory
error CallerNotAccountFactoryException();

/// @notice Thrown on attempting to call an access restricted function not as credit manager
error CallerNotCreditManagerException();

/// @notice Thrown on attempting to call an access restricted function not as credit facade
error CallerNotCreditFacadeException();

/// @notice Thrown on attempting to call an access restricted function not as controller or configurator
error CallerNotControllerException();

/// @notice Thrown on attempting to pause a contract without pausable admin rights
error CallerNotPausableAdminException();

/// @notice Thrown on attempting to unpause a contract without unpausable admin rights
error CallerNotUnpausableAdminException();

/// @notice Thrown on attempting to call an access restricted function not as gauge
error CallerNotGaugeException();

/// @notice Thrown on attempting to call an access restricted function not as quota keeper
error CallerNotPoolQuotaKeeperException();

/// @notice Thrown on attempting to call an access restricted function not as voter
error CallerNotVoterException();

/// @notice Thrown on attempting to call an access restricted function not as allowed adapter
error CallerNotAdapterException();

/// @notice Thrown on attempting to call an access restricted function not as migrator
error CallerNotMigratorException();

/// @notice Thrown when an address that is not the designated executor attempts to execute a transaction
error CallerNotExecutorException();

/// @notice Thrown on attempting to call an access restricted function not as veto admin
error CallerNotVetoAdminException();

// ------------------- //
// CONTROLLER TIMELOCK //
// ------------------- //

/// @notice Thrown when the new parameter values do not satisfy required conditions
error ParameterChecksFailedException();

/// @notice Thrown when attempting to execute a non-queued transaction
error TxNotQueuedException();

/// @notice Thrown when attempting to execute a transaction that is either immature or stale
error TxExecutedOutsideTimeWindowException();

/// @notice Thrown when execution of a transaction fails
error TxExecutionRevertedException();

/// @notice Thrown when the value of a parameter on execution is different from the value on queue
error ParameterChangedAfterQueuedTxException();

// -------- //
// BOT LIST //
// -------- //

/// @notice Thrown when attempting to set non-zero permissions for a forbidden or special bot
error InvalidBotException();

// --------------- //
// ACCOUNT FACTORY //
// --------------- //

/// @notice Thrown when trying to deploy second master credit account for a credit manager
error MasterCreditAccountAlreadyDeployedException();

/// @notice Thrown when trying to rescue funds from a credit account that is currently in use
error CreditAccountIsInUseException();

// ------------ //
// PRICE ORACLE //
// ------------ //

/// @notice Thrown on attempting to set a token price feed to an address that is not a correct price feed
error IncorrectPriceFeedException();

/// @notice Thrown on attempting to interact with a price feed for a token not added to the price oracle
error PriceFeedDoesNotExistException();

/// @notice Thrown when price feed returns incorrect price for a token
error IncorrectPriceException();

/// @notice Thrown when token's price feed becomes stale
error StalePriceException();

Settings
{
  "remappings": [
    "@1inch/=node_modules/@1inch/",
    "@arbitrum/=node_modules/@arbitrum/",
    "@chainlink/=node_modules/@chainlink/",
    "@eth-optimism/=node_modules/@eth-optimism/",
    "@gearbox-protocol/=node_modules/@gearbox-protocol/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@redstone-finance/=node_modules/@redstone-finance/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std/=lib/forge-std/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"components":[{"internalType":"address","name":"priceFeed","type":"address"},{"internalType":"uint32","name":"stalenessPeriod","type":"uint32"}],"internalType":"struct PriceFeedParams[2]","name":"priceFeeds","type":"tuple[2]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"AddressIsNotContractException","type":"error"},{"inputs":[],"name":"IncorrectParameterException","type":"error"},{"inputs":[],"name":"IncorrectPriceException","type":"error"},{"inputs":[],"name":"IncorrectPriceFeedException","type":"error"},{"inputs":[],"name":"StalePriceException","type":"error"},{"inputs":[],"name":"ZeroAddressException","type":"error"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFeed0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFeed1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFeedType","outputs":[{"internalType":"enum PriceFeedType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"skipCheck1","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"skipPriceCheck","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stalenessPeriod0","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stalenessPeriod1","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"targetFeedScale","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

6101406040523480156200001257600080fd5b50604051620010f2380380620010f28339810160408190526200003591620004a9565b805151620000438162000121565b602082015151620000548162000121565b8251516001600160a01b039081166080819052602080860180515190931660c052855181015163ffffffff90811660a052925181015190921660e0526040805163313ce56760e01b81529051919263313ce567926004808401938290030181865afa158015620000c8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ee919062000565565b620000fb90600a620006a4565b6101205260c05160e0516200011191906200014c565b1515610100525062000761915050565b6001600160a01b0381166200014957604051635919af9760e11b815260040160405180910390fd5b50565b60006200016d836001600160a01b03166200040060201b620004e81760201c565b6200019a5760405163df4c572d60e01b81526001600160a01b038416600482015260240160405180910390fd5b826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015620001f7575060408051601f3d908101601f19168201909252620001f49181019062000565565b60015b62000215576040516367a7cd4360e01b815260040160405180910390fd5b8060ff166008146200023a576040516367a7cd4360e01b815260040160405180910390fd5b50826001600160a01b031663d62ada116040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801562000298575060408051601f3d908101601f191682019092526200029591810190620006b5565b60015b15620002a15790505b826001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa925050508015620002fe575060408051601f3d908101601f19168201909252620002fb91810190620006f6565b60015b6200031c576040516367a7cd4360e01b815260040160405180910390fd5b85156200034f5763ffffffff87161562000349576040516347fbaa9760e01b815260040160405180910390fd5b620003f4565b8663ffffffff1660000362000377576040516347fbaa9760e01b815260040160405180910390fd5b6000886001600160a01b031663e75aeec86040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015620003d6575060408051601f3d908101601f19168201909252620003d391810190620006b5565b60015b15620003df5790505b80620003f257620003f285848a6200040f565b505b50505050505b92915050565b6001600160a01b03163b151590565b6000831362000431576040516329dbcc7160e11b815260040160405180910390fd5b6200044363ffffffff8216836200074b565b421062000463576040516316dd0ffb60e01b815260040160405180910390fd5b505050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715620004a357620004a362000468565b60405290565b600060808284031215620004bc57600080fd5b82601f830112620004cc57600080fd5b620004d66200047e565b806080840185811115620004e957600080fd5b845b818110156200055a5760408188031215620005065760008081fd5b620005106200047e565b81516001600160a01b0381168114620005295760008081fd5b815260208281015163ffffffff81168114620005455760008081fd5b828201529085529390930192604001620004eb565b509095945050505050565b6000602082840312156200057857600080fd5b815160ff811681146200058a57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115620005e8578160001904821115620005cc57620005cc62000591565b80851615620005da57918102915b93841c9390800290620005ac565b509250929050565b6000826200060157506001620003fa565b816200061057506000620003fa565b8160018114620006295760028114620006345762000654565b6001915050620003fa565b60ff84111562000648576200064862000591565b50506001821b620003fa565b5060208310610133831016604e8410600b841016171562000679575081810a620003fa565b620006858383620005a7565b80600019048211156200069c576200069c62000591565b029392505050565b60006200058a60ff841683620005f0565b600060208284031215620006c857600080fd5b815180151581146200058a57600080fd5b80516001600160501b0381168114620006f157600080fd5b919050565b600080600080600060a086880312156200070f57600080fd5b6200071a86620006d9565b94506020860151935060408601519250606086015191506200073f60808701620006d9565b90509295509295909350565b80820180821115620003fa57620003fa62000591565b60805160a05160c05160e051610100516101205161090a620007e86000396000818160de01526104a101526000818161020701526104790152600081816101ad015261045801526000818161023e015281816103310152610437015260008181610118015261040801526000818161016e015281816102ab01526103e7015261090a6000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806354fd4d5011610081578063ab0ca0e11161005b578063ab0ca0e114610239578063d62ada1114610260578063feaf968c1461026857600080fd5b806354fd4d50146101e45780637284e416146101ed5780637ff361ec1461020257600080fd5b8063385aee1b116100b2578063385aee1b146101695780633e777fd2146101a85780633fd0875f146101cf57600080fd5b80630ff8bdd2146100d9578063178793e814610113578063313ce5671461014f575b600080fd5b6101007f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b61013a7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff909116815260200161010a565b610157600881565b60405160ff909116815260200161010a565b6101907f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010a565b61013a7f000000000000000000000000000000000000000000000000000000000000000081565b6101d7600881565b60405161010a9190610606565b61010061012c81565b6101f56102a7565b60405161010a9190610652565b6102297f000000000000000000000000000000000000000000000000000000000000000081565b604051901515815260200161010a565b6101907f000000000000000000000000000000000000000000000000000000000000000081565b610229600181565b6102706103da565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a00161010a565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637284e4166040518163ffffffff1660e01b8152600401600060405180830381865afa158015610307573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261032f919081019061069b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637284e4166040518163ffffffff1660e01b8152600401600060405180830381865afa15801561038d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103b5919081019061069b565b6040516020016103c6929190610748565b604051602081830303815290604052905090565b600080600080600061042e7f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000060006104f7565b9350600061049d7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006104f7565b90507f00000000000000000000000000000000000000000000000000000000000000006104ca82876107e0565b6104d49190610816565b600097909650879550859450849350915050565b6001600160a01b03163b151590565b600080846001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610538573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055c9190610871565b5091945090925084915061057790505761057782828661057f565b509392505050565b600083136105b9576040517f53b798e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105c963ffffffff8216836108c1565b4210610601576040517f16dd0ffb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b602081016016831061062857634e487b7160e01b600052602160045260246000fd5b91905290565b60005b83811015610649578181015183820152602001610631565b50506000910152565b602081526000825180602084015261067181604085016020870161062e565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156106ad57600080fd5b815167ffffffffffffffff808211156106c557600080fd5b818401915084601f8301126106d957600080fd5b8151818111156106eb576106eb610685565b604051601f8201601f19908116603f0116810190838211818310171561071357610713610685565b8160405282815287602084870101111561072c57600080fd5b61073d83602083016020880161062e565b979650505050505050565b6000835161075a81846020880161062e565b7f202a200000000000000000000000000000000000000000000000000000000000908301908152835161079481600384016020880161062e565b7f20636f6d706f736974652070726963652066656564000000000000000000000060039290910191820152601801949350505050565b634e487b7160e01b600052601160045260246000fd5b80820260008212600160ff1b841416156107fc576107fc6107ca565b8181058314821517610810576108106107ca565b92915050565b60008261083357634e487b7160e01b600052601260045260246000fd5b600160ff1b82146000198414161561084d5761084d6107ca565b500590565b805169ffffffffffffffffffff8116811461086c57600080fd5b919050565b600080600080600060a0868803121561088957600080fd5b61089286610852565b94506020860151935060408601519250606086015191506108b560808701610852565b90509295509295909350565b80820180821115610810576108106107ca56fea2646970667358221220475818324795b639641335e17a8a4a4870f2d7fbffb13b7c8d3cc5bd6201da8f64736f6c63430008110033000000000000000000000000d979d375b4d7d7539de6d653dd40f0ffc8a2f83d00000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000c76dfb89ff298145b417d221b2c747d84952e01d0000000000000000000000000000000000000000000000000000000000001194

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100d45760003560e01c806354fd4d5011610081578063ab0ca0e11161005b578063ab0ca0e114610239578063d62ada1114610260578063feaf968c1461026857600080fd5b806354fd4d50146101e45780637284e416146101ed5780637ff361ec1461020257600080fd5b8063385aee1b116100b2578063385aee1b146101695780633e777fd2146101a85780633fd0875f146101cf57600080fd5b80630ff8bdd2146100d9578063178793e814610113578063313ce5671461014f575b600080fd5b6101007f0000000000000000000000000000000000000000000000000000000005f5e10081565b6040519081526020015b60405180910390f35b61013a7f00000000000000000000000000000000000000000000000000000000000000f081565b60405163ffffffff909116815260200161010a565b610157600881565b60405160ff909116815260200161010a565b6101907f000000000000000000000000d979d375b4d7d7539de6d653dd40f0ffc8a2f83d81565b6040516001600160a01b03909116815260200161010a565b61013a7f000000000000000000000000000000000000000000000000000000000000119481565b6101d7600881565b60405161010a9190610606565b61010061012c81565b6101f56102a7565b60405161010a9190610652565b6102297f000000000000000000000000000000000000000000000000000000000000000081565b604051901515815260200161010a565b6101907f000000000000000000000000c76dfb89ff298145b417d221b2c747d84952e01d81565b610229600181565b6102706103da565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a00161010a565b60607f000000000000000000000000d979d375b4d7d7539de6d653dd40f0ffc8a2f83d6001600160a01b0316637284e4166040518163ffffffff1660e01b8152600401600060405180830381865afa158015610307573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261032f919081019061069b565b7f000000000000000000000000c76dfb89ff298145b417d221b2c747d84952e01d6001600160a01b0316637284e4166040518163ffffffff1660e01b8152600401600060405180830381865afa15801561038d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103b5919081019061069b565b6040516020016103c6929190610748565b604051602081830303815290604052905090565b600080600080600061042e7f000000000000000000000000d979d375b4d7d7539de6d653dd40f0ffc8a2f83d7f00000000000000000000000000000000000000000000000000000000000000f060006104f7565b9350600061049d7f000000000000000000000000c76dfb89ff298145b417d221b2c747d84952e01d7f00000000000000000000000000000000000000000000000000000000000011947f00000000000000000000000000000000000000000000000000000000000000006104f7565b90507f0000000000000000000000000000000000000000000000000000000005f5e1006104ca82876107e0565b6104d49190610816565b600097909650879550859450849350915050565b6001600160a01b03163b151590565b600080846001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610538573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055c9190610871565b5091945090925084915061057790505761057782828661057f565b509392505050565b600083136105b9576040517f53b798e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105c963ffffffff8216836108c1565b4210610601576040517f16dd0ffb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b602081016016831061062857634e487b7160e01b600052602160045260246000fd5b91905290565b60005b83811015610649578181015183820152602001610631565b50506000910152565b602081526000825180602084015261067181604085016020870161062e565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156106ad57600080fd5b815167ffffffffffffffff808211156106c557600080fd5b818401915084601f8301126106d957600080fd5b8151818111156106eb576106eb610685565b604051601f8201601f19908116603f0116810190838211818310171561071357610713610685565b8160405282815287602084870101111561072c57600080fd5b61073d83602083016020880161062e565b979650505050505050565b6000835161075a81846020880161062e565b7f202a200000000000000000000000000000000000000000000000000000000000908301908152835161079481600384016020880161062e565b7f20636f6d706f736974652070726963652066656564000000000000000000000060039290910191820152601801949350505050565b634e487b7160e01b600052601160045260246000fd5b80820260008212600160ff1b841416156107fc576107fc6107ca565b8181058314821517610810576108106107ca565b92915050565b60008261083357634e487b7160e01b600052601260045260246000fd5b600160ff1b82146000198414161561084d5761084d6107ca565b500590565b805169ffffffffffffffffffff8116811461086c57600080fd5b919050565b600080600080600060a0868803121561088957600080fd5b61089286610852565b94506020860151935060408601519250606086015191506108b560808701610852565b90509295509295909350565b80820180821115610810576108106107ca56fea2646970667358221220475818324795b639641335e17a8a4a4870f2d7fbffb13b7c8d3cc5bd6201da8f64736f6c63430008110033

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

000000000000000000000000d979d375b4d7d7539de6d653dd40f0ffc8a2f83d00000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000c76dfb89ff298145b417d221b2c747d84952e01d0000000000000000000000000000000000000000000000000000000000001194

-----Decoded View---------------
Arg [0] : priceFeeds (tuple[2]): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput],System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000d979d375b4d7d7539de6d653dd40f0ffc8a2f83d
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000f0
Arg [2] : 000000000000000000000000c76dfb89ff298145b417d221b2c747d84952e01d
Arg [3] : 0000000000000000000000000000000000000000000000000000000000001194


Block Transaction 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

Transaction 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.