Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
MultiCollateralHintHelpers
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 1 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
import "../../interfaces/core/IBorrowerOperations.sol";
import "../../interfaces/core/IPositionManager.sol";
import "../../interfaces/core/ISortedPositions.sol";
import "../../interfaces/core/IFactory.sol";
import "../../dependencies/PropBase.sol";
import "../../dependencies/PropMath.sol";
contract MultiCollateralHintHelpers is PropBase {
IBorrowerOperations public immutable borrowerOperations;
constructor(address _borrowerOperationsAddress, uint256 _gasCompensation) PropBase(_gasCompensation) {
borrowerOperations = IBorrowerOperations(_borrowerOperationsAddress);
}
// --- Functions ---
/* getRedemptionHints() - Helper function for finding the right hints to pass to redeemCollateral().
*
* It simulates a redemption of `_debtAmount` to figure out where the redemption sequence will start and what state the final Position
* of the sequence will end up in.
*
* Returns three hints:
* - `firstRedemptionHint` is the address of the first Position with ICR >= MCR (i.e. the first Position that will be redeemed).
* - `partialRedemptionHintNICR` is the final nominal ICR of the last Position of the sequence after being hit by partial redemption,
* or zero in case of no partial redemption.
* - `truncatedDebtAmount` is the maximum amount that can be redeemed out of the the provided `_debtAmount`. This can be lower than
* `_debtAmount` when redeeming the full amount would leave the last Position of the redemption sequence with less net debt than the
* minimum allowed value (i.e. MIN_NET_DEBT).
*
* The number of Positions to consider for redemption can be capped by passing a non-zero value as `_maxIterations`, while passing zero
* will leave it uncapped.
*/
function getRedemptionHints(
IPositionManager positionManager,
uint256 _debtAmount,
uint256 _price,
uint256 _maxIterations
)
external
view
returns (address firstRedemptionHint, uint256 partialRedemptionHintNICR, uint256 truncatedDebtAmount)
{
ISortedPositions sortedPositionsCached = ISortedPositions(positionManager.sortedPositions());
uint256 remainingDebt = _debtAmount;
address currentPositionuser = sortedPositionsCached.getLast();
uint256 MCR = positionManager.MCR();
while (currentPositionuser != address(0) && positionManager.getCurrentICR(currentPositionuser, _price) < MCR) {
currentPositionuser = sortedPositionsCached.getPrev(currentPositionuser);
}
firstRedemptionHint = currentPositionuser;
if (_maxIterations == 0) {
_maxIterations = type(uint256).max;
}
uint256 minNetDebt = borrowerOperations.minNetDebt();
while (currentPositionuser != address(0) && remainingDebt > 0 && _maxIterations-- > 0) {
(uint256 debt, uint256 coll, , ) = positionManager.getEntireDebtAndColl(currentPositionuser);
uint256 netDebt = _getNetDebt(debt);
if (netDebt > remainingDebt) {
if (netDebt > minNetDebt) {
uint256 maxRedeemableDebt = PropMath._min(remainingDebt, netDebt - minNetDebt);
uint256 newColl = coll - ((maxRedeemableDebt * DECIMAL_PRECISION) / _price);
uint256 newDebt = netDebt - maxRedeemableDebt;
uint256 compositeDebt = _getCompositeDebt(newDebt);
partialRedemptionHintNICR = PropMath._computeNominalCR(newColl, compositeDebt);
remainingDebt = remainingDebt - maxRedeemableDebt;
}
break;
} else {
remainingDebt = remainingDebt - netDebt;
}
// Otherwise, _maxIterations-- underflows
require(_maxIterations != 0, "Hints not found");
currentPositionuser = sortedPositionsCached.getPrev(currentPositionuser);
}
truncatedDebtAmount = _debtAmount - remainingDebt;
}
/* getApproxHint() - return address of a Position that is, on average, (length / numTrials) positions away in the
sortedPositions list from the correct insert position of the Position to be inserted.
Note: The output address is worst-case O(n) positions away from the correct insert position, however, the function
is probabilistic. Input can be tuned to guarantee results to a high degree of confidence, e.g:
Submitting numTrials = k * sqrt(length), with k = 15 makes it very, very likely that the ouput address will
be <= sqrt(length) positions away from the correct insert position.
*/
function getApproxHint(
IPositionManager positionManager,
uint256 _CR,
uint256 _numTrials,
uint256 _inputRandomSeed
) external view returns (address hintAddress, uint256 diff, uint256 latestRandomSeed) {
ISortedPositions sortedPositions = ISortedPositions(positionManager.sortedPositions());
uint256 arrayLength = positionManager.getPositionOwnersCount();
if (arrayLength == 0) {
return (address(0), 0, _inputRandomSeed);
}
hintAddress = sortedPositions.getLast();
diff = PropMath._getAbsoluteDifference(_CR, positionManager.getNominalICR(hintAddress));
latestRandomSeed = _inputRandomSeed;
uint256 i = 1;
while (i < _numTrials) {
latestRandomSeed = uint256(keccak256(abi.encodePacked(latestRandomSeed)));
uint256 arrayIndex = latestRandomSeed % arrayLength;
address currentAddress = positionManager.getPositionFromPositionOwnersArray(arrayIndex);
uint256 currentNICR = positionManager.getNominalICR(currentAddress);
// check if abs(current - CR) > abs(closest - CR), and update closest if current is closer
uint256 currentDiff = PropMath._getAbsoluteDifference(currentNICR, _CR);
if (currentDiff < diff) {
diff = currentDiff;
hintAddress = currentAddress;
}
i++;
}
}
function computeNominalCR(uint256 _coll, uint256 _debt) external pure returns (uint256) {
return PropMath._computeNominalCR(_coll, _debt);
}
function computeCR(uint256 _coll, uint256 _debt, uint256 _price) external pure returns (uint256) {
return PropMath._computeCR(_coll, _debt, _price);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
import {ICore} from "./ICore.sol";
interface IBorrowerOperations {
struct Balances {
uint256[] collaterals;
uint256[] debts;
uint256[] prices;
}
event BorrowingFeePaid(address indexed borrower, uint256 amount);
event CollateralConfigured(address positionManager, address collateralToken);
event PositionCreated(address indexed _borrower, uint256 arrayIndex);
event PositionManagerRemoved(address positionManager);
event PositionUpdated(address indexed _borrower, uint256 _debt, uint256 _coll, uint256 stake, uint8 operation);
function addColl(
address positionManager,
address account,
uint256 _collateralAmount,
address _upperHint,
address _lowerHint
) external;
function adjustPosition(
address positionManager,
address account,
uint256 _maxFeePercentage,
uint256 _collDeposit,
uint256 _collWithdrawal,
uint256 _debtChange,
bool _isDebtIncrease,
address _upperHint,
address _lowerHint
) external;
function closePosition(address positionManager, address account) external;
function configureCollateral(address positionManager, address collateralToken) external;
function fetchBalances() external view returns (Balances memory balances);
function getGlobalSystemBalances() external view returns (uint256 totalPricedCollateral, uint256 totalDebt);
function getTCR() external view returns (uint256 globalTotalCollateralRatio);
function openPosition(
address positionManager,
address account,
uint256 _maxFeePercentage,
uint256 _collateralAmount,
uint256 _debtAmount,
address _upperHint,
address _lowerHint
) external;
function removePositionManager(address positionManager) external;
function repayDebt(
address positionManager,
address account,
uint256 _debtAmount,
address _upperHint,
address _lowerHint
) external;
function setDelegateApproval(address _delegate, bool _isApproved) external;
function setMinNetDebt(uint256 _minNetDebt) external;
function withdrawColl(
address positionManager,
address account,
uint256 _collWithdrawal,
address _upperHint,
address _lowerHint
) external;
function withdrawDebt(
address positionManager,
address account,
uint256 _maxFeePercentage,
uint256 _debtAmount,
address _upperHint,
address _lowerHint
) external;
function positionManagers(uint256) external view returns (address);
function checkRecoveryMode(uint256 TCR) external view returns (bool);
function DEBT_GAS_COMPENSATION() external view returns (uint256);
function DECIMAL_PRECISION() external view returns (uint256);
function PERCENT_DIVISOR() external view returns (uint256);
function CORE() external view returns (ICore);
function debtToken() external view returns (address);
function factory() external view returns (address);
function getCompositeDebt(uint256 _debt) external view returns (uint256);
function guardian() external view returns (address);
function isApprovedDelegate(address owner, address caller) external view returns (bool isApproved);
function minNetDebt() external view returns (uint256);
function owner() external view returns (address);
function positionManagersData(address) external view returns (address collateralToken, uint16 index);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC3156FlashBorrower} from "@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IFactory} from "./IFactory.sol";
interface IPositionManager {
event BaseRateUpdated(uint256 _baseRate);
event CollateralSent(address _to, uint256 _amount);
event LTermsUpdated(uint256 _L_collateral, uint256 _L_debt);
event LastFeeOpTimeUpdated(uint256 _lastFeeOpTime);
event Redemption(
address indexed _redeemer,
uint256 _attemptedDebtAmount,
uint256 _actualDebtAmount,
uint256 _collateralSent,
uint256 _collateralFee
);
event SystemSnapshotsUpdated(uint256 _totalStakesSnapshot, uint256 _totalCollateralSnapshot);
event TotalStakesUpdated(uint256 _newTotalStakes);
event PositionIndexUpdated(address _borrower, uint256 _newIndex);
event PositionSnapshotsUpdated(uint256 _L_collateral, uint256 _L_debt);
event PositionUpdated(address indexed _borrower, uint256 _debt, uint256 _coll, uint256 _stake, uint8 _operation);
function addCollateralSurplus(address borrower, uint256 collSurplus) external;
function applyPendingRewards(address _borrower) external returns (uint256 coll, uint256 debt);
function claimCollateral(address borrower, address _receiver) external;
function closePosition(address _borrower, address _receiver, uint256 collAmount, uint256 debtAmount) external;
function closePositionByLiquidation(address _borrower) external;
function setCollVaultRouter(address _collVaultRouter) external;
function collectInterests() external;
function decayBaseRateAndGetBorrowingFee(uint256 _debt) external returns (uint256);
function decreaseDebtAndSendCollateral(address account, uint256 debt, uint256 coll) external;
function fetchPrice() external view returns (uint256);
function finalizeLiquidation(
address _liquidator,
uint256 _debt,
uint256 _coll,
uint256 _collSurplus,
uint256 _debtGasComp,
uint256 _collGasComp
) external;
function getEntireSystemBalances() external view returns (uint256, uint256, uint256);
function movePendingPositionRewardsToActiveBalances(uint256 _debt, uint256 _collateral) external;
function openPosition(
address _borrower,
uint256 _collateralAmount,
uint256 _compositeDebt,
uint256 NICR,
address _upperHint,
address _lowerHint
) external returns (uint256 stake, uint256 arrayIndex);
function redeemCollateral(
uint256 _debtAmount,
address _firstRedemptionHint,
address _upperPartialRedemptionHint,
address _lowerPartialRedemptionHint,
uint256 _partialRedemptionHintNICR,
uint256 _maxIterations,
uint256 _maxFeePercentage
) external;
function setAddresses(address _priceFeedAddress, address _sortedPositionsAddress, address _collateralToken) external;
function setParameters(
IFactory.DeploymentParams calldata _params
) external;
function setPaused(bool _paused) external;
function setPriceFeed(address _priceFeedAddress) external;
function startSunset() external;
function updateBalances() external;
function updatePositionFromAdjustment(
bool _isDebtIncrease,
uint256 _debtChange,
uint256 _netDebtChange,
bool _isCollIncrease,
uint256 _collChange,
address _upperHint,
address _lowerHint,
address _borrower,
address _receiver
) external returns (uint256, uint256, uint256);
function DEBT_GAS_COMPENSATION() external view returns (uint256);
function DECIMAL_PRECISION() external view returns (uint256);
function L_collateral() external view returns (uint256);
function L_debt() external view returns (uint256);
function MCR() external view returns (uint256);
function PERCENT_DIVISOR() external view returns (uint256);
function CORE() external view returns (address);
function SUNSETTING_INTEREST_RATE() external view returns (uint256);
function Positions(
address
)
external
view
returns (
uint256 debt,
uint256 coll,
uint256 stake,
uint8 status,
uint128 arrayIndex,
uint256 activeInterestIndex
);
function activeInterestIndex() external view returns (uint256);
function baseRate() external view returns (uint256);
function borrowerOperations() external view returns (address);
function borrowingFeeFloor() external view returns (uint256);
function collateralToken() external view returns (address);
function debtToken() external view returns (address);
function collVaultRouter() external view returns (address);
function defaultedCollateral() external view returns (uint256);
function defaultedDebt() external view returns (uint256);
function getBorrowingFee(uint256 _debt) external view returns (uint256);
function getBorrowingFeeWithDecay(uint256 _debt) external view returns (uint256);
function getBorrowingRate() external view returns (uint256);
function getBorrowingRateWithDecay() external view returns (uint256);
function getCurrentICR(address _borrower, uint256 _price) external view returns (uint256);
function getEntireDebtAndColl(
address _borrower
) external view returns (uint256 debt, uint256 coll, uint256 pendingDebtReward, uint256 pendingCollateralReward);
function getEntireSystemColl() external view returns (uint256);
function getEntireSystemDebt() external view returns (uint256);
function getNominalICR(address _borrower) external view returns (uint256);
function getPendingCollAndDebtRewards(address _borrower) external view returns (uint256, uint256);
function getRedemptionFeeWithDecay(uint256 _collateralDrawn) external view returns (uint256);
function getRedemptionRate() external view returns (uint256);
function getRedemptionRateWithDecay() external view returns (uint256);
function getTotalActiveCollateral() external view returns (uint256);
function getTotalActiveDebt() external view returns (uint256);
function getPositionCollAndDebt(address _borrower) external view returns (uint256 coll, uint256 debt);
function getPositionFromPositionOwnersArray(uint256 _index) external view returns (address);
function getPositionOwnersCount() external view returns (uint256);
function getPositionStake(address _borrower) external view returns (uint256);
function getPositionStatus(address _borrower) external view returns (uint256);
function guardian() external view returns (address);
function hasPendingRewards(address _borrower) external view returns (bool);
function interestPayable() external view returns (uint256);
function interestRate() external view returns (uint256);
function lastActiveIndexUpdate() external view returns (uint256);
function lastCollateralError_Redistribution() external view returns (uint256);
function lastDebtError_Redistribution() external view returns (uint256);
function lastFeeOperationTime() external view returns (uint256);
function liquidationManager() external view returns (address);
function maxBorrowingFee() external view returns (uint256);
function maxRedemptionFee() external view returns (uint256);
function maxSystemDebt() external view returns (uint256);
function minuteDecayFactor() external view returns (uint256);
function owner() external view returns (address);
function paused() external view returns (bool);
function priceFeed() external view returns (address);
function redemptionFeeFloor() external view returns (uint256);
function rewardSnapshots(address) external view returns (uint256 collateral, uint256 debt);
function sortedPositions() external view returns (address);
function sunsetting() external view returns (bool);
function surplusBalances(address) external view returns (uint256);
function systemDeploymentTime() external view returns (uint256);
function totalCollateralSnapshot() external view returns (uint256);
function totalStakes() external view returns (uint256);
function totalStakesSnapshot() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ISortedPositions {
event NodeAdded(address _id, uint256 _NICR);
event NodeRemoved(address _id);
function insert(address _id, uint256 _NICR, address _prevId, address _nextId) external;
function reInsert(address _id, uint256 _newNICR, address _prevId, address _nextId) external;
function remove(address _id) external;
function setAddresses(address _positionManagerAddress) external;
function contains(address _id) external view returns (bool);
function data() external view returns (address head, address tail, uint256 size);
function findInsertPosition(
uint256 _NICR,
address _prevId,
address _nextId
) external view returns (address, address);
function getFirst() external view returns (address);
function getLast() external view returns (address);
function getNext(address _id) external view returns (address);
function getPrev(address _id) external view returns (address);
function getSize() external view returns (uint256);
function isEmpty() external view returns (bool);
function positionManager() external view returns (address);
function validInsertPosition(uint256 _NICR, address _prevId, address _nextId) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
interface IFactory {
// commented values are suggested default parameters
struct DeploymentParams {
uint256 minuteDecayFactor; // 999037758833783000 (half life of 12 hours)
uint256 redemptionFeeFloor; // 1e18 / 1000 * 5 (0.5%)
uint256 maxRedemptionFee; // 1e18 (100%)
uint256 borrowingFeeFloor; // 1e18 / 1000 * 5 (0.5%)
uint256 maxBorrowingFee; // 1e18 / 100 * 5 (5%)
uint256 interestRateInBps; // 100 (1%)
uint256 maxDebt;
uint256 MCR; // 12 * 1e17 (120%)
address collVaultRouter; // set to address(0) if PositionManager coll is not CollateralVault
}
event NewDeployment(address collateral, address priceFeed, address positionManager, address sortedPositions);
function deployNewInstance(
address collateral,
address priceFeed,
address customPositionManagerImpl,
address customSortedPositionsImpl,
DeploymentParams calldata params,
uint64 unlockRatePerSecond,
bool forceThroughLspBalanceCheck
) external;
function setImplementations(address _positionManagerImpl, address _sortedPositionsImpl) external;
function CORE() external view returns (address);
function borrowerOperations() external view returns (address);
function debtToken() external view returns (address);
function guardian() external view returns (address);
function liquidationManager() external view returns (address);
function owner() external view returns (address);
function sortedPositionsImpl() external view returns (address);
function liquidStabilityPool() external view returns (address);
function positionManagerCount() external view returns (uint256);
function positionManagerImpl() external view returns (address);
function positionManagers(uint256) external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
/*
* Base contract for PositionManager, BorrowerOperations and StabilityPool. Contains global system constants and
* common functions.
*/
contract PropBase {
uint256 public constant DECIMAL_PRECISION = 1e18;
// Amount of debt to be locked in gas pool on opening positions
uint256 public immutable DEBT_GAS_COMPENSATION;
uint256 public constant PERCENT_DIVISOR = 1000; // dividing by 1000 yields 0.1%
constructor(uint256 _gasCompensation) {
DEBT_GAS_COMPENSATION = _gasCompensation;
}
// --- Gas compensation functions ---
// Returns the composite debt (drawn debt + gas compensation) of a position, for the purpose of ICR calculation
function _getCompositeDebt(uint256 _debt) internal view returns (uint256) {
return _debt + DEBT_GAS_COMPENSATION;
}
function _getNetDebt(uint256 _debt) internal view returns (uint256) {
return _debt - DEBT_GAS_COMPENSATION;
}
// Return the amount of collateral to be drawn from a position's collateral and sent as gas compensation.
function _getCollGasCompensation(uint256 _entireColl) internal pure returns (uint256) {
return _entireColl / PERCENT_DIVISOR;
}
function _requireUserAcceptsFee(uint256 _fee, uint256 _amount, uint256 _maxFeePercentage) internal pure {
uint256 feePercentage = _amount != 0 ? (_fee * DECIMAL_PRECISION) / _amount : 0;
require(feePercentage <= _maxFeePercentage, "Fee exceeded provided maximum");
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
library PropMath {
uint256 internal constant DECIMAL_PRECISION = 1e18;
/* Precision for Nominal ICR (independent of price). Rationale for the value:
*
* - Making it “too high” could lead to overflows.
* - Making it “too low” could lead to an ICR equal to zero, due to truncation from Solidity floor division.
*
* This value of 1e20 is chosen for safety: the NICR will only overflow for numerator > ~1e39,
* and will only truncate to 0 if the denominator is at least 1e20 times greater than the numerator.
*
*/
uint256 internal constant NICR_PRECISION = 1e20;
function _min(uint256 _a, uint256 _b) internal pure returns (uint256) {
return (_a < _b) ? _a : _b;
}
function _max(uint256 _a, uint256 _b) internal pure returns (uint256) {
return (_a >= _b) ? _a : _b;
}
/*
* Multiply two decimal numbers and use normal rounding rules:
* -round product up if 19'th mantissa digit >= 5
* -round product down if 19'th mantissa digit < 5
*
* Used only inside the exponentiation, _decPow().
*/
function decMul(uint256 x, uint256 y) internal pure returns (uint256 decProd) {
uint256 prod_xy = x * y;
decProd = (prod_xy + (DECIMAL_PRECISION / 2)) / DECIMAL_PRECISION;
}
/*
* _decPow: Exponentiation function for 18-digit decimal base, and integer exponent n.
*
* Uses the efficient "exponentiation by squaring" algorithm. O(log(n)) complexity.
*
* Called by two functions that represent time in units of minutes:
* 1) PositionManager._calcDecayedBaseRate
* 2) CommunityIssuance._getCumulativeIssuanceFraction
*
* The exponent is capped to avoid reverting due to overflow. The cap 525600000 equals
* "minutes in 1000 years": 60 * 24 * 365 * 1000
*
* If a period of > 1000 years is ever used as an exponent in either of the above functions, the result will be
* negligibly different from just passing the cap, since:
*
* In function 1), the decayed base rate will be 0 for 1000 years or > 1000 years
* In function 2), the difference in tokens issued at 1000 years and any time > 1000 years, will be negligible
*/
function _decPow(uint256 _base, uint256 _minutes) internal pure returns (uint256) {
if (_minutes > 525600000) {
_minutes = 525600000;
} // cap to avoid overflow
if (_minutes == 0) {
return DECIMAL_PRECISION;
}
uint256 y = DECIMAL_PRECISION;
uint256 x = _base;
uint256 n = _minutes;
// Exponentiation-by-squaring
while (n > 1) {
if (n % 2 == 0) {
x = decMul(x, x);
n = n / 2;
} else {
// if (n % 2 != 0)
y = decMul(x, y);
x = decMul(x, x);
n = (n - 1) / 2;
}
}
return decMul(x, y);
}
function _getAbsoluteDifference(uint256 _a, uint256 _b) internal pure returns (uint256) {
return (_a >= _b) ? _a - _b : _b - _a;
}
function _computeNominalCR(uint256 _coll, uint256 _debt) internal pure returns (uint256) {
if (_debt > 0) {
return (_coll * NICR_PRECISION) / _debt;
}
// Return the maximal value for uint256 if the Position has a debt of 0. Represents "infinite" CR.
else {
// if (_debt == 0)
return 2 ** 256 - 1;
}
}
function _computeCR(uint256 _coll, uint256 _debt, uint256 _price) internal pure returns (uint256) {
if (_debt > 0) {
uint256 newCollRatio = (_coll * _price) / _debt;
return newCollRatio;
}
// Return the maximal value for uint256 if the Position has a debt of 0. Represents "infinite" CR.
else {
// if (_debt == 0)
return 2 ** 256 - 1;
}
}
function _computeCR(uint256 _coll, uint256 _debt) internal pure returns (uint256) {
if (_debt > 0) {
uint256 newCollRatio = (_coll) / _debt;
return newCollRatio;
}
// Return the maximal value for uint256 if the Position has a debt of 0. Represents "infinite" CR.
else {
// if (_debt == 0)
return 2 ** 256 - 1;
}
}
function _isApproxEqAbs(uint256 a, uint256 b, uint256 tolerance) internal pure returns (bool) {
return a > b ? (a - b) <= tolerance : (b - a) <= tolerance;
}
function _isWithinToleranceAbove(
uint256 a,
uint256 b,
uint256 tolerance
) internal pure returns (bool) {
if (a < b) return false;
return (a - b) <= tolerance;
}
function _isWithinToleranceBelow(
uint256 a,
uint256 b,
uint256 tolerance
) internal pure returns (bool) {
if (a > b) return false;
return (b - a) <= tolerance;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
import {IMetaCore} from "src/interfaces/core/IMetaCore.sol";
interface ICore {
// --- Public variables ---
function metaCore() external view returns (IMetaCore);
function startTime() external view returns (uint256);
function CCR() external view returns (uint256);
function dmBootstrapPeriod() external view returns (uint64);
function isPeriphery(address peripheryContract) external view returns (bool);
// --- External functions ---
function setPeripheryEnabled(address _periphery, bool _enabled) external;
function setPMBootstrapPeriod(address dm, uint64 _bootstrapPeriod) external;
function setNewCCR(uint256 _CCR) external;
function priceFeed() external view returns (address);
function owner() external view returns (address);
function pendingOwner() external view returns (address);
function guardian() external view returns (address);
function feeReceiver() external view returns (address);
function paused() external view returns (bool);
function lspBootstrapPeriod() external view returns (uint64);
function getLspEntryFee(address rebalancer) external view returns (uint16);
function getLspExitFee(address rebalancer) external view returns (uint16);
function interestProtocolShare() external view returns (uint16);
function defaultInterestReceiver() external view returns (address);
// --- Events ---
event CCRSet(uint256 initialCCR);
event PMBootstrapPeriodSet(address dm, uint64 bootstrapPeriod);
event PeripheryEnabled(address indexed periphery, bool enabled);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC3156FlashBorrower.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC3156 FlashBorrower, as defined in
* https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
*
* _Available since v4.1._
*/
interface IERC3156FlashBorrower {
/**
* @dev Receive a flash loan.
* @param initiator The initiator of the loan.
* @param token The loan currency.
* @param amount The amount of tokens lent.
* @param fee The additional amount of tokens to repay.
* @param data Arbitrary data structure, intended to contain user-defined parameters.
* @return The keccak256 hash of "IERC3156FlashBorrower.onFlashLoan"
*/
function onFlashLoan(
address initiator,
address token,
uint256 amount,
uint256 fee,
bytes calldata data
) external 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
pragma solidity 0.8.26;
interface IMetaCore {
// ---------------------------------
// Structures
// ---------------------------------
struct FeeInfo {
bool existsForDebtToken;
uint16 debtTokenFee;
}
struct RebalancerFeeInfo {
bool exists;
uint16 entryFee;
uint16 exitFee;
}
// ---------------------------------
// Public constants
// ---------------------------------
function OWNERSHIP_TRANSFER_DELAY() external view returns (uint256);
function DEFAULT_FLASH_LOAN_FEE() external view returns (uint16);
// ---------------------------------
// Public state variables
// ---------------------------------
function debtToken() external view returns (address);
function lspEntryFee() external view returns (uint16);
function lspExitFee() external view returns (uint16);
function interestProtocolShare() external view returns (uint16);
/// @dev Default interest receiver for all PositionManagers, unless overriden in the respective PM
function defaultInterestReceiver() external view returns (address);
function feeReceiver() external view returns (address);
function priceFeed() external view returns (address);
function owner() external view returns (address);
function pendingOwner() external view returns (address);
function ownershipTransferDeadline() external view returns (uint256);
function guardian() external view returns (address);
function paused() external view returns (bool);
function lspBootstrapPeriod() external view returns (uint64);
// ---------------------------------
// External functions
// ---------------------------------
function setFeeReceiver(address _feeReceiver) external;
function setPriceFeed(address _priceFeed) external;
function setGuardian(address _guardian) external;
/**
* @notice Global pause/unpause
* Pausing halts new deposits/borrowing across the protocol
*/
function setPaused(bool _paused) external;
/**
* @notice Extend or change the LSP bootstrap period,
* after which certain protocol mechanics change
*/
function setLspBootstrapPeriod(uint64 _bootstrapPeriod) external;
/**
* @notice Set a custom flash-loan fee for a given periphery contract
* @param _periphery Target contract that will get this custom fee
* @param _debtTokenFee Fee in basis points (bp)
* @param _existsForDebtToken Whether this custom fee is used when the caller = `debtToken`
*/
function setPeripheryFlashLoanFee(address _periphery, uint16 _debtTokenFee, bool _existsForDebtToken) external;
/**
* @notice Begin the ownership transfer process
* @param newOwner The address proposed to be the new owner
*/
function commitTransferOwnership(address newOwner) external;
/**
* @notice Finish the ownership transfer, after the mandatory delay
*/
function acceptTransferOwnership() external;
/**
* @notice Revoke a pending ownership transfer
*/
function revokeTransferOwnership() external;
/**
* @notice Look up a custom flash-loan fee for a specific periphery contract
* @param peripheryContract The contract that might have a custom fee
* @return The flash-loan fee in basis points
*/
function getPeripheryFlashLoanFee(address peripheryContract) external view returns (uint16);
/**
* @notice Set / override entry & exit fees for a special rebalancer contract
*/
function setRebalancerFee(address _rebalancer, uint16 _entryFee, uint16 _exitFee) external;
/**
* @notice Set the LSP entry fee globally
* @param _fee Fee in basis points
*/
function setEntryFee(uint16 _fee) external;
/**
* @notice Set the LSP exit fee globally
* @param _fee Fee in basis points
*/
function setExitFee(uint16 _fee) external;
/**
* @notice Set the interest protocol share globally to all PositionManagers
* @param _interestProtocolShare Share in basis points
*/
function setInterestProtocolShare(uint16 _interestProtocolShare) external;
/**
* @notice Look up the LSP entry fee for a rebalancer
* @param rebalancer Possibly has a special fee
* @return The entry fee in basis points
*/
function getLspEntryFee(address rebalancer) external view returns (uint16);
/**
* @notice Look up the LSP exit fee for a rebalancer
* @param rebalancer Possibly has a special fee
* @return The exit fee in basis points
*/
function getLspExitFee(address rebalancer) external view returns (uint16);
// ---------------------------------
// Events
// ---------------------------------
event NewOwnerCommitted(address indexed owner, address indexed pendingOwner, uint256 deadline);
event NewOwnerAccepted(address indexed oldOwner, address indexed newOwner);
event NewOwnerRevoked(address indexed owner, address indexed revokedOwner);
event FeeReceiverSet(address indexed feeReceiver);
event PriceFeedSet(address indexed priceFeed);
event GuardianSet(address indexed guardian);
event PeripheryFlashLoanFee(address indexed periphery, uint16 debtTokenFee);
event LSPBootstrapPeriodSet(uint64 bootstrapPeriod);
event RebalancerFees(address indexed rebalancer, uint16 entryFee, uint16 exitFee);
event EntryFeeSet(uint16 fee);
event ExitFeeSet(uint16 fee);
event InterestProtocolShareSet(uint16 interestProtocolShare);
event DefaultInterestReceiverSet(address indexed defaultInterestReceiver);
event Paused();
event Unpaused();
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/",
"solady/=lib/solady/src/",
"@solmate/=lib/solmate/src/",
"@chimera/=lib/chimera/src/",
"forge-std/=lib/forge-std/src/",
"@uniswap/v3-core/=lib/v3-core/",
"@uniswap/v3-periphery/=lib/v3-periphery/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"chimera/=lib/chimera/src/",
"ds-test/=lib/solmate/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"rewards/=lib/rewards/",
"solmate/=lib/solmate/src/",
"uniswap/=lib/uniswap/",
"v3-core/=lib/v3-core/contracts/",
"v3-periphery/=lib/v3-periphery/contracts/"
],
"optimizer": {
"enabled": true,
"runs": 1
},
"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":[{"internalType":"address","name":"_borrowerOperationsAddress","type":"address"},{"internalType":"uint256","name":"_gasCompensation","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DEBT_GAS_COMPENSATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DECIMAL_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_DIVISOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowerOperations","outputs":[{"internalType":"contract IBorrowerOperations","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_coll","type":"uint256"},{"internalType":"uint256","name":"_debt","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"computeCR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_coll","type":"uint256"},{"internalType":"uint256","name":"_debt","type":"uint256"}],"name":"computeNominalCR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"contract IPositionManager","name":"positionManager","type":"address"},{"internalType":"uint256","name":"_CR","type":"uint256"},{"internalType":"uint256","name":"_numTrials","type":"uint256"},{"internalType":"uint256","name":"_inputRandomSeed","type":"uint256"}],"name":"getApproxHint","outputs":[{"internalType":"address","name":"hintAddress","type":"address"},{"internalType":"uint256","name":"diff","type":"uint256"},{"internalType":"uint256","name":"latestRandomSeed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IPositionManager","name":"positionManager","type":"address"},{"internalType":"uint256","name":"_debtAmount","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_maxIterations","type":"uint256"}],"name":"getRedemptionHints","outputs":[{"internalType":"address","name":"firstRedemptionHint","type":"address"},{"internalType":"uint256","name":"partialRedemptionHintNICR","type":"uint256"},{"internalType":"uint256","name":"truncatedDebtAmount","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60c0604052348015600e575f80fd5b50604051610d26380380610d26833981016040819052602b91603e565b6080526001600160a01b031660a0526073565b5f8060408385031215604e575f80fd5b82516001600160a01b03811681146063575f80fd5b6020939093015192949293505050565b60805160a051610c7e6100a85f395f818161012001526103b201525f818160d30152818161099601526109d60152610c7e5ff3fe608060405234801561000f575f80fd5b5060043610610076575f3560e01c8063301be4591461007a5780634870dd9a146100b75780634ba4a28b146100ce578063525acdbb146100f5578063701526b41461010857806377553ad41461011b578063a20baee61461014f578063c394a7fa1461015e575b5f80fd5b61008d610088366004610a96565b610171565b604080516001600160a01b0390941684526020840192909252908201526060015b60405180910390f35b6100c06103e881565b6040519081526020016100ae565b6100c07f000000000000000000000000000000000000000000000000000000000000000081565b6100c0610103366004610ace565b610653565b61008d610116366004610a96565b610669565b6101427f000000000000000000000000000000000000000000000000000000000000000081565b6040516100ae9190610af7565b6100c0670de0b6b3a764000081565b6100c061016c366004610b0b565b61097c565b5f805f80876001600160a01b031663c045e47d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101b1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101d59190610b2b565b90505f8790505f826001600160a01b0316634d6228316040518163ffffffff1660e01b8152600401602060405180830381865afa158015610218573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061023c9190610b2b565b90505f8a6001600160a01b031663794e57246040518163ffffffff1660e01b8152600401602060405180830381865afa15801561027b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061029f9190610b46565b90505b6001600160a01b038216158015906103295750604051630d293c7160e41b81526001600160a01b038381166004830152602482018b90528291908d169063d293c71090604401602060405180830381865afa158015610303573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103279190610b46565b105b156103a057604051632dc9c0eb60e21b81526001600160a01b0385169063b72703ac9061035a908590600401610af7565b602060405180830381865afa158015610375573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103999190610b2b565b91506102a2565b819650875f036103af575f1997505b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663969c24526040518163ffffffff1660e01b8152600401602060405180830381865afa15801561040c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104309190610b46565b90505b6001600160a01b0383161580159061044a57505f84115b801561046057505f8961045c81610b71565b9a50115b15610638575f808d6001600160a01b031663b91af97c866040518263ffffffff1660e01b81526004016104939190610af7565b608060405180830381865afa1580156104ae573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104d29190610b86565b5050915091505f6104e283610990565b905086811115610572578381111561056a575f610508886105038785610bb9565b6109bb565b90505f8e61051e670de0b6b3a764000084610bcc565b6105289190610bf7565b6105329085610bb9565b90505f61053f8385610bb9565b90505f61054b826109d0565b905061055783826109fb565b9d50610563848c610bb9565b9a50505050505b505050610638565b61057c8188610bb9565b96508b5f036105c35760405162461bcd60e51b815260206004820152600f60248201526e121a5b9d1cc81b9bdd08199bdd5b99608a1b604482015260640160405180910390fd5b604051632dc9c0eb60e21b81526001600160a01b0389169063b72703ac906105ef908990600401610af7565b602060405180830381865afa15801561060a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061062e9190610b2b565b9550505050610433565b610642848c610bb9565b955050505050509450945094915050565b5f61065f848484610a2f565b90505b9392505050565b5f805f80876001600160a01b031663c045e47d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106a9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106cd9190610b2b565b90505f886001600160a01b0316633cf1b05b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561070c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107309190610b46565b9050805f03610749575f80879450945094505050610972565b816001600160a01b0316634d6228316040518163ffffffff1660e01b8152600401602060405180830381865afa158015610785573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107a99190610b2b565b945061081f888a6001600160a01b031663b0d8e181886040518263ffffffff1660e01b81526004016107db9190610af7565b602060405180830381865afa1580156107f6573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061081a9190610b46565b610a5d565b935085925060015b8781101561096e5760408051602081018690520160408051601f19818403018152919052805160209091012093505f6108608386610c0a565b60405163593cc83760e11b8152600481018290529091505f906001600160a01b038d169063b279906e90602401602060405180830381865afa1580156108a8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108cc9190610b2b565b90505f8c6001600160a01b031663b0d8e181836040518263ffffffff1660e01b81526004016108fb9190610af7565b602060405180830381865afa158015610916573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061093a9190610b46565b90505f610947828e610a5d565b905088811015610958578098508299505b8461096281610c1d565b95505050505050610827565b5050505b9450945094915050565b5f61098783836109fb565b90505b92915050565b5f61098a7f000000000000000000000000000000000000000000000000000000000000000083610bb9565b5f8183106109c95781610987565b5090919050565b5f61098a7f000000000000000000000000000000000000000000000000000000000000000083610c35565b5f8115610a275781610a1668056bc75e2d6310000085610bcc565b610a209190610bf7565b905061098a565b505f1961098a565b5f8215610a55575f83610a428487610bcc565b610a4c9190610bf7565b91506106629050565b505f19610662565b5f81831015610a7557610a708383610bb9565b610987565b6109878284610bb9565b6001600160a01b0381168114610a93575f80fd5b50565b5f805f8060808587031215610aa9575f80fd5b8435610ab481610a7f565b966020860135965060408601359560600135945092505050565b5f805f60608486031215610ae0575f80fd5b505081359360208301359350604090920135919050565b6001600160a01b0391909116815260200190565b5f8060408385031215610b1c575f80fd5b50508035926020909101359150565b5f60208284031215610b3b575f80fd5b815161066281610a7f565b5f60208284031215610b56575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b5f81610b7f57610b7f610b5d565b505f190190565b5f805f8060808587031215610b99575f80fd5b505082516020840151604085015160609095015191969095509092509050565b8181038181111561098a5761098a610b5d565b808202811582820484141761098a5761098a610b5d565b634e487b7160e01b5f52601260045260245ffd5b5f82610c0557610c05610be3565b500490565b5f82610c1857610c18610be3565b500690565b5f60018201610c2e57610c2e610b5d565b5060010190565b8082018082111561098a5761098a610b5d56fea264697066735822122009a851c841ba11db52431cc325dcdaf2020f6ad36d093947fee256a6ce3ebf4864736f6c634300081a003300000000000000000000000049fd0c4fb5172b20b7636b13c49fb15da52d5bd40000000000000000000000000000000000000000000000000de0b6b3a7640000
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610076575f3560e01c8063301be4591461007a5780634870dd9a146100b75780634ba4a28b146100ce578063525acdbb146100f5578063701526b41461010857806377553ad41461011b578063a20baee61461014f578063c394a7fa1461015e575b5f80fd5b61008d610088366004610a96565b610171565b604080516001600160a01b0390941684526020840192909252908201526060015b60405180910390f35b6100c06103e881565b6040519081526020016100ae565b6100c07f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b6100c0610103366004610ace565b610653565b61008d610116366004610a96565b610669565b6101427f00000000000000000000000049fd0c4fb5172b20b7636b13c49fb15da52d5bd481565b6040516100ae9190610af7565b6100c0670de0b6b3a764000081565b6100c061016c366004610b0b565b61097c565b5f805f80876001600160a01b031663c045e47d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101b1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101d59190610b2b565b90505f8790505f826001600160a01b0316634d6228316040518163ffffffff1660e01b8152600401602060405180830381865afa158015610218573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061023c9190610b2b565b90505f8a6001600160a01b031663794e57246040518163ffffffff1660e01b8152600401602060405180830381865afa15801561027b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061029f9190610b46565b90505b6001600160a01b038216158015906103295750604051630d293c7160e41b81526001600160a01b038381166004830152602482018b90528291908d169063d293c71090604401602060405180830381865afa158015610303573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103279190610b46565b105b156103a057604051632dc9c0eb60e21b81526001600160a01b0385169063b72703ac9061035a908590600401610af7565b602060405180830381865afa158015610375573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103999190610b2b565b91506102a2565b819650875f036103af575f1997505b5f7f00000000000000000000000049fd0c4fb5172b20b7636b13c49fb15da52d5bd46001600160a01b031663969c24526040518163ffffffff1660e01b8152600401602060405180830381865afa15801561040c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104309190610b46565b90505b6001600160a01b0383161580159061044a57505f84115b801561046057505f8961045c81610b71565b9a50115b15610638575f808d6001600160a01b031663b91af97c866040518263ffffffff1660e01b81526004016104939190610af7565b608060405180830381865afa1580156104ae573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104d29190610b86565b5050915091505f6104e283610990565b905086811115610572578381111561056a575f610508886105038785610bb9565b6109bb565b90505f8e61051e670de0b6b3a764000084610bcc565b6105289190610bf7565b6105329085610bb9565b90505f61053f8385610bb9565b90505f61054b826109d0565b905061055783826109fb565b9d50610563848c610bb9565b9a50505050505b505050610638565b61057c8188610bb9565b96508b5f036105c35760405162461bcd60e51b815260206004820152600f60248201526e121a5b9d1cc81b9bdd08199bdd5b99608a1b604482015260640160405180910390fd5b604051632dc9c0eb60e21b81526001600160a01b0389169063b72703ac906105ef908990600401610af7565b602060405180830381865afa15801561060a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061062e9190610b2b565b9550505050610433565b610642848c610bb9565b955050505050509450945094915050565b5f61065f848484610a2f565b90505b9392505050565b5f805f80876001600160a01b031663c045e47d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106a9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106cd9190610b2b565b90505f886001600160a01b0316633cf1b05b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561070c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107309190610b46565b9050805f03610749575f80879450945094505050610972565b816001600160a01b0316634d6228316040518163ffffffff1660e01b8152600401602060405180830381865afa158015610785573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107a99190610b2b565b945061081f888a6001600160a01b031663b0d8e181886040518263ffffffff1660e01b81526004016107db9190610af7565b602060405180830381865afa1580156107f6573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061081a9190610b46565b610a5d565b935085925060015b8781101561096e5760408051602081018690520160408051601f19818403018152919052805160209091012093505f6108608386610c0a565b60405163593cc83760e11b8152600481018290529091505f906001600160a01b038d169063b279906e90602401602060405180830381865afa1580156108a8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108cc9190610b2b565b90505f8c6001600160a01b031663b0d8e181836040518263ffffffff1660e01b81526004016108fb9190610af7565b602060405180830381865afa158015610916573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061093a9190610b46565b90505f610947828e610a5d565b905088811015610958578098508299505b8461096281610c1d565b95505050505050610827565b5050505b9450945094915050565b5f61098783836109fb565b90505b92915050565b5f61098a7f0000000000000000000000000000000000000000000000000de0b6b3a764000083610bb9565b5f8183106109c95781610987565b5090919050565b5f61098a7f0000000000000000000000000000000000000000000000000de0b6b3a764000083610c35565b5f8115610a275781610a1668056bc75e2d6310000085610bcc565b610a209190610bf7565b905061098a565b505f1961098a565b5f8215610a55575f83610a428487610bcc565b610a4c9190610bf7565b91506106629050565b505f19610662565b5f81831015610a7557610a708383610bb9565b610987565b6109878284610bb9565b6001600160a01b0381168114610a93575f80fd5b50565b5f805f8060808587031215610aa9575f80fd5b8435610ab481610a7f565b966020860135965060408601359560600135945092505050565b5f805f60608486031215610ae0575f80fd5b505081359360208301359350604090920135919050565b6001600160a01b0391909116815260200190565b5f8060408385031215610b1c575f80fd5b50508035926020909101359150565b5f60208284031215610b3b575f80fd5b815161066281610a7f565b5f60208284031215610b56575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b5f81610b7f57610b7f610b5d565b505f190190565b5f805f8060808587031215610b99575f80fd5b505082516020840151604085015160609095015191969095509092509050565b8181038181111561098a5761098a610b5d565b808202811582820484141761098a5761098a610b5d565b634e487b7160e01b5f52601260045260245ffd5b5f82610c0557610c05610be3565b500490565b5f82610c1857610c18610be3565b500690565b5f60018201610c2e57610c2e610b5d565b5060010190565b8082018082111561098a5761098a610b5d56fea264697066735822122009a851c841ba11db52431cc325dcdaf2020f6ad36d093947fee256a6ce3ebf4864736f6c634300081a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000049fd0c4fb5172b20b7636b13c49fb15da52d5bd40000000000000000000000000000000000000000000000000de0b6b3a7640000
-----Decoded View---------------
Arg [0] : _borrowerOperationsAddress (address): 0x49FD0C4fb5172b20b7636b13c49fb15dA52D5bd4
Arg [1] : _gasCompensation (uint256): 1000000000000000000
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000049fd0c4fb5172b20b7636b13c49fb15da52d5bd4
Arg [1] : 0000000000000000000000000000000000000000000000000de0b6b3a7640000
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.