Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
LoopingUtil
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 50 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.28;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { ILoopingUtil } from "../../../interfaces/positions/ILoopingUtil.sol";
import { PermissionDenied } from "../../../utils/Helpers.sol";
import { LoopingUtilStorage } from "../../../libraries/LoopingUtilStorage.sol";
contract LoopingUtil is Initializable, OwnableUpgradeable, ILoopingUtil {
using LoopingUtilStorage for LoopingUtilStorage.Layout;
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
modifier onlySender(address user) {
if (_msgSender() != user) revert PermissionDenied();
_;
}
function initialize(address _owner, address loopingStrategy) external initializer {
__Ownable_init(_owner);
LoopingUtilStorage.layout().spectraLoopingStrategy = loopingStrategy;
}
function assertWeightsCreated(address user) external view {
if (LoopingUtilStorage.layout().userWeightInfoMapping[user].loop != 0) {
revert ILoopingUtil.WeightsAlreadyCreated();
}
}
function getTVLInfo() external view returns (ILoopingUtil.TVLInfo memory) {
LoopingUtilStorage.Layout storage s = LoopingUtilStorage.layout();
TVLInfo memory tvlInfo = s.strategyTVLInfo;
return tvlInfo;
}
function getStageInfo(address user, uint64 stage) external view returns (ILoopingUtil.StageInfo memory) {
LoopingUtilStorage.Layout storage s = LoopingUtilStorage.layout();
ILoopingUtil.WeightInfo storage info = s.userWeightInfoMapping[user];
if (info.loop <= stage) revert ILoopingUtil.LoopLimitExceeded();
ILoopingUtil.StageInfo memory stageInfo;
stageInfo.borrowWeight = info.borrowWeights[stage];
stageInfo.collateralWeight = info.collateralWeights[stage];
stageInfo.totalBorrowWeight = info.totalBorrowWeight;
stageInfo.totalCollateralWeight = info.totalCollateralWeight;
stageInfo.stage = stage;
stageInfo.loop = info.loop;
return stageInfo;
}
function pushWeightInfo(address user, uint256 borrowWeight, uint256 collateralWeight) external onlySender(user) {
if (collateralWeight == 0) revert ILoopingUtil.ZeroValueError();
LoopingUtilStorage.Layout storage s = LoopingUtilStorage.layout();
ILoopingUtil.WeightInfo storage info = s.userWeightInfoMapping[user];
uint256 index = info.loop;
info.loop += 1;
if (borrowWeight != 0) {
info.borrowWeights[index] = borrowWeight;
}
info.collateralWeights[index] = collateralWeight;
info.totalBorrowWeight += borrowWeight;
info.totalCollateralWeight += collateralWeight;
emit WeightAdded(
user, info.loop, borrowWeight, collateralWeight, info.totalBorrowWeight, info.totalCollateralWeight
);
}
function onDeposit(uint256 collateralAdded, uint256 amountBorrowed) external {
LoopingUtilStorage.Layout storage s = LoopingUtilStorage.layout();
s.strategyTVLInfo.totalCollateralAdded += collateralAdded;
s.strategyTVLInfo.totalBorrowAdded += amountBorrowed;
}
function onWithdraw(uint256 collateralPulledOut, uint256 amountRepaid) external {
LoopingUtilStorage.Layout storage s = LoopingUtilStorage.layout();
s.strategyTVLInfo.totalCollateralRemoved += collateralPulledOut;
s.strategyTVLInfo.totalBorrowRemoved += amountRepaid;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @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 proxied contracts do not make use of 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.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* 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 {ERC1967Proxy-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.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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.
*
* The initial owner is set to the address provided by the deployer. 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 OwnableUpgradeable is Initializable, ContextUpgradeable {
/// @custom:storage-location erc7201:openzeppelin.storage.Ownable
struct OwnableStorage {
address _owner;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;
function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
assembly {
$.slot := OwnableStorageLocation
}
}
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
function __Ownable_init(address initialOwner) internal onlyInitializing {
__Ownable_init_unchained(initialOwner);
}
function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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) {
OwnableStorage storage $ = _getOwnableStorage();
return $._owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
OwnableStorage storage $ = _getOwnableStorage();
address oldOwner = $._owner;
$._owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.28;
interface ILoopingUtil {
error WeightsAlreadyCreated();
error LoopLimitExceeded();
error ZeroValueError();
event WeightAdded(
address user,
uint64 stage,
uint256 borrowWeight,
uint256 collateralWeight,
uint256 totalBorrowWeight,
uint256 totalCollateralWeight
);
struct WeightInfo {
uint256[10] borrowWeights; // weight of borrow at each step
uint256[10] collateralWeights; // weight of collateral at each step
uint256 totalBorrowWeight; // aggregated at time of deposit and withdrawal
uint256 totalCollateralWeight; // aggregated at time of deposit and withdrawal
uint64 loop; // total loops made
}
struct TVLInfo {
uint256 totalCollateralAdded;
uint256 totalCollateralRemoved;
uint256 totalBorrowAdded;
uint256 totalBorrowRemoved;
}
struct StageInfo {
uint256 borrowWeight;
uint256 collateralWeight;
uint256 totalBorrowWeight;
uint256 totalCollateralWeight;
uint64 stage;
uint64 loop;
}
function assertWeightsCreated(address user) external view;
function getTVLInfo() external view returns (ILoopingUtil.TVLInfo memory);
function getStageInfo(address user, uint64 stage) external view returns (ILoopingUtil.StageInfo memory);
function pushWeightInfo(address user, uint256 borrowWeight, uint256 collateralWeight) external;
function onDeposit(uint256 collateralAdded, uint256 amountBorrowed) external;
function onWithdraw(uint256 collateralPulledOut, uint256 amountRepaid) external;
}// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.28; // common errors error IncorrectTypeID(uint256 _typeId, address _sender); error NegativePriceError(); error PriceStaleError(); error CallFailed(); error NotDepositContract(address _address); error NotExecutor(address _address); error NotStrategyContract(address _address); error IncorrectTokenAddress(address _tokenAddress); error IncorrectValue(); error IncorrectMessageAddress(address _sender); error ZeroAddress(); error ZeroAmount(); error ZeroValue(); error MinimumDustAmountError(); error NonPayableFunction(); error DivideByZeroError(); error PermissionDenied(); error InvalidLendingThreshold(); error NotImplemented(); // common events //deposit events //deposit
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.24;
import { ILoopingUtil } from "../interfaces/positions/ILoopingUtil.sol";
library LoopingUtilStorage {
bytes32 internal constant STORAGE_SLOT = keccak256("looping.util.storage");
struct Layout {
address spectraLoopingStrategy;
mapping(address => ILoopingUtil.WeightInfo) userWeightInfoMapping;
ILoopingUtil.TVLInfo strategyTVLInfo;
}
function layout() internal pure returns (Layout storage s) {
bytes32 slot = STORAGE_SLOT;
assembly {
s.slot := slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@spectra-core/src/=lib/spectra-core/src/",
"@pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidity/",
"hardhat/=node_modules/hardhat/",
"@morpho-blue/=lib/morpho-blue/",
"ds-test/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"morpho-blue/=lib/morpho-blue/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"openzeppelin-erc20-basic/=lib/spectra-core/lib/openzeppelin-contracts/contracts/token/ERC20/",
"openzeppelin-erc20-extensions/=lib/spectra-core/lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/",
"openzeppelin-erc20/=lib/spectra-core/lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/",
"openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
"openzeppelin-math/=lib/spectra-core/lib/openzeppelin-contracts/contracts/utils/math/",
"openzeppelin-proxy/=lib/spectra-core/lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/",
"openzeppelin-utils/=lib/spectra-core/lib/openzeppelin-contracts/contracts/utils/",
"solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
"spectra-core/=lib/spectra-core/",
"v3-core/=lib/v3-core/"
],
"optimizer": {
"enabled": true,
"runs": 50
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"LoopLimitExceeded","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"PermissionDenied","type":"error"},{"inputs":[],"name":"WeightsAlreadyCreated","type":"error"},{"inputs":[],"name":"ZeroValueError","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint64","name":"stage","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"borrowWeight","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collateralWeight","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrowWeight","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalCollateralWeight","type":"uint256"}],"name":"WeightAdded","type":"event"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"assertWeightsCreated","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint64","name":"stage","type":"uint64"}],"name":"getStageInfo","outputs":[{"components":[{"internalType":"uint256","name":"borrowWeight","type":"uint256"},{"internalType":"uint256","name":"collateralWeight","type":"uint256"},{"internalType":"uint256","name":"totalBorrowWeight","type":"uint256"},{"internalType":"uint256","name":"totalCollateralWeight","type":"uint256"},{"internalType":"uint64","name":"stage","type":"uint64"},{"internalType":"uint64","name":"loop","type":"uint64"}],"internalType":"struct ILoopingUtil.StageInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTVLInfo","outputs":[{"components":[{"internalType":"uint256","name":"totalCollateralAdded","type":"uint256"},{"internalType":"uint256","name":"totalCollateralRemoved","type":"uint256"},{"internalType":"uint256","name":"totalBorrowAdded","type":"uint256"},{"internalType":"uint256","name":"totalBorrowRemoved","type":"uint256"}],"internalType":"struct ILoopingUtil.TVLInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"loopingStrategy","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collateralAdded","type":"uint256"},{"internalType":"uint256","name":"amountBorrowed","type":"uint256"}],"name":"onDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collateralPulledOut","type":"uint256"},{"internalType":"uint256","name":"amountRepaid","type":"uint256"}],"name":"onWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"borrowWeight","type":"uint256"},{"internalType":"uint256","name":"collateralWeight","type":"uint256"}],"name":"pushWeightInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6080604052348015600e575f5ffd5b5060156019565b60c9565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff161560685760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b039081161460c65780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b610a4a806100d65f395ff3fe608060405234801561000f575f5ffd5b506004361061008b575f3560e01c8062af98631461008f57806303004b47146100a45780632bb1f5f2146100b7578063485cc955146101305780634b9943e1146101435780635f665f981461017e578063715018a6146101915780638da5cb5b14610199578063bef26de0146101ae578063f2fde38b146101c1575b5f5ffd5b6100a261009d3660046108c5565b6101d4565b005b6100a26100b23660046108f5565b61036d565b6100ca6100c5366004610915565b6103b2565b60405161012791905f60c082019050825182526020830151602083015260408301516040830152606083015160608301526001600160401b0360808401511660808301526001600160401b0360a08401511660a083015292915050565b60405180910390f35b6100a261013e366004610955565b610499565b61014b6105b4565b60405161012791908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b6100a261018c366004610986565b61061c565b6100a261066d565b6101a1610680565b60405161012791906109a6565b6100a26101bc3660046108f5565b61069a565b6100a26101cf366004610986565b6106d6565b82336001600160a01b038216146101fe57604051630782484160e21b815260040160405180910390fd5b815f0361021e576040516308927dbf60e01b815260040160405180910390fd5b5f610227610719565b6001600160a01b0386165f90815260018083016020526040822060168101805494955090936001600160401b03169261026083856109ce565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550855f146102a157858282600a811061029e5761029e6109ed565b01555b8482600a0182600a81106102b7576102b76109ed565b018190555085826014015f8282546102cf9190610a01565b9250508190555084826015015f8282546102e99190610a01565b9091555050601682015460148301546015840154604080516001600160a01b038c1681526001600160401b039094166020850152830189905260608301889052608083019190915260a08201527fab1c5d10c64f3509a3930e39b533c4c57964101f95426d45b6c65acdf727f5699060c0015b60405180910390a150505050505050565b5f610376610719565b905082816002015f015f82825461038d9190610a01565b90915550506004810180548391905f906103a8908490610a01565b9091555050505050565b6103ba610868565b5f6103c3610719565b6001600160a01b0385165f90815260018201602052604090206016810154919250906001600160401b0380861691161161041057604051631a56cc6760e11b815260040160405180910390fd5b610418610868565b816001600160401b038616600a8110610433576104336109ed565b01548152600a808301906001600160401b038716908110610456576104566109ed565b0154602082015260148201546040820152601582015460608201526001600160401b03808616608083015260169092015490911660a08201529150505b92915050565b5f6104a261073d565b805490915060ff600160401b82041615906001600160401b03165f811580156104c85750825b90505f826001600160401b031660011480156104e35750303b155b9050811580156104f1575080155b1561050f5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561053957845460ff60401b1916600160401b1785555b61054287610761565b8561054b610719565b80546001600160a01b0319166001600160a01b039290921691909117905583156105ab57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200161035c565b50505050505050565b6105db60405180608001604052805f81526020015f81526020015f81526020015f81525090565b5f6105e4610719565b604080516080810182526002830154815260038301546020820152600483015491810191909152600590910154606082015292915050565b610624610719565b6001600160a01b0382165f90815260019190910160205260409020601601546001600160401b03161561066a57604051631c55fe1960e11b815260040160405180910390fd5b50565b610675610772565b61067e5f6107a4565b565b5f5f61068a6107fe565b546001600160a01b031692915050565b5f6106a3610719565b905082816002016001015f8282546106bb9190610a01565b90915550506005810180548391905f906103a8908490610a01565b6106de610772565b6001600160a01b038116610710575f604051631e4fbdf760e01b815260040161070791906109a6565b60405180910390fd5b61066a816107a4565b7fcd84e7899ddf0fe77bdd9b9f4439d35702884301b7ab1c27f179599a7deb0b9c90565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090565b610769610822565b61066a81610847565b3361077b610680565b6001600160a01b03161461067e573360405163118cdaa760e01b815260040161070791906109a6565b5f6107ad6107fe565b80546001600160a01b038481166001600160a01b031983168117845560405193945091169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930090565b61082a61084f565b61067e57604051631afcd79f60e31b815260040160405180910390fd5b6106de610822565b5f61085861073d565b54600160401b900460ff16919050565b6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f6001600160401b031681526020015f6001600160401b031681525090565b80356001600160a01b03811681146108c0575f5ffd5b919050565b5f5f5f606084860312156108d7575f5ffd5b6108e0846108aa565b95602085013595506040909401359392505050565b5f5f60408385031215610906575f5ffd5b50508035926020909101359150565b5f5f60408385031215610926575f5ffd5b61092f836108aa565b915060208301356001600160401b038116811461094a575f5ffd5b809150509250929050565b5f5f60408385031215610966575f5ffd5b61096f836108aa565b915061097d602084016108aa565b90509250929050565b5f60208284031215610996575f5ffd5b61099f826108aa565b9392505050565b6001600160a01b0391909116815260200190565b634e487b7160e01b5f52601160045260245ffd5b6001600160401b038181168382160190811115610493576104936109ba565b634e487b7160e01b5f52603260045260245ffd5b80820180821115610493576104936109ba56fea2646970667358221220b982f81641793cf01dbcb14caba9090f74c436902500e2a319f0a8c34d3a833364736f6c634300081c0033
Deployed Bytecode
0x608060405234801561000f575f5ffd5b506004361061008b575f3560e01c8062af98631461008f57806303004b47146100a45780632bb1f5f2146100b7578063485cc955146101305780634b9943e1146101435780635f665f981461017e578063715018a6146101915780638da5cb5b14610199578063bef26de0146101ae578063f2fde38b146101c1575b5f5ffd5b6100a261009d3660046108c5565b6101d4565b005b6100a26100b23660046108f5565b61036d565b6100ca6100c5366004610915565b6103b2565b60405161012791905f60c082019050825182526020830151602083015260408301516040830152606083015160608301526001600160401b0360808401511660808301526001600160401b0360a08401511660a083015292915050565b60405180910390f35b6100a261013e366004610955565b610499565b61014b6105b4565b60405161012791908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b6100a261018c366004610986565b61061c565b6100a261066d565b6101a1610680565b60405161012791906109a6565b6100a26101bc3660046108f5565b61069a565b6100a26101cf366004610986565b6106d6565b82336001600160a01b038216146101fe57604051630782484160e21b815260040160405180910390fd5b815f0361021e576040516308927dbf60e01b815260040160405180910390fd5b5f610227610719565b6001600160a01b0386165f90815260018083016020526040822060168101805494955090936001600160401b03169261026083856109ce565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550855f146102a157858282600a811061029e5761029e6109ed565b01555b8482600a0182600a81106102b7576102b76109ed565b018190555085826014015f8282546102cf9190610a01565b9250508190555084826015015f8282546102e99190610a01565b9091555050601682015460148301546015840154604080516001600160a01b038c1681526001600160401b039094166020850152830189905260608301889052608083019190915260a08201527fab1c5d10c64f3509a3930e39b533c4c57964101f95426d45b6c65acdf727f5699060c0015b60405180910390a150505050505050565b5f610376610719565b905082816002015f015f82825461038d9190610a01565b90915550506004810180548391905f906103a8908490610a01565b9091555050505050565b6103ba610868565b5f6103c3610719565b6001600160a01b0385165f90815260018201602052604090206016810154919250906001600160401b0380861691161161041057604051631a56cc6760e11b815260040160405180910390fd5b610418610868565b816001600160401b038616600a8110610433576104336109ed565b01548152600a808301906001600160401b038716908110610456576104566109ed565b0154602082015260148201546040820152601582015460608201526001600160401b03808616608083015260169092015490911660a08201529150505b92915050565b5f6104a261073d565b805490915060ff600160401b82041615906001600160401b03165f811580156104c85750825b90505f826001600160401b031660011480156104e35750303b155b9050811580156104f1575080155b1561050f5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561053957845460ff60401b1916600160401b1785555b61054287610761565b8561054b610719565b80546001600160a01b0319166001600160a01b039290921691909117905583156105ab57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200161035c565b50505050505050565b6105db60405180608001604052805f81526020015f81526020015f81526020015f81525090565b5f6105e4610719565b604080516080810182526002830154815260038301546020820152600483015491810191909152600590910154606082015292915050565b610624610719565b6001600160a01b0382165f90815260019190910160205260409020601601546001600160401b03161561066a57604051631c55fe1960e11b815260040160405180910390fd5b50565b610675610772565b61067e5f6107a4565b565b5f5f61068a6107fe565b546001600160a01b031692915050565b5f6106a3610719565b905082816002016001015f8282546106bb9190610a01565b90915550506005810180548391905f906103a8908490610a01565b6106de610772565b6001600160a01b038116610710575f604051631e4fbdf760e01b815260040161070791906109a6565b60405180910390fd5b61066a816107a4565b7fcd84e7899ddf0fe77bdd9b9f4439d35702884301b7ab1c27f179599a7deb0b9c90565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090565b610769610822565b61066a81610847565b3361077b610680565b6001600160a01b03161461067e573360405163118cdaa760e01b815260040161070791906109a6565b5f6107ad6107fe565b80546001600160a01b038481166001600160a01b031983168117845560405193945091169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930090565b61082a61084f565b61067e57604051631afcd79f60e31b815260040160405180910390fd5b6106de610822565b5f61085861073d565b54600160401b900460ff16919050565b6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f6001600160401b031681526020015f6001600160401b031681525090565b80356001600160a01b03811681146108c0575f5ffd5b919050565b5f5f5f606084860312156108d7575f5ffd5b6108e0846108aa565b95602085013595506040909401359392505050565b5f5f60408385031215610906575f5ffd5b50508035926020909101359150565b5f5f60408385031215610926575f5ffd5b61092f836108aa565b915060208301356001600160401b038116811461094a575f5ffd5b809150509250929050565b5f5f60408385031215610966575f5ffd5b61096f836108aa565b915061097d602084016108aa565b90509250929050565b5f60208284031215610996575f5ffd5b61099f826108aa565b9392505050565b6001600160a01b0391909116815260200190565b634e487b7160e01b5f52601160045260245ffd5b6001600160401b038181168382160190811115610493576104936109ba565b634e487b7160e01b5f52603260045260245ffd5b80820180821115610493576104936109ba56fea2646970667358221220b982f81641793cf01dbcb14caba9090f74c436902500e2a319f0a8c34d3a833364736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.