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