Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 658 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Redeem Collatera... | 19851603 | 54 days ago | IN | 0 ETH | 0.0014675 | ||||
Redeem Collatera... | 19851573 | 54 days ago | IN | 0 ETH | 0.0014819 | ||||
Redeem Collatera... | 19851557 | 54 days ago | IN | 0 ETH | 0.00186118 | ||||
Redeem Collatera... | 19851539 | 54 days ago | IN | 0 ETH | 0.00178078 | ||||
Redeem Collatera... | 19654019 | 81 days ago | IN | 0 ETH | 0.00541937 | ||||
Redeem Collatera... | 19637150 | 84 days ago | IN | 0 ETH | 0.00506781 | ||||
Redeem Collatera... | 19560161 | 94 days ago | IN | 0 ETH | 0.00916759 | ||||
Redeem Collatera... | 19560137 | 94 days ago | IN | 0 ETH | 0.00855113 | ||||
Redeem Collatera... | 19300293 | 131 days ago | IN | 0 ETH | 0.01228859 | ||||
Redeem Collatera... | 19235758 | 140 days ago | IN | 0 ETH | 0.0164727 | ||||
Redeem Collatera... | 18996458 | 174 days ago | IN | 0 ETH | 0.006574 | ||||
Redeem Collatera... | 18994336 | 174 days ago | IN | 0 ETH | 0.00704264 | ||||
Redeem Collatera... | 18989693 | 175 days ago | IN | 0 ETH | 0.00798866 | ||||
Redeem Collatera... | 18964812 | 178 days ago | IN | 0 ETH | 0.01496115 | ||||
Redeem Collatera... | 18961139 | 179 days ago | IN | 0 ETH | 0.00986542 | ||||
Redeem Collatera... | 18961115 | 179 days ago | IN | 0 ETH | 0.00828478 | ||||
Redeem Collatera... | 18947709 | 180 days ago | IN | 0 ETH | 0.00565454 | ||||
Redeem Collatera... | 18947688 | 180 days ago | IN | 0 ETH | 0.00623347 | ||||
Redeem Collatera... | 18939928 | 182 days ago | IN | 0 ETH | 0.00546573 | ||||
Redeem Collatera... | 18922133 | 184 days ago | IN | 0 ETH | 0.01059408 | ||||
Redeem Collatera... | 18893770 | 188 days ago | IN | 0 ETH | 0.01036273 | ||||
Redeem Collatera... | 18862344 | 192 days ago | IN | 0 ETH | 0.01020346 | ||||
Redeem Collatera... | 18861382 | 193 days ago | IN | 0 ETH | 0.00837553 | ||||
Redeem Collatera... | 18858238 | 193 days ago | IN | 0 ETH | 0.00850699 | ||||
Redeem Collatera... | 18850328 | 194 days ago | IN | 0 ETH | 0.01386901 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
TroveManager
Compiler Version
v0.8.14+commit.80d49f37
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./Interfaces/ITroveManager.sol"; import "./Dependencies/DfrancBase.sol"; import "./Dependencies/CheckContract.sol"; import "./Dependencies/Initializable.sol"; import "./Interfaces/ITroveManagerHelpers.sol"; contract TroveManager is DfrancBase, CheckContract, Initializable, ITroveManager { using SafeMath for uint256; string public constant NAME = "TroveManager"; // --- Connected contract declarations --- ITroveManagerHelpers public troveManagerHelpers; IStabilityPoolManager public stabilityPoolManager; address gasPoolAddress; ICollSurplusPool collSurplusPool; IDCHFToken public override dchfToken; IMONStaking public override monStaking; // A doubly linked list of Troves, sorted by their sorted by their collateral ratios ISortedTroves public sortedTroves; // --- Data structures --- bool public isInitialized; mapping(address => bool) public redemptionWhitelist; bool public isRedemptionWhitelisted; // Internal Function and Modifier onlyBorrowerOperations // @dev This workaround was needed in order to reduce bytecode size modifier troveIsActive(address _asset, address _borrower) { require(troveManagerHelpers.isTroveActive(_asset, _borrower), "IT"); _; } // --- Dependency setter --- function setAddresses( address _stabilityPoolManagerAddress, address _gasPoolAddress, address _collSurplusPoolAddress, address _dchfTokenAddress, address _sortedTrovesAddress, address _monStakingAddress, address _dfrancParamsAddress, address _troveManagerHelpersAddress ) external override initializer { require(!isInitialized, "AI"); checkContract(_stabilityPoolManagerAddress); checkContract(_gasPoolAddress); checkContract(_collSurplusPoolAddress); checkContract(_dchfTokenAddress); checkContract(_sortedTrovesAddress); checkContract(_monStakingAddress); checkContract(_dfrancParamsAddress); checkContract(_troveManagerHelpersAddress); isInitialized = true; stabilityPoolManager = IStabilityPoolManager(_stabilityPoolManagerAddress); gasPoolAddress = _gasPoolAddress; collSurplusPool = ICollSurplusPool(_collSurplusPoolAddress); dchfToken = IDCHFToken(_dchfTokenAddress); sortedTroves = ISortedTroves(_sortedTrovesAddress); monStaking = IMONStaking(_monStakingAddress); troveManagerHelpers = ITroveManagerHelpers(_troveManagerHelpersAddress); setDfrancParameters(_dfrancParamsAddress); } // --- Trove Getter functions --- function isContractTroveManager() public pure returns (bool) { return true; } // --- Trove Liquidation functions --- // Single liquidation function. Closes the trove if its ICR is lower than the minimum collateral ratio. function liquidate(address _asset, address _borrower) external override troveIsActive(_asset, _borrower) { address[] memory borrowers = new address[](1); borrowers[0] = _borrower; batchLiquidateTroves(_asset, borrowers); } // --- Inner single liquidation functions --- // Liquidate one trove, in Normal Mode. function _liquidateNormalMode( address _asset, IActivePool _activePool, IDefaultPool _defaultPool, address _borrower, uint256 _DCHFInStabPool ) internal returns (LiquidationValues memory singleLiquidation) { LocalVariables_InnerSingleLiquidateFunction memory vars; ( singleLiquidation.entireTroveDebt, singleLiquidation.entireTroveColl, vars.pendingDebtReward, vars.pendingCollReward ) = troveManagerHelpers.getEntireDebtAndColl(_asset, _borrower); troveManagerHelpers.movePendingTroveRewardsToActivePool( _asset, _activePool, _defaultPool, vars.pendingDebtReward, vars.pendingCollReward ); troveManagerHelpers.removeStake(_asset, _borrower); singleLiquidation.collGasCompensation = _getCollGasCompensation( _asset, singleLiquidation.entireTroveColl ); singleLiquidation.DCHFGasCompensation = dfrancParams.DCHF_GAS_COMPENSATION(_asset); uint256 collToLiquidate = singleLiquidation.entireTroveColl.sub( singleLiquidation.collGasCompensation ); ( singleLiquidation.debtToOffset, singleLiquidation.collToSendToSP, singleLiquidation.debtToRedistribute, singleLiquidation.collToRedistribute ) = _getOffsetAndRedistributionVals( singleLiquidation.entireTroveDebt, collToLiquidate, _DCHFInStabPool ); troveManagerHelpers.closeTrove( _asset, _borrower, ITroveManagerHelpers.Status.closedByLiquidation ); emit TroveLiquidated( _asset, _borrower, singleLiquidation.entireTroveDebt, singleLiquidation.entireTroveColl, TroveManagerOperation.liquidateInNormalMode ); emit TroveUpdated(_asset, _borrower, 0, 0, 0, TroveManagerOperation.liquidateInNormalMode); return singleLiquidation; } // Liquidate one trove, in Recovery Mode. function _liquidateRecoveryMode( address _asset, IActivePool _activePool, IDefaultPool _defaultPool, address _borrower, uint256 _ICR, uint256 _DCHFInStabPool, uint256 _TCR, uint256 _price ) internal returns (LiquidationValues memory singleLiquidation) { LocalVariables_InnerSingleLiquidateFunction memory vars; if (troveManagerHelpers.getTroveOwnersCount(_asset) <= 1) { return singleLiquidation; } // don't liquidate if last trove ( singleLiquidation.entireTroveDebt, singleLiquidation.entireTroveColl, vars.pendingDebtReward, vars.pendingCollReward ) = troveManagerHelpers.getEntireDebtAndColl(_asset, _borrower); singleLiquidation.collGasCompensation = _getCollGasCompensation( _asset, singleLiquidation.entireTroveColl ); singleLiquidation.DCHFGasCompensation = dfrancParams.DCHF_GAS_COMPENSATION(_asset); vars.collToLiquidate = singleLiquidation.entireTroveColl.sub( singleLiquidation.collGasCompensation ); // If ICR <= 100%, purely redistribute the Trove across all active Troves if (_ICR <= dfrancParams._100pct()) { troveManagerHelpers.movePendingTroveRewardsToActivePool( _asset, _activePool, _defaultPool, vars.pendingDebtReward, vars.pendingCollReward ); troveManagerHelpers.removeStake(_asset, _borrower); singleLiquidation.debtToOffset = 0; singleLiquidation.collToSendToSP = 0; singleLiquidation.debtToRedistribute = singleLiquidation.entireTroveDebt; singleLiquidation.collToRedistribute = vars.collToLiquidate; troveManagerHelpers.closeTrove( _asset, _borrower, ITroveManagerHelpers.Status.closedByLiquidation ); emit TroveLiquidated( _asset, _borrower, singleLiquidation.entireTroveDebt, singleLiquidation.entireTroveColl, TroveManagerOperation.liquidateInRecoveryMode ); emit TroveUpdated( _asset, _borrower, 0, 0, 0, TroveManagerOperation.liquidateInRecoveryMode ); // If 100% < ICR < MCR, offset as much as possible, and redistribute the remainder } else if ((_ICR > dfrancParams._100pct()) && (_ICR < dfrancParams.MCR(_asset))) { troveManagerHelpers.movePendingTroveRewardsToActivePool( _asset, _activePool, _defaultPool, vars.pendingDebtReward, vars.pendingCollReward ); troveManagerHelpers.removeStake(_asset, _borrower); ( singleLiquidation.debtToOffset, singleLiquidation.collToSendToSP, singleLiquidation.debtToRedistribute, singleLiquidation.collToRedistribute ) = _getOffsetAndRedistributionVals( singleLiquidation.entireTroveDebt, vars.collToLiquidate, _DCHFInStabPool ); troveManagerHelpers.closeTrove( _asset, _borrower, ITroveManagerHelpers.Status.closedByLiquidation ); emit TroveLiquidated( _asset, _borrower, singleLiquidation.entireTroveDebt, singleLiquidation.entireTroveColl, TroveManagerOperation.liquidateInRecoveryMode ); emit TroveUpdated( _asset, _borrower, 0, 0, 0, TroveManagerOperation.liquidateInRecoveryMode ); /* * If 110% <= ICR < current TCR (accounting for the preceding liquidations in the current sequence) * and there is DCHF in the Stability Pool, only offset, with no redistribution, * but at a capped rate of 1.1 and only if the whole debt can be liquidated. * The remainder due to the capped rate will be claimable as collateral surplus. */ } else if ( (_ICR >= dfrancParams.MCR(_asset)) && (_ICR < _TCR) && (singleLiquidation.entireTroveDebt <= _DCHFInStabPool) ) { troveManagerHelpers.movePendingTroveRewardsToActivePool( _asset, _activePool, _defaultPool, vars.pendingDebtReward, vars.pendingCollReward ); assert(_DCHFInStabPool != 0); troveManagerHelpers.removeStake(_asset, _borrower); singleLiquidation = _getCappedOffsetVals( _asset, singleLiquidation.entireTroveDebt, singleLiquidation.entireTroveColl, _price ); troveManagerHelpers.closeTrove( _asset, _borrower, ITroveManagerHelpers.Status.closedByLiquidation ); if (singleLiquidation.collSurplus > 0) { collSurplusPool.accountSurplus(_asset, _borrower, singleLiquidation.collSurplus); } emit TroveLiquidated( _asset, _borrower, singleLiquidation.entireTroveDebt, singleLiquidation.collToSendToSP, TroveManagerOperation.liquidateInRecoveryMode ); emit TroveUpdated( _asset, _borrower, 0, 0, 0, TroveManagerOperation.liquidateInRecoveryMode ); } else { // if (_ICR >= MCR && ( _ICR >= _TCR || singleLiquidation.entireTroveDebt > _DCHFInStabPool)) LiquidationValues memory zeroVals; return zeroVals; } return singleLiquidation; } /* In a full liquidation, returns the values for a trove's coll and debt to be offset, and coll and debt to be * redistributed to active troves. */ function _getOffsetAndRedistributionVals( uint256 _debt, uint256 _coll, uint256 _DCHFInStabPool ) internal pure returns ( uint256 debtToOffset, uint256 collToSendToSP, uint256 debtToRedistribute, uint256 collToRedistribute ) { if (_DCHFInStabPool > 0) { /* * Offset as much debt & collateral as possible against the Stability Pool, and redistribute the remainder * between all active troves. * * If the trove's debt is larger than the deposited DCHF in the Stability Pool: * * - Offset an amount of the trove's debt equal to the DCHF in the Stability Pool * - Send a fraction of the trove's collateral to the Stability Pool, equal to the fraction of its offset debt * */ debtToOffset = DfrancMath._min(_debt, _DCHFInStabPool); collToSendToSP = _coll.mul(debtToOffset).div(_debt); debtToRedistribute = _debt.sub(debtToOffset); collToRedistribute = _coll.sub(collToSendToSP); } else { debtToOffset = 0; collToSendToSP = 0; debtToRedistribute = _debt; collToRedistribute = _coll; } } /* * Get its offset coll/debt and ETH gas comp, and close the trove. */ function _getCappedOffsetVals( address _asset, uint256 _entireTroveDebt, uint256 _entireTroveColl, uint256 _price ) internal view returns (LiquidationValues memory singleLiquidation) { singleLiquidation.entireTroveDebt = _entireTroveDebt; singleLiquidation.entireTroveColl = _entireTroveColl; uint256 cappedCollPortion = _entireTroveDebt.mul(dfrancParams.MCR(_asset)).div(_price); singleLiquidation.collGasCompensation = _getCollGasCompensation(_asset, cappedCollPortion); singleLiquidation.DCHFGasCompensation = dfrancParams.DCHF_GAS_COMPENSATION(_asset); singleLiquidation.debtToOffset = _entireTroveDebt; singleLiquidation.collToSendToSP = cappedCollPortion.sub( singleLiquidation.collGasCompensation ); singleLiquidation.collSurplus = _entireTroveColl.sub(cappedCollPortion); singleLiquidation.debtToRedistribute = 0; singleLiquidation.collToRedistribute = 0; } /* * Liquidate a sequence of troves. Closes a maximum number of n under-collateralized Troves, * starting from the one with the lowest collateral ratio in the system, and moving upwards */ function liquidateTroves(address _asset, uint256 _n) external override { ContractsCache memory contractsCache = ContractsCache( dfrancParams.activePool(), dfrancParams.defaultPool(), IDCHFToken(address(0)), IMONStaking(address(0)), sortedTroves, ICollSurplusPool(address(0)), address(0) ); IStabilityPool stabilityPoolCached = stabilityPoolManager.getAssetStabilityPool(_asset); LocalVariables_OuterLiquidationFunction memory vars; LiquidationTotals memory totals; vars.price = dfrancParams.priceFeed().fetchPrice(_asset); vars.DCHFInStabPool = stabilityPoolCached.getTotalDCHFDeposits(); vars.recoveryModeAtStart = troveManagerHelpers.checkRecoveryMode(_asset, vars.price); // Perform the appropriate liquidation sequence - tally the values, and obtain their totals if (vars.recoveryModeAtStart) { totals = _getTotalsFromLiquidateTrovesSequence_RecoveryMode( _asset, contractsCache, vars.price, vars.DCHFInStabPool, _n ); } else { // if !vars.recoveryModeAtStart totals = _getTotalsFromLiquidateTrovesSequence_NormalMode( _asset, contractsCache.activePool, contractsCache.defaultPool, vars.price, vars.DCHFInStabPool, _n ); } require(totals.totalDebtInSequence > 0, "0L"); // Move liquidated ETH and DCHF to the appropriate pools stabilityPoolCached.offset(totals.totalDebtToOffset, totals.totalCollToSendToSP); troveManagerHelpers.redistributeDebtAndColl( _asset, contractsCache.activePool, contractsCache.defaultPool, totals.totalDebtToRedistribute, totals.totalCollToRedistribute ); if (totals.totalCollSurplus > 0) { contractsCache.activePool.sendAsset( _asset, address(collSurplusPool), totals.totalCollSurplus ); } // Update system snapshots troveManagerHelpers.updateSystemSnapshots_excludeCollRemainder( _asset, contractsCache.activePool, totals.totalCollGasCompensation ); vars.liquidatedDebt = totals.totalDebtInSequence; vars.liquidatedColl = totals.totalCollInSequence.sub(totals.totalCollGasCompensation).sub( totals.totalCollSurplus ); emit Liquidation( _asset, vars.liquidatedDebt, vars.liquidatedColl, totals.totalCollGasCompensation, totals.totalDCHFGasCompensation ); // Send gas compensation to caller _sendGasCompensation( _asset, contractsCache.activePool, msg.sender, totals.totalDCHFGasCompensation, totals.totalCollGasCompensation ); } /* * This function is used when the liquidateTroves sequence starts during Recovery Mode. However, it * handle the case where the system *leaves* Recovery Mode, part way through the liquidation sequence */ function _getTotalsFromLiquidateTrovesSequence_RecoveryMode( address _asset, ContractsCache memory _contractsCache, uint256 _price, uint256 _DCHFInStabPool, uint256 _n ) internal returns (LiquidationTotals memory totals) { LocalVariables_AssetBorrowerPrice memory assetVars = LocalVariables_AssetBorrowerPrice( _asset, address(0), _price ); LocalVariables_LiquidationSequence memory vars; LiquidationValues memory singleLiquidation; vars.remainingDCHFInStabPool = _DCHFInStabPool; vars.backToNormalMode = false; vars.entireSystemDebt = getEntireSystemDebt(assetVars._asset); vars.entireSystemColl = getEntireSystemColl(assetVars._asset); vars.user = _contractsCache.sortedTroves.getLast(assetVars._asset); address firstUser = _contractsCache.sortedTroves.getFirst(assetVars._asset); for (vars.i = 0; vars.i < _n && vars.user != firstUser; vars.i++) { // we need to cache it, because current user is likely going to be deleted address nextUser = _contractsCache.sortedTroves.getPrev(assetVars._asset, vars.user); vars.ICR = troveManagerHelpers.getCurrentICR( assetVars._asset, vars.user, assetVars._price ); if (!vars.backToNormalMode) { // Break the loop if ICR is greater than MCR and Stability Pool is empty if (vars.ICR >= dfrancParams.MCR(_asset) && vars.remainingDCHFInStabPool == 0) { break; } uint256 TCR = DfrancMath._computeCR( vars.entireSystemColl, vars.entireSystemDebt, assetVars._price ); singleLiquidation = _liquidateRecoveryMode( assetVars._asset, _contractsCache.activePool, _contractsCache.defaultPool, vars.user, vars.ICR, vars.remainingDCHFInStabPool, TCR, assetVars._price ); // Update aggregate trackers vars.remainingDCHFInStabPool = vars.remainingDCHFInStabPool.sub( singleLiquidation.debtToOffset ); vars.entireSystemDebt = vars.entireSystemDebt.sub(singleLiquidation.debtToOffset); vars.entireSystemColl = vars .entireSystemColl .sub(singleLiquidation.collToSendToSP) .sub(singleLiquidation.collGasCompensation) .sub(singleLiquidation.collSurplus); // Add liquidation values to their respective running totals totals = _addLiquidationValuesToTotals(totals, singleLiquidation); vars.backToNormalMode = !troveManagerHelpers._checkPotentialRecoveryMode( _asset, vars.entireSystemColl, vars.entireSystemDebt, assetVars._price ); } else if (vars.backToNormalMode && vars.ICR < dfrancParams.MCR(_asset)) { singleLiquidation = _liquidateNormalMode( assetVars._asset, _contractsCache.activePool, _contractsCache.defaultPool, vars.user, vars.remainingDCHFInStabPool ); vars.remainingDCHFInStabPool = vars.remainingDCHFInStabPool.sub( singleLiquidation.debtToOffset ); // Add liquidation values to their respective running totals totals = _addLiquidationValuesToTotals(totals, singleLiquidation); } else break; // break if the loop reaches a Trove with ICR >= MCR vars.user = nextUser; } } function _getTotalsFromLiquidateTrovesSequence_NormalMode( address _asset, IActivePool _activePool, IDefaultPool _defaultPool, uint256 _price, uint256 _DCHFInStabPool, uint256 _n ) internal returns (LiquidationTotals memory totals) { LocalVariables_LiquidationSequence memory vars; LiquidationValues memory singleLiquidation; ISortedTroves sortedTrovesCached = sortedTroves; vars.remainingDCHFInStabPool = _DCHFInStabPool; for (vars.i = 0; vars.i < _n; vars.i++) { vars.user = sortedTrovesCached.getLast(_asset); vars.ICR = troveManagerHelpers.getCurrentICR(_asset, vars.user, _price); if (vars.ICR < dfrancParams.MCR(_asset)) { singleLiquidation = _liquidateNormalMode( _asset, _activePool, _defaultPool, vars.user, vars.remainingDCHFInStabPool ); vars.remainingDCHFInStabPool = vars.remainingDCHFInStabPool.sub( singleLiquidation.debtToOffset ); // Add liquidation values to their respective running totals totals = _addLiquidationValuesToTotals(totals, singleLiquidation); } else break; // break if the loop reaches a Trove with ICR >= MCR } } /* * Attempt to liquidate a custom list of troves provided by the caller. */ function batchLiquidateTroves(address _asset, address[] memory _troveArray) public override { require(_troveArray.length != 0, "CA"); IActivePool activePoolCached = dfrancParams.activePool(); IDefaultPool defaultPoolCached = dfrancParams.defaultPool(); IStabilityPool stabilityPoolCached = stabilityPoolManager.getAssetStabilityPool(_asset); LocalVariables_OuterLiquidationFunction memory vars; LiquidationTotals memory totals; vars.DCHFInStabPool = stabilityPoolCached.getTotalDCHFDeposits(); vars.price = dfrancParams.priceFeed().fetchPrice(_asset); vars.recoveryModeAtStart = _checkRecoveryMode(_asset, vars.price); // Perform the appropriate liquidation sequence - tally values and obtain their totals. if (vars.recoveryModeAtStart) { totals = _getTotalFromBatchLiquidate_RecoveryMode( _asset, activePoolCached, defaultPoolCached, vars.price, vars.DCHFInStabPool, _troveArray ); } else { // if !vars.recoveryModeAtStart totals = _getTotalsFromBatchLiquidate_NormalMode( _asset, activePoolCached, defaultPoolCached, vars.price, vars.DCHFInStabPool, _troveArray ); } require(totals.totalDebtInSequence > 0, "0L"); // Move liquidated ETH and DCHF to the appropriate pools stabilityPoolCached.offset(totals.totalDebtToOffset, totals.totalCollToSendToSP); troveManagerHelpers.redistributeDebtAndColl( _asset, activePoolCached, defaultPoolCached, totals.totalDebtToRedistribute, totals.totalCollToRedistribute ); if (totals.totalCollSurplus > 0) { activePoolCached.sendAsset(_asset, address(collSurplusPool), totals.totalCollSurplus); } // Update system snapshots troveManagerHelpers.updateSystemSnapshots_excludeCollRemainder( _asset, activePoolCached, totals.totalCollGasCompensation ); vars.liquidatedDebt = totals.totalDebtInSequence; vars.liquidatedColl = totals.totalCollInSequence.sub(totals.totalCollGasCompensation).sub( totals.totalCollSurplus ); emit Liquidation( _asset, vars.liquidatedDebt, vars.liquidatedColl, totals.totalCollGasCompensation, totals.totalDCHFGasCompensation ); // Send gas compensation to caller _sendGasCompensation( _asset, activePoolCached, msg.sender, totals.totalDCHFGasCompensation, totals.totalCollGasCompensation ); } /* * This function is used when the batch liquidation sequence starts during Recovery Mode. However, it * handle the case where the system *leaves* Recovery Mode, part way through the liquidation sequence */ function _getTotalFromBatchLiquidate_RecoveryMode( address _asset, IActivePool _activePool, IDefaultPool _defaultPool, uint256 _price, uint256 _DCHFInStabPool, address[] memory _troveArray ) internal returns (LiquidationTotals memory totals) { LocalVariables_LiquidationSequence memory vars; LiquidationValues memory singleLiquidation; vars.remainingDCHFInStabPool = _DCHFInStabPool; vars.backToNormalMode = false; vars.entireSystemDebt = getEntireSystemDebt(_asset); vars.entireSystemColl = getEntireSystemColl(_asset); for (vars.i = 0; vars.i < _troveArray.length; vars.i++) { vars.user = _troveArray[vars.i]; // Skip non-active troves if (troveManagerHelpers.getTroveStatus(_asset, vars.user) != 1) { continue; } vars.ICR = troveManagerHelpers.getCurrentICR(_asset, vars.user, _price); if (!vars.backToNormalMode) { // Skip this trove if ICR is greater than MCR and Stability Pool is empty if (vars.ICR >= dfrancParams.MCR(_asset) && vars.remainingDCHFInStabPool == 0) { continue; } uint256 TCR = DfrancMath._computeCR( vars.entireSystemColl, vars.entireSystemDebt, _price ); singleLiquidation = _liquidateRecoveryMode( _asset, _activePool, _defaultPool, vars.user, vars.ICR, vars.remainingDCHFInStabPool, TCR, _price ); // Update aggregate trackers vars.remainingDCHFInStabPool = vars.remainingDCHFInStabPool.sub( singleLiquidation.debtToOffset ); vars.entireSystemDebt = vars.entireSystemDebt.sub(singleLiquidation.debtToOffset); vars.entireSystemColl = vars .entireSystemColl .sub(singleLiquidation.collToSendToSP) .sub(singleLiquidation.collGasCompensation) .sub(singleLiquidation.collSurplus); // Add liquidation values to their respective running totals totals = _addLiquidationValuesToTotals(totals, singleLiquidation); vars.backToNormalMode = !troveManagerHelpers._checkPotentialRecoveryMode( _asset, vars.entireSystemColl, vars.entireSystemDebt, _price ); } else if (vars.backToNormalMode && vars.ICR < dfrancParams.MCR(_asset)) { singleLiquidation = _liquidateNormalMode( _asset, _activePool, _defaultPool, vars.user, vars.remainingDCHFInStabPool ); vars.remainingDCHFInStabPool = vars.remainingDCHFInStabPool.sub( singleLiquidation.debtToOffset ); // Add liquidation values to their respective running totals totals = _addLiquidationValuesToTotals(totals, singleLiquidation); } else continue; // In Normal Mode skip troves with ICR >= MCR } } function _getTotalsFromBatchLiquidate_NormalMode( address _asset, IActivePool _activePool, IDefaultPool _defaultPool, uint256 _price, uint256 _DCHFInStabPool, address[] memory _troveArray ) internal returns (LiquidationTotals memory totals) { LocalVariables_LiquidationSequence memory vars; LiquidationValues memory singleLiquidation; vars.remainingDCHFInStabPool = _DCHFInStabPool; for (vars.i = 0; vars.i < _troveArray.length; vars.i++) { vars.user = _troveArray[vars.i]; vars.ICR = troveManagerHelpers.getCurrentICR(_asset, vars.user, _price); if (vars.ICR < dfrancParams.MCR(_asset)) { singleLiquidation = _liquidateNormalMode( _asset, _activePool, _defaultPool, vars.user, vars.remainingDCHFInStabPool ); vars.remainingDCHFInStabPool = vars.remainingDCHFInStabPool.sub( singleLiquidation.debtToOffset ); // Add liquidation values to their respective running totals totals = _addLiquidationValuesToTotals(totals, singleLiquidation); } } } // --- Liquidation helper functions --- function _addLiquidationValuesToTotals( LiquidationTotals memory oldTotals, LiquidationValues memory singleLiquidation ) internal pure returns (LiquidationTotals memory newTotals) { // Tally all the values with their respective running totals newTotals.totalCollGasCompensation = oldTotals.totalCollGasCompensation.add( singleLiquidation.collGasCompensation ); newTotals.totalDCHFGasCompensation = oldTotals.totalDCHFGasCompensation.add( singleLiquidation.DCHFGasCompensation ); newTotals.totalDebtInSequence = oldTotals.totalDebtInSequence.add( singleLiquidation.entireTroveDebt ); newTotals.totalCollInSequence = oldTotals.totalCollInSequence.add( singleLiquidation.entireTroveColl ); newTotals.totalDebtToOffset = oldTotals.totalDebtToOffset.add( singleLiquidation.debtToOffset ); newTotals.totalCollToSendToSP = oldTotals.totalCollToSendToSP.add( singleLiquidation.collToSendToSP ); newTotals.totalDebtToRedistribute = oldTotals.totalDebtToRedistribute.add( singleLiquidation.debtToRedistribute ); newTotals.totalCollToRedistribute = oldTotals.totalCollToRedistribute.add( singleLiquidation.collToRedistribute ); newTotals.totalCollSurplus = oldTotals.totalCollSurplus.add(singleLiquidation.collSurplus); return newTotals; } function _sendGasCompensation( address _asset, IActivePool _activePool, address _liquidator, uint256 _DCHF, uint256 _ETH ) internal { if (_DCHF > 0) { dchfToken.returnFromPool(gasPoolAddress, _liquidator, _DCHF); } if (_ETH > 0) { _activePool.sendAsset(_asset, _liquidator, _ETH); } } // --- Redemption functions --- // Redeem as much collateral as possible from _borrower's Trove in exchange for DCHF up to _maxDCHFamount function _redeemCollateralFromTrove( address _asset, ContractsCache memory _contractsCache, address _borrower, uint256 _maxDCHFamount, uint256 _price, address _upperPartialRedemptionHint, address _lowerPartialRedemptionHint, uint256 _partialRedemptionHintNICR ) internal returns (SingleRedemptionValues memory singleRedemption) { LocalVariables_AssetBorrowerPrice memory vars = LocalVariables_AssetBorrowerPrice( _asset, _borrower, _price ); // Determine the remaining amount (lot) to be redeemed, capped by the entire debt of the Trove minus the liquidation reserve singleRedemption.DCHFLot = DfrancMath._min( _maxDCHFamount, troveManagerHelpers.getTroveDebt(vars._asset, vars._borrower).sub( dfrancParams.DCHF_GAS_COMPENSATION(_asset) ) ); // Get the ETHLot of equivalent value in USD singleRedemption.ETHLot = singleRedemption.DCHFLot.mul(DECIMAL_PRECISION).div(_price); // Decrease the debt and collateral of the current Trove according to the DCHF lot and corresponding ETH to send uint256 newDebt = (troveManagerHelpers.getTroveDebt(vars._asset, vars._borrower)).sub( singleRedemption.DCHFLot ); uint256 newColl = (troveManagerHelpers.getTroveColl(vars._asset, vars._borrower)).sub( singleRedemption.ETHLot ); if (newDebt == dfrancParams.DCHF_GAS_COMPENSATION(_asset)) { // No debt left in the Trove (except for the liquidation reserve), therefore the trove gets closed troveManagerHelpers.removeStake(vars._asset, vars._borrower); troveManagerHelpers.closeTrove( vars._asset, vars._borrower, ITroveManagerHelpers.Status.closedByRedemption ); _redeemCloseTrove( vars._asset, _contractsCache, vars._borrower, dfrancParams.DCHF_GAS_COMPENSATION(vars._asset), newColl ); emit TroveUpdated( vars._asset, vars._borrower, 0, 0, 0, TroveManagerOperation.redeemCollateral ); } else { uint256 newNICR = DfrancMath._computeNominalCR(newColl, newDebt); /* * If the provided hint is out of date, we bail since trying to reinsert without a good hint will almost * certainly result in running out of gas. * * If the resultant net debt of the partial is less than the minimum, net debt we bail. */ if ( newNICR != _partialRedemptionHintNICR || _getNetDebt(vars._asset, newDebt) < dfrancParams.MIN_NET_DEBT(vars._asset) ) { singleRedemption.cancelledPartial = true; return singleRedemption; } _contractsCache.sortedTroves.reInsert( vars._asset, vars._borrower, newNICR, _upperPartialRedemptionHint, _lowerPartialRedemptionHint ); troveManagerHelpers.setTroveDeptAndColl(vars._asset, vars._borrower, newDebt, newColl); troveManagerHelpers.updateStakeAndTotalStakes(vars._asset, vars._borrower); emit TroveUpdated( vars._asset, vars._borrower, newDebt, newColl, troveManagerHelpers.getTroveStake(vars._asset, vars._borrower), TroveManagerOperation.redeemCollateral ); } return singleRedemption; } /* * Called when a full redemption occurs, and closes the trove. * The redeemer swaps (debt - liquidation reserve) DCHF for (debt - liquidation reserve) worth of ETH, so the DCHF liquidation reserve left corresponds to the remaining debt. * In order to close the trove, the DCHF liquidation reserve is burned, and the corresponding debt is removed from the active pool. * The debt recorded on the trove's struct is zero'd elswhere, in _closeTrove. * Any surplus ETH left in the trove, is sent to the Coll surplus pool, and can be later claimed by the borrower. */ function _redeemCloseTrove( address _asset, ContractsCache memory _contractsCache, address _borrower, uint256 _DCHF, uint256 _ETH ) internal { _contractsCache.dchfToken.burn(gasPoolAddress, _DCHF); // Update Active Pool DCHF, and send ETH to account _contractsCache.activePool.decreaseDCHFDebt(_asset, _DCHF); // send ETH from Active Pool to CollSurplus Pool _contractsCache.collSurplusPool.accountSurplus(_asset, _borrower, _ETH); _contractsCache.activePool.sendAsset( _asset, address(_contractsCache.collSurplusPool), _ETH ); } function _isValidFirstRedemptionHint( address _asset, ISortedTroves _sortedTroves, address _firstRedemptionHint, uint256 _price ) internal view returns (bool) { if ( _firstRedemptionHint == address(0) || !_sortedTroves.contains(_asset, _firstRedemptionHint) || troveManagerHelpers.getCurrentICR(_asset, _firstRedemptionHint, _price) < dfrancParams.MCR(_asset) ) { return false; } address nextTrove = _sortedTroves.getNext(_asset, _firstRedemptionHint); return nextTrove == address(0) || troveManagerHelpers.getCurrentICR(_asset, nextTrove, _price) < dfrancParams.MCR(_asset); } function setRedemptionWhitelistStatus(bool _status) external onlyOwner { isRedemptionWhitelisted = _status; } function addUserToWhitelistRedemption(address _user) external onlyOwner { redemptionWhitelist[_user] = true; } function removeUserFromWhitelistRedemption(address _user) external onlyOwner { delete redemptionWhitelist[_user]; } /* Send _DCHFamount DCHF to the system and redeem the corresponding amount of collateral from as many Troves as are needed to fill the redemption * request. Applies pending rewards to a Trove before reducing its debt and coll. * * Note that if _amount is very large, this function can run out of gas, specially if traversed troves are small. This can be easily avoided by * splitting the total _amount in appropriate chunks and calling the function multiple times. * * Param `_maxIterations` can also be provided, so the loop through Troves is capped (if it’s zero, it will be ignored).This makes it easier to * avoid OOG for the frontend, as only knowing approximately the average cost of an iteration is enough, without needing to know the “topology” * of the trove list. It also avoids the need to set the cap in stone in the contract, nor doing gas calculations, as both gas price and opcode * costs can vary. * * All Troves that are redeemed from -- with the likely exception of the last one -- will end up with no debt left, therefore they will be closed. * If the last Trove does have some remaining debt, it has a finite ICR, and the reinsertion could be anywhere in the list, therefore it requires a hint. * A frontend should use getRedemptionHints() to calculate what the ICR of this Trove will be after redemption, and pass a hint for its position * in the sortedTroves list along with the ICR value that the hint was found for. * * If another transaction modifies the list between calling getRedemptionHints() and passing the hints to redeemCollateral(), it * is very likely that the last (partially) redeemed Trove would end up with a different ICR than what the hint is for. In this case the * redemption will stop after the last completely redeemed Trove and the sender will keep the remaining DCHF amount, which they can attempt * to redeem later. */ function redeemCollateral( address _asset, uint256 _DCHFamount, address _firstRedemptionHint, address _upperPartialRedemptionHint, address _lowerPartialRedemptionHint, uint256 _partialRedemptionHintNICR, uint256 _maxIterations, uint256 _maxFeePercentage ) external override { if (isRedemptionWhitelisted) { require(redemptionWhitelist[msg.sender], "NW"); } require(block.timestamp >= dfrancParams.redemptionBlock(_asset), "BR"); ContractsCache memory contractsCache = ContractsCache( dfrancParams.activePool(), dfrancParams.defaultPool(), dchfToken, monStaking, sortedTroves, collSurplusPool, gasPoolAddress ); RedemptionTotals memory totals; troveManagerHelpers._requireValidMaxFeePercentage(_asset, _maxFeePercentage); totals.price = dfrancParams.priceFeed().fetchPrice(_asset); troveManagerHelpers._requireTCRoverMCR(_asset, totals.price); troveManagerHelpers._requireAmountGreaterThanZero(_DCHFamount); troveManagerHelpers._requireDCHFBalanceCoversRedemption( contractsCache.dchfToken, msg.sender, _DCHFamount ); totals.totalDCHFSupplyAtStart = getEntireSystemDebt(_asset); totals.remainingDCHF = _DCHFamount; address currentBorrower; if ( _isValidFirstRedemptionHint( _asset, contractsCache.sortedTroves, _firstRedemptionHint, totals.price ) ) { currentBorrower = _firstRedemptionHint; } else { currentBorrower = contractsCache.sortedTroves.getLast(_asset); // Find the first trove with ICR >= MCR while ( currentBorrower != address(0) && troveManagerHelpers.getCurrentICR(_asset, currentBorrower, totals.price) < dfrancParams.MCR(_asset) ) { currentBorrower = contractsCache.sortedTroves.getPrev(_asset, currentBorrower); } } // Loop through the Troves starting from the one with lowest collateral ratio until _amount of DCHF is exchanged for collateral if (_maxIterations == 0) { _maxIterations = type(uint256).max; } while (currentBorrower != address(0) && totals.remainingDCHF > 0 && _maxIterations > 0) { _maxIterations--; // Save the address of the Trove preceding the current one, before potentially modifying the list address nextUserToCheck = contractsCache.sortedTroves.getPrev(_asset, currentBorrower); troveManagerHelpers.applyPendingRewards( _asset, contractsCache.activePool, contractsCache.defaultPool, currentBorrower ); SingleRedemptionValues memory singleRedemption = _redeemCollateralFromTrove( _asset, contractsCache, currentBorrower, totals.remainingDCHF, totals.price, _upperPartialRedemptionHint, _lowerPartialRedemptionHint, _partialRedemptionHintNICR ); if (singleRedemption.cancelledPartial) break; // Partial redemption was cancelled (out-of-date hint, or new net debt < minimum), therefore we could not redeem from the last Trove totals.totalDCHFToRedeem = totals.totalDCHFToRedeem.add(singleRedemption.DCHFLot); totals.totalAssetDrawn = totals.totalAssetDrawn.add(singleRedemption.ETHLot); totals.remainingDCHF = totals.remainingDCHF.sub(singleRedemption.DCHFLot); currentBorrower = nextUserToCheck; } require(totals.totalAssetDrawn > 0, "UR"); // Decay the baseRate due to time passed, and then increase it according to the size of this redemption. // Use the saved total DCHF supply value, from before it was reduced by the redemption. troveManagerHelpers.updateBaseRateFromRedemption( _asset, totals.totalAssetDrawn, totals.price, totals.totalDCHFSupplyAtStart ); // Calculate the ETH fee totals.ETHFee = troveManagerHelpers._getRedemptionFee(_asset, totals.totalAssetDrawn); _requireUserAcceptsFee(totals.ETHFee, totals.totalAssetDrawn, _maxFeePercentage); // Send the ETH fee to the MON staking contract contractsCache.activePool.sendAsset( _asset, address(contractsCache.monStaking), totals.ETHFee ); contractsCache.monStaking.increaseF_Asset(_asset, totals.ETHFee); totals.ETHToSendToRedeemer = totals.totalAssetDrawn.sub(totals.ETHFee); emit Redemption( _asset, _DCHFamount, totals.totalDCHFToRedeem, totals.totalAssetDrawn, totals.ETHFee ); // Burn the total DCHF that is cancelled with debt, and send the redeemed ETH to msg.sender contractsCache.dchfToken.burn(msg.sender, totals.totalDCHFToRedeem); // Update Active Pool DCHF, and send ETH to account contractsCache.activePool.decreaseDCHFDebt(_asset, totals.totalDCHFToRedeem); contractsCache.activePool.sendAsset(_asset, msg.sender, totals.ETHToSendToRedeemer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./IDfrancBase.sol"; import "./IStabilityPool.sol"; import "./IDCHFToken.sol"; import "./IMONStaking.sol"; import "./ICollSurplusPool.sol"; import "./ISortedTroves.sol"; import "./IActivePool.sol"; import "./IDefaultPool.sol"; import "./IStabilityPoolManager.sol"; import "./ITroveManagerHelpers.sol"; // Common interface for the Trove Manager. interface ITroveManager is IDfrancBase { enum Status { nonExistent, active, closedByOwner, closedByLiquidation, closedByRedemption } // Store the necessary data for a trove struct Trove { address asset; uint256 debt; uint256 coll; uint256 stake; Status status; uint128 arrayIndex; } /* * --- Variable container structs for liquidations --- * * These structs are used to hold, return and assign variables inside the liquidation functions, * in order to avoid the error: "CompilerError: Stack too deep". **/ struct LocalVariables_OuterLiquidationFunction { uint256 price; uint256 DCHFInStabPool; bool recoveryModeAtStart; uint256 liquidatedDebt; uint256 liquidatedColl; } struct LocalVariables_InnerSingleLiquidateFunction { uint256 collToLiquidate; uint256 pendingDebtReward; uint256 pendingCollReward; } struct LocalVariables_LiquidationSequence { uint256 remainingDCHFInStabPool; uint256 i; uint256 ICR; address user; bool backToNormalMode; uint256 entireSystemDebt; uint256 entireSystemColl; } struct LocalVariables_AssetBorrowerPrice { address _asset; address _borrower; uint256 _price; } struct LiquidationValues { uint256 entireTroveDebt; uint256 entireTroveColl; uint256 collGasCompensation; uint256 DCHFGasCompensation; uint256 debtToOffset; uint256 collToSendToSP; uint256 debtToRedistribute; uint256 collToRedistribute; uint256 collSurplus; } struct LiquidationTotals { uint256 totalCollInSequence; uint256 totalDebtInSequence; uint256 totalCollGasCompensation; uint256 totalDCHFGasCompensation; uint256 totalDebtToOffset; uint256 totalCollToSendToSP; uint256 totalDebtToRedistribute; uint256 totalCollToRedistribute; uint256 totalCollSurplus; } struct ContractsCache { IActivePool activePool; IDefaultPool defaultPool; IDCHFToken dchfToken; IMONStaking monStaking; ISortedTroves sortedTroves; ICollSurplusPool collSurplusPool; address gasPoolAddress; } // --- Variable container structs for redemptions --- struct RedemptionTotals { uint256 remainingDCHF; uint256 totalDCHFToRedeem; uint256 totalAssetDrawn; uint256 ETHFee; uint256 ETHToSendToRedeemer; uint256 decayedBaseRate; uint256 price; uint256 totalDCHFSupplyAtStart; } struct SingleRedemptionValues { uint256 DCHFLot; uint256 ETHLot; bool cancelledPartial; } // --- Events --- event Liquidation( address indexed _asset, uint256 _liquidatedDebt, uint256 _liquidatedColl, uint256 _collGasCompensation, uint256 _DCHFGasCompensation ); event Redemption( address indexed _asset, uint256 _attemptedDCHFAmount, uint256 _actualDCHFAmount, uint256 _AssetSent, uint256 _AssetFee ); event TroveUpdated( address indexed _asset, address indexed _borrower, uint256 _debt, uint256 _coll, uint256 stake, uint8 operation ); event TroveLiquidated( address indexed _asset, address indexed _borrower, uint256 _debt, uint256 _coll, uint8 operation ); event BaseRateUpdated(address indexed _asset, uint256 _baseRate); event LastFeeOpTimeUpdated(address indexed _asset, uint256 _lastFeeOpTime); event TotalStakesUpdated(address indexed _asset, uint256 _newTotalStakes); event SystemSnapshotsUpdated( address indexed _asset, uint256 _totalStakesSnapshot, uint256 _totalCollateralSnapshot ); event LTermsUpdated(address indexed _asset, uint256 _L_ETH, uint256 _L_DCHFDebt); event TroveSnapshotsUpdated(address indexed _asset, uint256 _L_ETH, uint256 _L_DCHFDebt); event TroveIndexUpdated(address indexed _asset, address _borrower, uint256 _newIndex); event TroveUpdated( address indexed _asset, address indexed _borrower, uint256 _debt, uint256 _coll, uint256 _stake, TroveManagerOperation _operation ); event TroveLiquidated( address indexed _asset, address indexed _borrower, uint256 _debt, uint256 _coll, TroveManagerOperation _operation ); enum TroveManagerOperation { applyPendingRewards, liquidateInNormalMode, liquidateInRecoveryMode, redeemCollateral } // --- Functions --- function isContractTroveManager() external pure returns (bool); function troveManagerHelpers() external view returns (ITroveManagerHelpers); function setAddresses( address _stabilityPoolManagerAddress, address _gasPoolAddress, address _collSurplusPoolAddress, address _dchfTokenAddress, address _sortedTrovesAddress, address _monStakingAddress, address _dfrancParamsAddress, address _troveManagerHelpersAddress ) external; function stabilityPoolManager() external view returns (IStabilityPoolManager); function dchfToken() external view returns (IDCHFToken); function monStaking() external view returns (IMONStaking); function liquidate(address _asset, address borrower) external; function liquidateTroves(address _asset, uint256 _n) external; function batchLiquidateTroves(address _asset, address[] memory _troveArray) external; function redeemCollateral( address _asset, uint256 _DCHFamount, address _firstRedemptionHint, address _upperPartialRedemptionHint, address _lowerPartialRedemptionHint, uint256 _partialRedemptionHintNICR, uint256 _maxIterations, uint256 _maxFee ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "@openzeppelin/contracts/access/Ownable.sol"; import "./BaseMath.sol"; import "./DfrancMath.sol"; import "../Interfaces/IActivePool.sol"; import "../Interfaces/IDefaultPool.sol"; import "../Interfaces/IPriceFeed.sol"; import "../Interfaces/IDfrancBase.sol"; /* * Base contract for TroveManager, BorrowerOperations and StabilityPool. Contains global system constants and * common functions. */ contract DfrancBase is BaseMath, IDfrancBase, Ownable { using SafeMath for uint256; address public constant ETH_REF_ADDRESS = address(0); IDfrancParameters public override dfrancParams; function setDfrancParameters(address _vaultParams) public onlyOwner { dfrancParams = IDfrancParameters(_vaultParams); emit VaultParametersBaseChanged(_vaultParams); } // --- Gas compensation functions --- // Returns the composite debt (drawn debt + gas compensation) of a trove, for the purpose of ICR calculation function _getCompositeDebt(address _asset, uint256 _debt) internal view returns (uint256) { return _debt.add(dfrancParams.DCHF_GAS_COMPENSATION(_asset)); } function _getNetDebt(address _asset, uint256 _debt) internal view returns (uint256) { return _debt.sub(dfrancParams.DCHF_GAS_COMPENSATION(_asset)); } // Return the amount of ETH to be drawn from a trove's collateral and sent as gas compensation. function _getCollGasCompensation(address _asset, uint256 _entireColl) internal view returns (uint256) { return _entireColl / dfrancParams.PERCENT_DIVISOR(_asset); } function getEntireSystemColl(address _asset) public view returns (uint256 entireSystemColl) { uint256 activeColl = dfrancParams.activePool().getAssetBalance(_asset); uint256 liquidatedColl = dfrancParams.defaultPool().getAssetBalance(_asset); return activeColl.add(liquidatedColl); } function getEntireSystemDebt(address _asset) public view returns (uint256 entireSystemDebt) { uint256 activeDebt = dfrancParams.activePool().getDCHFDebt(_asset); uint256 closedDebt = dfrancParams.defaultPool().getDCHFDebt(_asset); return activeDebt.add(closedDebt); } function _getTCR(address _asset, uint256 _price) internal view returns (uint256 TCR) { uint256 entireSystemColl = getEntireSystemColl(_asset); uint256 entireSystemDebt = getEntireSystemDebt(_asset); TCR = DfrancMath._computeCR(entireSystemColl, entireSystemDebt, _price); return TCR; } function _checkRecoveryMode(address _asset, uint256 _price) internal view returns (bool) { uint256 TCR = _getTCR(_asset, _price); return TCR < dfrancParams.CCR(_asset); } function _requireUserAcceptsFee( uint256 _fee, uint256 _amount, uint256 _maxFeePercentage ) internal view { uint256 feePercentage = _fee.mul(dfrancParams.DECIMAL_PRECISION()).div(_amount); require(feePercentage <= _maxFeePercentage, "FM"); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; contract CheckContract { function checkContract(address _account) internal view { require(_account != address(0), "Account cannot be zero address"); uint256 size; assembly { size := extcodesize(_account) } require(size > 0, "Account code size cannot be zero"); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/utils/Address.sol"; abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./IDfrancBase.sol"; import "./IStabilityPool.sol"; import "./IDCHFToken.sol"; import "./IMONStaking.sol"; import "./ICollSurplusPool.sol"; import "./ISortedTroves.sol"; import "./IActivePool.sol"; import "./IDefaultPool.sol"; import "./IStabilityPoolManager.sol"; // Common interface for the Trove Manager. interface ITroveManagerHelpers is IDfrancBase { enum Status { nonExistent, active, closedByOwner, closedByLiquidation, closedByRedemption } // Store the necessary data for a trove struct Trove { address asset; uint256 debt; uint256 coll; uint256 stake; Status status; uint128 arrayIndex; } /* * --- Variable container structs for liquidations --- * * These structs are used to hold, return and assign variables inside the liquidation functions, * in order to avoid the error: "CompilerError: Stack too deep". **/ struct LocalVariables_OuterLiquidationFunction { uint256 price; uint256 DCHFInStabPool; bool recoveryModeAtStart; uint256 liquidatedDebt; uint256 liquidatedColl; } struct LocalVariables_InnerSingleLiquidateFunction { uint256 collToLiquidate; uint256 pendingDebtReward; uint256 pendingCollReward; } struct LocalVariables_LiquidationSequence { uint256 remainingDCHFInStabPool; uint256 i; uint256 ICR; address user; bool backToNormalMode; uint256 entireSystemDebt; uint256 entireSystemColl; } struct LocalVariables_AssetBorrowerPrice { address _asset; address _borrower; uint256 _price; } struct LiquidationValues { uint256 entireTroveDebt; uint256 entireTroveColl; uint256 collGasCompensation; uint256 DCHFGasCompensation; uint256 debtToOffset; uint256 collToSendToSP; uint256 debtToRedistribute; uint256 collToRedistribute; uint256 collSurplus; } struct LiquidationTotals { uint256 totalCollInSequence; uint256 totalDebtInSequence; uint256 totalCollGasCompensation; uint256 totalDCHFGasCompensation; uint256 totalDebtToOffset; uint256 totalCollToSendToSP; uint256 totalDebtToRedistribute; uint256 totalCollToRedistribute; uint256 totalCollSurplus; } struct ContractsCache { IActivePool activePool; IDefaultPool defaultPool; IDCHFToken dchfToken; IMONStaking monStaking; ISortedTroves sortedTroves; ICollSurplusPool collSurplusPool; address gasPoolAddress; } // --- Variable container structs for redemptions --- struct RedemptionTotals { uint256 remainingDCHF; uint256 totalDCHFToRedeem; uint256 totalAssetDrawn; uint256 ETHFee; uint256 ETHToSendToRedeemer; uint256 decayedBaseRate; uint256 price; uint256 totalDCHFSupplyAtStart; } struct SingleRedemptionValues { uint256 DCHFLot; uint256 ETHLot; bool cancelledPartial; } // Object containing the ETH and DCHF snapshots for a given active trove struct RewardSnapshot { uint256 asset; uint256 DCHFDebt; } // --- Events --- event Liquidation( address indexed _asset, uint256 _liquidatedDebt, uint256 _liquidatedColl, uint256 _collGasCompensation, uint256 _DCHFGasCompensation ); event Redemption( address indexed _asset, uint256 _attemptedDCHFAmount, uint256 _actualDCHFAmount, uint256 _AssetSent, uint256 _AssetFee ); event TroveUpdated( address indexed _asset, address indexed _borrower, uint256 _debt, uint256 _coll, uint256 stake, uint8 operation ); event TroveLiquidated( address indexed _asset, address indexed _borrower, uint256 _debt, uint256 _coll, uint8 operation ); event BaseRateUpdated(address indexed _asset, uint256 _baseRate); event LastFeeOpTimeUpdated(address indexed _asset, uint256 _lastFeeOpTime); event TotalStakesUpdated(address indexed _asset, uint256 _newTotalStakes); event SystemSnapshotsUpdated( address indexed _asset, uint256 _totalStakesSnapshot, uint256 _totalCollateralSnapshot ); event LTermsUpdated(address indexed _asset, uint256 _L_ETH, uint256 _L_DCHFDebt); event TroveSnapshotsUpdated(address indexed _asset, uint256 _L_ETH, uint256 _L_DCHFDebt); event TroveIndexUpdated(address indexed _asset, address _borrower, uint256 _newIndex); event TroveUpdated( address indexed _asset, address indexed _borrower, uint256 _debt, uint256 _coll, uint256 _stake, TroveManagerOperation _operation ); event TroveLiquidated( address indexed _asset, address indexed _borrower, uint256 _debt, uint256 _coll, TroveManagerOperation _operation ); enum TroveManagerOperation { applyPendingRewards, liquidateInNormalMode, liquidateInRecoveryMode, redeemCollateral } // Functions function addTroveOwnerToArray(address _asset, address _borrower) external returns (uint256 index); function applyPendingRewards(address _asset, address _borrower) external; function checkRecoveryMode(address _asset, uint256 _price) external returns (bool); function closeTrove(address _asset, address _borrower) external; function decayBaseRateFromBorrowing(address _asset) external; function decreaseTroveColl( address _asset, address _borrower, uint256 _collDecrease ) external returns (uint256); function decreaseTroveDebt( address _asset, address _borrower, uint256 _collDecrease ) external returns (uint256); function getBorrowingFee(address _asset, uint256 DCHFDebt) external view returns (uint256); function getBorrowingRateWithDecay(address _asset) external view returns (uint256); function getBorrowingRate(address _asset) external view returns (uint256); function getCurrentICR( address _asset, address _borrower, uint256 _price ) external view returns (uint256); function getEntireDebtAndColl(address _asset, address _borrower) external view returns ( uint256 debt, uint256 coll, uint256 pendingDCHFDebtReward, uint256 pendingAssetReward ); function getNominalICR(address _asset, address _borrower) external view returns (uint256); function getPendingAssetReward(address _asset, address _borrower) external view returns (uint256); function getPendingDCHFDebtReward(address _asset, address _borrower) external view returns (uint256); function getRedemptionFeeWithDecay(address _asset, uint256 _assetDraw) external view returns (uint256); function getRedemptionRate(address _asset) external view returns (uint256); function getRedemptionRateWithDecay(address _asset) external view returns (uint256); function getTCR(address _asset, uint256 _price) external view returns (uint256); function getTroveColl(address _asset, address _borrower) external view returns (uint256); function getTroveDebt(address _asset, address _borrower) external view returns (uint256); function getTroveStake(address _asset, address _borrower) external view returns (uint256); function getTroveStatus(address _asset, address _borrower) external view returns (uint256); function hasPendingRewards(address _asset, address _borrower) external view returns (bool); function increaseTroveColl( address _asset, address _borrower, uint256 _collIncrease ) external returns (uint256); function increaseTroveDebt( address _asset, address _borrower, uint256 _debtIncrease ) external returns (uint256); function setTroveStatus( address _asset, address _borrower, uint256 num ) external; function updateTroveRewardSnapshots(address _asset, address _borrower) external; function getBorrowingFeeWithDecay(address _asset, uint256 _DCHFDebt) external view returns (uint256); function getTroveOwnersCount(address _asset) external view returns (uint256); function getTroveFromTroveOwnersArray(address _asset, uint256 _index) external view returns (address); function setTroveDeptAndColl( address _asset, address _borrower, uint256 _debt, uint256 _coll ) external; function isTroveActive(address _asset, address _borrower) external view returns (bool); function movePendingTroveRewardsToActivePool( address _asset, IActivePool _activePool, IDefaultPool _defaultPool, uint256 _DCHF, uint256 _amount ) external; function removeStake(address _asset, address _borrower) external; function closeTrove( // access control address _asset, address _borrower, Status closedStatus ) external; function redistributeDebtAndColl( address _asset, IActivePool _activePool, IDefaultPool _defaultPool, uint256 _debt, uint256 _coll ) external; function updateSystemSnapshots_excludeCollRemainder( // access control address _asset, IActivePool _activePool, uint256 _collRemainder ) external; function _checkPotentialRecoveryMode( // access control address _asset, uint256 _entireSystemColl, uint256 _entireSystemDebt, uint256 _price ) external view returns (bool); function updateBaseRateFromRedemption( address _asset, uint256 _ETHDrawn, uint256 _price, uint256 _totalDCHFSupply ) external returns (uint256); function updateStakeAndTotalStakes(address _asset, address _borrower) external returns (uint256); function _requireValidMaxFeePercentage(address _asset, uint256 _maxFeePercentage) external view; function _requireTCRoverMCR(address _asset, uint256 _price) external view; function _requireAmountGreaterThanZero(uint256 _amount) external pure; function _requireDCHFBalanceCoversRedemption( IDCHFToken _dchfToken, address _redeemer, uint256 _amount ) external view; function applyPendingRewards( address _asset, IActivePool _activePool, IDefaultPool _defaultPool, address _borrower ) external; function _getRedemptionFee(address _asset, uint256 _assetDraw) external view returns (uint256); function getTrove(address _asset, address _borrower) external view returns ( address, uint256, uint256, uint256, Status, uint128 ); function getRewardSnapshots(address _asset, address _troveOwner) external view returns (uint256 asset, uint256 DCHFDebt); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./IDfrancParameters.sol"; interface IDfrancBase { event VaultParametersBaseChanged(address indexed newAddress); function dfrancParams() external view returns (IDfrancParameters); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./IDeposit.sol"; interface IStabilityPool is IDeposit { // --- Events --- event StabilityPoolAssetBalanceUpdated(uint256 _newBalance); event StabilityPoolDCHFBalanceUpdated(uint256 _newBalance); event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event TroveManagerAddressChanged(address _newTroveManagerAddress); event DefaultPoolAddressChanged(address _newDefaultPoolAddress); event DCHFTokenAddressChanged(address _newDCHFTokenAddress); event SortedTrovesAddressChanged(address _newSortedTrovesAddress); event CommunityIssuanceAddressChanged(address _newCommunityIssuanceAddress); event P_Updated(uint256 _P); event S_Updated(uint256 _S, uint128 _epoch, uint128 _scale); event G_Updated(uint256 _G, uint128 _epoch, uint128 _scale); event EpochUpdated(uint128 _currentEpoch); event ScaleUpdated(uint128 _currentScale); event DepositSnapshotUpdated(address indexed _depositor, uint256 _P, uint256 _S, uint256 _G); event SystemSnapshotUpdated(uint256 _P, uint256 _G); event UserDepositChanged(address indexed _depositor, uint256 _newDeposit); event StakeChanged(uint256 _newSystemStake, address _depositor); event AssetGainWithdrawn(address indexed _depositor, uint256 _Asset, uint256 _DCHFLoss); event MONPaidToDepositor(address indexed _depositor, uint256 _MON); event AssetSent(address _to, uint256 _amount); // --- Functions --- function NAME() external view returns (string memory name); /* * Called only once on init, to set addresses of other Dfranc contracts * Callable only by owner, renounces ownership at the end */ function setAddresses( address _assetAddress, address _borrowerOperationsAddress, address _troveManagerAddress, address _troveManagerHelperAddress, address _dchfTokenAddress, address _sortedTrovesAddress, address _communityIssuanceAddress, address _dfrancParamsAddress ) external; /* * Initial checks: * - Frontend is registered or zero address * - Sender is not a registered frontend * - _amount is not zero * --- * - Triggers a MON issuance, based on time passed since the last issuance. The MON issuance is shared between *all* depositors and front ends * - Tags the deposit with the provided front end tag param, if it's a new deposit * - Sends depositor's accumulated gains (MON, ETH) to depositor * - Sends the tagged front end's accumulated MON gains to the tagged front end * - Increases deposit and tagged front end's stake, and takes new snapshots for each. */ function provideToSP(uint256 _amount) external; /* * Initial checks: * - _amount is zero or there are no under collateralized troves left in the system * - User has a non zero deposit * --- * - Triggers a MON issuance, based on time passed since the last issuance. The MON issuance is shared between *all* depositors and front ends * - Removes the deposit's front end tag if it is a full withdrawal * - Sends all depositor's accumulated gains (MON, ETH) to depositor * - Sends the tagged front end's accumulated MON gains to the tagged front end * - Decreases deposit and tagged front end's stake, and takes new snapshots for each. * * If _amount > userDeposit, the user withdraws all of their compounded deposit. */ function withdrawFromSP(uint256 _amount) external; /* * Initial checks: * - User has a non zero deposit * - User has an open trove * - User has some ETH gain * --- * - Triggers a MON issuance, based on time passed since the last issuance. The MON issuance is shared between *all* depositors and front ends * - Sends all depositor's MON gain to depositor * - Sends all tagged front end's MON gain to the tagged front end * - Transfers the depositor's entire ETH gain from the Stability Pool to the caller's trove * - Leaves their compounded deposit in the Stability Pool * - Updates snapshots for deposit and tagged front end stake */ function withdrawAssetGainToTrove(address _upperHint, address _lowerHint) external; /* * Initial checks: * - Caller is TroveManager * --- * Cancels out the specified debt against the DCHF contained in the Stability Pool (as far as possible) * and transfers the Trove's ETH collateral from ActivePool to StabilityPool. * Only called by liquidation functions in the TroveManager. */ function offset(uint256 _debt, uint256 _coll) external; /* * Returns the total amount of ETH held by the pool, accounted in an internal variable instead of `balance`, * to exclude edge cases like ETH received from a self-destruct. */ function getAssetBalance() external view returns (uint256); /* * Returns DCHF held in the pool. Changes when users deposit/withdraw, and when Trove debt is offset. */ function getTotalDCHFDeposits() external view returns (uint256); /* * Calculates the ETH gain earned by the deposit since its last snapshots were taken. */ function getDepositorAssetGain(address _depositor) external view returns (uint256); /* * Calculate the MON gain earned by a deposit since its last snapshots were taken. * If not tagged with a front end, the depositor gets a 100% cut of what their deposit earned. * Otherwise, their cut of the deposit's earnings is equal to the kickbackRate, set by the front end through * which they made their deposit. */ function getDepositorMONGain(address _depositor) external view returns (uint256); /* * Return the user's compounded deposit. */ function getCompoundedDCHFDeposit(address _depositor) external view returns (uint256); /* * Return the front end's compounded stake. * * The front end's compounded stake is equal to the sum of its depositors' compounded deposits. */ function getCompoundedTotalStake() external view returns (uint256); function getNameBytes() external view returns (bytes32); function getAssetType() external view returns (address); /* * Fallback function * Only callable by Active Pool, it just accounts for ETH received * receive() external payable; */ }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "../Dependencies/ERC20Permit.sol"; import "../Interfaces/IStabilityPoolManager.sol"; abstract contract IDCHFToken is ERC20Permit { // --- Events --- event StabilityPoolAddressChanged(address _newStabilityPoolAddress); event DCHFTokenBalanceUpdated(address _user, uint256 _amount); function emergencyStopMinting(address _asset, bool status) external virtual; function addTroveManager(address _troveManager) external virtual; function removeTroveManager(address _troveManager) external virtual; function addBorrowerOps(address _borrowerOps) external virtual; function removeBorrowerOps(address _borrowerOps) external virtual; function mint( address _asset, address _account, uint256 _amount ) external virtual; function burn(address _account, uint256 _amount) external virtual; function sendToPool( address _sender, address poolAddress, uint256 _amount ) external virtual; function returnFromPool( address poolAddress, address user, uint256 _amount ) external virtual; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; interface IMONStaking { // --- Events -- event TreasuryAddressChanged(address _treausury); event SentToTreasury(address indexed _asset, uint256 _amount); event MONTokenAddressSet(address _MONTokenAddress); event DCHFTokenAddressSet(address _dchfTokenAddress); event TroveManagerAddressSet(address _troveManager); event BorrowerOperationsAddressSet(address _borrowerOperationsAddress); event ActivePoolAddressSet(address _activePoolAddress); event StakeChanged(address indexed staker, uint256 newStake); event StakingGainsAssetWithdrawn( address indexed staker, address indexed asset, uint256 AssetGain ); event StakingGainsDCHFWithdrawn(address indexed staker, uint256 DCHFGain); event F_AssetUpdated(address indexed _asset, uint256 _F_ASSET); event F_DCHFUpdated(uint256 _F_DCHF); event TotalMONStakedUpdated(uint256 _totalMONStaked); event AssetSent(address indexed _asset, address indexed _account, uint256 _amount); event StakerSnapshotsUpdated(address _staker, uint256 _F_Asset, uint256 _F_DCHF); function monToken() external view returns (IERC20); // --- Functions --- function setAddresses( address _MONTokenAddress, address _dchfTokenAddress, address _troveManagerAddress, address _troveManagerHelpersAddress, address _borrowerOperationsAddress, address _activePoolAddress, address _treasury ) external; function stake(uint256 _MONamount) external; function unstake(uint256 _MONamount) external; function increaseF_Asset(address _asset, uint256 _AssetFee) external; function increaseF_DCHF(uint256 _MONFee) external; function getPendingAssetGain(address _asset, address _user) external view returns (uint256); function getPendingDCHFGain(address _user) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./IDeposit.sol"; interface ICollSurplusPool is IDeposit { // --- Events --- event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event TroveManagerAddressChanged(address _newTroveManagerAddress); event ActivePoolAddressChanged(address _newActivePoolAddress); event CollBalanceUpdated(address indexed _account, uint256 _newBalance); event AssetSent(address _to, uint256 _amount); // --- Contract setters --- function setAddresses( address _borrowerOperationsAddress, address _troveManagerAddress, address _troveManagerHelpersAddress, address _activePoolAddress ) external; function getAssetBalance(address _asset) external view returns (uint256); function getCollateral(address _asset, address _account) external view returns (uint256); function accountSurplus( address _asset, address _account, uint256 _amount ) external; function claimColl(address _asset, address _account) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; // Common interface for the SortedTroves Doubly Linked List. interface ISortedTroves { // --- Events --- event SortedTrovesAddressChanged(address _sortedDoublyLLAddress); event BorrowerOperationsAddressChanged(address _borrowerOperationsAddress); event NodeAdded(address indexed _asset, address _id, uint256 _NICR); event NodeRemoved(address indexed _asset, address _id); // --- Functions --- function setParams( address _TroveManagerAddress, address _troveManagerHelpersAddress, address _borrowerOperationsAddress ) external; function insert( address _asset, address _id, uint256 _ICR, address _prevId, address _nextId ) external; function remove(address _asset, address _id) external; function reInsert( address _asset, address _id, uint256 _newICR, address _prevId, address _nextId ) external; function contains(address _asset, address _id) external view returns (bool); function isFull(address _asset) external view returns (bool); function isEmpty(address _asset) external view returns (bool); function getSize(address _asset) external view returns (uint256); function getMaxSize(address _asset) external view returns (uint256); function getFirst(address _asset) external view returns (address); function getLast(address _asset) external view returns (address); function getNext(address _asset, address _id) external view returns (address); function getPrev(address _asset, address _id) external view returns (address); function validInsertPosition( address _asset, uint256 _ICR, address _prevId, address _nextId ) external view returns (bool); function findInsertPosition( address _asset, uint256 _ICR, address _prevId, address _nextId ) external view returns (address, address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./IPool.sol"; interface IActivePool is IPool { // --- Events --- event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event TroveManagerAddressChanged(address _newTroveManagerAddress); event ActivePoolDCHFDebtUpdated(address _asset, uint256 _DCHFDebt); event ActivePoolAssetBalanceUpdated(address _asset, uint256 _balance); // --- Functions --- function sendAsset( address _asset, address _account, uint256 _amount ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./IPool.sol"; interface IDefaultPool is IPool { // --- Events --- event TroveManagerAddressChanged(address _newTroveManagerAddress); event DefaultPoolDCHFDebtUpdated(address _asset, uint256 _DCHFDebt); event DefaultPoolAssetBalanceUpdated(address _asset, uint256 _balance); // --- Functions --- function sendAssetToActivePool(address _asset, uint256 _amount) external; }
pragma solidity ^0.8.14; import "./IStabilityPool.sol"; interface IStabilityPoolManager { event StabilityPoolAdded(address asset, address stabilityPool); event StabilityPoolRemoved(address asset, address stabilityPool); function isStabilityPool(address stabilityPool) external view returns (bool); function addStabilityPool(address asset, address stabilityPool) external; function getAssetStabilityPool(address asset) external view returns (IStabilityPool); function unsafeGetAssetStabilityPool(address asset) external view returns (address); }
pragma solidity ^0.8.14; import "./IActivePool.sol"; import "./IDefaultPool.sol"; import "./IPriceFeed.sol"; import "./IDfrancBase.sol"; interface IDfrancParameters { error SafeCheckError( string parameter, uint256 valueEntered, uint256 minValue, uint256 maxValue ); event MCRChanged(uint256 oldMCR, uint256 newMCR); event CCRChanged(uint256 oldCCR, uint256 newCCR); event GasCompensationChanged(uint256 oldGasComp, uint256 newGasComp); event MinNetDebtChanged(uint256 oldMinNet, uint256 newMinNet); event PercentDivisorChanged(uint256 oldPercentDiv, uint256 newPercentDiv); event BorrowingFeeFloorChanged(uint256 oldBorrowingFloorFee, uint256 newBorrowingFloorFee); event MaxBorrowingFeeChanged(uint256 oldMaxBorrowingFee, uint256 newMaxBorrowingFee); event RedemptionFeeFloorChanged( uint256 oldRedemptionFeeFloor, uint256 newRedemptionFeeFloor ); event RedemptionBlockRemoved(address _asset); event PriceFeedChanged(address indexed addr); function DECIMAL_PRECISION() external view returns (uint256); function _100pct() external view returns (uint256); // Minimum collateral ratio for individual troves function MCR(address _collateral) external view returns (uint256); // Critical system collateral ratio. If the system's total collateral ratio (TCR) falls below the CCR, Recovery Mode is triggered. function CCR(address _collateral) external view returns (uint256); function DCHF_GAS_COMPENSATION(address _collateral) external view returns (uint256); function MIN_NET_DEBT(address _collateral) external view returns (uint256); function PERCENT_DIVISOR(address _collateral) external view returns (uint256); function BORROWING_FEE_FLOOR(address _collateral) external view returns (uint256); function REDEMPTION_FEE_FLOOR(address _collateral) external view returns (uint256); function MAX_BORROWING_FEE(address _collateral) external view returns (uint256); function redemptionBlock(address _collateral) external view returns (uint256); function activePool() external view returns (IActivePool); function defaultPool() external view returns (IDefaultPool); function priceFeed() external view returns (IPriceFeed); function setAddresses( address _activePool, address _defaultPool, address _priceFeed, address _adminContract ) external; function setPriceFeed(address _priceFeed) external; function setMCR(address _asset, uint256 newMCR) external; function setCCR(address _asset, uint256 newCCR) external; function sanitizeParameters(address _asset) external; function setAsDefault(address _asset) external; function setAsDefaultWithRemptionBlock(address _asset, uint256 blockInDays) external; function setDCHFGasCompensation(address _asset, uint256 gasCompensation) external; function setMinNetDebt(address _asset, uint256 minNetDebt) external; function setPercentDivisor(address _asset, uint256 precentDivisor) external; function setBorrowingFeeFloor(address _asset, uint256 borrowingFeeFloor) external; function setMaxBorrowingFee(address _asset, uint256 maxBorrowingFee) external; function setRedemptionFeeFloor(address _asset, uint256 redemptionFeeFloor) external; function removeRedemptionBlock(address _asset) external; }
// SPDX-License-Identifier: MIT import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; pragma solidity ^0.8.14; interface IPriceFeed { struct ChainlinkResponse { uint80 roundId; int256 answer; uint256 timestamp; bool success; uint8 decimals; } struct RegisterOracle { AggregatorV3Interface chainLinkOracle; AggregatorV3Interface chainLinkIndex; bool isRegistered; } enum Status { chainlinkWorking, chainlinkUntrusted } // --- Events --- event PriceFeedStatusChanged(Status newStatus); event LastGoodPriceUpdated(address indexed token, uint256 _lastGoodPrice); event LastGoodIndexUpdated(address indexed token, uint256 _lastGoodIndex); event RegisteredNewOracle( address token, address chainLinkAggregator, address chianLinkIndex ); // --- Function --- function addOracle( address _token, address _chainlinkOracle, address _chainlinkIndexOracle ) external; function fetchPrice(address _token) external returns (uint256); function getDirectPrice(address _asset) external returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./IDeposit.sol"; // Common interface for the Pools. interface IPool is IDeposit { // --- Events --- event AssetBalanceUpdated(uint256 _newBalance); event DCHFBalanceUpdated(uint256 _newBalance); event ActivePoolAddressChanged(address _newActivePoolAddress); event DefaultPoolAddressChanged(address _newDefaultPoolAddress); event AssetAddressChanged(address _assetAddress); event StabilityPoolAddressChanged(address _newStabilityPoolAddress); event AssetSent(address _to, address indexed _asset, uint256 _amount); // --- Functions --- function getAssetBalance(address _asset) external view returns (uint256); function getDCHFDebt(address _asset) external view returns (uint256); function increaseDCHFDebt(address _asset, uint256 _amount) external; function decreaseDCHFDebt(address _asset, uint256 _amount) external; }
pragma solidity ^0.8.14; interface IDeposit { function receivedERC20(address _asset, uint256 _amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AggregatorV3Interface { function decimals() external view returns ( uint8 ); function description() external view returns ( string memory ); function version() external view returns ( uint256 ); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData( uint80 _roundId ) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
pragma solidity ^0.8.14; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; interface IERC2612Permit { /** * @dev Sets `amount` 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: * * - `owner` cannot be the zero address. * - `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]. */ function permit( address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current ERC2612 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); } abstract contract ERC20Permit is ERC20, IERC2612Permit { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; bytes32 public DOMAIN_SEPARATOR; constructor() { uint256 chainID; assembly { chainID := chainid() } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ), keccak256(bytes(name())), keccak256(bytes("1")), // Version chainID, address(this) ) ); } /** * @dev See {IERC2612Permit-permit}. * */ function permit( address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external virtual override { require(block.timestamp <= deadline, "Permit: expired deadline"); bytes32 hashStruct = keccak256( abi.encode(PERMIT_TYPEHASH, owner, spender, amount, _nonces[owner].current(), deadline) ); bytes32 _hash = keccak256(abi.encodePacked(uint16(0x1901), DOMAIN_SEPARATOR, hashStruct)); address signer = ecrecover(_hash, v, r, s); require(signer != address(0) && signer == owner, "ERC20Permit: Invalid signature"); _nonces[owner].increment(); _approve(owner, spender, amount); } /** * @dev See {IERC2612Permit-nonces}. */ function nonces(address owner) public view override returns (uint256) { return _nonces[owner].current(); } function chainId() public view returns (uint256 chainID) { assembly { chainID := chainid() } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @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 `sender` to `recipient` 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 sender, address recipient, uint256 amount ) external returns (bool); /** * @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); }
// SPDX-License-Identifier: MIT 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 pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ 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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; abstract contract BaseMath { uint256 public constant DECIMAL_PRECISION = 1 ether; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; library DfrancMath { using SafeMath for uint256; uint256 internal constant DECIMAL_PRECISION = 1 ether; /* Precision for Nominal ICR (independent of price). Rationale for the value: * * - Making it “too high” could lead to overflows. * - Making it “too low” could lead to an ICR equal to zero, due to truncation from Solidity floor division. * * This value of 1e20 is chosen for safety: the NICR will only overflow for numerator > ~1e39 ETH, * and will only truncate to 0 if the denominator is at least 1e20 times greater than the numerator. * */ uint256 internal constant NICR_PRECISION = 1e20; function _min(uint256 _a, uint256 _b) internal pure returns (uint256) { return (_a < _b) ? _a : _b; } function _max(uint256 _a, uint256 _b) internal pure returns (uint256) { return (_a >= _b) ? _a : _b; } /* * Multiply two decimal numbers and use normal rounding rules: * -round product up if 19'th mantissa digit >= 5 * -round product down if 19'th mantissa digit < 5 * * Used only inside the exponentiation, _decPow(). */ function decMul(uint256 x, uint256 y) internal pure returns (uint256 decProd) { uint256 prod_xy = x.mul(y); decProd = prod_xy.add(DECIMAL_PRECISION / 2).div(DECIMAL_PRECISION); } /* * _decPow: Exponentiation function for 18-digit decimal base, and integer exponent n. * * Uses the efficient "exponentiation by squaring" algorithm. O(log(n)) complexity. * * Called by two functions that represent time in units of minutes: * 1) TroveManager._calcDecayedBaseRate * 2) CommunityIssuance._getCumulativeIssuanceFraction * * The exponent is capped to avoid reverting due to overflow. The cap 525600000 equals * "minutes in 1000 years": 60 * 24 * 365 * 1000 * * If a period of > 1000 years is ever used as an exponent in either of the above functions, the result will be * negligibly different from just passing the cap, since: * * In function 1), the decayed base rate will be 0 for 1000 years or > 1000 years * In function 2), the difference in tokens issued at 1000 years and any time > 1000 years, will be negligible */ function _decPow(uint256 _base, uint256 _minutes) internal pure returns (uint256) { if (_minutes > 525600000) { _minutes = 525600000; } // cap to avoid overflow if (_minutes == 0) { return DECIMAL_PRECISION; } uint256 y = DECIMAL_PRECISION; uint256 x = _base; uint256 n = _minutes; // Exponentiation-by-squaring while (n > 1) { if (n % 2 == 0) { x = decMul(x, x); n = n.div(2); } else { // if (n % 2 != 0) y = decMul(x, y); x = decMul(x, x); n = (n.sub(1)).div(2); } } return decMul(x, y); } function _getAbsoluteDifference(uint256 _a, uint256 _b) internal pure returns (uint256) { return (_a >= _b) ? _a.sub(_b) : _b.sub(_a); } function _computeNominalCR(uint256 _coll, uint256 _debt) internal pure returns (uint256) { if (_debt > 0) { return _coll.mul(NICR_PRECISION).div(_debt); } // Return the maximal value for uint256 if the Trove has a debt of 0. Represents "infinite" CR. else { // if (_debt == 0) return 2**256 - 1; } } function _computeCR( uint256 _coll, uint256 _debt, uint256 _price ) internal pure returns (uint256) { if (_debt > 0) { return _coll.mul(_price).div(_debt); } // Return the maximal value for uint256 if the Trove has a debt of 0. Represents "infinite" CR. else { // if (_debt == 0) return type(uint256).max; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"_baseRate","type":"uint256"}],"name":"BaseRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"_L_ETH","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_L_DCHFDebt","type":"uint256"}],"name":"LTermsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"_lastFeeOpTime","type":"uint256"}],"name":"LastFeeOpTimeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"_liquidatedDebt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_liquidatedColl","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_collGasCompensation","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_DCHFGasCompensation","type":"uint256"}],"name":"Liquidation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"_attemptedDCHFAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_actualDCHFAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_AssetSent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_AssetFee","type":"uint256"}],"name":"Redemption","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"_totalStakesSnapshot","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_totalCollateralSnapshot","type":"uint256"}],"name":"SystemSnapshotsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"_newTotalStakes","type":"uint256"}],"name":"TotalStakesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":false,"internalType":"address","name":"_borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"_newIndex","type":"uint256"}],"name":"TroveIndexUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":true,"internalType":"address","name":"_borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"_debt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_coll","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"operation","type":"uint8"}],"name":"TroveLiquidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"_L_ETH","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_L_DCHFDebt","type":"uint256"}],"name":"TroveSnapshotsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":true,"internalType":"address","name":"_borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"_debt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_coll","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stake","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"operation","type":"uint8"}],"name":"TroveUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"VaultParametersBaseChanged","type":"event"},{"inputs":[],"name":"DECIMAL_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETH_REF_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"addUserToWhitelistRedemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"address[]","name":"_troveArray","type":"address[]"}],"name":"batchLiquidateTroves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dchfToken","outputs":[{"internalType":"contract IDCHFToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dfrancParams","outputs":[{"internalType":"contract IDfrancParameters","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"getEntireSystemColl","outputs":[{"internalType":"uint256","name":"entireSystemColl","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"getEntireSystemDebt","outputs":[{"internalType":"uint256","name":"entireSystemDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isContractTroveManager","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRedemptionWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"address","name":"_borrower","type":"address"}],"name":"liquidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_n","type":"uint256"}],"name":"liquidateTroves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"monStaking","outputs":[{"internalType":"contract IMONStaking","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_DCHFamount","type":"uint256"},{"internalType":"address","name":"_firstRedemptionHint","type":"address"},{"internalType":"address","name":"_upperPartialRedemptionHint","type":"address"},{"internalType":"address","name":"_lowerPartialRedemptionHint","type":"address"},{"internalType":"uint256","name":"_partialRedemptionHintNICR","type":"uint256"},{"internalType":"uint256","name":"_maxIterations","type":"uint256"},{"internalType":"uint256","name":"_maxFeePercentage","type":"uint256"}],"name":"redeemCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"redemptionWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"removeUserFromWhitelistRedemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_stabilityPoolManagerAddress","type":"address"},{"internalType":"address","name":"_gasPoolAddress","type":"address"},{"internalType":"address","name":"_collSurplusPoolAddress","type":"address"},{"internalType":"address","name":"_dchfTokenAddress","type":"address"},{"internalType":"address","name":"_sortedTrovesAddress","type":"address"},{"internalType":"address","name":"_monStakingAddress","type":"address"},{"internalType":"address","name":"_dfrancParamsAddress","type":"address"},{"internalType":"address","name":"_troveManagerHelpersAddress","type":"address"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultParams","type":"address"}],"name":"setDfrancParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"setRedemptionWhitelistStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sortedTroves","outputs":[{"internalType":"contract ISortedTroves","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stabilityPoolManager","outputs":[{"internalType":"contract IStabilityPoolManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"troveManagerHelpers","outputs":[{"internalType":"contract ITroveManagerHelpers","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200001d3362000023565b62000073565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b615a1880620000836000396000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c80638da5cb5b116100f9578063ae91875411610097578063d733cfd011610071578063d733cfd0146103ae578063e90f42ba146103c1578063f2fde38b146103d4578063f6c5d736146103e757600080fd5b8063ae91875414610381578063b4c9d17e14610394578063cfefff3d146103a757600080fd5b8063a263757f116100d3578063a263757f14610310578063a3f4df7e14610323578063a9419ca31461035b578063acc18b531461036e57600080fd5b80638da5cb5b146102dd5780639e86d0c4146102ee578063a20baee61461030157600080fd5b8063431d47241161016657806372141e631161014057806372141e631461029c5780637c92590f146102a45780637f551157146102b757806386b9d81f146102ca57600080fd5b8063431d47241461026e5780634ac2ce2f14610281578063715018a61461029457600080fd5b806323019524146101ae57806323977b4d146101de57806327d04b35146102115780632f2b4e9014610232578063392e53cd1461024557806340a44bd114610259575b600080fd5b6006546101c1906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6102016101ec3660046153d1565b60096020526000908152604090205460ff1681565b60405190151581526020016101d5565b61022461021f3660046153d1565b6103f4565b6040519081526020016101d5565b6003546101c1906001600160a01b031681565b60085461020190600160a01b900460ff1681565b61026c6102673660046153ee565b6105d6565b005b61026c61027c3660046153d1565b6112f5565b6007546101c1906001600160a01b031681565b61026c611343565b6101c1600081565b61026c6102b2366004615485565b611379565b61026c6102c536600461555f565b611984565b61026c6102d836600461558b565b612025565b6000546001600160a01b03166101c1565b6102246102fc3660046153d1565b612134565b610224670de0b6b3a764000081565b61026c61031e3660046153d1565b6122c5565b61034e6040518060400160405280600c81526020016b2a3937bb32a6b0b730b3b2b960a11b81525081565b6040516101d591906155c4565b6002546101c1906001600160a01b031681565b61026c61037c366004615627565b612339565b6008546101c1906001600160a01b031681565b61026c6103a23660046153d1565b612376565b6001610201565b61026c6103bc366004615644565b6123c1565b6001546101c1906001600160a01b031681565b61026c6103e23660046153d1565b6125fb565b600a546102019060ff1681565b600080600160009054906101000a90046001600160a01b03166001600160a01b0316637f7dde4a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561044a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046e91906156ed565b60405163d1234da760e01b81526001600160a01b038581166004830152919091169063d1234da790602401602060405180830381865afa1580156104b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104da919061570a565b90506000600160009054906101000a90046001600160a01b03166001600160a01b0316633cc742256040518163ffffffff1660e01b8152600401602060405180830381865afa158015610531573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055591906156ed565b60405163d1234da760e01b81526001600160a01b038681166004830152919091169063d1234da7906024015b602060405180830381865afa15801561059e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c2919061570a565b90506105ce8282612696565b949350505050565b600a5460ff161561062a573360009081526009602052604090205460ff1661062a5760405162461bcd60e51b81526020600482015260026024820152614e5760f01b60448201526064015b60405180910390fd5b600154604051630e24a3fb60e31b81526001600160a01b038a81166004830152909116906371251fd890602401602060405180830381865afa158015610674573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610698919061570a565b4210156106cc5760405162461bcd60e51b8152602060048201526002602482015261212960f11b6044820152606401610621565b6040805160e08101808352600154633fbeef2560e11b909152915160009282916001600160a01b0390911690637f7dde4a9060e4808501916020918187030181865afa158015610720573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074491906156ed565b6001600160a01b03168152602001600160009054906101000a90046001600160a01b03166001600160a01b0316633cc742256040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c991906156ed565b6001600160a01b039081168252600654811660208084019190915260075482166040808501919091526008548316606080860191909152600554841660808087019190915260045490941660a0958601528151610100810183526000808252938101849052918201839052810182905291820181905291810182905260c0810182905260e0810191909152909150600254604051633ec59b6760e21b81526001600160a01b038c81166004830152602482018690529091169063fb166d9c9060440160006040518083038186803b1580156108a357600080fd5b505afa1580156108b7573d6000803e3d6000fd5b50505050600160009054906101000a90046001600160a01b03166001600160a01b031663741bef1a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561090e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093291906156ed565b604051635670bcc760e11b81526001600160a01b038c81166004830152919091169063ace1798e906024016020604051808303816000875af115801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a0919061570a565b60c0820181905260025460405163142250bf60e31b81526001600160a01b038d81166004830152602482019390935291169063a11285f89060440160006040518083038186803b1580156109f357600080fd5b505afa158015610a07573d6000803e3d6000fd5b505060025460405163e823c24960e01b8152600481018d90526001600160a01b03909116925063e823c249915060240160006040518083038186803b158015610a4f57600080fd5b505afa158015610a63573d6000803e3d6000fd5b5050600254604080860151905163ac3e45b160e01b81526001600160a01b03909216935063ac3e45b19250610a9e9133908e90600401615723565b60006040518083038186803b158015610ab657600080fd5b505afa158015610aca573d6000803e3d6000fd5b50505050610ad78a6103f4565b60e0820152888152608082015160c0820151600091610afa918d91908c906126ab565b15610b06575087610d05565b6080830151604051637608271560e01b81526001600160a01b038d8116600483015290911690637608271590602401602060405180830381865afa158015610b52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7691906156ed565b90505b6001600160a01b03811615801590610c8657506001546040516305f8cff960e01b81526001600160a01b038d81166004830152909116906305f8cff990602401602060405180830381865afa158015610bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfa919061570a565b600260009054906101000a90046001600160a01b03166001600160a01b031663b1eafaab8d848660c001516040518463ffffffff1660e01b8152600401610c4393929190615723565b602060405180830381865afa158015610c60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c84919061570a565b105b15610d055782608001516001600160a01b031663e71b84008c836040518363ffffffff1660e01b8152600401610cbd929190615747565b602060405180830381865afa158015610cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfe91906156ed565b9050610b79565b84600003610d135760001994505b6001600160a01b03811615801590610d2b5750815115155b8015610d375750600085115b15610eda5784610d4681615777565b955050600083608001516001600160a01b031663e71b84008d846040518363ffffffff1660e01b8152600401610d7d929190615747565b602060405180830381865afa158015610d9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbe91906156ed565b9050600260009054906101000a90046001600160a01b03166001600160a01b03166331f4bceb8d86600001518760200151866040518563ffffffff1660e01b8152600401610e3594939291906001600160a01b03948516815292841660208401529083166040830152909116606082015260800190565b600060405180830381600087803b158015610e4f57600080fd5b505af1158015610e63573d6000803e3d6000fd5b505050506000610e818d868587600001518860c001518f8f8f61299b565b9050806040015115610e94575050610eda565b80516020850151610ea491612696565b6020808601919091528101516040850151610ebe91612696565b604085015280518451610ed091613091565b8452509050610d13565b6000826040015111610f135760405162461bcd60e51b81526020600482015260026024820152612aa960f11b6044820152606401610621565b600260009054906101000a90046001600160a01b03166001600160a01b031663c5d75f7b8c84604001518560c001518660e001516040518563ffffffff1660e01b8152600401610f66949392919061578e565b6020604051808303816000875af1158015610f85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa9919061570a565b506002546040838101519051631f07590560e01b81526001600160a01b038e811660048301526024820192909252911690631f07590590604401602060405180830381865afa158015611000573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611024919061570a565b60608301819052604083015161103b91908661309d565b82600001516001600160a01b03166347878f158c856060015185606001516040518463ffffffff1660e01b815260040161107793929190615723565b600060405180830381600087803b15801561109157600080fd5b505af11580156110a5573d6000803e3d6000fd5b50505060608085015190840151604051630912c0f360e11b81526001600160a01b038f8116600483015260248201929092529116915063122581e690604401600060405180830381600087803b1580156110fe57600080fd5b505af1158015611112573d6000803e3d6000fd5b505050506060820151604083015161112991613091565b8260800181815250508a6001600160a01b03167f08b6f1ce3f9ab2722e8ea40c31a3e3a806a41702c5994f29af43dc0c1f2837df8b846020015185604001518660600151604051611193949392919093845260208401929092526040830152606082015260800190565b60405180910390a260408084015160208401519151632770a7eb60e21b815233600482015260248101929092526001600160a01b031690639dc29fac90604401600060405180830381600087803b1580156111ed57600080fd5b505af1158015611201573d6000803e3d6000fd5b50508451602085015160405163fb24e5f760e01b81526001600160a01b03909216935063fb24e5f7925061124e918f91906004016001600160a01b03929092168252602082015260400190565b600060405180830381600087803b15801561126857600080fd5b505af115801561127c573d6000803e3d6000fd5b5050845160808501516040516347878f1560e01b81526001600160a01b0390921693506347878f1592506112b6918f913391600401615723565b600060405180830381600087803b1580156112d057600080fd5b505af11580156112e4573d6000803e3d6000fd5b505050505050505050505050505050565b6000546001600160a01b0316331461131f5760405162461bcd60e51b8152600401610621906157b4565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000546001600160a01b0316331461136d5760405162461bcd60e51b8152600401610621906157b4565b6113776000613161565b565b80516000036113af5760405162461bcd60e51b8152602060048201526002602482015261434160f01b6044820152606401610621565b60015460408051633fbeef2560e11b815290516000926001600160a01b031691637f7dde4a9160048083019260209291908290030181865afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141d91906156ed565b90506000600160009054906101000a90046001600160a01b03166001600160a01b0316633cc742256040518163ffffffff1660e01b8152600401602060405180830381865afa158015611474573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149891906156ed565b60035460405163065c20bb60e41b81526001600160a01b038781166004830152929350600092909116906365c20bb090602401602060405180830381865afa1580156114e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150c91906156ed565b90506115426040518060a00160405280600081526020016000815260200160001515815260200160008152602001600081525090565b61154a615318565b826001600160a01b0316632d42b52b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611588573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ac919061570a565b60208084019190915260015460408051633a0df78d60e11b815290516001600160a01b039092169263741bef1a926004808401938290030181865afa1580156115f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161d91906156ed565b604051635670bcc760e11b81526001600160a01b038981166004830152919091169063ace1798e906024016020604051808303816000875af1158015611667573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168b919061570a565b8083526116999088906131b1565b15801560408401526116c2576116bb878686856000015186602001518b613236565b90506116db565b6116d8878686856000015186602001518b613648565b90505b60008160200151116117145760405162461bcd60e51b81526020600482015260026024820152610c1360f21b6044820152606401610621565b608081015160a082015160405163335525ad60e01b81526001600160a01b0386169263335525ad9261175192600401918252602082015260400190565b600060405180830381600087803b15801561176b57600080fd5b505af115801561177f573d6000803e3d6000fd5b505060025460c084015160e0850151604051634cf97b6360e11b81526001600160a01b0390931694506399f2f6c693506117c1928c928b928b926004016157e9565b600060405180830381600087803b1580156117db57600080fd5b505af11580156117ef573d6000803e3d6000fd5b505050506101008101511561186b576005546101008201516040516347878f1560e01b81526001600160a01b03888116936347878f1593611838938d9390921691600401615723565b600060405180830381600087803b15801561185257600080fd5b505af1158015611866573d6000803e3d6000fd5b505050505b6002546040808301519051636f58393d60e11b81526001600160a01b039092169163deb0727a916118a2918b918a91600401615723565b600060405180830381600087803b1580156118bc57600080fd5b505af11580156118d0573d6000803e3d6000fd5b50505060208201516060840152506101008101516040820151825161190092916118fa9190613091565b90613091565b6080808401829052606080850151604080860151868401518251938452602084019690965290820152908101929092526001600160a01b038916917fa3f221854f649364e9a3bb384dd1ff938482664f4a0eac0f6e39a542f5193bd3910160405180910390a261197b878633846060015185604001516137e7565b50505050505050565b6040805160e08101808352600154633fbeef2560e11b909152915160009282916001600160a01b0390911690637f7dde4a9060e4808501916020918187030181865afa1580156119d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fc91906156ed565b6001600160a01b03168152602001600160009054906101000a90046001600160a01b03166001600160a01b0316633cc742256040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8191906156ed565b6001600160a01b0390811682526000602083018190526040808401829052600854831660608501526080840182905260a0909301819052600354925163065c20bb60e41b81528783166004820152939450929116906365c20bb090602401602060405180830381865afa158015611afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b2091906156ed565b9050611b566040518060a00160405280600081526020016000815260200160001515815260200160008152602001600081525090565b611b5e615318565b600160009054906101000a90046001600160a01b03166001600160a01b031663741bef1a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd591906156ed565b604051635670bcc760e11b81526001600160a01b038881166004830152919091169063ace1798e906024016020604051808303816000875af1158015611c1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c43919061570a565b826000018181525050826001600160a01b0316632d42b52b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cae919061570a565b60208301526002548251604051638a490ebf60e01b81526001600160a01b0389811660048301526024820192909252911690638a490ebf906044016020604051808303816000875af1158015611d08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2c919061581d565b1580156040840152611d5457611d4d868584600001518560200151896138bc565b9050611d75565b611d728685600001518660200151856000015186602001518a613e32565b90505b6000816020015111611dae5760405162461bcd60e51b81526020600482015260026024820152610c1360f21b6044820152606401610621565b608081015160a082015160405163335525ad60e01b81526001600160a01b0386169263335525ad92611deb92600401918252602082015260400190565b600060405180830381600087803b158015611e0557600080fd5b505af1158015611e19573d6000803e3d6000fd5b50506002548651602088015160c086015160e0870151604051634cf97b6360e11b81526001600160a01b0390951696506399f2f6c69550611e62948d94939291906004016157e9565b600060405180830381600087803b158015611e7c57600080fd5b505af1158015611e90573d6000803e3d6000fd5b5050505061010081015115611f0f5783516005546101008301516040516347878f1560e01b81526001600160a01b03938416936347878f1593611edc938c939290911691600401615723565b600060405180830381600087803b158015611ef657600080fd5b505af1158015611f0a573d6000803e3d6000fd5b505050505b60025484516040808401519051636f58393d60e11b81526001600160a01b039093169263deb0727a92611f46928b92600401615723565b600060405180830381600087803b158015611f6057600080fd5b505af1158015611f74573d6000803e3d6000fd5b505050602082015160608401525061010081015160408201518251611f9e92916118fa9190613091565b6080808401829052606080850151604080860151868401518251938452602084019690965290820152908101929092526001600160a01b038816917fa3f221854f649364e9a3bb384dd1ff938482664f4a0eac0f6e39a542f5193bd3910160405180910390a261201d86856000015133846060015185604001516137e7565b505050505050565b6002546040516374927c0960e01b8152839183916001600160a01b03909116906374927c099061205b9085908590600401615747565b602060405180830381865afa158015612078573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209c919061581d565b6120cd5760405162461bcd60e51b8152602060048201526002602482015261125560f21b6044820152606401610621565b6040805160018082528183019092526000916020808301908036833701905050905083816000815181106121035761210361583a565b60200260200101906001600160a01b031690816001600160a01b03168152505061212d8582611379565b5050505050565b600080600160009054906101000a90046001600160a01b03166001600160a01b0316637f7dde4a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561218a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ae91906156ed565b604051635373433f60e01b81526001600160a01b0385811660048301529190911690635373433f90602401602060405180830381865afa1580156121f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061221a919061570a565b90506000600160009054906101000a90046001600160a01b03166001600160a01b0316633cc742256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612271573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229591906156ed565b604051635373433f60e01b81526001600160a01b0386811660048301529190911690635373433f90602401610581565b6000546001600160a01b031633146122ef5760405162461bcd60e51b8152600401610621906157b4565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f98c5e303d085e26fdf8af6a41184b0937ed01142ae7fdfa02dcc87e7079c325390600090a250565b6000546001600160a01b031633146123635760405162461bcd60e51b8152600401610621906157b4565b600a805460ff1916911515919091179055565b6000546001600160a01b031633146123a05760405162461bcd60e51b8152600401610621906157b4565b6001600160a01b03166000908152600960205260409020805460ff19169055565b600154600160a81b900460ff16158080156123e7575060018054600160a01b900460ff16105b806124075750303b158015612407575060018054600160a01b900460ff16145b61246a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610621565b6001805460ff60a01b1916600160a01b1790558015612497576001805460ff60a81b1916600160a81b1790555b600854600160a01b900460ff16156124d65760405162461bcd60e51b8152602060048201526002602482015261414960f01b6044820152606401610621565b6124df8961403b565b6124e88861403b565b6124f18761403b565b6124fa8661403b565b6125038561403b565b61250c8461403b565b6125158361403b565b61251e8261403b565b60088054600380546001600160a01b03199081166001600160a01b038e8116919091179092556004805482168d84161790556005805482168c84161790556006805482168b8416179055600160a01b6001600160a81b03199093168983161792909217909255600780548216878416179055600280549091169184169190911790556125a9836122c5565b80156125f0576001805460ff60a81b191681556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b6000546001600160a01b031633146126255760405162461bcd60e51b8152600401610621906157b4565b6001600160a01b03811661268a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610621565b61269381613161565b50565b60006126a28284615850565b90505b92915050565b60006001600160a01b038316158061272f5750604051631da4d95d60e31b81526001600160a01b0385169063ed26cae8906126ec9088908790600401615747565b602060405180830381865afa158015612709573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061272d919061581d565b155b8061281a57506001546040516305f8cff960e01b81526001600160a01b038781166004830152909116906305f8cff990602401602060405180830381865afa15801561277f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a3919061570a565b60025460405163b1eafaab60e01b81526001600160a01b039091169063b1eafaab906127d790899088908890600401615723565b602060405180830381865afa1580156127f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612818919061570a565b105b15612827575060006105ce565b6040516339ed25cd60e01b81526000906001600160a01b038616906339ed25cd906128589089908890600401615747565b602060405180830381865afa158015612875573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289991906156ed565b90506001600160a01b038116158061299157506001546040516305f8cff960e01b81526001600160a01b038881166004830152909116906305f8cff990602401602060405180830381865afa1580156128f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061291a919061570a565b60025460405163b1eafaab60e01b81526001600160a01b039091169063b1eafaab9061294e908a9086908990600401615723565b602060405180830381865afa15801561296b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298f919061570a565b105b9695505050505050565b6129c1604051806060016040528060008152602001600081526020016000151581525090565b604080516060810182526001600160a01b03808c168083528a821660208401528284018990526001549351635daaf32b60e11b815260048101919091529192612ad3928a92612ace92169063bb55e65690602401602060405180830381865afa158015612a32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a56919061570a565b60025485516020870151604051631e7c58c160e31b81526001600160a01b039093169263f3e2c60892612a8d929091600401615747565b602060405180830381865afa158015612aaa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fa919061570a565b6140e4565b808352612af4908790612aee90670de0b6b3a76400006140fa565b90614106565b6020808401919091528251600254835192840151604051631e7c58c160e31b8152600094612b3b94936001600160a01b03169263f3e2c60892612a8d929190600401615747565b60208085015160025485519286015160405163305a536960e01b8152949550600094612b7f946001600160a01b039093169263305a536992612a8d92600401615747565b600154604051635daaf32b60e11b81526001600160a01b038f8116600483015292935091169063bb55e65690602401602060405180830381865afa158015612bcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bef919061570a565b8203612dab5760025483516020850151604051633ed3a18f60e21b81526001600160a01b039093169263fb4e863c92612c2c929091600401615747565b600060405180830381600087803b158015612c4657600080fd5b505af1158015612c5a573d6000803e3d6000fd5b50506002548551602087015160405163f7fe1e1360e01b81526001600160a01b03909316945063f7fe1e139350612c9592600490810161587e565b600060405180830381600087803b158015612caf57600080fd5b505af1158015612cc3573d6000803e3d6000fd5b505084516020860151600154604051635daaf32b60e11b8152612d5c95509293508f926001600160a01b039091169063bb55e65690612d159086906004016001600160a01b0391909116815260200190565b602060405180830381865afa158015612d32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d56919061570a565b85614112565b82602001516001600160a01b031683600001516001600160a01b03166000805160206159c383398151915260008060006003604051612d9e94939291906158c8565b60405180910390a3613081565b6000612db78284614281565b90508581141580612e405750600154845160405163c4063a1960e01b81526001600160a01b03918216600482015291169063c4063a1990602401602060405180830381865afa158015612e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e32919061570a565b8451612e3e90856142b0565b105b15612e5657505060016040840152506130859050565b60808c01518451602086015160405163bc9b5bd560e01b81526001600160a01b0392831660048201529082166024820152604481018490528a82166064820152898216608482015291169063bc9b5bd59060a401600060405180830381600087803b158015612ec457600080fd5b505af1158015612ed8573d6000803e3d6000fd5b505060025486516020880151604051637793467f60e11b81526001600160a01b039283166004820152908216602482015260448101889052606481018790529116925063ef268cfe9150608401600060405180830381600087803b158015612f3f57600080fd5b505af1158015612f53573d6000803e3d6000fd5b50506002548651602088015160405163dbe9f91960e01b81526001600160a01b03909316945063dbe9f9199350612f8c92600401615747565b6020604051808303816000875af1158015612fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fcf919061570a565b506020840151845160025460405163dc3fe76f60e01b81526001600160a01b0380851694818516946000805160206159c3833981519152948a948a949091169263dc3fe76f9261302492909190600401615747565b602060405180830381865afa158015613041573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613065919061570a565b600360405161307794939291906158c8565b60405180910390a3505b5050505b98975050505050505050565b60006126a282846158ea565b600061312483612aee600160009054906101000a90046001600160a01b03166001600160a01b031663a20baee66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311d919061570a565b87906140fa565b90508181111561315b5760405162461bcd60e51b8152602060048201526002602482015261464d60f01b6044820152606401610621565b50505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806131be848461432b565b600154604051631f6a526d60e11b81526001600160a01b038781166004830152929350911690633ed4a4da90602401602060405180830381865afa15801561320a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061322e919061570a565b119392505050565b61323e615318565b613246615364565b61324e615318565b84825260006080830152613261896103f4565b60a083015261326f89612134565b60c0830152600060208301525b83518260200151101561363c578382602001518151811061329f5761329f61583a565b60209081029190910101516001600160a01b039081166060840181905260025460405163614d120960e01b815292169163614d1209916132e4918d9190600401615747565b602060405180830381865afa158015613301573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613325919061570a565b60010361362457600254606083015160405163b1eafaab60e01b81526001600160a01b039092169163b1eafaab91613364918d91908b90600401615723565b602060405180830381865afa158015613381573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133a5919061570a565b60408301526080820151613566576001546040516305f8cff960e01b81526001600160a01b038b81166004830152909116906305f8cff990602401602060405180830381865afa1580156133fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613421919061570a565b82604001511015801561343357508151155b61362457600061344c8360c001518460a001518961435a565b905061346a8a8a8a866060015187604001518860000151878e614383565b6080810151845191935061347e9190613091565b8352608082015160a084015161349391613091565b8360a00181815250506134c88261010001516118fa84604001516118fa8660a001518860c0015161309190919063ffffffff16565b60c08401526134d78483614cb2565b60025460c085015160a086015160405163015937cb60e41b81529397506001600160a01b03909216926315937cb092613519928f929091908d9060040161578e565b602060405180830381865afa158015613536573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061355a919061581d565b15608084015250613624565b816080015180156135e757506001546040516305f8cff960e01b81526001600160a01b038b81166004830152909116906305f8cff990602401602060405180830381865afa1580156135bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135e0919061570a565b8260400151105b156136245761360189898985606001518660000151614d93565b608081015183519192506136159190613091565b82526136218382614cb2565b92505b6020820180519061363482615901565b90525061327c565b50509695505050505050565b613650615318565b613658615364565b613660615318565b848252600060208301525b83518260200151101561363c578382602001518151811061368e5761368e61583a565b60209081029190910101516001600160a01b039081166060840181905260025460405163b1eafaab60e01b815292169163b1eafaab916136d5918d91908b90600401615723565b602060405180830381865afa1580156136f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613716919061570a565b60408381019190915260015490516305f8cff960e01b81526001600160a01b038b81166004830152909116906305f8cff990602401602060405180830381865afa158015613768573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061378c919061570a565b826040015110156137cf576137ac89898985606001518660000151614d93565b608081015183519192506137c09190613091565b82526137cc8382614cb2565b92505b602082018051906137df82615901565b90525061366b565b81156138585760065460048054604051631062c15f60e11b81526001600160a01b03938416936320c582be9361382593909116918891889101615723565b600060405180830381600087803b15801561383f57600080fd5b505af1158015613853573d6000803e3d6000fd5b505050505b801561212d576040516347878f1560e01b81526001600160a01b038516906347878f159061388e90889087908690600401615723565b600060405180830381600087803b1580156138a857600080fd5b505af11580156125f0573d6000803e3d6000fd5b6138c4615318565b604080516060810182526001600160a01b0388168152600060208201529081018590526138ef615364565b6138f7615318565b85825260006080830152825161390c906103f4565b60a0830152825161391c90612134565b60c083015260808801518351604051637608271560e01b81526001600160a01b039182166004820152911690637608271590602401602060405180830381865afa15801561396e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061399291906156ed565b6001600160a01b03908116606084015260808901518451604051631bdb4c8d60e01b815290831660048201526000929190911690631bdb4c8d90602401602060405180830381865afa1580156139ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a1091906156ed565b6000602085015290505b858360200151108015613a435750806001600160a01b031683606001516001600160a01b031614155b15613e25576080890151845160608501516040516239c6e160ea1b81526000936001600160a01b03169263e71b840092613a7f92600401615747565b602060405180830381865afa158015613a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ac091906156ed565b600254865160608701516040808a0151905163b1eafaab60e01b81529495506001600160a01b039093169363b1eafaab93613aff939291600401615723565b602060405180830381865afa158015613b1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b40919061570a565b60408501526080840151613d2f576001546040516305f8cff960e01b81526001600160a01b038d81166004830152909116906305f8cff990602401602060405180830381865afa158015613b98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bbc919061570a565b846040015110158015613bce57508351155b15613bd95750613e25565b6000613bf28560c001518660a00151886040015161435a565b9050613c2086600001518c600001518d60200151886060015189604001518a60000151878d60400151614383565b60808101518651919550613c349190613091565b8552608084015160a0860151613c4991613091565b8560a0018181525050613c7e8461010001516118fa86604001516118fa8860a001518a60c0015161309190919063ffffffff16565b60c0860152613c8d8785614cb2565b9650600260009054906101000a90046001600160a01b03166001600160a01b03166315937cb08d8760c001518860a001518a604001516040518563ffffffff1660e01b8152600401613ce2949392919061578e565b602060405180830381865afa158015613cff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d23919061581d565b15608086015250613dff565b83608001518015613db057506001546040516305f8cff960e01b81526001600160a01b038d81166004830152909116906305f8cff990602401602060405180830381865afa158015613d85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613da9919061570a565b8460400151105b15613df95784518a5160208c015160608701518751613dd29493929190614d93565b60808101518551919450613de69190613091565b8452613df28684614cb2565b9550613dff565b50613e25565b6001600160a01b0316606084015260208301805190613e1d82615901565b905250613a1a565b5050505095945050505050565b613e3a615318565b613e42615364565b613e4a615318565b600854858352600060208401526001600160a01b03165b848360200151101561402e57604051637608271560e01b81526001600160a01b038b81166004830152821690637608271590602401602060405180830381865afa158015613eb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ed791906156ed565b6001600160a01b039081166060850181905260025460405163b1eafaab60e01b815292169163b1eafaab91613f13918e91908c90600401615723565b602060405180830381865afa158015613f30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f54919061570a565b60408481019190915260015490516305f8cff960e01b81526001600160a01b038c81166004830152909116906305f8cff990602401602060405180830381865afa158015613fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fca919061570a565b8360400151101561401157613fea8a8a8a86606001518760000151614d93565b60808101518451919350613ffe9190613091565b835261400a8483614cb2565b9350614016565b61402e565b6020830180519061402682615901565b905250613e61565b5050509695505050505050565b6001600160a01b0381166140915760405162461bcd60e51b815260206004820152601e60248201527f4163636f756e742063616e6e6f74206265207a65726f206164647265737300006044820152606401610621565b803b806140e05760405162461bcd60e51b815260206004820181905260248201527f4163636f756e7420636f64652073697a652063616e6e6f74206265207a65726f6044820152606401610621565b5050565b60008183106140f357816126a2565b5090919050565b60006126a2828461591a565b60006126a28284615939565b604084810151600480549251632770a7eb60e21b81526001600160a01b039384169181019190915260248101859052911690639dc29fac90604401600060405180830381600087803b15801561416757600080fd5b505af115801561417b573d6000803e3d6000fd5b5050855160405163fb24e5f760e01b81526001600160a01b03898116600483015260248201879052909116925063fb24e5f79150604401600060405180830381600087803b1580156141cc57600080fd5b505af11580156141e0573d6000803e3d6000fd5b505050508360a001516001600160a01b031663fe9454b48685846040518463ffffffff1660e01b815260040161421893929190615723565b600060405180830381600087803b15801561423257600080fd5b505af1158015614246573d6000803e3d6000fd5b5050855160a08701516040516347878f1560e01b81526001600160a01b0390921693506347878f15925061388e918991908690600401615723565b600081156142a7576142a082612aee8568056bc75e2d631000006140fa565b90506126a5565b506000196126a5565b600154604051635daaf32b60e11b81526001600160a01b0384811660048301526000926126a29291169063bb55e65690602401602060405180830381865afa158015614300573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614324919061570a565b8390613091565b60008061433784612134565b90506000614344856103f4565b905061435182828661435a565b95945050505050565b600082156143775761437083612aee86856140fa565b905061437c565b506000195b9392505050565b61438b615318565b6143af60405180606001604052806000815260200160008152602001600081525090565b6002546040516320618ae960e11b81526001600160a01b038c8116600483015260019216906340c315d290602401602060405180830381865afa1580156143fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061441e919061570a565b116144295750613085565b6002546040516309bde83560e21b81526001600160a01b03909116906326f7a0d49061445b908d908b90600401615747565b608060405180830381865afa158015614478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061449c919061595b565b604085015260208481019190915284018190529083526144bd908b906150e9565b6040838101919091526001549051635daaf32b60e11b81526001600160a01b038c811660048301529091169063bb55e65690602401602060405180830381865afa15801561450f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614533919061570a565b60608301526040820151602083015161454b91613091565b81526001546040805163397f12d560e11b815290516001600160a01b03909216916372fe25aa916004808201926020929091908290030181865afa158015614597573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145bb919061570a565b86116147b95760025460208201516040808401519051631b1cd2a360e31b81526001600160a01b039093169263d8e6951892614601928f928f928f9290916004016157e9565b600060405180830381600087803b15801561461b57600080fd5b505af115801561462f573d6000803e3d6000fd5b5050600254604051633ed3a18f60e21b81526001600160a01b03909116925063fb4e863c9150614665908d908b90600401615747565b600060405180830381600087803b15801561467f57600080fd5b505af1158015614693573d6000803e3d6000fd5b505060006080850181905260a08501525050815160c0830152805160e083015260025460405163f7fe1e1360e01b81526001600160a01b039091169063f7fe1e13906146e8908d908b9060039060040161587e565b600060405180830381600087803b15801561470257600080fd5b505af1158015614716573d6000803e3d6000fd5b50505050866001600160a01b03168a6001600160a01b03167f44b1a33c624451b36e8d636828145aa4eb39bd6cc5e2cf623bb270d3abc38c8884600001518560200151600260405161476a93929190615991565b60405180910390a3866001600160a01b03168a6001600160a01b03166000805160206159c3833981519152600080600060026040516147ac94939291906158c8565b60405180910390a3614ca5565b600160009054906101000a90046001600160a01b03166001600160a01b03166372fe25aa6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561480c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614830919061570a565b861180156148aa57506001546040516305f8cff960e01b81526001600160a01b038c81166004830152909116906305f8cff990602401602060405180830381865afa158015614883573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148a7919061570a565b86105b156149de5760025460208201516040808401519051631b1cd2a360e31b81526001600160a01b039093169263d8e69518926148ef928f928f928f9290916004016157e9565b600060405180830381600087803b15801561490957600080fd5b505af115801561491d573d6000803e3d6000fd5b5050600254604051633ed3a18f60e21b81526001600160a01b03909116925063fb4e863c9150614953908d908b90600401615747565b600060405180830381600087803b15801561496d57600080fd5b505af1158015614981573d6000803e3d6000fd5b505083518351614995935090915087615162565b60e086015260c085015260a0840152608083015260025460405163f7fe1e1360e01b81526001600160a01b039091169063f7fe1e13906146e8908d908b9060039060040161587e565b6001546040516305f8cff960e01b81526001600160a01b038c81166004830152909116906305f8cff990602401602060405180830381865afa158015614a28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614a4c919061570a565b8610158015614a5a57508386105b8015614a67575081518510155b15614c945760025460208201516040808401519051631b1cd2a360e31b81526001600160a01b039093169263d8e6951892614aac928f928f928f9290916004016157e9565b600060405180830381600087803b158015614ac657600080fd5b505af1158015614ada573d6000803e3d6000fd5b5050505084600003614aee57614aee6159ac565b600254604051633ed3a18f60e21b81526001600160a01b039091169063fb4e863c90614b20908d908b90600401615747565b600060405180830381600087803b158015614b3a57600080fd5b505af1158015614b4e573d6000803e3d6000fd5b50505050614b668a83600001518460200151866151bc565b60025460405163f7fe1e1360e01b81529193506001600160a01b03169063f7fe1e1390614b9c908d908b9060039060040161587e565b600060405180830381600087803b158015614bb657600080fd5b505af1158015614bca573d6000803e3d6000fd5b5050505061010082015115614c4457600554610100830151604051633fa5152d60e21b81526001600160a01b039092169163fe9454b491614c11918e918c91600401615723565b600060405180830381600087803b158015614c2b57600080fd5b505af1158015614c3f573d6000803e3d6000fd5b505050505b866001600160a01b03168a6001600160a01b03167f44b1a33c624451b36e8d636828145aa4eb39bd6cc5e2cf623bb270d3abc38c8884600001518560a00151600260405161476a93929190615991565b614c9c615318565b91506130859050565b5098975050505050505050565b614cba615318565b60408083015190840151614ccd91612696565b604082015260608083015190840151614ce591612696565b606082015281516020840151614cfa91612696565b6020808301919091528201518351614d1191612696565b815260808083015190840151614d2691612696565b608082015260a08083015190840151614d3e91612696565b60a082015260c08083015190840151614d5691612696565b60c082015260e08083015190840151614d6e91612696565b60e08201526101008083015190840151614d8791612696565b61010082015292915050565b614d9b615318565b614dbf60405180606001604052806000815260200160008152602001600081525090565b6002546040516309bde83560e21b81526001600160a01b03909116906326f7a0d490614df1908a908890600401615747565b608060405180830381865afa158015614e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614e32919061595b565b60408086019182526020868101938452870193909352928552600254905192519151631b1cd2a360e31b81526001600160a01b039091169263d8e6951892614e82928c928c928c926004016157e9565b600060405180830381600087803b158015614e9c57600080fd5b505af1158015614eb0573d6000803e3d6000fd5b5050600254604051633ed3a18f60e21b81526001600160a01b03909116925063fb4e863c9150614ee6908a908890600401615747565b600060405180830381600087803b158015614f0057600080fd5b505af1158015614f14573d6000803e3d6000fd5b50505050614f268783602001516150e9565b6040838101919091526001549051635daaf32b60e11b81526001600160a01b0389811660048301529091169063bb55e65690602401602060405180830381865afa158015614f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614f9c919061570a565b606083015260408201516020830151600091614fb89190613091565b9050614fc983600001518286615162565b60e087015260c086015260a0850152608084015260025460405163f7fe1e1360e01b81526001600160a01b039091169063f7fe1e1390615012908b90899060039060040161587e565b600060405180830381600087803b15801561502c57600080fd5b505af1158015615040573d6000803e3d6000fd5b50505050846001600160a01b0316886001600160a01b03167f44b1a33c624451b36e8d636828145aa4eb39bd6cc5e2cf623bb270d3abc38c8885600001518660200151600160405161509493929190615991565b60405180910390a3846001600160a01b0316886001600160a01b03166000805160206159c3833981519152600080600060016040516150d694939291906158c8565b60405180910390a3505095945050505050565b60015460405163b6c93c3960e01b81526001600160a01b038481166004830152600092169063b6c93c3990602401602060405180830381865afa158015615134573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190615158919061570a565b6126a29083615939565b600080808084156151a65761517787866140e4565b935061518787612aee88876140fa565b92506151938785613091565b915061519f8684613091565b90506151b3565b5060009250829150859050845b93509350935093565b6151c4615318565b838152602081018390526001546040516305f8cff960e01b81526001600160a01b03878116600483015260009261524e928692612aee9216906305f8cff990602401602060405180830381865afa158015615223573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190615247919061570a565b88906140fa565b905061525a86826150e9565b6040838101919091526001549051635daaf32b60e11b81526001600160a01b0388811660048301529091169063bb55e65690602401602060405180830381865afa1580156152ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906152d0919061570a565b60608301526080820185905260408201516152ec908290613091565b60a08301526152fb8482613091565b61010083015250600060c0820181905260e0820152949350505050565b6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040518060e0016040528060008152602001600081526020016000815260200160006001600160a01b0316815260200160001515815260200160008152602001600081525090565b6001600160a01b038116811461269357600080fd5b80356153cc816153ac565b919050565b6000602082840312156153e357600080fd5b813561437c816153ac565b600080600080600080600080610100898b03121561540b57600080fd5b8835615416816153ac565b975060208901359650604089013561542d816153ac565b9550606089013561543d816153ac565b9450608089013561544d816153ac565b979a969950949793969560a0850135955060c08501359460e001359350915050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561549857600080fd5b82356154a3816153ac565b915060208381013567ffffffffffffffff808211156154c157600080fd5b818601915086601f8301126154d557600080fd5b8135818111156154e7576154e761546f565b8060051b604051601f19603f8301168101818110858211171561550c5761550c61546f565b60405291825284820192508381018501918983111561552a57600080fd5b938501935b8285101561554f57615540856153c1565b8452938501939285019261552f565b8096505050505050509250929050565b6000806040838503121561557257600080fd5b823561557d816153ac565b946020939093013593505050565b6000806040838503121561559e57600080fd5b82356155a9816153ac565b915060208301356155b9816153ac565b809150509250929050565b600060208083528351808285015260005b818110156155f1578581018301518582016040015282016155d5565b81811115615603576000604083870101525b50601f01601f1916929092016040019392505050565b801515811461269357600080fd5b60006020828403121561563957600080fd5b813561437c81615619565b600080600080600080600080610100898b03121561566157600080fd5b883561566c816153ac565b9750602089013561567c816153ac565b9650604089013561568c816153ac565b9550606089013561569c816153ac565b945060808901356156ac816153ac565b935060a08901356156bc816153ac565b925060c08901356156cc816153ac565b915060e08901356156dc816153ac565b809150509295985092959890939650565b6000602082840312156156ff57600080fd5b815161437c816153ac565b60006020828403121561571c57600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052601160045260246000fd5b60008161578657615786615761565b506000190190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6001600160a01b03958616815293851660208501529190931660408301526060820192909252608081019190915260a00190565b60006020828403121561582f57600080fd5b815161437c81615619565b634e487b7160e01b600052603260045260246000fd5b6000821982111561586357615863615761565b500190565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b0384811682528316602082015260608101600583106158a6576158a6615868565b826040830152949350505050565b600481106158c4576158c4615868565b9052565b84815260208101849052604081018390526080810161435160608301846158b4565b6000828210156158fc576158fc615761565b500390565b60006001820161591357615913615761565b5060010190565b600081600019048311821515161561593457615934615761565b500290565b60008261595657634e487b7160e01b600052601260045260246000fd5b500490565b6000806000806080858703121561597157600080fd5b505082516020840151604085015160609095015191969095509092509050565b83815260208101839052606081016105ce60408301846158b4565b634e487b7160e01b600052600160045260246000fdfe100d2512a463b515ea8d03a69afbcc791f1bd9139132e820631bec236f524ec1a2646970667358221220443b8dcdec648d8322b11c7187502e586531ceefdfee7d3e67c2a0a2e49505a264736f6c634300080e0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80638da5cb5b116100f9578063ae91875411610097578063d733cfd011610071578063d733cfd0146103ae578063e90f42ba146103c1578063f2fde38b146103d4578063f6c5d736146103e757600080fd5b8063ae91875414610381578063b4c9d17e14610394578063cfefff3d146103a757600080fd5b8063a263757f116100d3578063a263757f14610310578063a3f4df7e14610323578063a9419ca31461035b578063acc18b531461036e57600080fd5b80638da5cb5b146102dd5780639e86d0c4146102ee578063a20baee61461030157600080fd5b8063431d47241161016657806372141e631161014057806372141e631461029c5780637c92590f146102a45780637f551157146102b757806386b9d81f146102ca57600080fd5b8063431d47241461026e5780634ac2ce2f14610281578063715018a61461029457600080fd5b806323019524146101ae57806323977b4d146101de57806327d04b35146102115780632f2b4e9014610232578063392e53cd1461024557806340a44bd114610259575b600080fd5b6006546101c1906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6102016101ec3660046153d1565b60096020526000908152604090205460ff1681565b60405190151581526020016101d5565b61022461021f3660046153d1565b6103f4565b6040519081526020016101d5565b6003546101c1906001600160a01b031681565b60085461020190600160a01b900460ff1681565b61026c6102673660046153ee565b6105d6565b005b61026c61027c3660046153d1565b6112f5565b6007546101c1906001600160a01b031681565b61026c611343565b6101c1600081565b61026c6102b2366004615485565b611379565b61026c6102c536600461555f565b611984565b61026c6102d836600461558b565b612025565b6000546001600160a01b03166101c1565b6102246102fc3660046153d1565b612134565b610224670de0b6b3a764000081565b61026c61031e3660046153d1565b6122c5565b61034e6040518060400160405280600c81526020016b2a3937bb32a6b0b730b3b2b960a11b81525081565b6040516101d591906155c4565b6002546101c1906001600160a01b031681565b61026c61037c366004615627565b612339565b6008546101c1906001600160a01b031681565b61026c6103a23660046153d1565b612376565b6001610201565b61026c6103bc366004615644565b6123c1565b6001546101c1906001600160a01b031681565b61026c6103e23660046153d1565b6125fb565b600a546102019060ff1681565b600080600160009054906101000a90046001600160a01b03166001600160a01b0316637f7dde4a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561044a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046e91906156ed565b60405163d1234da760e01b81526001600160a01b038581166004830152919091169063d1234da790602401602060405180830381865afa1580156104b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104da919061570a565b90506000600160009054906101000a90046001600160a01b03166001600160a01b0316633cc742256040518163ffffffff1660e01b8152600401602060405180830381865afa158015610531573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055591906156ed565b60405163d1234da760e01b81526001600160a01b038681166004830152919091169063d1234da7906024015b602060405180830381865afa15801561059e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c2919061570a565b90506105ce8282612696565b949350505050565b600a5460ff161561062a573360009081526009602052604090205460ff1661062a5760405162461bcd60e51b81526020600482015260026024820152614e5760f01b60448201526064015b60405180910390fd5b600154604051630e24a3fb60e31b81526001600160a01b038a81166004830152909116906371251fd890602401602060405180830381865afa158015610674573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610698919061570a565b4210156106cc5760405162461bcd60e51b8152602060048201526002602482015261212960f11b6044820152606401610621565b6040805160e08101808352600154633fbeef2560e11b909152915160009282916001600160a01b0390911690637f7dde4a9060e4808501916020918187030181865afa158015610720573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074491906156ed565b6001600160a01b03168152602001600160009054906101000a90046001600160a01b03166001600160a01b0316633cc742256040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c991906156ed565b6001600160a01b039081168252600654811660208084019190915260075482166040808501919091526008548316606080860191909152600554841660808087019190915260045490941660a0958601528151610100810183526000808252938101849052918201839052810182905291820181905291810182905260c0810182905260e0810191909152909150600254604051633ec59b6760e21b81526001600160a01b038c81166004830152602482018690529091169063fb166d9c9060440160006040518083038186803b1580156108a357600080fd5b505afa1580156108b7573d6000803e3d6000fd5b50505050600160009054906101000a90046001600160a01b03166001600160a01b031663741bef1a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561090e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093291906156ed565b604051635670bcc760e11b81526001600160a01b038c81166004830152919091169063ace1798e906024016020604051808303816000875af115801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a0919061570a565b60c0820181905260025460405163142250bf60e31b81526001600160a01b038d81166004830152602482019390935291169063a11285f89060440160006040518083038186803b1580156109f357600080fd5b505afa158015610a07573d6000803e3d6000fd5b505060025460405163e823c24960e01b8152600481018d90526001600160a01b03909116925063e823c249915060240160006040518083038186803b158015610a4f57600080fd5b505afa158015610a63573d6000803e3d6000fd5b5050600254604080860151905163ac3e45b160e01b81526001600160a01b03909216935063ac3e45b19250610a9e9133908e90600401615723565b60006040518083038186803b158015610ab657600080fd5b505afa158015610aca573d6000803e3d6000fd5b50505050610ad78a6103f4565b60e0820152888152608082015160c0820151600091610afa918d91908c906126ab565b15610b06575087610d05565b6080830151604051637608271560e01b81526001600160a01b038d8116600483015290911690637608271590602401602060405180830381865afa158015610b52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7691906156ed565b90505b6001600160a01b03811615801590610c8657506001546040516305f8cff960e01b81526001600160a01b038d81166004830152909116906305f8cff990602401602060405180830381865afa158015610bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfa919061570a565b600260009054906101000a90046001600160a01b03166001600160a01b031663b1eafaab8d848660c001516040518463ffffffff1660e01b8152600401610c4393929190615723565b602060405180830381865afa158015610c60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c84919061570a565b105b15610d055782608001516001600160a01b031663e71b84008c836040518363ffffffff1660e01b8152600401610cbd929190615747565b602060405180830381865afa158015610cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfe91906156ed565b9050610b79565b84600003610d135760001994505b6001600160a01b03811615801590610d2b5750815115155b8015610d375750600085115b15610eda5784610d4681615777565b955050600083608001516001600160a01b031663e71b84008d846040518363ffffffff1660e01b8152600401610d7d929190615747565b602060405180830381865afa158015610d9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbe91906156ed565b9050600260009054906101000a90046001600160a01b03166001600160a01b03166331f4bceb8d86600001518760200151866040518563ffffffff1660e01b8152600401610e3594939291906001600160a01b03948516815292841660208401529083166040830152909116606082015260800190565b600060405180830381600087803b158015610e4f57600080fd5b505af1158015610e63573d6000803e3d6000fd5b505050506000610e818d868587600001518860c001518f8f8f61299b565b9050806040015115610e94575050610eda565b80516020850151610ea491612696565b6020808601919091528101516040850151610ebe91612696565b604085015280518451610ed091613091565b8452509050610d13565b6000826040015111610f135760405162461bcd60e51b81526020600482015260026024820152612aa960f11b6044820152606401610621565b600260009054906101000a90046001600160a01b03166001600160a01b031663c5d75f7b8c84604001518560c001518660e001516040518563ffffffff1660e01b8152600401610f66949392919061578e565b6020604051808303816000875af1158015610f85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa9919061570a565b506002546040838101519051631f07590560e01b81526001600160a01b038e811660048301526024820192909252911690631f07590590604401602060405180830381865afa158015611000573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611024919061570a565b60608301819052604083015161103b91908661309d565b82600001516001600160a01b03166347878f158c856060015185606001516040518463ffffffff1660e01b815260040161107793929190615723565b600060405180830381600087803b15801561109157600080fd5b505af11580156110a5573d6000803e3d6000fd5b50505060608085015190840151604051630912c0f360e11b81526001600160a01b038f8116600483015260248201929092529116915063122581e690604401600060405180830381600087803b1580156110fe57600080fd5b505af1158015611112573d6000803e3d6000fd5b505050506060820151604083015161112991613091565b8260800181815250508a6001600160a01b03167f08b6f1ce3f9ab2722e8ea40c31a3e3a806a41702c5994f29af43dc0c1f2837df8b846020015185604001518660600151604051611193949392919093845260208401929092526040830152606082015260800190565b60405180910390a260408084015160208401519151632770a7eb60e21b815233600482015260248101929092526001600160a01b031690639dc29fac90604401600060405180830381600087803b1580156111ed57600080fd5b505af1158015611201573d6000803e3d6000fd5b50508451602085015160405163fb24e5f760e01b81526001600160a01b03909216935063fb24e5f7925061124e918f91906004016001600160a01b03929092168252602082015260400190565b600060405180830381600087803b15801561126857600080fd5b505af115801561127c573d6000803e3d6000fd5b5050845160808501516040516347878f1560e01b81526001600160a01b0390921693506347878f1592506112b6918f913391600401615723565b600060405180830381600087803b1580156112d057600080fd5b505af11580156112e4573d6000803e3d6000fd5b505050505050505050505050505050565b6000546001600160a01b0316331461131f5760405162461bcd60e51b8152600401610621906157b4565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000546001600160a01b0316331461136d5760405162461bcd60e51b8152600401610621906157b4565b6113776000613161565b565b80516000036113af5760405162461bcd60e51b8152602060048201526002602482015261434160f01b6044820152606401610621565b60015460408051633fbeef2560e11b815290516000926001600160a01b031691637f7dde4a9160048083019260209291908290030181865afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141d91906156ed565b90506000600160009054906101000a90046001600160a01b03166001600160a01b0316633cc742256040518163ffffffff1660e01b8152600401602060405180830381865afa158015611474573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149891906156ed565b60035460405163065c20bb60e41b81526001600160a01b038781166004830152929350600092909116906365c20bb090602401602060405180830381865afa1580156114e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150c91906156ed565b90506115426040518060a00160405280600081526020016000815260200160001515815260200160008152602001600081525090565b61154a615318565b826001600160a01b0316632d42b52b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611588573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ac919061570a565b60208084019190915260015460408051633a0df78d60e11b815290516001600160a01b039092169263741bef1a926004808401938290030181865afa1580156115f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161d91906156ed565b604051635670bcc760e11b81526001600160a01b038981166004830152919091169063ace1798e906024016020604051808303816000875af1158015611667573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168b919061570a565b8083526116999088906131b1565b15801560408401526116c2576116bb878686856000015186602001518b613236565b90506116db565b6116d8878686856000015186602001518b613648565b90505b60008160200151116117145760405162461bcd60e51b81526020600482015260026024820152610c1360f21b6044820152606401610621565b608081015160a082015160405163335525ad60e01b81526001600160a01b0386169263335525ad9261175192600401918252602082015260400190565b600060405180830381600087803b15801561176b57600080fd5b505af115801561177f573d6000803e3d6000fd5b505060025460c084015160e0850151604051634cf97b6360e11b81526001600160a01b0390931694506399f2f6c693506117c1928c928b928b926004016157e9565b600060405180830381600087803b1580156117db57600080fd5b505af11580156117ef573d6000803e3d6000fd5b505050506101008101511561186b576005546101008201516040516347878f1560e01b81526001600160a01b03888116936347878f1593611838938d9390921691600401615723565b600060405180830381600087803b15801561185257600080fd5b505af1158015611866573d6000803e3d6000fd5b505050505b6002546040808301519051636f58393d60e11b81526001600160a01b039092169163deb0727a916118a2918b918a91600401615723565b600060405180830381600087803b1580156118bc57600080fd5b505af11580156118d0573d6000803e3d6000fd5b50505060208201516060840152506101008101516040820151825161190092916118fa9190613091565b90613091565b6080808401829052606080850151604080860151868401518251938452602084019690965290820152908101929092526001600160a01b038916917fa3f221854f649364e9a3bb384dd1ff938482664f4a0eac0f6e39a542f5193bd3910160405180910390a261197b878633846060015185604001516137e7565b50505050505050565b6040805160e08101808352600154633fbeef2560e11b909152915160009282916001600160a01b0390911690637f7dde4a9060e4808501916020918187030181865afa1580156119d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fc91906156ed565b6001600160a01b03168152602001600160009054906101000a90046001600160a01b03166001600160a01b0316633cc742256040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8191906156ed565b6001600160a01b0390811682526000602083018190526040808401829052600854831660608501526080840182905260a0909301819052600354925163065c20bb60e41b81528783166004820152939450929116906365c20bb090602401602060405180830381865afa158015611afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b2091906156ed565b9050611b566040518060a00160405280600081526020016000815260200160001515815260200160008152602001600081525090565b611b5e615318565b600160009054906101000a90046001600160a01b03166001600160a01b031663741bef1a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd591906156ed565b604051635670bcc760e11b81526001600160a01b038881166004830152919091169063ace1798e906024016020604051808303816000875af1158015611c1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c43919061570a565b826000018181525050826001600160a01b0316632d42b52b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cae919061570a565b60208301526002548251604051638a490ebf60e01b81526001600160a01b0389811660048301526024820192909252911690638a490ebf906044016020604051808303816000875af1158015611d08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2c919061581d565b1580156040840152611d5457611d4d868584600001518560200151896138bc565b9050611d75565b611d728685600001518660200151856000015186602001518a613e32565b90505b6000816020015111611dae5760405162461bcd60e51b81526020600482015260026024820152610c1360f21b6044820152606401610621565b608081015160a082015160405163335525ad60e01b81526001600160a01b0386169263335525ad92611deb92600401918252602082015260400190565b600060405180830381600087803b158015611e0557600080fd5b505af1158015611e19573d6000803e3d6000fd5b50506002548651602088015160c086015160e0870151604051634cf97b6360e11b81526001600160a01b0390951696506399f2f6c69550611e62948d94939291906004016157e9565b600060405180830381600087803b158015611e7c57600080fd5b505af1158015611e90573d6000803e3d6000fd5b5050505061010081015115611f0f5783516005546101008301516040516347878f1560e01b81526001600160a01b03938416936347878f1593611edc938c939290911691600401615723565b600060405180830381600087803b158015611ef657600080fd5b505af1158015611f0a573d6000803e3d6000fd5b505050505b60025484516040808401519051636f58393d60e11b81526001600160a01b039093169263deb0727a92611f46928b92600401615723565b600060405180830381600087803b158015611f6057600080fd5b505af1158015611f74573d6000803e3d6000fd5b505050602082015160608401525061010081015160408201518251611f9e92916118fa9190613091565b6080808401829052606080850151604080860151868401518251938452602084019690965290820152908101929092526001600160a01b038816917fa3f221854f649364e9a3bb384dd1ff938482664f4a0eac0f6e39a542f5193bd3910160405180910390a261201d86856000015133846060015185604001516137e7565b505050505050565b6002546040516374927c0960e01b8152839183916001600160a01b03909116906374927c099061205b9085908590600401615747565b602060405180830381865afa158015612078573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209c919061581d565b6120cd5760405162461bcd60e51b8152602060048201526002602482015261125560f21b6044820152606401610621565b6040805160018082528183019092526000916020808301908036833701905050905083816000815181106121035761210361583a565b60200260200101906001600160a01b031690816001600160a01b03168152505061212d8582611379565b5050505050565b600080600160009054906101000a90046001600160a01b03166001600160a01b0316637f7dde4a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561218a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ae91906156ed565b604051635373433f60e01b81526001600160a01b0385811660048301529190911690635373433f90602401602060405180830381865afa1580156121f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061221a919061570a565b90506000600160009054906101000a90046001600160a01b03166001600160a01b0316633cc742256040518163ffffffff1660e01b8152600401602060405180830381865afa158015612271573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229591906156ed565b604051635373433f60e01b81526001600160a01b0386811660048301529190911690635373433f90602401610581565b6000546001600160a01b031633146122ef5760405162461bcd60e51b8152600401610621906157b4565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f98c5e303d085e26fdf8af6a41184b0937ed01142ae7fdfa02dcc87e7079c325390600090a250565b6000546001600160a01b031633146123635760405162461bcd60e51b8152600401610621906157b4565b600a805460ff1916911515919091179055565b6000546001600160a01b031633146123a05760405162461bcd60e51b8152600401610621906157b4565b6001600160a01b03166000908152600960205260409020805460ff19169055565b600154600160a81b900460ff16158080156123e7575060018054600160a01b900460ff16105b806124075750303b158015612407575060018054600160a01b900460ff16145b61246a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610621565b6001805460ff60a01b1916600160a01b1790558015612497576001805460ff60a81b1916600160a81b1790555b600854600160a01b900460ff16156124d65760405162461bcd60e51b8152602060048201526002602482015261414960f01b6044820152606401610621565b6124df8961403b565b6124e88861403b565b6124f18761403b565b6124fa8661403b565b6125038561403b565b61250c8461403b565b6125158361403b565b61251e8261403b565b60088054600380546001600160a01b03199081166001600160a01b038e8116919091179092556004805482168d84161790556005805482168c84161790556006805482168b8416179055600160a01b6001600160a81b03199093168983161792909217909255600780548216878416179055600280549091169184169190911790556125a9836122c5565b80156125f0576001805460ff60a81b191681556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b6000546001600160a01b031633146126255760405162461bcd60e51b8152600401610621906157b4565b6001600160a01b03811661268a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610621565b61269381613161565b50565b60006126a28284615850565b90505b92915050565b60006001600160a01b038316158061272f5750604051631da4d95d60e31b81526001600160a01b0385169063ed26cae8906126ec9088908790600401615747565b602060405180830381865afa158015612709573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061272d919061581d565b155b8061281a57506001546040516305f8cff960e01b81526001600160a01b038781166004830152909116906305f8cff990602401602060405180830381865afa15801561277f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a3919061570a565b60025460405163b1eafaab60e01b81526001600160a01b039091169063b1eafaab906127d790899088908890600401615723565b602060405180830381865afa1580156127f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612818919061570a565b105b15612827575060006105ce565b6040516339ed25cd60e01b81526000906001600160a01b038616906339ed25cd906128589089908890600401615747565b602060405180830381865afa158015612875573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289991906156ed565b90506001600160a01b038116158061299157506001546040516305f8cff960e01b81526001600160a01b038881166004830152909116906305f8cff990602401602060405180830381865afa1580156128f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061291a919061570a565b60025460405163b1eafaab60e01b81526001600160a01b039091169063b1eafaab9061294e908a9086908990600401615723565b602060405180830381865afa15801561296b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298f919061570a565b105b9695505050505050565b6129c1604051806060016040528060008152602001600081526020016000151581525090565b604080516060810182526001600160a01b03808c168083528a821660208401528284018990526001549351635daaf32b60e11b815260048101919091529192612ad3928a92612ace92169063bb55e65690602401602060405180830381865afa158015612a32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a56919061570a565b60025485516020870151604051631e7c58c160e31b81526001600160a01b039093169263f3e2c60892612a8d929091600401615747565b602060405180830381865afa158015612aaa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fa919061570a565b6140e4565b808352612af4908790612aee90670de0b6b3a76400006140fa565b90614106565b6020808401919091528251600254835192840151604051631e7c58c160e31b8152600094612b3b94936001600160a01b03169263f3e2c60892612a8d929190600401615747565b60208085015160025485519286015160405163305a536960e01b8152949550600094612b7f946001600160a01b039093169263305a536992612a8d92600401615747565b600154604051635daaf32b60e11b81526001600160a01b038f8116600483015292935091169063bb55e65690602401602060405180830381865afa158015612bcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bef919061570a565b8203612dab5760025483516020850151604051633ed3a18f60e21b81526001600160a01b039093169263fb4e863c92612c2c929091600401615747565b600060405180830381600087803b158015612c4657600080fd5b505af1158015612c5a573d6000803e3d6000fd5b50506002548551602087015160405163f7fe1e1360e01b81526001600160a01b03909316945063f7fe1e139350612c9592600490810161587e565b600060405180830381600087803b158015612caf57600080fd5b505af1158015612cc3573d6000803e3d6000fd5b505084516020860151600154604051635daaf32b60e11b8152612d5c95509293508f926001600160a01b039091169063bb55e65690612d159086906004016001600160a01b0391909116815260200190565b602060405180830381865afa158015612d32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d56919061570a565b85614112565b82602001516001600160a01b031683600001516001600160a01b03166000805160206159c383398151915260008060006003604051612d9e94939291906158c8565b60405180910390a3613081565b6000612db78284614281565b90508581141580612e405750600154845160405163c4063a1960e01b81526001600160a01b03918216600482015291169063c4063a1990602401602060405180830381865afa158015612e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e32919061570a565b8451612e3e90856142b0565b105b15612e5657505060016040840152506130859050565b60808c01518451602086015160405163bc9b5bd560e01b81526001600160a01b0392831660048201529082166024820152604481018490528a82166064820152898216608482015291169063bc9b5bd59060a401600060405180830381600087803b158015612ec457600080fd5b505af1158015612ed8573d6000803e3d6000fd5b505060025486516020880151604051637793467f60e11b81526001600160a01b039283166004820152908216602482015260448101889052606481018790529116925063ef268cfe9150608401600060405180830381600087803b158015612f3f57600080fd5b505af1158015612f53573d6000803e3d6000fd5b50506002548651602088015160405163dbe9f91960e01b81526001600160a01b03909316945063dbe9f9199350612f8c92600401615747565b6020604051808303816000875af1158015612fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fcf919061570a565b506020840151845160025460405163dc3fe76f60e01b81526001600160a01b0380851694818516946000805160206159c3833981519152948a948a949091169263dc3fe76f9261302492909190600401615747565b602060405180830381865afa158015613041573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613065919061570a565b600360405161307794939291906158c8565b60405180910390a3505b5050505b98975050505050505050565b60006126a282846158ea565b600061312483612aee600160009054906101000a90046001600160a01b03166001600160a01b031663a20baee66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311d919061570a565b87906140fa565b90508181111561315b5760405162461bcd60e51b8152602060048201526002602482015261464d60f01b6044820152606401610621565b50505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806131be848461432b565b600154604051631f6a526d60e11b81526001600160a01b038781166004830152929350911690633ed4a4da90602401602060405180830381865afa15801561320a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061322e919061570a565b119392505050565b61323e615318565b613246615364565b61324e615318565b84825260006080830152613261896103f4565b60a083015261326f89612134565b60c0830152600060208301525b83518260200151101561363c578382602001518151811061329f5761329f61583a565b60209081029190910101516001600160a01b039081166060840181905260025460405163614d120960e01b815292169163614d1209916132e4918d9190600401615747565b602060405180830381865afa158015613301573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613325919061570a565b60010361362457600254606083015160405163b1eafaab60e01b81526001600160a01b039092169163b1eafaab91613364918d91908b90600401615723565b602060405180830381865afa158015613381573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133a5919061570a565b60408301526080820151613566576001546040516305f8cff960e01b81526001600160a01b038b81166004830152909116906305f8cff990602401602060405180830381865afa1580156133fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613421919061570a565b82604001511015801561343357508151155b61362457600061344c8360c001518460a001518961435a565b905061346a8a8a8a866060015187604001518860000151878e614383565b6080810151845191935061347e9190613091565b8352608082015160a084015161349391613091565b8360a00181815250506134c88261010001516118fa84604001516118fa8660a001518860c0015161309190919063ffffffff16565b60c08401526134d78483614cb2565b60025460c085015160a086015160405163015937cb60e41b81529397506001600160a01b03909216926315937cb092613519928f929091908d9060040161578e565b602060405180830381865afa158015613536573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061355a919061581d565b15608084015250613624565b816080015180156135e757506001546040516305f8cff960e01b81526001600160a01b038b81166004830152909116906305f8cff990602401602060405180830381865afa1580156135bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135e0919061570a565b8260400151105b156136245761360189898985606001518660000151614d93565b608081015183519192506136159190613091565b82526136218382614cb2565b92505b6020820180519061363482615901565b90525061327c565b50509695505050505050565b613650615318565b613658615364565b613660615318565b848252600060208301525b83518260200151101561363c578382602001518151811061368e5761368e61583a565b60209081029190910101516001600160a01b039081166060840181905260025460405163b1eafaab60e01b815292169163b1eafaab916136d5918d91908b90600401615723565b602060405180830381865afa1580156136f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613716919061570a565b60408381019190915260015490516305f8cff960e01b81526001600160a01b038b81166004830152909116906305f8cff990602401602060405180830381865afa158015613768573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061378c919061570a565b826040015110156137cf576137ac89898985606001518660000151614d93565b608081015183519192506137c09190613091565b82526137cc8382614cb2565b92505b602082018051906137df82615901565b90525061366b565b81156138585760065460048054604051631062c15f60e11b81526001600160a01b03938416936320c582be9361382593909116918891889101615723565b600060405180830381600087803b15801561383f57600080fd5b505af1158015613853573d6000803e3d6000fd5b505050505b801561212d576040516347878f1560e01b81526001600160a01b038516906347878f159061388e90889087908690600401615723565b600060405180830381600087803b1580156138a857600080fd5b505af11580156125f0573d6000803e3d6000fd5b6138c4615318565b604080516060810182526001600160a01b0388168152600060208201529081018590526138ef615364565b6138f7615318565b85825260006080830152825161390c906103f4565b60a0830152825161391c90612134565b60c083015260808801518351604051637608271560e01b81526001600160a01b039182166004820152911690637608271590602401602060405180830381865afa15801561396e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061399291906156ed565b6001600160a01b03908116606084015260808901518451604051631bdb4c8d60e01b815290831660048201526000929190911690631bdb4c8d90602401602060405180830381865afa1580156139ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a1091906156ed565b6000602085015290505b858360200151108015613a435750806001600160a01b031683606001516001600160a01b031614155b15613e25576080890151845160608501516040516239c6e160ea1b81526000936001600160a01b03169263e71b840092613a7f92600401615747565b602060405180830381865afa158015613a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ac091906156ed565b600254865160608701516040808a0151905163b1eafaab60e01b81529495506001600160a01b039093169363b1eafaab93613aff939291600401615723565b602060405180830381865afa158015613b1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b40919061570a565b60408501526080840151613d2f576001546040516305f8cff960e01b81526001600160a01b038d81166004830152909116906305f8cff990602401602060405180830381865afa158015613b98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bbc919061570a565b846040015110158015613bce57508351155b15613bd95750613e25565b6000613bf28560c001518660a00151886040015161435a565b9050613c2086600001518c600001518d60200151886060015189604001518a60000151878d60400151614383565b60808101518651919550613c349190613091565b8552608084015160a0860151613c4991613091565b8560a0018181525050613c7e8461010001516118fa86604001516118fa8860a001518a60c0015161309190919063ffffffff16565b60c0860152613c8d8785614cb2565b9650600260009054906101000a90046001600160a01b03166001600160a01b03166315937cb08d8760c001518860a001518a604001516040518563ffffffff1660e01b8152600401613ce2949392919061578e565b602060405180830381865afa158015613cff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d23919061581d565b15608086015250613dff565b83608001518015613db057506001546040516305f8cff960e01b81526001600160a01b038d81166004830152909116906305f8cff990602401602060405180830381865afa158015613d85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613da9919061570a565b8460400151105b15613df95784518a5160208c015160608701518751613dd29493929190614d93565b60808101518551919450613de69190613091565b8452613df28684614cb2565b9550613dff565b50613e25565b6001600160a01b0316606084015260208301805190613e1d82615901565b905250613a1a565b5050505095945050505050565b613e3a615318565b613e42615364565b613e4a615318565b600854858352600060208401526001600160a01b03165b848360200151101561402e57604051637608271560e01b81526001600160a01b038b81166004830152821690637608271590602401602060405180830381865afa158015613eb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ed791906156ed565b6001600160a01b039081166060850181905260025460405163b1eafaab60e01b815292169163b1eafaab91613f13918e91908c90600401615723565b602060405180830381865afa158015613f30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f54919061570a565b60408481019190915260015490516305f8cff960e01b81526001600160a01b038c81166004830152909116906305f8cff990602401602060405180830381865afa158015613fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fca919061570a565b8360400151101561401157613fea8a8a8a86606001518760000151614d93565b60808101518451919350613ffe9190613091565b835261400a8483614cb2565b9350614016565b61402e565b6020830180519061402682615901565b905250613e61565b5050509695505050505050565b6001600160a01b0381166140915760405162461bcd60e51b815260206004820152601e60248201527f4163636f756e742063616e6e6f74206265207a65726f206164647265737300006044820152606401610621565b803b806140e05760405162461bcd60e51b815260206004820181905260248201527f4163636f756e7420636f64652073697a652063616e6e6f74206265207a65726f6044820152606401610621565b5050565b60008183106140f357816126a2565b5090919050565b60006126a2828461591a565b60006126a28284615939565b604084810151600480549251632770a7eb60e21b81526001600160a01b039384169181019190915260248101859052911690639dc29fac90604401600060405180830381600087803b15801561416757600080fd5b505af115801561417b573d6000803e3d6000fd5b5050855160405163fb24e5f760e01b81526001600160a01b03898116600483015260248201879052909116925063fb24e5f79150604401600060405180830381600087803b1580156141cc57600080fd5b505af11580156141e0573d6000803e3d6000fd5b505050508360a001516001600160a01b031663fe9454b48685846040518463ffffffff1660e01b815260040161421893929190615723565b600060405180830381600087803b15801561423257600080fd5b505af1158015614246573d6000803e3d6000fd5b5050855160a08701516040516347878f1560e01b81526001600160a01b0390921693506347878f15925061388e918991908690600401615723565b600081156142a7576142a082612aee8568056bc75e2d631000006140fa565b90506126a5565b506000196126a5565b600154604051635daaf32b60e11b81526001600160a01b0384811660048301526000926126a29291169063bb55e65690602401602060405180830381865afa158015614300573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614324919061570a565b8390613091565b60008061433784612134565b90506000614344856103f4565b905061435182828661435a565b95945050505050565b600082156143775761437083612aee86856140fa565b905061437c565b506000195b9392505050565b61438b615318565b6143af60405180606001604052806000815260200160008152602001600081525090565b6002546040516320618ae960e11b81526001600160a01b038c8116600483015260019216906340c315d290602401602060405180830381865afa1580156143fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061441e919061570a565b116144295750613085565b6002546040516309bde83560e21b81526001600160a01b03909116906326f7a0d49061445b908d908b90600401615747565b608060405180830381865afa158015614478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061449c919061595b565b604085015260208481019190915284018190529083526144bd908b906150e9565b6040838101919091526001549051635daaf32b60e11b81526001600160a01b038c811660048301529091169063bb55e65690602401602060405180830381865afa15801561450f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614533919061570a565b60608301526040820151602083015161454b91613091565b81526001546040805163397f12d560e11b815290516001600160a01b03909216916372fe25aa916004808201926020929091908290030181865afa158015614597573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145bb919061570a565b86116147b95760025460208201516040808401519051631b1cd2a360e31b81526001600160a01b039093169263d8e6951892614601928f928f928f9290916004016157e9565b600060405180830381600087803b15801561461b57600080fd5b505af115801561462f573d6000803e3d6000fd5b5050600254604051633ed3a18f60e21b81526001600160a01b03909116925063fb4e863c9150614665908d908b90600401615747565b600060405180830381600087803b15801561467f57600080fd5b505af1158015614693573d6000803e3d6000fd5b505060006080850181905260a08501525050815160c0830152805160e083015260025460405163f7fe1e1360e01b81526001600160a01b039091169063f7fe1e13906146e8908d908b9060039060040161587e565b600060405180830381600087803b15801561470257600080fd5b505af1158015614716573d6000803e3d6000fd5b50505050866001600160a01b03168a6001600160a01b03167f44b1a33c624451b36e8d636828145aa4eb39bd6cc5e2cf623bb270d3abc38c8884600001518560200151600260405161476a93929190615991565b60405180910390a3866001600160a01b03168a6001600160a01b03166000805160206159c3833981519152600080600060026040516147ac94939291906158c8565b60405180910390a3614ca5565b600160009054906101000a90046001600160a01b03166001600160a01b03166372fe25aa6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561480c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614830919061570a565b861180156148aa57506001546040516305f8cff960e01b81526001600160a01b038c81166004830152909116906305f8cff990602401602060405180830381865afa158015614883573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148a7919061570a565b86105b156149de5760025460208201516040808401519051631b1cd2a360e31b81526001600160a01b039093169263d8e69518926148ef928f928f928f9290916004016157e9565b600060405180830381600087803b15801561490957600080fd5b505af115801561491d573d6000803e3d6000fd5b5050600254604051633ed3a18f60e21b81526001600160a01b03909116925063fb4e863c9150614953908d908b90600401615747565b600060405180830381600087803b15801561496d57600080fd5b505af1158015614981573d6000803e3d6000fd5b505083518351614995935090915087615162565b60e086015260c085015260a0840152608083015260025460405163f7fe1e1360e01b81526001600160a01b039091169063f7fe1e13906146e8908d908b9060039060040161587e565b6001546040516305f8cff960e01b81526001600160a01b038c81166004830152909116906305f8cff990602401602060405180830381865afa158015614a28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614a4c919061570a565b8610158015614a5a57508386105b8015614a67575081518510155b15614c945760025460208201516040808401519051631b1cd2a360e31b81526001600160a01b039093169263d8e6951892614aac928f928f928f9290916004016157e9565b600060405180830381600087803b158015614ac657600080fd5b505af1158015614ada573d6000803e3d6000fd5b5050505084600003614aee57614aee6159ac565b600254604051633ed3a18f60e21b81526001600160a01b039091169063fb4e863c90614b20908d908b90600401615747565b600060405180830381600087803b158015614b3a57600080fd5b505af1158015614b4e573d6000803e3d6000fd5b50505050614b668a83600001518460200151866151bc565b60025460405163f7fe1e1360e01b81529193506001600160a01b03169063f7fe1e1390614b9c908d908b9060039060040161587e565b600060405180830381600087803b158015614bb657600080fd5b505af1158015614bca573d6000803e3d6000fd5b5050505061010082015115614c4457600554610100830151604051633fa5152d60e21b81526001600160a01b039092169163fe9454b491614c11918e918c91600401615723565b600060405180830381600087803b158015614c2b57600080fd5b505af1158015614c3f573d6000803e3d6000fd5b505050505b866001600160a01b03168a6001600160a01b03167f44b1a33c624451b36e8d636828145aa4eb39bd6cc5e2cf623bb270d3abc38c8884600001518560a00151600260405161476a93929190615991565b614c9c615318565b91506130859050565b5098975050505050505050565b614cba615318565b60408083015190840151614ccd91612696565b604082015260608083015190840151614ce591612696565b606082015281516020840151614cfa91612696565b6020808301919091528201518351614d1191612696565b815260808083015190840151614d2691612696565b608082015260a08083015190840151614d3e91612696565b60a082015260c08083015190840151614d5691612696565b60c082015260e08083015190840151614d6e91612696565b60e08201526101008083015190840151614d8791612696565b61010082015292915050565b614d9b615318565b614dbf60405180606001604052806000815260200160008152602001600081525090565b6002546040516309bde83560e21b81526001600160a01b03909116906326f7a0d490614df1908a908890600401615747565b608060405180830381865afa158015614e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614e32919061595b565b60408086019182526020868101938452870193909352928552600254905192519151631b1cd2a360e31b81526001600160a01b039091169263d8e6951892614e82928c928c928c926004016157e9565b600060405180830381600087803b158015614e9c57600080fd5b505af1158015614eb0573d6000803e3d6000fd5b5050600254604051633ed3a18f60e21b81526001600160a01b03909116925063fb4e863c9150614ee6908a908890600401615747565b600060405180830381600087803b158015614f0057600080fd5b505af1158015614f14573d6000803e3d6000fd5b50505050614f268783602001516150e9565b6040838101919091526001549051635daaf32b60e11b81526001600160a01b0389811660048301529091169063bb55e65690602401602060405180830381865afa158015614f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614f9c919061570a565b606083015260408201516020830151600091614fb89190613091565b9050614fc983600001518286615162565b60e087015260c086015260a0850152608084015260025460405163f7fe1e1360e01b81526001600160a01b039091169063f7fe1e1390615012908b90899060039060040161587e565b600060405180830381600087803b15801561502c57600080fd5b505af1158015615040573d6000803e3d6000fd5b50505050846001600160a01b0316886001600160a01b03167f44b1a33c624451b36e8d636828145aa4eb39bd6cc5e2cf623bb270d3abc38c8885600001518660200151600160405161509493929190615991565b60405180910390a3846001600160a01b0316886001600160a01b03166000805160206159c3833981519152600080600060016040516150d694939291906158c8565b60405180910390a3505095945050505050565b60015460405163b6c93c3960e01b81526001600160a01b038481166004830152600092169063b6c93c3990602401602060405180830381865afa158015615134573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190615158919061570a565b6126a29083615939565b600080808084156151a65761517787866140e4565b935061518787612aee88876140fa565b92506151938785613091565b915061519f8684613091565b90506151b3565b5060009250829150859050845b93509350935093565b6151c4615318565b838152602081018390526001546040516305f8cff960e01b81526001600160a01b03878116600483015260009261524e928692612aee9216906305f8cff990602401602060405180830381865afa158015615223573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190615247919061570a565b88906140fa565b905061525a86826150e9565b6040838101919091526001549051635daaf32b60e11b81526001600160a01b0388811660048301529091169063bb55e65690602401602060405180830381865afa1580156152ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906152d0919061570a565b60608301526080820185905260408201516152ec908290613091565b60a08301526152fb8482613091565b61010083015250600060c0820181905260e0820152949350505050565b6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040518060e0016040528060008152602001600081526020016000815260200160006001600160a01b0316815260200160001515815260200160008152602001600081525090565b6001600160a01b038116811461269357600080fd5b80356153cc816153ac565b919050565b6000602082840312156153e357600080fd5b813561437c816153ac565b600080600080600080600080610100898b03121561540b57600080fd5b8835615416816153ac565b975060208901359650604089013561542d816153ac565b9550606089013561543d816153ac565b9450608089013561544d816153ac565b979a969950949793969560a0850135955060c08501359460e001359350915050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561549857600080fd5b82356154a3816153ac565b915060208381013567ffffffffffffffff808211156154c157600080fd5b818601915086601f8301126154d557600080fd5b8135818111156154e7576154e761546f565b8060051b604051601f19603f8301168101818110858211171561550c5761550c61546f565b60405291825284820192508381018501918983111561552a57600080fd5b938501935b8285101561554f57615540856153c1565b8452938501939285019261552f565b8096505050505050509250929050565b6000806040838503121561557257600080fd5b823561557d816153ac565b946020939093013593505050565b6000806040838503121561559e57600080fd5b82356155a9816153ac565b915060208301356155b9816153ac565b809150509250929050565b600060208083528351808285015260005b818110156155f1578581018301518582016040015282016155d5565b81811115615603576000604083870101525b50601f01601f1916929092016040019392505050565b801515811461269357600080fd5b60006020828403121561563957600080fd5b813561437c81615619565b600080600080600080600080610100898b03121561566157600080fd5b883561566c816153ac565b9750602089013561567c816153ac565b9650604089013561568c816153ac565b9550606089013561569c816153ac565b945060808901356156ac816153ac565b935060a08901356156bc816153ac565b925060c08901356156cc816153ac565b915060e08901356156dc816153ac565b809150509295985092959890939650565b6000602082840312156156ff57600080fd5b815161437c816153ac565b60006020828403121561571c57600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052601160045260246000fd5b60008161578657615786615761565b506000190190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6001600160a01b03958616815293851660208501529190931660408301526060820192909252608081019190915260a00190565b60006020828403121561582f57600080fd5b815161437c81615619565b634e487b7160e01b600052603260045260246000fd5b6000821982111561586357615863615761565b500190565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b0384811682528316602082015260608101600583106158a6576158a6615868565b826040830152949350505050565b600481106158c4576158c4615868565b9052565b84815260208101849052604081018390526080810161435160608301846158b4565b6000828210156158fc576158fc615761565b500390565b60006001820161591357615913615761565b5060010190565b600081600019048311821515161561593457615934615761565b500290565b60008261595657634e487b7160e01b600052601260045260246000fd5b500490565b6000806000806080858703121561597157600080fd5b505082516020840151604085015160609095015191969095509092509050565b83815260208101839052606081016105ce60408301846158b4565b634e487b7160e01b600052600160045260246000fdfe100d2512a463b515ea8d03a69afbcc791f1bd9139132e820631bec236f524ec1a2646970667358221220443b8dcdec648d8322b11c7187502e586531ceefdfee7d3e67c2a0a2e49505a264736f6c634300080e0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.