Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Method | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|---|
- | 13817823 | 1392 days ago | Contract Creation | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Minimal Proxy Contract for 0x373a292b93ff9017d28e64154ef83b99d5c4e270
Contract Name:
CreditAccount
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1// Gearbox Protocol. Generalized leverage for DeFi protocols// (c) Gearbox Holdings, 2021pragma solidity ^0.7.4;import {Initializable} from "@openzeppelin/contracts/proxy/Initializable.sol";import {Address} from "@openzeppelin/contracts/utils/Address.sol";import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";import {ICreditAccount} from "../interfaces/ICreditAccount.sol";import {Constants} from "../libraries/helpers/Constants.sol";import {Errors} from "../libraries/helpers/Errors.sol";/// @title Credit Account/// @notice Implements generic credit account logic:/// - Keeps token balances/// - Stores general parameters: borrowed amount, cumulative index at open and block when it was initialized/// - Approves tokens for 3rd party contracts/// - Transfers assets/// - Execute financial orders////// More: https://dev.gearbox.fi/developers/credit/credit_accountcontract CreditAccount is ICreditAccount, Initializable {
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// solhint-disable-next-line compiler-versionpragma solidity >=0.4.24 <0.8.0;import "../utils/Address.sol";/*** @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.** TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as* possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.** CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.*/abstract contract Initializable {/*** @dev Indicates that the contract has been initialized.*/bool private _initialized;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.6.2 <0.8.0;/*** @dev Collection of functions related to the address type*/library Address {/*** @dev Returns true if `account` is a contract.** [IMPORTANT]* ====* It is unsafe to assume that an address for which this function returns* false is an externally-owned account (EOA) and not a contract.** Among others, `isContract` will return false for the following* types of addresses:** - an externally-owned account* - a contract in construction* - an address where a contract will be created* - an address where a contract lived, but was destroyed* ====*/function isContract(address account) internal view returns (bool) {
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.6.0 <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 () internal {
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.6.0 <0.8.0;/*** @dev Interface of the ERC20 standard as defined in the EIP.*/interface IERC20 {/*** @dev Returns the amount of tokens in existence.*/function totalSupply() external view returns (uint256);/*** @dev Returns the amount of tokens owned by `account`.*/function balanceOf(address account) external view returns (uint256);/*** @dev Moves `amount` tokens from the caller's account to `recipient`.** Returns a boolean value indicating whether the operation succeeded.** Emits a {Transfer} event.*/function transfer(address recipient, uint256 amount) external returns (bool);
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.6.0 <0.8.0;import "./IERC20.sol";import "../../math/SafeMath.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 SafeMath for uint256;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 {
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-2.0-or-later// Gearbox Protocol. Generalized leverage for DeFi protocols// (c) Gearbox Holdings, 2021pragma solidity ^0.7.4;/// @title Reusable Credit Account interface/// @notice Implements general credit account:/// - Keeps token balances/// - Keeps token balances/// - Stores general parameters: borrowed amount, cumulative index at open and block when it was initialized/// - Approves tokens for 3rd party contracts/// - Transfers assets/// - Execute financial orders////// More: https://dev.gearbox.fi/developers/creditManager/vanillacreditAccountinterface ICreditAccount {/// @dev Initializes clone contractfunction initialize() external;/// @dev Connects credit account to credit manager/// @param _creditManager Credit manager addressfunction connectTo(address _creditManager,uint256 _borrowedAmount,
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-2.0-or-later// Gearbox Protocol. Generalized leverage for DeFi protocols// (c) Gearbox Holdings, 2021pragma solidity ^0.7.4;import {PercentageMath} from "../math/PercentageMath.sol";library Constants {uint256 constant MAX_INT =0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;// 25% of MAX_INTuint256 constant MAX_INT_4 =0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;// REWARD FOR LEAN DEPLOYMENT MININGuint256 constant ACCOUNT_CREATION_REWARD = 1e5;uint256 constant DEPLOYMENT_COST = 1e17;// FEE = 10%uint256 constant FEE_INTEREST = 1000; // 10%// FEE + LIQUIDATION_FEE 2%uint256 constant FEE_LIQUIDATION = 200;// Liquidation premium 5%
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-2.0-or-later// Gearbox Protocol. Generalized leverage for DeFi protocols// (c) Gearbox Holdings, 2021pragma solidity ^0.7.4;/// @title Errors librarylibrary 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";
123456789101112131415161718192021222324// SPDX-License-Identifier: MITpragma solidity >=0.6.0 <0.8.0;/** @dev Provides information about the current execution context, including the* sender of the transaction and its data. While these are generally available* via msg.sender and msg.data, they should not be accessed in such a direct* manner, since when dealing with GSN meta-transactions the account sending and* paying for execution may not be the actual sender (as far as an application* is concerned).** This contract is only required for intermediate, library-like contracts.*/abstract contract Context {function _msgSender() internal view virtual returns (address payable) {return msg.sender;}function _msgData() internal view virtual returns (bytes memory) {this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691return msg.data;}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.6.0 <0.8.0;/*** @dev Wrappers over Solidity's arithmetic operations with added overflow* checks.** Arithmetic operations in Solidity wrap on overflow. This can easily result* in bugs, because programmers usually assume that an overflow raises an* error, which is the standard behavior in high level programming languages.* `SafeMath` restores this intuition by reverting the transaction when an* operation overflows.** Using this library instead of the unchecked operations eliminates an entire* class of bugs, so it's recommended to use it always.*/library SafeMath {/*** @dev Returns the addition of two unsigned integers, with an overflow flag.** _Available since v3.4._*/function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {uint256 c = a + b;if (c < a) return (false, 0);
1234567891011121314151617181920212223242526// SPDX-License-Identifier: agpl-3.0pragma solidity ^0.7.4;import {Errors} from "../helpers/Errors.sol";/*** @title PercentageMath library* @author Aave* @notice Provides functions to perform percentage calculations* @dev Percentages are defined by default with 2 decimals of precision (100.00). The precision is indicated by PERCENTAGE_FACTOR* @dev Operations are rounded half up**/library PercentageMath {uint256 constant PERCENTAGE_FACTOR = 1e4; //percentage plus two decimalsuint256 constant HALF_PERCENT = PERCENTAGE_FACTOR / 2;/*** @dev Executes a percentage multiplication* @param value The value of which the percentage needs to be calculated* @param percentage The percentage of the value to be calculated* @return The percentage of value**/function percentMul(uint256 value, uint256 percentage)internalpure
12345678910111213141516171819{"optimizer": {"enabled": false,"runs": 200},"outputSelection": {"*": {"*": ["evm.bytecode","evm.deployedBytecode","devdoc","userdoc","metadata","abi"]}},"libraries": {}}
Contract ABI
API[{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"swapContract","type":"address"}],"name":"approveToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"borrowedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"targetContract","type":"address"}],"name":"cancelAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_creditManager","type":"address"},{"internalType":"uint256","name":"_borrowedAmount","type":"uint256"},{"internalType":"uint256","name":"_cumulativeIndexAtOpen","type":"uint256"}],"name":"connectTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"creditManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cumulativeIndexAtOpen","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"destination","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"execute","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"safeTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"since","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_borrowedAmount","type":"uint256"},{"internalType":"uint256","name":"_cumulativeIndexAtOpen","type":"uint256"}],"name":"updateParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.