Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Multi Chain
Multichain Addresses
6 addresses found via
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x60e06040 | 17478893 | 109 days 23 hrs ago | IN | Create: BlacklistHelper | 0 ETH | 0.02087339 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
BlacklistHelper
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 2000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ACLTrait } from "../core/ACLTrait.sol"; import { IBlacklistHelper } from "../interfaces/IBlacklistHelper.sol"; import { ICreditFacade } from "../interfaces/ICreditFacade.sol"; interface IBlacklistableUSDC { function isBlacklisted(address _account) external view returns (bool); } interface IBlacklistableUSDT { function isBlackListed(address _account) external view returns (bool); } /// @title Blacklist Helper /// @dev A contract used to enable successful liquidations when the borrower is blacklisted /// while simultaneously allowing them to recover their funds under a different address contract BlacklistHelper is ACLTrait, IBlacklistHelper { using SafeERC20 for IERC20; /// @dev Address of USDC address public immutable usdc; /// @dev Address of USDT address public immutable usdt; /// @dev mapping from address to supported Credit Facade status mapping(address => bool) public isSupportedCreditFacade; /// @dev mapping from (underlying, account) to amount available to claim mapping(address => mapping(address => uint256)) public claimable; /// @dev Contract version uint256 public constant override version = 3_00; /// @dev Restricts calls to Credit Facades only modifier creditFacadeOnly() { if (!isSupportedCreditFacade[msg.sender]) { revert CreditFacadeOnlyException(); } _; } /// @param _addressProvider Address of the address provider /// @param _usdc Address of USDC /// @param _usdt Address of USDT constructor( address _addressProvider, address _usdc, address _usdt ) ACLTrait(_addressProvider) { usdc = _usdc; // F:[BH-1] usdt = _usdt; // F:[BH-1] } /// @dev Returns whether the account is blacklisted for a particular underlying /// @param underlying Underlying token to check /// @param account Account to check /// @notice Used to consolidate different `isBlacklisted` functions under the same interface function isBlacklisted(address underlying, address account) external view override returns (bool) { if (underlying == usdc) { return IBlacklistableUSDC(usdc).isBlacklisted(account); // F:[BH-2] } else if (underlying == usdt) { return IBlacklistableUSDT(usdt).isBlackListed(account); // F:[BH-2] } else { return false; } } /// @dev Increases the underlying balance available to claim by the account /// @param underlying Underlying to increase claimable for /// @param holder Account to increase claimable for /// @param amount Amount to increase claimable claimable for /// @notice Can only be called by Credit Facades when liquidating a blacklisted borrower /// Expects the underlying to be transferred directly to this contract in the same transaction function addClaimable( address underlying, address holder, uint256 amount ) external override creditFacadeOnly { claimable[underlying][holder] += amount; // F:[BH-4] emit ClaimableAdded(underlying, holder, amount); // F:[BH-4] } /// @dev Transfers the sender's claimable balance of underlying to the specified address /// @param underlying Underlying to transfer /// @param to Recipient address function claim(address underlying, address to) external override { uint256 amount = claimable[underlying][msg.sender]; if (amount < 1) { revert NothingToClaimException(); // F:[BH-5] } claimable[underlying][msg.sender] = 0; // F:[BH-5] IERC20(underlying).safeTransfer(to, amount); // F:[BH-5] emit Claimed(underlying, msg.sender, to, amount); // F:[BH-5] } /// @dev Adds a new Credit Facade to `supported` list /// @param _creditFacade Address of the Credit Facade function addCreditFacade(address _creditFacade) external configuratorOnly { if (!ICreditFacade(_creditFacade).isBlacklistableUnderlying()) { revert CreditFacadeNonBlacklistable(); // F:[BH-3] } isSupportedCreditFacade[_creditFacade] = true; // F:[BH-3] emit CreditFacadeAdded(_creditFacade); // F:[BH-3] } /// @dev Removes a Credit Facade from the `supported` list /// @param _creditFacade Address of the Credit Facade function removeCreditFacade(address _creditFacade) external configuratorOnly { isSupportedCreditFacade[_creditFacade] = false; // F:[BH-3] emit CreditFacadeRemoved(_creditFacade); // F:[BH-3] } }
// SPDX-License-Identifier: BUSL-1.1 // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; /// @title Claimable /// @dev Implements logic for a two-step ownership transfer on top of Ownable contract Claimable is Ownable { /// @dev The new owner that has not claimed ownership yet address public pendingOwner; /// @dev A modifier that restricts the function to the pending owner only modifier onlyPendingOwner() { if (msg.sender != pendingOwner) { revert("Claimable: Sender is not pending owner"); } _; } /// @dev Sets pending owner to the new owner, but does not /// transfer ownership yet /// @param newOwner The address to become the future owner function transferOwnership(address newOwner) public override onlyOwner { require( newOwner != address(0), "Claimable: new owner is the zero address" ); pendingOwner = newOwner; } /// @dev Used by the pending owner to claim ownership after transferOwnership function claimOwnership() external onlyPendingOwner { _transferOwnership(pendingOwner); pendingOwner = address(0); } }
// SPDX-License-Identifier: BUSL-1.1 // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; import { Pausable } from "@openzeppelin/contracts/security/Pausable.sol"; import { AddressProvider } from "./AddressProvider.sol"; import { IACL } from "../interfaces/IACL.sol"; import { ZeroAddressException, CallerNotConfiguratorException, CallerNotPausableAdminException, CallerNotUnPausableAdminException } from "../interfaces/IErrors.sol"; /// @title ACL Trait /// @notice Utility class for ACL consumers abstract contract ACLTrait is Pausable { // ACL contract to check rights IACL public immutable _acl; /// @dev constructor /// @param addressProvider Address of address repository constructor(address addressProvider) { if (addressProvider == address(0)) revert ZeroAddressException(); // F:[AA-2] _acl = IACL(AddressProvider(addressProvider).getACL()); } /// @dev Reverts if msg.sender is not configurator modifier configuratorOnly() { if (!_acl.isConfigurator(msg.sender)) revert CallerNotConfiguratorException(); _; } ///@dev Pause contract function pause() external { if (!_acl.isPausableAdmin(msg.sender)) revert CallerNotPausableAdminException(); _pause(); } /// @dev Unpause contract function unpause() external { if (!_acl.isUnpausableAdmin(msg.sender)) revert CallerNotUnPausableAdminException(); _unpause(); } }
// SPDX-License-Identifier: BUSL-1.1 // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; import { IAddressProvider } from "../interfaces/IAddressProvider.sol"; import { Claimable } from "./access/Claimable.sol"; import { Errors } from "../libraries/Errors.sol"; // Repositories & services bytes32 constant CONTRACTS_REGISTER = "CONTRACTS_REGISTER"; bytes32 constant ACL = "ACL"; bytes32 constant PRICE_ORACLE = "PRICE_ORACLE"; bytes32 constant ACCOUNT_FACTORY = "ACCOUNT_FACTORY"; bytes32 constant DATA_COMPRESSOR = "DATA_COMPRESSOR"; bytes32 constant TREASURY_CONTRACT = "TREASURY_CONTRACT"; bytes32 constant GEAR_TOKEN = "GEAR_TOKEN"; bytes32 constant WETH_TOKEN = "WETH_TOKEN"; bytes32 constant WETH_GATEWAY = "WETH_GATEWAY"; bytes32 constant LEVERAGED_ACTIONS = "LEVERAGED_ACTIONS"; /// @title AddressRepository /// @notice Stores addresses of deployed contracts contract AddressProvider is Claimable, IAddressProvider { // Mapping from contract keys to respective addresses mapping(bytes32 => address) public addresses; // Contract version uint256 public constant version = 2; constructor() { // @dev Emits first event for contract discovery emit AddressSet("ADDRESS_PROVIDER", address(this)); } /// @return Address of ACL contract function getACL() external view returns (address) { return _getAddress(ACL); // F:[AP-3] } /// @dev Sets address of ACL contract /// @param _address Address of ACL contract function setACL(address _address) external onlyOwner // F:[AP-12] { _setAddress(ACL, _address); // F:[AP-3] } /// @return Address of ContractsRegister function getContractsRegister() external view returns (address) { return _getAddress(CONTRACTS_REGISTER); // F:[AP-4] } /// @dev Sets address of ContractsRegister /// @param _address Address of ContractsRegister function setContractsRegister(address _address) external onlyOwner // F:[AP-12] { _setAddress(CONTRACTS_REGISTER, _address); // F:[AP-4] } /// @return Address of PriceOracle function getPriceOracle() external view override returns (address) { return _getAddress(PRICE_ORACLE); // F:[AP-5] } /// @dev Sets address of PriceOracle /// @param _address Address of PriceOracle function setPriceOracle(address _address) external onlyOwner // F:[AP-12] { _setAddress(PRICE_ORACLE, _address); // F:[AP-5] } /// @return Address of AccountFactory function getAccountFactory() external view returns (address) { return _getAddress(ACCOUNT_FACTORY); // F:[AP-6] } /// @dev Sets address of AccountFactory /// @param _address Address of AccountFactory function setAccountFactory(address _address) external onlyOwner // F:[AP-12] { _setAddress(ACCOUNT_FACTORY, _address); // F:[AP-6] } /// @return Address of DataCompressor function getDataCompressor() external view override returns (address) { return _getAddress(DATA_COMPRESSOR); // F:[AP-7] } /// @dev Sets address of AccountFactory /// @param _address Address of AccountFactory function setDataCompressor(address _address) external onlyOwner // F:[AP-12] { _setAddress(DATA_COMPRESSOR, _address); // F:[AP-7] } /// @return Address of Treasury contract function getTreasuryContract() external view returns (address) { return _getAddress(TREASURY_CONTRACT); // F:[AP-8] } /// @dev Sets address of Treasury Contract /// @param _address Address of Treasury Contract function setTreasuryContract(address _address) external onlyOwner // F:[AP-12] { _setAddress(TREASURY_CONTRACT, _address); // F:[AP-8] } /// @return Address of GEAR token function getGearToken() external view override returns (address) { return _getAddress(GEAR_TOKEN); // F:[AP-9] } /// @dev Sets address of GEAR token /// @param _address Address of GEAR token function setGearToken(address _address) external onlyOwner // F:[AP-12] { _setAddress(GEAR_TOKEN, _address); // F:[AP-9] } /// @return Address of WETH token function getWethToken() external view override returns (address) { return _getAddress(WETH_TOKEN); // F:[AP-10] } /// @dev Sets address of WETH token /// @param _address Address of WETH token function setWethToken(address _address) external onlyOwner // F:[AP-12] { _setAddress(WETH_TOKEN, _address); // F:[AP-10] } /// @return Address of WETH token function getWETHGateway() external view override returns (address) { return _getAddress(WETH_GATEWAY); // F:[AP-11] } /// @dev Sets address of WETH token /// @param _address Address of WETH token function setWETHGateway(address _address) external onlyOwner // F:[AP-12] { _setAddress(WETH_GATEWAY, _address); // F:[AP-11] } /// @return Address of PathFinder function getLeveragedActions() external view returns (address) { return _getAddress(LEVERAGED_ACTIONS); // T:[AP-7] } /// @dev Sets address of PathFinder /// @param _address Address of PathFinder function setLeveragedActions(address _address) external onlyOwner // T:[AP-15] { _setAddress(LEVERAGED_ACTIONS, _address); // T:[AP-7] } /// @return Address of key, reverts if the key doesn't exist function _getAddress(bytes32 key) internal view returns (address) { address result = addresses[key]; require(result != address(0), Errors.AS_ADDRESS_NOT_FOUND); // F:[AP-1] return result; // F:[AP-3, 4, 5, 6, 7, 8, 9, 10, 11] } /// @dev Sets address to map by its key /// @param key Key in string format /// @param value Address function _setAddress(bytes32 key, address value) internal { addresses[key] = value; // F:[AP-3, 4, 5, 6, 7, 8, 9, 10, 11] emit AddressSet(key, value); // F:[AP-2] } }
// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; import { IVersion } from "./IVersion.sol"; interface IACLExceptions { /// @dev Thrown when attempting to delete an address from a set that is not a pausable admin error AddressNotPausableAdminException(address addr); /// @dev Thrown when attempting to delete an address from a set that is not a unpausable admin error AddressNotUnpausableAdminException(address addr); } interface IACLEvents { /// @dev Emits when a new admin is added that can pause contracts event PausableAdminAdded(address indexed newAdmin); /// @dev Emits when a Pausable admin is removed event PausableAdminRemoved(address indexed admin); /// @dev Emits when a new admin is added that can unpause contracts event UnpausableAdminAdded(address indexed newAdmin); /// @dev Emits when an Unpausable admin is removed event UnpausableAdminRemoved(address indexed admin); } /// @title ACL interface interface IACL is IACLEvents, IACLExceptions, IVersion { /// @dev Returns true if the address is a pausable admin and false if not /// @param addr Address to check function isPausableAdmin(address addr) external view returns (bool); /// @dev Returns true if the address is unpausable admin and false if not /// @param addr Address to check function isUnpausableAdmin(address addr) external view returns (bool); /// @dev Returns true if an address has configurator rights /// @param account Address to check function isConfigurator(address account) external view returns (bool); /// @dev Returns address of configurator function owner() external view returns (address); }
// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; import { IVersion } from "./IVersion.sol"; interface IAddressProviderEvents { /// @dev Emits when an address is set for a contract role event AddressSet(bytes32 indexed service, address indexed newAddress); } /// @title Optimised for front-end Address Provider interface interface IAddressProvider is IAddressProviderEvents, IVersion { /// @return Address of ACL contract function getACL() external view returns (address); /// @return Address of ContractsRegister function getContractsRegister() external view returns (address); /// @return Address of AccountFactory function getAccountFactory() external view returns (address); /// @return Address of DataCompressor function getDataCompressor() external view returns (address); /// @return Address of GEAR token function getGearToken() external view returns (address); /// @return Address of WETH token function getWethToken() external view returns (address); /// @return Address of WETH Gateway function getWETHGateway() external view returns (address); /// @return Address of PriceOracle function getPriceOracle() external view returns (address); /// @return Address of DAO Treasury Multisig function getTreasuryContract() external view returns (address); /// @return Address of PathFinder function getLeveragedActions() external view returns (address); }
// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; import { IVersion } from "./IVersion.sol"; interface IBlacklistHelperEvents { /// @dev Emitted when a borrower's claimable balance is increased event ClaimableAdded( address indexed underlying, address indexed holder, uint256 amount ); /// @dev Emitted when a borrower claims their tokens event Claimed( address indexed underlying, address indexed holder, address to, uint256 amount ); /// @dev Emitted when a Credit Facade is added to BlacklistHelper event CreditFacadeAdded(address indexed creditFacade); /// @dev Emitted when a Credit Facade is removed from BlacklistHelper event CreditFacadeRemoved(address indexed creditFacade); } interface IBlacklistHelperExceptions { /// @dev Thrown when an access-restricted function is called by non-CreditFacade error CreditFacadeOnlyException(); /// @dev Thrown when attempting to add a Credit Facade that has non-blacklistable underlying error CreditFacadeNonBlacklistable(); /// @dev Thrown when attempting to claim funds without having anything claimable error NothingToClaimException(); } interface IBlacklistHelper is IBlacklistHelperEvents, IBlacklistHelperExceptions, IVersion { /// @dev Returns whether the account is blacklisted for a particular underlying /// @param underlying Underlying token to check /// @param account Account to check function isBlacklisted(address underlying, address account) external view returns (bool); /// @dev Transfers the sender's claimable balance of underlying to the specified address /// @param underlying Underlying to transfer /// @param to Recipient address function claim(address underlying, address to) external; /// @dev Increases the underlying balance available to claim by the account /// @param underlying Underlying to increase claimable for /// @param holder Account to increase claimable for /// @param amount Amount to increase claimable claimable for function addClaimable( address underlying, address holder, uint256 amount ) external; /// @dev Returns the amount claimable by an account /// @param underlying Underlying to get the amount for /// @param holder Acccount to get the amount for function claimable(address underlying, address holder) external view returns (uint256); }
// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; import { Balance } from "../libraries/Balances.sol"; import { MultiCall } from "../libraries/MultiCall.sol"; import { ICreditManagerV2, ICreditManagerV2Exceptions } from "./ICreditManagerV2.sol"; import { IVersion } from "./IVersion.sol"; interface ICreditFacadeExtended { /// @dev Stores expected balances (computed as current balance + passed delta) /// and compare with actual balances at the end of a multicall, reverts /// if at least one is less than expected /// @param expected Array of expected balance changes /// @notice This is an extenstion function that does not exist in the Credit Facade /// itself and can only be used within a multicall function revertIfReceivedLessThan(Balance[] memory expected) external; /// @dev Enables token in enabledTokenMask for the Credit Account of msg.sender /// @param token Address of token to enable function enableToken(address token) external; /// @dev Disables a token on the caller's Credit Account /// @param token Token to disable /// @notice This is an extenstion function that does not exist in the Credit Facade /// itself and can only be used within a multicall function disableToken(address token) external; /// @dev Adds collateral to borrower's credit account /// @param onBehalfOf Address of the borrower whose account is funded /// @param token Address of a collateral token /// @param amount Amount to add function addCollateral( address onBehalfOf, address token, uint256 amount ) external payable; /// @dev Increases debt for msg.sender's Credit Account /// - Borrows the requested amount from the pool /// - Updates the CA's borrowAmount / cumulativeIndexOpen /// to correctly compute interest going forward /// - Performs a full collateral check /// /// @param amount Amount to borrow function increaseDebt(uint256 amount) external; /// @dev Decrease debt /// - Decreases the debt by paying the requested amount + accrued interest + fees back to the pool /// - It's also include to this payment interest accrued at the moment and fees /// - Updates cunulativeIndex to cumulativeIndex now /// /// @param amount Amount to increase borrowed amount function decreaseDebt(uint256 amount) external; } interface ICreditFacadeEvents { /// @dev Emits when Blacklist Helper is set for the Credit Facade upon creation event BlacklistHelperSet(address indexed blacklistHelper); /// @dev Emits when a new Credit Account is opened through the /// Credit Facade event OpenCreditAccount( address indexed onBehalfOf, address indexed creditAccount, uint256 borrowAmount, uint16 referralCode ); /// @dev Emits when the account owner closes their CA normally event CloseCreditAccount(address indexed borrower, address indexed to); /// @dev Emits when a Credit Account is liquidated due to low health factor event LiquidateCreditAccount( address indexed borrower, address indexed liquidator, address indexed to, uint256 remainingFunds ); /// @dev Emits when a Credit Account is liquidated due to expiry event LiquidateExpiredCreditAccount( address indexed borrower, address indexed liquidator, address indexed to, uint256 remainingFunds ); /// @dev Emits when remaining funds in underlying currency are sent to /// the blacklist helper upon blacklisted borrower liquidation event UnderlyingSentToBlacklistHelper( address indexed borrower, uint256 amount ); /// @dev Emits when the account owner increases CA's debt event IncreaseBorrowedAmount(address indexed borrower, uint256 amount); /// @dev Emits when the account owner reduces CA's debt event DecreaseBorrowedAmount(address indexed borrower, uint256 amount); /// @dev Emits when the account owner add new collateral to a CA event AddCollateral( address indexed onBehalfOf, address indexed token, uint256 value ); /// @dev Emits when a multicall is started event MultiCallStarted(address indexed borrower); /// @dev Emits when a multicall is finished event MultiCallFinished(); /// @dev Emits when Credit Account ownership is transferred event TransferAccount(address indexed oldOwner, address indexed newOwner); /// @dev Emits when the user changes approval for account transfers to itself from another address event TransferAccountAllowed( address indexed from, address indexed to, bool state ); /// @dev Emits when the account owner enables a token on their CA event TokenEnabled(address indexed borrower, address indexed token); /// @dev Emits when the account owner disables a token on their CA event TokenDisabled(address indexed borrower, address indexed token); /// @dev Emits when pool incurs loss on account liquidation and facade forbids borrowing event IncurLossOnLiquidation(uint256 loss); } interface ICreditFacadeExceptions is ICreditManagerV2Exceptions { /// @dev Thrown if the CreditFacade is not expirable, and an aciton is attempted that /// requires expirability error NotAllowedWhenNotExpirableException(); /// @dev Thrown if whitelisted mode is enabled, and an action is attempted that is /// not allowed in whitelisted mode error NotAllowedInWhitelistedMode(); /// @dev Thrown if a user attempts to transfer a CA to an address that didn't allow it error AccountTransferNotAllowedException(); /// @dev Thrown if a liquidator tries to liquidate an account with a health factor above 1 error CantLiquidateWithSuchHealthFactorException(); /// @dev Thrown if a liquidator tries to liquidate an account by expiry while a Credit Facade is not expired error CantLiquidateNonExpiredException(); /// @dev Thrown if call data passed to a multicall is too short error IncorrectCallDataException(); /// @dev Thrown inside account closure multicall if the borrower attempts an action that is forbidden on closing /// an account error ForbiddenDuringClosureException(); /// @dev Thrown if debt increase and decrease are subsequently attempted in one multicall error IncreaseAndDecreaseForbiddenInOneCallException(); /// @dev Thrown if a selector that doesn't match any allowed function is passed to the Credit Facade /// during a multicall error UnknownMethodException(); /// @dev Thrown if a user tries to open an account or increase debt with increaseDebtForbidden mode on error IncreaseDebtForbiddenException(); /// @dev Thrown if the account owner tries to transfer an unhealthy account error CantTransferLiquidatableAccountException(); /// @dev Thrown if too much new debt was taken within a single block error BorrowedBlockLimitException(); /// @dev Thrown if the new debt principal for a CA falls outside of borrowing limits error BorrowAmountOutOfLimitsException(); /// @dev Thrown if one of the balances on a Credit Account is less than expected /// at the end of a multicall, if revertIfReceivedLessThan was called error BalanceLessThanMinimumDesiredException(address); /// @dev Thrown if a user attempts to open an account on a Credit Facade that has expired error OpenAccountNotAllowedAfterExpirationException(); /// @dev Thrown if expected balances are attempted to be set through revertIfReceivedLessThan twice error ExpectedBalancesAlreadySetException(); /// @dev Thrown if a Credit Account has enabled forbidden tokens and the owner attempts to perform an action /// that is not allowed with any forbidden tokens enabled error ActionProhibitedWithForbiddenTokensException(); /// @dev Thrown when attempting to perform an action on behalf of a borrower /// that is blacklisted in the underlying token error NotAllowedForBlacklistedAddressException(); /// @dev Thrown when the pool receives less funds than borrowAmountWithInterest on account closure error LiquiditySanityCheckException(); } interface ICreditFacade is ICreditFacadeEvents, ICreditFacadeExceptions, IVersion { // // CREDIT ACCOUNT MANAGEMENT // /// @dev Opens credit account, borrows funds from the pool and pulls collateral /// without any additional action. /// @param amount The amount of collateral provided by the borrower /// @param onBehalfOf The address to open an account for. Transfers to it have to be allowed if /// msg.sender != obBehalfOf /// @param leverageFactor Percentage of the user's own funds to borrow. 100 is equal to 100% - borrows the same amount /// as the user's own collateral, equivalent to 2x leverage. /// @param referralCode Referral code that is used for potential rewards. 0 if no referral code provided. function openCreditAccount( uint256 amount, address onBehalfOf, uint16 leverageFactor, uint16 referralCode ) external payable; /// @dev Opens a Credit Account and runs a batch of operations in a multicall /// @param borrowedAmount Debt size /// @param onBehalfOf The address to open an account for. Transfers to it have to be allowed if /// msg.sender != obBehalfOf /// @param calls The array of MultiCall structs encoding the required operations. Generally must have /// at least a call to addCollateral, as otherwise the health check at the end will fail. /// @param referralCode Referral code which is used for potential rewards. 0 if no referral code provided function openCreditAccountMulticall( uint256 borrowedAmount, address onBehalfOf, MultiCall[] calldata calls, uint16 referralCode ) external payable; /// @dev Runs a batch of transactions within a multicall and closes the account /// - Wraps ETH to WETH and sends it msg.sender if value > 0 /// - Executes the multicall - the main purpose of a multicall when closing is to convert all assets to underlying /// in order to pay the debt. /// - Closes credit account: /// + Checks the underlying balance: if it is greater than the amount paid to the pool, transfers the underlying /// from the Credit Account and proceeds. If not, tries to transfer the shortfall from msg.sender. /// + Transfers all enabled assets with non-zero balances to the "to" address, unless they are marked /// to be skipped in skipTokenMask /// - Emits a CloseCreditAccount event /// /// @param to Address to send funds to during account closing /// @param skipTokenMask Uint-encoded bit mask where 1's mark tokens that shouldn't be transferred /// @param calls The array of MultiCall structs encoding the operations to execute before closing the account. function closeCreditAccount( address to, uint256 skipTokenMask, MultiCall[] calldata calls ) external payable; /// @dev A version of `closeCreditAccount` with `convertWETH` parameter that is ignored. /// Used for backward compatibility. function closeCreditAccount( address to, uint256 skipTokenMask, bool convertWETH, MultiCall[] calldata calls ) external payable; /// @dev Runs a batch of transactions within a multicall and liquidates the account /// - Computes the total value and checks that hf < 1. An account can't be liquidated when hf >= 1. /// Total value has to be computed before the multicall, otherwise the liquidator would be able /// to manipulate it. /// - Wraps ETH to WETH and sends it to msg.sender (liquidator) if value > 0 /// - Executes the multicall - the main purpose of a multicall when liquidating is to convert all assets to underlying /// in order to pay the debt. /// - Liquidate credit account: /// + Computes the amount that needs to be paid to the pool. If totalValue * liquidationDiscount < borrow + interest + fees, /// only totalValue * liquidationDiscount has to be paid. Since liquidationDiscount < 1, the liquidator can take /// totalValue * (1 - liquidationDiscount) as premium. Also computes the remaining funds to be sent to borrower /// as totalValue * liquidationDiscount - amountToPool. /// + Checks the underlying balance: if it is greater than amountToPool + remainingFunds, transfers the underlying /// from the Credit Account and proceeds. If not, tries to transfer the shortfall from the liquidator. /// + Transfers all enabled assets with non-zero balances to the "to" address, unless they are marked /// to be skipped in skipTokenMask. If the liquidator is confident that all assets were converted /// during the multicall, they can set the mask to uint256.max - 1, to only transfer the underlying /// - Emits LiquidateCreditAccount event /// /// @param to Address to send funds to after liquidation /// @param skipTokenMask Uint-encoded bit mask where 1's mark tokens that shouldn't be transferred /// @param calls The array of MultiCall structs encoding the operations to execute before liquidating the account. function liquidateCreditAccount( address borrower, address to, uint256 skipTokenMask, MultiCall[] calldata calls ) external payable; /// @dev A version of `liquidateCreditAccount` with `convertWETH` parameter that is ignored. /// Used for backward compatibility. function liquidateCreditAccount( address borrower, address to, uint256 skipTokenMask, bool convertWETH, MultiCall[] calldata calls ) external payable; /// @dev Runs a batch of transactions within a multicall and liquidates the account when /// this Credit Facade is expired /// The general flow of liquidation is nearly the same as normal liquidations, with two main differences: /// - An account can be liquidated on an expired Credit Facade even with hf > 1. However, /// no accounts can be liquidated through this function if the Credit Facade is not expired. /// - Liquidation premiums and fees for liquidating expired accounts are reduced. /// It is still possible to normally liquidate an underwater Credit Account, even when the Credit Facade /// is expired. /// @param to Address to send funds to after liquidation /// @param skipTokenMask Uint-encoded bit mask where 1's mark tokens that shouldn't be transferred /// @param calls The array of MultiCall structs encoding the operations to execute before liquidating the account. /// @notice See more at https://dev.gearbox.fi/docs/documentation/credit/liquidation#liquidating-accounts-by-expiration function liquidateExpiredCreditAccount( address borrower, address to, uint256 skipTokenMask, MultiCall[] calldata calls ) external payable; /// @dev A version of `liquidateExpiredCreditAccount` with `convertWETH` parameter that is ignored. /// Used for backward compatibility. function liquidateExpiredCreditAccount( address borrower, address to, uint256 skipTokenMask, bool convertWETH, MultiCall[] calldata calls ) external payable; /// @dev Adds collateral to borrower's credit account /// @param onBehalfOf Address of the borrower whose account is funded /// @param token Address of a collateral token /// @param amount Amount to add function addCollateral( address onBehalfOf, address token, uint256 amount ) external payable; /// @dev Executes a batch of transactions within a Multicall, to manage an existing account /// - Wraps ETH and sends it back to msg.sender, if value > 0 /// - Executes the Multicall /// - Performs a fullCollateralCheck to verify that hf > 1 after all actions /// @param calls The array of MultiCall structs encoding the operations to execute. function multicall(MultiCall[] calldata calls) external payable; /// @dev Returns true if the borrower has an open Credit Account /// @param borrower Borrower address function hasOpenedCreditAccount(address borrower) external view returns (bool); /// @dev Approves account transfer from another user to msg.sender /// @param from Address for which account transfers are allowed/forbidden /// @param state True is transfer is allowed, false if forbidden function approveAccountTransfer(address from, bool state) external; /// @dev Transfers credit account to another user /// By default, this action is forbidden, and the user has to approve transfers from sender to itself /// by calling approveAccountTransfer. /// This is done to prevent malicious actors from transferring compromised accounts to other users. /// @param to Address to transfer the account to function transferAccountOwnership(address to) external; // // GETTERS // /// @dev Calculates total value for provided Credit Account in underlying /// /// @param creditAccount Credit Account address /// @return total Total value in underlying /// @return twv Total weighted (discounted by liquidation thresholds) value in underlying function calcTotalValue(address creditAccount) external view returns (uint256 total, uint256 twv); /** * @dev Calculates health factor for the credit account * * sum(asset[i] * liquidation threshold[i]) * Hf = -------------------------------------------- * borrowed amount + interest accrued + fees * * * More info: https://dev.gearbox.fi/developers/credit/economy#health-factor * * @param creditAccount Credit account address * @return hf = Health factor in bp (see PERCENTAGE FACTOR in PercentageMath.sol) */ function calcCreditAccountHealthFactor(address creditAccount) external view returns (uint256 hf); /// @dev Returns true if token is a collateral token and is not forbidden, /// otherwise returns false /// @param token Token to check function isTokenAllowed(address token) external view returns (bool); /// @dev Returns the CreditManager connected to this Credit Facade function creditManager() external view returns (ICreditManagerV2); /// @dev Returns true if 'from' is allowed to transfer Credit Accounts to 'to' /// @param from Sender address to check allowance for /// @param to Receiver address to check allowance for function transfersAllowed(address from, address to) external view returns (bool); /// @return maxBorrowedAmountPerBlock Maximal amount of new debt that can be taken per block /// @return isIncreaseDebtForbidden True if increasing debt is forbidden /// @return expirationDate Timestamp of the next expiration (for expirable Credit Facades only) /// @return emergencyLiquidationDiscount Premium for liquidations when the system is paused function params() external view returns ( uint128 maxBorrowedAmountPerBlock, bool isIncreaseDebtForbidden, uint40 expirationDate, uint16 emergencyLiquidationDiscount ); /// @return minBorrowedAmount Minimal borrowed amount per credit account /// @return maxBorrowedAmount Maximal borrowed amount per credit account function limits() external view returns (uint128 minBorrowedAmount, uint128 maxBorrowedAmount); function lossParams() external view returns (uint128 currentCumulativeLoss, uint128 maxCumulativeLoss); function totalDebt() external view returns (uint128 currentTotalDebt, uint128 totalDebtLimit); /// @dev Address of the DegenNFT that gatekeeps account openings in whitelisted mode function degenNFT() external view returns (address); /// @dev Address of the underlying asset function underlying() external view returns (address); /// @dev Address of the blacklist helper or address(0), if underlying is not blacklistable function blacklistHelper() external view returns (address); /// @dev Whether the underlying of connected Credit Manager is blacklistable function isBlacklistableUnderlying() external view returns (bool); } interface ICreditFacadeV2 { /// @return maxBorrowedAmountPerBlock Maximal amount of new debt that can be taken per block /// @return isIncreaseDebtForbidden True if increasing debt is forbidden /// @return expirationDate Timestamp of the next expiration (for expirable Credit Facades only) function params() external view returns ( uint128 maxBorrowedAmountPerBlock, bool isIncreaseDebtForbidden, uint40 expirationDate ); }
// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; import { IPriceOracleV2 } from "./IPriceOracle.sol"; import { IVersion } from "./IVersion.sol"; enum ClosureAction { CLOSE_ACCOUNT, LIQUIDATE_ACCOUNT, LIQUIDATE_EXPIRED_ACCOUNT, LIQUIDATE_PAUSED } interface ICreditManagerV2Events { /// @dev Emits when a call to an external contract is made through the Credit Manager event ExecuteOrder(address indexed borrower, address indexed target); /// @dev Emits when a configurator is upgraded event NewConfigurator(address indexed newConfigurator); } interface ICreditManagerV2Exceptions { /// @dev Thrown if an access-restricted function is called by an address that is not /// the connected Credit Facade, or an allowed adapter error AdaptersOrCreditFacadeOnlyException(); /// @dev Thrown if an access-restricted function is called by an address that is not /// the connected Credit Facade error CreditFacadeOnlyException(); /// @dev Thrown if an access-restricted function is called by an address that is not /// the connected Credit Configurator error CreditConfiguratorOnlyException(); /// @dev Thrown on attempting to open a Credit Account for or transfer a Credit Account /// to the zero address or an address that already owns a Credit Account error ZeroAddressOrUserAlreadyHasAccountException(); /// @dev Thrown on attempting to execute an order to an address that is not an allowed /// target contract error TargetContractNotAllowedException(); /// @dev Thrown on failing a full collateral check after an operation error NotEnoughCollateralException(); /// @dev Thrown on attempting to receive a token that is not a collateral token /// or was forbidden error TokenNotAllowedException(); /// @dev Thrown if an attempt to approve a collateral token to a target contract failed error AllowanceFailedException(); /// @dev Thrown on attempting to perform an action for an address that owns no Credit Account error HasNoOpenedAccountException(); /// @dev Thrown on attempting to add a token that is already in a collateral list error TokenAlreadyAddedException(); /// @dev Thrown on configurator attempting to add more than 256 collateral tokens error TooManyTokensException(); /// @dev Thrown if more than the maximal number of tokens were enabled on a Credit Account, /// and there are not enough unused token to disable error TooManyEnabledTokensException(); /// @dev Thrown when a reentrancy into the contract is attempted error ReentrancyLockException(); } /// @notice All Credit Manager functions are access-restricted and can only be called /// by the Credit Facade or allowed adapters. Users are not allowed to /// interact with the Credit Manager directly interface ICreditManagerV2 is ICreditManagerV2Events, ICreditManagerV2Exceptions, IVersion { // // CREDIT ACCOUNT MANAGEMENT // /// @dev Opens credit account and borrows funds from the pool. /// - Takes Credit Account from the factory; /// - Requests the pool to lend underlying to the Credit Account /// /// @param borrowedAmount Amount to be borrowed by the Credit Account /// @param onBehalfOf The owner of the newly opened Credit Account function openCreditAccount(uint256 borrowedAmount, address onBehalfOf) external returns (address); /// @dev Closes a Credit Account - covers both normal closure and liquidation /// - Checks whether the contract is paused, and, if so, if the payer is an emergency liquidator. /// Only emergency liquidators are able to liquidate account while the CM is paused. /// Emergency liquidations do not pay a liquidator premium or liquidation fees. /// - Calculates payments to various recipients on closure: /// + Computes amountToPool, which is the amount to be sent back to the pool. /// This includes the principal, interest and fees, but can't be more than /// total position value /// + Computes remainingFunds during liquidations - these are leftover funds /// after paying the pool and the liquidator, and are sent to the borrower /// + Computes protocol profit, which includes interest and liquidation fees /// + Computes loss if the totalValue is less than borrow amount + interest /// - Checks the underlying token balance: /// + if it is larger than amountToPool, then the pool is paid fully from funds on the Credit Account /// + else tries to transfer the shortfall from the payer - either the borrower during closure, or liquidator during liquidation /// - Send assets to the "to" address, as long as they are not included into skipTokenMask /// - If convertWETH is true, the function converts WETH into ETH before sending /// - Returns the Credit Account back to factory /// /// @param borrower Borrower address /// @param closureActionType Whether the account is closed, liquidated or liquidated due to expiry /// @param totalValue Portfolio value for liqution, 0 for ordinary closure /// @param payer Address which would be charged if credit account has not enough funds to cover amountToPool /// @param to Address to which the leftover funds will be sent /// @param skipTokenMask Tokenmask contains 1 for tokens which needed to be skipped for sending /// @param convertWETH If true converts WETH to ETH function closeCreditAccount( address borrower, ClosureAction closureActionType, uint256 totalValue, address payer, address to, uint256 skipTokenMask, bool convertWETH ) external returns (uint256 remainingFunds); /// @dev Manages debt size for borrower: /// /// - Increase debt: /// + Increases debt by transferring funds from the pool to the credit account /// + Updates the cumulative index to keep interest the same. Since interest /// is always computed dynamically as borrowedAmount * (cumulativeIndexNew / cumulativeIndexOpen - 1), /// cumulativeIndexOpen needs to be updated, as the borrow amount has changed /// /// - Decrease debt: /// + Repays debt partially + all interest and fees accrued thus far /// + Updates cunulativeIndex to cumulativeIndex now /// /// @param creditAccount Address of the Credit Account to change debt for /// @param amount Amount to increase / decrease the principal by /// @param increase True to increase principal, false to decrease /// @return newBorrowedAmount The new debt principal function manageDebt( address creditAccount, uint256 amount, bool increase ) external returns (uint256 newBorrowedAmount); /// @dev Adds collateral to borrower's credit account /// @param payer Address of the account which will be charged to provide additional collateral /// @param creditAccount Address of the Credit Account /// @param token Collateral token to add /// @param amount Amount to add function addCollateral( address payer, address creditAccount, address token, uint256 amount ) external; /// @dev Transfers Credit Account ownership to another address /// @param from Address of previous owner /// @param to Address of new owner function transferAccountOwnership(address from, address to) external; /// @dev Requests the Credit Account to approve a collateral token to another contract. /// @param borrower Borrower's address /// @param targetContract Spender to change allowance for /// @param token Collateral token to approve /// @param amount New allowance amount function approveCreditAccount( address borrower, address targetContract, address token, uint256 amount ) external; /// @dev Requests a Credit Account to make a low-level call with provided data /// This is the intended pathway for state-changing interactions with 3rd-party protocols /// @param borrower Borrower's address /// @param targetContract Contract to be called /// @param data Data to pass with the call function executeOrder( address borrower, address targetContract, bytes memory data ) external returns (bytes memory); // // COLLATERAL VALIDITY AND ACCOUNT HEALTH CHECKS // /// @dev Enables a token on a Credit Account, including it /// into account health and total value calculations /// @param creditAccount Address of a Credit Account to enable the token for /// @param token Address of the token to be enabled function checkAndEnableToken(address creditAccount, address token) external; /// @dev Optimized health check for individual swap-like operations. /// @notice Fast health check assumes that only two tokens (input and output) /// participate in the operation and computes a % change in weighted value between /// inbound and outbound collateral. The cumulative negative change across several /// swaps in sequence cannot be larger than feeLiquidation (a fee that the /// protocol is ready to waive if needed). Since this records a % change /// between just two tokens, the corresponding % change in TWV will always be smaller, /// which makes this check safe. /// More details at https://dev.gearbox.fi/docs/documentation/risk/fast-collateral-check#fast-check-protection /// @param creditAccount Address of the Credit Account /// @param tokenIn Address of the token spent by the swap /// @param tokenOut Address of the token received from the swap /// @param balanceInBefore Balance of tokenIn before the operation /// @param balanceOutBefore Balance of tokenOut before the operation function fastCollateralCheck( address creditAccount, address tokenIn, address tokenOut, uint256 balanceInBefore, uint256 balanceOutBefore ) external; /// @dev Performs a full health check on an account, summing up /// value of all enabled collateral tokens /// @param creditAccount Address of the Credit Account to check function fullCollateralCheck(address creditAccount) external; /// @dev Checks that the number of enabled tokens on a Credit Account /// does not violate the maximal enabled token limit and tries /// to disable unused tokens if it does /// @param creditAccount Account to check enabled tokens for function checkAndOptimizeEnabledTokens(address creditAccount) external; /// @dev Disables a token on a credit account /// @notice Usually called by adapters to disable spent tokens during a multicall, /// but can also be called separately from the Credit Facade to remove /// unwanted tokens /// @return True if token mask was change otherwise False function disableToken(address creditAccount, address token) external returns (bool); // // GETTERS // /// @dev Returns the address of a borrower's Credit Account, or reverts if there is none. /// @param borrower Borrower's address function getCreditAccountOrRevert(address borrower) external view returns (address); /// @dev Computes amounts that must be sent to various addresses before closing an account /// @param totalValue Credit Accounts total value in underlying /// @param closureActionType Type of account closure /// * CLOSE_ACCOUNT: The account is healthy and is closed normally /// * LIQUIDATE_ACCOUNT: The account is unhealthy and is being liquidated to avoid bad debt /// * LIQUIDATE_EXPIRED_ACCOUNT: The account has expired and is being liquidated (lowered liquidation premium) /// * LIQUIDATE_PAUSED: The account is liquidated while the system is paused due to emergency (no liquidation premium) /// @param borrowedAmount Credit Account's debt principal /// @param borrowedAmountWithInterest Credit Account's debt principal + interest /// @return amountToPool Amount of underlying to be sent to the pool /// @return remainingFunds Amount of underlying to be sent to the borrower (only applicable to liquidations) /// @return profit Protocol's profit from fees (if any) /// @return loss Protocol's loss from bad debt (if any) function calcClosePayments( uint256 totalValue, ClosureAction closureActionType, uint256 borrowedAmount, uint256 borrowedAmountWithInterest ) external view returns ( uint256 amountToPool, uint256 remainingFunds, uint256 profit, uint256 loss ); /// @dev Calculates the debt accrued by a Credit Account /// @param creditAccount Address of the Credit Account /// @return borrowedAmount The debt principal /// @return borrowedAmountWithInterest The debt principal + accrued interest /// @return borrowedAmountWithInterestAndFees The debt principal + accrued interest and protocol fees function calcCreditAccountAccruedInterest(address creditAccount) external view returns ( uint256 borrowedAmount, uint256 borrowedAmountWithInterest, uint256 borrowedAmountWithInterestAndFees ); /// @dev Maps Credit Accounts to bit masks encoding their enabled token sets /// Only enabled tokens are counted as collateral for the Credit Account /// @notice An enabled token mask encodes an enabled token by setting /// the bit at the position equal to token's index to 1 function enabledTokensMap(address creditAccount) external view returns (uint256); /// @dev Maps the Credit Account to its current percentage drop across all swaps since /// the last full check, in RAY format function cumulativeDropAtFastCheckRAY(address creditAccount) external view returns (uint256); /// @dev Returns the collateral token at requested index and its liquidation threshold /// @param id The index of token to return function collateralTokens(uint256 id) external view returns (address token, uint16 liquidationThreshold); /// @dev Returns the collateral token with requested mask and its liquidationThreshold /// @param tokenMask Token mask corresponding to the token function collateralTokensByMask(uint256 tokenMask) external view returns (address token, uint16 liquidationThreshold); /// @dev Total number of known collateral tokens. function collateralTokensCount() external view returns (uint256); /// @dev Returns the mask for the provided token /// @param token Token to returns the mask for function tokenMasksMap(address token) external view returns (uint256); /// @dev Bit mask encoding a set of forbidden tokens function forbiddenTokenMask() external view returns (uint256); /// @dev Maps allowed adapters to their respective target contracts. function adapterToContract(address adapter) external view returns (address); /// @dev Maps 3rd party contracts to their respective adapters function contractToAdapter(address targetContract) external view returns (address); /// @dev Address of the underlying asset function underlying() external view returns (address); /// @dev Address of the connected pool function pool() external view returns (address); /// @dev Address of the connected pool /// @notice [DEPRECATED]: use pool() instead. function poolService() external view returns (address); /// @dev A map from borrower addresses to Credit Account addresses function creditAccounts(address borrower) external view returns (address); /// @dev Address of the connected Credit Configurator function creditConfigurator() external view returns (address); /// @dev Address of WETH function wethAddress() external view returns (address); /// @dev Returns the liquidation threshold for the provided token /// @param token Token to retrieve the LT for function liquidationThresholds(address token) external view returns (uint16); /// @dev The maximal number of enabled tokens on a single Credit Account function maxAllowedEnabledTokenLength() external view returns (uint8); /// @dev Maps addresses to their status as emergency liquidator. /// @notice Emergency liquidators are trusted addresses /// that are able to liquidate positions while the contracts are paused, /// e.g. when there is a risk of bad debt while an exploit is being patched. /// In the interest of fairness, emergency liquidators do not receive a premium /// And are compensated by the Gearbox DAO separately. function canLiquidateWhilePaused(address) external view returns (bool); /// @dev Returns the fee parameters of the Credit Manager /// @return feeInterest Percentage of interest taken by the protocol as profit /// @return feeLiquidation Percentage of account value taken by the protocol as profit /// during unhealthy account liquidations /// @return liquidationDiscount Multiplier that reduces the effective totalValue during unhealthy account liquidations, /// allowing the liquidator to take the unaccounted for remainder as premium. Equal to (1 - liquidationPremium) /// @return feeLiquidationExpired Percentage of account value taken by the protocol as profit /// during expired account liquidations /// @return liquidationDiscountExpired Multiplier that reduces the effective totalValue during expired account liquidations, /// allowing the liquidator to take the unaccounted for remainder as premium. Equal to (1 - liquidationPremiumExpired) function fees() external view returns ( uint16 feeInterest, uint16 feeLiquidation, uint16 liquidationDiscount, uint16 feeLiquidationExpired, uint16 liquidationDiscountExpired ); /// @dev Address of the connected Credit Facade function creditFacade() external view returns (address); /// @dev Address of the connected Price Oracle function priceOracle() external view returns (IPriceOracleV2); /// @dev Address of the universal adapter function universalAdapter() external view returns (address); /// @dev Contract's version function version() external view returns (uint256); /// @dev Paused() state function checkEmergencyPausable(address caller, bool state) external returns (bool); }
// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; /// @dev Common contract exceptions /// @dev Thrown on attempting to set an important address to zero address error ZeroAddressException(); /// @dev Thrown on attempting to call a non-implemented function error NotImplementedException(); /// @dev Thrown on attempting to set an EOA as an important contract in the system error AddressIsNotContractException(address); /// @dev Thrown on attempting to use a non-ERC20 contract or an EOA as a token error IncorrectTokenContractException(); /// @dev Thrown on attempting to set a token price feed to an address that is not a /// correct price feed error IncorrectPriceFeedException(); /// @dev Thrown on attempting to call an access restricted function as a non-Configurator error CallerNotConfiguratorException(); /// @dev Thrown on attempting to call an access restricted function as a non-Configurator error CallerNotControllerException(); /// @dev Thrown on attempting to pause a contract as a non-Pausable admin error CallerNotPausableAdminException(); /// @dev Thrown on attempting to pause a contract as a non-Unpausable admin error CallerNotUnPausableAdminException();
// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; import { IVersion } from "./IVersion.sol"; interface IPriceOracleV2Events { /// @dev Emits when a new price feed is added event NewPriceFeed(address indexed token, address indexed priceFeed); } interface IPriceOracleV2Exceptions { /// @dev Thrown if a price feed returns 0 error ZeroPriceException(); /// @dev Thrown if the last recorded result was not updated in the last round error ChainPriceStaleException(); /// @dev Thrown on attempting to get a result for a token that does not have a price feed error PriceOracleNotExistsException(); } /// @title Price oracle interface interface IPriceOracleV2 is IPriceOracleV2Events, IPriceOracleV2Exceptions, IVersion { /// @dev Converts a quantity of an asset to USD (decimals = 8). /// @param amount Amount to convert /// @param token Address of the token to be converted function convertToUSD(uint256 amount, address token) external view returns (uint256); /// @dev Converts a quantity of USD (decimals = 8) to an equivalent amount of an asset /// @param amount Amount to convert /// @param token Address of the token converted to function convertFromUSD(uint256 amount, address token) external view returns (uint256); /// @dev Converts one asset into another /// /// @param amount Amount to convert /// @param tokenFrom Address of the token to convert from /// @param tokenTo Address of the token to convert to function convert( uint256 amount, address tokenFrom, address tokenTo ) external view returns (uint256); /// @dev Returns collateral values for two tokens, required for a fast check /// @param amountFrom Amount of the outbound token /// @param tokenFrom Address of the outbound token /// @param amountTo Amount of the inbound token /// @param tokenTo Address of the inbound token /// @return collateralFrom Value of the outbound token amount in USD /// @return collateralTo Value of the inbound token amount in USD function fastCheck( uint256 amountFrom, address tokenFrom, uint256 amountTo, address tokenTo ) external view returns (uint256 collateralFrom, uint256 collateralTo); /// @dev Returns token's price in USD (8 decimals) /// @param token The token to compute the price for function getPrice(address token) external view returns (uint256); /// @dev Returns the price feed address for the passed token /// @param token Token to get the price feed for function priceFeeds(address token) external view returns (address priceFeed); /// @dev Returns the price feed for the passed token, /// with additional parameters /// @param token Token to get the price feed for function priceFeedsWithFlags(address token) external view returns ( address priceFeed, bool skipCheck, uint256 decimals ); } interface IPriceOracleV2Ext is IPriceOracleV2 { /// @dev Sets a price feed if it doesn't exist, or updates an existing one /// @param token Address of the token to set the price feed for /// @param priceFeed Address of a USD price feed adhering to Chainlink's interface function addPriceFeed(address token, address priceFeed) external; }
// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; /// @title IVersion /// @dev Declares a version function which returns the contract's version interface IVersion { /// @dev Returns contract version function version() external view returns (uint256); }
// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; struct Balance { address token; uint256 balance; } library BalanceOps { error UnknownToken(address); function copyBalance(Balance memory b) internal pure returns (Balance memory) { return Balance({ token: b.token, balance: b.balance }); } function addBalance( Balance[] memory b, address token, uint256 amount ) internal pure { b[getIndex(b, token)].balance += amount; } function subBalance( Balance[] memory b, address token, uint256 amount ) internal pure { b[getIndex(b, token)].balance -= amount; } function getBalance(Balance[] memory b, address token) internal pure returns (uint256 amount) { return b[getIndex(b, token)].balance; } function setBalance( Balance[] memory b, address token, uint256 amount ) internal pure { b[getIndex(b, token)].balance = amount; } function getIndex(Balance[] memory b, address token) internal pure returns (uint256 index) { for (uint256 i; i < b.length; ) { if (b[i].token == token) { return i; } unchecked { ++i; } } revert UnknownToken(token); } function copy(Balance[] memory b, uint256 len) internal pure returns (Balance[] memory res) { res = new Balance[](len); for (uint256 i; i < len; ) { res[i] = copyBalance(b[i]); unchecked { ++i; } } } function clone(Balance[] memory b) internal pure returns (Balance[] memory) { return copy(b, b.length); } function getModifiedAfterSwap( Balance[] memory b, address tokenFrom, uint256 amountFrom, address tokenTo, uint256 amountTo ) internal pure returns (Balance[] memory res) { res = copy(b, b.length); setBalance(res, tokenFrom, getBalance(b, tokenFrom) - amountFrom); setBalance(res, tokenTo, getBalance(b, tokenTo) + amountTo); } }
// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.10; /// @title Errors library library Errors { // // COMMON // string public constant ZERO_ADDRESS_IS_NOT_ALLOWED = "Z0"; string public constant NOT_IMPLEMENTED = "NI"; string public constant INCORRECT_PATH_LENGTH = "PL"; string public constant INCORRECT_ARRAY_LENGTH = "CR"; string public constant REGISTERED_CREDIT_ACCOUNT_MANAGERS_ONLY = "CP"; string public constant REGISTERED_POOLS_ONLY = "RP"; string public constant INCORRECT_PARAMETER = "IP"; // // MATH // string public constant MATH_MULTIPLICATION_OVERFLOW = "M1"; string public constant MATH_ADDITION_OVERFLOW = "M2"; string public constant MATH_DIVISION_BY_ZERO = "M3"; // // POOL // string public constant POOL_CONNECTED_CREDIT_MANAGERS_ONLY = "PS0"; string public constant POOL_INCOMPATIBLE_CREDIT_ACCOUNT_MANAGER = "PS1"; string public constant POOL_MORE_THAN_EXPECTED_LIQUIDITY_LIMIT = "PS2"; string public constant POOL_INCORRECT_WITHDRAW_FEE = "PS3"; string public constant POOL_CANT_ADD_CREDIT_MANAGER_TWICE = "PS4"; // // ACCOUNT FACTORY // string public constant AF_CANT_CLOSE_CREDIT_ACCOUNT_IN_THE_SAME_BLOCK = "AF1"; string public constant AF_MINING_IS_FINISHED = "AF2"; string public constant AF_CREDIT_ACCOUNT_NOT_IN_STOCK = "AF3"; string public constant AF_EXTERNAL_ACCOUNTS_ARE_FORBIDDEN = "AF4"; // // ADDRESS PROVIDER // string public constant AS_ADDRESS_NOT_FOUND = "AP1"; // // CONTRACTS REGISTER // string public constant CR_POOL_ALREADY_ADDED = "CR1"; string public constant CR_CREDIT_MANAGER_ALREADY_ADDED = "CR2"; // // CREDIT ACCOUNT // string public constant CA_CONNECTED_CREDIT_MANAGER_ONLY = "CA1"; string public constant CA_FACTORY_ONLY = "CA2"; // // ACL // string public constant ACL_CALLER_NOT_PAUSABLE_ADMIN = "ACL1"; string public constant ACL_CALLER_NOT_CONFIGURATOR = "ACL2"; // // WETH GATEWAY // string public constant WG_DESTINATION_IS_NOT_WETH_COMPATIBLE = "WG1"; string public constant WG_RECEIVE_IS_NOT_ALLOWED = "WG2"; string public constant WG_NOT_ENOUGH_FUNDS = "WG3"; // // TOKEN DISTRIBUTOR // string public constant TD_WALLET_IS_ALREADY_CONNECTED_TO_VC = "TD1"; string public constant TD_INCORRECT_WEIGHTS = "TD2"; string public constant TD_NON_ZERO_BALANCE_AFTER_DISTRIBUTION = "TD3"; string public constant TD_CONTRIBUTOR_IS_NOT_REGISTERED = "TD4"; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; struct MultiCall { address target; bytes callData; } library MultiCallOps { function copyMulticall(MultiCall memory call) internal pure returns (MultiCall memory) { return MultiCall({ target: call.target, callData: call.callData }); } function trim(MultiCall[] memory calls) internal pure returns (MultiCall[] memory trimmed) { uint256 len = calls.length; if (len == 0) return calls; uint256 foundLen; while (calls[foundLen].target != address(0)) { unchecked { ++foundLen; if (foundLen == len) return calls; } } if (foundLen > 0) return copy(calls, foundLen); } function copy(MultiCall[] memory calls, uint256 len) internal pure returns (MultiCall[] memory res) { res = new MultiCall[](len); for (uint256 i; i < len; ) { res[i] = copyMulticall(calls[i]); unchecked { ++i; } } } function clone(MultiCall[] memory calls) internal pure returns (MultiCall[] memory res) { return copy(calls, calls.length); } function append(MultiCall[] memory calls, MultiCall memory newCall) internal pure returns (MultiCall[] memory res) { uint256 len = calls.length; res = new MultiCall[](len + 1); for (uint256 i; i < len; ) { res[i] = copyMulticall(calls[i]); unchecked { ++i; } } res[len] = copyMulticall(newCall); } function prepend(MultiCall[] memory calls, MultiCall memory newCall) internal pure returns (MultiCall[] memory res) { uint256 len = calls.length; res = new MultiCall[](len + 1); res[0] = copyMulticall(newCall); for (uint256 i = 1; i < len + 1; ) { res[i] = copyMulticall(calls[i]); unchecked { ++i; } } } function concat(MultiCall[] memory calls1, MultiCall[] memory calls2) internal pure returns (MultiCall[] memory res) { uint256 len1 = calls1.length; uint256 lenTotal = len1 + calls2.length; if (lenTotal == calls1.length) return clone(calls1); if (lenTotal == calls2.length) return clone(calls2); res = new MultiCall[](lenTotal); for (uint256 i; i < lenTotal; ) { res[i] = (i < len1) ? copyMulticall(calls1[i]) : copyMulticall(calls2[i - len1]); unchecked { ++i; } } } }
// 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 anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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 * ==== * * [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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (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); } } }
// 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; } }
{ "optimizer": { "enabled": true, "runs": 2000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_addressProvider","type":"address"},{"internalType":"address","name":"_usdc","type":"address"},{"internalType":"address","name":"_usdt","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CallerNotConfiguratorException","type":"error"},{"inputs":[],"name":"CallerNotPausableAdminException","type":"error"},{"inputs":[],"name":"CallerNotUnPausableAdminException","type":"error"},{"inputs":[],"name":"CreditFacadeNonBlacklistable","type":"error"},{"inputs":[],"name":"CreditFacadeOnlyException","type":"error"},{"inputs":[],"name":"NothingToClaimException","type":"error"},{"inputs":[],"name":"ZeroAddressException","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"underlying","type":"address"},{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimableAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"underlying","type":"address"},{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creditFacade","type":"address"}],"name":"CreditFacadeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creditFacade","type":"address"}],"name":"CreditFacadeRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"_acl","outputs":[{"internalType":"contract IACL","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addClaimable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_creditFacade","type":"address"}],"name":"addCreditFacade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"isBlacklisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isSupportedCreditFacade","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_creditFacade","type":"address"}],"name":"removeCreditFacade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b506040516200124338038062001243833981016040819052620000349162000109565b6000805460ff19169055826001600160a01b0381166200006757604051635919af9760e11b815260040160405180910390fd5b806001600160a01b031663087376956040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000a6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000cc919062000153565b6001600160a01b0390811660805292831660a052501660c0525062000178565b80516001600160a01b03811681146200010457600080fd5b919050565b6000806000606084860312156200011f57600080fd5b6200012a84620000ec565b92506200013a60208501620000ec565b91506200014a60408501620000ec565b90509250925092565b6000602082840312156200016657600080fd5b6200017182620000ec565b9392505050565b60805160a05160c051611063620001e06000396000818161010901528181610518015261058701526000818161014d0152818161043401526104a30152600081816102250152818161037d015281816105ee015281816107ac015261088b01526110636000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063576cd2d11161008c57806389406ff51161006657806389406ff5146101fa5780639e3896101461020d578063a50cf2c814610220578063d4570c1c1461024757600080fd5b8063576cd2d1146101c45780635c975abb146101e75780638456cb59146101f257600080fd5b80633f4ba83a116100c85780633f4ba83a1461016f5780634028eddc146101775780634610f6ac1461019a57806354fd4d50146101ad57600080fd5b806321c0b342146100ef5780632f48ab7d146101045780633e413bee14610148575b600080fd5b6101026100fd366004610eaf565b610272565b005b61012b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61012b7f000000000000000000000000000000000000000000000000000000000000000081565b61010261034f565b61018a610185366004610eaf565b610430565b604051901515815260200161013f565b6101026101a8366004610ee2565b6105c0565b6101b661012c81565b60405190815260200161013f565b61018a6101d2366004610ee2565b60016020526000908152604090205460ff1681565b60005460ff1661018a565b61010261077e565b610102610208366004610ee2565b61085d565b61010261021b366004610f04565b61097d565b61012b7f000000000000000000000000000000000000000000000000000000000000000081565b6101b6610255366004610eaf565b600260209081526000928352604080842090915290825290205481565b6001600160a01b038216600090815260026020908152604080832033845290915290205460018110156102d1576040517f45326b6d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383166000818152600260209081526040808320338452909152812055610300908383610a49565b604080516001600160a01b038481168252602082018490523392908616917f913c992353dc81b7a8ba31496c484e9b6306bd2f6c509a649a38fdf5e1c953b291015b60405180910390a3505050565b6040517fd4eb5db00000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d4eb5db090602401602060405180830381865afa1580156103cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f09190610f40565b610426576040517f10332dee00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61042e610ace565b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031603610516576040517ffe575a870000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063fe575a87906024015b602060405180830381865afa1580156104eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050f9190610f40565b90506105ba565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036105b6576040517fe47d60600000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063e47d6060906024016104ce565b5060005b92915050565b6040517f5f259aba0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635f259aba90602401602060405180830381865afa15801561063d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106619190610f40565b610697576040517f61081c1500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b031663e1d49d7d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f99190610f40565b61072f576040517f28cfda1b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517fbd5b26ef7954344752b759707e6bcd78451ef30ebacaf751abec2ede07b8e24f9190a250565b6040517f3a41ec640000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690633a41ec6490602401602060405180830381865afa1580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f9190610f40565b610855576040517fd794b1e700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61042e610b20565b6040517f5f259aba0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635f259aba90602401602060405180830381865afa1580156108da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fe9190610f40565b610934576040517f61081c1500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055517f794e243b3141951917f506b06ff4d020392f585dc4a81a052fde47ff96d438de9190a250565b3360009081526001602052604090205460ff166109c6576040517fd8026b2200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038084166000908152600260209081526040808320938616835292905290812080548392906109fd908490610f62565b92505081905550816001600160a01b0316836001600160a01b03167fbc75c7cef9767751e0c642bcefb2d29f7cfd455959c2323505bc3d3c5b70fafd8360405161034291815260200190565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610ac9908490610b5d565b505050565b610ad6610c47565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b610b28610c99565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610b033390565b6000610bb2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610cec9092919063ffffffff16565b805190915015610ac95780806020019051810190610bd09190610f40565b610ac95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60005460ff1661042e5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610c3e565b60005460ff161561042e5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610c3e565b6060610cfb8484600085610d03565b949350505050565b606082471015610d7b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610c3e565b600080866001600160a01b03168587604051610d979190610fc0565b60006040518083038185875af1925050503d8060008114610dd4576040519150601f19603f3d011682016040523d82523d6000602084013e610dd9565b606091505b5091509150610dea87838387610df5565b979650505050505050565b60608315610e64578251600003610e5d576001600160a01b0385163b610e5d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c3e565b5081610cfb565b610cfb8383815115610e795781518083602001fd5b8060405162461bcd60e51b8152600401610c3e9190610fdc565b80356001600160a01b0381168114610eaa57600080fd5b919050565b60008060408385031215610ec257600080fd5b610ecb83610e93565b9150610ed960208401610e93565b90509250929050565b600060208284031215610ef457600080fd5b610efd82610e93565b9392505050565b600080600060608486031215610f1957600080fd5b610f2284610e93565b9250610f3060208501610e93565b9150604084013590509250925092565b600060208284031215610f5257600080fd5b81518015158114610efd57600080fd5b808201808211156105ba577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60005b83811015610fb7578181015183820152602001610f9f565b50506000910152565b60008251610fd2818460208701610f9c565b9190910192915050565b6020815260008251806020840152610ffb816040850160208701610f9c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea26469706673582212202f09d1fe978efd2696aefbda0b3c71fe2f1010965b8bd3287336c955b93adff264736f6c63430008110033000000000000000000000000cf64698aff7e5f27a11dff868af228653ba53be0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063576cd2d11161008c57806389406ff51161006657806389406ff5146101fa5780639e3896101461020d578063a50cf2c814610220578063d4570c1c1461024757600080fd5b8063576cd2d1146101c45780635c975abb146101e75780638456cb59146101f257600080fd5b80633f4ba83a116100c85780633f4ba83a1461016f5780634028eddc146101775780634610f6ac1461019a57806354fd4d50146101ad57600080fd5b806321c0b342146100ef5780632f48ab7d146101045780633e413bee14610148575b600080fd5b6101026100fd366004610eaf565b610272565b005b61012b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b6040516001600160a01b0390911681526020015b60405180910390f35b61012b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b61010261034f565b61018a610185366004610eaf565b610430565b604051901515815260200161013f565b6101026101a8366004610ee2565b6105c0565b6101b661012c81565b60405190815260200161013f565b61018a6101d2366004610ee2565b60016020526000908152604090205460ff1681565b60005460ff1661018a565b61010261077e565b610102610208366004610ee2565b61085d565b61010261021b366004610f04565b61097d565b61012b7f000000000000000000000000523da3a8961e4dd4f6206dbf7e6c749f51796bb381565b6101b6610255366004610eaf565b600260209081526000928352604080842090915290825290205481565b6001600160a01b038216600090815260026020908152604080832033845290915290205460018110156102d1576040517f45326b6d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383166000818152600260209081526040808320338452909152812055610300908383610a49565b604080516001600160a01b038481168252602082018490523392908616917f913c992353dc81b7a8ba31496c484e9b6306bd2f6c509a649a38fdf5e1c953b291015b60405180910390a3505050565b6040517fd4eb5db00000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000523da3a8961e4dd4f6206dbf7e6c749f51796bb36001600160a01b03169063d4eb5db090602401602060405180830381865afa1580156103cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f09190610f40565b610426576040517f10332dee00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61042e610ace565b565b60007f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316836001600160a01b031603610516576040517ffe575a870000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301527f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48169063fe575a87906024015b602060405180830381865afa1580156104eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050f9190610f40565b90506105ba565b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b0316836001600160a01b0316036105b6576040517fe47d60600000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301527f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7169063e47d6060906024016104ce565b5060005b92915050565b6040517f5f259aba0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000523da3a8961e4dd4f6206dbf7e6c749f51796bb36001600160a01b031690635f259aba90602401602060405180830381865afa15801561063d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106619190610f40565b610697576040517f61081c1500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b031663e1d49d7d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f99190610f40565b61072f576040517f28cfda1b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517fbd5b26ef7954344752b759707e6bcd78451ef30ebacaf751abec2ede07b8e24f9190a250565b6040517f3a41ec640000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000523da3a8961e4dd4f6206dbf7e6c749f51796bb36001600160a01b031690633a41ec6490602401602060405180830381865afa1580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f9190610f40565b610855576040517fd794b1e700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61042e610b20565b6040517f5f259aba0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000523da3a8961e4dd4f6206dbf7e6c749f51796bb36001600160a01b031690635f259aba90602401602060405180830381865afa1580156108da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fe9190610f40565b610934576040517f61081c1500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055517f794e243b3141951917f506b06ff4d020392f585dc4a81a052fde47ff96d438de9190a250565b3360009081526001602052604090205460ff166109c6576040517fd8026b2200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038084166000908152600260209081526040808320938616835292905290812080548392906109fd908490610f62565b92505081905550816001600160a01b0316836001600160a01b03167fbc75c7cef9767751e0c642bcefb2d29f7cfd455959c2323505bc3d3c5b70fafd8360405161034291815260200190565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610ac9908490610b5d565b505050565b610ad6610c47565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b610b28610c99565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610b033390565b6000610bb2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610cec9092919063ffffffff16565b805190915015610ac95780806020019051810190610bd09190610f40565b610ac95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60005460ff1661042e5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610c3e565b60005460ff161561042e5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610c3e565b6060610cfb8484600085610d03565b949350505050565b606082471015610d7b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610c3e565b600080866001600160a01b03168587604051610d979190610fc0565b60006040518083038185875af1925050503d8060008114610dd4576040519150601f19603f3d011682016040523d82523d6000602084013e610dd9565b606091505b5091509150610dea87838387610df5565b979650505050505050565b60608315610e64578251600003610e5d576001600160a01b0385163b610e5d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c3e565b5081610cfb565b610cfb8383815115610e795781518083602001fd5b8060405162461bcd60e51b8152600401610c3e9190610fdc565b80356001600160a01b0381168114610eaa57600080fd5b919050565b60008060408385031215610ec257600080fd5b610ecb83610e93565b9150610ed960208401610e93565b90509250929050565b600060208284031215610ef457600080fd5b610efd82610e93565b9392505050565b600080600060608486031215610f1957600080fd5b610f2284610e93565b9250610f3060208501610e93565b9150604084013590509250925092565b600060208284031215610f5257600080fd5b81518015158114610efd57600080fd5b808201808211156105ba577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60005b83811015610fb7578181015183820152602001610f9f565b50506000910152565b60008251610fd2818460208701610f9c565b9190910192915050565b6020815260008251806020840152610ffb816040850160208701610f9c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea26469706673582212202f09d1fe978efd2696aefbda0b3c71fe2f1010965b8bd3287336c955b93adff264736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000cf64698aff7e5f27a11dff868af228653ba53be0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
-----Decoded View---------------
Arg [0] : _addressProvider (address): 0xcF64698AFF7E5f27A11dff868AF228653ba53be0
Arg [1] : _usdc (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [2] : _usdt (address): 0xdAC17F958D2ee523a2206206994597C13D831ec7
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000cf64698aff7e5f27a11dff868af228653ba53be0
Arg [1] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [2] : 000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.
[ 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.