Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Initialize | 11115872 | 42 hrs ago | IN | 0 S | 0.0621754 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
PegStabilityModule
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 {ReentrancyGuard} from "./abstract/ReentrancyGuard.sol"; import {MathLib} from "./library/MathLib.sol"; import {IBaseContracts} from "./interface/IBaseContracts.sol"; import {IERC20Custom} from "./interface/IERC20Custom.sol"; import {IERC20Token} from "./interface/IERC20Token.sol"; import {IMiscHelper} from "./interface/IMiscHelper.sol"; import {IOracle} from "./interface/IOracle.sol"; import {IPSM} from "./interface/IPSM.sol"; import {IStableOwner} from "./interface/IStableOwner.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IERC20 as IERC20Safe} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title PegStabilityModule * @dev Token swap system for price stability * @notice Manages DUSX-stablecoin swaps */ contract PegStabilityModule is Ownable, ReentrancyGuard, IPSM { /*////////////////////////////////////////////////////////////// SWAP DIRECTION ENUM //////////////////////////////////////////////////////////////*/ /// @notice Defines swap direction for price calculations enum Direction { IN, // Swapping stablecoins for DUSX OUT // Swapping DUSX for stablecoins } /*////////////////////////////////////////////////////////////// STATE VARIABLES //////////////////////////////////////////////////////////////*/ bool public initialized; /// @notice Base contracts registry IBaseContracts public immutable baseContracts; /// @notice DUSX token contract /// @dev Immutable reference to core protocol token IERC20Token public immutable dusx; /// @notice Stablecoin token contract /// @dev Immutable reference to supported stablecoin IERC20Custom public immutable stableToken; /// @notice Stable token owner contract /// @dev Used for controlled minting and burning IStableOwner public immutable stableOwner; /// @notice Price oracle contract /// @dev Provides real-time price information IOracle public oracle; /// @notice Protocol helper contract /// @dev Facilitates cross-contract interactions IMiscHelper public helper; /// @notice Maximum amount of DUSX that can be minted /// @dev Prevents excessive token creation uint256 public dusxMintCap; /// @notice Current amount of DUSX minted through this module /// @dev Tracks minted tokens for cap enforcement uint256 public dusxMinted; /// @notice Precision factor for stable token /// @dev Accounts for different stable token decimal places uint256 public immutable stablePrecision; /// @notice Treasury address for receiving leftover stablecoins address public treasury; /// @notice Precision constants uint256 public constant MANTISSA_ONE = 1e18; /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ /// @notice Emitted when DUSX mint cap is changed event DUSXMintCapChanged(uint256 oldCap, uint256 newCap); /// @notice Emitted when stable tokens are swapped for DUSX event StableForDUSXSwapped(uint256 stableIn, uint256 mintedDUSX); /// @notice Emitted when DUSX is swapped for stable tokens event DUSXForStableSwapped(uint256 burnedDUSX, uint256 stableOut); /// @notice Emitted when treasury address is updated event TreasuryAddressUpdated(address oldTreasury, address newTreasury); /// @notice Emitted when contract is initialized event Initialized(address helper, address oracle); /*////////////////////////////////////////////////////////////// CUSTOM ERRORS //////////////////////////////////////////////////////////////*/ error alreadyInitialized(); /// @notice Thrown when an invalid token amount is provided error InvalidAmount(); /// @notice Thrown when token decimals are incompatible error InvalidDecimals(); /// @notice Thrown when a zero address is provided error ZeroAddress(); /// @notice Thrown when a zero amount is provided error ZeroAmount(); /// @notice Thrown when DUSX mint cap would be exceeded error DUSXMintCapReached(); /*////////////////////////////////////////////////////////////// MODIFIERS //////////////////////////////////////////////////////////////*/ /// @notice Restricts function access to helper contract modifier onlyHelper() { if (address(helper) != _msgSender()) { revert UnauthorizedAccount(_msgSender()); } _; } /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ /** * @notice Initializes Peg Stability Module with core tokens * @param baseContracts_ BaseContracts instance for protocol integration * @param stableToken_ Stablecoin token contract address * @param treasury_ Address that can withdraw fees * * Requirements: * · Non-zero addresses for all parameters * · Stablecoin decimals must be ≤ 18 * * Effects: * · Sets core token references * · Calculates stable token precision */ constructor( IBaseContracts baseContracts_, IERC20Custom stableToken_, address treasury_ ) { _ensureNonzeroAddress(address(baseContracts_)); _ensureNonzeroAddress(address(stableToken_)); _ensureNonzeroAddress(treasury_); baseContracts = baseContracts_; treasury = treasury_; // Get core contracts from BaseContracts dusx = baseContracts.dusx(); stableOwner = baseContracts.stableOwner(); // Validate addresses _ensureNonzeroAddress(address(dusx)); _ensureNonzeroAddress(address(stableOwner)); // Initialize contract state stableToken = stableToken_; uint8 decimals_ = stableToken.decimals(); if (decimals_ > 18) { revert InvalidDecimals(); } stablePrecision = 10 ** decimals_; } /*////////////////////////////////////////////////////////////// INITIALIZATION FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Initializes contract with helper, oracle and treasury * * Requirements: * · Caller must be contract owner * · Non-zero addresses for all parameters * · Contract must not be already initialized * * Effects: * · Sets helper contract * · Sets oracle contract * · Sets treasury address * · Sets maximum DUSX mint cap */ function initialize() external onlyOwner { if (initialized) revert alreadyInitialized(); // Get contracts from BaseContracts helper = baseContracts.helper(); oracle = baseContracts.oracleChainlink(); // Validate addresses _ensureNonzeroAddress(address(helper)); _ensureNonzeroAddress(address(oracle)); dusxMintCap = type(uint256).max; initialized = true; emit Initialized(address(helper), address(oracle)); } /** * @notice Sets the treasury address for receiving leftover stablecoins * @param newTreasury The new treasury address */ function setTreasury(address newTreasury) external onlyOwner { _ensureNonzeroAddress(newTreasury); address oldTreasury = treasury; treasury = newTreasury; emit TreasuryAddressUpdated(oldTreasury, newTreasury); } /*////////////////////////////////////////////////////////////// SWAP FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Swaps DUSX for stable tokens * @param msgSender Original swap initiator * @param receiver Recipient of stable tokens * @param amountDUSX DUSX amount to swap * * Requirements: * · Only callable by helper * · Non-zero receiver address * · Sufficient DUSX minted * * Effects: * · Burns DUSX tokens * · Transfers stable tokens * · Updates oracle price * · Emits DUSXForStableSwapped event */ function swapDUSXForStable( address msgSender, address receiver, uint256 amountDUSX ) external nonReentrant onlyHelper { _ensureNonzeroAddress(receiver); _ensureNonzeroAmount(amountDUSX); _ensureNonzeroAddress(treasury); // Check if there's enough DUSX minted to burn if (dusxMinted < amountDUSX) { revert InvalidAmount(); } // Burn DUSX first to prevent reentrancy unchecked { dusxMinted -= amountDUSX; } stableOwner.burn(msgSender, amountDUSX); // oracle.updatePrice(address(stableToken)); uint256 stableTokenAmountUSD = _previewTokenUSDAmount( amountDUSX, Direction.OUT ); SafeERC20.safeTransfer( IERC20Safe(address(stableToken)), receiver, stableTokenAmountUSD ); uint256 remainingStable = MathLib.subWithZeroFloor( (amountDUSX * 10 ** stableToken.decimals()) / MANTISSA_ONE, stableTokenAmountUSD ); if ( remainingStable > 0 && remainingStable <= stableToken.balanceOf(address(this)) ) { SafeERC20.safeTransfer( IERC20Safe(address(stableToken)), treasury, remainingStable ); } emit DUSXForStableSwapped(amountDUSX, stableTokenAmountUSD); } /** * @notice Swaps stable tokens for DUSX * @param msgSender Original swap initiator * @param receiver DUSX token recipient * @param amountStable Stable token amount to swap * * Requirements: * · Only callable by helper * · Non-zero receiver address * · Within DUSX mint cap * * Effects: * · Transfers stable tokens * · Mints DUSX tokens * · Updates oracle price * · Emits StableForDUSXSwapped event */ function swapStableForDUSX( address msgSender, address receiver, uint256 amountStable ) external nonReentrant onlyHelper { _ensureNonzeroAddress(receiver); _ensureNonzeroAmount(amountStable); _ensureNonzeroAddress(treasury); uint256 balanceBefore = stableToken.balanceOf(address(this)); SafeERC20.safeTransferFrom( IERC20Safe(address(stableToken)), msgSender, address(this), amountStable ); uint256 balanceAfter = stableToken.balanceOf(address(this)); uint256 actualTransferAmt = balanceAfter - balanceBefore; // oracle.updatePrice(address(stableToken)); uint256 actualTransferAmtInUSD = _previewTokenUSDAmount( actualTransferAmt, Direction.IN ); if (dusxMinted + actualTransferAmtInUSD > dusxMintCap) { revert DUSXMintCapReached(); } unchecked { dusxMinted += actualTransferAmtInUSD; } stableOwner.mint(receiver, actualTransferAmtInUSD); uint256 remainingStable = (MathLib.subWithZeroFloor( (actualTransferAmt * MANTISSA_ONE) / 10 ** stableToken.decimals(), actualTransferAmtInUSD ) * 10 ** stableToken.decimals()) / MANTISSA_ONE; if ( remainingStable > 0 && remainingStable <= stableToken.balanceOf(address(this)) ) { SafeERC20.safeTransfer( IERC20Safe(address(stableToken)), treasury, remainingStable ); } emit StableForDUSXSwapped(actualTransferAmt, actualTransferAmtInUSD); } /** * @notice Sets the maximum amount of DUSX that can be minted through this contract * @param dusxMintCap_ The new maximum amount of DUSX that can be minted */ function setDUSXMintCap(uint256 dusxMintCap_) external onlyOwner { uint256 oldDUSXMintCap = dusxMintCap; dusxMintCap = dusxMintCap_; emit DUSXMintCapChanged(oldDUSXMintCap, dusxMintCap_); } /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Preview the amount of stable tokens received for burning DUSX * @param amountDUSX Amount of DUSX to hypothetically burn * @return Amount of stable tokens that would be received */ function previewSwapDUSXForStable( uint256 amountDUSX ) external view returns (uint256) { _ensureNonzeroAmount(amountDUSX); uint256 stableTokenAmountUSD = _previewTokenUSDAmount( amountDUSX, Direction.OUT ); if ( dusxMinted < ((stableTokenAmountUSD * MANTISSA_ONE) / 10 ** stableToken.decimals()) ) { revert InvalidAmount(); } return stableTokenAmountUSD; } /** * @notice Preview the amount of DUSX received for depositing stable tokens * @param amountStable Amount of stable tokens to hypothetically deposit * @return Amount of DUSX that would be received */ function previewSwapStableForDUSX( uint256 amountStable ) external view returns (uint256) { _ensureNonzeroAmount(amountStable); uint256 dusxTokenAmountUSD = _previewTokenUSDAmount( amountStable, Direction.IN ); if (dusxMinted + dusxTokenAmountUSD > dusxMintCap) { revert DUSXMintCapReached(); } return dusxTokenAmountUSD; } /*////////////////////////////////////////////////////////////// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @dev Calculates the USD value of tokens based on swap direction * @param amount The token amount to convert * @param direction Swap direction (IN/OUT) * @return USD value scaled by 1e18 */ function _previewTokenUSDAmount( uint256 amount, Direction direction ) private view returns (uint256) { if (direction == Direction.IN) { // amount (6) * price (18) / stablePrecision (6) = 18 decimals return (amount * _getPriceInUSD(direction)) / stablePrecision; } else { // amount (18) * stablePrecision (6) / price (18) = 6 decimals return (amount * stablePrecision) / _getPriceInUSD(direction); } } /** * @dev Gets the USD price of stable token with direction-based adjustments * @param direction Swap direction (IN/OUT) * @return Adjusted USD price */ function _getPriceInUSD( Direction direction ) private view returns (uint256) { uint256 price = oracle.getPrice(address(stableToken)); if (direction == Direction.IN) { return price < MANTISSA_ONE ? price : MANTISSA_ONE; } else { return price > MANTISSA_ONE ? price : MANTISSA_ONE; } } // Validates that an address is not zero function _ensureNonzeroAddress(address addr) private pure { if (addr == address(0)) { revert ZeroAddress(); } } // Validates that an amount is greater than zero function _ensureNonzeroAmount(uint256 amount) private pure { if (amount == 0) { revert ZeroAmount(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC165} from "./IERC165.sol"; /** * @title IERC1363 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. * * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction. */ interface IERC1363 is IERC20, IERC165 { /* * Note: the ERC-165 identifier for this interface is 0xb0202a11. * 0xb0202a11 === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^ * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @param data Additional data with no specified format, sent in call to `spender`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC1363} from "../../../interfaces/IERC1363.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC-20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { /** * @dev An operation with an ERC-20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. * * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being * set here. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { safeTransfer(token, to, value); } else if (!token.transferAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferFromAndCallRelaxed( IERC1363 token, address from, address to, uint256 value, bytes memory data ) internal { if (to.code.length == 0) { safeTransferFrom(token, from, to, value); } else if (!token.transferFromAndCall(from, to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}. * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall} * once without retrying, and relies on the returned value to be true. * * Reverts if the returned value is other than `true`. */ function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { forceApprove(token, to, value); } else if (!token.approveAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements. */ function _callOptionalReturn(IERC20 token, bytes memory data) private { uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) // bubble errors if iszero(success) { let ptr := mload(0x40) returndatacopy(ptr, 0, returndatasize()) revert(ptr, returndatasize()) } returnSize := returndatasize() returnValue := mload(0) } if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { bool success; uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) returnSize := returndatasize() returnValue := mload(0) } return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.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; /** * @title ReentrancyGuard * @dev Contract module that helps prevent reentrant calls to a function * @notice This module is used through inheritance. It will make available the modifier * `nonReentrant`, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. */ abstract contract ReentrancyGuard { /*////////////////////////////////////////////////////////////// STATE VARIABLES //////////////////////////////////////////////////////////////*/ /// @notice Guard state constants uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; /// @notice Current state of the guard uint256 private _status; /*////////////////////////////////////////////////////////////// CUSTOM ERRORS //////////////////////////////////////////////////////////////*/ error ReentrantCall(); /*////////////////////////////////////////////////////////////// MODIFIERS //////////////////////////////////////////////////////////////*/ /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ /** * @notice Initializes the contract by setting the initial reentrancy guard state */ constructor() { _status = NOT_ENTERED; } /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Checks if a protected function is currently executing * @return True if the contract is in the entered state */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } /*////////////////////////////////////////////////////////////// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @dev Sets guard state before protected function execution * @notice Reverts if a reentrant call is detected */ function _nonReentrantBefore() private { if (_status == ENTERED) { revert ReentrantCall(); } _status = ENTERED; } /** * @dev Resets guard state after protected function execution */ function _nonReentrantAfter() private { _status = NOT_ENTERED; } }
// 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; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title MathLib * @dev Library for safe mathematical operations and array comparisons * @notice This library provides utility functions for: * 1. Finding maximum/minimum values in arrays * 2. Comparing pairs of numbers * 3. Safe subtraction with zero floor protection */ library MathLib { /*////////////////////////////////////////////////////////////// ARRAY OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Finds the maximum value in an array * @param values Array of values to compare * @return uint256 Maximum value in the array * @dev * · Assumes array is not empty. First value is used as initial max. * · Reverts if input array is empty * · O(n) time complexity, where n is array length * · Useful for scenarios like tracking highest bid, maximum allocation, etc. */ function max(uint256[] memory values) internal pure returns (uint256) { uint256 maxValue = values[0]; uint256 length = values.length; for (uint256 i = 1; i < length; i++) { if (values[i] > maxValue) { maxValue = values[i]; } } return maxValue; } /** * @notice Finds the minimum value in an array * @param values Array of values to compare * @return uint256 Minimum value in the array * @dev * · Assumes array is not empty. First value is used as initial min. * · Reverts if input array is empty * · O(n) time complexity, where n is array length * · Useful for scenarios like finding lowest price, minimum threshold, etc. */ function min(uint256[] memory values) internal pure returns (uint256) { uint256 minValue = values[0]; uint256 length = values.length; for (uint256 i = 1; i < length; i++) { if (values[i] < minValue) { minValue = values[i]; } } return minValue; } /*////////////////////////////////////////////////////////////// COMPARISON OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Returns the larger of two values * @param a First value to compare * @param b Second value to compare * @return uint256 Maximum between a and b * @dev Uses ternary operator for gas efficiency */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @notice Returns the smaller of two values * @param a First value to compare * @param b Second value to compare * @return uint256 Minimum between a and b * @dev Uses ternary operator for gas efficiency */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /*////////////////////////////////////////////////////////////// ARITHMETIC OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Performs subtraction with a zero floor * @param a Value to subtract from * @param b Value to subtract * @return uint256 Result of (a - b) if a > b, otherwise 0 * @dev Prevents underflow by returning 0 instead of reverting */ function subWithZeroFloor( uint256 a, uint256 b ) internal pure returns (uint256) { return a > b ? a - b : 0; } }
{ "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":"contract IERC20Custom","name":"stableToken_","type":"address"},{"internalType":"address","name":"treasury_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DUSXMintCapReached","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidDecimals","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"InvalidOwner","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"UnauthorizedAccount","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"inputs":[],"name":"alreadyInitialized","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"burnedDUSX","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stableOut","type":"uint256"}],"name":"DUSXForStableSwapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCap","type":"uint256"}],"name":"DUSXMintCapChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"helper","type":"address"},{"indexed":false,"internalType":"address","name":"oracle","type":"address"}],"name":"Initialized","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":"stableIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintedDUSX","type":"uint256"}],"name":"StableForDUSXSwapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldTreasury","type":"address"},{"indexed":false,"internalType":"address","name":"newTreasury","type":"address"}],"name":"TreasuryAddressUpdated","type":"event"},{"inputs":[],"name":"MANTISSA_ONE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseContracts","outputs":[{"internalType":"contract IBaseContracts","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dusx","outputs":[{"internalType":"contract IERC20Token","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dusxMintCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dusxMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"helper","outputs":[{"internalType":"contract IMiscHelper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountDUSX","type":"uint256"}],"name":"previewSwapDUSXForStable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountStable","type":"uint256"}],"name":"previewSwapStableForDUSX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"dusxMintCap_","type":"uint256"}],"name":"setDUSXMintCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTreasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stableOwner","outputs":[{"internalType":"contract IStableOwner","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stablePrecision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stableToken","outputs":[{"internalType":"contract IERC20Custom","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"msgSender","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amountDUSX","type":"uint256"}],"name":"swapDUSXForStable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"msgSender","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amountStable","type":"uint256"}],"name":"swapStableForDUSX","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
61012060405234620000ec57620000206200001962000259565b9162000505565b6200002a620000f2565b612750620009d6823960805181818161036e0152818161113b01526111ad015260a0518161072a015260c0518181816107b201528181610cb9015281816115af0152818161162a0152818161166b015281816117c90152818161184e015281816119390152818161198601528181611d9b01528181611dd701528181611ecc01528181611f19015261254a015260e05181818161083a015281816117400152611d160152610100518181816103150152818161219001526121c4015261275090f35b620000f8565b60405190565b600080fd5b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b906200012990620000fd565b810190811060018060401b038211176200014257604052565b62000107565b906200015f62000157620000f2565b92836200011d565b565b600080fd5b60018060a01b031690565b6200017c9062000166565b90565b6200018a9062000171565b90565b62000198816200017f565b03620001a057565b600080fd5b90505190620001b4826200018d565b565b620001c19062000171565b90565b620001cf81620001b6565b03620001d757565b600080fd5b90505190620001eb82620001c4565b565b620001f88162000171565b036200020057565b600080fd5b905051906200021482620001ed565b565b9091606082840312620002535762000250620002368460008501620001a5565b93620002468160208601620001dc565b9360400162000205565b90565b62000161565b6200027c6200312680380380620002708162000148565b92833981019062000216565b909192565b90565b6200029d62000297620002a39262000166565b62000281565b62000166565b90565b620002b19062000284565b90565b620002bf90620002a6565b90565b620002cd90620002a6565b90565b60001b90565b90620002e960018060a01b0391620002d0565b9181191691161790565b620002fe90620002a6565b90565b90565b906200031e620003186200032692620002f3565b62000301565b8254620002d6565b9055565b6200033690516200017f565b90565b60e01b90565b6200034a9062000171565b90565b62000358816200033f565b036200036057565b600080fd5b9050519062000374826200034d565b565b906020828203126200039357620003909160000162000365565b90565b62000161565b60000190565b620003a9620000f2565b3d6000823e3d90fd5b620003bd9062000171565b90565b620003cb81620003b2565b03620003d357565b600080fd5b90505190620003e782620003c0565b565b9060208282031262000406576200040391600001620003d8565b90565b62000161565b6200041890516200033f565b90565b6200042690620002a6565b90565b620004359051620003b2565b90565b6200044390620002a6565b90565b620004529051620001b6565b90565b60ff1690565b620004668162000455565b036200046e57565b600080fd5b9050519062000482826200045b565b565b90602082820312620004a1576200049e9160000162000473565b90565b62000161565b90565b620004c3620004bd620004c992620004a7565b62000281565b62000455565b90565b90565b634e487b7160e01b600052601160045260246000fd5b620004f09062000455565b604d8111620004ff57600a0a90565b620004cf565b9162000556919262000516620007bd565b6200052b6200052582620002b4565b620008cc565b620005406200053a85620002c2565b620008cc565b6200054b82620008cc565b608052600662000304565b6200058b6020620005726200056c60806200032a565b620002b4565b6396df10c09062000582620000f2565b93849262000339565b825281806200059d6004820162000399565b03915afa908115620007b75760009162000782575b5060a052620005eb6020620005d2620005cc60806200032a565b620002b4565b63c7366e6e90620005e2620000f2565b93849262000339565b82528180620005fd6004820162000399565b03915afa9081156200077c5760009162000747575b5060e05262000636620006306200062a60a06200040c565b6200041b565b620008cc565b62000656620006506200064a60e062000429565b62000438565b620008cc565b60c0526200068e6020620006756200066f60c062000446565b620002c2565b63313ce5679062000685620000f2565b93849262000339565b82528180620006a06004820162000399565b03915afa90811562000741576000916200070c575b5080620006ce620006c76012620004aa565b9162000455565b11620006e557620006df90620004e5565b61010052565b620006ef620000f2565b630692acc560e51b815280620007086004820162000399565b0390fd5b62000732915060203d811162000739575b6200072981836200011d565b81019062000484565b38620006b5565b503d6200071d565b6200039f565b6200076d915060203d811162000774575b6200076481836200011d565b810190620003e9565b3862000612565b503d62000758565b6200039f565b620007a8915060203d8111620007af575b6200079f81836200011d565b81019062000376565b38620005b2565b503d62000793565b6200039f565b620007c762000861565b565b90565b620007e5620007df620007eb92620007c9565b62000281565b620004cc565b90565b620007fa6001620007cc565b90565b906200080c60001991620002d0565b9181191691161790565b6200082f620008296200083592620004cc565b62000281565b620004cc565b90565b90565b90620008556200084f6200085d9262000816565b62000838565b8254620007fd565b9055565b6200086b62000883565b6200088162000879620007ee565b60016200083b565b565b620008976200089162000921565b62000968565b565b90565b620008b5620008af620008bb9262000899565b62000281565b62000166565b90565b620008c9906200089c565b90565b620008ed620008e6620008e06000620008be565b62000171565b9162000171565b14620008f557565b620008ff620000f2565b63d92e233d60e01b815280620009186004820162000399565b0390fd5b600090565b6200092b6200091c565b503390565b60001c90565b60018060a01b031690565b62000950620009569162000930565b62000936565b90565b62000965905462000941565b90565b62000974600062000959565b6200098182600062000304565b90620009b9620009b27f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e093620002f3565b91620002f3565b91620009c4620000f2565b80620009d08162000399565b0390a356fe60806040526004361015610013575b610af7565b61001e60003561017d565b806303fb7a5a1461017857806312e906fb14610173578063158ef93e1461016e5780631ea8fe781461016957806325d3d7cf146101645780634a8622ea1461015f57806361d027b31461015a57806363b0e66a14610155578063715018a6146101505780637dc0d1d01461014b5780638129fc1c146101465780638da5cb5b1461014157806396df10c01461013c578063a9d75b2b14610137578063c7366e6e14610132578063d99c6b3b1461012d578063da2c91dc14610128578063f0f4426014610123578063f238537a1461011e578063f23c0f4014610119578063f2fde38b146101145763ffd0ac1e0361000e57610ac2565b610a7f565b610a4a565b6109d8565b6109a5565b610952565b6108c0565b61088b565b610803565b61077b565b6106f3565b6106c0565b61068b565b6105e8565b6105ad565b610508565b610463565b6103f5565b610337565b6102de565b610231565b6101fc565b60e01c90565b60405190565b600080fd5b600080fd5b90565b61019f81610193565b036101a657565b600080fd5b905035906101b882610196565b565b906020828203126101d4576101d1916000016101ab565b90565b61018e565b6101e290610193565b9052565b91906101fa906000602085019401906101d9565b565b3461022c576102286102176102123660046101ba565b610c75565b61021f610183565b918291826101e6565b0390f35b610189565b346102615761025d61024c6102473660046101ba565b610dbe565b610254610183565b918291826101e6565b0390f35b610189565b600091031261027157565b61018e565b1c90565b60ff1690565b6102909060086102959302610276565b61027a565b90565b906102a39154610280565b90565b6102b36002600090610298565b90565b151590565b6102c4906102b6565b9052565b91906102dc906000602085019401906102bb565b565b3461030e576102ee366004610266565b61030a6102f96102a6565b610301610183565b918291826102c8565b0390f35b610189565b7f000000000000000000000000000000000000000000000000000000000000000090565b3461036757610347366004610266565b610363610352610313565b61035a610183565b918291826101e6565b0390f35b610189565b7f000000000000000000000000000000000000000000000000000000000000000090565b60018060a01b031690565b90565b6103b26103ad6103b792610390565b61039b565b610390565b90565b6103c39061039e565b90565b6103cf906103ba565b90565b6103db906103c6565b9052565b91906103f3906000602085019401906103d2565b565b3461042557610405366004610266565b61042161041061036c565b610418610183565b918291826103df565b0390f35b610189565b90565b61043d9060086104429302610276565b61042a565b90565b90610450915461042d565b90565b6104606005600090610445565b90565b3461049357610473366004610266565b61048f61047e610453565b610486610183565b918291826101e6565b0390f35b610189565b60018060a01b031690565b6104b39060086104b89302610276565b610498565b90565b906104c691546104a3565b90565b6104d660066000906104bb565b90565b6104e290610390565b90565b6104ee906104d9565b9052565b9190610506906000602085019401906104e5565b565b3461053857610518366004610266565b6105346105236104c9565b61052b610183565b918291826104f2565b0390f35b610189565b60018060a01b031690565b61055890600861055d9302610276565b61053d565b90565b9061056b9154610548565b90565b61057b6003600090610560565b90565b610587906103ba565b90565b6105939061057e565b9052565b91906105ab9060006020850194019061058a565b565b346105dd576105bd366004610266565b6105d96105c861056e565b6105d0610183565b91829182610597565b0390f35b610189565b60000190565b34610616576105f8366004610266565b610600610e87565b610608610183565b80610612816105e2565b0390f35b610189565b60018060a01b031690565b61063690600861063b9302610276565b61061b565b90565b906106499154610626565b90565b610659600260019061063e565b90565b610665906103ba565b90565b6106719061065c565b9052565b919061068990600060208501940190610668565b565b346106bb5761069b366004610266565b6106b76106a661064c565b6106ae610183565b91829182610675565b0390f35b610189565b346106ee576106d0366004610266565b6106d861134a565b6106e0610183565b806106ea816105e2565b0390f35b610189565b3461072357610703366004610266565b61071f61070e61137a565b610716610183565b918291826104f2565b0390f35b610189565b7f000000000000000000000000000000000000000000000000000000000000000090565b610755906103ba565b90565b6107619061074c565b9052565b919061077990600060208501940190610758565b565b346107ab5761078b366004610266565b6107a7610796610728565b61079e610183565b91829182610765565b0390f35b610189565b7f000000000000000000000000000000000000000000000000000000000000000090565b6107dd906103ba565b90565b6107e9906107d4565b9052565b9190610801906000602085019401906107e0565b565b3461083357610813366004610266565b61082f61081e6107b0565b610826610183565b918291826107ed565b0390f35b610189565b7f000000000000000000000000000000000000000000000000000000000000000090565b610865906103ba565b90565b6108719061085c565b9052565b919061088990600060208501940190610868565b565b346108bb5761089b366004610266565b6108b76108a6610838565b6108ae610183565b91829182610875565b0390f35b610189565b346108ee576108d86108d33660046101ba565b611418565b6108e0610183565b806108ea816105e2565b0390f35b610189565b6108fc816104d9565b0361090357565b600080fd5b90503590610915826108f3565b565b909160608284031261094d5761094a6109338460008501610908565b936109418160208601610908565b936040016101ab565b90565b61018e565b346109815761096b610965366004610917565b91611b63565b610973610183565b8061097d816105e2565b0390f35b610189565b906020828203126109a05761099d91600001610908565b90565b61018e565b346109d3576109bd6109b8366004610986565b611c0c565b6109c5610183565b806109cf816105e2565b0390f35b610189565b34610a07576109f16109eb366004610917565b9161205d565b6109f9610183565b80610a03816105e2565b0390f35b610189565b90565b610a23610a1e610a2892610a0c565b61039b565b610193565b90565b610a3c670de0b6b3a7640000610a0f565b90565b610a47610a2b565b90565b34610a7a57610a5a366004610266565b610a76610a65610a3f565b610a6d610183565b918291826101e6565b0390f35b610189565b34610aad57610a97610a92366004610986565b6120d8565b610a9f610183565b80610aa9816105e2565b0390f35b610189565b610abf6004600090610445565b90565b34610af257610ad2366004610266565b610aee610add610ab2565b610ae5610183565b918291826101e6565b0390f35b610189565b600080fd5b600090565b60001c90565b610b13610b1891610b01565b61042a565b90565b610b259054610b07565b90565b634e487b7160e01b600052601160045260246000fd5b610b4d610b5391939293610193565b92610193565b91610b5f838202610193565b928184041490151715610b6e57565b610b28565b600080fd5b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b90610ba290610b78565b810190811067ffffffffffffffff821117610bbc57604052565b610b82565b60e01b90565b60ff1690565b610bd681610bc7565b03610bdd57565b600080fd5b90505190610bef82610bcd565b565b90602082820312610c0b57610c0891600001610be2565b90565b61018e565b610c18610183565b3d6000823e3d90fd5b610c2a90610bc7565b604d8111610c3857600a0a90565b610b28565b634e487b7160e01b600052601260045260246000fd5b610c5f610c6591610193565b91610193565b908115610c70570490565b610c3d565b610c9390610c81610afc565b50610c8b816120e3565b600190612151565b610c9d6005610b1b565b610caf82610ca9610a2b565b90610b3e565b610cf36020610cdd7f00000000000000000000000000000000000000000000000000000000000000006107d4565b63313ce56790610ceb610183565b938492610bc1565b82528180610d03600482016105e2565b03915afa8015610d9457610d3b92610d2a610d3092610d3594600091610d66575b50610c21565b90610c53565b610193565b91610193565b10610d435790565b610d4b610183565b63162908e360e11b815280610d62600482016105e2565b0390fd5b610d87915060203d8111610d8d575b610d7f8183610b98565b810190610bf1565b38610d24565b503d610d75565b610c10565b610da8610dae91939293610193565b92610193565b8201809211610db957565b610b28565b610ddc90610dca610afc565b50610dd4816120e3565b600090612151565b610df0610de96005610b1b565b8290610d99565b610e0b610e05610e006004610b1b565b610193565b91610193565b11610e135790565b610e1b610183565b634c258f7f60e11b815280610e32600482016105e2565b0390fd5b610e3e6121f8565b610e46610e73565b565b90565b610e5f610e5a610e6492610e48565b61039b565b610390565b90565b610e7090610e4b565b90565b610e85610e806000610e67565b61224d565b565b610e8f610e36565b565b610e996121f8565b610ea1611123565b565b610eaf610eb491610b01565b61027a565b90565b610ec19054610ea3565b90565b610ecd906104d9565b90565b610ed981610ec4565b03610ee057565b600080fd5b90505190610ef282610ed0565b565b90602082820312610f0e57610f0b91600001610ee5565b90565b61018e565b60001b90565b90610f2a60018060a01b0391610f13565b9181191691161790565b610f3d9061039e565b90565b610f4990610f34565b90565b90565b90610f64610f5f610f6b92610f40565b610f4c565b8254610f19565b9055565b610f78906104d9565b90565b610f8481610f6f565b03610f8b57565b600080fd5b90505190610f9d82610f7b565b565b90602082820312610fb957610fb691600001610f90565b90565b61018e565b60081b90565b90610fd7610100600160a81b0391610fbe565b9181191691161790565b610fea9061039e565b90565b610ff690610fe1565b90565b90565b9061101161100c61101892610fed565b610ff9565b8254610fc4565b9055565b61102861102d91610b01565b61053d565b90565b61103a905461101c565b90565b60081c90565b61104f6110549161103d565b61061b565b90565b6110619054611043565b90565b9061107160001991610f13565b9181191691161790565b61108f61108a61109492610193565b61039b565b610193565b90565b90565b906110af6110aa6110b69261107b565b611097565b8254611064565b9055565b906110c660ff91610f13565b9181191691161790565b6110d9906102b6565b90565b90565b906110f46110ef6110fb926110d0565b6110dc565b82546110ba565b9055565b91602061112192949361111a604082019660008301906104e5565b01906104e5565b565b61112d6002610eb7565b61132757611175602061115f7f00000000000000000000000000000000000000000000000000000000000000006103c6565b6363b0e66a9061116d610183565b938492610bc1565b82528180611185600482016105e2565b03915afa8015611322576111a3916000916112f4575b506003610f4f565b6111e760206111d17f00000000000000000000000000000000000000000000000000000000000000006103c6565b634f7b02ee906111df610183565b938492610bc1565b825281806111f7600482016105e2565b03915afa80156112ef57611215916000916112c1575b506002610ffc565b61122f61122a6112256003611030565b61057e565b6122ae565b61124961124461123f6002611057565b61065c565b6122ae565b611256600019600461109a565b611262600160026110df565b61127461126f6003611030565b61057e565b6112866112816002611057565b61065c565b7f3cd5ec01b1ae7cfec6ca1863e2cd6aa25d6d1702825803ff2b7cc95010fffdc2916112bc6112b3610183565b928392836110ff565b0390a1565b6112e2915060203d81116112e8575b6112da8183610b98565b810190610f9f565b3861120d565b503d6112d0565b610c10565b611315915060203d811161131b575b61130d8183610b98565b810190610ef4565b3861119b565b503d611303565b610c10565b61132f610183565b631499a6b760e21b815280611346600482016105e2565b0390fd5b611352610e91565b565b600090565b61136561136a91610b01565b610498565b90565b6113779054611359565b90565b611382611354565b5061138d600061136d565b90565b6113a19061139c6121f8565b6113c7565b565b9160206113c59294936113be604082019660008301906101d9565b01906101d9565b565b6113d16004610b1b565b6113dc82600461109a565b907ff3551bbad8eeb221e736852e2722b3d481a91825bf37bfe4310dad8ea7be52379161141361140a610183565b928392836113a3565b0390a1565b61142190611390565b565b90611436929161143161231f565b611440565b61143e6123aa565b565b919061145461144f6003611030565b61057e565b61146d6114676114626123be565b6104d9565b916104d9565b0361147d5761147b9261157f565b565b6114a66114886123be565b611490610183565b9182916332b2baa360e01b8352600483016104f2565b0390fd5b6114b3906103ba565b90565b905051906114c382610196565b565b906020828203126114df576114dc916000016114b6565b90565b61018e565b6114ed9061039e565b90565b6114f9906114e4565b90565b61150b61151191939293610193565b92610193565b820391821161151c57565b610b28565b9061152c9101610193565b90565b600091031261153a57565b61018e565b91602061156192949361155a604082019660008301906104e5565b01906101d9565b565b61157761157261157c92610e48565b61039b565b610193565b90565b909161158a836122ae565b611593816120e3565b6115a56115a0600661136d565b6122ae565b61160560206115d37f00000000000000000000000000000000000000000000000000000000000000006107d4565b6370a08231906115fa6115e5306114aa565b926115ee610183565b95869485938493610bc1565b8352600483016104f2565b03915afa928315611b5e576116c19361166492600091611b30575b509261165361164e7f00000000000000000000000000000000000000000000000000000000000000006107d4565b6114f0565b9161165d306114aa565b919261243b565b602061168f7f00000000000000000000000000000000000000000000000000000000000000006107d4565b6370a08231906116b66116a1306114aa565b926116aa610183565b96879485938493610bc1565b8352600483016104f2565b03915afa8015611b2b576116dd92600091611afd575b506114fc565b6116e981600090612151565b916116fe6116f76005610b1b565b8490610d99565b61171961171361170e6004610b1b565b610193565b91610193565b11611ada5761173b6117348461172f6005610b1b565b611521565b600561109a565b6117647f000000000000000000000000000000000000000000000000000000000000000061085c565b906340c10f19908492803b15611ad5576117926000809461179d611786610183565b97889687958694610bc1565b84526004840161153f565b03925af18015611ad057611aa3575b506117bf816117b9610a2b565b90610b3e565b61180360206117ed7f00000000000000000000000000000000000000000000000000000000000000006107d4565b63313ce567906117fb610183565b938492610bc1565b82528180611813600482016105e2565b03915afa8015611a9e576118889261183a6118409261184794600091611a70575b50610c21565b90610c53565b849061248b565b60206118727f00000000000000000000000000000000000000000000000000000000000000006107d4565b63313ce56790611880610183565b948592610bc1565b82528180611898600482016105e2565b03915afa908115611a6b576118bc6118c2926118d094600091611a3d575b50610c21565b90610b3e565b6118ca610a2b565b90610c53565b806118e46118de6000611563565b91610193565b118061197a575b61192d575b50907fde284546e14ace043549433b4364e8b1ce5d7bdb4ef885cde1a8cefd4be063439161192861191f610183565b928392836113a3565b0390a1565b6119749061196261195d7f00000000000000000000000000000000000000000000000000000000000000006107d4565b6114f0565b9061196d600661136d565b90916124ce565b386118f0565b50806119dc60206119aa7f00000000000000000000000000000000000000000000000000000000000000006107d4565b6370a08231906119d16119bc306114aa565b926119c5610183565b95869485938493610bc1565b8352600483016104f2565b03915afa908115611a3857611a03916119fd91600091611a0a575b50610193565b91610193565b11156118eb565b611a2b915060203d8111611a31575b611a238183610b98565b8101906114c5565b386119f7565b503d611a19565b610c10565b611a5e915060203d8111611a64575b611a568183610b98565b810190610bf1565b386118b6565b503d611a4c565b610c10565b611a91915060203d8111611a97575b611a898183610b98565b810190610bf1565b38611834565b503d611a7f565b610c10565b611ac39060003d8111611ac9575b611abb8183610b98565b81019061152f565b386117ac565b503d611ab1565b610c10565b610b73565b611ae2610183565b634c258f7f60e11b815280611af9600482016105e2565b0390fd5b611b1e915060203d8111611b24575b611b168183610b98565b8101906114c5565b386116d7565b503d611b0c565b610c10565b611b51915060203d8111611b57575b611b498183610b98565b8101906114c5565b38611620565b503d611b3f565b610c10565b90611b6e9291611423565b565b611b8190611b7c6121f8565b611bb2565b565b611b8c906103ba565b90565b90565b90611ba7611ba2611bae92611b83565b611b8f565b8254610f19565b9055565b611bbb816122ae565b611bc5600661136d565b611bd0826006611b92565b907f430359a6d97ced2b6f93c77a91e7ce9dfd43252eb91e916adba170485cd8a6a491611c07611bfe610183565b928392836110ff565b0390a1565b611c1590611b70565b565b90611c2a9291611c2561231f565b611c34565b611c326123aa565b565b9190611c48611c436003611030565b61057e565b611c61611c5b611c566123be565b6104d9565b916104d9565b03611c7157611c6f92611cac565b565b611c9a611c7c6123be565b611c84610183565b9182916332b2baa360e01b8352600483016104f2565b0390fd5b90611ca99103610193565b90565b919091611cb8836122ae565b611cc1826120e3565b611cd3611cce600661136d565b6122ae565b611cdd6005610b1b565b611cef611ce984610193565b91610193565b1061203a57611d11611d0a83611d056005610b1b565b611c9e565b600561109a565b611d3a7f000000000000000000000000000000000000000000000000000000000000000061085c565b90639dc29fac908392803b1561203557611d6860008094611d73611d5c610183565b97889687958694610bc1565b84526004840161153f565b03925af1801561203057612003575b50611dcc611d9282600190612151565b92611dc4611dbf7f00000000000000000000000000000000000000000000000000000000000000006107d4565b6114f0565b9084916124ce565b80611e116020611dfb7f00000000000000000000000000000000000000000000000000000000000000006107d4565b63313ce56790611e09610183565b938492610bc1565b82528180611e21600482016105e2565b03915afa8015611ffe57611e6392611e48611e4e92611e5c94600091611fd0575b50610c21565b90610b3e565b611e56610a2b565b90610c53565b839061248b565b80611e77611e716000611563565b91610193565b1180611f0d575b611ec0575b50907fd9ef2ac0b44537831d7d3f78eb74a60b2f743dcb5989eeca48a6e200013a0afd91611ebb611eb2610183565b928392836113a3565b0390a1565b611f0790611ef5611ef07f00000000000000000000000000000000000000000000000000000000000000006107d4565b6114f0565b90611f00600661136d565b90916124ce565b38611e83565b5080611f6f6020611f3d7f00000000000000000000000000000000000000000000000000000000000000006107d4565b6370a0823190611f64611f4f306114aa565b92611f58610183565b95869485938493610bc1565b8352600483016104f2565b03915afa908115611fcb57611f9691611f9091600091611f9d575b50610193565b91610193565b1115611e7e565b611fbe915060203d8111611fc4575b611fb68183610b98565b8101906114c5565b38611f8a565b503d611fac565b610c10565b611ff1915060203d8111611ff7575b611fe98183610b98565b810190610bf1565b38611e42565b503d611fdf565b610c10565b6120239060003d8111612029575b61201b8183610b98565b81019061152f565b38611d82565b503d612011565b610c10565b610b73565b612042610183565b63162908e360e11b815280612059600482016105e2565b0390fd5b906120689291611c17565b565b61207b906120766121f8565b61207d565b565b8061209961209361208e6000610e67565b6104d9565b916104d9565b146120a9576120a79061224d565b565b6120d46120b66000610e67565b6120be610183565b91829163b20f76e360e01b8352600483016104f2565b0390fd5b6120e19061206a565b565b6120f66120f06000611563565b91610193565b146120fd57565b612105610183565b631f2a200560e01b81528061211c600482016105e2565b0390fd5b634e487b7160e01b600052602160045260246000fd5b6002111561214057565b612120565b9061214f82612136565b565b9061215a610afc565b508061216f6121696000612145565b91612145565b146000146121b85761218e906121886121b5939161251c565b90610b3e565b7f000000000000000000000000000000000000000000000000000000000000000090610c53565b90565b6121ef6121e96121f5937f000000000000000000000000000000000000000000000000000000000000000090610b3e565b9161251c565b90610c53565b90565b61220061137a565b61221961221361220e6123be565b6104d9565b916104d9565b0361222057565b61224961222b6123be565b612233610183565b9182916332b2baa360e01b8352600483016104f2565b0390fd5b612257600061136d565b612262826000611b92565b906122966122907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e093611b83565b91611b83565b9161229f610183565b806122a9816105e2565b0390a3565b6122c96122c36122be6000610e67565b6104d9565b916104d9565b146122d057565b6122d8610183565b63d92e233d60e01b8152806122ef600482016105e2565b0390fd5b90565b61230a61230561230f926122f3565b61039b565b610193565b90565b61231c60026122f6565b90565b6123296001610b1b565b61234261233c612337612312565b610193565b91610193565b1461235b57612359612352612312565b600161109a565b565b612363610183565b6306fda65d60e31b81528061237a600482016105e2565b0390fd5b90565b61239561239061239a9261237e565b61039b565b610193565b90565b6123a76001612381565b90565b6123bc6123b561239d565b600161109a565b565b6123c6611354565b503390565b6123d4906103ba565b90565b63ffffffff1690565b63ffffffff60e01b1690565b6124006123fb612405926123d7565b610bc1565b6123e0565b90565b6040906124326124399496959396612428606084019860008501906104e5565b60208301906104e5565b01906101d9565b565b6004926124756124899593612484939461245c6323b872dd929491926123ec565b93612465610183565b9788956020870190815201612408565b60208201810382520383610b98565b612659565b565b90612494610afc565b50816124a86124a283610193565b91610193565b116000146124bd576124b9916114fc565b5b90565b50506124c96000611563565b6124ba565b9061251561251a93612506600494936124ed63a9059cbb9193916123ec565b926124f6610183565b968794602086019081520161153f565b60208201810382520383610b98565b612659565b565b612524610afc565b5061258e602061253c6125376002611057565b61065c565b6341976e099061258361256e7f00000000000000000000000000000000000000000000000000000000000000006107d4565b92612577610183565b95869485938493610bc1565b8352600483016104f2565b03915afa90811561265457600091612626575b50906125b66125b06000612145565b91612145565b146000146125f257806125d86125d26125cd610a2b565b610193565b91610193565b106000146125e4575b90565b506125ed610a2b565b6125e1565b8061260c612606612601610a2b565b610193565b91610193565b11600014612618575b90565b50612621610a2b565b612615565b612647915060203d811161264d575b61263f8183610b98565b8101906114c5565b386125a1565b503d612635565b610c10565b906000602091612667610afc565b50612670610afc565b50828151910182855af11561270e573d600051906126976126916000611563565b91610193565b146000146126f457506126a9816123cb565b3b6126bd6126b76000611563565b91610193565b145b6126c65750565b6126d26126f0916123cb565b6126da610183565b918291635274afe760e01b8352600483016104f2565b0390fd5b6127076127016001612381565b91610193565b14156126bf565b6040513d6000823e3d90fdfea2646970667358221220cd36b42cc1cd70d91477ce29eb3aa7d8df4bafd2495b6ab66aaffe9db60d4cda64736f6c634300081800330000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf900000000000000000000000012684d18bdba8e31936f40abce1175366874114f
Deployed Bytecode
0x60806040526004361015610013575b610af7565b61001e60003561017d565b806303fb7a5a1461017857806312e906fb14610173578063158ef93e1461016e5780631ea8fe781461016957806325d3d7cf146101645780634a8622ea1461015f57806361d027b31461015a57806363b0e66a14610155578063715018a6146101505780637dc0d1d01461014b5780638129fc1c146101465780638da5cb5b1461014157806396df10c01461013c578063a9d75b2b14610137578063c7366e6e14610132578063d99c6b3b1461012d578063da2c91dc14610128578063f0f4426014610123578063f238537a1461011e578063f23c0f4014610119578063f2fde38b146101145763ffd0ac1e0361000e57610ac2565b610a7f565b610a4a565b6109d8565b6109a5565b610952565b6108c0565b61088b565b610803565b61077b565b6106f3565b6106c0565b61068b565b6105e8565b6105ad565b610508565b610463565b6103f5565b610337565b6102de565b610231565b6101fc565b60e01c90565b60405190565b600080fd5b600080fd5b90565b61019f81610193565b036101a657565b600080fd5b905035906101b882610196565b565b906020828203126101d4576101d1916000016101ab565b90565b61018e565b6101e290610193565b9052565b91906101fa906000602085019401906101d9565b565b3461022c576102286102176102123660046101ba565b610c75565b61021f610183565b918291826101e6565b0390f35b610189565b346102615761025d61024c6102473660046101ba565b610dbe565b610254610183565b918291826101e6565b0390f35b610189565b600091031261027157565b61018e565b1c90565b60ff1690565b6102909060086102959302610276565b61027a565b90565b906102a39154610280565b90565b6102b36002600090610298565b90565b151590565b6102c4906102b6565b9052565b91906102dc906000602085019401906102bb565b565b3461030e576102ee366004610266565b61030a6102f96102a6565b610301610183565b918291826102c8565b0390f35b610189565b7f00000000000000000000000000000000000000000000000000000000000f424090565b3461036757610347366004610266565b610363610352610313565b61035a610183565b918291826101e6565b0390f35b610189565b7f0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c90565b60018060a01b031690565b90565b6103b26103ad6103b792610390565b61039b565b610390565b90565b6103c39061039e565b90565b6103cf906103ba565b90565b6103db906103c6565b9052565b91906103f3906000602085019401906103d2565b565b3461042557610405366004610266565b61042161041061036c565b610418610183565b918291826103df565b0390f35b610189565b90565b61043d9060086104429302610276565b61042a565b90565b90610450915461042d565b90565b6104606005600090610445565b90565b3461049357610473366004610266565b61048f61047e610453565b610486610183565b918291826101e6565b0390f35b610189565b60018060a01b031690565b6104b39060086104b89302610276565b610498565b90565b906104c691546104a3565b90565b6104d660066000906104bb565b90565b6104e290610390565b90565b6104ee906104d9565b9052565b9190610506906000602085019401906104e5565b565b3461053857610518366004610266565b6105346105236104c9565b61052b610183565b918291826104f2565b0390f35b610189565b60018060a01b031690565b61055890600861055d9302610276565b61053d565b90565b9061056b9154610548565b90565b61057b6003600090610560565b90565b610587906103ba565b90565b6105939061057e565b9052565b91906105ab9060006020850194019061058a565b565b346105dd576105bd366004610266565b6105d96105c861056e565b6105d0610183565b91829182610597565b0390f35b610189565b60000190565b34610616576105f8366004610266565b610600610e87565b610608610183565b80610612816105e2565b0390f35b610189565b60018060a01b031690565b61063690600861063b9302610276565b61061b565b90565b906106499154610626565b90565b610659600260019061063e565b90565b610665906103ba565b90565b6106719061065c565b9052565b919061068990600060208501940190610668565b565b346106bb5761069b366004610266565b6106b76106a661064c565b6106ae610183565b91829182610675565b0390f35b610189565b346106ee576106d0366004610266565b6106d861134a565b6106e0610183565b806106ea816105e2565b0390f35b610189565b3461072357610703366004610266565b61071f61070e61137a565b610716610183565b918291826104f2565b0390f35b610189565b7f000000000000000000000000e30e73cc52ef50a4e4a8b1a3dd0b002b2276f85490565b610755906103ba565b90565b6107619061074c565b9052565b919061077990600060208501940190610758565b565b346107ab5761078b366004610266565b6107a7610796610728565b61079e610183565b91829182610765565b0390f35b610189565b7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf990565b6107dd906103ba565b90565b6107e9906107d4565b9052565b9190610801906000602085019401906107e0565b565b3461083357610813366004610266565b61082f61081e6107b0565b610826610183565b918291826107ed565b0390f35b610189565b7f000000000000000000000000002c4c18f15c4e5ed51b845b2c87459ed630fa8690565b610865906103ba565b90565b6108719061085c565b9052565b919061088990600060208501940190610868565b565b346108bb5761089b366004610266565b6108b76108a6610838565b6108ae610183565b91829182610875565b0390f35b610189565b346108ee576108d86108d33660046101ba565b611418565b6108e0610183565b806108ea816105e2565b0390f35b610189565b6108fc816104d9565b0361090357565b600080fd5b90503590610915826108f3565b565b909160608284031261094d5761094a6109338460008501610908565b936109418160208601610908565b936040016101ab565b90565b61018e565b346109815761096b610965366004610917565b91611b63565b610973610183565b8061097d816105e2565b0390f35b610189565b906020828203126109a05761099d91600001610908565b90565b61018e565b346109d3576109bd6109b8366004610986565b611c0c565b6109c5610183565b806109cf816105e2565b0390f35b610189565b34610a07576109f16109eb366004610917565b9161205d565b6109f9610183565b80610a03816105e2565b0390f35b610189565b90565b610a23610a1e610a2892610a0c565b61039b565b610193565b90565b610a3c670de0b6b3a7640000610a0f565b90565b610a47610a2b565b90565b34610a7a57610a5a366004610266565b610a76610a65610a3f565b610a6d610183565b918291826101e6565b0390f35b610189565b34610aad57610a97610a92366004610986565b6120d8565b610a9f610183565b80610aa9816105e2565b0390f35b610189565b610abf6004600090610445565b90565b34610af257610ad2366004610266565b610aee610add610ab2565b610ae5610183565b918291826101e6565b0390f35b610189565b600080fd5b600090565b60001c90565b610b13610b1891610b01565b61042a565b90565b610b259054610b07565b90565b634e487b7160e01b600052601160045260246000fd5b610b4d610b5391939293610193565b92610193565b91610b5f838202610193565b928184041490151715610b6e57565b610b28565b600080fd5b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b90610ba290610b78565b810190811067ffffffffffffffff821117610bbc57604052565b610b82565b60e01b90565b60ff1690565b610bd681610bc7565b03610bdd57565b600080fd5b90505190610bef82610bcd565b565b90602082820312610c0b57610c0891600001610be2565b90565b61018e565b610c18610183565b3d6000823e3d90fd5b610c2a90610bc7565b604d8111610c3857600a0a90565b610b28565b634e487b7160e01b600052601260045260246000fd5b610c5f610c6591610193565b91610193565b908115610c70570490565b610c3d565b610c9390610c81610afc565b50610c8b816120e3565b600190612151565b610c9d6005610b1b565b610caf82610ca9610a2b565b90610b3e565b610cf36020610cdd7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b63313ce56790610ceb610183565b938492610bc1565b82528180610d03600482016105e2565b03915afa8015610d9457610d3b92610d2a610d3092610d3594600091610d66575b50610c21565b90610c53565b610193565b91610193565b10610d435790565b610d4b610183565b63162908e360e11b815280610d62600482016105e2565b0390fd5b610d87915060203d8111610d8d575b610d7f8183610b98565b810190610bf1565b38610d24565b503d610d75565b610c10565b610da8610dae91939293610193565b92610193565b8201809211610db957565b610b28565b610ddc90610dca610afc565b50610dd4816120e3565b600090612151565b610df0610de96005610b1b565b8290610d99565b610e0b610e05610e006004610b1b565b610193565b91610193565b11610e135790565b610e1b610183565b634c258f7f60e11b815280610e32600482016105e2565b0390fd5b610e3e6121f8565b610e46610e73565b565b90565b610e5f610e5a610e6492610e48565b61039b565b610390565b90565b610e7090610e4b565b90565b610e85610e806000610e67565b61224d565b565b610e8f610e36565b565b610e996121f8565b610ea1611123565b565b610eaf610eb491610b01565b61027a565b90565b610ec19054610ea3565b90565b610ecd906104d9565b90565b610ed981610ec4565b03610ee057565b600080fd5b90505190610ef282610ed0565b565b90602082820312610f0e57610f0b91600001610ee5565b90565b61018e565b60001b90565b90610f2a60018060a01b0391610f13565b9181191691161790565b610f3d9061039e565b90565b610f4990610f34565b90565b90565b90610f64610f5f610f6b92610f40565b610f4c565b8254610f19565b9055565b610f78906104d9565b90565b610f8481610f6f565b03610f8b57565b600080fd5b90505190610f9d82610f7b565b565b90602082820312610fb957610fb691600001610f90565b90565b61018e565b60081b90565b90610fd7610100600160a81b0391610fbe565b9181191691161790565b610fea9061039e565b90565b610ff690610fe1565b90565b90565b9061101161100c61101892610fed565b610ff9565b8254610fc4565b9055565b61102861102d91610b01565b61053d565b90565b61103a905461101c565b90565b60081c90565b61104f6110549161103d565b61061b565b90565b6110619054611043565b90565b9061107160001991610f13565b9181191691161790565b61108f61108a61109492610193565b61039b565b610193565b90565b90565b906110af6110aa6110b69261107b565b611097565b8254611064565b9055565b906110c660ff91610f13565b9181191691161790565b6110d9906102b6565b90565b90565b906110f46110ef6110fb926110d0565b6110dc565b82546110ba565b9055565b91602061112192949361111a604082019660008301906104e5565b01906104e5565b565b61112d6002610eb7565b61132757611175602061115f7f0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c6103c6565b6363b0e66a9061116d610183565b938492610bc1565b82528180611185600482016105e2565b03915afa8015611322576111a3916000916112f4575b506003610f4f565b6111e760206111d17f0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c6103c6565b634f7b02ee906111df610183565b938492610bc1565b825281806111f7600482016105e2565b03915afa80156112ef57611215916000916112c1575b506002610ffc565b61122f61122a6112256003611030565b61057e565b6122ae565b61124961124461123f6002611057565b61065c565b6122ae565b611256600019600461109a565b611262600160026110df565b61127461126f6003611030565b61057e565b6112866112816002611057565b61065c565b7f3cd5ec01b1ae7cfec6ca1863e2cd6aa25d6d1702825803ff2b7cc95010fffdc2916112bc6112b3610183565b928392836110ff565b0390a1565b6112e2915060203d81116112e8575b6112da8183610b98565b810190610f9f565b3861120d565b503d6112d0565b610c10565b611315915060203d811161131b575b61130d8183610b98565b810190610ef4565b3861119b565b503d611303565b610c10565b61132f610183565b631499a6b760e21b815280611346600482016105e2565b0390fd5b611352610e91565b565b600090565b61136561136a91610b01565b610498565b90565b6113779054611359565b90565b611382611354565b5061138d600061136d565b90565b6113a19061139c6121f8565b6113c7565b565b9160206113c59294936113be604082019660008301906101d9565b01906101d9565b565b6113d16004610b1b565b6113dc82600461109a565b907ff3551bbad8eeb221e736852e2722b3d481a91825bf37bfe4310dad8ea7be52379161141361140a610183565b928392836113a3565b0390a1565b61142190611390565b565b90611436929161143161231f565b611440565b61143e6123aa565b565b919061145461144f6003611030565b61057e565b61146d6114676114626123be565b6104d9565b916104d9565b0361147d5761147b9261157f565b565b6114a66114886123be565b611490610183565b9182916332b2baa360e01b8352600483016104f2565b0390fd5b6114b3906103ba565b90565b905051906114c382610196565b565b906020828203126114df576114dc916000016114b6565b90565b61018e565b6114ed9061039e565b90565b6114f9906114e4565b90565b61150b61151191939293610193565b92610193565b820391821161151c57565b610b28565b9061152c9101610193565b90565b600091031261153a57565b61018e565b91602061156192949361155a604082019660008301906104e5565b01906101d9565b565b61157761157261157c92610e48565b61039b565b610193565b90565b909161158a836122ae565b611593816120e3565b6115a56115a0600661136d565b6122ae565b61160560206115d37f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b6370a08231906115fa6115e5306114aa565b926115ee610183565b95869485938493610bc1565b8352600483016104f2565b03915afa928315611b5e576116c19361166492600091611b30575b509261165361164e7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b6114f0565b9161165d306114aa565b919261243b565b602061168f7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b6370a08231906116b66116a1306114aa565b926116aa610183565b96879485938493610bc1565b8352600483016104f2565b03915afa8015611b2b576116dd92600091611afd575b506114fc565b6116e981600090612151565b916116fe6116f76005610b1b565b8490610d99565b61171961171361170e6004610b1b565b610193565b91610193565b11611ada5761173b6117348461172f6005610b1b565b611521565b600561109a565b6117647f000000000000000000000000002c4c18f15c4e5ed51b845b2c87459ed630fa8661085c565b906340c10f19908492803b15611ad5576117926000809461179d611786610183565b97889687958694610bc1565b84526004840161153f565b03925af18015611ad057611aa3575b506117bf816117b9610a2b565b90610b3e565b61180360206117ed7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b63313ce567906117fb610183565b938492610bc1565b82528180611813600482016105e2565b03915afa8015611a9e576118889261183a6118409261184794600091611a70575b50610c21565b90610c53565b849061248b565b60206118727f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b63313ce56790611880610183565b948592610bc1565b82528180611898600482016105e2565b03915afa908115611a6b576118bc6118c2926118d094600091611a3d575b50610c21565b90610b3e565b6118ca610a2b565b90610c53565b806118e46118de6000611563565b91610193565b118061197a575b61192d575b50907fde284546e14ace043549433b4364e8b1ce5d7bdb4ef885cde1a8cefd4be063439161192861191f610183565b928392836113a3565b0390a1565b6119749061196261195d7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b6114f0565b9061196d600661136d565b90916124ce565b386118f0565b50806119dc60206119aa7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b6370a08231906119d16119bc306114aa565b926119c5610183565b95869485938493610bc1565b8352600483016104f2565b03915afa908115611a3857611a03916119fd91600091611a0a575b50610193565b91610193565b11156118eb565b611a2b915060203d8111611a31575b611a238183610b98565b8101906114c5565b386119f7565b503d611a19565b610c10565b611a5e915060203d8111611a64575b611a568183610b98565b810190610bf1565b386118b6565b503d611a4c565b610c10565b611a91915060203d8111611a97575b611a898183610b98565b810190610bf1565b38611834565b503d611a7f565b610c10565b611ac39060003d8111611ac9575b611abb8183610b98565b81019061152f565b386117ac565b503d611ab1565b610c10565b610b73565b611ae2610183565b634c258f7f60e11b815280611af9600482016105e2565b0390fd5b611b1e915060203d8111611b24575b611b168183610b98565b8101906114c5565b386116d7565b503d611b0c565b610c10565b611b51915060203d8111611b57575b611b498183610b98565b8101906114c5565b38611620565b503d611b3f565b610c10565b90611b6e9291611423565b565b611b8190611b7c6121f8565b611bb2565b565b611b8c906103ba565b90565b90565b90611ba7611ba2611bae92611b83565b611b8f565b8254610f19565b9055565b611bbb816122ae565b611bc5600661136d565b611bd0826006611b92565b907f430359a6d97ced2b6f93c77a91e7ce9dfd43252eb91e916adba170485cd8a6a491611c07611bfe610183565b928392836110ff565b0390a1565b611c1590611b70565b565b90611c2a9291611c2561231f565b611c34565b611c326123aa565b565b9190611c48611c436003611030565b61057e565b611c61611c5b611c566123be565b6104d9565b916104d9565b03611c7157611c6f92611cac565b565b611c9a611c7c6123be565b611c84610183565b9182916332b2baa360e01b8352600483016104f2565b0390fd5b90611ca99103610193565b90565b919091611cb8836122ae565b611cc1826120e3565b611cd3611cce600661136d565b6122ae565b611cdd6005610b1b565b611cef611ce984610193565b91610193565b1061203a57611d11611d0a83611d056005610b1b565b611c9e565b600561109a565b611d3a7f000000000000000000000000002c4c18f15c4e5ed51b845b2c87459ed630fa8661085c565b90639dc29fac908392803b1561203557611d6860008094611d73611d5c610183565b97889687958694610bc1565b84526004840161153f565b03925af1801561203057612003575b50611dcc611d9282600190612151565b92611dc4611dbf7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b6114f0565b9084916124ce565b80611e116020611dfb7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b63313ce56790611e09610183565b938492610bc1565b82528180611e21600482016105e2565b03915afa8015611ffe57611e6392611e48611e4e92611e5c94600091611fd0575b50610c21565b90610b3e565b611e56610a2b565b90610c53565b839061248b565b80611e77611e716000611563565b91610193565b1180611f0d575b611ec0575b50907fd9ef2ac0b44537831d7d3f78eb74a60b2f743dcb5989eeca48a6e200013a0afd91611ebb611eb2610183565b928392836113a3565b0390a1565b611f0790611ef5611ef07f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b6114f0565b90611f00600661136d565b90916124ce565b38611e83565b5080611f6f6020611f3d7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b6370a0823190611f64611f4f306114aa565b92611f58610183565b95869485938493610bc1565b8352600483016104f2565b03915afa908115611fcb57611f9691611f9091600091611f9d575b50610193565b91610193565b1115611e7e565b611fbe915060203d8111611fc4575b611fb68183610b98565b8101906114c5565b38611f8a565b503d611fac565b610c10565b611ff1915060203d8111611ff7575b611fe98183610b98565b810190610bf1565b38611e42565b503d611fdf565b610c10565b6120239060003d8111612029575b61201b8183610b98565b81019061152f565b38611d82565b503d612011565b610c10565b610b73565b612042610183565b63162908e360e11b815280612059600482016105e2565b0390fd5b906120689291611c17565b565b61207b906120766121f8565b61207d565b565b8061209961209361208e6000610e67565b6104d9565b916104d9565b146120a9576120a79061224d565b565b6120d46120b66000610e67565b6120be610183565b91829163b20f76e360e01b8352600483016104f2565b0390fd5b6120e19061206a565b565b6120f66120f06000611563565b91610193565b146120fd57565b612105610183565b631f2a200560e01b81528061211c600482016105e2565b0390fd5b634e487b7160e01b600052602160045260246000fd5b6002111561214057565b612120565b9061214f82612136565b565b9061215a610afc565b508061216f6121696000612145565b91612145565b146000146121b85761218e906121886121b5939161251c565b90610b3e565b7f00000000000000000000000000000000000000000000000000000000000f424090610c53565b90565b6121ef6121e96121f5937f00000000000000000000000000000000000000000000000000000000000f424090610b3e565b9161251c565b90610c53565b90565b61220061137a565b61221961221361220e6123be565b6104d9565b916104d9565b0361222057565b61224961222b6123be565b612233610183565b9182916332b2baa360e01b8352600483016104f2565b0390fd5b612257600061136d565b612262826000611b92565b906122966122907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e093611b83565b91611b83565b9161229f610183565b806122a9816105e2565b0390a3565b6122c96122c36122be6000610e67565b6104d9565b916104d9565b146122d057565b6122d8610183565b63d92e233d60e01b8152806122ef600482016105e2565b0390fd5b90565b61230a61230561230f926122f3565b61039b565b610193565b90565b61231c60026122f6565b90565b6123296001610b1b565b61234261233c612337612312565b610193565b91610193565b1461235b57612359612352612312565b600161109a565b565b612363610183565b6306fda65d60e31b81528061237a600482016105e2565b0390fd5b90565b61239561239061239a9261237e565b61039b565b610193565b90565b6123a76001612381565b90565b6123bc6123b561239d565b600161109a565b565b6123c6611354565b503390565b6123d4906103ba565b90565b63ffffffff1690565b63ffffffff60e01b1690565b6124006123fb612405926123d7565b610bc1565b6123e0565b90565b6040906124326124399496959396612428606084019860008501906104e5565b60208301906104e5565b01906101d9565b565b6004926124756124899593612484939461245c6323b872dd929491926123ec565b93612465610183565b9788956020870190815201612408565b60208201810382520383610b98565b612659565b565b90612494610afc565b50816124a86124a283610193565b91610193565b116000146124bd576124b9916114fc565b5b90565b50506124c96000611563565b6124ba565b9061251561251a93612506600494936124ed63a9059cbb9193916123ec565b926124f6610183565b968794602086019081520161153f565b60208201810382520383610b98565b612659565b565b612524610afc565b5061258e602061253c6125376002611057565b61065c565b6341976e099061258361256e7f0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf96107d4565b92612577610183565b95869485938493610bc1565b8352600483016104f2565b03915afa90811561265457600091612626575b50906125b66125b06000612145565b91612145565b146000146125f257806125d86125d26125cd610a2b565b610193565b91610193565b106000146125e4575b90565b506125ed610a2b565b6125e1565b8061260c612606612601610a2b565b610193565b91610193565b11600014612618575b90565b50612621610a2b565b612615565b612647915060203d811161264d575b61263f8183610b98565b8101906114c5565b386125a1565b503d612635565b610c10565b906000602091612667610afc565b50612670610afc565b50828151910182855af11561270e573d600051906126976126916000611563565b91610193565b146000146126f457506126a9816123cb565b3b6126bd6126b76000611563565b91610193565b145b6126c65750565b6126d26126f0916123cb565b6126da610183565b918291635274afe760e01b8352600483016104f2565b0390fd5b6127076127016001612381565b91610193565b14156126bf565b6040513d6000823e3d90fdfea2646970667358221220cd36b42cc1cd70d91477ce29eb3aa7d8df4bafd2495b6ab66aaffe9db60d4cda64736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf900000000000000000000000012684d18bdba8e31936f40abce1175366874114f
-----Decoded View---------------
Arg [0] : baseContracts_ (address): 0x5Ce899AEd04c656776148fc3b1Adbe59e5f13D5c
Arg [1] : stableToken_ (address): 0x6047828dc181963ba44974801FF68e538dA5eaF9
Arg [2] : treasury_ (address): 0x12684d18BDBA8e31936f40aBcE1175366874114f
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c
Arg [1] : 0000000000000000000000006047828dc181963ba44974801ff68e538da5eaf9
Arg [2] : 00000000000000000000000012684d18bdba8e31936f40abce1175366874114f
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.