Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
DynamicInterestRate
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
No with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {Ownable} from "./abstract/Ownable.sol"; import {Rebase, AuxRebase} from "./library/AuxRebase.sol"; import {IBaseContracts} from "./interface/IBaseContracts.sol"; import {IDynamicInterestRate} from "./interface/IDynamicInterestRate.sol"; import {IERC20Custom} from "./interface/IERC20Custom.sol"; import {ILender} from "./interface/ILender.sol"; import {IMarketLens} from "./interface/IMarketLens.sol"; import {IPSM} from "./interface/IPSM.sol"; import {IStakedDUSX} from "./interface/IStakedDUSX.sol"; import {ISupplyHangingCalculator} from "./interface/ISupplyHangingCalculator.sol"; import {IVault} from "./interface/IVault.sol"; /** * @title DynamicInterestRate * @dev Adaptive interest rate based on market metrics * @notice Manages protocol interest rates using system health indicators */ contract DynamicInterestRate is Ownable, IDynamicInterestRate { using AuxRebase for Rebase; // STATE VARIABLES bool public healthyState; uint256 public minPsmCapital; IMarketLens public marketLens; IStakedDUSX public immutable stDUSX; ISupplyHangingCalculator public supplyHangingCalculator; IPSM[] public pegStabilityModules; IVault public immutable vault; // CONFIGURATION uint256 public stakingRatioTrigger = 2500; uint256[] private _emergencyGradeArray; uint256[] private _interestRateArray; // STATE VARIABLES uint256 public maxStakingRatioMultiplier = 5000; uint256 public maxInterestRate = 10_000; uint256 public criticalEmergencyGrade = 9500; uint256 public constant TENK_PRECISION = 10_000; event MinPsmCapitalUpdated(uint256 newMinPsmCapital); event StakingRatioTriggerUpdated(uint256 newStakingRatioTrigger); event MaxStakingRatioMultiplierUpdated( uint256 newMaxStakingRatioMultiplier ); event MaxInterestRateUpdated(uint256 newMaxInterestRate); event CriticalEmergencyGradeUpdated(uint256 newCriticalEmergencyGrade); // ERRORS error EmptyArray(); error InvalidParameter(); error ZeroAddress(); error RateExceedsMaximum(uint256 rate); // CONSTRUCTOR constructor( IBaseContracts baseContracts_, uint256[] memory emergencyGradeArray_, uint256[] memory interestRateArray_ ) { _ensureNonzeroAddress(address(baseContracts_)); vault = baseContracts_.vault(); stDUSX = baseContracts_.stDUSX(); marketLens = baseContracts_.marketLens(); supplyHangingCalculator = baseContracts_.supplyCalculator(); _ensureNonzeroAddress(address(vault)); _ensureNonzeroAddress(address(stDUSX)); _ensureNonzeroAddress(address(marketLens)); _ensureNonzeroAddress(address(supplyHangingCalculator)); // Initialize PSMs IPSM[] memory psms_ = new IPSM[](2); psms_[0] = baseContracts_.psmCircle(); psms_[1] = baseContracts_.psmTether(); if (address(psms_[0]) == address(0) || address(psms_[1]) == address(0)) revert ZeroAddress(); pegStabilityModules = psms_; _emergencyGradeArray = emergencyGradeArray_; _interestRateArray = interestRateArray_; } // PUBLIC FUNCTIONS function setMinPsmCapital(uint256 newMinPsmCapital) external onlyOwner { minPsmCapital = newMinPsmCapital; emit MinPsmCapitalUpdated(newMinPsmCapital); } /** * @notice Updates the emergency grade array used for interest rate calculation * @dev Only callable by the contract owner * @param newEmergencyGradeArray The new array of emergency grade thresholds */ function updateEmergencyGradeArray( uint256[] calldata newEmergencyGradeArray ) external onlyOwner { if (newEmergencyGradeArray.length == 0) revert EmptyArray(); // Ensure the array is in ascending order for (uint256 i = 1; i < newEmergencyGradeArray.length; i++) { if (newEmergencyGradeArray[i] <= newEmergencyGradeArray[i - 1]) revert InvalidParameter(); } // Interest rate array must have exactly one more element than emergency grade array if (_interestRateArray.length != newEmergencyGradeArray.length + 1) revert InvalidParameter(); _emergencyGradeArray = newEmergencyGradeArray; } /** * @notice Updates the interest rate array used for interest rate calculation * @dev Only callable by the contract owner * @param newInterestRateArray The new array of interest rates */ function updateInterestRateArray( uint256[] calldata newInterestRateArray ) external onlyOwner { if (newInterestRateArray.length == 0) revert EmptyArray(); // Ensure all interest rates are within permitted range for (uint256 i = 0; i < newInterestRateArray.length; i++) { if (newInterestRateArray[i] > maxInterestRate) revert RateExceedsMaximum(newInterestRateArray[i]); } // Interest rate array must have exactly one more element than emergency grade array if (newInterestRateArray.length != _emergencyGradeArray.length + 1) revert InvalidParameter(); _interestRateArray = newInterestRateArray; } /** * @notice Updates both emergency grade and interest rate arrays simultaneously * @dev Only callable by the contract owner * @param newEmergencyGradeArray The new array of emergency grade thresholds * @param newInterestRateArray The new array of interest rates */ function updateRateArrays( uint256[] calldata newEmergencyGradeArray, uint256[] calldata newInterestRateArray ) external onlyOwner { if ( newEmergencyGradeArray.length == 0 || newInterestRateArray.length == 0 ) revert EmptyArray(); // Interest rate array must have exactly one more element than emergency grade array if (newInterestRateArray.length != newEmergencyGradeArray.length + 1) revert InvalidParameter(); // Ensure the emergency grade array is in ascending order for (uint256 i = 1; i < newEmergencyGradeArray.length; i++) { if (newEmergencyGradeArray[i] <= newEmergencyGradeArray[i - 1]) revert InvalidParameter(); } // Ensure all interest rates are within permitted range for (uint256 i = 0; i < newInterestRateArray.length; i++) { if (newInterestRateArray[i] > maxInterestRate) revert RateExceedsMaximum(newInterestRateArray[i]); } _emergencyGradeArray = newEmergencyGradeArray; _interestRateArray = newInterestRateArray; } /** * @notice Updates the staking ratio trigger value * @dev Only callable by the contract owner * @param newStakingRatioTrigger The new staking ratio trigger value */ function updateStakingRatioTrigger( uint256 newStakingRatioTrigger ) external onlyOwner { stakingRatioTrigger = newStakingRatioTrigger; emit StakingRatioTriggerUpdated(newStakingRatioTrigger); } /** * @notice Updates the maximum staking ratio multiplier * @dev Only callable by the contract owner * @param newMaxStakingRatioMultiplier The new maximum staking ratio multiplier */ function updateMaxStakingRatioMultiplier( uint256 newMaxStakingRatioMultiplier ) external onlyOwner { maxStakingRatioMultiplier = newMaxStakingRatioMultiplier; emit MaxStakingRatioMultiplierUpdated(newMaxStakingRatioMultiplier); } /** * @notice Updates the maximum interest rate * @dev Only callable by the contract owner * @param newMaxInterestRate The new maximum interest rate */ function updateMaxInterestRate( uint256 newMaxInterestRate ) external onlyOwner { maxInterestRate = newMaxInterestRate; emit MaxInterestRateUpdated(newMaxInterestRate); } /** * @notice Updates the critical emergency grade * @dev Only callable by the contract owner * @param newCriticalEmergencyGrade The new critical emergency grade */ function updateCriticalEmergencyGrade( uint256 newCriticalEmergencyGrade ) external onlyOwner { criticalEmergencyGrade = newCriticalEmergencyGrade; emit CriticalEmergencyGradeUpdated(newCriticalEmergencyGrade); } function getEmergencyGradeArray() external view returns (uint256[] memory) { return _emergencyGradeArray; } function getInterestRateArray() external view returns (uint256[] memory) { return _interestRateArray; } function getInterestPerSecond() external view returns (uint256) { return (getInterestRate() * 316880879) / 100; } function getInterestRate() public view returns (uint256) { if (pegStabilityModules.length == 0) revert EmptyArray(); uint256 supplyHanging = supplyHangingCalculator .getSupplyHangingUnsafe(); uint256 psmTotalCapital = _calculatePSMTotalCapital(); uint256 rate; if ( psmTotalCapital < minPsmCapital || supplyHanging >= psmTotalCapital ) { rate = _interestRateArray[_interestRateArray.length - 1]; } else { uint256 emergencyGrade = (supplyHanging * TENK_PRECISION) / psmTotalCapital; rate = _findApplicableRate(emergencyGrade); } uint256 stakingRatio = _calculateStakingRatio(); if (_shouldApplyStakingModifier(rate, stakingRatio)) { rate = _applyStakingModifier(rate, stakingRatio); } if (rate > maxInterestRate) revert RateExceedsMaximum(rate); return rate; } // PRIVATE FUNCTIONS function _calculatePSMTotalCapital() private view returns (uint256 total) { uint256 length = pegStabilityModules.length; for (uint256 i; i < length; ) { total += pegStabilityModules[i].dusxMinted(); unchecked { ++i; } } } function _calculateTotalBorrowed() private view returns (uint256 total) { address[] memory lenders = vault.getControllers(); uint256 length = lenders.length; for (uint256 i = 0; i < length; ) { total += marketLens.getTotalBorrowed(ILender(lenders[i])); unchecked { ++i; } } } function _calculateStakingRatio() private view returns (uint256) { uint256 totalBorrowed = _calculateTotalBorrowed(); uint256 ratio = 0; if (totalBorrowed != 0) { ratio = (IERC20Custom(address(stDUSX)).totalSupply() * TENK_PRECISION) / totalBorrowed; if (ratio > maxStakingRatioMultiplier) { ratio = maxStakingRatioMultiplier; } } return ratio; } function _findApplicableRate( uint256 emergencyGrade ) private view returns (uint256) { uint256 length = _emergencyGradeArray.length; uint256 i = 0; for (i; i < length; ) { if (emergencyGrade < _emergencyGradeArray[i]) { break; } unchecked { ++i; } } return _interestRateArray[i]; } function _shouldApplyStakingModifier( uint256 rate, uint256 stakingRatio ) private view returns (bool) { return stakingRatioTrigger > 0 && stakingRatio > stakingRatioTrigger && rate == _interestRateArray[0]; } function _applyStakingModifier( uint256 rate, uint256 stakingRatio ) private view returns (uint256) { return (rate * stakingRatio) / stakingRatioTrigger; } // Validates that an address is not zero function _ensureNonzeroAddress(address addr) private pure { if (addr == address(0)) { revert ZeroAddress(); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title Context * @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, as 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). * @notice This contract is used through inheritance. It will make available the * modifier `_msgSender()`, which can be used to reference the account that * called a function within an implementing contract. */ abstract contract Context { /*////////////////////////////////////////////////////////////// INTERNAL FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Gets the sender of the current call * @dev Provides a way to retrieve the message sender that supports meta-transactions * @return Sender address (msg.sender in the base implementation) */ function _msgSender() internal view virtual returns (address) { return msg.sender; } /** * @notice Gets the complete calldata of the current call * @dev Provides a way to retrieve the message data that supports meta-transactions * @return Complete calldata bytes */ function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @notice Gets the length of any context-specific suffix in the message data * @dev Used in meta-transaction implementations to account for additional data * @return Length of the context suffix (0 in the base implementation) */ function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {Context} from "./Context.sol"; /** * @title Ownable * @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. * @notice By default, the owner account will be the one that deploys the contract. * This can later be changed with {transferOwnership} and {renounceOwnership}. */ abstract contract Ownable is Context { /*////////////////////////////////////////////////////////////// STATE VARIABLES //////////////////////////////////////////////////////////////*/ /// @notice Address of the current owner address private _owner; /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ /// @notice Emitted when ownership is transferred event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /*////////////////////////////////////////////////////////////// CUSTOM ERRORS //////////////////////////////////////////////////////////////*/ /// @notice Thrown when non-owner tries to call owner-only function error UnauthorizedAccount(address account); /// @notice Thrown when trying to transfer ownership to invalid address error InvalidOwner(address owner); /*////////////////////////////////////////////////////////////// MODIFIERS //////////////////////////////////////////////////////////////*/ /** * @dev Throws if called by any account other than the owner */ modifier onlyOwner() { _checkOwner(); _; } /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ /** * @dev Initializes the contract setting the deployer as the initial owner */ constructor() { _transferOwnership(_msgSender()); } /*////////////////////////////////////////////////////////////// PUBLIC FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Leaves the contract without owner * @dev 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 { _transferOwnership(address(0)); } /** * @notice Transfers ownership of the contract to a new account * @dev The new owner cannot be the zero address * @param newOwner The address that will become the new owner */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert InvalidOwner(address(0)); } _transferOwnership(newOwner); } /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Returns the address of the current owner * @return Current owner address */ function owner() public view virtual returns (address) { return _owner; } /*////////////////////////////////////////////////////////////// INTERNAL FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @dev Transfers ownership of the contract to a new account (`newOwner`) * Internal function without access restriction */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev Throws if the sender is not the owner */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert UnauthorizedAccount(_msgSender()); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {IDUSXProvider} from "./IDUSXProvider.sol"; import {IERC20Token} from "./IERC20Token.sol"; import {IERC20TokenRebase} from "./IERC20TokenRebase.sol"; import {IFeesDistributor} from "./IFees.sol"; import {IFeesWithdrawer} from "./IFees.sol"; import {IFloor} from "./IFloor.sol"; import {ILenderOwner} from "./ILenderOwner.sol"; import {ILiquidationHelper} from "./ILiquidationHelper.sol"; import {IMarketLens} from "./IMarketLens.sol"; import {IMiscHelper} from "./IMiscHelper.sol"; import {IOracle} from "./IOracle.sol"; import {IPSM} from "./IPSM.sol"; import {IRepayHelper} from "./IRepayHelper.sol"; import {IStableOwner} from "./IStableOwner.sol"; import {IStakedDUSX} from "./IStakedDUSX.sol"; import {ISupplyHangingCalculator} from "./ISupplyHangingCalculator.sol"; import {IVault} from "./IVault.sol"; import {IVoteEscrowedSTTX} from "./IVoteEscrowedSTTX.sol"; import {IDynamicInterestRate} from "./IDynamicInterestRate.sol"; import {IMinter} from "./IMinter.sol"; interface IBaseContracts { struct CoreTokens { IERC20Token dusx; IERC20TokenRebase sttx; IStakedDUSX stDUSX; IVoteEscrowedSTTX veSTTX; } struct PSMContracts { IPSM psmCircle; IPSM psmTether; IStableOwner stableOwner; } struct OracleContracts { IOracle oracleChainlink; IOracle oracleFloorPrice; } struct HelperContracts { IMiscHelper helper; ILiquidationHelper liquidationHelper; IRepayHelper repayHelper; IMarketLens marketLens; } error ZeroAddress(); error ContractAlreadySet(); // Struct getters function coreTokens() external view returns (CoreTokens memory); function psmContracts() external view returns (PSMContracts memory); function oracleContracts() external view returns (OracleContracts memory); function helperContracts() external view returns (HelperContracts memory); // Individual contract getters function dusxProvider() external view returns (IDUSXProvider); function feesDistributor() external view returns (IFeesDistributor); function feesWithdrawer() external view returns (IFeesWithdrawer); function floor() external view returns (IFloor); function lenderOwner() external view returns (ILenderOwner); function minter() external view returns (IMinter); function supplyCalculator() external view returns (ISupplyHangingCalculator); function vault() external view returns (IVault); function dynamicInterestRate() external view returns (IDynamicInterestRate); // Convenience getters for struct members function dusx() external view returns (IERC20Token); function sttx() external view returns (IERC20TokenRebase); function stDUSX() external view returns (IStakedDUSX); function veSTTX() external view returns (IVoteEscrowedSTTX); function psmCircle() external view returns (IPSM); function psmTether() external view returns (IPSM); function stableOwner() external view returns (IStableOwner); function oracleChainlink() external view returns (IOracle); function oracleFloorPrice() external view returns (IOracle); function helper() external view returns (IMiscHelper); function liquidationHelper() external view returns (ILiquidationHelper); function repayHelper() external view returns (IRepayHelper); function marketLens() external view returns (IMarketLens); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title IDUSXProvider * @dev Interface for DUSX token provision and distribution operations * @notice Defines functionality for: * 1. Token provision management * 2. Supply control * 3. Distribution tracking */ interface IDUSXProvider { /*////////////////////////////////////////////////////////////// PROVISION OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Provides DUSX tokens to the requesting address * @param amount The quantity of DUSX tokens to provide in base units * @dev Handles: * · Token minting/transfer * · Supply tracking * · State updates * * Requirements: * · Caller is authorized * · Amount > 0 * · Within supply limits * * Effects: * · Increases recipient balance * · Updates total supply * · Emits provision event */ function provide(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title IDynamicInterestRate * @dev Interface for dynamic interest rate calculations in the lending protocol * @notice Defines methods for retrieving time-based interest rates that: * 1. Adjust based on market conditions * 2. Support per-second and base rate calculations * 3. Maintain precision through proper scaling * * This interface is crucial for: * · Accurate interest accrual * · Dynamic market response * · Protocol yield calculations */ interface IDynamicInterestRate { /*////////////////////////////////////////////////////////////// INTEREST RATE QUERIES //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves the current interest rate per second * @return uint256 Interest rate per second, scaled by 1e18 * @dev Used for precise interest calculations over time periods */ function getInterestPerSecond() external view returns (uint256); /** * @notice Retrieves the current base interest rate * @return uint256 Base interest rate, scaled by 1e18 * @dev Represents the foundational rate before adjustments */ function getInterestRate() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title IERC20Custom * @dev Interface for the ERC20 fungible token standard (EIP-20) * @notice Defines functionality for: * 1. Token transfers * 2. Allowance management * 3. Balance tracking * 4. Token metadata */ interface IERC20Custom { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ /** * @dev Emitted on token transfer between addresses * @param from Source address (0x0 for mints) * @param to Destination address (0x0 for burns) * @param value Amount of tokens transferred * @notice Tracks: * · Regular transfers * · Minting operations * · Burning operations */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when spending allowance is granted * @param owner Address granting permission * @param spender Address receiving permission * @param value Amount of tokens approved * @notice Records: * · New approvals * · Updated allowances * · Revoked permissions */ event Approval( address indexed owner, address indexed spender, uint256 value ); /*////////////////////////////////////////////////////////////// TRANSFER OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Transfers tokens to specified recipient * @param to Recipient address * @param value Amount to transfer in base units * @return bool True if transfer succeeds * @dev Requirements: * · Caller has sufficient balance * · Recipient is valid * · Amount > 0 * * Effects: * · Decreases caller balance * · Increases recipient balance * · Emits Transfer event */ function transfer(address to, uint256 value) external returns (bool); /** * @notice Executes transfer on behalf of token owner * @param from Source address * @param to Destination address * @param value Amount to transfer in base units * @return bool True if transfer succeeds * @dev Requirements: * · Caller has sufficient allowance * · Source has sufficient balance * · Valid addresses * * Effects: * · Decreases allowance * · Updates balances * · Emits Transfer event */ function transferFrom( address from, address to, uint256 value ) external returns (bool); /*////////////////////////////////////////////////////////////// APPROVAL OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Authorizes address to spend tokens * @param spender Address to authorize * @param value Amount to authorize in base units * @return bool True if approval succeeds * @dev Controls: * · Spending permissions * · Delegation limits * · Authorization levels * * Security: * · Overwrites previous allowance * · Requires explicit value * · Emits Approval event */ function approve(address spender, uint256 value) external returns (bool); /*////////////////////////////////////////////////////////////// TOKEN METADATA //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves human-readable token name * @return string Full token name */ function name() external view returns (string memory); /** * @notice Retrieves token trading symbol * @return string Short token identifier */ function symbol() external view returns (string memory); /** * @notice Retrieves token decimal precision * @return uint8 Number of decimal places * @dev Standard: * · 18 for most tokens * · Used for display formatting */ function decimals() external view returns (uint8); /*////////////////////////////////////////////////////////////// BALANCE QUERIES //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves total token supply * @return uint256 Current total supply * @dev Reflects: * · All minted tokens * · Minus burned tokens * · In base units */ function totalSupply() external view returns (uint256); /** * @notice Retrieves account token balance * @param account Address to query * @return uint256 Current balance in base units * @dev Returns: * · Available balance * · Includes pending rewards * · Excludes locked tokens */ function balanceOf(address account) external view returns (uint256); /** * @notice Retrieves remaining spending allowance * @param owner Token owner address * @param spender Authorized spender address * @return uint256 Current allowance in base units * @dev Shows: * · Approved amount * · Remaining limit * · Delegation status */ function allowance( address owner, address spender ) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {IERC20Custom} from "./IERC20Custom.sol"; /** * @title IERC20Token * @dev Extended interface for ERC20 tokens with supply control capabilities * @notice Defines functionality for: * 1. Token minting * 2. Token burning * 3. Supply management */ interface IERC20Token is IERC20Custom { /*////////////////////////////////////////////////////////////// SUPPLY MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Mints new tokens to specified account * @param account Address to receive minted tokens * @param amount Quantity of tokens to mint in base units * @dev Controls: * · Supply expansion * · Balance updates * · Event emission * * Requirements: * · Caller is authorized * · Within maxSupply * · Valid recipient */ function mint(address account, uint256 amount) external; /** * @notice Burns tokens from specified account * @param account Address to burn tokens from * @param amount Quantity of tokens to burn in base units * @dev Manages: * · Supply reduction * · Balance updates * · Event emission * * Requirements: * · Caller is authorized * · Sufficient balance * · Amount > 0 */ function burn(address account, uint256 amount) external; /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves maximum token supply limit * @return uint256 Maximum supply cap in base units * @dev Enforces: * · Supply ceiling * · Mint restrictions * · Protocol limits * * Note: This is an immutable value that * cannot be exceeded by minting operations */ function maxSupply() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {IERC20Custom} from "./IERC20Custom.sol"; /** * @title IERC20TokenRebase * @dev Extended interface for ERC20 tokens with elastic supply and safe management * @notice Defines functionality for: * 1. Supply elasticity (rebasing) * 2. Safe-based token management * 3. Supply control mechanisms * 4. Configuration management */ interface IERC20TokenRebase is IERC20Custom { /*////////////////////////////////////////////////////////////// SUPPLY MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Mints new tokens to specified account * @param account Address to receive minted tokens * @param amount Quantity of tokens to mint in base units * @dev Requires: * · Caller is authorized minter * · Within maxSupply limits * · Valid recipient */ function mint(address account, uint256 amount) external; /** * @notice Burns tokens from specified account * @param account Address to burn tokens from * @param amount Quantity of tokens to burn in base units * @dev Requires: * · Caller is authorized * · Account has sufficient balance * · Amount > 0 */ function burn(address account, uint256 amount) external; /*////////////////////////////////////////////////////////////// REBASE OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Executes supply rebase based on current parameters * @dev Triggers: * · Supply adjustment * · Balance recalculation * · Event emission * * Considers: * · Rebase interval * · Basis points * · Supply limits */ function rebase() external; /** * @notice Configures rebase parameters * @param rebaseInterval Time period between rebases (in seconds) * @param rebaseBasisPoints Scale factor for rebase (in basis points) * @dev Controls: * · Rebase frequency * · Rebase magnitude * · Supply elasticity */ function setRebaseConfig( uint256 rebaseInterval, uint256 rebaseBasisPoints ) external; /*////////////////////////////////////////////////////////////// SAFE MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Initializes new token management safe * @param safe Address of safe to create * @dev Establishes: * · Safe permissions * · Access controls * · Management capabilities */ function createSafe(address safe) external; /** * @notice Removes existing token management safe * @param safe Address of safe to remove * @dev Handles: * · Permission revocation * · State cleanup * · Access termination */ function destroySafe(address safe) external; /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves floor contract address * @return address Active floor contract * @dev Used for: * · Price stability * · Supply control */ function floor() external view returns (address); /** * @notice Retrieves authorized minter address * @return address Active minter contract * @dev Controls: * · Mint permissions * · Supply expansion */ function minter() external view returns (address); /** * @notice Returns absolute maximum token supply * @return uint256 Maximum supply cap in base units * @dev Enforces: * · Hard supply limit * · Mint restrictions */ function maxSupply() external view returns (uint256); /** * @notice Calculates maximum supply after rebase * @return uint256 Post-rebase maximum supply in base units * @dev Considers: * · Current max supply * · Rebase parameters * · Supply caps */ function maxSupplyRebased() external view returns (uint256); /** * @notice Calculates total supply after rebase * @return uint256 Post-rebase total supply in base units * @dev Reflects: * · Current supply * · Rebase effects * · Supply limits */ function totalSupplyRebased() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title IFeesWithdrawer * @dev Interface for protocol fee withdrawal operations * @notice Defines functionality for: * 1. Secure fee withdrawal * 2. Access control for withdrawals * 3. Protocol revenue management * * This interface ensures: * · Controlled access to protocol fees * · Safe transfer of accumulated revenue * · Proper accounting of withdrawn amounts */ interface IFeesWithdrawer { /*////////////////////////////////////////////////////////////// WITHDRAWAL OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Withdraws accumulated protocol fees to designated recipients * @dev Only callable by authorized withdrawers * Handles: * · Fee accounting updates * · Transfer of tokens * · Event emission for tracking */ function withdraw() external; } /** * @title IFeesDistributor * @dev Interface for protocol fee distribution and allocation * @notice Defines functionality for: * 1. Fee distribution across protocol components * 2. Dynamic allocation management * 3. Floor token revenue sharing * * This interface manages: * · Revenue distribution logic * · Allocation percentages * · Protocol incentive mechanisms */ interface IFeesDistributor { /*////////////////////////////////////////////////////////////// DISTRIBUTION OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Distributes accumulated protocol fees according to set allocations * @dev Handles the distribution of fees to: * · Floor token stakers * · Protocol treasury * · Other designated recipients */ function distribute() external; /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Returns current percentage allocated to Floor token stakers * @return uint256 Floor allocation percentage, scaled by 1e18 */ function floorAllocation() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title IFloor * @dev Interface for protocol floor price management and capital operations * @notice Defines functionality for: * 1. Token deposit management * 2. Refund processing * 3. Capital tracking */ interface IFloor { /*////////////////////////////////////////////////////////////// DEPOSIT OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Processes token deposits into the floor contract * @param msgSender Address initiating the deposit * @param amount Quantity of tokens to deposit * @dev Handles: * · Token transfer validation * · Capital tracking updates * · Event emission */ function deposit(address msgSender, uint256 amount) external; /*////////////////////////////////////////////////////////////// REFUND OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Processes token refunds from the floor contract * @param msgSender Address receiving the refund * @param amount Quantity of tokens to refund * @dev Ensures: * · Sufficient contract balance * · Authorized withdrawal * · Capital accounting */ function refund(address msgSender, uint256 amount) external; /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Returns current total capital held in the floor contract * @return uint256 Current capital amount in base units * @dev Used for: * · Floor price calculations * · Protocol health metrics * · Capital adequacy checks */ function capital() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {Rebase} from "../library/AuxRebase.sol"; import {IERC20Custom} from "./IERC20Custom.sol"; import {IOracle} from "./IOracle.sol"; import {IVault} from "./IVault.sol"; /** * @title ILender * @dev Interface for lending operations and management * @notice Defines the core lending protocol functionality including: * 1. Collateral management and borrowing operations * 2. Interest rate and fee management * 3. Liquidation handling * 4. Vault integration * * The interface is designed to support: * · Over-collateralized lending * · Dynamic interest rates * · Liquidation mechanisms * · Fee collection and distribution */ interface ILender { /*////////////////////////////////////////////////////////////// ADMIN CONFIGURATION //////////////////////////////////////////////////////////////*/ /** * @notice Updates the interest rate for borrowing * @param newInterestRate New interest rate (scaled by 1e18) */ function changeInterestRate(uint256 newInterestRate) external; /** * @notice Sets global and per-address borrowing limits * @param newBorrowLimit Total borrowing limit for the protocol * @param perAddressPart Maximum borrow amount per address */ function changeBorrowLimit( uint256 newBorrowLimit, uint256 perAddressPart ) external; /*////////////////////////////////////////////////////////////// CORE LENDING OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Updates protocol state with accrued interest */ function accrue() external; /** * @notice Updates the exchange rate from the oracle */ function updateExchangeRate() external; /** * @notice Withdraws accumulated protocol fees * @param amountToProvide Amount of fees to withdraw */ function withdrawFees(uint256 amountToProvide) external; /*////////////////////////////////////////////////////////////// LIQUIDATION HANDLING //////////////////////////////////////////////////////////////*/ /** * @notice Liquidates undercollateralized positions * @param liquidator Address performing the liquidation * @param users Array of user addresses to liquidate * @param maxBorrowParts Maximum borrow parts to liquidate per user * @param to Address to receive liquidated collateral */ function liquidate( address liquidator, address[] memory users, uint256[] memory maxBorrowParts, address to ) external; /*////////////////////////////////////////////////////////////// VAULT OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Deposits collateral into the vault * @param amount Amount of collateral to deposit */ function vaultDepositAddCollateral(uint256 amount) external; /** * @notice Withdraws borrowed assets from the vault * @param msgSender Address initiating the withdrawal * @param amount Amount to withdraw * @return part Borrow part assigned * @return share Share of the vault */ function borrowVaultWithdraw( address msgSender, uint256 amount ) external returns (uint256 part, uint256 share); /*////////////////////////////////////////////////////////////// COLLATERAL MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Adds collateral to a lending position * @param to Address to credit the collateral * @param skim True to skim tokens from the contract * @param share Amount of shares to add as collateral */ function addCollateral(address to, bool skim, uint256 share) external; /** * @notice Removes collateral from a lending position * @param to Address to receive the removed collateral * @param share Amount of shares to remove */ function removeCollateral(address to, uint256 share) external; /*////////////////////////////////////////////////////////////// BORROWING OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Borrows assets against deposited collateral * @param msgSender Address initiating the borrow * @param amount Amount to borrow * @return part Borrow part assigned * @return share Share of the borrowed amount */ function borrow( address msgSender, uint256 amount ) external returns (uint256 part, uint256 share); /** * @notice Repays borrowed assets * @param payer Address paying the debt * @param to Address whose debt to repay * @param skim True to skim tokens from the contract * @param part Amount of borrow part to repay * @return amount Actual amount repaid */ function repay( address payer, address to, bool skim, uint256 part ) external returns (uint256 amount); /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Gets the oracle contract address * @return IOracle Oracle interface */ function oracle() external view returns (IOracle); /** * @notice Gets interest accrual information * @return Last accrual timestamp, accumulated interest, interest per second */ function accrueInfo() external view returns (uint256, uint256, uint256); /** * @notice Gets the required collateral ratio * @return uint256 Collateral ratio (scaled by 1e5) */ function collateralRatio() external view returns (uint256); /** * @notice Gets the liquidation bonus multiplier * @return uint256 Liquidation multiplier (scaled by 1e5) */ function liquidationMultiplier() external view returns (uint256); /** * @notice Gets total collateral shares in the protocol * @return uint256 Total collateral share amount */ function totalCollateralShare() external view returns (uint256); /** * @notice Gets the vault contract address * @return IVault Vault interface */ function vault() external view returns (IVault); /** * @notice Gets the fee recipient address * @return address Fee recipient */ function feeTo() external view returns (address); /** * @notice Gets the collateral token address * @return IERC20Custom Collateral token interface */ function collateral() external view returns (IERC20Custom); /** * @notice Gets total borrow state * @return Rebase Total borrow information */ function totalBorrow() external view returns (Rebase memory); /** * @notice Gets user's borrow part * @param account User address * @return uint256 User's borrow part */ function userBorrowPart(address account) external view returns (uint256); /** * @notice Gets user's collateral share * @param account User address * @return uint256 User's collateral share */ function userCollateralShare( address account ) external view returns (uint256); /** * @notice Gets protocol borrowing limits * @return total Total protocol borrow limit * @return borrowPartPerAddress Per-address borrow limit */ function borrowLimit() external view returns (uint256 total, uint256 borrowPartPerAddress); /** * @notice Gets the DUSX token address * @return IERC20Custom DUSX token interface */ function dusx() external view returns (IERC20Custom); /** * @notice Gets all accounts with active positions * @return address[] Array of account addresses */ function accounts() external view returns (address[] memory); /** * @notice Gets the collateral precision factor * @return uint256 Collateral precision */ function collateralPrecision() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {ILender} from "./ILender.sol"; /** * @title ILenderOwner * @dev Interface for protocol-level lender management and configuration * @notice Defines functionality for: * 1. Interest rate management * 2. Borrow limit control * 3. Risk parameter adjustment */ interface ILenderOwner { /*////////////////////////////////////////////////////////////// INTEREST MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Updates lender's interest rate configuration * @param lender The lender contract to modify * @param newInterestRate New interest rate value in basis points * @dev Controls: * · Interest accrual * · Yield generation * · Protocol revenue * * Requirements: * · Caller is authorized * · Rate within bounds * · Valid lender contract */ function changeInterestRate( ILender lender, uint256 newInterestRate ) external; /*////////////////////////////////////////////////////////////// LIMIT MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Updates lender's borrowing constraints * @param lender The lender contract to modify * @param newBorrowLimit New total protocol borrow limit * @param perAddressPart Maximum borrow limit per address * @dev Manages: * · Protocol exposure * · Individual limits * · Risk thresholds * * Requirements: * · Caller is authorized * · Valid limits * · perAddressPart <= newBorrowLimit * * Security: * · Prevents overleveraging * · Controls risk exposure * · Ensures protocol stability */ function changeBorrowLimit( ILender lender, uint256 newBorrowLimit, uint256 perAddressPart ) external; /*////////////////////////////////////////////////////////////// DEPRECATION MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Checks if a lender contract is deprecated * @param lender The lender address to check * @return bool True if the lender is deprecated, false otherwise * @dev Used to: * · Prevent operations on deprecated markets * · Control market lifecycle * · Manage protocol upgrades * * Security: * · Read-only function * · No state modifications * · Access control not required */ function deprecated(address lender) external view returns (bool); /** * @notice Checks if a lender contract is in manual mode * @param lender The lender address to check * @return bool True if the lender is in manual mode, false otherwise * @dev Used to: * · Determine if borrow limits are managed manually * · Control automatic interest rate adjustments * * Security: * · Read-only function * · No state modifications * · Access control not required */ function manual(address lender) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {IERC20Custom} from "./IERC20Custom.sol"; import {ILender} from "../interface/ILender.sol"; import {IMiscHelper} from "../interface/IMiscHelper.sol"; /** * @title ILiquidationHelper * @dev Interface for liquidation assistance operations * @notice Defines comprehensive liquidation functionality including: * 1. Direct liquidation execution * 2. Liquidation amount calculations * 3. Position health checks * 4. Preview and simulation functions * * The helper provides: * · Maximum and partial liquidation support * · Customizable recipient addresses * · Pre-execution liquidation simulations * · Automated DUSX amount calculations */ interface ILiquidationHelper { /*////////////////////////////////////////////////////////////// CONFIGURATION //////////////////////////////////////////////////////////////*/ /*////////////////////////////////////////////////////////////// LIQUIDATION EXECUTION //////////////////////////////////////////////////////////////*/ /** * @notice Liquidates maximum possible amount for an account * @param lender Address of the lending contract * @param account Address to be liquidated * @return collateralAmount Amount of collateral received * @return adjustedBorrowPart Adjusted borrow amount after liquidation * @return requiredDUSXAmount DUSX tokens needed to execute liquidation * @dev Automatically calculates maximum liquidatable amount */ function liquidateMax( ILender lender, address account ) external returns ( uint256 collateralAmount, uint256 adjustedBorrowPart, uint256 requiredDUSXAmount ); /** * @notice Liquidates specific amount for an account * @param lender Address of the lending contract * @param account Address to be liquidated * @param borrowPart Amount of borrow position to liquidate * @return collateralAmount Amount of collateral received * @return adjustedBorrowPart Adjusted borrow amount after liquidation * @return requiredDUSXAmount DUSX tokens needed to execute liquidation * @dev Validates borrowPart against maximum liquidatable amount */ function liquidate( ILender lender, address account, uint256 borrowPart ) external returns ( uint256 collateralAmount, uint256 adjustedBorrowPart, uint256 requiredDUSXAmount ); /*////////////////////////////////////////////////////////////// LIQUIDATION WITH CUSTOM RECIPIENT //////////////////////////////////////////////////////////////*/ /** * @notice Liquidates maximum amount and sends to specified recipient * @param lender Address of the lending contract * @param account Address to be liquidated * @param recipient Address to receive liquidated assets * @dev Combines max liquidation with custom recipient */ function liquidateMaxTo( ILender lender, address account, address recipient ) external; /** * @notice Liquidates specific amount and sends to specified recipient * @param lender Address of the lending contract * @param account Address to be liquidated * @param recipient Address to receive liquidated assets * @param borrowPart Amount of borrow position to liquidate * @dev Combines partial liquidation with custom recipient */ function liquidateTo( ILender lender, address account, address recipient, uint256 borrowPart ) external; /*////////////////////////////////////////////////////////////// LIQUIDATION PREVIEWS //////////////////////////////////////////////////////////////*/ /** * @notice Previews maximum possible liquidation amounts * @param lender Address of the lending contract * @param account Address to check * @return liquidatable Whether the account can be liquidated * @return requiredDUSXAmount DUSX tokens needed for liquidation * @return adjustedBorrowPart Final borrow amount after liquidation * @return returnedCollateralAmount Collateral amount to be received * @dev Simulates liquidation without executing */ function previewMaxLiquidation( ILender lender, address account ) external view returns ( bool liquidatable, uint256 requiredDUSXAmount, uint256 adjustedBorrowPart, uint256 returnedCollateralAmount ); /** * @notice Previews specific liquidation amounts * @param lender Address of the lending contract * @param account Address to check * @param borrowPart Amount of borrow position to liquidate * @return liquidatable Whether the account can be liquidated * @return requiredDUSXAmount DUSX tokens needed for liquidation * @return adjustedBorrowPart Final borrow amount after liquidation * @return returnedCollateralAmount Collateral amount to be received * @dev Simulates partial liquidation without executing */ function previewLiquidation( ILender lender, address account, uint256 borrowPart ) external view returns ( bool liquidatable, uint256 requiredDUSXAmount, uint256 adjustedBorrowPart, uint256 returnedCollateralAmount ); /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Checks if an account is eligible for liquidation * @param lender Address of the lending contract * @param account Address to check * @return bool True if account can be liquidated * @dev Considers collateral ratio and position health */ function isLiquidatable( ILender lender, address account ) external view returns (bool); /** * @notice Returns the DUSX token contract used for liquidations * @return IERC20Custom DUSX token interface * @dev DUSX is required to execute liquidations */ function dusx() external view returns (IERC20Custom); /** * @notice Returns the helper utility contract * @return IMiscHelper Helper interface for additional functions * @dev Helper provides supporting calculations and checks */ function helper() external view returns (IMiscHelper); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {ILender} from "./ILender.sol"; /** * @title IMarketLens * @dev Interface for viewing and analyzing lending market data * @notice Provides functionality for: * 1. Market size analysis * 2. Borrowing metrics * 3. Risk assessment data */ interface IMarketLens { /*////////////////////////////////////////////////////////////// MARKET METRICS //////////////////////////////////////////////////////////////*/ /** * @notice Calculates total borrowed amount from a specific lending market * @param lender Address of the lending market to analyze * @return uint256 Total borrowed amount in base units * @dev Aggregates: * · Active loan positions * · Accrued interest * · Pending liquidations * * Used for: * · Market size analysis * · Risk assessment * · Protocol health monitoring */ function getTotalBorrowed(ILender lender) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {IERC20Custom} from "./IERC20Custom.sol"; /** * @title IMinter * @dev Interface for the Minter contract */ interface IMinter { /** * @notice Enables whitelist minting phase */ function enableWhitelistMint() external; /** * @notice Enables public minting phase */ function enablePublicMint() external; /** * @notice Adds a wallet to the whitelist * @param wallet Wallet address to whitelist */ function addToWhitelist(address wallet) external; /** * @notice Mints tokens during whitelist phase * @param stablecoin Stablecoin used for minting * @param stableAmount Amount of stablecoin to mint against */ function whitelistMint( IERC20Custom stablecoin, uint256 stableAmount ) external; /** * @notice Mints tokens during public phase * @param stablecoin Stablecoin used for minting * @param stableAmount Amount of stablecoin to mint against */ function publicMint(IERC20Custom stablecoin, uint256 stableAmount) external; /** * @notice Mints remaining token supply * @param stablecoin Stablecoin used for minting */ function mintRemainingSupply(IERC20Custom stablecoin) external; /** * @notice Sends accumulated DUSX to floor contract */ function sendToFloorDUSX() external; /** * @notice Verifies if a wallet is whitelisted * @param wallet Address to verify * @return bool Whitelist status */ function verifyWallet(address wallet) external view returns (bool); /** * @notice Calculates mint amount for given stablecoin input * @param stablecoin Stablecoin used for calculation * @param stableAmount Amount of stablecoin * @return uint256 Calculated mint amount */ function calcMintAmount( IERC20Custom stablecoin, uint256 stableAmount ) external view returns (uint256); /** * @notice Gets the current token reserve * @return uint256 Current token reserve */ function tokenReserve() external view returns (uint256); /** * @notice Gets the current mint ratio * @return uint256 Current mint ratio */ function getCurrentRatio() external view returns (uint256); /** * @notice Gets the current mint rate * @return uint256 Current mint rate */ function getCurrentRate() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {IDynamicInterestRate} from "./IDynamicInterestRate.sol"; import {IFeesDistributor} from "./IFees.sol"; import {IFeesWithdrawer} from "./IFees.sol"; import {IFloor} from "./IFloor.sol"; import {ILender} from "./ILender.sol"; import {ILenderOwner} from "./ILenderOwner.sol"; import {ILiquidationHelper} from "./ILiquidationHelper.sol"; import {IMarketLens} from "./IMarketLens.sol"; import {IPSM} from "./IPSM.sol"; import {IRepayHelper} from "./IRepayHelper.sol"; import {IStakedDUSX} from "./IStakedDUSX.sol"; import {ISupplyHangingCalculator} from "./ISupplyHangingCalculator.sol"; /** * @title IMiscHelper * @dev Interface for miscellaneous helper functions across the protocol * @notice Provides comprehensive helper methods for: * 1. Protocol configuration and parameter management * 2. Floor token operations * 3. Staked DUSX token management * 4. PSM (Peg Stability Module) operations * 5. Lending operations including borrowing and repayment * 6. System-wide view functions * * This interface acts as a central utility hub for coordinating * various protocol components and simplifying complex operations */ interface IMiscHelper { /*////////////////////////////////////////////////////////////// CONFIGURATION FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Sets the supply hanging calculator contract * @param supplyHangingCalculator_ New calculator contract address * @dev Used for calculating supply adjustments */ function setSupplyHangingCalculator( ISupplyHangingCalculator supplyHangingCalculator_ ) external; /** * @notice Sets core protocol parameters and contract addresses * @param repayHelper_ Repayment helper contract * @param liquidationHelper_ Liquidation helper contract * @param dynamicInterestRate_ Interest rate calculator * @param feesDistributor_ Fee distribution contract * @param feesWithdrawer_ Fee withdrawal contract * @param lenderOwner_ Lender owner contract * @param marketLens_ Market data viewer contract * @dev Updates all main protocol component addresses */ function setParameters( IRepayHelper repayHelper_, ILiquidationHelper liquidationHelper_, IDynamicInterestRate dynamicInterestRate_, IFeesDistributor feesDistributor_, IFeesWithdrawer feesWithdrawer_, ILenderOwner lenderOwner_, IMarketLens marketLens_ ) external; /** * @notice Sets the list of active lender contracts * @param lenders_ Array of lender addresses * @dev Updates the protocol's lending markets */ function setLenders(ILender[] memory lenders_) external; /** * @notice Sets the list of PSM contracts * @param pegStabilityModules_ Array of PSM addresses * @dev Updates available stablecoin PSM modules */ function setPegStabilityModules( IPSM[] memory pegStabilityModules_ ) external; /*////////////////////////////////////////////////////////////// FLOOR TOKEN OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Deposits Floor tokens into the protocol * @param amount Amount of Floor tokens to deposit */ function depositFloor(uint256 amount) external; /** * @notice Refunds Floor tokens from the protocol * @param amount Amount of Floor tokens to refund */ function refundFloor(uint256 amount) external; /*////////////////////////////////////////////////////////////// STAKED DUSX OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Deposits DUSX tokens for staking * @param amount Amount of DUSX to stake */ function depositStakedDUSX(uint256 amount) external; /** * @notice Withdraws staked DUSX tokens * @param amount Amount of staked DUSX to withdraw */ function withdrawStakedDUSX(uint256 amount) external; /*////////////////////////////////////////////////////////////// PSM OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Swaps DUSX for stablecoin through PSM * @param psm PSM contract to use for swap * @param receiver Address to receive stablecoins * @param amountDUSX Amount of DUSX to swap */ function psmSwapDUSXForStable( IPSM psm, address receiver, uint256 amountDUSX ) external; /** * @notice Swaps stablecoin for DUSX through PSM * @param psm PSM contract to use for swap * @param receiver Address to receive DUSX * @param amountStable Amount of stablecoin to swap */ function psmSwapStableForDUSX( IPSM psm, address receiver, uint256 amountStable ) external; /*////////////////////////////////////////////////////////////// LENDING OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Withdraws borrowed tokens from vault * @param lender Lender contract to withdraw from * @param amount Amount to withdraw */ function lenderBorrowVaultWithdraw(ILender lender, uint256 amount) external; /** * @notice Executes a borrow operation * @param lender Lender contract to borrow from * @param amount Amount to borrow */ function lenderBorrow(ILender lender, uint256 amount) external; /** * @notice Repays borrowed tokens * @param lender Lender contract to repay to * @param payer Address paying the debt * @param to Address receiving any excess * @param skim Whether to skim tokens from contract * @param part Amount of borrow part to repay */ function lenderRepay( ILender lender, address payer, address to, bool skim, uint256 part ) external; /** * @notice Executes liquidation for multiple users * @param lender Lender contract to liquidate from * @param liquidator Address performing liquidation * @param users Array of addresses to liquidate * @param maxBorrowParts Maximum borrow parts to liquidate per user * @param to Address to receive liquidated assets */ function lenderLiquidate( ILender lender, address liquidator, address[] memory users, uint256[] memory maxBorrowParts, address to ) external; /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Returns current APR for staked DUSX * @return uint256 Annual percentage rate */ function aprStakedDUSX() external view returns (uint256); /** * @notice Returns repayment helper contract */ function repayHelper() external view returns (IRepayHelper); /** * @notice Returns liquidation helper contract */ function liquidationHelper() external view returns (ILiquidationHelper); /** * @notice Returns dynamic interest rate calculator */ function dynamicInterestRate() external view returns (IDynamicInterestRate); /** * @notice Returns floor token contract */ function floor() external view returns (IFloor); /** * @notice Returns fees distributor contract */ function feesDistributor() external view returns (IFeesDistributor); /** * @notice Returns fees withdrawer contract */ function feesWithdrawer() external view returns (IFeesWithdrawer); /** * @notice Returns lender contract at specified index * @param index Position in lenders array */ function lenders(uint256 index) external view returns (ILender); /** * @notice Returns total number of lender contracts */ function lendersLength() external view returns (uint256); /** * @notice Returns lender owner contract */ function lenderOwner() external view returns (ILenderOwner); /** * @notice Returns market lens contract */ function marketLens() external view returns (IMarketLens); /** * @notice Returns PSM contract at specified index * @param index Position in PSM array */ function pegStabilityModules(uint256 index) external view returns (IPSM); /** * @notice Returns total number of PSM contracts */ function pegStabilityModulesLength() external view returns (uint256); /** * @notice Returns staked DUSX token contract */ function stDUSX() external view returns (IStakedDUSX); /** * @notice Returns supply hanging calculator contract */ function supplyHangingCalculator() external view returns (ISupplyHangingCalculator); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title IOracle * @dev Interface for basic price feed operations * @notice Defines functionality for: * 1. Asset price retrieval * 2. Price precision handling */ interface IOracle { /*////////////////////////////////////////////////////////////// PRICE QUERIES //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves current asset price * @param asset Address of the asset to price * @return uint256 Current price in base units with precision * @dev Provides: * · Latest price data * · Standardized precision * · Asset valuation * * Note: Check implementation for specific precision details */ function getPrice(address asset) external view returns (uint256); } /** * @title ITwapOracle * @dev Interface for time-weighted average price calculations * @notice Defines functionality for: * 1. TWAP updates * 2. Time-weighted calculations * 3. Price smoothing */ interface ITwapOracle { /*////////////////////////////////////////////////////////////// TWAP OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Updates time-weighted average price * @param asset Address of the asset to update * @return uint256 New TWAP value in base units * @dev Calculates: * · Time-weighted price * · Cumulative values * · Price averages * * Features: * · Manipulation resistance * · Smoothing effect * · Historical tracking */ function updateTwap(address asset) external returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {IERC20Custom} from "./IERC20Custom.sol"; /** * @title IPSM * @dev Interface for Peg Stability Module (PSM) operations * @notice Defines functionality for: * 1. Stablecoin/DUSX swaps * 2. Peg maintenance * 3. Supply tracking */ interface IPSM { /*////////////////////////////////////////////////////////////// SWAP OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Executes stablecoin to DUSX swap * @param msgSender Address initiating the swap * @param receiver Address receiving the DUSX * @param stableTokenAmount Amount of stablecoins to swap * @dev Handles: * · Stablecoin deposit * · DUSX minting * · Supply tracking */ function swapStableForDUSX( address msgSender, address receiver, uint256 stableTokenAmount ) external; /** * @notice Executes DUSX to stablecoin swap * @param msgSender Address initiating the swap * @param receiver Address receiving the stablecoins * @param stableTokenAmount Amount of stablecoins to receive * @dev Handles: * · DUSX burning * · Stablecoin release * · Supply adjustment */ function swapDUSXForStable( address msgSender, address receiver, uint256 stableTokenAmount ) external; /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves the stablecoin token contract * @return IERC20Custom Stablecoin token interface * @dev Used for: * · Token transfers * · Balance checks * · Allowance verification */ function stableToken() external view returns (IERC20Custom); /** * @notice Returns total DUSX tokens minted through PSM * @return uint256 Total minted amount in base units * @dev Tracks: * · Total supply impact * · PSM utilization * · Protocol growth metrics */ function dusxMinted() external view returns (uint256); /** * @notice Returns the maximum amount of DUSX that can be minted through PSM * @return uint256 Maximum mintable amount in base units * @dev Used for: * · Supply control * · Risk management * · Protocol safety */ function dusxMintCap() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {IERC20Custom} from "./IERC20Custom.sol"; import {ILender} from "./ILender.sol"; import {IMiscHelper} from "./IMiscHelper.sol"; /** * @title IRepayHelper * @dev Interface for streamlined loan repayment operations and management * @notice Defines functionality for: * 1. Loan repayment processing * 2. Multi-loan management * 3. Helper contract integration * 4. Token interactions */ interface IRepayHelper { /*////////////////////////////////////////////////////////////// CONFIGURATION //////////////////////////////////////////////////////////////*/ /*////////////////////////////////////////////////////////////// REPAYMENT OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Processes partial loan repayment * @param lender Address of the lending contract * @param to Address whose loan is being repaid * @param amount Amount to repay in base units * @return part Share of the loan repaid * @dev Handles: * · Token transfers * · Loan accounting * · Share calculations * * Requirements: * · Amount > 0 * · Sufficient balance * · Valid addresses */ function repayAmount( ILender lender, address to, uint256 amount ) external returns (uint256 part); /** * @notice Processes complete loan repayment * @param lender Address of the lending contract * @param to Address whose loan is being repaid * @return amount Total amount repaid in base units * @dev Manages: * · Full debt calculation * · Complete repayment * · Account settlement * * Effects: * · Clears entire debt * · Updates balances * · Emits events */ function repayTotal( ILender lender, address to ) external returns (uint256 amount); /** * @notice Processes multiple complete loan repayments * @param lender Address of the lending contract * @param tos Array of addresses whose loans are being repaid * @return amount Total amount repaid across all loans * @dev Executes: * · Batch processing * · Multiple settlements * · Aggregate accounting * * Optimizations: * · Gas efficient * · Bulk processing * · Single transaction */ function repayTotalMultiple( ILender lender, address[] calldata tos ) external returns (uint256 amount); /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves DUSX token contract * @return IERC20Custom Interface of the DUSX token * @dev Used for: * · Token operations * · Balance checks * · Allowance verification */ function dusx() external view returns (IERC20Custom); /** * @notice Retrieves helper contract * @return IMiscHelper Interface of the helper contract * @dev Provides: * · Helper functionality * · Integration access * · Utility methods */ function helper() external view returns (IMiscHelper); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {IERC20Token} from "./IERC20Token.sol"; /** * @title IStableOwner Interface * @dev Interface for StableOwner contract that manages stable token supply * @notice Defines the external interface for stable token supply management */ interface IStableOwner { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ /// @notice Emitted when stable token contract is updated /// @param stable New stable token contract address event StableSet(IERC20Token indexed stable); /// @notice Emitted when new tokens are minted /// @param account Recipient of minted tokens /// @param amount Amount of tokens minted event TokensMinted(address indexed account, uint256 amount); /// @notice Emitted when tokens are burned /// @param account Account tokens were burned from /// @param amount Amount of tokens burned event TokensBurned(address indexed account, uint256 amount); /*////////////////////////////////////////////////////////////// FUNCTIONS //////////////////////////////////////////////////////////////*/ /// @notice Updates the stable token contract address /// @param stable_ New stable token contract address function setStable(IERC20Token stable_) external; /// @notice Creates new stable tokens /// @param account Address to receive minted tokens /// @param amount Number of tokens to mint function mint(address account, uint256 amount) external; /// @notice Destroys existing stable tokens /// @param account Address to burn tokens from /// @param amount Number of tokens to burn function burn(address account, uint256 amount) external; /// @notice The managed stable token contract /// @return The IERC20Token interface of the stable token function stable() external view returns (IERC20Token); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title IStakedDUSX * @dev Interface for staked DUSX token operations and reward distribution * @notice Defines functionality for: * 1. DUSX token staking * 2. Reward distribution * 3. Position management */ interface IStakedDUSX { /*////////////////////////////////////////////////////////////// REWARD DISTRIBUTION //////////////////////////////////////////////////////////////*/ /** * @notice Distributes protocol fees as staking rewards * @param amount Amount of fees to distribute in base units * @dev Handles: * · Pro-rata distribution * · Reward accounting * · Distribution events * * Rewards are: * · Automatically calculated * · Immediately available * · Proportional to stake */ function distributeFees(uint256 amount) external; /** * @notice Claims pending fee rewards for the caller * @return claimedAmount Amount of fees claimed * @dev Allows users to manually claim their accumulated fees */ function claimFees() external returns (uint256 claimedAmount); /*////////////////////////////////////////////////////////////// STAKING OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Processes DUSX token deposits for staking * @param from Address providing the tokens * @param to Address receiving the staked position * @param amount Quantity of tokens to stake in base units * @dev Manages: * · Token transfers * · Position creation * · Reward calculations * * Supports: * · Direct deposits * · Delegated deposits * · Position tracking */ function deposit(address from, address to, uint256 amount) external; /** * @notice Initiates a withdrawal from staked DUSX * @param amount Amount of tokens to withdraw */ function beginWithdrawal(uint256 amount) external; /** * @notice Processes withdrawal of staked DUSX tokens * @param account Address withdrawing tokens * @dev Handles: * · Position updates * · Reward claims * · Token transfers * * Ensures: * · Sufficient balance * · Reward distribution * · Clean exit */ function withdraw(address account) external; /** * @notice Views pending unclaimed fees for an account * @param account Address to check for pending fees * @return pendingAmount Amount of pending fees available to claim * @dev Calculates based on the fee accumulator and account's last claimed value */ function pendingFees( address account ) external view returns (uint256 pendingAmount); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title ISupplyHangingCalculator * @dev Interface for calculating and managing token supply adjustments * @notice Defines functionality for: * 1. Supply hanging calculations * 2. Safety margin management * 3. Risk-adjusted metrics */ interface ISupplyHangingCalculator { /*////////////////////////////////////////////////////////////// SAFETY PARAMETERS //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves current safety margin for supply calculations * @return uint256 Safety margin percentage scaled by 1e18 * @dev Used for: * · Risk adjustment * · Supply buffer * · Protocol protection */ function safetyMargin() external view returns (uint256); /*////////////////////////////////////////////////////////////// SUPPLY HANGING CALCULATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Calculates current supply hanging with safety margins * @return uint256 Risk-adjusted supply hanging in base units * @dev Includes: * · Safety margin application * · Risk adjustments * · Protocol constraints * * Used for: * · Safe supply management * · Conservative adjustments * · Risk-aware operations */ function getSupplyHanging() external view returns (uint256); /** * @notice Calculates raw supply hanging without safety margins * @return uint256 Unadjusted supply hanging in base units * @dev Provides: * · Raw calculations * · No safety buffers * · Maximum theoretical values * * Used for: * · Analysis purposes * · Maximum bounds * · Stress testing */ function getSupplyHangingUnsafe() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {Rebase} from "../library/AuxRebase.sol"; import {IERC20Custom} from "./IERC20Custom.sol"; /** * @title IVault * @dev Interface for advanced vault operations with elastic share system * @notice Defines functionality for: * 1. Token custody and management * 2. Share-based accounting * 3. Elastic supply mechanics * 4. Amount/share conversions */ interface IVault { /*////////////////////////////////////////////////////////////// DEPOSIT OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Processes token deposits into vault * @param token Token contract to deposit * @param from Source of tokens * @param to Recipient of shares * @param amount Token amount (in base units, 0 for share-based) * @param share Share amount (0 for amount-based) * @return amountIn Actual tokens deposited * @return shareIn Actual shares minted * @dev Handles: * · Token transfers * · Share minting * · Balance updates * * Requirements: * · Valid token contract * · Authorized caller * · Sufficient balance * · Either amount or share > 0 * * Note: Only one of amount/share should be non-zero */ function deposit( IERC20Custom token, address from, address to, uint256 amount, uint256 share ) external returns (uint256 amountIn, uint256 shareIn); /*////////////////////////////////////////////////////////////// WITHDRAWAL OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Processes token withdrawals from vault * @param token Token contract to withdraw * @param from Source of shares * @param to Recipient of tokens * @param amount Token amount (in base units, 0 for share-based) * @param share Share amount (0 for amount-based) * @return amountOut Actual tokens withdrawn * @return shareOut Actual shares burned * @dev Manages: * · Share burning * · Token transfers * · Balance updates * * Requirements: * · Valid token contract * · Sufficient shares * · Either amount or share > 0 * · Authorized withdrawal * * Security: * · Validates balances * · Checks permissions * · Updates state atomically */ function withdraw( IERC20Custom token, address from, address to, uint256 amount, uint256 share ) external returns (uint256 amountOut, uint256 shareOut); /*////////////////////////////////////////////////////////////// SHARE TRANSFERS //////////////////////////////////////////////////////////////*/ /** * @notice Transfers vault shares between accounts * @param token Associated token contract * @param from Source of shares * @param to Recipient of shares * @param share Amount of shares to transfer * @dev Executes: * · Direct share movement * · Balance updates * · Event emission * * Requirements: * · Sufficient share balance * · Valid addresses * · Share amount > 0 * * Note: Bypasses amount calculations for efficiency */ function transfer( IERC20Custom token, address from, address to, uint256 share ) external; /*////////////////////////////////////////////////////////////// BALANCE QUERIES //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves account's vault share balance * @param token Token contract to query * @param account Address to check * @return uint256 Share balance * @dev Provides: * · Raw share balance * · Without conversion * · Current state * * Use toAmount() to convert to token amount */ function balanceOf( IERC20Custom token, address account ) external view returns (uint256); /*////////////////////////////////////////////////////////////// CONVERSION OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Converts token amount to vault shares * @param token Token contract for conversion * @param amount Amount of tokens to convert * @param roundUp Whether to round up result * @return share Equivalent share amount * @dev Calculates: * · Share equivalent * · Based on totals * · Handles precision * * Rounding: * true = ceiling (≥) * false = floor (≤) */ function toShare( IERC20Custom token, uint256 amount, bool roundUp ) external view returns (uint256 share); /** * @notice Converts vault shares to token amount * @param token Token contract for conversion * @param share Amount of shares to convert * @param roundUp Whether to round up result * @return amount Equivalent token amount * @dev Calculates: * · Token equivalent * · Based on totals * · Handles precision * * Rounding: * true = ceiling (≥) * false = floor (≤) */ function toAmount( IERC20Custom token, uint256 share, bool roundUp ) external view returns (uint256 amount); /** * @notice Gets the list of active controllers * @return Array of controller addresses */ function getControllers() external view returns (address[] memory); /*////////////////////////////////////////////////////////////// VAULT TOTALS //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves vault's total supply tracking * @param token Token contract to query * @return vaultTotals Rebase struct containing: * · elastic: Total token amount * · base: Total shares * @dev Provides: * · Current vault state * · Supply tracking * · Conversion basis * * Used for: * · Share calculations * · Amount conversions * · State validation */ function totals( IERC20Custom token ) external view returns (Rebase memory vaultTotals); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title IVoteEscrowedSTTX * @dev Interface for vote-escrowed STTX (veSTTX) token operations * @notice Defines functionality for: * 1. Token withdrawal management * 2. Escrow position handling * 3. Voting power release */ interface IVoteEscrowedSTTX { /*////////////////////////////////////////////////////////////// WITHDRAWAL OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Processes withdrawal of escrowed STTX tokens * @dev Handles: * · Lock period verification * · Position liquidation * · Token transfers * * Requirements: * · Lock period expired * · Active position exists * · Caller is position owner * * Effects: * · Releases locked tokens * · Removes voting power * · Clears escrow position */ function withdraw() external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title Rebase Library * @dev Library for handling elastic supply token calculations and adjustments * @notice This library provides mathematical operations for elastic/base token conversions * and supply adjustments. It handles two key concepts: * * 1. Elastic Supply: The actual total supply that can expand or contract * 2. Base Supply: The underlying base amount that remains constant */ /*////////////////////////////////////////////////////////////// TYPES //////////////////////////////////////////////////////////////*/ /** * @dev Core data structure for elastic supply tracking * @param elastic Current elastic (rebased) supply * @param base Current base (non-rebased) supply */ struct Rebase { uint256 elastic; uint256 base; } /** * @title AuxRebase * @dev Auxiliary functions for elastic supply calculations * @notice Provides safe mathematical operations for elastic/base conversions * with optional rounding control */ library AuxRebase { /*////////////////////////////////////////////////////////////// ELASTIC SUPPLY OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Increases the elastic supply * @param total Current total supply state * @param elastic Amount to add to elastic supply * @return newElastic Updated elastic supply after addition */ function addElastic( Rebase storage total, uint256 elastic ) internal returns (uint256 newElastic) { newElastic = total.elastic += elastic; } /** * @notice Decreases the elastic supply * @param total Current total supply state * @param elastic Amount to subtract from elastic supply * @return newElastic Updated elastic supply after subtraction */ function subElastic( Rebase storage total, uint256 elastic ) internal returns (uint256 newElastic) { newElastic = total.elastic -= elastic; } /*////////////////////////////////////////////////////////////// CONVERSION OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Converts an elastic amount to its base amount * @param total Current total supply state * @param elastic Amount of elastic tokens to convert * @param roundUp If true, rounds up the result * @return base Equivalent amount in base units * @dev * · If elastic supply is 0, returns elastic amount as base * · Handles potential precision loss during conversion * · Rounding can cause slight variations in converted amounts * · Recommended for scenarios requiring precise supply tracking * * Rounding Behavior: * · roundUp = false: Always rounds down (truncates) * · roundUp = true: Rounds up if there's a fractional remainder * * Edge Cases: * · total.elastic == 0: Returns input elastic as base * · Potential for minimal precision differences */ function toBase( Rebase memory total, uint256 elastic, bool roundUp ) internal pure returns (uint256 base) { if (total.elastic == 0) { base = elastic; } else { base = (elastic * total.base) / total.elastic; if (roundUp && (base * total.elastic) / total.base < elastic) { base++; } } } /** * @notice Converts a base amount to its elastic amount * @param total Current total supply state * @param base Amount of base tokens to convert * @param roundUp If true, rounds up the result * @return elastic Equivalent amount in elastic units * @dev * · If base supply is 0, returns base amount as elastic * · Handles potential precision loss during conversion * · Rounding can cause slight variations in converted amounts * · Recommended for scenarios requiring precise supply tracking * * Rounding Behavior: * · roundUp = false: Always rounds down (truncates) * · roundUp = true: Rounds up if there's a fractional remainder * * Edge Cases: * · total.base == 0: Returns input base as elastic * · Potential for minimal precision differences */ function toElastic( Rebase memory total, uint256 base, bool roundUp ) internal pure returns (uint256 elastic) { if (total.base == 0) { elastic = base; } else { elastic = (base * total.elastic) / total.base; if (roundUp && (elastic * total.base) / total.elastic < base) { elastic++; } } } /*////////////////////////////////////////////////////////////// COMBINED OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Adds elastic tokens and calculates corresponding base amount * @param total Current total supply state * @param elastic Amount of elastic tokens to add * @param roundUp If true, rounds up base conversion * @return (Rebase, uint256) Updated total supply and calculated base amount */ function add( Rebase memory total, uint256 elastic, bool roundUp ) internal pure returns (Rebase memory, uint256 base) { base = toBase(total, elastic, roundUp); total.elastic += elastic; total.base += base; return (total, base); } /** * @notice Subtracts base tokens and calculates corresponding elastic amount * @param total Current total supply state * @param base Amount of base tokens to subtract * @param roundUp If true, rounds up elastic conversion * @return (Rebase, uint256) Updated total supply and calculated elastic amount */ function sub( Rebase memory total, uint256 base, bool roundUp ) internal pure returns (Rebase memory, uint256 elastic) { elastic = toElastic(total, base, roundUp); total.elastic -= elastic; total.base -= base; return (total, elastic); } /** * @notice Adds specific amounts to both elastic and base supplies * @param total Current total supply state * @param elastic Amount of elastic tokens to add * @param base Amount of base tokens to add * @return Rebase Updated total supply after addition */ function add( Rebase memory total, uint256 elastic, uint256 base ) internal pure returns (Rebase memory) { total.elastic += elastic; total.base += base; return total; } /** * @notice Subtracts specific amounts from both elastic and base supplies * @param total Current total supply state * @param elastic Amount of elastic tokens to subtract * @param base Amount of base tokens to subtract * @return Rebase Updated total supply after subtraction */ function sub( Rebase memory total, uint256 elastic, uint256 base ) internal pure returns (Rebase memory) { total.elastic -= elastic; total.base -= base; return total; } }
{ "viaIR": true, "evmVersion": "paris", "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IBaseContracts","name":"baseContracts_","type":"address"},{"internalType":"uint256[]","name":"emergencyGradeArray_","type":"uint256[]"},{"internalType":"uint256[]","name":"interestRateArray_","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EmptyArray","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"InvalidOwner","type":"error"},{"inputs":[],"name":"InvalidParameter","type":"error"},{"inputs":[{"internalType":"uint256","name":"rate","type":"uint256"}],"name":"RateExceedsMaximum","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"UnauthorizedAccount","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newCriticalEmergencyGrade","type":"uint256"}],"name":"CriticalEmergencyGradeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxInterestRate","type":"uint256"}],"name":"MaxInterestRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxStakingRatioMultiplier","type":"uint256"}],"name":"MaxStakingRatioMultiplierUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMinPsmCapital","type":"uint256"}],"name":"MinPsmCapitalUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newStakingRatioTrigger","type":"uint256"}],"name":"StakingRatioTriggerUpdated","type":"event"},{"inputs":[],"name":"TENK_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"criticalEmergencyGrade","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEmergencyGradeArray","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInterestPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInterestRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInterestRateArray","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"healthyState","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketLens","outputs":[{"internalType":"contract IMarketLens","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxInterestRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxStakingRatioMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minPsmCapital","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pegStabilityModules","outputs":[{"internalType":"contract IPSM","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMinPsmCapital","type":"uint256"}],"name":"setMinPsmCapital","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stDUSX","outputs":[{"internalType":"contract IStakedDUSX","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingRatioTrigger","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"supplyHangingCalculator","outputs":[{"internalType":"contract ISupplyHangingCalculator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCriticalEmergencyGrade","type":"uint256"}],"name":"updateCriticalEmergencyGrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"newEmergencyGradeArray","type":"uint256[]"}],"name":"updateEmergencyGradeArray","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"newInterestRateArray","type":"uint256[]"}],"name":"updateInterestRateArray","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxInterestRate","type":"uint256"}],"name":"updateMaxInterestRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxStakingRatioMultiplier","type":"uint256"}],"name":"updateMaxStakingRatioMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"newEmergencyGradeArray","type":"uint256[]"},{"internalType":"uint256[]","name":"newInterestRateArray","type":"uint256[]"}],"name":"updateRateArrays","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newStakingRatioTrigger","type":"uint256"}],"name":"updateStakingRatioTrigger","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c06040523462000058576200001f6200001862000274565b9162000c32565b620000296200005e565b61259f62001333823960805181818161071c0152611ff1015260a051818181610d1201526123f1015261259f90f35b62000064565b60405190565b600080fd5b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b90620000959062000069565b810190811060018060401b03821117620000ae57604052565b62000073565b90620000cb620000c36200005e565b928362000089565b565b600080fd5b600080fd5b60018060a01b031690565b620000ed90620000d7565b90565b620000fb90620000e2565b90565b6200010981620000f0565b036200011157565b600080fd5b905051906200012582620000fe565b565b600080fd5b60018060401b038111620001435760208091020190565b62000073565b600080fd5b90565b6200015c816200014e565b036200016457565b600080fd5b90505190620001788262000151565b565b90929192620001936200018d826200012c565b620000b4565b9381855260208086019202830192818411620001d557915b838310620001b95750505050565b60208091620001c9848662000169565b815201920191620001ab565b62000149565b9080601f83011215620001fc57816020620001f9935191016200017a565b90565b62000127565b916060838303126200026e576200021d826000850162000116565b92602081015160018060401b0381116200026857836200023f918301620001db565b92604082015160018060401b03811162000262576200025f9201620001db565b90565b620000d2565b620000d2565b620000cd565b62000297620038d2803803806200028b81620000b4565b92833981019062000202565b909192565b60001b90565b90620002b1600019916200029c565b9181191691161790565b90565b90565b620002da620002d4620002e092620002bb565b620002be565b6200014e565b90565b90565b9062000300620002fa6200030892620002c1565b620002e3565b8254620002a2565b9055565b90565b62000328620003226200032e926200030c565b620002be565b6200014e565b90565b906200034b6200034562000353926200030f565b620002e3565b8254620002a2565b9055565b90565b620003736200036d620003799262000357565b620002be565b6200014e565b90565b9062000396620003906200039e926200035a565b620002e3565b8254620002a2565b9055565b90565b620003be620003b8620003c492620003a2565b620002be565b6200014e565b90565b90620003e1620003db620003e992620003a5565b620002e3565b8254620002a2565b9055565b62000406620004006200040c92620000d7565b620002be565b620000d7565b90565b6200041a90620003ed565b90565b62000428906200040f565b90565b60e01b90565b6200043c90620000e2565b90565b6200044a8162000431565b036200045257565b600080fd5b9050519062000466826200043f565b565b906020828203126200048557620004829160000162000457565b90565b620000cd565b60000190565b6200049b6200005e565b3d6000823e3d90fd5b620004af90620000e2565b90565b620004bd81620004a4565b03620004c557565b600080fd5b90505190620004d982620004b2565b565b90602082820312620004f857620004f591600001620004ca565b90565b620000cd565b6200050990620000e2565b90565b6200051781620004fe565b036200051f57565b600080fd5b9050519062000533826200050c565b565b9060208282031262000552576200054f9160000162000524565b90565b620000cd565b906200056b60018060a01b03916200029c565b9181191691161790565b6200058090620003ed565b90565b6200058e9062000575565b90565b90565b90620005ae620005a8620005b69262000583565b62000591565b825462000558565b9055565b620005c590620000e2565b90565b620005d381620005ba565b03620005db57565b600080fd5b90505190620005ef82620005c8565b565b906020828203126200060e576200060b91600001620005e0565b90565b620000cd565b6200061f90620003ed565b90565b6200062d9062000614565b90565b90565b906200064d62000647620006559262000622565b62000630565b825462000558565b9055565b62000665905162000431565b90565b62000673906200040f565b90565b620006829051620004a4565b90565b62000690906200040f565b90565b60001c90565b60018060a01b031690565b620006b3620006b99162000693565b62000699565b90565b620006c89054620006a4565b90565b620006d6906200040f565b90565b60018060a01b031690565b620006f3620006f99162000693565b620006d9565b90565b620007089054620006e4565b90565b62000716906200040f565b90565b90565b620007356200072f6200073b9262000719565b620002be565b6200014e565b90565b60018060401b038111620007555760208091020190565b62000073565b90620007716200076b836200073e565b620000b4565b918252565b369037565b90620007a66200078b836200075b565b926020806200079b86936200073e565b920191039062000776565b565b620007b390620000e2565b90565b620007c181620007a8565b03620007c957565b600080fd5b90505190620007dd82620007b6565b565b90602082820312620007fc57620007f991600001620007ce565b90565b620000cd565b634e487b7160e01b600052603260045260246000fd5b5190565b90620008288262000818565b8110156200083a576020809102010190565b62000802565b90565b6200085c62000856620008629262000840565b620002be565b6200014e565b90565b906200087190620007a8565b9052565b90565b620008916200088b620008979262000875565b620002be565b6200014e565b90565b620008a69051620007a8565b90565b620008b4906200040f565b90565b620008d0620008ca620008d69262000840565b620002be565b620000d7565b90565b620008e490620008b7565b90565b5490565b600190818003010490565b600052602060002090565b1b90565b91906008620009259102916200091e6000198462000901565b9262000901565b9181191691161790565b62000948620009426200094e926200014e565b620002be565b6200014e565b90565b91906200096c6200096662000975936200092f565b620002e3565b90835462000905565b9055565b600090565b62000994916200098d62000979565b9162000951565b565b5b818110620009a3575050565b80620009b360006001936200097e565b0162000997565b9091828110620009ca575b505050565b620009ef620009e8620009e1620009fb95620008eb565b92620008eb565b92620008f6565b91820191019062000996565b388080620009c5565b9068010000000000000000811162000a32578162000a2662000a3093620008e7565b90828155620009ba565b565b62000073565b60200190565b90565b62000a4c8262000818565b9160018060401b03831162000abb5762000a7f62000a7860019262000a72868662000a04565b62000a38565b92620008f6565b92049160005b83811062000a935750505050565b600190602062000aad62000aa7866200089a565b62000a3e565b940193818401550162000a85565b62000073565b9062000acd9162000a41565b565b5490565b600190818003010490565b600052602060002090565b5b81811062000af6575050565b8062000b0660006001936200097e565b0162000aea565b909182811062000b1d575b505050565b62000b4262000b3b62000b3462000b4e9562000ad3565b9262000ad3565b9262000ade565b91820191019062000ae9565b38808062000b18565b9068010000000000000000811162000b85578162000b7962000b839362000acf565b9082815562000b0d565b565b62000073565b5190565b62000b9b90516200014e565b90565b60200190565b62000baf8262000b8b565b9160018060401b03831162000c1e5762000be262000bdb60019262000bd5868662000b57565b62000b9e565b9262000ade565b92049160005b83811062000bf65750505050565b600190602062000c1062000c0a8662000b8f565b620002e3565b940193818401550162000be8565b62000073565b9062000c309162000ba4565b565b91909162000c3f620011d6565b62000c4e6109c46005620002e6565b62000c5d611388600862000331565b62000c6c61271060096200037c565b62000c7b61251c600a620003c7565b62000c9062000c8a826200041d565b620011f8565b62000cba602062000ca1836200041d565b63fbfa77cf9062000cb16200005e565b9384926200042b565b8252818062000ccc600482016200048b565b03915afa908115620011d0576000916200119b575b5060a05262000d0f602062000cf6836200041d565b6374453d1b9062000d066200005e565b9384926200042b565b8252818062000d21600482016200048b565b03915afa908115620011955760009162001160575b5060805262000d64602062000d4b836200041d565b6361f04d759062000d5b6200005e565b9384926200042b565b8252818062000d76600482016200048b565b03915afa80156200115a5762000d989160009162001125575b50600262000594565b62000dc2602062000da9836200041d565b63d358b3a29062000db96200005e565b9384926200042b565b8252818062000dd4600482016200048b565b03915afa80156200111f5762000df691600091620010ea575b50600362000633565b62000e1662000e1062000e0a60a062000659565b62000668565b620011f8565b62000e3662000e3062000e2a608062000676565b62000685565b620011f8565b62000e5662000e5062000e4a6002620006bc565b620006cb565b620011f8565b62000e7662000e7062000e6a6003620006fc565b6200070b565b620011f8565b62000e8c62000e8660026200071c565b6200077b565b9062000eb7602062000e9e836200041d565b63b5cab3629062000eae6200005e565b9384926200042b565b8252818062000ec9600482016200048b565b03915afa8015620010e45762000f2c9262000f0d62000f1392602094600091620010b0575b5062000f078762000f00600062000843565b906200081c565b62000865565b6200041d565b63d4aaf8b99062000f236200005e565b9384926200042b565b8252818062000f3e600482016200048b565b03915afa8015620010aa5762000f769160009162001075575b5062000f708362000f69600162000878565b906200081c565b62000865565b62000fa262000f9c62000f968362000f8f600062000843565b906200081c565b6200089a565b620008a9565b62000fc362000fbc62000fb66000620008d9565b620000e2565b91620000e2565b14801562001020575b62000ff95762000ff79262000fe762000fef92600462000ac1565b600662000c24565b600762000c24565b565b620010036200005e565b63d92e233d60e01b8152806200101c600482016200048b565b0390fd5b506200104d6200104762001041836200103a600162000878565b906200081c565b6200089a565b620008a9565b6200106e62001067620010616000620008d9565b620000e2565b91620000e2565b1462000fcc565b6200109b915060203d8111620010a2575b62001092818362000089565b810190620007df565b3862000f57565b503d62001086565b62000491565b620010d59150853d8111620010dc575b620010cc818362000089565b810190620007df565b3862000eee565b503d620010c0565b62000491565b62001110915060203d811162001117575b62001107818362000089565b810190620005f1565b3862000ded565b503d620010fb565b62000491565b6200114b915060203d811162001152575b62001142818362000089565b81019062000535565b3862000d8f565b503d62001136565b62000491565b62001186915060203d81116200118d575b6200117d818362000089565b810190620004db565b3862000d36565b503d62001171565b62000491565b620011c1915060203d8111620011c8575b620011b8818362000089565b81019062000468565b3862000ce1565b503d620011ac565b62000491565b620011e0620011e2565b565b620011f6620011f06200124d565b620012c5565b565b62001219620012126200120c6000620008d9565b620000e2565b91620000e2565b146200122157565b6200122b6200005e565b63d92e233d60e01b81528062001244600482016200048b565b0390fd5b600090565b6200125762001248565b503390565b60018060a01b031690565b620012766200127c9162000693565b6200125c565b90565b6200128b905462001267565b90565b62001299906200040f565b90565b90565b90620012b9620012b3620012c1926200128e565b6200129c565b825462000558565b9055565b620012d160006200127f565b620012de8260006200129f565b90620013166200130f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0936200128e565b916200128e565b91620013216200005e565b806200132d816200048b565b0390a356fe60806040526004361015610013575b610d98565b61001e6000356101cd565b80631a6362b4146101c85780632846c4d9146101c35780632aaca2b8146101be5780634a4c2d7a146101b95780635257b566146101b457806360f7237b146101af57806361f04d75146101aa5780636ed8dd19146101a5578063715018a6146101a057806374453d1b1461019b57806383cf078e146101965780638da5cb5b146101915780638ebcb61c1461018c57806392acced0146101875780639860a44e14610182578063a9583d5f1461017d578063b54f0a8914610178578063c586132814610173578063ce3d13511461016e578063d7f116dc14610169578063d819576314610164578063db58f1ce1461015f578063dc3cbb8d1461015a578063ed987a0814610155578063f2fde38b14610150578063f70fca541461014b5763fbfa77cf0361000e57610d63565b610cdd565b610caa565b610c32565b610b22565b610adf565b610aaa565b610a65565b610a22565b6109ed565b610955565b610920565b6108db565b61086e565b61083b565b610806565b6107a2565b61076d565b6106e7565b6106b2565b610644565b61059f565b6104c0565b61046a565b6103f3565b610385565b610297565b60e01c90565b60405190565b600080fd5b600080fd5b60009103126101ee57565b6101de565b5190565b60209181520190565b60200190565b90565b61021290610206565b9052565b9061022381602093610209565b0190565b60200190565b9061024a61024461023d846101f3565b80936101f7565b92610200565b9060005b81811061025b5750505090565b90919261027461026e6001928651610216565b94610227565b910191909161024e565b610294916020820191600081840391015261022d565b90565b346102c7576102a73660046101e3565b6102c36102b2610ec3565b6102ba6101d3565b9182918261027e565b0390f35b6101d9565b600080fd5b600080fd5b600080fd5b600080fd5b909182601f8301121561031a5781359167ffffffffffffffff831161031557602001926020830284011161031057565b6102db565b6102d6565b6102d1565b909160408284031261037a57600082013567ffffffffffffffff8111610375578361034b9184016102e0565b929093602082013567ffffffffffffffff81116103705761036c92016102e0565b9091565b6102cc565b6102cc565b6101de565b60000190565b346103b7576103a161039836600461031f565b929190916113fb565b6103a96101d3565b806103b38161037f565b0390f35b6101d9565b906020828203126103ee57600082013567ffffffffffffffff81116103e9576103e592016102e0565b9091565b6102cc565b6101de565b346104225761040c6104063660046103bc565b9061157e565b6104146101d3565b8061041e8161037f565b0390f35b6101d9565b61043081610206565b0361043757565b600080fd5b9050359061044982610427565b565b90602082820312610465576104629160000161043c565b90565b6101de565b346104985761048261047d36600461044b565b611620565b61048a6101d3565b806104948161037f565b0390f35b6101d9565b6104a690610206565b9052565b91906104be9060006020850194019061049d565b565b346104f0576104d03660046101e3565b6104ec6104db6116f2565b6104e36101d3565b918291826104aa565b0390f35b6101d9565b1c90565b60018060a01b031690565b61051490600861051993026104f5565b6104f9565b90565b906105279154610504565b90565b610537600360009061051c565b90565b60018060a01b031690565b90565b61055c6105576105619261053a565b610545565b61053a565b90565b61056d90610548565b90565b61057990610564565b90565b61058590610570565b9052565b919061059d9060006020850194019061057c565b565b346105cf576105af3660046101e3565b6105cb6105ba61052a565b6105c26101d3565b91829182610589565b0390f35b6101d9565b60018060a01b031690565b6105ef9060086105f493026104f5565b6105d4565b90565b9061060291546105df565b90565b61061260026000906105f7565b90565b61061e90610564565b90565b61062a90610615565b9052565b919061064290600060208501940190610621565b565b34610674576106543660046101e3565b61067061065f610605565b6106676101d3565b9182918261062e565b0390f35b6101d9565b90565b61068c90600861069193026104f5565b610679565b90565b9061069f915461067c565b90565b6106af6005600090610694565b90565b346106e2576106c23660046101e3565b6106de6106cd6106a2565b6106d56101d3565b918291826104aa565b0390f35b6101d9565b34610715576106f73660046101e3565b6106ff611938565b6107076101d3565b806107118161037f565b0390f35b6101d9565b7f000000000000000000000000000000000000000000000000000000000000000090565b61074790610564565b90565b6107539061073e565b9052565b919061076b9060006020850194019061074a565b565b3461079d5761077d3660046101e3565b61079961078861071a565b6107906101d3565b91829182610757565b0390f35b6101d9565b346107d2576107b23660046101e3565b6107ce6107bd611980565b6107c56101d3565b918291826104aa565b0390f35b6101d9565b6107e09061053a565b90565b6107ec906107d7565b9052565b9190610804906000602085019401906107e3565b565b34610836576108163660046101e3565b6108326108216119ee565b6108296101d3565b918291826107f0565b0390f35b6101d9565b346108695761085361084e36600461044b565b611a5d565b61085b6101d3565b806108658161037f565b0390f35b6101d9565b3461089e5761087e3660046101e3565b61089a610889611a68565b6108916101d3565b9182918261027e565b0390f35b6101d9565b90565b6108ba6108b56108bf926108a3565b610545565b610206565b90565b6108cd6127106108a6565b90565b6108d86108c2565b90565b3461090b576108eb3660046101e3565b6109076108f66108d0565b6108fe6101d3565b918291826104aa565b0390f35b6101d9565b61091d6009600090610694565b90565b34610950576109303660046101e3565b61094c61093b610910565b6109436101d3565b918291826104aa565b0390f35b6101d9565b346109845761096e6109683660046103bc565b90611bf9565b6109766101d3565b806109808161037f565b0390f35b6101d9565b60ff1690565b61099f9060086109a493026104f5565b610989565b90565b906109b2915461098f565b90565b6109c260006014906109a7565b90565b151590565b6109d3906109c5565b9052565b91906109eb906000602085019401906109ca565b565b34610a1d576109fd3660046101e3565b610a19610a086109b5565b610a106101d3565b918291826109d7565b0390f35b6101d9565b34610a5057610a3a610a3536600461044b565b611c5e565b610a426101d3565b80610a4c8161037f565b0390f35b6101d9565b610a62600a600090610694565b90565b34610a9557610a753660046101e3565b610a91610a80610a55565b610a886101d3565b918291826104aa565b0390f35b6101d9565b610aa76001600090610694565b90565b34610ada57610aba3660046101e3565b610ad6610ac5610a9a565b610acd6101d3565b918291826104aa565b0390f35b6101d9565b34610b0d57610af7610af236600461044b565b611cc2565b610aff6101d3565b80610b098161037f565b0390f35b6101d9565b610b1f6008600090610694565b90565b34610b5257610b323660046101e3565b610b4e610b3d610b12565b610b456101d3565b918291826104aa565b0390f35b6101d9565b634e487b7160e01b600052603260045260246000fd5b5490565b600052602060002090565b610b8581610b6d565b821015610ba057610b97600191610b71565b91020190600090565b610b57565b60018060a01b031690565b610bc0906008610bc593026104f5565b610ba5565b90565b90610bd39154610bb0565b90565b6004610be181610b6d565b821015610bfe57610bfb91610bf591610b7c565b90610bc8565b90565b600080fd5b610c0c90610564565b90565b610c1890610c03565b9052565b9190610c3090600060208501940190610c0f565b565b34610c6257610c5e610c4d610c4836600461044b565b610bd6565b610c556101d3565b91829182610c1c565b0390f35b6101d9565b610c70816107d7565b03610c7757565b600080fd5b90503590610c8982610c67565b565b90602082820312610ca557610ca291600001610c7c565b90565b6101de565b34610cd857610cc2610cbd366004610c8b565b611d3b565b610cca6101d3565b80610cd48161037f565b0390f35b6101d9565b34610d0b57610cf5610cf036600461044b565b611d9f565b610cfd6101d3565b80610d078161037f565b0390f35b6101d9565b7f000000000000000000000000000000000000000000000000000000000000000090565b610d3d90610564565b90565b610d4990610d34565b9052565b9190610d6190600060208501940190610d40565b565b34610d9357610d733660046101e3565b610d8f610d7e610d10565b610d866101d3565b91829182610d4d565b0390f35b6101d9565b600080fd5b606090565b5490565b60209181520190565b600052602060002090565b60001c90565b610dcc610dd191610dba565b610679565b90565b610dde9054610dc0565b90565b60010190565b90610e04610dfe610df784610da2565b8093610da6565b92610daf565b9060005b818110610e155750505090565b909192610e35610e2f600192610e2a87610dd4565b610216565b94610de1565b9101919091610e08565b90610e4991610de7565b90565b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b90610e7690610e4c565b810190811067ffffffffffffffff821117610e9057604052565b610e56565b90610eb5610eae92610ea56101d3565b93848092610e3f565b0383610e6c565b565b610ec090610e95565b90565b610ecb610d9d565b50610ed66006610eb7565b90565b90610eed939291610ee8611daa565b6111a6565b565b5090565b90565b610f0a610f05610f0f92610ef3565b610545565b610206565b90565b90565b610f29610f24610f2e92610f12565b610545565b610206565b90565b634e487b7160e01b600052601160045260246000fd5b610f56610f5c91939293610206565b92610206565b8201809211610f6757565b610f31565b6001610f789101610206565b90565b9190811015610f8b576020020190565b610b57565b35610f9a81610427565b90565b610fac610fb291939293610206565b92610206565b8203918211610fbd57565b610f31565b610fcc9054610dc0565b90565b610fde610fe491939293610206565b92610206565b91610ff0838202610206565b928184041490151715610fff57565b610f31565b600190818003010490565b1b90565b9190600861102f9102916110296000198461100f565b9261100f565b9181191691161790565b61104d61104861105292610206565b610545565b610206565b90565b90565b919061106e61106961107693611039565b611055565b908354611013565b9055565b600090565b6110919161108b61107a565b91611058565b565b5b81811061109f575050565b806110ad600060019361107f565b01611094565b90918281106110c2575b505050565b6110e06110da6110d46110eb95611004565b92611004565b92610daf565b918201910190611093565b3880806110bd565b9068010000000000000000811161111c578161111161111a93610da2565b908281556110b3565b565b610e56565b90565b90916111309083610eef565b9167ffffffffffffffff83116111945761115e61115860019261115386866110f3565b611121565b92610daf565b92049160005b8381106111715750505050565b600190602061118761118286610f90565b611055565b9401938184015501611164565b610e56565b906111a49291611124565b565b9290916111b4848490610eef565b6111c76111c16000610ef6565b91610206565b1480156113d6575b6113b3576111de818390610eef565b61120d6112076112026111f2888890610eef565b6111fc6001610f15565b90610f47565b610206565b91610206565b036113905761121c6001610f15565b5b8061123a61123461122f888890610eef565b610206565b91610206565b10156112c35761125461124f86868491610f7b565b610f90565b61128c61128661128161127c8989611276886112706001610f15565b90610f9d565b91610f7b565b610f90565b610206565b91610206565b11156112a05761129b90610f6c565b61121d565b6112a86101d3565b630309cb8760e51b8152806112bf6004820161037f565b0390fd5b5091939092936112d36000610ef6565b5b806112f16112eb6112e6878990610eef565b610206565b91610206565b10156113745761130b61130685878491610f7b565b610f90565b61132661132061131b6009610fc2565b610206565b91610206565b116113395761133490610f6c565b6112d4565b61135261134d866113709387919091610f7b565b610f90565b61135a6101d3565b918291630d0216bf60e01b8352600483016104aa565b0390fd5b506113879061138e949392956006611199565b6007611199565b565b6113986101d3565b630309cb8760e51b8152806113af6004820161037f565b0390fd5b6113bb6101d3565b63521299a960e01b8152806113d26004820161037f565b0390fd5b506113e2818390610eef565b6113f56113ef6000610ef6565b91610206565b146111cf565b90611407939291610ed9565b565b9061141b91611416611daa565b61141d565b565b611428818390610eef565b61143b6114356000610ef6565b91610206565b1461155b5761144a6000610ef6565b5b8061146861146261145d858790610eef565b610206565b91610206565b10156114eb5761148261147d83858491610f7b565b610f90565b61149d6114976114926009610fc2565b610206565b91610206565b116114b0576114ab90610f6c565b61144b565b6114e7926114c4916114c993919091610f7b565b610f90565b6114d16101d3565b918291630d0216bf60e01b8352600483016104aa565b0390fd5b50906114f8828290610eef565b61152661152061151b61150b6006610da2565b6115156001610f15565b90610f47565b610206565b91610206565b0361153857611536916007611199565b565b6115406101d3565b630309cb8760e51b8152806115576004820161037f565b0390fd5b6115636101d3565b63521299a960e01b81528061157a6004820161037f565b0390fd5b9061158891611409565b565b61159b90611596611daa565b6115da565b565b60001b90565b906115b06000199161159d565b9181191691161790565b906115cf6115ca6115d692611039565b611055565b82546115a3565b9055565b6115e58160086115ba565b61161b7fef8d6b7360688c75ba18bd7b859afd153547b5092d73aeca32b1c03a6420926b916116126101d3565b918291826104aa565b0390a1565b6116299061158a565b565b61163761163c91610dba565b6104f9565b90565b611649905461162b565b90565b60e01b90565b9050519061165f82610427565b565b9060208282031261167b5761167891600001611652565b90565b6101de565b6116886101d3565b3d6000823e3d90fd5b634e487b7160e01b600052601260045260246000fd5b6116b36116b991610206565b91610206565b9081156116c4570490565b611691565b6116d281610da2565b8210156116ed576116e4600191610daf565b91020190600090565b610b57565b6116fa61107a565b506117056004610b6d565b6117186117126000610ef6565b91610206565b146118c75761174a602061173461172f600361163f565b610570565b633724e53a906117426101d3565b93849261164c565b8252818061175a6004820161037f565b03915afa9081156118c257600091611894575b50611776611dff565b9061177f61107a565b508161179c6117966117916001610fc2565b610206565b91610206565b108015611879575b6000146118515750506117de6117d860076117d26117c26007610da2565b6117cc6001610f15565b90610f9d565b906116c9565b90610694565b5b6117e7611fa5565b6117f28282906120e4565b611842575b508061181461180e6118096009610fc2565b610206565b91610206565b1161181c5790565b61183e906118286101d3565b918291630d0216bf60e01b8352600483016104aa565b0390fd5b61184b91612173565b386117f7565b6118749161186a61186f926118646108c2565b90610fcf565b6116a7565b611ee5565b6117df565b508061188d61188784610206565b91610206565b10156117a4565b6118b5915060203d81116118bb575b6118ad8183610e6c565b810190611661565b3861176d565b503d6118a3565b611680565b6118cf6101d3565b63521299a960e01b8152806118e66004820161037f565b0390fd5b6118f2611daa565b6118fa611924565b565b61191061190b61191592610ef3565b610545565b61053a565b90565b611921906118fc565b90565b6119366119316000611918565b6121e6565b565b6119406118ea565b565b90565b61195961195461195e92611942565b610545565b610206565b90565b90565b61197861197361197d92611961565b610545565b610206565b90565b61198861107a565b506119ba6119aa6119976116f2565b6119a46312e337ef611945565b90610fcf565b6119b46064611964565b906116a7565b90565b600090565b60018060a01b031690565b6119d96119de91610dba565b6119c2565b90565b6119eb90546119cd565b90565b6119f66119bd565b50611a0160006119e1565b90565b611a1590611a10611daa565b611a17565b565b611a228160056115ba565b611a587f987d030d8facc771449fcb0709510c65ca63c74c2a59516903e4a816a7a77cc191611a4f6101d3565b918291826104aa565b0390a1565b611a6690611a04565b565b611a70610d9d565b50611a7b6007610eb7565b90565b90611a9091611a8b611daa565b611a92565b565b90611a9e828290610eef565b611ab1611aab6000610ef6565b91610206565b14611bd657611ac06001610f15565b5b80611ade611ad8611ad3868690610eef565b610206565b91610206565b1015611b6757611af8611af384848491610f7b565b610f90565b611b30611b2a611b25611b208787611b1a88611b146001610f15565b90610f9d565b91610f7b565b610f90565b610206565b91610206565b1115611b4457611b3f90610f6c565b611ac1565b611b4c6101d3565b630309cb8760e51b815280611b636004820161037f565b0390fd5b50611b726007610da2565b611ba1611b9b611b96611b86868690610eef565b611b906001610f15565b90610f47565b610206565b91610206565b03611bb357611bb1916006611199565b565b611bbb6101d3565b630309cb8760e51b815280611bd26004820161037f565b0390fd5b611bde6101d3565b63521299a960e01b815280611bf56004820161037f565b0390fd5b90611c0391611a7e565b565b611c1690611c11611daa565b611c18565b565b611c2381600a6115ba565b611c597f36931cd2c96cd6b4676532d84c2c7fbc3143b7b46b2aaca4a9bb86d97926e83791611c506101d3565b918291826104aa565b0390a1565b611c6790611c05565b565b611c7a90611c75611daa565b611c7c565b565b611c878160096115ba565b611cbd7fcd90c7a63a1de76707890fac09d3ec4c5490e4e83e7ce87920161e45e59fcded91611cb46101d3565b918291826104aa565b0390a1565b611ccb90611c69565b565b611cde90611cd9611daa565b611ce0565b565b80611cfc611cf6611cf16000611918565b6107d7565b916107d7565b14611d0c57611d0a906121e6565b565b611d37611d196000611918565b611d216101d3565b91829163b20f76e360e01b8352600483016107f0565b0390fd5b611d4490611ccd565b565b611d5790611d52611daa565b611d59565b565b611d648160016115ba565b611d9a7fd19626887a80d9a30bbcc2875d8b7042a2d453acdaa61376278cf2ebe68d9d9e91611d916101d3565b918291826104aa565b0390a1565b611da890611d46565b565b611db26119ee565b611dcb611dc5611dc0612247565b6107d7565b916107d7565b03611dd257565b611dfb611ddd612247565b611de56101d3565b9182916332b2baa360e01b8352600483016107f0565b0390fd5b611e0761107a565b90611e126004610b6d565b90611e1b61107a565b925b83611e30611e2a85610206565b91610206565b1015611edf57611e6e6020611e58611e53611e4d60048990610b7c565b90610bc8565b610c03565b634a8622ea90611e666101d3565b93849261164c565b82528180611e7e6004820161037f565b03915afa8015611eda57611ea492611e9e92600092611eaa575b50610f47565b93610f6c565b92611e1d565b611ecc91925060203d8111611ed3575b611ec48183610e6c565b810190611661565b9038611e98565b503d611eba565b611680565b92509050565b611eed61107a565b50611ef86006610da2565b90611f036000610ef6565b5b80611f17611f1185610206565b91610206565b1015611f725781611f44611f3e611f39611f33600686906116c9565b90610694565b610206565b91610206565b10611f5757611f5290610f6c565b611f04565b611f6f9250611f6991505b60076116c9565b90610694565b90565b611f6f9250611f699150611f62565b611f8a90610548565b90565b611f9690611f81565b90565b611fa290610564565b90565b611fad61107a565b50611fb66123de565b611fc06000610ef6565b9080611fd5611fcf6000610ef6565b91610206565b03611fdf575b5090565b6120359150602061201f61201a6120157f000000000000000000000000000000000000000000000000000000000000000061073e565b611f8d565b611f99565b6318160ddd9061202d6101d3565b94859261164c565b825281806120456004820161037f565b03915afa9182156120da576120749261206f916000916120ac575b506120696108c2565b90610fcf565b6116a7565b8061209061208a6120856008610fc2565b610206565b91610206565b1161209c575b38611fdb565b506120a76008610fc2565b612096565b6120cd915060203d81116120d3575b6120c58183610e6c565b810190611661565b38612060565b503d6120bb565b611680565b600090565b906120ed6120df565b506120f86005610fc2565b61210b6121056000610ef6565b91610206565b11908161214f575b50908161211f575b5090565b905061214861214261213d61213760076000906116c9565b90610694565b610206565b91610206565b143861211b565b905061216c6121666121616005610fc2565b610206565b91610206565b1138612113565b612199916121899161218361107a565b50610fcf565b6121936005610fc2565b906116a7565b90565b906121ad60018060a01b039161159d565b9181191691161790565b6121c090610564565b90565b90565b906121db6121d66121e2926121b7565b6121c3565b825461219c565b9055565b6121f060006119e1565b6121fb8260006121c6565b9061222f6122297f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0936121b7565b916121b7565b916122386101d3565b806122428161037f565b0390a3565b61224f6119bd565b503390565b906122676122606101d3565b9283610e6c565b565b67ffffffffffffffff81116122815760208091020190565b610e56565b9050519061229382610c67565b565b909291926122aa6122a582612269565b612254565b93818552602080860192028301928184116122e757915b8383106122ce5750505050565b602080916122dc8486612286565b8152019201916122c1565b6102db565b9080601f8301121561230a5781602061230793519101612295565b90565b6102d1565b9060208282031261234057600082015167ffffffffffffffff811161233b5761233892016122ec565b90565b6102cc565b6101de565b5190565b61235561235a91610dba565b6105d4565b90565b6123679054612349565b90565b9061237482612345565b811015612385576020809102010190565b610b57565b61239490516107d7565b90565b6123a090610548565b90565b6123ac90612397565b90565b6123b890610564565b90565b6123c4906123af565b9052565b91906123dc906000602085019401906123bb565b565b6123e661107a565b9061242b60006124157f0000000000000000000000000000000000000000000000000000000000000000610d34565b63b4e8a6c4906124236101d3565b93849261164c565b8252818061243b6004820161037f565b03915afa90811561256457600091612541575b5061245881612345565b916124636000610ef6565b935b8461247861247286610206565b91610206565b101561253a576124d96020612495612490600261235d565b610615565b6384212635906124ce6124b96124b46124af8a8d9061236a565b61238a565b6123a3565b926124c26101d3565b9586948593849361164c565b8352600483016123c8565b03915afa8015612535576124ff926124f992600092612505575b50610f47565b94610f6c565b93612465565b61252791925060203d811161252e575b61251f8183610e6c565b810190611661565b90386124f3565b503d612515565b611680565b9350915050565b61255e91503d806000833e6125568183610e6c565b81019061230f565b3861244e565b61168056fea264697066735822122003b4e37fffe08595e5c83a9409cfeee68488182ff84599cef60f4125ac1b460964736f6c634300081800330000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000002328000000000000000000000000000000000000000000000000000000000000238c00000000000000000000000000000000000000000000000000000000000023f0000000000000000000000000000000000000000000000000000000000000245400000000000000000000000000000000000000000000000000000000000024b8000000000000000000000000000000000000000000000000000000000000251c000000000000000000000000000000000000000000000000000000000000258000000000000000000000000000000000000000000000000000000000000025e4000000000000000000000000000000000000000000000000000000000000264800000000000000000000000000000000000000000000000000000000000026ac0000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000005dc00000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000009c40000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000000000000000000000000000000000000000000dac0000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000011940000000000000000000000000000000000000000000000000000000000001388000000000000000000000000000000000000000000000000000000000000157c0000000000000000000000000000000000000000000000000000000000001770
Deployed Bytecode
0x60806040526004361015610013575b610d98565b61001e6000356101cd565b80631a6362b4146101c85780632846c4d9146101c35780632aaca2b8146101be5780634a4c2d7a146101b95780635257b566146101b457806360f7237b146101af57806361f04d75146101aa5780636ed8dd19146101a5578063715018a6146101a057806374453d1b1461019b57806383cf078e146101965780638da5cb5b146101915780638ebcb61c1461018c57806392acced0146101875780639860a44e14610182578063a9583d5f1461017d578063b54f0a8914610178578063c586132814610173578063ce3d13511461016e578063d7f116dc14610169578063d819576314610164578063db58f1ce1461015f578063dc3cbb8d1461015a578063ed987a0814610155578063f2fde38b14610150578063f70fca541461014b5763fbfa77cf0361000e57610d63565b610cdd565b610caa565b610c32565b610b22565b610adf565b610aaa565b610a65565b610a22565b6109ed565b610955565b610920565b6108db565b61086e565b61083b565b610806565b6107a2565b61076d565b6106e7565b6106b2565b610644565b61059f565b6104c0565b61046a565b6103f3565b610385565b610297565b60e01c90565b60405190565b600080fd5b600080fd5b60009103126101ee57565b6101de565b5190565b60209181520190565b60200190565b90565b61021290610206565b9052565b9061022381602093610209565b0190565b60200190565b9061024a61024461023d846101f3565b80936101f7565b92610200565b9060005b81811061025b5750505090565b90919261027461026e6001928651610216565b94610227565b910191909161024e565b610294916020820191600081840391015261022d565b90565b346102c7576102a73660046101e3565b6102c36102b2610ec3565b6102ba6101d3565b9182918261027e565b0390f35b6101d9565b600080fd5b600080fd5b600080fd5b600080fd5b909182601f8301121561031a5781359167ffffffffffffffff831161031557602001926020830284011161031057565b6102db565b6102d6565b6102d1565b909160408284031261037a57600082013567ffffffffffffffff8111610375578361034b9184016102e0565b929093602082013567ffffffffffffffff81116103705761036c92016102e0565b9091565b6102cc565b6102cc565b6101de565b60000190565b346103b7576103a161039836600461031f565b929190916113fb565b6103a96101d3565b806103b38161037f565b0390f35b6101d9565b906020828203126103ee57600082013567ffffffffffffffff81116103e9576103e592016102e0565b9091565b6102cc565b6101de565b346104225761040c6104063660046103bc565b9061157e565b6104146101d3565b8061041e8161037f565b0390f35b6101d9565b61043081610206565b0361043757565b600080fd5b9050359061044982610427565b565b90602082820312610465576104629160000161043c565b90565b6101de565b346104985761048261047d36600461044b565b611620565b61048a6101d3565b806104948161037f565b0390f35b6101d9565b6104a690610206565b9052565b91906104be9060006020850194019061049d565b565b346104f0576104d03660046101e3565b6104ec6104db6116f2565b6104e36101d3565b918291826104aa565b0390f35b6101d9565b1c90565b60018060a01b031690565b61051490600861051993026104f5565b6104f9565b90565b906105279154610504565b90565b610537600360009061051c565b90565b60018060a01b031690565b90565b61055c6105576105619261053a565b610545565b61053a565b90565b61056d90610548565b90565b61057990610564565b90565b61058590610570565b9052565b919061059d9060006020850194019061057c565b565b346105cf576105af3660046101e3565b6105cb6105ba61052a565b6105c26101d3565b91829182610589565b0390f35b6101d9565b60018060a01b031690565b6105ef9060086105f493026104f5565b6105d4565b90565b9061060291546105df565b90565b61061260026000906105f7565b90565b61061e90610564565b90565b61062a90610615565b9052565b919061064290600060208501940190610621565b565b34610674576106543660046101e3565b61067061065f610605565b6106676101d3565b9182918261062e565b0390f35b6101d9565b90565b61068c90600861069193026104f5565b610679565b90565b9061069f915461067c565b90565b6106af6005600090610694565b90565b346106e2576106c23660046101e3565b6106de6106cd6106a2565b6106d56101d3565b918291826104aa565b0390f35b6101d9565b34610715576106f73660046101e3565b6106ff611938565b6107076101d3565b806107118161037f565b0390f35b6101d9565b7f000000000000000000000000a0b0cbffed77e57e946fb1fb875b28edd0d0cc6d90565b61074790610564565b90565b6107539061073e565b9052565b919061076b9060006020850194019061074a565b565b3461079d5761077d3660046101e3565b61079961078861071a565b6107906101d3565b91829182610757565b0390f35b6101d9565b346107d2576107b23660046101e3565b6107ce6107bd611980565b6107c56101d3565b918291826104aa565b0390f35b6101d9565b6107e09061053a565b90565b6107ec906107d7565b9052565b9190610804906000602085019401906107e3565b565b34610836576108163660046101e3565b6108326108216119ee565b6108296101d3565b918291826107f0565b0390f35b6101d9565b346108695761085361084e36600461044b565b611a5d565b61085b6101d3565b806108658161037f565b0390f35b6101d9565b3461089e5761087e3660046101e3565b61089a610889611a68565b6108916101d3565b9182918261027e565b0390f35b6101d9565b90565b6108ba6108b56108bf926108a3565b610545565b610206565b90565b6108cd6127106108a6565b90565b6108d86108c2565b90565b3461090b576108eb3660046101e3565b6109076108f66108d0565b6108fe6101d3565b918291826104aa565b0390f35b6101d9565b61091d6009600090610694565b90565b34610950576109303660046101e3565b61094c61093b610910565b6109436101d3565b918291826104aa565b0390f35b6101d9565b346109845761096e6109683660046103bc565b90611bf9565b6109766101d3565b806109808161037f565b0390f35b6101d9565b60ff1690565b61099f9060086109a493026104f5565b610989565b90565b906109b2915461098f565b90565b6109c260006014906109a7565b90565b151590565b6109d3906109c5565b9052565b91906109eb906000602085019401906109ca565b565b34610a1d576109fd3660046101e3565b610a19610a086109b5565b610a106101d3565b918291826109d7565b0390f35b6101d9565b34610a5057610a3a610a3536600461044b565b611c5e565b610a426101d3565b80610a4c8161037f565b0390f35b6101d9565b610a62600a600090610694565b90565b34610a9557610a753660046101e3565b610a91610a80610a55565b610a886101d3565b918291826104aa565b0390f35b6101d9565b610aa76001600090610694565b90565b34610ada57610aba3660046101e3565b610ad6610ac5610a9a565b610acd6101d3565b918291826104aa565b0390f35b6101d9565b34610b0d57610af7610af236600461044b565b611cc2565b610aff6101d3565b80610b098161037f565b0390f35b6101d9565b610b1f6008600090610694565b90565b34610b5257610b323660046101e3565b610b4e610b3d610b12565b610b456101d3565b918291826104aa565b0390f35b6101d9565b634e487b7160e01b600052603260045260246000fd5b5490565b600052602060002090565b610b8581610b6d565b821015610ba057610b97600191610b71565b91020190600090565b610b57565b60018060a01b031690565b610bc0906008610bc593026104f5565b610ba5565b90565b90610bd39154610bb0565b90565b6004610be181610b6d565b821015610bfe57610bfb91610bf591610b7c565b90610bc8565b90565b600080fd5b610c0c90610564565b90565b610c1890610c03565b9052565b9190610c3090600060208501940190610c0f565b565b34610c6257610c5e610c4d610c4836600461044b565b610bd6565b610c556101d3565b91829182610c1c565b0390f35b6101d9565b610c70816107d7565b03610c7757565b600080fd5b90503590610c8982610c67565b565b90602082820312610ca557610ca291600001610c7c565b90565b6101de565b34610cd857610cc2610cbd366004610c8b565b611d3b565b610cca6101d3565b80610cd48161037f565b0390f35b6101d9565b34610d0b57610cf5610cf036600461044b565b611d9f565b610cfd6101d3565b80610d078161037f565b0390f35b6101d9565b7f00000000000000000000000088d6d8547bcbd5366538cedccf424776f3f7cabf90565b610d3d90610564565b90565b610d4990610d34565b9052565b9190610d6190600060208501940190610d40565b565b34610d9357610d733660046101e3565b610d8f610d7e610d10565b610d866101d3565b91829182610d4d565b0390f35b6101d9565b600080fd5b606090565b5490565b60209181520190565b600052602060002090565b60001c90565b610dcc610dd191610dba565b610679565b90565b610dde9054610dc0565b90565b60010190565b90610e04610dfe610df784610da2565b8093610da6565b92610daf565b9060005b818110610e155750505090565b909192610e35610e2f600192610e2a87610dd4565b610216565b94610de1565b9101919091610e08565b90610e4991610de7565b90565b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b90610e7690610e4c565b810190811067ffffffffffffffff821117610e9057604052565b610e56565b90610eb5610eae92610ea56101d3565b93848092610e3f565b0383610e6c565b565b610ec090610e95565b90565b610ecb610d9d565b50610ed66006610eb7565b90565b90610eed939291610ee8611daa565b6111a6565b565b5090565b90565b610f0a610f05610f0f92610ef3565b610545565b610206565b90565b90565b610f29610f24610f2e92610f12565b610545565b610206565b90565b634e487b7160e01b600052601160045260246000fd5b610f56610f5c91939293610206565b92610206565b8201809211610f6757565b610f31565b6001610f789101610206565b90565b9190811015610f8b576020020190565b610b57565b35610f9a81610427565b90565b610fac610fb291939293610206565b92610206565b8203918211610fbd57565b610f31565b610fcc9054610dc0565b90565b610fde610fe491939293610206565b92610206565b91610ff0838202610206565b928184041490151715610fff57565b610f31565b600190818003010490565b1b90565b9190600861102f9102916110296000198461100f565b9261100f565b9181191691161790565b61104d61104861105292610206565b610545565b610206565b90565b90565b919061106e61106961107693611039565b611055565b908354611013565b9055565b600090565b6110919161108b61107a565b91611058565b565b5b81811061109f575050565b806110ad600060019361107f565b01611094565b90918281106110c2575b505050565b6110e06110da6110d46110eb95611004565b92611004565b92610daf565b918201910190611093565b3880806110bd565b9068010000000000000000811161111c578161111161111a93610da2565b908281556110b3565b565b610e56565b90565b90916111309083610eef565b9167ffffffffffffffff83116111945761115e61115860019261115386866110f3565b611121565b92610daf565b92049160005b8381106111715750505050565b600190602061118761118286610f90565b611055565b9401938184015501611164565b610e56565b906111a49291611124565b565b9290916111b4848490610eef565b6111c76111c16000610ef6565b91610206565b1480156113d6575b6113b3576111de818390610eef565b61120d6112076112026111f2888890610eef565b6111fc6001610f15565b90610f47565b610206565b91610206565b036113905761121c6001610f15565b5b8061123a61123461122f888890610eef565b610206565b91610206565b10156112c35761125461124f86868491610f7b565b610f90565b61128c61128661128161127c8989611276886112706001610f15565b90610f9d565b91610f7b565b610f90565b610206565b91610206565b11156112a05761129b90610f6c565b61121d565b6112a86101d3565b630309cb8760e51b8152806112bf6004820161037f565b0390fd5b5091939092936112d36000610ef6565b5b806112f16112eb6112e6878990610eef565b610206565b91610206565b10156113745761130b61130685878491610f7b565b610f90565b61132661132061131b6009610fc2565b610206565b91610206565b116113395761133490610f6c565b6112d4565b61135261134d866113709387919091610f7b565b610f90565b61135a6101d3565b918291630d0216bf60e01b8352600483016104aa565b0390fd5b506113879061138e949392956006611199565b6007611199565b565b6113986101d3565b630309cb8760e51b8152806113af6004820161037f565b0390fd5b6113bb6101d3565b63521299a960e01b8152806113d26004820161037f565b0390fd5b506113e2818390610eef565b6113f56113ef6000610ef6565b91610206565b146111cf565b90611407939291610ed9565b565b9061141b91611416611daa565b61141d565b565b611428818390610eef565b61143b6114356000610ef6565b91610206565b1461155b5761144a6000610ef6565b5b8061146861146261145d858790610eef565b610206565b91610206565b10156114eb5761148261147d83858491610f7b565b610f90565b61149d6114976114926009610fc2565b610206565b91610206565b116114b0576114ab90610f6c565b61144b565b6114e7926114c4916114c993919091610f7b565b610f90565b6114d16101d3565b918291630d0216bf60e01b8352600483016104aa565b0390fd5b50906114f8828290610eef565b61152661152061151b61150b6006610da2565b6115156001610f15565b90610f47565b610206565b91610206565b0361153857611536916007611199565b565b6115406101d3565b630309cb8760e51b8152806115576004820161037f565b0390fd5b6115636101d3565b63521299a960e01b81528061157a6004820161037f565b0390fd5b9061158891611409565b565b61159b90611596611daa565b6115da565b565b60001b90565b906115b06000199161159d565b9181191691161790565b906115cf6115ca6115d692611039565b611055565b82546115a3565b9055565b6115e58160086115ba565b61161b7fef8d6b7360688c75ba18bd7b859afd153547b5092d73aeca32b1c03a6420926b916116126101d3565b918291826104aa565b0390a1565b6116299061158a565b565b61163761163c91610dba565b6104f9565b90565b611649905461162b565b90565b60e01b90565b9050519061165f82610427565b565b9060208282031261167b5761167891600001611652565b90565b6101de565b6116886101d3565b3d6000823e3d90fd5b634e487b7160e01b600052601260045260246000fd5b6116b36116b991610206565b91610206565b9081156116c4570490565b611691565b6116d281610da2565b8210156116ed576116e4600191610daf565b91020190600090565b610b57565b6116fa61107a565b506117056004610b6d565b6117186117126000610ef6565b91610206565b146118c75761174a602061173461172f600361163f565b610570565b633724e53a906117426101d3565b93849261164c565b8252818061175a6004820161037f565b03915afa9081156118c257600091611894575b50611776611dff565b9061177f61107a565b508161179c6117966117916001610fc2565b610206565b91610206565b108015611879575b6000146118515750506117de6117d860076117d26117c26007610da2565b6117cc6001610f15565b90610f9d565b906116c9565b90610694565b5b6117e7611fa5565b6117f28282906120e4565b611842575b508061181461180e6118096009610fc2565b610206565b91610206565b1161181c5790565b61183e906118286101d3565b918291630d0216bf60e01b8352600483016104aa565b0390fd5b61184b91612173565b386117f7565b6118749161186a61186f926118646108c2565b90610fcf565b6116a7565b611ee5565b6117df565b508061188d61188784610206565b91610206565b10156117a4565b6118b5915060203d81116118bb575b6118ad8183610e6c565b810190611661565b3861176d565b503d6118a3565b611680565b6118cf6101d3565b63521299a960e01b8152806118e66004820161037f565b0390fd5b6118f2611daa565b6118fa611924565b565b61191061190b61191592610ef3565b610545565b61053a565b90565b611921906118fc565b90565b6119366119316000611918565b6121e6565b565b6119406118ea565b565b90565b61195961195461195e92611942565b610545565b610206565b90565b90565b61197861197361197d92611961565b610545565b610206565b90565b61198861107a565b506119ba6119aa6119976116f2565b6119a46312e337ef611945565b90610fcf565b6119b46064611964565b906116a7565b90565b600090565b60018060a01b031690565b6119d96119de91610dba565b6119c2565b90565b6119eb90546119cd565b90565b6119f66119bd565b50611a0160006119e1565b90565b611a1590611a10611daa565b611a17565b565b611a228160056115ba565b611a587f987d030d8facc771449fcb0709510c65ca63c74c2a59516903e4a816a7a77cc191611a4f6101d3565b918291826104aa565b0390a1565b611a6690611a04565b565b611a70610d9d565b50611a7b6007610eb7565b90565b90611a9091611a8b611daa565b611a92565b565b90611a9e828290610eef565b611ab1611aab6000610ef6565b91610206565b14611bd657611ac06001610f15565b5b80611ade611ad8611ad3868690610eef565b610206565b91610206565b1015611b6757611af8611af384848491610f7b565b610f90565b611b30611b2a611b25611b208787611b1a88611b146001610f15565b90610f9d565b91610f7b565b610f90565b610206565b91610206565b1115611b4457611b3f90610f6c565b611ac1565b611b4c6101d3565b630309cb8760e51b815280611b636004820161037f565b0390fd5b50611b726007610da2565b611ba1611b9b611b96611b86868690610eef565b611b906001610f15565b90610f47565b610206565b91610206565b03611bb357611bb1916006611199565b565b611bbb6101d3565b630309cb8760e51b815280611bd26004820161037f565b0390fd5b611bde6101d3565b63521299a960e01b815280611bf56004820161037f565b0390fd5b90611c0391611a7e565b565b611c1690611c11611daa565b611c18565b565b611c2381600a6115ba565b611c597f36931cd2c96cd6b4676532d84c2c7fbc3143b7b46b2aaca4a9bb86d97926e83791611c506101d3565b918291826104aa565b0390a1565b611c6790611c05565b565b611c7a90611c75611daa565b611c7c565b565b611c878160096115ba565b611cbd7fcd90c7a63a1de76707890fac09d3ec4c5490e4e83e7ce87920161e45e59fcded91611cb46101d3565b918291826104aa565b0390a1565b611ccb90611c69565b565b611cde90611cd9611daa565b611ce0565b565b80611cfc611cf6611cf16000611918565b6107d7565b916107d7565b14611d0c57611d0a906121e6565b565b611d37611d196000611918565b611d216101d3565b91829163b20f76e360e01b8352600483016107f0565b0390fd5b611d4490611ccd565b565b611d5790611d52611daa565b611d59565b565b611d648160016115ba565b611d9a7fd19626887a80d9a30bbcc2875d8b7042a2d453acdaa61376278cf2ebe68d9d9e91611d916101d3565b918291826104aa565b0390a1565b611da890611d46565b565b611db26119ee565b611dcb611dc5611dc0612247565b6107d7565b916107d7565b03611dd257565b611dfb611ddd612247565b611de56101d3565b9182916332b2baa360e01b8352600483016107f0565b0390fd5b611e0761107a565b90611e126004610b6d565b90611e1b61107a565b925b83611e30611e2a85610206565b91610206565b1015611edf57611e6e6020611e58611e53611e4d60048990610b7c565b90610bc8565b610c03565b634a8622ea90611e666101d3565b93849261164c565b82528180611e7e6004820161037f565b03915afa8015611eda57611ea492611e9e92600092611eaa575b50610f47565b93610f6c565b92611e1d565b611ecc91925060203d8111611ed3575b611ec48183610e6c565b810190611661565b9038611e98565b503d611eba565b611680565b92509050565b611eed61107a565b50611ef86006610da2565b90611f036000610ef6565b5b80611f17611f1185610206565b91610206565b1015611f725781611f44611f3e611f39611f33600686906116c9565b90610694565b610206565b91610206565b10611f5757611f5290610f6c565b611f04565b611f6f9250611f6991505b60076116c9565b90610694565b90565b611f6f9250611f699150611f62565b611f8a90610548565b90565b611f9690611f81565b90565b611fa290610564565b90565b611fad61107a565b50611fb66123de565b611fc06000610ef6565b9080611fd5611fcf6000610ef6565b91610206565b03611fdf575b5090565b6120359150602061201f61201a6120157f000000000000000000000000a0b0cbffed77e57e946fb1fb875b28edd0d0cc6d61073e565b611f8d565b611f99565b6318160ddd9061202d6101d3565b94859261164c565b825281806120456004820161037f565b03915afa9182156120da576120749261206f916000916120ac575b506120696108c2565b90610fcf565b6116a7565b8061209061208a6120856008610fc2565b610206565b91610206565b1161209c575b38611fdb565b506120a76008610fc2565b612096565b6120cd915060203d81116120d3575b6120c58183610e6c565b810190611661565b38612060565b503d6120bb565b611680565b600090565b906120ed6120df565b506120f86005610fc2565b61210b6121056000610ef6565b91610206565b11908161214f575b50908161211f575b5090565b905061214861214261213d61213760076000906116c9565b90610694565b610206565b91610206565b143861211b565b905061216c6121666121616005610fc2565b610206565b91610206565b1138612113565b612199916121899161218361107a565b50610fcf565b6121936005610fc2565b906116a7565b90565b906121ad60018060a01b039161159d565b9181191691161790565b6121c090610564565b90565b90565b906121db6121d66121e2926121b7565b6121c3565b825461219c565b9055565b6121f060006119e1565b6121fb8260006121c6565b9061222f6122297f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0936121b7565b916121b7565b916122386101d3565b806122428161037f565b0390a3565b61224f6119bd565b503390565b906122676122606101d3565b9283610e6c565b565b67ffffffffffffffff81116122815760208091020190565b610e56565b9050519061229382610c67565b565b909291926122aa6122a582612269565b612254565b93818552602080860192028301928184116122e757915b8383106122ce5750505050565b602080916122dc8486612286565b8152019201916122c1565b6102db565b9080601f8301121561230a5781602061230793519101612295565b90565b6102d1565b9060208282031261234057600082015167ffffffffffffffff811161233b5761233892016122ec565b90565b6102cc565b6101de565b5190565b61235561235a91610dba565b6105d4565b90565b6123679054612349565b90565b9061237482612345565b811015612385576020809102010190565b610b57565b61239490516107d7565b90565b6123a090610548565b90565b6123ac90612397565b90565b6123b890610564565b90565b6123c4906123af565b9052565b91906123dc906000602085019401906123bb565b565b6123e661107a565b9061242b60006124157f00000000000000000000000088d6d8547bcbd5366538cedccf424776f3f7cabf610d34565b63b4e8a6c4906124236101d3565b93849261164c565b8252818061243b6004820161037f565b03915afa90811561256457600091612541575b5061245881612345565b916124636000610ef6565b935b8461247861247286610206565b91610206565b101561253a576124d96020612495612490600261235d565b610615565b6384212635906124ce6124b96124b46124af8a8d9061236a565b61238a565b6123a3565b926124c26101d3565b9586948593849361164c565b8352600483016123c8565b03915afa8015612535576124ff926124f992600092612505575b50610f47565b94610f6c565b93612465565b61252791925060203d811161252e575b61251f8183610e6c565b810190611661565b90386124f3565b503d612515565b611680565b9350915050565b61255e91503d806000833e6125568183610e6c565b81019061230f565b3861244e565b61168056fea264697066735822122003b4e37fffe08595e5c83a9409cfeee68488182ff84599cef60f4125ac1b460964736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000002328000000000000000000000000000000000000000000000000000000000000238c00000000000000000000000000000000000000000000000000000000000023f0000000000000000000000000000000000000000000000000000000000000245400000000000000000000000000000000000000000000000000000000000024b8000000000000000000000000000000000000000000000000000000000000251c000000000000000000000000000000000000000000000000000000000000258000000000000000000000000000000000000000000000000000000000000025e4000000000000000000000000000000000000000000000000000000000000264800000000000000000000000000000000000000000000000000000000000026ac0000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000005dc00000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000009c40000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000000000000000000000000000000000000000000dac0000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000011940000000000000000000000000000000000000000000000000000000000001388000000000000000000000000000000000000000000000000000000000000157c0000000000000000000000000000000000000000000000000000000000001770
-----Decoded View---------------
Arg [0] : baseContracts_ (address): 0x5Ce899AEd04c656776148fc3b1Adbe59e5f13D5c
Arg [1] : emergencyGradeArray_ (uint256[]): 9000,9100,9200,9300,9400,9500,9600,9700,9800,9900,10000
Arg [2] : interestRateArray_ (uint256[]): 500,1000,1500,2000,2500,3000,3500,4000,4500,5000,5500,6000
-----Encoded View---------------
28 Constructor Arguments found :
Arg [0] : 0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [2] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [3] : 000000000000000000000000000000000000000000000000000000000000000b
Arg [4] : 0000000000000000000000000000000000000000000000000000000000002328
Arg [5] : 000000000000000000000000000000000000000000000000000000000000238c
Arg [6] : 00000000000000000000000000000000000000000000000000000000000023f0
Arg [7] : 0000000000000000000000000000000000000000000000000000000000002454
Arg [8] : 00000000000000000000000000000000000000000000000000000000000024b8
Arg [9] : 000000000000000000000000000000000000000000000000000000000000251c
Arg [10] : 0000000000000000000000000000000000000000000000000000000000002580
Arg [11] : 00000000000000000000000000000000000000000000000000000000000025e4
Arg [12] : 0000000000000000000000000000000000000000000000000000000000002648
Arg [13] : 00000000000000000000000000000000000000000000000000000000000026ac
Arg [14] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [15] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [16] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [17] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [18] : 00000000000000000000000000000000000000000000000000000000000005dc
Arg [19] : 00000000000000000000000000000000000000000000000000000000000007d0
Arg [20] : 00000000000000000000000000000000000000000000000000000000000009c4
Arg [21] : 0000000000000000000000000000000000000000000000000000000000000bb8
Arg [22] : 0000000000000000000000000000000000000000000000000000000000000dac
Arg [23] : 0000000000000000000000000000000000000000000000000000000000000fa0
Arg [24] : 0000000000000000000000000000000000000000000000000000000000001194
Arg [25] : 0000000000000000000000000000000000000000000000000000000000001388
Arg [26] : 000000000000000000000000000000000000000000000000000000000000157c
Arg [27] : 0000000000000000000000000000000000000000000000000000000000001770
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.