Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
MultiTroveGetter
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 1 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
import "./Interfaces/ICollateralRegistry.sol";
import "./Interfaces/IMultiTroveGetter.sol";
import "./Types/BatchId.sol";
/* Helper contract for grabbing Trove data for the front end. Not part of the core Liquity system. */
contract MultiTroveGetter is IMultiTroveGetter {
ICollateralRegistry public immutable collateralRegistry;
constructor(ICollateralRegistry _collateralRegistry) {
collateralRegistry = _collateralRegistry;
}
function getMultipleSortedTroves(uint256 _collIndex, int256 _startIdx, uint256 _count)
external
view
returns (CombinedTroveData[] memory _troves)
{
ITroveManager troveManager = collateralRegistry.getTroveManager(_collIndex);
require(address(troveManager) != address(0), "Invalid collateral index");
ISortedTroves sortedTroves = troveManager.sortedTroves();
assert(address(sortedTroves) != address(0));
uint256 startIdx;
bool descend;
if (_startIdx >= 0) {
startIdx = uint256(_startIdx);
descend = true;
} else {
startIdx = uint256(-(_startIdx + 1));
descend = false;
}
uint256 sortedTrovesSize = sortedTroves.getSize();
if (startIdx >= sortedTrovesSize) {
_troves = new CombinedTroveData[](0);
} else {
uint256 maxCount = sortedTrovesSize - startIdx;
if (_count > maxCount) {
_count = maxCount;
}
if (descend) {
_troves = _getMultipleSortedTrovesFromHead(troveManager, sortedTroves, startIdx, _count);
} else {
_troves = _getMultipleSortedTrovesFromTail(troveManager, sortedTroves, startIdx, _count);
}
}
}
function _getOneTrove(ITroveManager _troveManager, uint256 _id, CombinedTroveData memory _out) internal view {
_out.id = _id;
LatestTroveData memory troveData = _troveManager.getLatestTroveData(_id);
_out.entireDebt = troveData.entireDebt;
_out.entireColl = troveData.entireColl;
_out.redistBoldDebtGain = troveData.redistBoldDebtGain;
_out.redistCollGain = troveData.redistCollGain;
_out.accruedInterest = troveData.accruedInterest;
_out.recordedDebt = troveData.recordedDebt;
_out.annualInterestRate = troveData.annualInterestRate;
_out.accruedBatchManagementFee = troveData.accruedBatchManagementFee;
_out.lastInterestRateAdjTime = troveData.lastInterestRateAdjTime;
(
, // debt
, // coll
_out.stake,
, // status
, // arrayIndex
_out.lastDebtUpdateTime,
, // lastInterestRateAdjTime
, // annualInterestRate
_out.interestBatchManager,
_out.batchDebtShares
) = _troveManager.Troves(_id);
(_out.snapshotETH, _out.snapshotBoldDebt) = _troveManager.rewardSnapshots(_id);
}
function _getMultipleSortedTrovesFromHead(
ITroveManager _troveManager,
ISortedTroves _sortedTroves,
uint256 _startIdx,
uint256 _count
) internal view returns (CombinedTroveData[] memory _troves) {
uint256 currentTroveId = _sortedTroves.getFirst();
for (uint256 idx = 0; idx < _startIdx; ++idx) {
currentTroveId = _sortedTroves.getNext(currentTroveId);
}
_troves = new CombinedTroveData[](_count);
for (uint256 idx = 0; idx < _count; ++idx) {
_getOneTrove(_troveManager, currentTroveId, _troves[idx]);
currentTroveId = _sortedTroves.getNext(currentTroveId);
}
}
function _getMultipleSortedTrovesFromTail(
ITroveManager _troveManager,
ISortedTroves _sortedTroves,
uint256 _startIdx,
uint256 _count
) internal view returns (CombinedTroveData[] memory _troves) {
uint256 currentTroveId = _sortedTroves.getLast();
for (uint256 idx = 0; idx < _startIdx; ++idx) {
currentTroveId = _sortedTroves.getPrev(currentTroveId);
}
_troves = new CombinedTroveData[](_count);
for (uint256 idx = 0; idx < _count; ++idx) {
_getOneTrove(_troveManager, currentTroveId, _troves[idx]);
currentTroveId = _sortedTroves.getPrev(currentTroveId);
}
}
function getDebtPerInterestRateAscending(uint256 _collIndex, uint256 _startId, uint256 _maxIterations)
external
view
returns (DebtPerInterestRate[] memory data, uint256 currId)
{
ITroveManager troveManager = collateralRegistry.getTroveManager(_collIndex);
require(address(troveManager) != address(0), "Invalid collateral index");
ISortedTroves sortedTroves = troveManager.sortedTroves();
assert(address(sortedTroves) != address(0));
data = new DebtPerInterestRate[](_maxIterations);
currId = _startId == 0 ? sortedTroves.getLast() : _startId;
for (uint256 i = 0; i < _maxIterations; ++i) {
if (currId == 0) break;
(, uint256 prevId, BatchId interestBatchManager,) = sortedTroves.nodes(currId);
LatestTroveData memory trove = troveManager.getLatestTroveData(currId);
data[i].interestBatchManager = BatchId.unwrap(interestBatchManager);
data[i].interestRate = trove.annualInterestRate;
data[i].debt = trove.entireDebt;
currId = prevId;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)
pragma solidity ^0.8.0;
interface IERC5267 {
/**
* @dev MAY be emitted to signal that the domain could have changed.
*/
event EIP712DomainChanged();
/**
* @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
* signature.
*/
function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IInterestRouter.sol";
import "./IBoldRewardsReceiver.sol";
import "../Types/TroveChange.sol";
interface IActivePool {
function SP_YIELD_SPLIT() external view returns (uint256);
function defaultPoolAddress() external view returns (address);
function borrowerOperationsAddress() external view returns (address);
function troveManagerAddress() external view returns (address);
function interestRouter() external view returns (IInterestRouter);
// We avoid IStabilityPool here in order to prevent creating a dependency cycle that would break flattening
function stabilityPool() external view returns (IBoldRewardsReceiver);
function getCollBalance() external view returns (uint256);
function getBoldDebt() external view returns (uint256);
function lastAggUpdateTime() external view returns (uint256);
function aggRecordedDebt() external view returns (uint256);
function aggWeightedDebtSum() external view returns (uint256);
function aggBatchManagementFees() external view returns (uint256);
function aggWeightedBatchManagementFeeSum() external view returns (uint256);
function calcPendingAggInterest() external view returns (uint256);
function calcPendingSPYield() external view returns (uint256);
function calcPendingAggBatchManagementFee() external view returns (uint256);
function getNewApproxAvgInterestRateFromTroveChange(TroveChange calldata _troveChange)
external
view
returns (uint256);
function mintAggInterest() external;
function mintAggInterestAndAccountForTroveChange(TroveChange calldata _troveChange, address _batchManager)
external;
function mintBatchManagementFeeAndAccountForChange(TroveChange calldata _troveChange, address _batchAddress)
external;
function setShutdownFlag() external;
function hasBeenShutDown() external view returns (bool);
function shutdownTime() external view returns (uint256);
function sendColl(address _account, uint256 _amount) external;
function sendCollToDefaultPool(uint256 _amount) external;
function receiveColl(uint256 _amount) external;
function accountForReceivedColl(uint256 _amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IAddRemoveManagers {
function setAddManager(uint256 _troveId, address _manager) external;
function setRemoveManagerWithReceiver(uint256 _troveId, address _manager, address _receiver) external;
function addManagerOf(uint256 _troveId) external view returns (address);
function removeManagerReceiverOf(uint256 _troveId) external view returns (address, address);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IWhitelist.sol";
interface IAddressesRegistryWhitelist {
function whitelist() external view returns (IWhitelist);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IBoldRewardsReceiver {
function triggerBoldRewards(uint256 _boldYield) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol";
import "openzeppelin-contracts/contracts/interfaces/IERC5267.sol";
import "./IOwned.sol";
interface IBoldToken is IERC20Metadata, IERC20Permit, IOwned, IERC5267 {
function mint(address _account, uint256 _amount) external;
function burn(address _account, uint256 _amount) external;
function sendToPool(address _sender, address poolAddress, uint256 _amount) external;
function returnFromPool(address poolAddress, address user, uint256 _amount) external;
function setCollateralRegistry(address _collateralRegistryAddress) external;
function setMinter(address minter, bool isMinter) external;
function setBurner(address burner, bool isBurner) external;
function setStabilityPool(address stabilityPool, bool isStabilityPool) external;
function isMinter(address minter) external view returns (bool);
function isBurner(address burner) external view returns (bool);
function isStabilityPool(address stabilityPool) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ILiquityBase.sol";
import "./IAddRemoveManagers.sol";
import "./IBoldToken.sol";
import "./IPriceFeed.sol";
import "./ISortedTroves.sol";
import "./ITroveManager.sol";
import "./IWETH.sol";
// Common interface for the Borrower Operations.
interface IBorrowerOperations is ILiquityBase, IAddRemoveManagers {
function CCR() external view returns (uint256);
function MCR() external view returns (uint256);
function SCR() external view returns (uint256);
function BCR() external view returns (uint256);
function updateCRs(uint256 newCCR, uint256 newSCR, uint256 newMCR, uint256 newBCR) external;
function openTrove(
address _owner,
uint256 _ownerIndex,
uint256 _ETHAmount,
uint256 _boldAmount,
uint256 _upperHint,
uint256 _lowerHint,
uint256 _annualInterestRate,
uint256 _maxUpfrontFee,
address _addManager,
address _removeManager,
address _receiver
) external returns (uint256);
struct OpenTroveAndJoinInterestBatchManagerParams {
address owner;
uint256 ownerIndex;
uint256 collAmount;
uint256 boldAmount;
uint256 upperHint;
uint256 lowerHint;
address interestBatchManager;
uint256 maxUpfrontFee;
address addManager;
address removeManager;
address receiver;
}
function openTroveAndJoinInterestBatchManager(OpenTroveAndJoinInterestBatchManagerParams calldata _params)
external
returns (uint256);
function addColl(uint256 _troveId, uint256 _ETHAmount) external;
function withdrawColl(uint256 _troveId, uint256 _amount) external;
function withdrawBold(uint256 _troveId, uint256 _amount, uint256 _maxUpfrontFee) external;
function repayBold(uint256 _troveId, uint256 _amount) external;
function closeTrove(uint256 _troveId) external;
function adjustTrove(
uint256 _troveId,
uint256 _collChange,
bool _isCollIncrease,
uint256 _debtChange,
bool isDebtIncrease,
uint256 _maxUpfrontFee
) external;
function adjustZombieTrove(
uint256 _troveId,
uint256 _collChange,
bool _isCollIncrease,
uint256 _boldChange,
bool _isDebtIncrease,
uint256 _upperHint,
uint256 _lowerHint,
uint256 _maxUpfrontFee
) external;
function adjustTroveInterestRate(
uint256 _troveId,
uint256 _newAnnualInterestRate,
uint256 _upperHint,
uint256 _lowerHint,
uint256 _maxUpfrontFee
) external;
function applyPendingDebt(uint256 _troveId, uint256 _lowerHint, uint256 _upperHint) external;
function onLiquidateTrove(uint256 _troveId) external;
function claimCollateral() external;
function hasBeenShutDown() external view returns (bool);
function shutdown() external;
function shutdownFromOracleFailure() external;
function checkBatchManagerExists(address _batchMananger) external view returns (bool);
// -- individual delegation --
struct InterestIndividualDelegate {
address account;
uint128 minInterestRate;
uint128 maxInterestRate;
uint256 minInterestRateChangePeriod;
}
function getInterestIndividualDelegateOf(uint256 _troveId)
external
view
returns (InterestIndividualDelegate memory);
function setInterestIndividualDelegate(
uint256 _troveId,
address _delegate,
uint128 _minInterestRate,
uint128 _maxInterestRate,
// only needed if trove was previously in a batch:
uint256 _newAnnualInterestRate,
uint256 _upperHint,
uint256 _lowerHint,
uint256 _maxUpfrontFee,
uint256 _minInterestRateChangePeriod
) external;
function removeInterestIndividualDelegate(uint256 _troveId) external;
// -- batches --
struct InterestBatchManager {
uint128 minInterestRate;
uint128 maxInterestRate;
uint256 minInterestRateChangePeriod;
}
function registerBatchManager(
uint128 minInterestRate,
uint128 maxInterestRate,
uint128 currentInterestRate,
uint128 fee,
uint128 minInterestRateChangePeriod
) external;
function lowerBatchManagementFee(uint256 _newAnnualFee) external;
function setBatchManagerAnnualInterestRate(
uint128 _newAnnualInterestRate,
uint256 _upperHint,
uint256 _lowerHint,
uint256 _maxUpfrontFee
) external;
function interestBatchManagerOf(uint256 _troveId) external view returns (address);
function getInterestBatchManager(address _account) external view returns (InterestBatchManager memory);
function setInterestBatchManager(
uint256 _troveId,
address _newBatchManager,
uint256 _upperHint,
uint256 _lowerHint,
uint256 _maxUpfrontFee
) external;
function removeFromBatch(
uint256 _troveId,
uint256 _newAnnualInterestRate,
uint256 _upperHint,
uint256 _lowerHint,
uint256 _maxUpfrontFee
) external;
function switchBatchManager(
uint256 _troveId,
uint256 _removeUpperHint,
uint256 _removeLowerHint,
address _newBatchManager,
uint256 _addUpperHint,
uint256 _addLowerHint,
uint256 _maxUpfrontFee
) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "./IBoldToken.sol";
import "./ITroveManager.sol";
interface ICollateralRegistry {
struct RedemptionTotals {
uint256 numCollaterals;
uint256 boldSupplyAtStart;
uint256 unbacked;
uint256 redeemedAmount;
}
function addNewCollaterals(
IERC20Metadata[] memory _tokens,
ITroveManager[] memory _troveManagers
) external;
function removeCollateral(uint256 index) external;
function baseRate() external view returns (uint256);
function lastFeeOperationTime() external view returns (uint256);
function redeemCollateral(uint256 _boldamount, uint256 _maxIterations, uint256 _maxFeePercentage) external;
// getters
function totalCollaterals() external view returns (uint256);
function getToken(uint256 _index) external view returns (IERC20Metadata);
function getTroveManager(uint256 _index) external view returns (ITroveManager);
function boldToken() external view returns (IBoldToken);
function getRedemptionRate() external view returns (uint256);
function getRedemptionRateWithDecay() external view returns (uint256);
function getRedemptionRateForRedeemedAmount(uint256 _redeemAmount) external view returns (uint256);
function getRedemptionFeeWithDecay(uint256 _ETHDrawn) external view returns (uint256);
function getEffectiveRedemptionFeeInBold(uint256 _redeemAmount) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IDefaultPool {
function troveManagerAddress() external view returns (address);
function activePoolAddress() external view returns (address);
// --- Functions ---
function getCollBalance() external view returns (uint256);
function getBoldDebt() external view returns (uint256);
function sendCollToActivePool(uint256 _amount) external;
function receiveColl(uint256 _amount) external;
function increaseBoldDebt(uint256 _amount) external;
function decreaseBoldDebt(uint256 _amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IInterestRouter {
// Currently the Interest Router doesn’t need any specific function
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IActivePool.sol";
import "./IDefaultPool.sol";
import "./IPriceFeed.sol";
import "./IWhitelist.sol";
interface ILiquityBase {
function activePool() external view returns (IActivePool);
function getEntireBranchDebt() external view returns (uint256);
function getEntireBranchColl() external view returns (uint256);
function setWhitelist(IWhitelist _whitelist) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IMultiTroveGetter {
struct CombinedTroveData {
uint256 id;
uint256 entireDebt;
uint256 entireColl;
uint256 redistBoldDebtGain;
uint256 redistCollGain;
uint256 accruedInterest;
uint256 recordedDebt;
uint256 annualInterestRate;
uint256 accruedBatchManagementFee;
uint256 lastInterestRateAdjTime;
uint256 stake;
uint256 lastDebtUpdateTime;
address interestBatchManager;
uint256 batchDebtShares;
uint256 snapshotETH;
uint256 snapshotBoldDebt;
}
struct DebtPerInterestRate {
address interestBatchManager;
uint256 interestRate;
uint256 debt;
}
function getMultipleSortedTroves(uint256 _collIndex, int256 _startIdx, uint256 _count)
external
view
returns (CombinedTroveData[] memory _troves);
function getDebtPerInterestRateAscending(uint256 _collIndex, uint256 _startId, uint256 _maxIterations)
external
view
returns (DebtPerInterestRate[] memory, uint256 currId);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IOwned {
function owner() external view returns (address);
function nominatedOwner() external view returns (address);
function nominateNewOwner(address owner) external;
function acceptOwnership() external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IPriceFeed {
function fetchPrice() external returns (uint256, bool);
function fetchRedemptionPrice() external returns (uint256, bool);
function lastGoodPrice() external view returns (uint256);
function setAddresses(address _borrowerOperationsAddress) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ITroveManager.sol";
import {BatchId, BATCH_ID_ZERO} from "../Types/BatchId.sol";
interface ISortedTroves {
// -- Mutating functions (permissioned) --
function insert(uint256 _id, uint256 _annualInterestRate, uint256 _prevId, uint256 _nextId) external;
function insertIntoBatch(
uint256 _troveId,
BatchId _batchId,
uint256 _annualInterestRate,
uint256 _prevId,
uint256 _nextId
) external;
function remove(uint256 _id) external;
function removeFromBatch(uint256 _id) external;
function reInsert(uint256 _id, uint256 _newAnnualInterestRate, uint256 _prevId, uint256 _nextId) external;
function reInsertBatch(BatchId _id, uint256 _newAnnualInterestRate, uint256 _prevId, uint256 _nextId) external;
// -- View functions --
function contains(uint256 _id) external view returns (bool);
function isBatchedNode(uint256 _id) external view returns (bool);
function isEmptyBatch(BatchId _id) external view returns (bool);
function isEmpty() external view returns (bool);
function getSize() external view returns (uint256);
function getFirst() external view returns (uint256);
function getLast() external view returns (uint256);
function getNext(uint256 _id) external view returns (uint256);
function getPrev(uint256 _id) external view returns (uint256);
function validInsertPosition(uint256 _annualInterestRate, uint256 _prevId, uint256 _nextId)
external
view
returns (bool);
function findInsertPosition(uint256 _annualInterestRate, uint256 _prevId, uint256 _nextId)
external
view
returns (uint256, uint256);
// Public state variable getters
function borrowerOperationsAddress() external view returns (address);
function troveManager() external view returns (ITroveManager);
function size() external view returns (uint256);
function nodes(uint256 _id) external view returns (uint256 nextId, uint256 prevId, BatchId batchId, bool exists);
function batches(BatchId _id) external view returns (uint256 head, uint256 tail);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IActivePool.sol";
import "./ILiquityBase.sol";
import "./IBoldToken.sol";
import "./ITroveManager.sol";
import "./IBoldRewardsReceiver.sol";
/*
* The Stability Pool holds Bold tokens deposited by Stability Pool depositors.
*
* When a trove is liquidated, then depending on system conditions, some of its Bold debt gets offset with
* Bold in the Stability Pool: that is, the offset debt evaporates, and an equal amount of Bold tokens in the Stability Pool is burned.
*
* Thus, a liquidation causes each depositor to receive a Bold loss, in proportion to their deposit as a share of total deposits.
* They also receive an Coll gain, as the collateral of the liquidated trove is distributed among Stability depositors,
* in the same proportion.
*
* When a liquidation occurs, it depletes every deposit by the same fraction: for example, a liquidation that depletes 40%
* of the total Bold in the Stability Pool, depletes 40% of each deposit.
*
* A deposit that has experienced a series of liquidations is termed a "compounded deposit": each liquidation depletes the deposit,
* multiplying it by some factor in range ]0,1[
*
* Please see the implementation spec in the proof document, which closely follows on from the compounded deposit / Coll gain derivations:
* https://github.com/liquity/liquity/blob/master/papers/Scalable_Reward_Distribution_with_Compounding_Stakes.pdf
*
*/
interface IStabilityPool is ILiquityBase, IBoldRewardsReceiver {
function boldToken() external view returns (IBoldToken);
function troveManager() external view returns (ITroveManager);
/* provideToSP():
* - Calculates depositor's Coll gain
* - Calculates the compounded deposit
* - Increases deposit, and takes new snapshots of accumulators P and S
* - Sends depositor's accumulated Coll gains to depositor
*/
function provideToSP(uint256 _amount, bool _doClaim) external;
/* withdrawFromSP():
* - Calculates depositor's Coll gain
* - Calculates the compounded deposit
* - Sends the requested BOLD withdrawal to depositor
* - (If _amount > userDeposit, the user withdraws all of their compounded deposit)
* - Decreases deposit by withdrawn amount and takes new snapshots of accumulators P and S
*/
function withdrawFromSP(uint256 _amount, bool doClaim) external;
function claimAllCollGains() external;
/*
* Initial checks:
* - Caller is TroveManager
* ---
* Cancels out the specified debt against the Bold contained in the Stability Pool (as far as possible)
* and transfers the Trove's collateral from ActivePool to StabilityPool.
* Only called by liquidation functions in the TroveManager.
*/
function offset(uint256 _debt, uint256 _coll) external;
function deposits(address _depositor) external view returns (uint256 initialValue);
function stashedColl(address _depositor) external view returns (uint256);
/*
* Returns the total amount of Coll held by the pool, accounted in an internal variable instead of `balance`,
* to exclude edge cases like Coll received from a self-destruct.
*/
function getCollBalance() external view returns (uint256);
/*
* Returns Bold held in the pool. Changes when users deposit/withdraw, and when Trove debt is offset.
*/
function getTotalBoldDeposits() external view returns (uint256);
function getYieldGainsOwed() external view returns (uint256);
function getYieldGainsPending() external view returns (uint256);
/*
* Calculates the Coll gain earned by the deposit since its last snapshots were taken.
*/
function getDepositorCollGain(address _depositor) external view returns (uint256);
/*
* Calculates the BOLD yield gain earned by the deposit since its last snapshots were taken.
*/
function getDepositorYieldGain(address _depositor) external view returns (uint256);
/*
* Calculates what `getDepositorYieldGain` will be if interest is minted now.
*/
function getDepositorYieldGainWithPending(address _depositor) external view returns (uint256);
/*
* Return the user's compounded deposit.
*/
function getCompoundedBoldDeposit(address _depositor) external view returns (uint256);
function scaleToS(uint256 _scale) external view returns (uint256);
function scaleToB(uint256 _scale) external view returns (uint256);
function P() external view returns (uint256);
function currentScale() external view returns (uint256);
function P_PRECISION() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ILiquityBase.sol";
import "./ITroveNFT.sol";
import "./IBorrowerOperations.sol";
import "./IStabilityPool.sol";
import "./IBoldToken.sol";
import "./ISortedTroves.sol";
import "../Types/LatestTroveData.sol";
import "../Types/LatestBatchData.sol";
import "./IAddressesRegistryWhitelist.sol";
// Common interface for the Trove Manager.
interface ITroveManager is ILiquityBase {
enum Status {
nonExistent,
active,
closedByOwner,
closedByLiquidation,
zombie
}
function shutdownTime() external view returns (uint256);
function troveNFT() external view returns (ITroveNFT);
function stabilityPool() external view returns (IStabilityPool);
//function boldToken() external view returns (IBoldToken);
function sortedTroves() external view returns (ISortedTroves);
function borrowerOperations() external view returns (IBorrowerOperations);
function updateCRs(uint256 newCCR, uint256 newSCR, uint256 newMCR) external;
function updateLiquidationValues(uint256 newLiquidationPenaltySP, uint256 newliquidationPenaltyRedistribution)
external;
function isWhitelisted(address user) external view returns (bool);
function Troves(uint256 _id)
external
view
returns (
uint256 debt,
uint256 coll,
uint256 stake,
Status status,
uint64 arrayIndex,
uint64 lastDebtUpdateTime,
uint64 lastInterestRateAdjTime,
uint256 annualInterestRate,
address interestBatchManager,
uint256 batchDebtShares
);
function rewardSnapshots(uint256 _id) external view returns (uint256 coll, uint256 boldDebt);
function getTroveIdsCount() external view returns (uint256);
function getTroveFromTroveIdsArray(uint256 _index) external view returns (uint256);
function getCurrentICR(uint256 _troveId, uint256 _price) external view returns (uint256);
function lastZombieTroveId() external view returns (uint256);
function batchLiquidateTroves(uint256[] calldata _troveArray) external;
function redeemCollateral(
address _sender,
uint256 _boldAmount,
uint256 _price,
uint256 _redemptionRate,
uint256 _maxIterations
) external returns (uint256 _redemeedAmount);
function shutdown() external;
function urgentRedemption(uint256 _boldAmount, uint256[] calldata _troveIds, uint256 _minCollateral) external;
function getUnbackedPortionPriceAndRedeemability() external returns (uint256, uint256, bool);
function getLatestTroveData(uint256 _troveId) external view returns (LatestTroveData memory);
function getTroveAnnualInterestRate(uint256 _troveId) external view returns (uint256);
function getTroveStatus(uint256 _troveId) external view returns (Status);
function getLatestBatchData(address _batchAddress) external view returns (LatestBatchData memory);
// -- permissioned functions called by BorrowerOperations
function onOpenTrove(address _owner, uint256 _troveId, TroveChange memory _troveChange, uint256 _annualInterestRate)
external;
function onOpenTroveAndJoinBatch(
address _owner,
uint256 _troveId,
TroveChange memory _troveChange,
address _batchAddress,
uint256 _batchColl,
uint256 _batchDebt
) external;
// Called from `adjustZombieTrove()`
function setTroveStatusToActive(uint256 _troveId) external;
function onAdjustTroveInterestRate(
uint256 _troveId,
uint256 _newColl,
uint256 _newDebt,
uint256 _newAnnualInterestRate,
TroveChange calldata _troveChange
) external;
function onAdjustTrove(uint256 _troveId, uint256 _newColl, uint256 _newDebt, TroveChange calldata _troveChange)
external;
function onAdjustTroveInsideBatch(
uint256 _troveId,
uint256 _newTroveColl,
uint256 _newTroveDebt,
TroveChange memory _troveChange,
address _batchAddress,
uint256 _newBatchColl,
uint256 _newBatchDebt
) external;
function onApplyTroveInterest(
uint256 _troveId,
uint256 _newTroveColl,
uint256 _newTroveDebt,
address _batchAddress,
uint256 _newBatchColl,
uint256 _newBatchDebt,
TroveChange calldata _troveChange
) external;
function onCloseTrove(
uint256 _troveId,
TroveChange memory _troveChange, // decrease vars: entire, with interest, batch fee and redistribution
address _batchAddress,
uint256 _newBatchColl,
uint256 _newBatchDebt // entire, with interest and batch fee
) external;
// -- batches --
function onRegisterBatchManager(address _batchAddress, uint256 _annualInterestRate, uint256 _annualFee) external;
function onLowerBatchManagerAnnualFee(
address _batchAddress,
uint256 _newColl,
uint256 _newDebt,
uint256 _newAnnualManagementFee
) external;
function onSetBatchManagerAnnualInterestRate(
address _batchAddress,
uint256 _newColl,
uint256 _newDebt,
uint256 _newAnnualInterestRate,
uint256 _upfrontFee // needed by BatchUpdated event
) external;
struct OnSetInterestBatchManagerParams {
uint256 troveId;
uint256 troveColl; // entire, with redistribution
uint256 troveDebt; // entire, with interest, batch fee and redistribution
TroveChange troveChange;
address newBatchAddress;
uint256 newBatchColl; // updated collateral for new batch manager
uint256 newBatchDebt; // updated debt for new batch manager
}
function onSetInterestBatchManager(OnSetInterestBatchManagerParams calldata _params) external;
function onRemoveFromBatch(
uint256 _troveId,
uint256 _newTroveColl, // entire, with redistribution
uint256 _newTroveDebt, // entire, with interest, batch fee and redistribution
TroveChange memory _troveChange,
address _batchAddress,
uint256 _newBatchColl,
uint256 _newBatchDebt, // entire, with interest and batch fee
uint256 _newAnnualInterestRate
) external;
// -- end of permissioned functions --
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "./ITroveManager.sol";
import "../Interfaces/IWhitelist.sol";
interface ITroveNFT is IERC721Metadata {
function mint(address _owner, uint256 _troveId) external;
function burn(uint256 _troveId) external;
function setWhitelist(IWhitelist _whitelist) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol";
interface IWETH is IERC20Metadata {
function deposit() external payable;
function withdraw(uint256 wad) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IWhitelist {
function addToWhitelist(address callingContract, address user) external;
function removeFromWhitelist(address callingContract, address user) external;
function isWhitelisted(address callingContract, address user) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
type BatchId is address;
using {equals as ==, notEquals as !=, isZero, isNotZero} for BatchId global;
function equals(BatchId a, BatchId b) pure returns (bool) {
return BatchId.unwrap(a) == BatchId.unwrap(b);
}
function notEquals(BatchId a, BatchId b) pure returns (bool) {
return !(a == b);
}
function isZero(BatchId x) pure returns (bool) {
return x == BATCH_ID_ZERO;
}
function isNotZero(BatchId x) pure returns (bool) {
return !x.isZero();
}
BatchId constant BATCH_ID_ZERO = BatchId.wrap(address(0));// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
struct LatestBatchData {
uint256 entireDebtWithoutRedistribution;
uint256 entireCollWithoutRedistribution;
uint256 accruedInterest;
uint256 recordedDebt;
uint256 annualInterestRate;
uint256 weightedRecordedDebt;
uint256 annualManagementFee;
uint256 accruedManagementFee;
uint256 weightedRecordedBatchManagementFee;
uint256 lastDebtUpdateTime;
uint256 lastInterestRateAdjTime;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
struct LatestTroveData {
uint256 entireDebt;
uint256 entireColl;
uint256 redistBoldDebtGain;
uint256 redistCollGain;
uint256 accruedInterest;
uint256 recordedDebt;
uint256 annualInterestRate;
uint256 weightedRecordedDebt;
uint256 accruedBatchManagementFee;
uint256 lastInterestRateAdjTime;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
struct TroveChange {
uint256 appliedRedistBoldDebtGain;
uint256 appliedRedistCollGain;
uint256 collIncrease;
uint256 collDecrease;
uint256 debtIncrease;
uint256 debtDecrease;
uint256 newWeightedRecordedDebt;
uint256 oldWeightedRecordedDebt;
uint256 upfrontFee;
uint256 batchAccruedManagementFee;
uint256 newWeightedRecordedBatchManagementFee;
uint256 oldWeightedRecordedBatchManagementFee;
}{
"evmVersion": "cancun",
"libraries": {},
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"enabled": true,
"runs": 1
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": [
"openzeppelin/=lib/V2-gov/lib/openzeppelin-contracts/",
"@chimera/=lib/V2-gov/lib/chimera/src/",
"@openzeppelin/contracts/=lib/V2-gov/lib/openzeppelin-contracts/contracts/",
"Solady/=lib/Solady/src/",
"V2-gov/=lib/V2-gov/",
"chimera/=lib/V2-gov/lib/chimera/src/",
"ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"v4-core/=lib/V2-gov/lib/v4-core/"
],
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract ICollateralRegistry","name":"_collateralRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"collateralRegistry","outputs":[{"internalType":"contract ICollateralRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collIndex","type":"uint256"},{"internalType":"uint256","name":"_startId","type":"uint256"},{"internalType":"uint256","name":"_maxIterations","type":"uint256"}],"name":"getDebtPerInterestRateAscending","outputs":[{"components":[{"internalType":"address","name":"interestBatchManager","type":"address"},{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"debt","type":"uint256"}],"internalType":"struct IMultiTroveGetter.DebtPerInterestRate[]","name":"data","type":"tuple[]"},{"internalType":"uint256","name":"currId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collIndex","type":"uint256"},{"internalType":"int256","name":"_startIdx","type":"int256"},{"internalType":"uint256","name":"_count","type":"uint256"}],"name":"getMultipleSortedTroves","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"entireDebt","type":"uint256"},{"internalType":"uint256","name":"entireColl","type":"uint256"},{"internalType":"uint256","name":"redistBoldDebtGain","type":"uint256"},{"internalType":"uint256","name":"redistCollGain","type":"uint256"},{"internalType":"uint256","name":"accruedInterest","type":"uint256"},{"internalType":"uint256","name":"recordedDebt","type":"uint256"},{"internalType":"uint256","name":"annualInterestRate","type":"uint256"},{"internalType":"uint256","name":"accruedBatchManagementFee","type":"uint256"},{"internalType":"uint256","name":"lastInterestRateAdjTime","type":"uint256"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"uint256","name":"lastDebtUpdateTime","type":"uint256"},{"internalType":"address","name":"interestBatchManager","type":"address"},{"internalType":"uint256","name":"batchDebtShares","type":"uint256"},{"internalType":"uint256","name":"snapshotETH","type":"uint256"},{"internalType":"uint256","name":"snapshotBoldDebt","type":"uint256"}],"internalType":"struct IMultiTroveGetter.CombinedTroveData[]","name":"_troves","type":"tuple[]"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60a060405234801561000f575f80fd5b5060405161120838038061120883398101604081905261002e9161003f565b6001600160a01b031660805261006c565b5f6020828403121561004f575f80fd5b81516001600160a01b0381168114610065575f80fd5b9392505050565b6080516111786100905f395f818160920152818160ef015261032701526111785ff3fe608060405234801561000f575f80fd5b506004361061003f575f3560e01c806327addfca14610043578063d1a4629c1461006c578063d330fadd1461008d575b5f80fd5b610056610051366004610cb8565b6100cc565b6040516100639190610ce1565b60405180910390f35b61007f61007a366004610cb8565b610321565b604051610063929190610dce565b6100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610063565b604051630bc17feb60e01b8152600481018490526060905f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630bc17feb90602401602060405180830381865afa158015610134573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101589190610e50565b90506001600160a01b0381166101895760405162461bcd60e51b815260040161018090610e72565b60405180910390fd5b5f816001600160a01b031663ae9187546040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101c6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101ea9190610e50565b90506001600160a01b03811661020257610202610ea4565b5f805f871261021657508590506001610230565b610221876001610ecc565b61022a90610ef3565b91505f90505b5f836001600160a01b031663de8fa4316040518163ffffffff1660e01b8152600401602060405180830381865afa15801561026d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102919190610f0d565b90508083106102d257604080515f80825260208201909252906102ca565b6102b7610c42565b8152602001906001900390816102af5790505b509550610315565b5f6102dd8483610f38565b9050808811156102eb578097505b8215610304576102fd8686868b6106b5565b9650610313565b6103108686868b610893565b96505b505b50505050509392505050565b60605f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630bc17feb876040518263ffffffff1660e01b815260040161037391815260200190565b602060405180830381865afa15801561038e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103b29190610e50565b90506001600160a01b0381166103da5760405162461bcd60e51b815260040161018090610e72565b5f816001600160a01b031663ae9187546040518163ffffffff1660e01b8152600401602060405180830381865afa158015610417573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061043b9190610e50565b90506001600160a01b03811661045357610453610ea4565b846001600160401b0381111561046b5761046b610f24565b6040519080825280602002602001820160405280156104c657816020015b6104b360405180606001604052805f6001600160a01b031681526020015f81526020015f81525090565b8152602001906001900390816104895790505b50935085156104d55785610535565b806001600160a01b0316634d6228316040518163ffffffff1660e01b8152600401602060405180830381865afa158015610511573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105359190610f0d565b92505f5b858110156106aa5783156106aa576040516238a78560e71b8152600481018590525f9081906001600160a01b03851690631c53c28090602401608060405180830381865afa15801561058d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105b19190610f51565b50604051632ab4fd0160e21b8152600481018a905291945092505f91506001600160a01b0387169063aad3f4049060240161014060405180830381865afa1580156105fe573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106229190610fd2565b90508188858151811061063757610637611057565b60209081029190910101516001600160a01b03909116905260c0810151885189908690811061066857610668611057565b60200260200101516020018181525050805f015188858151811061068e5761068e611057565b6020908102919091010151604001525090945050600101610539565b505050935093915050565b60605f846001600160a01b0316631e2231436040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106f4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107189190610f0d565b90505f5b84811015610795576040516307aba33d60e01b8152600481018390526001600160a01b038716906307aba33d90602401602060405180830381865afa158015610767573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061078b9190610f0d565b915060010161071c565b50826001600160401b038111156107ae576107ae610f24565b6040519080825280602002602001820160405280156107e757816020015b6107d4610c42565b8152602001906001900390816107cc5790505b5091505f5b8381101561088957610818878385848151811061080b5761080b611057565b6020026020010151610a5a565b6040516307aba33d60e01b8152600481018390526001600160a01b038716906307aba33d90602401602060405180830381865afa15801561085b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061087f9190610f0d565b91506001016107ec565b5050949350505050565b60605f846001600160a01b0316634d6228316040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108d2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108f69190610f0d565b90505f5b848110156109735760405163040de97d60e21b8152600481018390526001600160a01b03871690631037a5f490602401602060405180830381865afa158015610945573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109699190610f0d565b91506001016108fa565b50826001600160401b0381111561098c5761098c610f24565b6040519080825280602002602001820160405280156109c557816020015b6109b2610c42565b8152602001906001900390816109aa5790505b5091505f5b83811015610889576109e9878385848151811061080b5761080b611057565b60405163040de97d60e21b8152600481018390526001600160a01b03871690631037a5f490602401602060405180830381865afa158015610a2c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a509190610f0d565b91506001016109ca565b818152604051632ab4fd0160e21b8152600481018390525f906001600160a01b0385169063aad3f4049060240161014060405180830381865afa158015610aa3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ac79190610fd2565b80516020848101919091528101516040808501919091528082015160608086019190915282015160808086019190915282015160a08086019190915282015160c08086019190915282015160e08501526101008083015190850152610120808301519085015251632904486760e21b8152600481018590529091506001600160a01b0385169063a411219c9060240161014060405180830381865afa158015610b72573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b969190611086565b6101a08c01526001600160a01b039081166101808c01526001600160401b03939093166101608b015250506101408801939093525050604051630bac90b160e31b8152600481018790529087169250635d64858891506024016040805180830381865afa158015610c09573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c2d9190611120565b6101e08401526101c090920191909152505050565b6040518061020001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f6001600160a01b031681526020015f81526020015f81526020015f81525090565b5f805f60608486031215610cca575f80fd5b505081359360208301359350604090920135919050565b602080825282518282018190525f919060409081850190868401855b82811015610dc15781518051855286810151878601528581015186860152606080820151908601526080808201519086015260a0808201519086015260c0808201519086015260e080820151908601526101008082015190860152610120808201519086015261014080820151908601526101608082015190860152610180808201516001600160a01b0316908601526101a080820151908601526101c080820151908601526101e090810151908501526102009093019290850190600101610cfd565b5091979650505050505050565b604080825283518282018190525f9190606090818501906020808901865b83811015610e2257815180516001600160a01b031686528381015184870152870151878601529385019390820190600101610dec565b505050508093505050508260208301529392505050565b6001600160a01b0381168114610e4d575f80fd5b50565b5f60208284031215610e60575f80fd5b8151610e6b81610e39565b9392505050565b602080825260189082015277092dcecc2d8d2c840c6ded8d8c2e8cae4c2d840d2dcc8caf60431b604082015260600190565b634e487b7160e01b5f52600160045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b8082018281125f831280158216821582161715610eeb57610eeb610eb8565b505092915050565b5f600160ff1b8201610f0757610f07610eb8565b505f0390565b5f60208284031215610f1d575f80fd5b5051919050565b634e487b7160e01b5f52604160045260245ffd5b81810381811115610f4b57610f4b610eb8565b92915050565b5f805f8060808587031215610f64575f80fd5b84519350602085015192506040850151610f7d81610e39565b60608601519092508015158114610f92575f80fd5b939692955090935050565b60405161014081016001600160401b0381118282101715610fcc57634e487b7160e01b5f52604160045260245ffd5b60405290565b5f6101408284031215610fe3575f80fd5b610feb610f9d565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152506101208084015181830152508091505092915050565b634e487b7160e01b5f52603260045260245ffd5b80516001600160401b0381168114611081575f80fd5b919050565b5f805f805f805f805f806101408b8d0312156110a0575f80fd5b8a51995060208b0151985060408b0151975060608b0151600581106110c3575f80fd5b96506110d160808c0161106b565b95506110df60a08c0161106b565b94506110ed60c08c0161106b565b935060e08b015192506101008b015161110581610e39565b809250506101208b015190509295989b9194979a5092959850565b5f8060408385031215611131575f80fd5b50508051602090910151909290915056fea264697066735822122046ea5ea5dbf5002ffe715a0f680685546d550a7839ac9f0b348caa83dbea8e5864736f6c634300081800330000000000000000000000003580bdee01cd7e82c85b868479d5beab735116e4
Deployed Bytecode
0x608060405234801561000f575f80fd5b506004361061003f575f3560e01c806327addfca14610043578063d1a4629c1461006c578063d330fadd1461008d575b5f80fd5b610056610051366004610cb8565b6100cc565b6040516100639190610ce1565b60405180910390f35b61007f61007a366004610cb8565b610321565b604051610063929190610dce565b6100b47f0000000000000000000000003580bdee01cd7e82c85b868479d5beab735116e481565b6040516001600160a01b039091168152602001610063565b604051630bc17feb60e01b8152600481018490526060905f906001600160a01b037f0000000000000000000000003580bdee01cd7e82c85b868479d5beab735116e41690630bc17feb90602401602060405180830381865afa158015610134573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101589190610e50565b90506001600160a01b0381166101895760405162461bcd60e51b815260040161018090610e72565b60405180910390fd5b5f816001600160a01b031663ae9187546040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101c6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101ea9190610e50565b90506001600160a01b03811661020257610202610ea4565b5f805f871261021657508590506001610230565b610221876001610ecc565b61022a90610ef3565b91505f90505b5f836001600160a01b031663de8fa4316040518163ffffffff1660e01b8152600401602060405180830381865afa15801561026d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102919190610f0d565b90508083106102d257604080515f80825260208201909252906102ca565b6102b7610c42565b8152602001906001900390816102af5790505b509550610315565b5f6102dd8483610f38565b9050808811156102eb578097505b8215610304576102fd8686868b6106b5565b9650610313565b6103108686868b610893565b96505b505b50505050509392505050565b60605f807f0000000000000000000000003580bdee01cd7e82c85b868479d5beab735116e46001600160a01b0316630bc17feb876040518263ffffffff1660e01b815260040161037391815260200190565b602060405180830381865afa15801561038e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103b29190610e50565b90506001600160a01b0381166103da5760405162461bcd60e51b815260040161018090610e72565b5f816001600160a01b031663ae9187546040518163ffffffff1660e01b8152600401602060405180830381865afa158015610417573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061043b9190610e50565b90506001600160a01b03811661045357610453610ea4565b846001600160401b0381111561046b5761046b610f24565b6040519080825280602002602001820160405280156104c657816020015b6104b360405180606001604052805f6001600160a01b031681526020015f81526020015f81525090565b8152602001906001900390816104895790505b50935085156104d55785610535565b806001600160a01b0316634d6228316040518163ffffffff1660e01b8152600401602060405180830381865afa158015610511573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105359190610f0d565b92505f5b858110156106aa5783156106aa576040516238a78560e71b8152600481018590525f9081906001600160a01b03851690631c53c28090602401608060405180830381865afa15801561058d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105b19190610f51565b50604051632ab4fd0160e21b8152600481018a905291945092505f91506001600160a01b0387169063aad3f4049060240161014060405180830381865afa1580156105fe573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106229190610fd2565b90508188858151811061063757610637611057565b60209081029190910101516001600160a01b03909116905260c0810151885189908690811061066857610668611057565b60200260200101516020018181525050805f015188858151811061068e5761068e611057565b6020908102919091010151604001525090945050600101610539565b505050935093915050565b60605f846001600160a01b0316631e2231436040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106f4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107189190610f0d565b90505f5b84811015610795576040516307aba33d60e01b8152600481018390526001600160a01b038716906307aba33d90602401602060405180830381865afa158015610767573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061078b9190610f0d565b915060010161071c565b50826001600160401b038111156107ae576107ae610f24565b6040519080825280602002602001820160405280156107e757816020015b6107d4610c42565b8152602001906001900390816107cc5790505b5091505f5b8381101561088957610818878385848151811061080b5761080b611057565b6020026020010151610a5a565b6040516307aba33d60e01b8152600481018390526001600160a01b038716906307aba33d90602401602060405180830381865afa15801561085b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061087f9190610f0d565b91506001016107ec565b5050949350505050565b60605f846001600160a01b0316634d6228316040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108d2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108f69190610f0d565b90505f5b848110156109735760405163040de97d60e21b8152600481018390526001600160a01b03871690631037a5f490602401602060405180830381865afa158015610945573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109699190610f0d565b91506001016108fa565b50826001600160401b0381111561098c5761098c610f24565b6040519080825280602002602001820160405280156109c557816020015b6109b2610c42565b8152602001906001900390816109aa5790505b5091505f5b83811015610889576109e9878385848151811061080b5761080b611057565b60405163040de97d60e21b8152600481018390526001600160a01b03871690631037a5f490602401602060405180830381865afa158015610a2c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a509190610f0d565b91506001016109ca565b818152604051632ab4fd0160e21b8152600481018390525f906001600160a01b0385169063aad3f4049060240161014060405180830381865afa158015610aa3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ac79190610fd2565b80516020848101919091528101516040808501919091528082015160608086019190915282015160808086019190915282015160a08086019190915282015160c08086019190915282015160e08501526101008083015190850152610120808301519085015251632904486760e21b8152600481018590529091506001600160a01b0385169063a411219c9060240161014060405180830381865afa158015610b72573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b969190611086565b6101a08c01526001600160a01b039081166101808c01526001600160401b03939093166101608b015250506101408801939093525050604051630bac90b160e31b8152600481018790529087169250635d64858891506024016040805180830381865afa158015610c09573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c2d9190611120565b6101e08401526101c090920191909152505050565b6040518061020001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f6001600160a01b031681526020015f81526020015f81526020015f81525090565b5f805f60608486031215610cca575f80fd5b505081359360208301359350604090920135919050565b602080825282518282018190525f919060409081850190868401855b82811015610dc15781518051855286810151878601528581015186860152606080820151908601526080808201519086015260a0808201519086015260c0808201519086015260e080820151908601526101008082015190860152610120808201519086015261014080820151908601526101608082015190860152610180808201516001600160a01b0316908601526101a080820151908601526101c080820151908601526101e090810151908501526102009093019290850190600101610cfd565b5091979650505050505050565b604080825283518282018190525f9190606090818501906020808901865b83811015610e2257815180516001600160a01b031686528381015184870152870151878601529385019390820190600101610dec565b505050508093505050508260208301529392505050565b6001600160a01b0381168114610e4d575f80fd5b50565b5f60208284031215610e60575f80fd5b8151610e6b81610e39565b9392505050565b602080825260189082015277092dcecc2d8d2c840c6ded8d8c2e8cae4c2d840d2dcc8caf60431b604082015260600190565b634e487b7160e01b5f52600160045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b8082018281125f831280158216821582161715610eeb57610eeb610eb8565b505092915050565b5f600160ff1b8201610f0757610f07610eb8565b505f0390565b5f60208284031215610f1d575f80fd5b5051919050565b634e487b7160e01b5f52604160045260245ffd5b81810381811115610f4b57610f4b610eb8565b92915050565b5f805f8060808587031215610f64575f80fd5b84519350602085015192506040850151610f7d81610e39565b60608601519092508015158114610f92575f80fd5b939692955090935050565b60405161014081016001600160401b0381118282101715610fcc57634e487b7160e01b5f52604160045260245ffd5b60405290565b5f6101408284031215610fe3575f80fd5b610feb610f9d565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152506101208084015181830152508091505092915050565b634e487b7160e01b5f52603260045260245ffd5b80516001600160401b0381168114611081575f80fd5b919050565b5f805f805f805f805f806101408b8d0312156110a0575f80fd5b8a51995060208b0151985060408b0151975060608b0151600581106110c3575f80fd5b96506110d160808c0161106b565b95506110df60a08c0161106b565b94506110ed60c08c0161106b565b935060e08b015192506101008b015161110581610e39565b809250506101208b015190509295989b9194979a5092959850565b5f8060408385031215611131575f80fd5b50508051602090910151909290915056fea264697066735822122046ea5ea5dbf5002ffe715a0f680685546d550a7839ac9f0b348caa83dbea8e5864736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003580bdee01cd7e82c85b868479d5beab735116e4
-----Decoded View---------------
Arg [0] : _collateralRegistry (address): 0x3580BDeE01Cd7E82C85B868479d5bEab735116e4
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000003580bdee01cd7e82c85b868479d5beab735116e4
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 33 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.