Skip to content
Verified contractPartialBUSL-1.1

AutoRangePlatformConfigV1

Address0x4d0316310cb213c3b7b3896e34e40cbd6266badf
Balance

0 ETH

 

Transactions

7

 

Compiler

solc 0.8.24

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.24+commit.e11b9ed9
Language
solidity
Optimization
Yes, 1 runs
EVM version
cancun
Via IR
yes
License
BUSL-1.1
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,965,825
Creation transaction
0x1b63229eb6…f22d85242d

src/official/AutoRangePlatformConfigV1.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

import {Ownable2Step, Ownable} from "@openzeppelin/contracts/access/Ownable2Step.sol";

/// @title AutoRangePlatformConfigV1
/// @notice Platform-wide configuration for AutoRange compound vaults — the
/// default operator wallet, the deposit cap, the performance fee cut, the
/// tiered creation fee, and the platform's own pool of backup operator
/// wallets. Read by AutoRangeVaultFactoryV1 at vault-creation time and by each
/// AutoRangeVaultV1 instance thereafter.
contract AutoRangePlatformConfigV1 is Ownable2Step {
    /// @notice Token `maxDepositUsd` is denominated in.
    address public feeToken;

    /// @notice Default (primary) operator a new vault starts with. See
    /// operatorPool below for the backup-wallet redundancy layer alongside
    /// it.
    address public defaultOperator;

    /// @notice Global cap on total USD a single vault may hold. Zero means "no cap".
    uint256 public maxDepositUsd;

    /// @notice Cut of every LP trading fee the platform takes. Basis points.
    uint256 public performanceFeeBps;

    /// @notice Legacy flat creation fee field, kept for interface parity —
    /// AutoRangeVaultV1 never reads this (it uses the tiered
    /// creationFeeTierThresholdUsd/creationFeeFlatUsd/creationFeeBps
    /// combination via creationFeeParams() instead).
    uint256 public creationFeeUsdt;

    /// @notice Where the creation fee and reinjection-time fee cut land.
    address public treasury;

    /// @notice The tiered creation fee's bracket-2 rate — % charged on
    /// whatever a vault's cumulative fee-eligible capital exceeds
    /// creationFeeTierThresholdUsd. Basis points, e.g. 50 = 0.5%. Zero means
    /// no bracket-2 charge.
    uint256 public creationFeeBps;

    /// @notice The dedicated cooldown AutoRangeVaultV1's
    /// operatorForceRebalance() enforces on itself, independent of each
    /// vault's own minRebalanceInterval.
    uint256 public forceRebalanceCooldownSeconds;

    /// @notice The tiered creation fee's bracket boundary. A vault's
    /// cumulative fee-eligible capital (raw 6-decimal stable units) up to
    /// this amount is charged only the one-time creationFeeFlatUsd; anything
    /// above it is charged creationFeeBps on the excess. Zero degrades the
    /// whole scheme to flat-bps-on-everything.
    uint256 public creationFeeTierThresholdUsd;

    /// @notice The one-time flat fee (raw 6-decimal stable units) charged
    /// exactly once per vault, the first time it ever takes a fee-eligible
    /// deposit, covering its first creationFeeTierThresholdUsd of cumulative
    /// capital. Zero means no flat fee (bracket 1 is free).
    uint256 public creationFeeFlatUsd;

    /// Every wallet in here is authorized (AutoRangeVaultV1's
    /// isOperator mapping) on EVERY new vault at creation time, in addition
    /// to that vault's own single `operator` (still resolved from
    /// defaultOperator above, unchanged). Scope deliberately narrow — this
    /// is redundancy WITHIN the platform's own keeper infrastructure (so a
    /// vault isn't stuck if its assigned wallet is temporarily out of gas or
    /// rate-limited), never third-party agent authorization; explicit
    /// pool was populated (or before a wallet was added to it) are
    /// unaffected — the pool is only read once, at AutoRangeVaultV1's
    /// own initialize() time, never re-synced into an already-created vault.
    address[] private _operatorPool;

    event FeeTokenUpdated(address newToken);
    event DefaultOperatorUpdated(address newOperator);
    event MaxDepositUsdUpdated(uint256 newMax);
    event PerformanceFeeBpsUpdated(uint256 newFeeBps);
    event CreationFeeUsdtUpdated(uint256 newFee);
    event CreationFeeBpsUpdated(uint256 newFeeBps);
    event TreasuryUpdated(address newTreasury);
    event ForceRebalanceCooldownSecondsUpdated(uint256 newCooldown);
    event CreationFeeTierThresholdUsdUpdated(uint256 newThresholdUsd);
    event CreationFeeFlatUsdUpdated(uint256 newFlatUsd);
    event OperatorPoolUpdated(address[] newPool);

    /// @notice Same 7-arg shape as every earlier PlatformConfig's own
    /// constructor — no reason to diverge, this is a fresh instance either
    /// way. operatorPool starts empty, set afterward via setOperatorPool()
    /// (deploy_v9.sh does this right after deploying, same pattern as the
    constructor(
        address initialOwner,
        address _feeToken,
        address _defaultOperator,
        uint256 _maxDepositUsd,
        uint256 _performanceFeeBps,
        uint256 _creationFeeUsdt,
        address _treasury
    ) Ownable(initialOwner) {
        require(_feeToken != address(0), "feeToken=0");
        require(_defaultOperator != address(0), "defaultOperator=0");
        require(_performanceFeeBps <= 10_000, "performanceFeeBps>100%");
        require(_treasury != address(0), "treasury=0");
        feeToken = _feeToken;
        defaultOperator = _defaultOperator;
        maxDepositUsd = _maxDepositUsd;
        performanceFeeBps = _performanceFeeBps;
        creationFeeUsdt = _creationFeeUsdt;
        treasury = _treasury;
    }

    function setPerformanceFeeBps(uint256 newFeeBps) external onlyOwner {
        require(newFeeBps <= 10_000, "performanceFeeBps>100%");
        performanceFeeBps = newFeeBps;
        emit PerformanceFeeBpsUpdated(newFeeBps);
    }

    function setFeeToken(address newToken) external onlyOwner {
        require(newToken != address(0), "feeToken=0");
        feeToken = newToken;
        emit FeeTokenUpdated(newToken);
    }

    function setDefaultOperator(address newOperator) external onlyOwner {
        require(newOperator != address(0), "operator=0");
        defaultOperator = newOperator;
        emit DefaultOperatorUpdated(newOperator);
    }

    function setMaxDepositUsd(uint256 newMax) external onlyOwner {
        maxDepositUsd = newMax;
        emit MaxDepositUsdUpdated(newMax);
    }

    function setCreationFeeUsdt(uint256 newFee) external onlyOwner {
        creationFeeUsdt = newFee;
        emit CreationFeeUsdtUpdated(newFee);
    }

    function setCreationFeeBps(uint256 newFeeBps) external onlyOwner {
        require(newFeeBps <= 10_000, "creationFeeBps>100%");
        creationFeeBps = newFeeBps;
        emit CreationFeeBpsUpdated(newFeeBps);
    }

    function setTreasury(address newTreasury) external onlyOwner {
        require(newTreasury != address(0), "treasury=0");
        treasury = newTreasury;
        emit TreasuryUpdated(newTreasury);
    }

    function setForceRebalanceCooldownSeconds(uint256 newCooldown) external onlyOwner {
        forceRebalanceCooldownSeconds = newCooldown;
        emit ForceRebalanceCooldownSecondsUpdated(newCooldown);
    }

    function setCreationFeeTierThresholdUsd(uint256 newThresholdUsd) external onlyOwner {
        creationFeeTierThresholdUsd = newThresholdUsd;
        emit CreationFeeTierThresholdUsdUpdated(newThresholdUsd);
    }

    function setCreationFeeFlatUsd(uint256 newFlatUsd) external onlyOwner {
        creationFeeFlatUsd = newFlatUsd;
        emit CreationFeeFlatUsdUpdated(newFlatUsd);
    }

    /// @notice Replaces the whole pool in one call (not an add/remove pair)
    /// — the platform owner manages its own keeper wallet roster as a set,
    /// re-submitting the full desired list each time. No zero-address check
    /// on individual entries: an accidental address(0) here just wastes one
    /// isOperator[address(0)]=true slot at vault-creation time (address(0)
    /// can never be msg.sender anyway), never a security issue.
    function setOperatorPool(address[] calldata newPool) external onlyOwner {
        _operatorPool = newPool;
        emit OperatorPoolUpdated(newPool);
    }

    function operatorPool() external view returns (address[] memory) {
        return _operatorPool;
    }

    /// @notice Packs the 3 tiered-fee reads AutoRangeVaultV1's
    /// _creationFeeFor() needs into ONE external call instead of 3.
    function creationFeeParams() external view returns (uint256 thresholdUsd, uint256 flatUsd, uint256 bps) {
        return (creationFeeTierThresholdUsd, creationFeeFlatUsd, creationFeeBps);
    }
}

lib/openzeppelin-contracts/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @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);
    }
}

lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {Ownable} from "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * This extension of the {Ownable} contract includes a two-step mechanism to transfer
 * ownership, where the new owner must call {acceptOwnership} in order to replace the
 * old one. This can help prevent common mistakes, such as transfers of ownership to
 * incorrect accounts, or to contracts that are unable to interact with the
 * permission system.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        return _pendingOwner;
    }

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     *
     * Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

lib/openzeppelin-contracts/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "appendCBOR": false,
    "bytecodeHash": "none",
    "useLiteralContent": false
  },
  "optimizer": {
    "runs": 1,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "v3-core/=lib/v3-core/",
    "v3-periphery/=lib/v3-periphery/contracts/",
    "@uniswap/v3-core/=lib/v3-core/",
    "@uniswap/v3-periphery/=lib/v3-periphery/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.