编译器
0.8.17+commit.8df45f5f
文件 1 的 28:ActivePool.sol
pragma solidity 0.8.17;
import "./Interfaces/IActivePool.sol";
import "./Interfaces/ICollSurplusPool.sol";
import "./Dependencies/ICollateralToken.sol";
import "./Interfaces/ICdpManagerData.sol";
import "./Interfaces/IBorrowerOperations.sol";
import "./Dependencies/ERC3156FlashLender.sol";
import "./Dependencies/SafeERC20.sol";
import "./Dependencies/ReentrancyGuard.sol";
import "./Dependencies/AuthNoOwner.sol";
import "./Dependencies/BaseMath.sol";
import "./Dependencies/TwapWeightedObserver.sol";
import "./Dependencies/EbtcMath.sol";
contract ActivePool is
IActivePool,
ERC3156FlashLender,
ReentrancyGuard,
BaseMath,
AuthNoOwner,
TwapWeightedObserver
{
using SafeERC20 for IERC20;
string public constant NAME = "ActivePool";
address public immutable borrowerOperationsAddress;
address public immutable cdpManagerAddress;
address public immutable collSurplusPoolAddress;
address public immutable feeRecipientAddress;
uint256 internal systemCollShares;
uint256 internal systemDebt;
uint256 internal feeRecipientCollShares;
ICollateralToken public immutable collateral;
constructor(
address _borrowerOperationsAddress,
address _cdpManagerAddress,
address _collTokenAddress,
address _collSurplusAddress
) TwapWeightedObserver(0) {
borrowerOperationsAddress = _borrowerOperationsAddress;
cdpManagerAddress = _cdpManagerAddress;
collateral = ICollateralToken(_collTokenAddress);
collSurplusPoolAddress = _collSurplusAddress;
feeRecipientAddress = IBorrowerOperations(borrowerOperationsAddress).feeRecipientAddress();
address _authorityAddress = address(AuthNoOwner(cdpManagerAddress).authority());
if (_authorityAddress != address(0)) {
_initializeAuthority(_authorityAddress);
}
require(systemDebt == 0, "ActivePool: systemDebt should be 0 for TWAP initialization");
}
function getSystemCollShares() external view override returns (uint256) {
return systemCollShares;
}
function getSystemDebt() external view override returns (uint256) {
return systemDebt;
}
function getFeeRecipientClaimableCollShares() external view override returns (uint256) {
return feeRecipientCollShares;
}
function transferSystemCollShares(address _account, uint256 _shares) public override {
_requireCallerIsBOorCdpM();
uint256 cachedSystemCollShares = systemCollShares;
require(cachedSystemCollShares >= _shares, "!ActivePoolBal");
unchecked {
cachedSystemCollShares -= _shares;
}
systemCollShares = cachedSystemCollShares;
emit SystemCollSharesUpdated(cachedSystemCollShares);
emit CollSharesTransferred(_account, _shares);
_transferCollSharesWithContractHooks(_account, _shares);
}
function transferSystemCollSharesAndLiquidatorReward(
address _account,
uint256 _shares,
uint256 _liquidatorRewardShares
) external override {
_requireCallerIsBOorCdpM();
uint256 cachedSystemCollShares = systemCollShares;
require(cachedSystemCollShares >= _shares, "ActivePool: Insufficient collateral shares");
uint256 totalShares = _shares + _liquidatorRewardShares;
unchecked {
cachedSystemCollShares -= _shares;
}
systemCollShares = cachedSystemCollShares;
emit SystemCollSharesUpdated(cachedSystemCollShares);
emit CollSharesTransferred(_account, totalShares);
_transferCollSharesWithContractHooks(_account, totalShares);
}
function allocateSystemCollSharesToFeeRecipient(uint256 _shares) external override {
_requireCallerIsCdpManager();
uint256 cachedSystemCollShares = systemCollShares;
require(cachedSystemCollShares >= _shares, "ActivePool: Insufficient collateral shares");
unchecked {
cachedSystemCollShares -= _shares;
}
systemCollShares = cachedSystemCollShares;
uint256 cachedFeeRecipientCollShares = feeRecipientCollShares + _shares;
feeRecipientCollShares = cachedFeeRecipientCollShares;
emit SystemCollSharesUpdated(cachedSystemCollShares);
emit FeeRecipientClaimableCollSharesIncreased(cachedFeeRecipientCollShares, _shares);
}
function _transferCollSharesWithContractHooks(address _account, uint256 _shares) internal {
collateral.transferShares(_account, _shares);
if (_account == collSurplusPoolAddress) {
ICollSurplusPool(_account).increaseTotalSurplusCollShares(_shares);
}
}
function increaseSystemDebt(uint256 _amount) external override {
_requireCallerIsBOorCdpM();
uint256 cachedSystemDebt = systemDebt + _amount;
uint128 castedSystemDebt = EbtcMath.toUint128(cachedSystemDebt);
if (!twapDisabled) {
try this.setValueAndUpdate(castedSystemDebt) {} catch {
twapDisabled = true;
emit TwapDisabled();
}
}
systemDebt = cachedSystemDebt;
emit ActivePoolEBTCDebtUpdated(cachedSystemDebt);
}
function decreaseSystemDebt(uint256 _amount) external override {
_requireCallerIsBOorCdpM();
uint256 cachedSystemDebt = systemDebt - _amount;
uint128 castedSystemDebt = EbtcMath.toUint128(cachedSystemDebt);
if (!twapDisabled) {
try this.setValueAndUpdate(EbtcMath.toUint128(castedSystemDebt)) {} catch {
twapDisabled = true;
emit TwapDisabled();
}
}
systemDebt = cachedSystemDebt;
emit ActivePoolEBTCDebtUpdated(cachedSystemDebt);
}
function _requireCallerIsBorrowerOperations() internal view {
require(
msg.sender == borrowerOperationsAddress,
"ActivePool: Caller is not BorrowerOperations"
);
}
function _requireCallerIsBOorCdpM() internal view {
require(
msg.sender == borrowerOperationsAddress || msg.sender == cdpManagerAddress,
"ActivePool: Caller is neither BorrowerOperations nor CdpManager"
);
}
function _requireCallerIsCdpManager() internal view {
require(msg.sender == cdpManagerAddress, "ActivePool: Caller is not CdpManager");
}
function increaseSystemCollShares(uint256 _value) external override {
_requireCallerIsBorrowerOperations();
uint256 cachedSystemCollShares = systemCollShares + _value;
systemCollShares = cachedSystemCollShares;
emit SystemCollSharesUpdated(cachedSystemCollShares);
}
function flashLoan(
IERC3156FlashBorrower receiver,
address token,
uint256 amount,
bytes calldata data
) external override returns (bool) {
require(amount > 0, "ActivePool: 0 Amount");
uint256 fee = flashFee(token, amount);
require(amount <= maxFlashLoan(token), "ActivePool: Too much");
uint256 amountWithFee = amount + fee;
uint256 oldRate = collateral.getPooledEthByShares(DECIMAL_PRECISION);
collateral.transfer(address(receiver), amount);
require(
receiver.onFlashLoan(msg.sender, token, amount, fee, data) == FLASH_SUCCESS_VALUE,
"ActivePool: IERC3156: Callback failed"
);
collateral.transferFrom(address(receiver), address(this), amountWithFee);
collateral.transfer(feeRecipientAddress, fee);
require(
collateral.balanceOf(address(this)) >= collateral.getPooledEthByShares(systemCollShares),
"ActivePool: Must repay Balance"
);
require(
collateral.sharesOf(address(this)) >= systemCollShares,
"ActivePool: Must repay Share"
);
require(
collateral.getPooledEthByShares(DECIMAL_PRECISION) == oldRate,
"ActivePool: Should keep same collateral share rate"
);
emit FlashLoanSuccess(address(receiver), token, amount, fee);
return true;
}
function flashFee(address token, uint256 amount) public view override returns (uint256) {
require(token == address(collateral), "ActivePool: collateral Only");
require(!flashLoansPaused, "ActivePool: Flash Loans Paused");
return (amount * feeBps) / MAX_BPS;
}
function maxFlashLoan(address token) public view override returns (uint256) {
if (token != address(collateral)) {
return 0;
}
if (flashLoansPaused) {
return 0;
}
return collateral.balanceOf(address(this));
}
function claimFeeRecipientCollShares(uint256 _shares) external override requiresAuth {
ICdpManagerData(cdpManagerAddress).syncGlobalAccountingAndGracePeriod();
uint256 cachedFeeRecipientCollShares = feeRecipientCollShares;
require(
cachedFeeRecipientCollShares >= _shares,
"ActivePool: Insufficient fee recipient coll"
);
unchecked {
cachedFeeRecipientCollShares -= _shares;
}
feeRecipientCollShares = cachedFeeRecipientCollShares;
emit FeeRecipientClaimableCollSharesDecreased(cachedFeeRecipientCollShares, _shares);
collateral.transferShares(feeRecipientAddress, _shares);
}
function sweepToken(address token, uint256 amount) public nonReentrant requiresAuth {
ICdpManagerData(cdpManagerAddress).syncGlobalAccountingAndGracePeriod();
require(token != address(collateral), "ActivePool: Cannot Sweep Collateral");
uint256 balance = IERC20(token).balanceOf(address(this));
require(amount <= balance, "ActivePool: Attempt to sweep more than balance");
address cachedFeeRecipientAddress = feeRecipientAddress;
IERC20(token).safeTransfer(cachedFeeRecipientAddress, amount);
emit SweepTokenSuccess(token, amount, cachedFeeRecipientAddress);
}
function setFeeBps(uint256 _newFee) external requiresAuth {
ICdpManagerData(cdpManagerAddress).syncGlobalAccountingAndGracePeriod();
require(_newFee <= MAX_FEE_BPS, "ERC3156FlashLender: _newFee should <= MAX_FEE_BPS");
uint256 _oldFee = feeBps;
feeBps = uint16(_newFee);
emit FlashFeeSet(msg.sender, _oldFee, _newFee);
}
function setFlashLoansPaused(bool _paused) external requiresAuth {
ICdpManagerData(cdpManagerAddress).syncGlobalAccountingAndGracePeriod();
flashLoansPaused = _paused;
emit FlashLoansPaused(msg.sender, _paused);
}
}
文件 2 的 28:Address.sol
pragma solidity 0.8.17;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
文件 3 的 28:AuthNoOwner.sol
pragma solidity 0.8.17;
import {Authority} from "./Authority.sol";
contract AuthNoOwner {
event AuthorityUpdated(address indexed user, Authority indexed newAuthority);
Authority private _authority;
bool private _authorityInitialized;
modifier requiresAuth() virtual {
require(isAuthorized(msg.sender, msg.sig), "Auth: UNAUTHORIZED");
_;
}
function authority() public view returns (Authority) {
return _authority;
}
function authorityInitialized() public view returns (bool) {
return _authorityInitialized;
}
function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {
Authority auth = _authority;
return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig));
}
function _initializeAuthority(address newAuthority) internal {
require(address(_authority) == address(0), "Auth: authority is non-zero");
require(!_authorityInitialized, "Auth: authority already initialized");
_authority = Authority(newAuthority);
_authorityInitialized = true;
emit AuthorityUpdated(address(this), Authority(newAuthority));
}
}
文件 4 的 28:Authority.sol
pragma solidity 0.8.17;
interface Authority {
function canCall(address user, address target, bytes4 functionSig) external view returns (bool);
}
文件 5 的 28:BaseMath.sol
pragma solidity 0.8.17;
contract BaseMath {
uint256 public constant DECIMAL_PRECISION = 1e18;
}
文件 6 的 28:ERC3156FlashLender.sol
pragma solidity 0.8.17;
import "../Interfaces/IERC3156FlashLender.sol";
import "../Interfaces/IWETH.sol";
abstract contract ERC3156FlashLender is IERC3156FlashLender {
uint256 public constant MAX_BPS = 10_000;
uint256 public constant MAX_FEE_BPS = 1_000;
bytes32 public constant FLASH_SUCCESS_VALUE = keccak256("ERC3156FlashBorrower.onFlashLoan");
uint16 public feeBps = 3;
bool public flashLoansPaused;
}
文件 7 的 28:EbtcMath.sol
pragma solidity 0.8.17;
library EbtcMath {
uint256 internal constant DECIMAL_PRECISION = 1e18;
uint256 public constant MAX_TCR = type(uint256).max;
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;
}
function toUint128(uint256 value) internal pure returns (uint128) {
require(value <= type(uint128).max, "EbtcMath: downcast to uint128 will overflow");
return uint128(value);
}
function decMul(uint256 x, uint256 y) internal pure returns (uint256 decProd) {
uint256 prod_xy = x * y;
decProd = (prod_xy + (DECIMAL_PRECISION / 2)) / DECIMAL_PRECISION;
}
function _decPow(uint256 _base, uint256 _minutes) internal pure returns (uint256) {
if (_minutes > 525600000) {
_minutes = 525600000;
}
if (_minutes == 0) {
return DECIMAL_PRECISION;
}
uint256 y = DECIMAL_PRECISION;
uint256 x = _base;
uint256 n = _minutes;
while (n > 1) {
if (n % 2 == 0) {
x = decMul(x, x);
n = n / 2;
} else {
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 _collShares, uint256 _debt) internal pure returns (uint256) {
if (_debt > 0) {
return (_collShares * NICR_PRECISION) / _debt;
}
else {
return MAX_TCR;
}
}
function _computeCR(
uint256 _stEthBalance,
uint256 _debt,
uint256 _price
) internal pure returns (uint256) {
if (_debt > 0) {
uint256 newCollRatio = (_stEthBalance * _price) / _debt;
return newCollRatio;
}
else {
return MAX_TCR;
}
}
}
文件 8 的 28:IActivePool.sol
pragma solidity 0.8.17;
import "./IPool.sol";
import "./ITwapWeightedObserver.sol";
interface IActivePool is IPool, ITwapWeightedObserver {
event ActivePoolEBTCDebtUpdated(uint256 _EBTCDebt);
event SystemCollSharesUpdated(uint256 _coll);
event FeeRecipientClaimableCollSharesIncreased(uint256 _coll, uint256 _fee);
event FeeRecipientClaimableCollSharesDecreased(uint256 _coll, uint256 _fee);
event FlashLoanSuccess(
address indexed _receiver,
address indexed _token,
uint256 _amount,
uint256 _fee
);
event SweepTokenSuccess(address indexed _token, uint256 _amount, address indexed _recipient);
function transferSystemCollShares(address _account, uint256 _amount) external;
function increaseSystemCollShares(uint256 _value) external;
function transferSystemCollSharesAndLiquidatorReward(
address _account,
uint256 _shares,
uint256 _liquidatorRewardShares
) external;
function allocateSystemCollSharesToFeeRecipient(uint256 _shares) external;
function claimFeeRecipientCollShares(uint256 _shares) external;
function feeRecipientAddress() external view returns (address);
function getFeeRecipientClaimableCollShares() external view returns (uint256);
}
文件 9 的 28:IBaseTwapWeightedObserver.sol
pragma solidity 0.8.17;
interface IBaseTwapWeightedObserver {
struct PackedData {
uint128 observerCumuVal;
uint128 accumulator;
uint64 lastObserved;
uint64 lastAccrued;
uint128 lastObservedAverage;
}
}
文件 10 的 28:IBorrowerOperations.sol
pragma solidity 0.8.17;
import "./IPositionManagers.sol";
interface IBorrowerOperations is IPositionManagers {
event FeeRecipientAddressChanged(address indexed _feeRecipientAddress);
event FlashLoanSuccess(
address indexed _receiver,
address indexed _token,
uint256 _amount,
uint256 _fee
);
function openCdp(
uint256 _EBTCAmount,
bytes32 _upperHint,
bytes32 _lowerHint,
uint256 _stEthBalance
) external returns (bytes32);
function openCdpFor(
uint _EBTCAmount,
bytes32 _upperHint,
bytes32 _lowerHint,
uint _collAmount,
address _borrower
) external returns (bytes32);
function addColl(
bytes32 _cdpId,
bytes32 _upperHint,
bytes32 _lowerHint,
uint256 _stEthBalanceIncrease
) external;
function withdrawColl(
bytes32 _cdpId,
uint256 _stEthBalanceDecrease,
bytes32 _upperHint,
bytes32 _lowerHint
) external;
function withdrawDebt(
bytes32 _cdpId,
uint256 _amount,
bytes32 _upperHint,
bytes32 _lowerHint
) external;
function repayDebt(
bytes32 _cdpId,
uint256 _amount,
bytes32 _upperHint,
bytes32 _lowerHint
) external;
function closeCdp(bytes32 _cdpId) external;
function adjustCdp(
bytes32 _cdpId,
uint256 _stEthBalanceDecrease,
uint256 _debtChange,
bool isDebtIncrease,
bytes32 _upperHint,
bytes32 _lowerHint
) external;
function adjustCdpWithColl(
bytes32 _cdpId,
uint256 _stEthBalanceDecrease,
uint256 _debtChange,
bool isDebtIncrease,
bytes32 _upperHint,
bytes32 _lowerHint,
uint256 _stEthBalanceIncrease
) external;
function claimSurplusCollShares() external;
function feeRecipientAddress() external view returns (address);
}
文件 11 的 28:ICdpManagerData.sol
pragma solidity 0.8.17;
import "./ICollSurplusPool.sol";
import "./IEBTCToken.sol";
import "./ISortedCdps.sol";
import "./IActivePool.sol";
import "./IRecoveryModeGracePeriod.sol";
import "../Dependencies/ICollateralTokenOracle.sol";
interface ICdpManagerData is IRecoveryModeGracePeriod {
event StakingRewardSplitSet(uint256 _stakingRewardSplit);
event RedemptionFeeFloorSet(uint256 _redemptionFeeFloor);
event MinuteDecayFactorSet(uint256 _minuteDecayFactor);
event BetaSet(uint256 _beta);
event RedemptionsPaused(bool _paused);
event Liquidation(uint256 _liquidatedDebt, uint256 _liquidatedColl, uint256 _liqReward);
event Redemption(
uint256 _debtToRedeemExpected,
uint256 _debtToRedeemActual,
uint256 _collSharesSent,
uint256 _feeCollShares,
address indexed _redeemer
);
event CdpUpdated(
bytes32 indexed _cdpId,
address indexed _borrower,
address indexed _executor,
uint256 _oldDebt,
uint256 _oldCollShares,
uint256 _debt,
uint256 _collShares,
uint256 _stake,
CdpOperation _operation
);
event CdpLiquidated(
bytes32 indexed _cdpId,
address indexed _borrower,
uint _debt,
uint _collShares,
CdpOperation _operation,
address indexed _liquidator,
uint _premiumToLiquidator
);
event CdpPartiallyLiquidated(
bytes32 indexed _cdpId,
address indexed _borrower,
uint256 _debt,
uint256 _collShares,
CdpOperation operation,
address indexed _liquidator,
uint _premiumToLiquidator
);
event BaseRateUpdated(uint256 _baseRate);
event LastRedemptionTimestampUpdated(uint256 _lastFeeOpTime);
event TotalStakesUpdated(uint256 _newTotalStakes);
event SystemSnapshotsUpdated(uint256 _totalStakesSnapshot, uint256 _totalCollateralSnapshot);
event SystemDebtRedistributionIndexUpdated(uint256 _systemDebtRedistributionIndex);
event CdpDebtRedistributionIndexUpdated(bytes32 _cdpId, uint256 _cdpDebtRedistributionIndex);
event CdpArrayIndexUpdated(bytes32 _cdpId, uint256 _newIndex);
event StEthIndexUpdated(uint256 _oldIndex, uint256 _newIndex, uint256 _updTimestamp);
event CollateralFeePerUnitUpdated(uint256 _oldPerUnit, uint256 _newPerUnit, uint256 _feeTaken);
event CdpFeeSplitApplied(
bytes32 _cdpId,
uint256 _oldPerUnitCdp,
uint256 _newPerUnitCdp,
uint256 _collReduced,
uint256 _collLeft
);
enum CdpOperation {
openCdp,
closeCdp,
adjustCdp,
syncAccounting,
liquidateInNormalMode,
liquidateInRecoveryMode,
redeemCollateral,
partiallyLiquidate,
failedPartialRedemption
}
enum Status {
nonExistent,
active,
closedByOwner,
closedByLiquidation,
closedByRedemption
}
struct Cdp {
uint256 debt;
uint256 coll;
uint256 stake;
uint128 liquidatorRewardShares;
Status status;
}
struct CdpDebtAndCollShares {
uint256 debt;
uint256 collShares;
}
struct LiquidationLocals {
bytes32 cdpId;
uint256 partialAmount;
uint256 price;
uint256 ICR;
bytes32 upperPartialHint;
bytes32 lowerPartialHint;
bool recoveryModeAtStart;
uint256 TCR;
uint256 totalSurplusCollShares;
uint256 totalCollSharesToSend;
uint256 totalDebtToBurn;
uint256 totalDebtToRedistribute;
uint256 totalLiquidatorRewardCollShares;
}
struct LiquidationRecoveryModeLocals {
uint256 entireSystemDebt;
uint256 entireSystemColl;
uint256 totalDebtToBurn;
uint256 totalCollSharesToSend;
uint256 totalSurplusCollShares;
bytes32 cdpId;
uint256 price;
uint256 ICR;
uint256 totalDebtToRedistribute;
uint256 totalLiquidatorRewardCollShares;
}
struct LocalVariables_OuterLiquidationFunction {
uint256 price;
bool recoveryModeAtStart;
uint256 liquidatedDebt;
uint256 liquidatedColl;
}
struct LocalVariables_LiquidationSequence {
uint256 i;
uint256 ICR;
bytes32 cdpId;
bool backToNormalMode;
uint256 entireSystemDebt;
uint256 entireSystemColl;
uint256 price;
uint256 TCR;
}
struct SingleRedemptionInputs {
bytes32 cdpId;
uint256 maxEBTCamount;
uint256 price;
bytes32 upperPartialRedemptionHint;
bytes32 lowerPartialRedemptionHint;
uint256 partialRedemptionHintNICR;
}
struct LiquidationValues {
uint256 entireCdpDebt;
uint256 debtToBurn;
uint256 totalCollToSendToLiquidator;
uint256 debtToRedistribute;
uint256 collSurplus;
uint256 liquidatorCollSharesReward;
}
struct LiquidationTotals {
uint256 totalDebtInSequence;
uint256 totalDebtToBurn;
uint256 totalCollToSendToLiquidator;
uint256 totalDebtToRedistribute;
uint256 totalCollSurplus;
uint256 totalCollReward;
}
struct RedemptionTotals {
uint256 remainingDebtToRedeem;
uint256 debtToRedeem;
uint256 collSharesDrawn;
uint256 totalCollSharesSurplus;
uint256 feeCollShares;
uint256 collSharesToRedeemer;
uint256 decayedBaseRate;
uint256 price;
uint256 systemDebtAtStart;
uint256 twapSystemDebtAtStart;
uint256 systemCollSharesAtStart;
uint256 tcrAtStart;
}
struct SingleRedemptionValues {
uint256 debtToRedeem;
uint256 collSharesDrawn;
uint256 collSurplus;
uint256 liquidatorRewardShares;
bool cancelledPartial;
bool fullRedemption;
uint256 newPartialNICR;
}
function getActiveCdpsCount() external view returns (uint256);
function totalStakes() external view returns (uint256);
function ebtcToken() external view returns (IEBTCToken);
function systemStEthFeePerUnitIndex() external view returns (uint256);
function systemStEthFeePerUnitIndexError() external view returns (uint256);
function stEthIndex() external view returns (uint256);
function calcFeeUponStakingReward(
uint256 _newIndex,
uint256 _prevIndex
) external view returns (uint256, uint256, uint256);
function syncGlobalAccounting() external;
function syncGlobalAccountingAndGracePeriod() external;
function getAccumulatedFeeSplitApplied(
bytes32 _cdpId,
uint256 _systemStEthFeePerUnitIndex
) external view returns (uint256, uint256);
function getCachedNominalICR(bytes32 _cdpId) external view returns (uint256);
function getCachedICR(bytes32 _cdpId, uint256 _price) external view returns (uint256);
function getSyncedCdpDebt(bytes32 _cdpId) external view returns (uint256);
function getSyncedCdpCollShares(bytes32 _cdpId) external view returns (uint256);
function getSyncedICR(bytes32 _cdpId, uint256 _price) external view returns (uint256);
function getSyncedTCR(uint256 _price) external view returns (uint256);
function getSyncedSystemCollShares() external view returns (uint256);
function getSyncedNominalICR(bytes32 _cdpId) external view returns (uint256);
function getPendingRedistributedDebt(bytes32 _cdpId) external view returns (uint256);
function hasPendingRedistributedDebt(bytes32 _cdpId) external view returns (bool);
function getSyncedDebtAndCollShares(
bytes32 _cdpId
) external view returns (uint256 debt, uint256 collShares);
function canLiquidateRecoveryMode(uint256 icr, uint256 tcr) external view returns (bool);
function totalCollateralSnapshot() external view returns (uint256);
function totalStakesSnapshot() external view returns (uint256);
}
文件 12 的 28:ICollSurplusPool.sol
pragma solidity 0.8.17;
interface ICollSurplusPool {
event SurplusCollSharesAdded(
bytes32 indexed _cdpId,
address indexed _account,
uint256 _claimableSurplusCollShares,
uint256 _surplusCollSharesAddedFromCollateral,
uint256 _surplusCollSharesAddedFromLiquidatorReward
);
event CollSharesTransferred(address indexed _to, uint256 _amount);
event SweepTokenSuccess(address indexed _token, uint256 _amount, address indexed _recipient);
function getTotalSurplusCollShares() external view returns (uint256);
function getSurplusCollShares(address _account) external view returns (uint256);
function increaseSurplusCollShares(
bytes32 _cdpId,
address _account,
uint256 _collateralShares,
uint256 _liquidatorRewardShares
) external;
function claimSurplusCollShares(address _account) external;
function increaseTotalSurplusCollShares(uint256 _value) external;
}
文件 13 的 28:ICollateralToken.sol
pragma solidity 0.8.17;
import "./IERC20.sol";
interface ICollateralToken is IERC20 {
function getSharesByPooledEth(uint256 _ethAmount) external view returns (uint256);
function getPooledEthByShares(uint256 _sharesAmount) external view returns (uint256);
function transferShares(address _recipient, uint256 _sharesAmount) external returns (uint256);
function sharesOf(address _account) external view returns (uint256);
function getOracle() external view returns (address);
}
文件 14 的 28:ICollateralTokenOracle.sol
pragma solidity 0.8.17;
interface ICollateralTokenOracle {
function getBeaconSpec()
external
view
returns (
uint64 epochsPerFrame,
uint64 slotsPerEpoch,
uint64 secondsPerSlot,
uint64 genesisTime
);
}
文件 15 的 28:IEBTCToken.sol
pragma solidity 0.8.17;
import "../Dependencies/IERC20.sol";
import "../Dependencies/IERC2612.sol";
interface IEBTCToken is IERC20, IERC2612 {
function mint(address _account, uint256 _amount) external;
function burn(address _account, uint256 _amount) external;
}
文件 16 的 28:IERC20.sol
pragma solidity 0.8.17;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
文件 17 的 28:IERC2612.sol
pragma solidity 0.8.17;
interface IERC2612 {
function permit(
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function version() external view returns (string memory);
function permitTypeHash() external view returns (bytes32);
function domainSeparator() external view returns (bytes32);
}
文件 18 的 28:IERC3156FlashBorrower.sol
pragma solidity 0.8.17;
interface IERC3156FlashBorrower {
function onFlashLoan(
address initiator,
address token,
uint256 amount,
uint256 fee,
bytes calldata data
) external returns (bytes32);
}
文件 19 的 28:IERC3156FlashLender.sol
pragma solidity 0.8.17;
import "./IERC3156FlashBorrower.sol";
interface IERC3156FlashLender {
event FlashFeeSet(address indexed _setter, uint256 _oldFee, uint256 _newFee);
event MaxFlashFeeSet(address indexed _setter, uint256 _oldMaxFee, uint256 _newMaxFee);
event FlashLoansPaused(address indexed _setter, bool _paused);
function maxFlashLoan(address token) external view returns (uint256);
function flashFee(address token, uint256 amount) external view returns (uint256);
function flashLoan(
IERC3156FlashBorrower receiver,
address token,
uint256 amount,
bytes calldata data
) external returns (bool);
}
文件 20 的 28:IPool.sol
pragma solidity 0.8.17;
interface IPool {
event ETHBalanceUpdated(uint256 _newBalance);
event EBTCBalanceUpdated(uint256 _newBalance);
event CollSharesTransferred(address indexed _to, uint256 _amount);
function getSystemCollShares() external view returns (uint256);
function getSystemDebt() external view returns (uint256);
function increaseSystemDebt(uint256 _amount) external;
function decreaseSystemDebt(uint256 _amount) external;
}
文件 21 的 28:IPositionManagers.sol
pragma solidity 0.8.17;
interface IPositionManagers {
enum PositionManagerApproval {
None,
OneTime,
Persistent
}
event PositionManagerApprovalSet(
address indexed _borrower,
address indexed _positionManager,
PositionManagerApproval _approval
);
function getPositionManagerApproval(
address _borrower,
address _positionManager
) external view returns (PositionManagerApproval);
function setPositionManagerApproval(
address _positionManager,
PositionManagerApproval _approval
) external;
function revokePositionManagerApproval(address _positionManager) external;
function renouncePositionManagerApproval(address _borrower) external;
function permitPositionManagerApproval(
address _borrower,
address _positionManager,
PositionManagerApproval _approval,
uint _deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function version() external view returns (string memory);
function permitTypeHash() external view returns (bytes32);
function domainSeparator() external view returns (bytes32);
}
文件 22 的 28:IRecoveryModeGracePeriod.sol
pragma solidity 0.8.17;
interface IRecoveryModeGracePeriod {
event TCRNotified(uint256 TCR);
event GracePeriodStart();
event GracePeriodEnd();
event GracePeriodDurationSet(uint256 _recoveryModeGracePeriodDuration);
function notifyStartGracePeriod(uint256 tcr) external;
function notifyEndGracePeriod(uint256 tcr) external;
}
文件 23 的 28:ISortedCdps.sol
pragma solidity 0.8.17;
interface ISortedCdps {
event NodeAdded(bytes32 _id, uint _NICR);
event NodeRemoved(bytes32 _id);
function remove(bytes32 _id) external;
function batchRemove(bytes32[] memory _ids) external;
function reInsert(bytes32 _id, uint256 _newICR, bytes32 _prevId, bytes32 _nextId) external;
function contains(bytes32 _id) external view returns (bool);
function isFull() external view returns (bool);
function isEmpty() external view returns (bool);
function getSize() external view returns (uint256);
function getMaxSize() external view returns (uint256);
function getFirst() external view returns (bytes32);
function getLast() external view returns (bytes32);
function getNext(bytes32 _id) external view returns (bytes32);
function getPrev(bytes32 _id) external view returns (bytes32);
function validInsertPosition(
uint256 _ICR,
bytes32 _prevId,
bytes32 _nextId
) external view returns (bool);
function findInsertPosition(
uint256 _ICR,
bytes32 _prevId,
bytes32 _nextId
) external view returns (bytes32, bytes32);
function insert(
address owner,
uint256 _ICR,
bytes32 _prevId,
bytes32 _nextId
) external returns (bytes32);
function getOwnerAddress(bytes32 _id) external pure returns (address);
function nonExistId() external view returns (bytes32);
function cdpCountOf(address owner) external view returns (uint256);
function getCdpCountOf(
address owner,
bytes32 startNodeId,
uint maxNodes
) external view returns (uint256, bytes32);
function getCdpsOf(address owner) external view returns (bytes32[] memory);
function getAllCdpsOf(
address owner,
bytes32 startNodeId,
uint maxNodes
) external view returns (bytes32[] memory, uint256, bytes32);
function cdpOfOwnerByIndex(address owner, uint256 index) external view returns (bytes32);
function cdpOfOwnerByIdx(
address owner,
uint256 index,
bytes32 startNodeId,
uint maxNodes
) external view returns (bytes32, bool);
function toCdpId(
address owner,
uint256 blockHeight,
uint256 nonce
) external pure returns (bytes32);
function nextCdpNonce() external view returns (uint256);
}
文件 24 的 28:ITwapWeightedObserver.sol
pragma solidity 0.8.17;
import {IBaseTwapWeightedObserver} from "./IBaseTwapWeightedObserver.sol";
interface ITwapWeightedObserver is IBaseTwapWeightedObserver {
event TwapDisabled();
function PERIOD() external view returns (uint256);
function valueToTrack() external view returns (uint128);
function timeToAccrue() external view returns (uint64);
function getLatestAccumulator() external view returns (uint128);
function observe() external returns (uint256);
function update() external;
function twapDisabled() external view returns (bool);
}
文件 25 的 28:IWETH.sol
pragma solidity 0.8.17;
interface IWETH {
function deposit() external payable;
function withdraw(uint256) external;
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
文件 26 的 28:ReentrancyGuard.sol
pragma solidity 0.8.17;
abstract contract ReentrancyGuard {
uint256 internal constant OPEN = 1;
uint256 internal constant LOCKED = 2;
uint256 public locked = OPEN;
modifier nonReentrant() virtual {
require(locked == OPEN, "ReentrancyGuard: Reentrancy in nonReentrant call");
locked = LOCKED;
_;
locked = OPEN;
}
}
文件 27 的 28:SafeERC20.sol
pragma solidity 0.8.17;
import "./IERC20.sol";
import "./Address.sol";
library SafeERC20 {
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 amount) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, amount));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(
data,
"SafeERC20: low-level call failed"
);
require(
returndata.length == 0 || abi.decode(returndata, (bool)),
"SafeERC20: ERC20 operation did not succeed"
);
}
}
文件 28 的 28:TwapWeightedObserver.sol
pragma solidity 0.8.17;
import {ITwapWeightedObserver} from "../Interfaces/ITwapWeightedObserver.sol";
contract TwapWeightedObserver is ITwapWeightedObserver {
PackedData public data;
uint128 public valueToTrack;
bool public twapDisabled;
constructor(uint128 initialValue) {
PackedData memory cachedData = PackedData({
observerCumuVal: initialValue,
accumulator: initialValue,
lastObserved: uint64(block.timestamp),
lastAccrued: uint64(block.timestamp),
lastObservedAverage: initialValue
});
valueToTrack = initialValue;
data = cachedData;
}
event NewTrackValue(uint256 _oldValue, uint256 _newValue, uint256 _ts, uint256 _newAcc);
function _setValue(uint128 newValue) internal {
uint128 _newAcc = _updateAcc(valueToTrack);
data.lastAccrued = uint64(block.timestamp);
emit NewTrackValue(valueToTrack, newValue, block.timestamp, _newAcc);
valueToTrack = newValue;
}
function _updateAcc(uint128 oldValue) internal returns (uint128) {
uint128 _newAcc = data.accumulator + oldValue * (timeToAccrue());
data.accumulator = _newAcc;
return _newAcc;
}
function timeToAccrue() public view returns (uint64) {
return uint64(block.timestamp) - data.lastAccrued;
}
function _syncToNow() internal view returns (uint128) {
return data.accumulator + (valueToTrack * (timeToAccrue()));
}
function getLatestAccumulator() public view returns (uint128) {
return _syncToNow();
}
uint256 public constant PERIOD = 7 days;
function observe() external returns (uint256) {
uint256 futureWeight = block.timestamp - data.lastObserved;
if (futureWeight == 0) {
return data.lastObservedAverage;
}
(uint128 virtualAvgValue, uint128 obsAcc) = _calcUpdatedAvg();
if (_checkUpdatePeriod()) {
_update(virtualAvgValue, obsAcc);
return virtualAvgValue;
}
uint256 weightedAvg = uint256(data.lastObservedAverage) *
(uint256(PERIOD) - uint256(futureWeight));
uint256 weightedVirtual = uint256(virtualAvgValue) * (uint256(futureWeight));
uint256 weightedMean = (weightedAvg + weightedVirtual) / PERIOD;
return weightedMean;
}
function _calcUpdatedAvg() internal view returns (uint128, uint128) {
uint128 latestAcc = getLatestAccumulator();
uint128 avgValue = (latestAcc - data.observerCumuVal) /
(uint64(block.timestamp) - data.lastObserved);
return (avgValue, latestAcc);
}
function _update(uint128 avgValue, uint128 obsAcc) internal {
data.lastObservedAverage = avgValue;
data.observerCumuVal = obsAcc;
data.lastObserved = uint64(block.timestamp);
}
function _checkUpdatePeriod() internal returns (bool) {
return block.timestamp >= (data.lastObserved + PERIOD);
}
function update() public {
if (_checkUpdatePeriod()) {
(uint128 avgValue, uint128 latestAcc) = _calcUpdatedAvg();
_update(avgValue, latestAcc);
}
}
function setValueAndUpdate(uint128 value) external {
require(msg.sender == address(this), "TwapWeightedObserver: Only self call");
_setValue(value);
update();
}
function getData() external view returns (PackedData memory) {
return data;
}
}
{
"compilationTarget": {
"contracts/ActivePool.sol": "ActivePool"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_borrowerOperationsAddress","type":"address"},{"internalType":"address","name":"_cdpManagerAddress","type":"address"},{"internalType":"address","name":"_collTokenAddress","type":"address"},{"internalType":"address","name":"_collSurplusAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_EBTCDebt","type":"uint256"}],"name":"ActivePoolEBTCDebtUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"contract Authority","name":"newAuthority","type":"address"}],"name":"AuthorityUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"CollSharesTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_newBalance","type":"uint256"}],"name":"EBTCBalanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_newBalance","type":"uint256"}],"name":"ETHBalanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_coll","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"FeeRecipientClaimableCollSharesDecreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_coll","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"FeeRecipientClaimableCollSharesIncreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_setter","type":"address"},{"indexed":false,"internalType":"uint256","name":"_oldFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"FlashFeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_receiver","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"FlashLoanSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_setter","type":"address"},{"indexed":false,"internalType":"bool","name":"_paused","type":"bool"}],"name":"FlashLoansPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_setter","type":"address"},{"indexed":false,"internalType":"uint256","name":"_oldMaxFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newMaxFee","type":"uint256"}],"name":"MaxFlashFeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_oldValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_ts","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newAcc","type":"uint256"}],"name":"NewTrackValue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"}],"name":"SweepTokenSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_coll","type":"uint256"}],"name":"SystemCollSharesUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"TwapDisabled","type":"event"},{"inputs":[],"name":"DECIMAL_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FLASH_SUCCESS_VALUE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_FEE_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"allocateSystemCollSharesToFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"authority","outputs":[{"internalType":"contract Authority","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"authorityInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowerOperationsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cdpManagerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"claimFeeRecipientCollShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collSurplusPoolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateral","outputs":[{"internalType":"contract ICollateralToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"data","outputs":[{"internalType":"uint128","name":"observerCumuVal","type":"uint128"},{"internalType":"uint128","name":"accumulator","type":"uint128"},{"internalType":"uint64","name":"lastObserved","type":"uint64"},{"internalType":"uint64","name":"lastAccrued","type":"uint64"},{"internalType":"uint128","name":"lastObservedAverage","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"decreaseSystemDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeBps","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRecipientAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"flashFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC3156FlashBorrower","name":"receiver","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flashLoan","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flashLoansPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getData","outputs":[{"components":[{"internalType":"uint128","name":"observerCumuVal","type":"uint128"},{"internalType":"uint128","name":"accumulator","type":"uint128"},{"internalType":"uint64","name":"lastObserved","type":"uint64"},{"internalType":"uint64","name":"lastAccrued","type":"uint64"},{"internalType":"uint128","name":"lastObservedAverage","type":"uint128"}],"internalType":"struct IBaseTwapWeightedObserver.PackedData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeRecipientClaimableCollShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestAccumulator","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSystemCollShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSystemDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"increaseSystemCollShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"increaseSystemDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"maxFlashLoan","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"observe","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"setFeeBps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setFlashLoansPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"value","type":"uint128"}],"name":"setValueAndUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sweepToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timeToAccrue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"transferSystemCollShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"uint256","name":"_liquidatorRewardShares","type":"uint256"}],"name":"transferSystemCollSharesAndLiquidatorReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"twapDisabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"valueToTrack","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"}]