Source Code
Overview
S Balance
S Value
$0.00Latest 25 from a total of 57 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Change Borrow Li... | 55821623 | 67 days ago | IN | 0 S | 0.00451627 | ||||
| Set Manual | 55821617 | 67 days ago | IN | 0 S | 0.00312911 | ||||
| Change Borrow Li... | 54589414 | 77 days ago | IN | 0 S | 0.00273399 | ||||
| Change Borrow Li... | 54589399 | 77 days ago | IN | 0 S | 0.00273399 | ||||
| Change Borrow Li... | 54589384 | 77 days ago | IN | 0 S | 0.00273399 | ||||
| Change Borrow Li... | 54589361 | 77 days ago | IN | 0 S | 0.00273399 | ||||
| Change Borrow Li... | 54589346 | 77 days ago | IN | 0 S | 0.00273399 | ||||
| Change Borrow Li... | 54589330 | 77 days ago | IN | 0 S | 0.00273399 | ||||
| Change Borrow Li... | 54589317 | 77 days ago | IN | 0 S | 0.00273399 | ||||
| Change Borrow Li... | 54589304 | 77 days ago | IN | 0 S | 0.00273399 | ||||
| Change Borrow Li... | 54589287 | 77 days ago | IN | 0 S | 0.00273399 | ||||
| Set Manual | 54589275 | 77 days ago | IN | 0 S | 0.05901133 | ||||
| Change Borrow Li... | 17876802 | 298 days ago | IN | 0 S | 0.06954556 | ||||
| Set Manual | 17876794 | 298 days ago | IN | 0 S | 0.05901133 | ||||
| Change Borrow Li... | 17876718 | 298 days ago | IN | 0 S | 0.06954556 | ||||
| Set Manual | 17876711 | 298 days ago | IN | 0 S | 0.05901133 | ||||
| Change Borrow Li... | 17876061 | 298 days ago | IN | 0 S | 0.06954556 | ||||
| Set Manual | 17876052 | 298 days ago | IN | 0 S | 0.05901133 | ||||
| Change Borrow Li... | 17875997 | 298 days ago | IN | 0 S | 0.06954556 | ||||
| Set Manual | 17875989 | 298 days ago | IN | 0 S | 0.05901133 | ||||
| Change Borrow Li... | 17867202 | 298 days ago | IN | 0 S | 0.06954857 | ||||
| Change Borrow Li... | 17867073 | 298 days ago | IN | 0 S | 0.06954857 | ||||
| Change Borrow Li... | 14522162 | 313 days ago | IN | 0 S | 0.06954556 | ||||
| Set Manual | 14522151 | 313 days ago | IN | 0 S | 0.05901133 | ||||
| Change Borrow Li... | 14522120 | 313 days ago | IN | 0 S | 0.07170016 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
LenderOwner
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
No with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {Ownable} from "../abstract/Ownable.sol";
import {IBaseContracts} from "../interface/IBaseContracts.sol";
import {IERC20Token} from "../interface/IERC20Token.sol";
import {ILender} from "../interface/ILender.sol";
import {ILenderOwner} from "../interface/ILenderOwner.sol";
import {IMiscHelper} from "../interface/IMiscHelper.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20 as IERC20Safe} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title LenderOwner
* @dev Manages administrative control and configuration for lending markets
* @notice Facilitates:
* · Lender configuration management
* · Interest rate adjustments
* · Supply control
* · Borrowing limits
* · Fee distribution
*/
contract LenderOwner is Ownable, ILenderOwner {
/*//////////////////////////////////////////////////////////////
STORAGE
//////////////////////////////////////////////////////////////*/
/// @notice Treasury address for fee collection
/// @dev Mutable to allow updates
address public treasury;
/// @notice DUSX token contract reference
/// @dev Immutable for gas optimization
IERC20Token public immutable dusx;
/// @notice Tracks manual lender markets
/// @dev Lender address => manual status
mapping(address => bool) public manual;
/// @notice Tracks deprecated lender markets
/// @dev Lender address => deprecated status
mapping(address => bool) public deprecated;
/// @notice Protocol helper contract
/// @dev Facilitates cross-contract interactions
IMiscHelper public helper;
/// @notice Base contracts registry
IBaseContracts public immutable baseContracts;
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/// @notice Emitted when lender manual changes
/// @param lender Target lender address
/// @param previous Old manual status
/// @param current New manual status
event Manual(address indexed lender, bool previous, bool current);
/// @notice Emitted when lender deprecation changes
/// @param lender Target lender address
/// @param previous Old deprecation status
/// @param current New deprecation status
event Deprecated(address indexed lender, bool previous, bool current);
/// @notice Emitted when treasury updates
/// @param previous Old treasury address
/// @param current New treasury address
event TreasuryChanged(address indexed previous, address indexed current);
/*//////////////////////////////////////////////////////////////
CUSTOM ERRORS
//////////////////////////////////////////////////////////////*/
/// @notice Zero address not allowed
error ZeroAddress();
/// @notice Invalid parameter
error InvalidParameter();
/// @notice Error thrown when attempting to modify a lender that is not in manual mode
error LenderNotInManualMode();
modifier onlyHelper() {
if (address(helper) != _msgSender()) {
revert UnauthorizedAccount(_msgSender());
}
_;
}
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
/**
* @notice Configures contract with core parameters
* @param baseContracts_ Base contracts registry address
* @param treasury_ Treasury address for fee collection
*/
constructor(IBaseContracts baseContracts_, address treasury_) {
_ensureNonzeroAddress(address(baseContracts_));
baseContracts = baseContracts_;
_ensureNonzeroAddress(treasury_);
treasury = treasury_;
dusx = baseContracts_.dusx();
_ensureNonzeroAddress(address(dusx));
helper = baseContracts_.helper();
_ensureNonzeroAddress(address(helper));
}
/*//////////////////////////////////////////////////////////////
TOKEN OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Rescues DUSX tokens to treasury
* @dev Process:
* 1. Check balance
* 2. Transfer to treasury
*
* Security:
* · Owner-only
* · Safe transfer
*/
function rescueDUSX() external onlyOwner {
SafeERC20.safeTransfer(
IERC20Safe(address(dusx)),
treasury,
dusx.balanceOf(address(this))
);
}
/*//////////////////////////////////////////////////////////////
CONFIGURATION FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Updates lender interest rate
* @param lender Target lender
* @param newInterestRate New rate value
* @dev Process:
* 1. Update rate
* 2. Accrue interest
*
* Security:
* · Owner-only
*/
function changeInterestRate(
ILender lender,
uint256 newInterestRate
) external onlyHelper {
// Check if lender's collateral is veSTTX
if (address(lender.collateral()) == address(baseContracts.veSTTX())) {
// Apply different interest rate for veSTTX collateral
lender.changeInterestRate(newInterestRate / 4);
} else {
// Apply normal interest rate for other collaterals
lender.changeInterestRate(newInterestRate);
}
lender.accrue();
}
/**
* @notice Updates lender borrow limits
* @param lender Target lender
* @param newBorrowLimit New total limit
* @param perAddressPart Per-address limit
* @dev Security:
* · Owner-only
*/
function changeBorrowLimit(
ILender lender,
uint256 newBorrowLimit,
uint256 perAddressPart
) external onlyHelper {
lender.changeBorrowLimit(newBorrowLimit, perAddressPart);
}
/**
* @notice Updates lender borrow limits manually
* @param lender Target lender
* @param newBorrowLimit New total limit
* @param perAddressPart Per-address limit
* @dev Security:
* · Owner-only
* · Requires lender to be in manual mode
*/
function changeBorrowLimitManually(
ILender lender,
uint256 newBorrowLimit,
uint256 perAddressPart
) external onlyOwner {
if (!manual[address(lender)]) {
revert LenderNotInManualMode();
}
lender.changeBorrowLimit(newBorrowLimit, perAddressPart);
}
/**
* @notice Sets lender manual status
* @param lender Target lender
* @dev Security:
* · Owner-only
*/
function setManual(ILender lender) external onlyOwner {
emit Manual(address(lender), manual[address(lender)], true);
manual[address(lender)] = true;
emit Deprecated(address(lender), deprecated[address(lender)], false);
deprecated[address(lender)] = false;
}
/**
* @notice Sets lender auto status
* @param lender Target lender
* @dev Security:
* · Owner-only
*/
function setAuto(ILender lender) external onlyOwner {
emit Manual(address(lender), manual[address(lender)], false);
manual[address(lender)] = false;
emit Deprecated(address(lender), deprecated[address(lender)], false);
deprecated[address(lender)] = false;
}
/**
* @notice Sets lender deprecation status
* @param lender Target lender
* @dev Security:
* · Owner-only
*/
function setDeprecated(ILender lender) external onlyOwner {
lender.changeBorrowLimit(0, 0);
emit Manual(address(lender), manual[address(lender)], false);
manual[address(lender)] = false;
emit Deprecated(address(lender), deprecated[address(lender)], true);
deprecated[address(lender)] = true;
}
/**
* @notice Updates treasury address
* @param treasury_ New treasury address
* @dev Security:
* · Owner-only
* · Address validation
*
* Events:
* · Emits TreasuryChanged
*/
function setTreasury(address treasury_) external onlyOwner {
_ensureNonzeroAddress(treasury_);
emit TreasuryChanged(treasury, treasury_);
treasury = treasury_;
}
/*//////////////////////////////////////////////////////////////
PRIVATE FUNCTIONS
//////////////////////////////////////////////////////////////*/
// Validates that an address is not zero
function _ensureNonzeroAddress(address addr) private pure {
if (addr == address(0)) {
revert ZeroAddress();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title Context
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, as when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
* @notice This contract is used through inheritance. It will make available the
* modifier `_msgSender()`, which can be used to reference the account that
* called a function within an implementing contract.
*/
abstract contract Context {
/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Gets the sender of the current call
* @dev Provides a way to retrieve the message sender that supports meta-transactions
* @return Sender address (msg.sender in the base implementation)
*/
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
/**
* @notice Gets the complete calldata of the current call
* @dev Provides a way to retrieve the message data that supports meta-transactions
* @return Complete calldata bytes
*/
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @notice Gets the length of any context-specific suffix in the message data
* @dev Used in meta-transaction implementations to account for additional data
* @return Length of the context suffix (0 in the base implementation)
*/
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {Context} from "./Context.sol";
/**
* @title Ownable
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
* @notice By default, the owner account will be the one that deploys the contract.
* This can later be changed with {transferOwnership} and {renounceOwnership}.
*/
abstract contract Ownable is Context {
/*//////////////////////////////////////////////////////////////
STATE VARIABLES
//////////////////////////////////////////////////////////////*/
/// @notice Address of the current owner
address private _owner;
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/// @notice Emitted when ownership is transferred
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/*//////////////////////////////////////////////////////////////
CUSTOM ERRORS
//////////////////////////////////////////////////////////////*/
/// @notice Thrown when non-owner tries to call owner-only function
error UnauthorizedAccount(address account);
/// @notice Thrown when trying to transfer ownership to invalid address
error InvalidOwner(address owner);
/*//////////////////////////////////////////////////////////////
MODIFIERS
//////////////////////////////////////////////////////////////*/
/**
* @dev Throws if called by any account other than the owner
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
/**
* @dev Initializes the contract setting the deployer as the initial owner
*/
constructor() {
_transferOwnership(_msgSender());
}
/*//////////////////////////////////////////////////////////////
PUBLIC FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Leaves the contract without owner
* @dev Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @notice Transfers ownership of the contract to a new account
* @dev The new owner cannot be the zero address
* @param newOwner The address that will become the new owner
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert InvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Returns the address of the current owner
* @return Current owner address
*/
function owner() public view virtual returns (address) {
return _owner;
}
/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`)
* Internal function without access restriction
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev Throws if the sender is not the owner
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert UnauthorizedAccount(_msgSender());
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {IDUSXProvider} from "./IDUSXProvider.sol";
import {IERC20Token} from "./IERC20Token.sol";
import {IERC20TokenRebase} from "./IERC20TokenRebase.sol";
import {IFeesDistributor} from "./IFees.sol";
import {IFeesWithdrawer} from "./IFees.sol";
import {IFloor} from "./IFloor.sol";
import {ILenderOwner} from "./ILenderOwner.sol";
import {ILiquidationHelper} from "./ILiquidationHelper.sol";
import {IMarketLens} from "./IMarketLens.sol";
import {IMiscHelper} from "./IMiscHelper.sol";
import {IOracle} from "./IOracle.sol";
import {IPSM} from "./IPSM.sol";
import {IRepayHelper} from "./IRepayHelper.sol";
import {IStableOwner} from "./IStableOwner.sol";
import {IStakedDUSX} from "./IStakedDUSX.sol";
import {ISupplyHangingCalculator} from "./ISupplyHangingCalculator.sol";
import {IVault} from "./IVault.sol";
import {IVoteEscrowedSTTX} from "./IVoteEscrowedSTTX.sol";
import {IDynamicInterestRate} from "./IDynamicInterestRate.sol";
import {IMinter} from "./IMinter.sol";
interface IBaseContracts {
struct CoreTokens {
IERC20Token dusx;
IERC20TokenRebase sttx;
IStakedDUSX stDUSX;
IVoteEscrowedSTTX veSTTX;
}
struct PSMContracts {
IPSM psmCircle;
IPSM psmTether;
IStableOwner stableOwner;
}
struct OracleContracts {
IOracle oracleChainlink;
IOracle oracleFloorPrice;
}
struct HelperContracts {
IMiscHelper helper;
ILiquidationHelper liquidationHelper;
IRepayHelper repayHelper;
IMarketLens marketLens;
}
error ZeroAddress();
error ContractAlreadySet();
// Struct getters
function coreTokens() external view returns (CoreTokens memory);
function psmContracts() external view returns (PSMContracts memory);
function oracleContracts() external view returns (OracleContracts memory);
function helperContracts() external view returns (HelperContracts memory);
// Individual contract getters
function dusxProvider() external view returns (IDUSXProvider);
function feesDistributor() external view returns (IFeesDistributor);
function feesWithdrawer() external view returns (IFeesWithdrawer);
function floor() external view returns (IFloor);
function lenderOwner() external view returns (ILenderOwner);
function minter() external view returns (IMinter);
function supplyCalculator()
external
view
returns (ISupplyHangingCalculator);
function vault() external view returns (IVault);
function dynamicInterestRate() external view returns (IDynamicInterestRate);
// Convenience getters for struct members
function dusx() external view returns (IERC20Token);
function sttx() external view returns (IERC20TokenRebase);
function stDUSX() external view returns (IStakedDUSX);
function veSTTX() external view returns (IVoteEscrowedSTTX);
function psmCircle() external view returns (IPSM);
function psmTether() external view returns (IPSM);
function stableOwner() external view returns (IStableOwner);
function oracleChainlink() external view returns (IOracle);
function oracleFloorPrice() external view returns (IOracle);
function helper() external view returns (IMiscHelper);
function liquidationHelper() external view returns (ILiquidationHelper);
function repayHelper() external view returns (IRepayHelper);
function marketLens() external view returns (IMarketLens);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title IDUSXProvider
* @dev Interface for DUSX token provision and distribution operations
* @notice Defines functionality for:
* 1. Token provision management
* 2. Supply control
* 3. Distribution tracking
*/
interface IDUSXProvider {
/*//////////////////////////////////////////////////////////////
PROVISION OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Provides DUSX tokens to the requesting address
* @param amount The quantity of DUSX tokens to provide in base units
* @dev Handles:
* · Token minting/transfer
* · Supply tracking
* · State updates
*
* Requirements:
* · Caller is authorized
* · Amount > 0
* · Within supply limits
*
* Effects:
* · Increases recipient balance
* · Updates total supply
* · Emits provision event
*/
function provide(uint256 amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title IDynamicInterestRate
* @dev Interface for dynamic interest rate calculations in the lending protocol
* @notice Defines methods for retrieving time-based interest rates that:
* 1. Adjust based on market conditions
* 2. Support per-second and base rate calculations
* 3. Maintain precision through proper scaling
*
* This interface is crucial for:
* · Accurate interest accrual
* · Dynamic market response
* · Protocol yield calculations
*/
interface IDynamicInterestRate {
/*//////////////////////////////////////////////////////////////
INTEREST RATE QUERIES
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves the current interest rate per second
* @return uint256 Interest rate per second, scaled by 1e18
* @dev Used for precise interest calculations over time periods
*/
function getInterestPerSecond() external view returns (uint256);
/**
* @notice Retrieves the current base interest rate
* @return uint256 Base interest rate, scaled by 1e18
* @dev Represents the foundational rate before adjustments
*/
function getInterestRate() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title IERC20Custom
* @dev Interface for the ERC20 fungible token standard (EIP-20)
* @notice Defines functionality for:
* 1. Token transfers
* 2. Allowance management
* 3. Balance tracking
* 4. Token metadata
*/
interface IERC20Custom {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/**
* @dev Emitted on token transfer between addresses
* @param from Source address (0x0 for mints)
* @param to Destination address (0x0 for burns)
* @param value Amount of tokens transferred
* @notice Tracks:
* · Regular transfers
* · Minting operations
* · Burning operations
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when spending allowance is granted
* @param owner Address granting permission
* @param spender Address receiving permission
* @param value Amount of tokens approved
* @notice Records:
* · New approvals
* · Updated allowances
* · Revoked permissions
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
/*//////////////////////////////////////////////////////////////
TRANSFER OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Transfers tokens to specified recipient
* @param to Recipient address
* @param value Amount to transfer in base units
* @return bool True if transfer succeeds
* @dev Requirements:
* · Caller has sufficient balance
* · Recipient is valid
* · Amount > 0
*
* Effects:
* · Decreases caller balance
* · Increases recipient balance
* · Emits Transfer event
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @notice Executes transfer on behalf of token owner
* @param from Source address
* @param to Destination address
* @param value Amount to transfer in base units
* @return bool True if transfer succeeds
* @dev Requirements:
* · Caller has sufficient allowance
* · Source has sufficient balance
* · Valid addresses
*
* Effects:
* · Decreases allowance
* · Updates balances
* · Emits Transfer event
*/
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
/*//////////////////////////////////////////////////////////////
APPROVAL OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Authorizes address to spend tokens
* @param spender Address to authorize
* @param value Amount to authorize in base units
* @return bool True if approval succeeds
* @dev Controls:
* · Spending permissions
* · Delegation limits
* · Authorization levels
*
* Security:
* · Overwrites previous allowance
* · Requires explicit value
* · Emits Approval event
*/
function approve(address spender, uint256 value) external returns (bool);
/*//////////////////////////////////////////////////////////////
TOKEN METADATA
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves human-readable token name
* @return string Full token name
*/
function name() external view returns (string memory);
/**
* @notice Retrieves token trading symbol
* @return string Short token identifier
*/
function symbol() external view returns (string memory);
/**
* @notice Retrieves token decimal precision
* @return uint8 Number of decimal places
* @dev Standard:
* · 18 for most tokens
* · Used for display formatting
*/
function decimals() external view returns (uint8);
/*//////////////////////////////////////////////////////////////
BALANCE QUERIES
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves total token supply
* @return uint256 Current total supply
* @dev Reflects:
* · All minted tokens
* · Minus burned tokens
* · In base units
*/
function totalSupply() external view returns (uint256);
/**
* @notice Retrieves account token balance
* @param account Address to query
* @return uint256 Current balance in base units
* @dev Returns:
* · Available balance
* · Includes pending rewards
* · Excludes locked tokens
*/
function balanceOf(address account) external view returns (uint256);
/**
* @notice Retrieves remaining spending allowance
* @param owner Token owner address
* @param spender Authorized spender address
* @return uint256 Current allowance in base units
* @dev Shows:
* · Approved amount
* · Remaining limit
* · Delegation status
*/
function allowance(
address owner,
address spender
) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {IERC20Custom} from "./IERC20Custom.sol";
/**
* @title IERC20Token
* @dev Extended interface for ERC20 tokens with supply control capabilities
* @notice Defines functionality for:
* 1. Token minting
* 2. Token burning
* 3. Supply management
*/
interface IERC20Token is IERC20Custom {
/*//////////////////////////////////////////////////////////////
SUPPLY MANAGEMENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Mints new tokens to specified account
* @param account Address to receive minted tokens
* @param amount Quantity of tokens to mint in base units
* @dev Controls:
* · Supply expansion
* · Balance updates
* · Event emission
*
* Requirements:
* · Caller is authorized
* · Within maxSupply
* · Valid recipient
*/
function mint(address account, uint256 amount) external;
/**
* @notice Burns tokens from specified account
* @param account Address to burn tokens from
* @param amount Quantity of tokens to burn in base units
* @dev Manages:
* · Supply reduction
* · Balance updates
* · Event emission
*
* Requirements:
* · Caller is authorized
* · Sufficient balance
* · Amount > 0
*/
function burn(address account, uint256 amount) external;
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves maximum token supply limit
* @return uint256 Maximum supply cap in base units
* @dev Enforces:
* · Supply ceiling
* · Mint restrictions
* · Protocol limits
*
* Note: This is an immutable value that
* cannot be exceeded by minting operations
*/
function maxSupply() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {IERC20Custom} from "./IERC20Custom.sol";
/**
* @title IERC20TokenRebase
* @dev Extended interface for ERC20 tokens with elastic supply and safe management
* @notice Defines functionality for:
* 1. Supply elasticity (rebasing)
* 2. Safe-based token management
* 3. Supply control mechanisms
* 4. Configuration management
*/
interface IERC20TokenRebase is IERC20Custom {
/*//////////////////////////////////////////////////////////////
SUPPLY MANAGEMENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Mints new tokens to specified account
* @param account Address to receive minted tokens
* @param amount Quantity of tokens to mint in base units
* @dev Requires:
* · Caller is authorized minter
* · Within maxSupply limits
* · Valid recipient
*/
function mint(address account, uint256 amount) external;
/**
* @notice Burns tokens from specified account
* @param account Address to burn tokens from
* @param amount Quantity of tokens to burn in base units
* @dev Requires:
* · Caller is authorized
* · Account has sufficient balance
* · Amount > 0
*/
function burn(address account, uint256 amount) external;
/*//////////////////////////////////////////////////////////////
REBASE OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Executes supply rebase based on current parameters
* @dev Triggers:
* · Supply adjustment
* · Balance recalculation
* · Event emission
*
* Considers:
* · Rebase interval
* · Basis points
* · Supply limits
*/
function rebase() external;
/**
* @notice Configures rebase parameters
* @param rebaseInterval Time period between rebases (in seconds)
* @param rebaseBasisPoints Scale factor for rebase (in basis points)
* @dev Controls:
* · Rebase frequency
* · Rebase magnitude
* · Supply elasticity
*/
function setRebaseConfig(
uint256 rebaseInterval,
uint256 rebaseBasisPoints
) external;
/*//////////////////////////////////////////////////////////////
SAFE MANAGEMENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Initializes new token management safe
* @param safe Address of safe to create
* @dev Establishes:
* · Safe permissions
* · Access controls
* · Management capabilities
*/
function createSafe(address safe) external;
/**
* @notice Removes existing token management safe
* @param safe Address of safe to remove
* @dev Handles:
* · Permission revocation
* · State cleanup
* · Access termination
*/
function destroySafe(address safe) external;
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves floor contract address
* @return address Active floor contract
* @dev Used for:
* · Price stability
* · Supply control
*/
function floor() external view returns (address);
/**
* @notice Retrieves authorized minter address
* @return address Active minter contract
* @dev Controls:
* · Mint permissions
* · Supply expansion
*/
function minter() external view returns (address);
/**
* @notice Returns absolute maximum token supply
* @return uint256 Maximum supply cap in base units
* @dev Enforces:
* · Hard supply limit
* · Mint restrictions
*/
function maxSupply() external view returns (uint256);
/**
* @notice Calculates maximum supply after rebase
* @return uint256 Post-rebase maximum supply in base units
* @dev Considers:
* · Current max supply
* · Rebase parameters
* · Supply caps
*/
function maxSupplyRebased() external view returns (uint256);
/**
* @notice Calculates total supply after rebase
* @return uint256 Post-rebase total supply in base units
* @dev Reflects:
* · Current supply
* · Rebase effects
* · Supply limits
*/
function totalSupplyRebased() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title IFeesWithdrawer
* @dev Interface for protocol fee withdrawal operations
* @notice Defines functionality for:
* 1. Secure fee withdrawal
* 2. Access control for withdrawals
* 3. Protocol revenue management
*
* This interface ensures:
* · Controlled access to protocol fees
* · Safe transfer of accumulated revenue
* · Proper accounting of withdrawn amounts
*/
interface IFeesWithdrawer {
/*//////////////////////////////////////////////////////////////
WITHDRAWAL OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Withdraws accumulated protocol fees to designated recipients
* @dev Only callable by authorized withdrawers
* Handles:
* · Fee accounting updates
* · Transfer of tokens
* · Event emission for tracking
*/
function withdraw() external;
}
/**
* @title IFeesDistributor
* @dev Interface for protocol fee distribution and allocation
* @notice Defines functionality for:
* 1. Fee distribution across protocol components
* 2. Dynamic allocation management
* 3. Floor token revenue sharing
*
* This interface manages:
* · Revenue distribution logic
* · Allocation percentages
* · Protocol incentive mechanisms
*/
interface IFeesDistributor {
/*//////////////////////////////////////////////////////////////
DISTRIBUTION OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Distributes accumulated protocol fees according to set allocations
* @dev Handles the distribution of fees to:
* · Floor token stakers
* · Protocol treasury
* · Other designated recipients
*/
function distribute() external;
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Returns current percentage allocated to Floor token stakers
* @return uint256 Floor allocation percentage, scaled by 1e18
*/
function floorAllocation() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title IFloor
* @dev Interface for protocol floor price management and capital operations
* @notice Defines functionality for:
* 1. Token deposit management
* 2. Refund processing
* 3. Capital tracking
*/
interface IFloor {
/*//////////////////////////////////////////////////////////////
DEPOSIT OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Processes token deposits into the floor contract
* @param msgSender Address initiating the deposit
* @param amount Quantity of tokens to deposit
* @dev Handles:
* · Token transfer validation
* · Capital tracking updates
* · Event emission
*/
function deposit(address msgSender, uint256 amount) external;
/*//////////////////////////////////////////////////////////////
REFUND OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Processes token refunds from the floor contract
* @param msgSender Address receiving the refund
* @param amount Quantity of tokens to refund
* @dev Ensures:
* · Sufficient contract balance
* · Authorized withdrawal
* · Capital accounting
*/
function refund(address msgSender, uint256 amount) external;
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Returns current total capital held in the floor contract
* @return uint256 Current capital amount in base units
* @dev Used for:
* · Floor price calculations
* · Protocol health metrics
* · Capital adequacy checks
*/
function capital() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {Rebase} from "../library/AuxRebase.sol";
import {IERC20Custom} from "./IERC20Custom.sol";
import {IOracle} from "./IOracle.sol";
import {IVault} from "./IVault.sol";
/**
* @title ILender
* @dev Interface for lending operations and management
* @notice Defines the core lending protocol functionality including:
* 1. Collateral management and borrowing operations
* 2. Interest rate and fee management
* 3. Liquidation handling
* 4. Vault integration
*
* The interface is designed to support:
* · Over-collateralized lending
* · Dynamic interest rates
* · Liquidation mechanisms
* · Fee collection and distribution
*/
interface ILender {
/*//////////////////////////////////////////////////////////////
ADMIN CONFIGURATION
//////////////////////////////////////////////////////////////*/
/**
* @notice Updates the interest rate for borrowing
* @param newInterestRate New interest rate (scaled by 1e18)
*/
function changeInterestRate(uint256 newInterestRate) external;
/**
* @notice Sets global and per-address borrowing limits
* @param newBorrowLimit Total borrowing limit for the protocol
* @param perAddressPart Maximum borrow amount per address
*/
function changeBorrowLimit(
uint256 newBorrowLimit,
uint256 perAddressPart
) external;
/*//////////////////////////////////////////////////////////////
CORE LENDING OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Updates protocol state with accrued interest
*/
function accrue() external;
/**
* @notice Updates the exchange rate from the oracle
*/
function updateExchangeRate() external;
/**
* @notice Withdraws accumulated protocol fees
* @param amountToProvide Amount of fees to withdraw
*/
function withdrawFees(uint256 amountToProvide) external;
/*//////////////////////////////////////////////////////////////
LIQUIDATION HANDLING
//////////////////////////////////////////////////////////////*/
/**
* @notice Liquidates undercollateralized positions
* @param liquidator Address performing the liquidation
* @param users Array of user addresses to liquidate
* @param maxBorrowParts Maximum borrow parts to liquidate per user
* @param to Address to receive liquidated collateral
*/
function liquidate(
address liquidator,
address[] memory users,
uint256[] memory maxBorrowParts,
address to
) external;
/*//////////////////////////////////////////////////////////////
VAULT OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Deposits collateral into the vault
* @param amount Amount of collateral to deposit
*/
function vaultDepositAddCollateral(uint256 amount) external;
/**
* @notice Withdraws borrowed assets from the vault
* @param msgSender Address initiating the withdrawal
* @param amount Amount to withdraw
* @return part Borrow part assigned
* @return share Share of the vault
*/
function borrowVaultWithdraw(
address msgSender,
uint256 amount
) external returns (uint256 part, uint256 share);
/*//////////////////////////////////////////////////////////////
COLLATERAL MANAGEMENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Adds collateral to a lending position
* @param to Address to credit the collateral
* @param skim True to skim tokens from the contract
* @param share Amount of shares to add as collateral
*/
function addCollateral(address to, bool skim, uint256 share) external;
/**
* @notice Removes collateral from a lending position
* @param to Address to receive the removed collateral
* @param share Amount of shares to remove
*/
function removeCollateral(address to, uint256 share) external;
/*//////////////////////////////////////////////////////////////
BORROWING OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Borrows assets against deposited collateral
* @param msgSender Address initiating the borrow
* @param amount Amount to borrow
* @return part Borrow part assigned
* @return share Share of the borrowed amount
*/
function borrow(
address msgSender,
uint256 amount
) external returns (uint256 part, uint256 share);
/**
* @notice Repays borrowed assets
* @param payer Address paying the debt
* @param to Address whose debt to repay
* @param skim True to skim tokens from the contract
* @param part Amount of borrow part to repay
* @return amount Actual amount repaid
*/
function repay(
address payer,
address to,
bool skim,
uint256 part
) external returns (uint256 amount);
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Gets the oracle contract address
* @return IOracle Oracle interface
*/
function oracle() external view returns (IOracle);
/**
* @notice Gets interest accrual information
* @return Last accrual timestamp, accumulated interest, interest per second
*/
function accrueInfo() external view returns (uint256, uint256, uint256);
/**
* @notice Gets the required collateral ratio
* @return uint256 Collateral ratio (scaled by 1e5)
*/
function collateralRatio() external view returns (uint256);
/**
* @notice Gets the liquidation bonus multiplier
* @return uint256 Liquidation multiplier (scaled by 1e5)
*/
function liquidationMultiplier() external view returns (uint256);
/**
* @notice Gets total collateral shares in the protocol
* @return uint256 Total collateral share amount
*/
function totalCollateralShare() external view returns (uint256);
/**
* @notice Gets the vault contract address
* @return IVault Vault interface
*/
function vault() external view returns (IVault);
/**
* @notice Gets the fee recipient address
* @return address Fee recipient
*/
function feeTo() external view returns (address);
/**
* @notice Gets the collateral token address
* @return IERC20Custom Collateral token interface
*/
function collateral() external view returns (IERC20Custom);
/**
* @notice Gets total borrow state
* @return Rebase Total borrow information
*/
function totalBorrow() external view returns (Rebase memory);
/**
* @notice Gets user's borrow part
* @param account User address
* @return uint256 User's borrow part
*/
function userBorrowPart(address account) external view returns (uint256);
/**
* @notice Gets user's collateral share
* @param account User address
* @return uint256 User's collateral share
*/
function userCollateralShare(
address account
) external view returns (uint256);
/**
* @notice Gets protocol borrowing limits
* @return total Total protocol borrow limit
* @return borrowPartPerAddress Per-address borrow limit
*/
function borrowLimit()
external
view
returns (uint256 total, uint256 borrowPartPerAddress);
/**
* @notice Gets the DUSX token address
* @return IERC20Custom DUSX token interface
*/
function dusx() external view returns (IERC20Custom);
/**
* @notice Gets all accounts with active positions
* @return address[] Array of account addresses
*/
function accounts() external view returns (address[] memory);
/**
* @notice Gets the collateral precision factor
* @return uint256 Collateral precision
*/
function collateralPrecision() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {ILender} from "./ILender.sol";
/**
* @title ILenderOwner
* @dev Interface for protocol-level lender management and configuration
* @notice Defines functionality for:
* 1. Interest rate management
* 2. Borrow limit control
* 3. Risk parameter adjustment
*/
interface ILenderOwner {
/*//////////////////////////////////////////////////////////////
INTEREST MANAGEMENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Updates lender's interest rate configuration
* @param lender The lender contract to modify
* @param newInterestRate New interest rate value in basis points
* @dev Controls:
* · Interest accrual
* · Yield generation
* · Protocol revenue
*
* Requirements:
* · Caller is authorized
* · Rate within bounds
* · Valid lender contract
*/
function changeInterestRate(
ILender lender,
uint256 newInterestRate
) external;
/*//////////////////////////////////////////////////////////////
LIMIT MANAGEMENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Updates lender's borrowing constraints
* @param lender The lender contract to modify
* @param newBorrowLimit New total protocol borrow limit
* @param perAddressPart Maximum borrow limit per address
* @dev Manages:
* · Protocol exposure
* · Individual limits
* · Risk thresholds
*
* Requirements:
* · Caller is authorized
* · Valid limits
* · perAddressPart <= newBorrowLimit
*
* Security:
* · Prevents overleveraging
* · Controls risk exposure
* · Ensures protocol stability
*/
function changeBorrowLimit(
ILender lender,
uint256 newBorrowLimit,
uint256 perAddressPart
) external;
/*//////////////////////////////////////////////////////////////
DEPRECATION MANAGEMENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Checks if a lender contract is deprecated
* @param lender The lender address to check
* @return bool True if the lender is deprecated, false otherwise
* @dev Used to:
* · Prevent operations on deprecated markets
* · Control market lifecycle
* · Manage protocol upgrades
*
* Security:
* · Read-only function
* · No state modifications
* · Access control not required
*/
function deprecated(address lender) external view returns (bool);
/**
* @notice Checks if a lender contract is in manual mode
* @param lender The lender address to check
* @return bool True if the lender is in manual mode, false otherwise
* @dev Used to:
* · Determine if borrow limits are managed manually
* · Control automatic interest rate adjustments
*
* Security:
* · Read-only function
* · No state modifications
* · Access control not required
*/
function manual(address lender) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {IERC20Custom} from "./IERC20Custom.sol";
import {ILender} from "../interface/ILender.sol";
import {IMiscHelper} from "../interface/IMiscHelper.sol";
/**
* @title ILiquidationHelper
* @dev Interface for liquidation assistance operations
* @notice Defines comprehensive liquidation functionality including:
* 1. Direct liquidation execution
* 2. Liquidation amount calculations
* 3. Position health checks
* 4. Preview and simulation functions
*
* The helper provides:
* · Maximum and partial liquidation support
* · Customizable recipient addresses
* · Pre-execution liquidation simulations
* · Automated DUSX amount calculations
*/
interface ILiquidationHelper {
/*//////////////////////////////////////////////////////////////
CONFIGURATION
//////////////////////////////////////////////////////////////*/
/*//////////////////////////////////////////////////////////////
LIQUIDATION EXECUTION
//////////////////////////////////////////////////////////////*/
/**
* @notice Liquidates maximum possible amount for an account
* @param lender Address of the lending contract
* @param account Address to be liquidated
* @return collateralAmount Amount of collateral received
* @return adjustedBorrowPart Adjusted borrow amount after liquidation
* @return requiredDUSXAmount DUSX tokens needed to execute liquidation
* @dev Automatically calculates maximum liquidatable amount
*/
function liquidateMax(
ILender lender,
address account
)
external
returns (
uint256 collateralAmount,
uint256 adjustedBorrowPart,
uint256 requiredDUSXAmount
);
/**
* @notice Liquidates specific amount for an account
* @param lender Address of the lending contract
* @param account Address to be liquidated
* @param borrowPart Amount of borrow position to liquidate
* @return collateralAmount Amount of collateral received
* @return adjustedBorrowPart Adjusted borrow amount after liquidation
* @return requiredDUSXAmount DUSX tokens needed to execute liquidation
* @dev Validates borrowPart against maximum liquidatable amount
*/
function liquidate(
ILender lender,
address account,
uint256 borrowPart
)
external
returns (
uint256 collateralAmount,
uint256 adjustedBorrowPart,
uint256 requiredDUSXAmount
);
/*//////////////////////////////////////////////////////////////
LIQUIDATION WITH CUSTOM RECIPIENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Liquidates maximum amount and sends to specified recipient
* @param lender Address of the lending contract
* @param account Address to be liquidated
* @param recipient Address to receive liquidated assets
* @dev Combines max liquidation with custom recipient
*/
function liquidateMaxTo(
ILender lender,
address account,
address recipient
) external;
/**
* @notice Liquidates specific amount and sends to specified recipient
* @param lender Address of the lending contract
* @param account Address to be liquidated
* @param recipient Address to receive liquidated assets
* @param borrowPart Amount of borrow position to liquidate
* @dev Combines partial liquidation with custom recipient
*/
function liquidateTo(
ILender lender,
address account,
address recipient,
uint256 borrowPart
) external;
/*//////////////////////////////////////////////////////////////
LIQUIDATION PREVIEWS
//////////////////////////////////////////////////////////////*/
/**
* @notice Previews maximum possible liquidation amounts
* @param lender Address of the lending contract
* @param account Address to check
* @return liquidatable Whether the account can be liquidated
* @return requiredDUSXAmount DUSX tokens needed for liquidation
* @return adjustedBorrowPart Final borrow amount after liquidation
* @return returnedCollateralAmount Collateral amount to be received
* @dev Simulates liquidation without executing
*/
function previewMaxLiquidation(
ILender lender,
address account
)
external
view
returns (
bool liquidatable,
uint256 requiredDUSXAmount,
uint256 adjustedBorrowPart,
uint256 returnedCollateralAmount
);
/**
* @notice Previews specific liquidation amounts
* @param lender Address of the lending contract
* @param account Address to check
* @param borrowPart Amount of borrow position to liquidate
* @return liquidatable Whether the account can be liquidated
* @return requiredDUSXAmount DUSX tokens needed for liquidation
* @return adjustedBorrowPart Final borrow amount after liquidation
* @return returnedCollateralAmount Collateral amount to be received
* @dev Simulates partial liquidation without executing
*/
function previewLiquidation(
ILender lender,
address account,
uint256 borrowPart
)
external
view
returns (
bool liquidatable,
uint256 requiredDUSXAmount,
uint256 adjustedBorrowPart,
uint256 returnedCollateralAmount
);
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Checks if an account is eligible for liquidation
* @param lender Address of the lending contract
* @param account Address to check
* @return bool True if account can be liquidated
* @dev Considers collateral ratio and position health
*/
function isLiquidatable(
ILender lender,
address account
) external view returns (bool);
/**
* @notice Returns the DUSX token contract used for liquidations
* @return IERC20Custom DUSX token interface
* @dev DUSX is required to execute liquidations
*/
function dusx() external view returns (IERC20Custom);
/**
* @notice Returns the helper utility contract
* @return IMiscHelper Helper interface for additional functions
* @dev Helper provides supporting calculations and checks
*/
function helper() external view returns (IMiscHelper);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {ILender} from "./ILender.sol";
/**
* @title IMarketLens
* @dev Interface for viewing and analyzing lending market data
* @notice Provides functionality for:
* 1. Market size analysis
* 2. Borrowing metrics
* 3. Risk assessment data
*/
interface IMarketLens {
/*//////////////////////////////////////////////////////////////
MARKET METRICS
//////////////////////////////////////////////////////////////*/
/**
* @notice Calculates total borrowed amount from a specific lending market
* @param lender Address of the lending market to analyze
* @return uint256 Total borrowed amount in base units
* @dev Aggregates:
* · Active loan positions
* · Accrued interest
* · Pending liquidations
*
* Used for:
* · Market size analysis
* · Risk assessment
* · Protocol health monitoring
*/
function getTotalBorrowed(ILender lender) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {IERC20Custom} from "./IERC20Custom.sol";
/**
* @title IMinter
* @dev Interface for the Minter contract
*/
interface IMinter {
/**
* @notice Enables whitelist minting phase
*/
function enableWhitelistMint() external;
/**
* @notice Enables public minting phase
*/
function enablePublicMint() external;
/**
* @notice Adds a wallet to the whitelist
* @param wallet Wallet address to whitelist
*/
function addToWhitelist(address wallet) external;
/**
* @notice Mints tokens during whitelist phase
* @param stablecoin Stablecoin used for minting
* @param stableAmount Amount of stablecoin to mint against
*/
function whitelistMint(
IERC20Custom stablecoin,
uint256 stableAmount
) external;
/**
* @notice Mints tokens during public phase
* @param stablecoin Stablecoin used for minting
* @param stableAmount Amount of stablecoin to mint against
*/
function publicMint(IERC20Custom stablecoin, uint256 stableAmount) external;
/**
* @notice Mints remaining token supply
* @param stablecoin Stablecoin used for minting
*/
function mintRemainingSupply(IERC20Custom stablecoin) external;
/**
* @notice Sends accumulated DUSX to floor contract
*/
function sendToFloorDUSX() external;
/**
* @notice Verifies if a wallet is whitelisted
* @param wallet Address to verify
* @return bool Whitelist status
*/
function verifyWallet(address wallet) external view returns (bool);
/**
* @notice Calculates mint amount for given stablecoin input
* @param stablecoin Stablecoin used for calculation
* @param stableAmount Amount of stablecoin
* @return uint256 Calculated mint amount
*/
function calcMintAmount(
IERC20Custom stablecoin,
uint256 stableAmount
) external view returns (uint256);
/**
* @notice Gets the current token reserve
* @return uint256 Current token reserve
*/
function tokenReserve() external view returns (uint256);
/**
* @notice Gets the current mint ratio
* @return uint256 Current mint ratio
*/
function getCurrentRatio() external view returns (uint256);
/**
* @notice Gets the current mint rate
* @return uint256 Current mint rate
*/
function getCurrentRate() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {IDynamicInterestRate} from "./IDynamicInterestRate.sol";
import {IFeesDistributor} from "./IFees.sol";
import {IFeesWithdrawer} from "./IFees.sol";
import {IFloor} from "./IFloor.sol";
import {ILender} from "./ILender.sol";
import {ILenderOwner} from "./ILenderOwner.sol";
import {ILiquidationHelper} from "./ILiquidationHelper.sol";
import {IMarketLens} from "./IMarketLens.sol";
import {IPSM} from "./IPSM.sol";
import {IRepayHelper} from "./IRepayHelper.sol";
import {IStakedDUSX} from "./IStakedDUSX.sol";
import {ISupplyHangingCalculator} from "./ISupplyHangingCalculator.sol";
/**
* @title IMiscHelper
* @dev Interface for miscellaneous helper functions across the protocol
* @notice Provides comprehensive helper methods for:
* 1. Protocol configuration and parameter management
* 2. Floor token operations
* 3. Staked DUSX token management
* 4. PSM (Peg Stability Module) operations
* 5. Lending operations including borrowing and repayment
* 6. System-wide view functions
*
* This interface acts as a central utility hub for coordinating
* various protocol components and simplifying complex operations
*/
interface IMiscHelper {
/*//////////////////////////////////////////////////////////////
CONFIGURATION FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Sets the supply hanging calculator contract
* @param supplyHangingCalculator_ New calculator contract address
* @dev Used for calculating supply adjustments
*/
function setSupplyHangingCalculator(
ISupplyHangingCalculator supplyHangingCalculator_
) external;
/**
* @notice Sets core protocol parameters and contract addresses
* @param repayHelper_ Repayment helper contract
* @param liquidationHelper_ Liquidation helper contract
* @param dynamicInterestRate_ Interest rate calculator
* @param feesDistributor_ Fee distribution contract
* @param feesWithdrawer_ Fee withdrawal contract
* @param lenderOwner_ Lender owner contract
* @param marketLens_ Market data viewer contract
* @dev Updates all main protocol component addresses
*/
function setParameters(
IRepayHelper repayHelper_,
ILiquidationHelper liquidationHelper_,
IDynamicInterestRate dynamicInterestRate_,
IFeesDistributor feesDistributor_,
IFeesWithdrawer feesWithdrawer_,
ILenderOwner lenderOwner_,
IMarketLens marketLens_
) external;
/**
* @notice Sets the list of active lender contracts
* @param lenders_ Array of lender addresses
* @dev Updates the protocol's lending markets
*/
function setLenders(ILender[] memory lenders_) external;
/**
* @notice Sets the list of PSM contracts
* @param pegStabilityModules_ Array of PSM addresses
* @dev Updates available stablecoin PSM modules
*/
function setPegStabilityModules(
IPSM[] memory pegStabilityModules_
) external;
/*//////////////////////////////////////////////////////////////
FLOOR TOKEN OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Deposits Floor tokens into the protocol
* @param amount Amount of Floor tokens to deposit
*/
function depositFloor(uint256 amount) external;
/**
* @notice Refunds Floor tokens from the protocol
* @param amount Amount of Floor tokens to refund
*/
function refundFloor(uint256 amount) external;
/*//////////////////////////////////////////////////////////////
STAKED DUSX OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Deposits DUSX tokens for staking
* @param amount Amount of DUSX to stake
*/
function depositStakedDUSX(uint256 amount) external;
/**
* @notice Withdraws staked DUSX tokens
* @param amount Amount of staked DUSX to withdraw
*/
function withdrawStakedDUSX(uint256 amount) external;
/*//////////////////////////////////////////////////////////////
PSM OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Swaps DUSX for stablecoin through PSM
* @param psm PSM contract to use for swap
* @param receiver Address to receive stablecoins
* @param amountDUSX Amount of DUSX to swap
*/
function psmSwapDUSXForStable(
IPSM psm,
address receiver,
uint256 amountDUSX
) external;
/**
* @notice Swaps stablecoin for DUSX through PSM
* @param psm PSM contract to use for swap
* @param receiver Address to receive DUSX
* @param amountStable Amount of stablecoin to swap
*/
function psmSwapStableForDUSX(
IPSM psm,
address receiver,
uint256 amountStable
) external;
/*//////////////////////////////////////////////////////////////
LENDING OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Withdraws borrowed tokens from vault
* @param lender Lender contract to withdraw from
* @param amount Amount to withdraw
*/
function lenderBorrowVaultWithdraw(ILender lender, uint256 amount) external;
/**
* @notice Executes a borrow operation
* @param lender Lender contract to borrow from
* @param amount Amount to borrow
*/
function lenderBorrow(ILender lender, uint256 amount) external;
/**
* @notice Repays borrowed tokens
* @param lender Lender contract to repay to
* @param payer Address paying the debt
* @param to Address receiving any excess
* @param skim Whether to skim tokens from contract
* @param part Amount of borrow part to repay
*/
function lenderRepay(
ILender lender,
address payer,
address to,
bool skim,
uint256 part
) external;
/**
* @notice Executes liquidation for multiple users
* @param lender Lender contract to liquidate from
* @param liquidator Address performing liquidation
* @param users Array of addresses to liquidate
* @param maxBorrowParts Maximum borrow parts to liquidate per user
* @param to Address to receive liquidated assets
*/
function lenderLiquidate(
ILender lender,
address liquidator,
address[] memory users,
uint256[] memory maxBorrowParts,
address to
) external;
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Returns current APR for staked DUSX
* @return uint256 Annual percentage rate
*/
function aprStakedDUSX() external view returns (uint256);
/**
* @notice Returns repayment helper contract
*/
function repayHelper() external view returns (IRepayHelper);
/**
* @notice Returns liquidation helper contract
*/
function liquidationHelper() external view returns (ILiquidationHelper);
/**
* @notice Returns dynamic interest rate calculator
*/
function dynamicInterestRate() external view returns (IDynamicInterestRate);
/**
* @notice Returns floor token contract
*/
function floor() external view returns (IFloor);
/**
* @notice Returns fees distributor contract
*/
function feesDistributor() external view returns (IFeesDistributor);
/**
* @notice Returns fees withdrawer contract
*/
function feesWithdrawer() external view returns (IFeesWithdrawer);
/**
* @notice Returns lender contract at specified index
* @param index Position in lenders array
*/
function lenders(uint256 index) external view returns (ILender);
/**
* @notice Returns total number of lender contracts
*/
function lendersLength() external view returns (uint256);
/**
* @notice Returns lender owner contract
*/
function lenderOwner() external view returns (ILenderOwner);
/**
* @notice Returns market lens contract
*/
function marketLens() external view returns (IMarketLens);
/**
* @notice Returns PSM contract at specified index
* @param index Position in PSM array
*/
function pegStabilityModules(uint256 index) external view returns (IPSM);
/**
* @notice Returns total number of PSM contracts
*/
function pegStabilityModulesLength() external view returns (uint256);
/**
* @notice Returns staked DUSX token contract
*/
function stDUSX() external view returns (IStakedDUSX);
/**
* @notice Returns supply hanging calculator contract
*/
function supplyHangingCalculator()
external
view
returns (ISupplyHangingCalculator);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title IOracle
* @dev Interface for basic price feed operations
* @notice Defines functionality for:
* 1. Asset price retrieval
* 2. Price precision handling
*/
interface IOracle {
/*//////////////////////////////////////////////////////////////
PRICE QUERIES
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves current asset price
* @param asset Address of the asset to price
* @return uint256 Current price in base units with precision
* @dev Provides:
* · Latest price data
* · Standardized precision
* · Asset valuation
*
* Note: Check implementation for specific precision details
*/
function getPrice(address asset) external view returns (uint256);
}
/**
* @title ITwapOracle
* @dev Interface for time-weighted average price calculations
* @notice Defines functionality for:
* 1. TWAP updates
* 2. Time-weighted calculations
* 3. Price smoothing
*/
interface ITwapOracle {
/*//////////////////////////////////////////////////////////////
TWAP OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Updates time-weighted average price
* @param asset Address of the asset to update
* @return uint256 New TWAP value in base units
* @dev Calculates:
* · Time-weighted price
* · Cumulative values
* · Price averages
*
* Features:
* · Manipulation resistance
* · Smoothing effect
* · Historical tracking
*/
function updateTwap(address asset) external returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {IERC20Custom} from "./IERC20Custom.sol";
/**
* @title IPSM
* @dev Interface for Peg Stability Module (PSM) operations
* @notice Defines functionality for:
* 1. Stablecoin/DUSX swaps
* 2. Peg maintenance
* 3. Supply tracking
*/
interface IPSM {
/*//////////////////////////////////////////////////////////////
SWAP OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Executes stablecoin to DUSX swap
* @param msgSender Address initiating the swap
* @param receiver Address receiving the DUSX
* @param stableTokenAmount Amount of stablecoins to swap
* @dev Handles:
* · Stablecoin deposit
* · DUSX minting
* · Supply tracking
*/
function swapStableForDUSX(
address msgSender,
address receiver,
uint256 stableTokenAmount
) external;
/**
* @notice Executes DUSX to stablecoin swap
* @param msgSender Address initiating the swap
* @param receiver Address receiving the stablecoins
* @param stableTokenAmount Amount of stablecoins to receive
* @dev Handles:
* · DUSX burning
* · Stablecoin release
* · Supply adjustment
*/
function swapDUSXForStable(
address msgSender,
address receiver,
uint256 stableTokenAmount
) external;
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves the stablecoin token contract
* @return IERC20Custom Stablecoin token interface
* @dev Used for:
* · Token transfers
* · Balance checks
* · Allowance verification
*/
function stableToken() external view returns (IERC20Custom);
/**
* @notice Returns total DUSX tokens minted through PSM
* @return uint256 Total minted amount in base units
* @dev Tracks:
* · Total supply impact
* · PSM utilization
* · Protocol growth metrics
*/
function dusxMinted() external view returns (uint256);
/**
* @notice Returns the maximum amount of DUSX that can be minted through PSM
* @return uint256 Maximum mintable amount in base units
* @dev Used for:
* · Supply control
* · Risk management
* · Protocol safety
*/
function dusxMintCap() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {IERC20Custom} from "./IERC20Custom.sol";
import {ILender} from "./ILender.sol";
import {IMiscHelper} from "./IMiscHelper.sol";
/**
* @title IRepayHelper
* @dev Interface for streamlined loan repayment operations and management
* @notice Defines functionality for:
* 1. Loan repayment processing
* 2. Multi-loan management
* 3. Helper contract integration
* 4. Token interactions
*/
interface IRepayHelper {
/*//////////////////////////////////////////////////////////////
CONFIGURATION
//////////////////////////////////////////////////////////////*/
/*//////////////////////////////////////////////////////////////
REPAYMENT OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Processes partial loan repayment
* @param lender Address of the lending contract
* @param to Address whose loan is being repaid
* @param amount Amount to repay in base units
* @return part Share of the loan repaid
* @dev Handles:
* · Token transfers
* · Loan accounting
* · Share calculations
*
* Requirements:
* · Amount > 0
* · Sufficient balance
* · Valid addresses
*/
function repayAmount(
ILender lender,
address to,
uint256 amount
) external returns (uint256 part);
/**
* @notice Processes complete loan repayment
* @param lender Address of the lending contract
* @param to Address whose loan is being repaid
* @return amount Total amount repaid in base units
* @dev Manages:
* · Full debt calculation
* · Complete repayment
* · Account settlement
*
* Effects:
* · Clears entire debt
* · Updates balances
* · Emits events
*/
function repayTotal(
ILender lender,
address to
) external returns (uint256 amount);
/**
* @notice Processes multiple complete loan repayments
* @param lender Address of the lending contract
* @param tos Array of addresses whose loans are being repaid
* @return amount Total amount repaid across all loans
* @dev Executes:
* · Batch processing
* · Multiple settlements
* · Aggregate accounting
*
* Optimizations:
* · Gas efficient
* · Bulk processing
* · Single transaction
*/
function repayTotalMultiple(
ILender lender,
address[] calldata tos
) external returns (uint256 amount);
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves DUSX token contract
* @return IERC20Custom Interface of the DUSX token
* @dev Used for:
* · Token operations
* · Balance checks
* · Allowance verification
*/
function dusx() external view returns (IERC20Custom);
/**
* @notice Retrieves helper contract
* @return IMiscHelper Interface of the helper contract
* @dev Provides:
* · Helper functionality
* · Integration access
* · Utility methods
*/
function helper() external view returns (IMiscHelper);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {IERC20Token} from "./IERC20Token.sol";
/**
* @title IStableOwner Interface
* @dev Interface for StableOwner contract that manages stable token supply
* @notice Defines the external interface for stable token supply management
*/
interface IStableOwner {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/// @notice Emitted when stable token contract is updated
/// @param stable New stable token contract address
event StableSet(IERC20Token indexed stable);
/// @notice Emitted when new tokens are minted
/// @param account Recipient of minted tokens
/// @param amount Amount of tokens minted
event TokensMinted(address indexed account, uint256 amount);
/// @notice Emitted when tokens are burned
/// @param account Account tokens were burned from
/// @param amount Amount of tokens burned
event TokensBurned(address indexed account, uint256 amount);
/*//////////////////////////////////////////////////////////////
FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Updates the stable token contract address
/// @param stable_ New stable token contract address
function setStable(IERC20Token stable_) external;
/// @notice Creates new stable tokens
/// @param account Address to receive minted tokens
/// @param amount Number of tokens to mint
function mint(address account, uint256 amount) external;
/// @notice Destroys existing stable tokens
/// @param account Address to burn tokens from
/// @param amount Number of tokens to burn
function burn(address account, uint256 amount) external;
/// @notice The managed stable token contract
/// @return The IERC20Token interface of the stable token
function stable() external view returns (IERC20Token);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title IStakedDUSX
* @dev Interface for staked DUSX token operations and reward distribution
* @notice Defines functionality for:
* 1. DUSX token staking
* 2. Reward distribution
* 3. Position management
*/
interface IStakedDUSX {
/*//////////////////////////////////////////////////////////////
REWARD DISTRIBUTION
//////////////////////////////////////////////////////////////*/
/**
* @notice Distributes protocol fees as staking rewards
* @param amount Amount of fees to distribute in base units
* @dev Handles:
* · Pro-rata distribution
* · Reward accounting
* · Distribution events
*
* Rewards are:
* · Automatically calculated
* · Immediately available
* · Proportional to stake
*/
function distributeFees(uint256 amount) external;
/**
* @notice Claims pending fee rewards for the caller
* @return claimedAmount Amount of fees claimed
* @dev Allows users to manually claim their accumulated fees
*/
function claimFees() external returns (uint256 claimedAmount);
/*//////////////////////////////////////////////////////////////
STAKING OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Processes DUSX token deposits for staking
* @param from Address providing the tokens
* @param to Address receiving the staked position
* @param amount Quantity of tokens to stake in base units
* @dev Manages:
* · Token transfers
* · Position creation
* · Reward calculations
*
* Supports:
* · Direct deposits
* · Delegated deposits
* · Position tracking
*/
function deposit(address from, address to, uint256 amount) external;
/**
* @notice Initiates a withdrawal from staked DUSX
* @param amount Amount of tokens to withdraw
*/
function beginWithdrawal(uint256 amount) external;
/**
* @notice Processes withdrawal of staked DUSX tokens
* @param account Address withdrawing tokens
* @dev Handles:
* · Position updates
* · Reward claims
* · Token transfers
*
* Ensures:
* · Sufficient balance
* · Reward distribution
* · Clean exit
*/
function withdraw(address account) external;
/**
* @notice Views pending unclaimed fees for an account
* @param account Address to check for pending fees
* @return pendingAmount Amount of pending fees available to claim
* @dev Calculates based on the fee accumulator and account's last claimed value
*/
function pendingFees(
address account
) external view returns (uint256 pendingAmount);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title ISupplyHangingCalculator
* @dev Interface for calculating and managing token supply adjustments
* @notice Defines functionality for:
* 1. Supply hanging calculations
* 2. Safety margin management
* 3. Risk-adjusted metrics
*/
interface ISupplyHangingCalculator {
/*//////////////////////////////////////////////////////////////
SAFETY PARAMETERS
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves current safety margin for supply calculations
* @return uint256 Safety margin percentage scaled by 1e18
* @dev Used for:
* · Risk adjustment
* · Supply buffer
* · Protocol protection
*/
function safetyMargin() external view returns (uint256);
/*//////////////////////////////////////////////////////////////
SUPPLY HANGING CALCULATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Calculates current supply hanging with safety margins
* @return uint256 Risk-adjusted supply hanging in base units
* @dev Includes:
* · Safety margin application
* · Risk adjustments
* · Protocol constraints
*
* Used for:
* · Safe supply management
* · Conservative adjustments
* · Risk-aware operations
*/
function getSupplyHanging() external view returns (uint256);
/**
* @notice Calculates raw supply hanging without safety margins
* @return uint256 Unadjusted supply hanging in base units
* @dev Provides:
* · Raw calculations
* · No safety buffers
* · Maximum theoretical values
*
* Used for:
* · Analysis purposes
* · Maximum bounds
* · Stress testing
*/
function getSupplyHangingUnsafe() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
import {Rebase} from "../library/AuxRebase.sol";
import {IERC20Custom} from "./IERC20Custom.sol";
/**
* @title IVault
* @dev Interface for advanced vault operations with elastic share system
* @notice Defines functionality for:
* 1. Token custody and management
* 2. Share-based accounting
* 3. Elastic supply mechanics
* 4. Amount/share conversions
*/
interface IVault {
/*//////////////////////////////////////////////////////////////
DEPOSIT OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Processes token deposits into vault
* @param token Token contract to deposit
* @param from Source of tokens
* @param to Recipient of shares
* @param amount Token amount (in base units, 0 for share-based)
* @param share Share amount (0 for amount-based)
* @return amountIn Actual tokens deposited
* @return shareIn Actual shares minted
* @dev Handles:
* · Token transfers
* · Share minting
* · Balance updates
*
* Requirements:
* · Valid token contract
* · Authorized caller
* · Sufficient balance
* · Either amount or share > 0
*
* Note: Only one of amount/share should be non-zero
*/
function deposit(
IERC20Custom token,
address from,
address to,
uint256 amount,
uint256 share
) external returns (uint256 amountIn, uint256 shareIn);
/*//////////////////////////////////////////////////////////////
WITHDRAWAL OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Processes token withdrawals from vault
* @param token Token contract to withdraw
* @param from Source of shares
* @param to Recipient of tokens
* @param amount Token amount (in base units, 0 for share-based)
* @param share Share amount (0 for amount-based)
* @return amountOut Actual tokens withdrawn
* @return shareOut Actual shares burned
* @dev Manages:
* · Share burning
* · Token transfers
* · Balance updates
*
* Requirements:
* · Valid token contract
* · Sufficient shares
* · Either amount or share > 0
* · Authorized withdrawal
*
* Security:
* · Validates balances
* · Checks permissions
* · Updates state atomically
*/
function withdraw(
IERC20Custom token,
address from,
address to,
uint256 amount,
uint256 share
) external returns (uint256 amountOut, uint256 shareOut);
/*//////////////////////////////////////////////////////////////
SHARE TRANSFERS
//////////////////////////////////////////////////////////////*/
/**
* @notice Transfers vault shares between accounts
* @param token Associated token contract
* @param from Source of shares
* @param to Recipient of shares
* @param share Amount of shares to transfer
* @dev Executes:
* · Direct share movement
* · Balance updates
* · Event emission
*
* Requirements:
* · Sufficient share balance
* · Valid addresses
* · Share amount > 0
*
* Note: Bypasses amount calculations for efficiency
*/
function transfer(
IERC20Custom token,
address from,
address to,
uint256 share
) external;
/*//////////////////////////////////////////////////////////////
BALANCE QUERIES
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves account's vault share balance
* @param token Token contract to query
* @param account Address to check
* @return uint256 Share balance
* @dev Provides:
* · Raw share balance
* · Without conversion
* · Current state
*
* Use toAmount() to convert to token amount
*/
function balanceOf(
IERC20Custom token,
address account
) external view returns (uint256);
/*//////////////////////////////////////////////////////////////
CONVERSION OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Converts token amount to vault shares
* @param token Token contract for conversion
* @param amount Amount of tokens to convert
* @param roundUp Whether to round up result
* @return share Equivalent share amount
* @dev Calculates:
* · Share equivalent
* · Based on totals
* · Handles precision
*
* Rounding:
* true = ceiling (≥)
* false = floor (≤)
*/
function toShare(
IERC20Custom token,
uint256 amount,
bool roundUp
) external view returns (uint256 share);
/**
* @notice Converts vault shares to token amount
* @param token Token contract for conversion
* @param share Amount of shares to convert
* @param roundUp Whether to round up result
* @return amount Equivalent token amount
* @dev Calculates:
* · Token equivalent
* · Based on totals
* · Handles precision
*
* Rounding:
* true = ceiling (≥)
* false = floor (≤)
*/
function toAmount(
IERC20Custom token,
uint256 share,
bool roundUp
) external view returns (uint256 amount);
/**
* @notice Gets the list of active controllers
* @return Array of controller addresses
*/
function getControllers() external view returns (address[] memory);
/*//////////////////////////////////////////////////////////////
VAULT TOTALS
//////////////////////////////////////////////////////////////*/
/**
* @notice Retrieves vault's total supply tracking
* @param token Token contract to query
* @return vaultTotals Rebase struct containing:
* · elastic: Total token amount
* · base: Total shares
* @dev Provides:
* · Current vault state
* · Supply tracking
* · Conversion basis
*
* Used for:
* · Share calculations
* · Amount conversions
* · State validation
*/
function totals(
IERC20Custom token
) external view returns (Rebase memory vaultTotals);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title IVoteEscrowedSTTX
* @dev Interface for vote-escrowed STTX (veSTTX) token operations
* @notice Defines functionality for:
* 1. Token withdrawal management
* 2. Escrow position handling
* 3. Voting power release
*/
interface IVoteEscrowedSTTX {
/*//////////////////////////////////////////////////////////////
WITHDRAWAL OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Processes withdrawal of escrowed STTX tokens
* @dev Handles:
* · Lock period verification
* · Position liquidation
* · Token transfers
*
* Requirements:
* · Lock period expired
* · Active position exists
* · Caller is position owner
*
* Effects:
* · Releases locked tokens
* · Removes voting power
* · Clears escrow position
*/
function withdraw() external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24 <0.9.0;
/**
* @title Rebase Library
* @dev Library for handling elastic supply token calculations and adjustments
* @notice This library provides mathematical operations for elastic/base token conversions
* and supply adjustments. It handles two key concepts:
*
* 1. Elastic Supply: The actual total supply that can expand or contract
* 2. Base Supply: The underlying base amount that remains constant
*/
/*//////////////////////////////////////////////////////////////
TYPES
//////////////////////////////////////////////////////////////*/
/**
* @dev Core data structure for elastic supply tracking
* @param elastic Current elastic (rebased) supply
* @param base Current base (non-rebased) supply
*/
struct Rebase {
uint256 elastic;
uint256 base;
}
/**
* @title AuxRebase
* @dev Auxiliary functions for elastic supply calculations
* @notice Provides safe mathematical operations for elastic/base conversions
* with optional rounding control
*/
library AuxRebase {
/*//////////////////////////////////////////////////////////////
ELASTIC SUPPLY OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Increases the elastic supply
* @param total Current total supply state
* @param elastic Amount to add to elastic supply
* @return newElastic Updated elastic supply after addition
*/
function addElastic(
Rebase storage total,
uint256 elastic
) internal returns (uint256 newElastic) {
newElastic = total.elastic += elastic;
}
/**
* @notice Decreases the elastic supply
* @param total Current total supply state
* @param elastic Amount to subtract from elastic supply
* @return newElastic Updated elastic supply after subtraction
*/
function subElastic(
Rebase storage total,
uint256 elastic
) internal returns (uint256 newElastic) {
newElastic = total.elastic -= elastic;
}
/*//////////////////////////////////////////////////////////////
CONVERSION OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Converts an elastic amount to its base amount
* @param total Current total supply state
* @param elastic Amount of elastic tokens to convert
* @param roundUp If true, rounds up the result
* @return base Equivalent amount in base units
* @dev
* · If elastic supply is 0, returns elastic amount as base
* · Handles potential precision loss during conversion
* · Rounding can cause slight variations in converted amounts
* · Recommended for scenarios requiring precise supply tracking
*
* Rounding Behavior:
* · roundUp = false: Always rounds down (truncates)
* · roundUp = true: Rounds up if there's a fractional remainder
*
* Edge Cases:
* · total.elastic == 0: Returns input elastic as base
* · Potential for minimal precision differences
*/
function toBase(
Rebase memory total,
uint256 elastic,
bool roundUp
) internal pure returns (uint256 base) {
if (total.elastic == 0) {
base = elastic;
} else {
base = (elastic * total.base) / total.elastic;
if (roundUp && (base * total.elastic) / total.base < elastic) {
base++;
}
}
}
/**
* @notice Converts a base amount to its elastic amount
* @param total Current total supply state
* @param base Amount of base tokens to convert
* @param roundUp If true, rounds up the result
* @return elastic Equivalent amount in elastic units
* @dev
* · If base supply is 0, returns base amount as elastic
* · Handles potential precision loss during conversion
* · Rounding can cause slight variations in converted amounts
* · Recommended for scenarios requiring precise supply tracking
*
* Rounding Behavior:
* · roundUp = false: Always rounds down (truncates)
* · roundUp = true: Rounds up if there's a fractional remainder
*
* Edge Cases:
* · total.base == 0: Returns input base as elastic
* · Potential for minimal precision differences
*/
function toElastic(
Rebase memory total,
uint256 base,
bool roundUp
) internal pure returns (uint256 elastic) {
if (total.base == 0) {
elastic = base;
} else {
elastic = (base * total.elastic) / total.base;
if (roundUp && (elastic * total.base) / total.elastic < base) {
elastic++;
}
}
}
/*//////////////////////////////////////////////////////////////
COMBINED OPERATIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Adds elastic tokens and calculates corresponding base amount
* @param total Current total supply state
* @param elastic Amount of elastic tokens to add
* @param roundUp If true, rounds up base conversion
* @return (Rebase, uint256) Updated total supply and calculated base amount
*/
function add(
Rebase memory total,
uint256 elastic,
bool roundUp
) internal pure returns (Rebase memory, uint256 base) {
base = toBase(total, elastic, roundUp);
total.elastic += elastic;
total.base += base;
return (total, base);
}
/**
* @notice Subtracts base tokens and calculates corresponding elastic amount
* @param total Current total supply state
* @param base Amount of base tokens to subtract
* @param roundUp If true, rounds up elastic conversion
* @return (Rebase, uint256) Updated total supply and calculated elastic amount
*/
function sub(
Rebase memory total,
uint256 base,
bool roundUp
) internal pure returns (Rebase memory, uint256 elastic) {
elastic = toElastic(total, base, roundUp);
total.elastic -= elastic;
total.base -= base;
return (total, elastic);
}
/**
* @notice Adds specific amounts to both elastic and base supplies
* @param total Current total supply state
* @param elastic Amount of elastic tokens to add
* @param base Amount of base tokens to add
* @return Rebase Updated total supply after addition
*/
function add(
Rebase memory total,
uint256 elastic,
uint256 base
) internal pure returns (Rebase memory) {
total.elastic += elastic;
total.base += base;
return total;
}
/**
* @notice Subtracts specific amounts from both elastic and base supplies
* @param total Current total supply state
* @param elastic Amount of elastic tokens to subtract
* @param base Amount of base tokens to subtract
* @return Rebase Updated total supply after subtraction
*/
function sub(
Rebase memory total,
uint256 elastic,
uint256 base
) internal pure returns (Rebase memory) {
total.elastic -= elastic;
total.base -= base;
return total;
}
}{
"viaIR": true,
"evmVersion": "paris",
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IBaseContracts","name":"baseContracts_","type":"address"},{"internalType":"address","name":"treasury_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"InvalidOwner","type":"error"},{"inputs":[],"name":"InvalidParameter","type":"error"},{"inputs":[],"name":"LenderNotInManualMode","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"UnauthorizedAccount","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"bool","name":"previous","type":"bool"},{"indexed":false,"internalType":"bool","name":"current","type":"bool"}],"name":"Deprecated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"bool","name":"previous","type":"bool"},{"indexed":false,"internalType":"bool","name":"current","type":"bool"}],"name":"Manual","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":"previous","type":"address"},{"indexed":true,"internalType":"address","name":"current","type":"address"}],"name":"TreasuryChanged","type":"event"},{"inputs":[],"name":"baseContracts","outputs":[{"internalType":"contract IBaseContracts","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ILender","name":"lender","type":"address"},{"internalType":"uint256","name":"newBorrowLimit","type":"uint256"},{"internalType":"uint256","name":"perAddressPart","type":"uint256"}],"name":"changeBorrowLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ILender","name":"lender","type":"address"},{"internalType":"uint256","name":"newBorrowLimit","type":"uint256"},{"internalType":"uint256","name":"perAddressPart","type":"uint256"}],"name":"changeBorrowLimitManually","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ILender","name":"lender","type":"address"},{"internalType":"uint256","name":"newInterestRate","type":"uint256"}],"name":"changeInterestRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"deprecated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dusx","outputs":[{"internalType":"contract IERC20Token","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"helper","outputs":[{"internalType":"contract IMiscHelper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"manual","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"rescueDUSX","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ILender","name":"lender","type":"address"}],"name":"setAuto","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ILender","name":"lender","type":"address"}],"name":"setDeprecated","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ILender","name":"lender","type":"address"}],"name":"setManual","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"treasury_","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60c0604052346200005f576200001f6200001862000186565b90620003c3565b6200002962000065565b611ac5620006c4823960805181818161067301528181610dc00152610dfa015260a05181818161032d015261154b0152611ac590f35b6200006b565b60405190565b600080fd5b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b906200009c9062000070565b810190811060018060401b03821117620000b557604052565b6200007a565b90620000d2620000ca62000065565b928362000090565b565b600080fd5b60018060a01b031690565b620000ef90620000d9565b90565b620000fd90620000e4565b90565b6200010b81620000f2565b036200011357565b600080fd5b90505190620001278262000100565b565b6200013481620000e4565b036200013c57565b600080fd5b90505190620001508262000129565b565b9190604083820312620001805780620001736200017d926000860162000118565b9360200162000141565b90565b620000d4565b620001a962002189803803806200019d81620000bb565b92833981019062000152565b9091565b90565b620001c9620001c3620001cf92620000d9565b620001ad565b620000d9565b90565b620001dd90620001b0565b90565b620001eb90620001d2565b90565b60001b90565b906200020760018060a01b0391620001ee565b9181191691161790565b6200021c90620001d2565b90565b90565b906200023c62000236620002449262000211565b6200021f565b8254620001f4565b9055565b60e01b90565b6200025990620000e4565b90565b62000267816200024e565b036200026f57565b600080fd5b9050519062000283826200025c565b565b90602082820312620002a2576200029f9160000162000274565b90565b620000d4565b60000190565b620002b862000065565b3d6000823e3d90fd5b620002cd90516200024e565b90565b620002db90620001d2565b90565b620002e990620000e4565b90565b620002f781620002de565b03620002ff57565b600080fd5b905051906200031382620002ec565b565b9060208282031262000332576200032f9160000162000304565b90565b620000d4565b6200034390620001b0565b90565b620003519062000338565b90565b90565b90620003716200036b620003799262000346565b62000354565b8254620001f4565b9055565b60001c90565b60018060a01b031690565b6200039d620003a3916200037d565b62000383565b90565b620003b290546200038e565b90565b620003c090620001d2565b90565b90620003ff90620003d36200056b565b620003e8620003e284620001e0565b620005c0565b8260a052620003f781620005c0565b600162000222565b6200042960206200041083620001e0565b6396df10c0906200042062000065565b93849262000248565b825281806200043b60048201620002a8565b03915afa9081156200056557620004a092602092620004879260009162000531575b50608052620004816200047b620004756080620002c1565b620002d0565b620005c0565b620001e0565b6363b0e66a906200049762000065565b93849262000248565b82528180620004b260048201620002a8565b03915afa80156200052b57620004d491600091620004f6575b50600462000357565b620004f4620004ee620004e86004620003a6565b620003b5565b620005c0565b565b6200051c915060203d811162000523575b62000513818362000090565b81019062000315565b38620004cb565b503d62000507565b620002ae565b620005569150843d81116200055d575b6200054d818362000090565b81019062000285565b386200045d565b503d62000541565b620002ae565b6200057562000577565b565b6200058b6200058562000615565b62000656565b565b90565b620005a9620005a3620005af926200058d565b620001ad565b620000d9565b90565b620005bd9062000590565b90565b620005e1620005da620005d46000620005b2565b620000e4565b91620000e4565b14620005e957565b620005f362000065565b63d92e233d60e01b8152806200060c60048201620002a8565b0390fd5b600090565b6200061f62000610565b503390565b60018060a01b031690565b6200063e62000644916200037d565b62000624565b90565b6200065390546200062f565b90565b62000662600062000647565b6200066f82600062000222565b90620006a7620006a07f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09362000211565b9162000211565b91620006b262000065565b80620006be81620002a8565b0390a356fe60806040526004361015610013575b61085b565b61001e60003561012d565b80630a7af47c146101285780630d5866e21461012357806325d3d7cf1461011e578063266f803a1461011957806361d027b31461011457806363b0e66a1461010f5780636a65092e1461010a578063715018a61461010557806387efa114146101005780638da5cb5b146100fb57806396df10c0146100f6578063b5ac72cd146100f1578063ce3e70a7146100ec578063df9a9374146100e7578063f0f44260146100e2578063f2fde38b146100dd5763f83926090361000e57610827565b6107c6565b610793565b61075f565b61072c565b6106f9565b6106c4565b61063c565b610609565b6105d6565b6105a2565b61050b565b610466565b6103cd565b61037e565b6102e8565b61025e565b60e01c90565b60405190565b600080fd5b600080fd5b60018060a01b031690565b61015790610143565b90565b6101638161014e565b0361016a57565b600080fd5b9050359061017c8261015a565b565b90602082820312610198576101959160000161016f565b90565b61013e565b90565b6101b46101af6101b992610143565b61019d565b610143565b90565b6101c5906101a0565b90565b6101d1906101bc565b90565b906101de906101c8565b600052602052604060002090565b1c90565b60ff1690565b61020690600861020b93026101ec565b6101f0565b90565b9061021991546101f6565b90565b6102339061022e6002916000926101d4565b61020e565b90565b151590565b61024490610236565b9052565b919061025c9060006020850194019061023b565b565b3461028e5761028a61027961027436600461017e565b61021c565b610281610133565b91829182610248565b0390f35b610139565b61029c9061014e565b90565b6102a881610293565b036102af57565b600080fd5b905035906102c18261029f565b565b906020828203126102dd576102da916000016102b4565b90565b61013e565b60000190565b34610316576103006102fb3660046102c3565b610b79565b610308610133565b80610312816102e2565b0390f35b610139565b600091031261032657565b61013e565b7f000000000000000000000000000000000000000000000000000000000000000090565b610358906101bc565b90565b6103649061034f565b9052565b919061037c9060006020850194019061035b565b565b346103ae5761038e36600461031b565b6103aa61039961032b565b6103a1610133565b91829182610368565b0390f35b610139565b6103ca906103c56003916000926101d4565b61020e565b90565b346103fd576103f96103e86103e336600461017e565b6103b3565b6103f0610133565b91829182610248565b0390f35b610139565b60018060a01b031690565b61041d90600861042293026101ec565b610402565b90565b90610430915461040d565b90565b6104406001600090610425565b90565b61044c9061014e565b9052565b919061046490600060208501940190610443565b565b346104965761047636600461031b565b610492610481610433565b610489610133565b91829182610450565b0390f35b610139565b60018060a01b031690565b6104b69060086104bb93026101ec565b61049b565b90565b906104c991546104a6565b90565b6104d960046000906104be565b90565b6104e5906101bc565b90565b6104f1906104dc565b9052565b9190610509906000602085019401906104e8565b565b3461053b5761051b36600461031b565b6105376105266104cc565b61052e610133565b918291826104f5565b0390f35b610139565b90565b61054c81610540565b0361055357565b600080fd5b9050359061056582610543565b565b909160608284031261059d5761059a61058384600085016102b4565b936105918160208601610558565b93604001610558565b90565b61013e565b346105d1576105bb6105b5366004610567565b91610ccb565b6105c3610133565b806105cd816102e2565b0390f35b610139565b34610604576105e636600461031b565b6105ee610d26565b6105f6610133565b80610600816102e2565b0390f35b610139565b346106375761061936600461031b565b610621610ea4565b610629610133565b80610633816102e2565b0390f35b610139565b3461066c5761064c36600461031b565b610668610657610eb3565b61065f610133565b91829182610450565b0390f35b610139565b7f000000000000000000000000000000000000000000000000000000000000000090565b61069e906101bc565b90565b6106aa90610695565b9052565b91906106c2906000602085019401906106a1565b565b346106f4576106d436600461031b565b6106f06106df610671565b6106e7610133565b918291826106ae565b0390f35b610139565b346107275761071161070c3660046102c3565b610ff0565b610719610133565b80610723816102e2565b0390f35b610139565b3461075a5761074461073f3660046102c3565b611122565b61074c610133565b80610756816102e2565b0390f35b610139565b3461078e57610778610772366004610567565b91611219565b610780610133565b8061078a816102e2565b0390f35b610139565b346107c1576107ab6107a636600461017e565b6112e1565b6107b3610133565b806107bd816102e2565b0390f35b610139565b346107f4576107de6107d936600461017e565b61135a565b6107e6610133565b806107f0816102e2565b0390f35b610139565b9190604083820312610822578061081661081f92600086016102b4565b93602001610558565b90565b61013e565b346108565761084061083a3660046107f9565b906117e7565b610848610133565b80610852816102e2565b0390f35b610139565b600080fd5b6108719061086c6117f3565b6109da565b565b61087c906101bc565b90565b600080fd5b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b906108ae90610884565b810190811067ffffffffffffffff8211176108c857604052565b61088e565b60e01b90565b60009103126108de57565b61013e565b90565b6108fa6108f56108ff926108e3565b61019d565b610540565b90565b61090b906108e6565b9052565b91602061093192949361092a60408201966000830190610902565b0190610902565b565b61093b610133565b3d6000823e3d90fd5b60001c90565b61095661095b91610944565b6101f0565b90565b610968905461094a565b90565b91602061098d9294936109866040820196600083019061023b565b019061023b565b565b60001b90565b906109a160ff9161098f565b9181191691161790565b6109b490610236565b90565b90565b906109cf6109ca6109d6926109ab565b6109b7565b8254610995565b9055565b6109e381610873565b90634c343f0060008093803b15610b7457610a1260008094610a1d610a06610133565b988996879586946108cd565b84526004840161090f565b03925af1918215610b6f57610b4092610b42575b50610a3b81610873565b610a57610a526002610a4c85610873565b906101d4565b61095e565b906000610a847f6dd0921f466666de6bbf3064c7858ae58244531503f62a63d12a7a6f47e1f0e6926101c8565b92610a99610a90610133565b9283928361096b565b0390a2610aba6000610ab56002610aaf85610873565b906101d4565b6109ba565b610ac381610873565b610adf610ada6003610ad485610873565b906101d4565b61095e565b906001610b0c7ff5d8e3317fae883866485f066bf52e2e972ef14804ac942426beecf9538ef8c3926101c8565b92610b21610b18610133565b9283928361096b565b0390a2610b3b600191610b35600391610873565b906101d4565b6109ba565b565b610b629060003d8111610b68575b610b5a81836108a4565b8101906108d3565b38610a31565b503d610b50565b610933565b61087f565b610b8290610860565b565b610b90610b9591610944565b61049b565b90565b610ba29054610b84565b90565b9190610bb9610bb46004610b98565b6104dc565b610bd2610bcc610bc7611848565b61014e565b9161014e565b03610be257610be092610c40565b565b610c0b610bed611848565b610bf5610133565b9182916332b2baa360e01b835260048301610450565b0390fd5b610c1890610540565b9052565b916020610c3e929493610c3760408201966000830190610c0f565b0190610c0f565b565b610c4990610873565b91634c343f00919092803b15610cc657610c7760008094610c82610c6b610133565b978896879586946108cd565b845260048401610c1c565b03925af18015610cc157610c94575b50565b610cb49060003d8111610cba575b610cac81836108a4565b8101906108d3565b38610c91565b503d610ca2565b610933565b61087f565b90610cd69291610ba5565b565b610ce06117f3565b610ce8610d12565b565b610cfe610cf9610d03926108e3565b61019d565b610143565b90565b610d0f90610cea565b90565b610d24610d1f6000610d06565b611855565b565b610d2e610cd8565b565b610d386117f3565b610d40610db5565b565b610d4b906101a0565b90565b610d5790610d42565b90565b610d66610d6b91610944565b610402565b90565b610d789054610d5a565b90565b610d84906101bc565b90565b90505190610d9482610543565b565b90602082820312610db057610dad91600001610d87565b90565b61013e565b610e50610de9610de47f0000000000000000000000000000000000000000000000000000000000000000610695565b610d4e565b610df36001610d6e565b6020610e1e7f0000000000000000000000000000000000000000000000000000000000000000610695565b6370a0823190610e45610e3030610d7b565b92610e39610133565b978894859384936108cd565b835260048301610450565b03915afa918215610e9f57610e6d93600093610e6f575b50611917565b565b610e9191935060203d8111610e98575b610e8981836108a4565b810190610d96565b9138610e67565b503d610e7f565b610933565b610eac610d30565b565b600090565b610ebb610eae565b50610ec66000610d6e565b90565b610eda90610ed56117f3565b610edc565b565b610fee90610ee981610873565b610f05610f006002610efa85610873565b906101d4565b61095e565b906001610f327f6dd0921f466666de6bbf3064c7858ae58244531503f62a63d12a7a6f47e1f0e6926101c8565b92610f47610f3e610133565b9283928361096b565b0390a2610f686001610f636002610f5d85610873565b906101d4565b6109ba565b610f7181610873565b610f8d610f886003610f8285610873565b906101d4565b61095e565b906000610fba7ff5d8e3317fae883866485f066bf52e2e972ef14804ac942426beecf9538ef8c3926101c8565b92610fcf610fc6610133565b9283928361096b565b0390a2610fe9600091610fe3600391610873565b906101d4565b6109ba565b565b610ff990610ec9565b565b61100c906110076117f3565b61100e565b565b6111209061101b81610873565b611037611032600261102c85610873565b906101d4565b61095e565b9060006110647f6dd0921f466666de6bbf3064c7858ae58244531503f62a63d12a7a6f47e1f0e6926101c8565b92611079611070610133565b9283928361096b565b0390a261109a6000611095600261108f85610873565b906101d4565b6109ba565b6110a381610873565b6110bf6110ba60036110b485610873565b906101d4565b61095e565b9060006110ec7ff5d8e3317fae883866485f066bf52e2e972ef14804ac942426beecf9538ef8c3926101c8565b926111016110f8610133565b9283928361096b565b0390a261111b600091611115600391610873565b906101d4565b6109ba565b565b61112b90610ffb565b565b90611140929161113b6117f3565b611142565b565b61116761116161115c600261115685610873565b906101d4565b61095e565b15610236565b6111f65761117490610873565b91634c343f00919092803b156111f1576111a2600080946111ad611196610133565b978896879586946108cd565b845260048401610c1c565b03925af180156111ec576111bf575b50565b6111df9060003d81116111e5575b6111d781836108a4565b8101906108d3565b386111bc565b503d6111cd565b610933565b61087f565b6111fe610133565b633e6cd7d960e21b815280611215600482016102e2565b0390fd5b90611224929161112d565b565b611237906112326117f3565b611277565b565b9061124a60018060a01b039161098f565b9181191691161790565b90565b9061126c611267611273926101c8565b611254565b8254611239565b9055565b6112df9061128481611965565b61128e6001610d6e565b816112c26112bc7f8c3aa5f43a388513435861bf27dfad7829cd248696fed367c62d441f62954496936101c8565b916101c8565b916112cb610133565b806112d5816102e2565b0390a36001611257565b565b6112ea90611226565b565b6112fd906112f86117f3565b6112ff565b565b8061131b6113156113106000610d06565b61014e565b9161014e565b1461132b5761132990611855565b565b6113566113386000610d06565b611340610133565b91829163b20f76e360e01b835260048301610450565b0390fd5b611363906112ec565b565b906113786113736004610b98565b6104dc565b61139161138b611386611848565b61014e565b9161014e565b036113a15761139f916114f1565b565b6113ca6113ac611848565b6113b4610133565b9182916332b2baa360e01b835260048301610450565b0390fd5b6113d79061014e565b90565b6113e3816113ce565b036113ea57565b600080fd5b905051906113fc826113da565b565b9060208282031261141857611415916000016113ef565b90565b61013e565b611426906101bc565b90565b6114329061014e565b90565b61143e81611429565b0361144557565b600080fd5b9050519061145782611435565b565b90602082820312611473576114709160000161144a565b90565b61013e565b611481906101bc565b90565b919061149890600060208501940190610c0f565b565b90565b6114b16114ac6114b69261149a565b61019d565b610540565b90565b634e487b7160e01b600052601260045260246000fd5b6114db6114e191610540565b91610540565b9081156114ec570490565b6114b9565b61151560206114ff83610873565b63d8dfeb459061150d610133565b9384926108cd565b82528180611525600482016102e2565b03915afa80156117e257611541916000916117b4575b5061141d565b611585602061156f7f000000000000000000000000000000000000000000000000000000000000000061034f565b635c2c7cc69061157d610133565b9384926108cd565b82528180611595600482016102e2565b03915afa80156117af576115b86115bd916115c393600091611781575b50611478565b61014e565b9161014e565b146000146116ef576115d481610873565b916115ee63f5d93f52916115e8600461149d565b906114cf565b833b156116ea5761161f9361161460008094611608610133565b978895869485936108cd565b835260048301611484565b03925af19182156116e55761163a926116b8575b505b610873565b63f8ba4cff90803b156116b35761165e91600091611656610133565b9384926108cd565b825281838161166f600482016102e2565b03925af180156116ae57611681575b50565b6116a19060003d81116116a7575b61169981836108a4565b8101906108d3565b3861167e565b503d61168f565b610933565b61087f565b6116d89060003d81116116de575b6116d081836108a4565b8101906108d3565b38611633565b503d6116c6565b610933565b61087f565b6116f881610873565b9163f5d93f5290833b1561177c576117309361172560008094611719610133565b978895869485936108cd565b835260048301611484565b03925af19182156117775761163a9261174a575b50611635565b61176a9060003d8111611770575b61176281836108a4565b8101906108d3565b38611744565b503d611758565b610933565b61087f565b6117a2915060203d81116117a8575b61179a81836108a4565b810190611459565b386115b2565b503d611790565b610933565b6117d5915060203d81116117db575b6117cd81836108a4565b8101906113fe565b3861153b565b503d6117c3565b610933565b906117f191611365565b565b6117fb610eb3565b61181461180e611809611848565b61014e565b9161014e565b0361181b57565b611844611826611848565b61182e610133565b9182916332b2baa360e01b835260048301610450565b0390fd5b611850610eae565b503390565b61185f6000610d6e565b61186a826000611257565b9061189e6118987f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0936101c8565b916101c8565b916118a7610133565b806118b1816102e2565b0390a3565b6118bf906101bc565b90565b63ffffffff1690565b63ffffffff60e01b1690565b6118eb6118e66118f0926118c2565b6108cd565b6118cb565b90565b91602061191592949361190e60408201966000830190610443565b0190610c0f565b565b9061195e6119639361194f6004949361193663a9059cbb9193916118d7565b9261193f610133565b96879460208601908152016118f3565b602082018103825203836108a4565b6119ce565b565b61198061197a6119756000610d06565b61014e565b9161014e565b1461198757565b61198f610133565b63d92e233d60e01b8152806119a6600482016102e2565b0390fd5b600090565b90565b6119c66119c16119cb926119af565b61019d565b610540565b90565b9060006020916119dc6119aa565b506119e56119aa565b50828151910182855af115611a83573d60005190611a0c611a0660006108e6565b91610540565b14600014611a695750611a1e816118b6565b3b611a32611a2c60006108e6565b91610540565b145b611a3b5750565b611a47611a65916118b6565b611a4f610133565b918291635274afe760e01b835260048301610450565b0390fd5b611a7c611a7660016119b2565b91610540565b1415611a34565b6040513d6000823e3d90fdfea2646970667358221220cc8537203005f4bdfff3ef68b926540db265c065aa6079a3affce2e8b1de429264736f6c634300081800330000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c00000000000000000000000012684d18bdba8e31936f40abce1175366874114f
Deployed Bytecode
0x60806040526004361015610013575b61085b565b61001e60003561012d565b80630a7af47c146101285780630d5866e21461012357806325d3d7cf1461011e578063266f803a1461011957806361d027b31461011457806363b0e66a1461010f5780636a65092e1461010a578063715018a61461010557806387efa114146101005780638da5cb5b146100fb57806396df10c0146100f6578063b5ac72cd146100f1578063ce3e70a7146100ec578063df9a9374146100e7578063f0f44260146100e2578063f2fde38b146100dd5763f83926090361000e57610827565b6107c6565b610793565b61075f565b61072c565b6106f9565b6106c4565b61063c565b610609565b6105d6565b6105a2565b61050b565b610466565b6103cd565b61037e565b6102e8565b61025e565b60e01c90565b60405190565b600080fd5b600080fd5b60018060a01b031690565b61015790610143565b90565b6101638161014e565b0361016a57565b600080fd5b9050359061017c8261015a565b565b90602082820312610198576101959160000161016f565b90565b61013e565b90565b6101b46101af6101b992610143565b61019d565b610143565b90565b6101c5906101a0565b90565b6101d1906101bc565b90565b906101de906101c8565b600052602052604060002090565b1c90565b60ff1690565b61020690600861020b93026101ec565b6101f0565b90565b9061021991546101f6565b90565b6102339061022e6002916000926101d4565b61020e565b90565b151590565b61024490610236565b9052565b919061025c9060006020850194019061023b565b565b3461028e5761028a61027961027436600461017e565b61021c565b610281610133565b91829182610248565b0390f35b610139565b61029c9061014e565b90565b6102a881610293565b036102af57565b600080fd5b905035906102c18261029f565b565b906020828203126102dd576102da916000016102b4565b90565b61013e565b60000190565b34610316576103006102fb3660046102c3565b610b79565b610308610133565b80610312816102e2565b0390f35b610139565b600091031261032657565b61013e565b7f0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c90565b610358906101bc565b90565b6103649061034f565b9052565b919061037c9060006020850194019061035b565b565b346103ae5761038e36600461031b565b6103aa61039961032b565b6103a1610133565b91829182610368565b0390f35b610139565b6103ca906103c56003916000926101d4565b61020e565b90565b346103fd576103f96103e86103e336600461017e565b6103b3565b6103f0610133565b91829182610248565b0390f35b610139565b60018060a01b031690565b61041d90600861042293026101ec565b610402565b90565b90610430915461040d565b90565b6104406001600090610425565b90565b61044c9061014e565b9052565b919061046490600060208501940190610443565b565b346104965761047636600461031b565b610492610481610433565b610489610133565b91829182610450565b0390f35b610139565b60018060a01b031690565b6104b69060086104bb93026101ec565b61049b565b90565b906104c991546104a6565b90565b6104d960046000906104be565b90565b6104e5906101bc565b90565b6104f1906104dc565b9052565b9190610509906000602085019401906104e8565b565b3461053b5761051b36600461031b565b6105376105266104cc565b61052e610133565b918291826104f5565b0390f35b610139565b90565b61054c81610540565b0361055357565b600080fd5b9050359061056582610543565b565b909160608284031261059d5761059a61058384600085016102b4565b936105918160208601610558565b93604001610558565b90565b61013e565b346105d1576105bb6105b5366004610567565b91610ccb565b6105c3610133565b806105cd816102e2565b0390f35b610139565b34610604576105e636600461031b565b6105ee610d26565b6105f6610133565b80610600816102e2565b0390f35b610139565b346106375761061936600461031b565b610621610ea4565b610629610133565b80610633816102e2565b0390f35b610139565b3461066c5761064c36600461031b565b610668610657610eb3565b61065f610133565b91829182610450565b0390f35b610139565b7f000000000000000000000000e30e73cc52ef50a4e4a8b1a3dd0b002b2276f85490565b61069e906101bc565b90565b6106aa90610695565b9052565b91906106c2906000602085019401906106a1565b565b346106f4576106d436600461031b565b6106f06106df610671565b6106e7610133565b918291826106ae565b0390f35b610139565b346107275761071161070c3660046102c3565b610ff0565b610719610133565b80610723816102e2565b0390f35b610139565b3461075a5761074461073f3660046102c3565b611122565b61074c610133565b80610756816102e2565b0390f35b610139565b3461078e57610778610772366004610567565b91611219565b610780610133565b8061078a816102e2565b0390f35b610139565b346107c1576107ab6107a636600461017e565b6112e1565b6107b3610133565b806107bd816102e2565b0390f35b610139565b346107f4576107de6107d936600461017e565b61135a565b6107e6610133565b806107f0816102e2565b0390f35b610139565b9190604083820312610822578061081661081f92600086016102b4565b93602001610558565b90565b61013e565b346108565761084061083a3660046107f9565b906117e7565b610848610133565b80610852816102e2565b0390f35b610139565b600080fd5b6108719061086c6117f3565b6109da565b565b61087c906101bc565b90565b600080fd5b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b906108ae90610884565b810190811067ffffffffffffffff8211176108c857604052565b61088e565b60e01b90565b60009103126108de57565b61013e565b90565b6108fa6108f56108ff926108e3565b61019d565b610540565b90565b61090b906108e6565b9052565b91602061093192949361092a60408201966000830190610902565b0190610902565b565b61093b610133565b3d6000823e3d90fd5b60001c90565b61095661095b91610944565b6101f0565b90565b610968905461094a565b90565b91602061098d9294936109866040820196600083019061023b565b019061023b565b565b60001b90565b906109a160ff9161098f565b9181191691161790565b6109b490610236565b90565b90565b906109cf6109ca6109d6926109ab565b6109b7565b8254610995565b9055565b6109e381610873565b90634c343f0060008093803b15610b7457610a1260008094610a1d610a06610133565b988996879586946108cd565b84526004840161090f565b03925af1918215610b6f57610b4092610b42575b50610a3b81610873565b610a57610a526002610a4c85610873565b906101d4565b61095e565b906000610a847f6dd0921f466666de6bbf3064c7858ae58244531503f62a63d12a7a6f47e1f0e6926101c8565b92610a99610a90610133565b9283928361096b565b0390a2610aba6000610ab56002610aaf85610873565b906101d4565b6109ba565b610ac381610873565b610adf610ada6003610ad485610873565b906101d4565b61095e565b906001610b0c7ff5d8e3317fae883866485f066bf52e2e972ef14804ac942426beecf9538ef8c3926101c8565b92610b21610b18610133565b9283928361096b565b0390a2610b3b600191610b35600391610873565b906101d4565b6109ba565b565b610b629060003d8111610b68575b610b5a81836108a4565b8101906108d3565b38610a31565b503d610b50565b610933565b61087f565b610b8290610860565b565b610b90610b9591610944565b61049b565b90565b610ba29054610b84565b90565b9190610bb9610bb46004610b98565b6104dc565b610bd2610bcc610bc7611848565b61014e565b9161014e565b03610be257610be092610c40565b565b610c0b610bed611848565b610bf5610133565b9182916332b2baa360e01b835260048301610450565b0390fd5b610c1890610540565b9052565b916020610c3e929493610c3760408201966000830190610c0f565b0190610c0f565b565b610c4990610873565b91634c343f00919092803b15610cc657610c7760008094610c82610c6b610133565b978896879586946108cd565b845260048401610c1c565b03925af18015610cc157610c94575b50565b610cb49060003d8111610cba575b610cac81836108a4565b8101906108d3565b38610c91565b503d610ca2565b610933565b61087f565b90610cd69291610ba5565b565b610ce06117f3565b610ce8610d12565b565b610cfe610cf9610d03926108e3565b61019d565b610143565b90565b610d0f90610cea565b90565b610d24610d1f6000610d06565b611855565b565b610d2e610cd8565b565b610d386117f3565b610d40610db5565b565b610d4b906101a0565b90565b610d5790610d42565b90565b610d66610d6b91610944565b610402565b90565b610d789054610d5a565b90565b610d84906101bc565b90565b90505190610d9482610543565b565b90602082820312610db057610dad91600001610d87565b90565b61013e565b610e50610de9610de47f000000000000000000000000e30e73cc52ef50a4e4a8b1a3dd0b002b2276f854610695565b610d4e565b610df36001610d6e565b6020610e1e7f000000000000000000000000e30e73cc52ef50a4e4a8b1a3dd0b002b2276f854610695565b6370a0823190610e45610e3030610d7b565b92610e39610133565b978894859384936108cd565b835260048301610450565b03915afa918215610e9f57610e6d93600093610e6f575b50611917565b565b610e9191935060203d8111610e98575b610e8981836108a4565b810190610d96565b9138610e67565b503d610e7f565b610933565b610eac610d30565b565b600090565b610ebb610eae565b50610ec66000610d6e565b90565b610eda90610ed56117f3565b610edc565b565b610fee90610ee981610873565b610f05610f006002610efa85610873565b906101d4565b61095e565b906001610f327f6dd0921f466666de6bbf3064c7858ae58244531503f62a63d12a7a6f47e1f0e6926101c8565b92610f47610f3e610133565b9283928361096b565b0390a2610f686001610f636002610f5d85610873565b906101d4565b6109ba565b610f7181610873565b610f8d610f886003610f8285610873565b906101d4565b61095e565b906000610fba7ff5d8e3317fae883866485f066bf52e2e972ef14804ac942426beecf9538ef8c3926101c8565b92610fcf610fc6610133565b9283928361096b565b0390a2610fe9600091610fe3600391610873565b906101d4565b6109ba565b565b610ff990610ec9565b565b61100c906110076117f3565b61100e565b565b6111209061101b81610873565b611037611032600261102c85610873565b906101d4565b61095e565b9060006110647f6dd0921f466666de6bbf3064c7858ae58244531503f62a63d12a7a6f47e1f0e6926101c8565b92611079611070610133565b9283928361096b565b0390a261109a6000611095600261108f85610873565b906101d4565b6109ba565b6110a381610873565b6110bf6110ba60036110b485610873565b906101d4565b61095e565b9060006110ec7ff5d8e3317fae883866485f066bf52e2e972ef14804ac942426beecf9538ef8c3926101c8565b926111016110f8610133565b9283928361096b565b0390a261111b600091611115600391610873565b906101d4565b6109ba565b565b61112b90610ffb565b565b90611140929161113b6117f3565b611142565b565b61116761116161115c600261115685610873565b906101d4565b61095e565b15610236565b6111f65761117490610873565b91634c343f00919092803b156111f1576111a2600080946111ad611196610133565b978896879586946108cd565b845260048401610c1c565b03925af180156111ec576111bf575b50565b6111df9060003d81116111e5575b6111d781836108a4565b8101906108d3565b386111bc565b503d6111cd565b610933565b61087f565b6111fe610133565b633e6cd7d960e21b815280611215600482016102e2565b0390fd5b90611224929161112d565b565b611237906112326117f3565b611277565b565b9061124a60018060a01b039161098f565b9181191691161790565b90565b9061126c611267611273926101c8565b611254565b8254611239565b9055565b6112df9061128481611965565b61128e6001610d6e565b816112c26112bc7f8c3aa5f43a388513435861bf27dfad7829cd248696fed367c62d441f62954496936101c8565b916101c8565b916112cb610133565b806112d5816102e2565b0390a36001611257565b565b6112ea90611226565b565b6112fd906112f86117f3565b6112ff565b565b8061131b6113156113106000610d06565b61014e565b9161014e565b1461132b5761132990611855565b565b6113566113386000610d06565b611340610133565b91829163b20f76e360e01b835260048301610450565b0390fd5b611363906112ec565b565b906113786113736004610b98565b6104dc565b61139161138b611386611848565b61014e565b9161014e565b036113a15761139f916114f1565b565b6113ca6113ac611848565b6113b4610133565b9182916332b2baa360e01b835260048301610450565b0390fd5b6113d79061014e565b90565b6113e3816113ce565b036113ea57565b600080fd5b905051906113fc826113da565b565b9060208282031261141857611415916000016113ef565b90565b61013e565b611426906101bc565b90565b6114329061014e565b90565b61143e81611429565b0361144557565b600080fd5b9050519061145782611435565b565b90602082820312611473576114709160000161144a565b90565b61013e565b611481906101bc565b90565b919061149890600060208501940190610c0f565b565b90565b6114b16114ac6114b69261149a565b61019d565b610540565b90565b634e487b7160e01b600052601260045260246000fd5b6114db6114e191610540565b91610540565b9081156114ec570490565b6114b9565b61151560206114ff83610873565b63d8dfeb459061150d610133565b9384926108cd565b82528180611525600482016102e2565b03915afa80156117e257611541916000916117b4575b5061141d565b611585602061156f7f0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c61034f565b635c2c7cc69061157d610133565b9384926108cd565b82528180611595600482016102e2565b03915afa80156117af576115b86115bd916115c393600091611781575b50611478565b61014e565b9161014e565b146000146116ef576115d481610873565b916115ee63f5d93f52916115e8600461149d565b906114cf565b833b156116ea5761161f9361161460008094611608610133565b978895869485936108cd565b835260048301611484565b03925af19182156116e55761163a926116b8575b505b610873565b63f8ba4cff90803b156116b35761165e91600091611656610133565b9384926108cd565b825281838161166f600482016102e2565b03925af180156116ae57611681575b50565b6116a19060003d81116116a7575b61169981836108a4565b8101906108d3565b3861167e565b503d61168f565b610933565b61087f565b6116d89060003d81116116de575b6116d081836108a4565b8101906108d3565b38611633565b503d6116c6565b610933565b61087f565b6116f881610873565b9163f5d93f5290833b1561177c576117309361172560008094611719610133565b978895869485936108cd565b835260048301611484565b03925af19182156117775761163a9261174a575b50611635565b61176a9060003d8111611770575b61176281836108a4565b8101906108d3565b38611744565b503d611758565b610933565b61087f565b6117a2915060203d81116117a8575b61179a81836108a4565b810190611459565b386115b2565b503d611790565b610933565b6117d5915060203d81116117db575b6117cd81836108a4565b8101906113fe565b3861153b565b503d6117c3565b610933565b906117f191611365565b565b6117fb610eb3565b61181461180e611809611848565b61014e565b9161014e565b0361181b57565b611844611826611848565b61182e610133565b9182916332b2baa360e01b835260048301610450565b0390fd5b611850610eae565b503390565b61185f6000610d6e565b61186a826000611257565b9061189e6118987f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0936101c8565b916101c8565b916118a7610133565b806118b1816102e2565b0390a3565b6118bf906101bc565b90565b63ffffffff1690565b63ffffffff60e01b1690565b6118eb6118e66118f0926118c2565b6108cd565b6118cb565b90565b91602061191592949361190e60408201966000830190610443565b0190610c0f565b565b9061195e6119639361194f6004949361193663a9059cbb9193916118d7565b9261193f610133565b96879460208601908152016118f3565b602082018103825203836108a4565b6119ce565b565b61198061197a6119756000610d06565b61014e565b9161014e565b1461198757565b61198f610133565b63d92e233d60e01b8152806119a6600482016102e2565b0390fd5b600090565b90565b6119c66119c16119cb926119af565b61019d565b610540565b90565b9060006020916119dc6119aa565b506119e56119aa565b50828151910182855af115611a83573d60005190611a0c611a0660006108e6565b91610540565b14600014611a695750611a1e816118b6565b3b611a32611a2c60006108e6565b91610540565b145b611a3b5750565b611a47611a65916118b6565b611a4f610133565b918291635274afe760e01b835260048301610450565b0390fd5b611a7c611a7660016119b2565b91610540565b1415611a34565b6040513d6000823e3d90fdfea2646970667358221220cc8537203005f4bdfff3ef68b926540db265c065aa6079a3affce2e8b1de429264736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c00000000000000000000000012684d18bdba8e31936f40abce1175366874114f
-----Decoded View---------------
Arg [0] : baseContracts_ (address): 0x5Ce899AEd04c656776148fc3b1Adbe59e5f13D5c
Arg [1] : treasury_ (address): 0x12684d18BDBA8e31936f40aBcE1175366874114f
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000005ce899aed04c656776148fc3b1adbe59e5f13d5c
Arg [1] : 00000000000000000000000012684d18bdba8e31936f40abce1175366874114f
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.