ETH Price: $1,683.12 (+0.98%)
Gas: 10 Gwei
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multi Chain

Multichain Addresses

1 address found via
Transaction Hash
Method
Block
From
To
Value
0x60806040134732632021-10-23 10:38:19707 days 6 hrs ago1634985499IN
 Create: FeeManager
0 ETH0.1013070948.95353689

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FeeManager

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion, GNU GPLv3 license
File 1 of 18 : FeeManager.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "./FeeManagerStorage.sol";

/// @title FeeManager
/// @author Angle Core Team
/// @dev This contract interacts with fee parameters for a given stablecoin/collateral pair
/// @dev `FeeManager` contains all the functions that keepers can call to update parameters
/// in the `StableMaster` and `PerpetualManager` contracts
/// @dev These parameters need to be updated by keepers because they depend on variables, like
/// the collateral ratio, that are too expensive to compute each time transactions that would need
/// it occur
contract FeeManager is FeeManagerStorage, IFeeManagerFunctions, AccessControl, Initializable {
    /// @notice Role for `PoolManager` only
    bytes32 public constant POOLMANAGER_ROLE = keccak256("POOLMANAGER_ROLE");
    /// @notice Role for guardians and governors
    bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");

    /// @notice Deploys the `FeeManager` contract for a pair stablecoin/collateral
    /// @param _poolManager `PoolManager` contract handling the collateral
    /// @dev The `_poolManager` address is used to grant the correct role. It does not need to be stored by the
    /// contract
    /// @dev There is no need to do a zero address check on the `_poolManager` as if the zero address is passed
    /// the function will revert when trying to fetch the `StableMaster`
    constructor(IPoolManager _poolManager) {
        stableMaster = IStableMaster(_poolManager.stableMaster());
        // Once a `FeeManager` contract has been initialized with a `PoolManager` contract, this
        // reference cannot be modified
        _setupRole(POOLMANAGER_ROLE, address(_poolManager));

        _setRoleAdmin(POOLMANAGER_ROLE, POOLMANAGER_ROLE);
        _setRoleAdmin(GUARDIAN_ROLE, POOLMANAGER_ROLE);
    }

    /// @notice Initializes the governor and guardian roles of the contract as well as the reference to
    /// the `perpetualManager` contract
    /// @param governorList List of the governor addresses of the protocol
    /// @param guardian Guardian address of the protocol
    /// @param _perpetualManager `PerpetualManager` contract handling the perpetuals of the pool
    /// @dev `GUARDIAN_ROLE` can then directly be granted or revoked by the corresponding `PoolManager`
    /// As `POOLMANAGER_ROLE` is admin of `GUARDIAN_ROLE`, it corresponds to the intended behaviour of roles
    function deployCollateral(
        address[] memory governorList,
        address guardian,
        address _perpetualManager
    ) external override onlyRole(POOLMANAGER_ROLE) initializer {
        for (uint256 i = 0; i < governorList.length; i++) {
            _grantRole(GUARDIAN_ROLE, governorList[i]);
        }
        _grantRole(GUARDIAN_ROLE, guardian);
        perpetualManager = IPerpetualManager(_perpetualManager);
    }

    // ============================ `StableMaster` =================================

    /// @notice Updates the SLP and Users fees associated to the pair stablecoin/collateral in
    /// the `StableMaster` contract
    /// @dev This function updates:
    /// 	-	`bonusMalusMint`: part of the fee induced by a user minting depending on the collateral ratio
    ///                   In normal times, no fees are taken for that, and so this fee should be equal to `BASE_PARAMS`
    ///		-	`bonusMalusBurn`: part of the fee induced by a user burning depending on the collateral ratio
    ///		-	Slippage: what's given to SLPs compared with their claim when they exit
    ///		-	SlippageFee: that is the portion of fees that is put aside because the protocol
    ///         is not well collateralized
    /// @dev `bonusMalusMint` and `bonusMalusBurn` allow governance to add penalties or bonuses for users minting
    /// and burning in some situations of collateral ratio. These parameters are multiplied to the fee amount depending
    /// on the hedge ratio by Hedging Agents to get the exact fee induced to the users
    function updateUsersSLP() external override {
        // Computing the collateral ratio, expressed in `BASE_PARAMS`
        uint256 collatRatio = stableMaster.getCollateralRatio();
        // Computing the fees based on this collateral ratio
        uint64 bonusMalusMint = _piecewiseLinearCollatRatio(collatRatio, xBonusMalusMint, yBonusMalusMint);
        uint64 bonusMalusBurn = _piecewiseLinearCollatRatio(collatRatio, xBonusMalusBurn, yBonusMalusBurn);
        uint64 slippage = _piecewiseLinearCollatRatio(collatRatio, xSlippage, ySlippage);
        uint64 slippageFee = _piecewiseLinearCollatRatio(collatRatio, xSlippageFee, ySlippageFee);

        emit UserAndSLPFeesUpdated(collatRatio, bonusMalusMint, bonusMalusBurn, slippage, slippageFee);
        stableMaster.setFeeKeeper(bonusMalusMint, bonusMalusBurn, slippage, slippageFee);
    }

    // ============================= PerpetualManager ==============================

    /// @notice Updates HA fees associated to the pair stablecoin/collateral in the `PerpetualManager` contract
    /// @dev This function updates:
    ///     - The part of the fee taken from HAs when they open a perpetual or add collateral in it. This allows
    ///        governance to add penalties or bonuses in some occasions to HAs opening their perpetuals
    ///     - The part of the fee taken from the HA when they withdraw collateral from a perpetual. This allows
    ///       governance to add penalty or bonuses in some occasions to HAs closing their perpetuals
    /// @dev Penalties or bonuses for HAs should almost never be used
    /// @dev In the `PerpetualManager` contract, these parameters are multiplied to the fee amount depending on the HA
    /// hedge ratio to get the exact fee amount for HAs
    /// @dev For the moment, these parameters do not depend on the collateral ratio, and they are just an extra
    /// element that governance can play on to correct fees taken for HAs
    function updateHA() external override {
        emit HaFeesUpdated(haFeeDeposit, haFeeWithdraw);
        perpetualManager.setFeeKeeper(haFeeDeposit, haFeeWithdraw);
    }

    // ============================= Governance ====================================

    /// @notice Sets the x (i.e. thresholds of collateral ratio) array / y (i.e. value of fees at threshold)-array
    /// for users minting, burning, for SLPs withdrawal slippage or for the slippage fee when updating
    /// the exchange rate between sanTokens and collateral
    /// @param xArray New collateral ratio thresholds (in ascending order)
    /// @param yArray New fees or values for the parameters at thresholds
    /// @param typeChange Type of parameter to change
    /// @dev For `typeChange = 1`, `bonusMalusMint` fees are updated
    /// @dev For `typeChange = 2`, `bonusMalusBurn` fees are updated
    /// @dev For `typeChange = 3`, `slippage` values are updated
    /// @dev For other values of `typeChange`, `slippageFee` values are updated
    function setFees(
        uint256[] memory xArray,
        uint64[] memory yArray,
        uint8 typeChange
    ) external override onlyRole(GUARDIAN_ROLE) {
        require(xArray.length == yArray.length && yArray.length > 0, "5");
        for (uint256 i = 0; i <= yArray.length - 1; i++) {
            if (i > 0) {
                require(xArray[i] > xArray[i - 1], "7");
            }
        }
        if (typeChange == 1) {
            xBonusMalusMint = xArray;
            yBonusMalusMint = yArray;
            emit FeeMintUpdated(xBonusMalusMint, yBonusMalusMint);
        } else if (typeChange == 2) {
            xBonusMalusBurn = xArray;
            yBonusMalusBurn = yArray;
            emit FeeBurnUpdated(xBonusMalusBurn, yBonusMalusBurn);
        } else if (typeChange == 3) {
            xSlippage = xArray;
            ySlippage = yArray;
            _checkSlippageCompatibility();
            emit SlippageUpdated(xSlippage, ySlippage);
        } else {
            xSlippageFee = xArray;
            ySlippageFee = yArray;
            _checkSlippageCompatibility();
            emit SlippageFeeUpdated(xSlippageFee, ySlippageFee);
        }
    }

    /// @notice Sets the extra fees that can be used when HAs deposit or withdraw collateral from the
    /// protocol
    /// @param _haFeeDeposit New parameter to modify deposit fee for HAs
    /// @param _haFeeWithdraw New parameter to modify withdraw fee for HAs
    function setHAFees(uint64 _haFeeDeposit, uint64 _haFeeWithdraw) external override onlyRole(GUARDIAN_ROLE) {
        haFeeDeposit = _haFeeDeposit;
        haFeeWithdraw = _haFeeWithdraw;
    }

    /// @notice Helps to make sure that the `slippageFee` and the `slippage` will in most situations be compatible
    /// with one another
    /// @dev Whenever the `slippageFee` is not null, the `slippage` should be non null, as otherwise, there would be
    /// an opportunity cost to increase the collateral ratio to make the `slippage` non null and collect the fees
    /// that have been left aside
    /// @dev This function does not perform an exhaustive check around the fact that whenever the `slippageFee`
    /// is not null the `slippage` is not null neither. It simply checks that each positive value in the `ySlippageFee` array
    /// corresponds to a positive value of the `slippage`
    /// @dev The protocol still relies on governance to make sure that this condition is always verified, this function
    /// is just here to eliminate potentially extreme errors
    function _checkSlippageCompatibility() internal view {
        // We need this `if` condition because when this function is first called after contract deployment, the length
        // of the two arrays is zero
        if (xSlippage.length >= 1 && xSlippageFee.length >= 1) {
            for (uint256 i = 0; i <= ySlippageFee.length - 1; i++) {
                if (ySlippageFee[i] > 0) {
                    require(ySlippageFee[i] <= BASE_PARAMS_CASTED, "37");
                    require(_piecewiseLinearCollatRatio(xSlippageFee[i], xSlippage, ySlippage) > 0, "38");
                }
            }
        }
    }

    /// @notice Computes the value of a linear by part function at a given point
    /// @param x Point of the function we want to compute
    /// @param xArray List of breaking points (in ascending order) that define the linear by part function
    /// @param yArray List of values at breaking points (not necessarily in ascending order)
    /// @dev The evolution of the linear by part function between two breaking points is linear
    /// @dev Before the first breaking point and after the last one, the function is constant with a value
    /// equal to the first or last value of the `yArray`
    /// @dev The reason for having a function that is different from what's in the `FunctionUtils` contract is that
    /// here the values in `xArray` can be greater than `BASE_PARAMS` meaning that there is a non negligeable risk that
    /// the product between `yArray` and `xArray` values overflows
    function _piecewiseLinearCollatRatio(
        uint256 x,
        uint256[] storage xArray,
        uint64[] storage yArray
    ) internal view returns (uint64 y) {
        if (x >= xArray[xArray.length - 1]) {
            return yArray[xArray.length - 1];
        } else if (x <= xArray[0]) {
            return yArray[0];
        } else {
            uint256 lower;
            uint256 upper = xArray.length - 1;
            uint256 mid;
            while (upper - lower > 1) {
                mid = lower + (upper - lower) / 2;
                if (xArray[mid] <= x) {
                    lower = mid;
                } else {
                    upper = mid;
                }
            }
            uint256 yCasted;
            if (yArray[upper] > yArray[lower]) {
                yCasted =
                    yArray[lower] +
                    ((yArray[upper] - yArray[lower]) * (x - xArray[lower])) /
                    (xArray[upper] - xArray[lower]);
            } else {
                yCasted =
                    yArray[lower] -
                    ((yArray[lower] - yArray[upper]) * (x - xArray[lower])) /
                    (xArray[upper] - xArray[lower]);
            }
            // There is no problem with this cast as `y` was initially a `uint64` and we divided a `uint256` with a `uint256`
            // that is greater
            y = uint64(yCasted);
        }
    }
}

File 2 of 18 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 3 of 18 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

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

File 4 of 18 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

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

File 5 of 18 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 6 of 18 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 7 of 18 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * 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[EIP 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);
}

File 8 of 18 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "../interfaces/IAccessControl.sol";

/**
 * @dev This contract is fully forked from OpenZeppelin `AccessControl`.
 * The only difference is the removal of the ERC165 implementation as it's not
 * needed in Angle.
 *
 * Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external override {
        require(account == _msgSender(), "71");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal {
        emit RoleAdminChanged(role, getRoleAdmin(role), adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) internal {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) internal {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 9 of 18 : FeeManagerEvents.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "../external/AccessControl.sol";

import "../interfaces/IFeeManager.sol";
import "../interfaces/IPoolManager.sol";
import "../interfaces/IStableMaster.sol";
import "../interfaces/IPerpetualManager.sol";

/// @title FeeManagerEvents
/// @author Angle Core Team
/// @dev This file contains all the events that are triggered by the `FeeManager` contract
contract FeeManagerEvents {
    event UserAndSLPFeesUpdated(
        uint256 _collatRatio,
        uint64 _bonusMalusMint,
        uint64 _bonusMalusBurn,
        uint64 _slippage,
        uint64 _slippageFee
    );

    event FeeMintUpdated(uint256[] _xBonusMalusMint, uint64[] _yBonusMalusMint);

    event FeeBurnUpdated(uint256[] _xBonusMalusBurn, uint64[] _yBonusMalusBurn);

    event SlippageUpdated(uint256[] _xSlippage, uint64[] _ySlippage);

    event SlippageFeeUpdated(uint256[] _xSlippageFee, uint64[] _ySlippageFee);

    event HaFeesUpdated(uint64 _haFeeDeposit, uint64 _haFeeWithdraw);
}

File 10 of 18 : FeeManagerStorage.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "./FeeManagerEvents.sol";

/// @title FeeManagerStorage
/// @author Angle Core Team
/// @dev `FeeManagerStorage` contains all the parameters (most often fee parameters) to add corrections
/// to fees in the `StableMaster` and `PerpetualManager` contracts
contract FeeManagerStorage is FeeManagerEvents {
    uint64 public constant BASE_PARAMS_CASTED = 10**9;
    // ==================== References to other contracts ==========================

    /// @notice Address of the `StableMaster` contract corresponding to this contract
    /// This reference cannot be modified
    IStableMaster public stableMaster;

    /// @notice Address of the `PerpetualManager` corresponding to this contract
    /// This reference cannot be modified
    IPerpetualManager public perpetualManager;

    // ================= Parameters that can be set by governance ==================

    /// @notice Bonus - Malus Fee, means that if the `fee > BASE_PARAMS` then agents incur a malus and will
    /// have larger fees, while `fee < BASE_PARAMS` they incur a smaller fee than what they would have if fees
    /// just consisted in what was obtained using the hedge ratio
    /// @notice Values of the collateral ratio where mint transaction fees will change for users
    /// It should be ranked in ascending order
    uint256[] public xBonusMalusMint;
    /// @notice Values of the bonus/malus on the mint fees at the points of collateral ratio in the array above
    /// The evolution of the fees when collateral ratio is between two threshold values is linear
    uint64[] public yBonusMalusMint;
    /// @notice Values of the collateral ratio where burn transaction fees will change
    uint256[] public xBonusMalusBurn;
    /// @notice Values of the bonus/malus on the burn fees at the points of collateral ratio in the array above
    uint64[] public yBonusMalusBurn;

    /// @notice Values of the collateral ratio where the slippage factor for SLPs exiting will evolve
    uint256[] public xSlippage;
    /// @notice Slippage factor at the values of collateral ratio above
    uint64[] public ySlippage;
    /// @notice Values of the collateral ratio where the slippage fee, that is the portion of the fees
    /// that does not come to SLPs although changes
    uint256[] public xSlippageFee;
    /// @notice Slippage fee value at the values of collateral ratio above
    uint64[] public ySlippageFee;

    /// @notice Bonus - Malus HA deposit Fee, means that if the `fee > BASE_PARAMS` then HAs incur a malus and
    /// will have larger fees, while `fee < BASE_PARAMS` they incur a smaller fee than what they would have if
    /// fees just consisted in what was obtained using hedge ratio
    uint64 public haFeeDeposit;
    /// @notice Bonus - Malus HA withdraw Fee
    uint64 public haFeeWithdraw;
}

File 11 of 18 : IAccessControl.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

/// @title IAccessControl
/// @author Forked from OpenZeppelin
/// @notice Interface for `AccessControl` contracts
interface IAccessControl {
    function hasRole(bytes32 role, address account) external view returns (bool);

    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    function grantRole(bytes32 role, address account) external;

    function revokeRole(bytes32 role, address account) external;

    function renounceRole(bytes32 role, address account) external;
}

File 12 of 18 : IERC721.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

interface IERC721 is IERC165 {
    function balanceOf(address owner) external view returns (uint256 balance);

    function ownerOf(uint256 tokenId) external view returns (address owner);

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    function approve(address to, uint256 tokenId) external;

    function getApproved(uint256 tokenId) external view returns (address operator);

    function setApprovalForAll(address operator, bool _approved) external;

    function isApprovedForAll(address owner, address operator) external view returns (bool);

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

interface IERC721Metadata is IERC721 {
    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 13 of 18 : IFeeManager.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "./IAccessControl.sol";

/// @title IFeeManagerFunctions
/// @author Angle Core Team
/// @dev Interface for the `FeeManager` contract
interface IFeeManagerFunctions is IAccessControl {
    // ================================= Keepers ===================================

    function updateUsersSLP() external;

    function updateHA() external;

    // ================================= Governance ================================

    function deployCollateral(
        address[] memory governorList,
        address guardian,
        address _perpetualManager
    ) external;

    function setFees(
        uint256[] memory xArray,
        uint64[] memory yArray,
        uint8 typeChange
    ) external;

    function setHAFees(uint64 _haFeeDeposit, uint64 _haFeeWithdraw) external;
}

/// @title IFeeManager
/// @author Angle Core Team
/// @notice Previous interface with additionnal getters for public variables and mappings
/// @dev We need these getters as they are used in other contracts of the protocol
interface IFeeManager is IFeeManagerFunctions {
    function stableMaster() external view returns (address);

    function perpetualManager() external view returns (address);
}

File 14 of 18 : IOracle.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

/// @title IOracle
/// @author Angle Core Team
/// @notice Interface for Angle's oracle contracts reading oracle rates from both UniswapV3 and Chainlink
/// from just UniswapV3 or from just Chainlink
interface IOracle {
    function read() external view returns (uint256);

    function readAll() external view returns (uint256 lowerRate, uint256 upperRate);

    function readLower() external view returns (uint256);

    function readUpper() external view returns (uint256);

    function readQuote(uint256 baseAmount) external view returns (uint256);

    function readQuoteLower(uint256 baseAmount) external view returns (uint256);

    function inBase() external view returns (uint256);
}

File 15 of 18 : IPerpetualManager.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "./IERC721.sol";
import "./IFeeManager.sol";
import "./IOracle.sol";
import "./IAccessControl.sol";

/// @title Interface of the contract managing perpetuals
/// @author Angle Core Team
/// @dev Front interface, meaning only user-facing functions
interface IPerpetualManagerFront is IERC721Metadata {
    function openPerpetual(
        address owner,
        uint256 amountBrought,
        uint256 amountCommitted,
        uint256 maxOracleRate,
        uint256 minNetMargin
    ) external returns (uint256 perpetualID);

    function closePerpetual(
        uint256 perpetualID,
        address to,
        uint256 minCashOutAmount
    ) external;

    function addToPerpetual(uint256 perpetualID, uint256 amount) external;

    function removeFromPerpetual(
        uint256 perpetualID,
        uint256 amount,
        address to
    ) external;

    function liquidatePerpetuals(uint256[] memory perpetualIDs) external;

    function forceClosePerpetuals(uint256[] memory perpetualIDs) external;

    // ========================= External View Functions =============================

    function getCashOutAmount(uint256 perpetualID, uint256 rate) external view returns (uint256, uint256);

    function isApprovedOrOwner(address spender, uint256 perpetualID) external view returns (bool);
}

/// @title Interface of the contract managing perpetuals
/// @author Angle Core Team
/// @dev This interface does not contain user facing functions, it just has functions that are
/// interacted with in other parts of the protocol
interface IPerpetualManagerFunctions is IAccessControl {
    // ================================= Governance ================================

    function deployCollateral(
        address[] memory governorList,
        address guardian,
        IFeeManager feeManager,
        IOracle oracle_
    ) external;

    function setFeeManager(IFeeManager feeManager_) external;

    function setHAFees(
        uint64[] memory _xHAFees,
        uint64[] memory _yHAFees,
        uint8 deposit
    ) external;

    function setTargetAndLimitHAHedge(uint64 _targetHAHedge, uint64 _limitHAHedge) external;

    function setKeeperFeesLiquidationRatio(uint64 _keeperFeesLiquidationRatio) external;

    function setKeeperFeesCap(uint256 _keeperFeesLiquidationCap, uint256 _keeperFeesClosingCap) external;

    function setKeeperFeesClosing(uint64[] memory _xKeeperFeesClosing, uint64[] memory _yKeeperFeesClosing) external;

    function setLockTime(uint64 _lockTime) external;

    function setBoundsPerpetual(uint64 _maxLeverage, uint64 _maintenanceMargin) external;

    function pause() external;

    function unpause() external;

    // ==================================== Keepers ================================

    function setFeeKeeper(uint64 feeDeposit, uint64 feesWithdraw) external;

    // =============================== StableMaster ================================

    function setOracle(IOracle _oracle) external;
}

/// @title IPerpetualManager
/// @author Angle Core Team
/// @notice Previous interface with additionnal getters for public variables
interface IPerpetualManager is IPerpetualManagerFunctions {
    function poolManager() external view returns (address);

    function oracle() external view returns (address);

    function targetHAHedge() external view returns (uint64);

    function totalHedgeAmount() external view returns (uint256);
}

File 16 of 18 : IPoolManager.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "./IFeeManager.sol";
import "./IPerpetualManager.sol";
import "./IOracle.sol";

// Struct for the parameters associated to a strategy interacting with a collateral `PoolManager`
// contract
struct StrategyParams {
    // Timestamp of last report made by this strategy
    // It is also used to check if a strategy has been initialized
    uint256 lastReport;
    // Total amount the strategy is expected to have
    uint256 totalStrategyDebt;
    // The share of the total assets in the `PoolManager` contract that the `strategy` can access to.
    uint256 debtRatio;
}

/// @title IPoolManagerFunctions
/// @author Angle Core Team
/// @notice Interface for the collateral poolManager contracts handling each one type of collateral for
/// a given stablecoin
/// @dev Only the functions used in other contracts of the protocol are left here
interface IPoolManagerFunctions {
    // ============================ Constructor ====================================

    function deployCollateral(
        address[] memory governorList,
        address guardian,
        IPerpetualManager _perpetualManager,
        IFeeManager feeManager,
        IOracle oracle
    ) external;

    // ============================ Yield Farming ==================================

    function creditAvailable() external view returns (uint256);

    function debtOutstanding() external view returns (uint256);

    function report(
        uint256 _gain,
        uint256 _loss,
        uint256 _debtPayment
    ) external;

    // ============================ Governance =====================================

    function addGovernor(address _governor) external;

    function removeGovernor(address _governor) external;

    function setGuardian(address _guardian, address guardian) external;

    function revokeGuardian(address guardian) external;

    function setFeeManager(IFeeManager _feeManager) external;

    // ============================= Getters =======================================

    function getBalance() external view returns (uint256);

    function getTotalAsset() external view returns (uint256);
}

/// @title IPoolManager
/// @author Angle Core Team
/// @notice Previous interface with additionnal getters for public variables and mappings
/// @dev Used in other contracts of the protocol
interface IPoolManager is IPoolManagerFunctions {
    function stableMaster() external view returns (address);

    function perpetualManager() external view returns (address);

    function token() external view returns (address);

    function feeManager() external view returns (address);

    function totalDebt() external view returns (uint256);

    function strategies(address _strategy) external view returns (StrategyParams memory);
}

File 17 of 18 : ISanToken.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

/// @title ISanToken
/// @author Angle Core Team
/// @notice Interface for Angle's `SanToken` contract that handles sanTokens, tokens that are given to SLPs
/// contributing to a collateral for a given stablecoin
interface ISanToken is IERC20Upgradeable {
    // ================================== StableMaster =============================

    function mint(address account, uint256 amount) external;

    function burnFrom(
        uint256 amount,
        address burner,
        address sender
    ) external;

    function burnSelf(uint256 amount, address burner) external;

    function stableMaster() external view returns (address);

    function poolManager() external view returns (address);
}

File 18 of 18 : IStableMaster.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

// Normally just importing `IPoolManager` should be sufficient, but for clarity here
// we prefer to import all concerned interfaces
import "./IPoolManager.sol";
import "./IOracle.sol";
import "./IPerpetualManager.sol";
import "./ISanToken.sol";

// Struct to handle all the parameters to manage the fees
// related to a given collateral pool (associated to the stablecoin)
struct MintBurnData {
    // Values of the thresholds to compute the minting fees
    // depending on HA hedge (scaled by `BASE_PARAMS`)
    uint64[] xFeeMint;
    // Values of the fees at thresholds (scaled by `BASE_PARAMS`)
    uint64[] yFeeMint;
    // Values of the thresholds to compute the burning fees
    // depending on HA hedge (scaled by `BASE_PARAMS`)
    uint64[] xFeeBurn;
    // Values of the fees at thresholds (scaled by `BASE_PARAMS`)
    uint64[] yFeeBurn;
    // Max proportion of collateral from users that can be covered by HAs
    // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated
    // the other changes accordingly
    uint64 targetHAHedge;
    // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied
    // to the value of the fees computed using the hedge curve
    // Scaled by `BASE_PARAMS`
    uint64 bonusMalusMint;
    // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied
    // to the value of the fees computed using the hedge curve
    // Scaled by `BASE_PARAMS`
    uint64 bonusMalusBurn;
    // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral
    uint256 capOnStableMinted;
}

// Struct to handle all the variables and parameters to handle SLPs in the protocol
// including the fraction of interests they receive or the fees to be distributed to
// them
struct SLPData {
    // Last timestamp at which the `sanRate` has been updated for SLPs
    uint256 lastBlockUpdated;
    // Fees accumulated from previous blocks and to be distributed to SLPs
    uint256 lockedInterests;
    // Max interests used to update the `sanRate` in a single block
    // Should be in collateral token base
    uint256 maxInterestsDistributed;
    // Amount of fees left aside for SLPs and that will be distributed
    // when the protocol is collateralized back again
    uint256 feesAside;
    // Part of the fees normally going to SLPs that is left aside
    // before the protocol is collateralized back again (depends on collateral ratio)
    // Updated by keepers and scaled by `BASE_PARAMS`
    uint64 slippageFee;
    // Portion of the fees from users minting and burning
    // that goes to SLPs (the rest goes to surplus)
    uint64 feesForSLPs;
    // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)
    // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim
    // Updated by keepers and scaled by `BASE_PARAMS`
    uint64 slippage;
    // Portion of the interests from lending
    // that goes to SLPs (the rest goes to surplus)
    uint64 interestsForSLPs;
}

/// @title IStableMasterFunctions
/// @author Angle Core Team
/// @notice Interface for the `StableMaster` contract
interface IStableMasterFunctions {
    function deploy(
        address[] memory _governorList,
        address _guardian,
        address _agToken
    ) external;

    // ============================== Lending ======================================

    function accumulateInterest(uint256 gain) external;

    function signalLoss(uint256 loss) external;

    // ============================== HAs ==========================================

    function getStocksUsers() external view returns (uint256 maxCAmountInStable);

    function convertToSLP(uint256 amount, address user) external;

    // ============================== Keepers ======================================

    function getCollateralRatio() external returns (uint256);

    function setFeeKeeper(
        uint64 feeMint,
        uint64 feeBurn,
        uint64 _slippage,
        uint64 _slippageFee
    ) external;

    // ============================== AgToken ======================================

    function updateStocksUsers(uint256 amount, address poolManager) external;

    // ============================= Governance ====================================

    function setCore(address newCore) external;

    function addGovernor(address _governor) external;

    function removeGovernor(address _governor) external;

    function setGuardian(address newGuardian, address oldGuardian) external;

    function revokeGuardian(address oldGuardian) external;

    function setCapOnStableAndMaxInterests(
        uint256 _capOnStableMinted,
        uint256 _maxInterestsDistributed,
        IPoolManager poolManager
    ) external;

    function setIncentivesForSLPs(
        uint64 _feesForSLPs,
        uint64 _interestsForSLPs,
        IPoolManager poolManager
    ) external;

    function setUserFees(
        IPoolManager poolManager,
        uint64[] memory _xFee,
        uint64[] memory _yFee,
        uint8 _mint
    ) external;

    function setTargetHAHedge(uint64 _targetHAHedge) external;

    function pause(bytes32 agent, IPoolManager poolManager) external;

    function unpause(bytes32 agent, IPoolManager poolManager) external;
}

/// @title IStableMaster
/// @author Angle Core Team
/// @notice Previous interface with additionnal getters for public variables and mappings
interface IStableMaster is IStableMasterFunctions {
    function agToken() external view returns (address);

    function collateralMap(IPoolManager poolManager)
        external
        view
        returns (
            IERC20 token,
            ISanToken sanToken,
            IPerpetualManager perpetualManager,
            IOracle oracle,
            uint256 stocksUsers,
            uint256 sanRate,
            uint256 collatBase,
            SLPData memory slpData,
            MintBurnData memory feeData
        );
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IPoolManager","name":"_poolManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"_xBonusMalusBurn","type":"uint256[]"},{"indexed":false,"internalType":"uint64[]","name":"_yBonusMalusBurn","type":"uint64[]"}],"name":"FeeBurnUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"_xBonusMalusMint","type":"uint256[]"},{"indexed":false,"internalType":"uint64[]","name":"_yBonusMalusMint","type":"uint64[]"}],"name":"FeeMintUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"_haFeeDeposit","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"_haFeeWithdraw","type":"uint64"}],"name":"HaFeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"_xSlippageFee","type":"uint256[]"},{"indexed":false,"internalType":"uint64[]","name":"_ySlippageFee","type":"uint64[]"}],"name":"SlippageFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"_xSlippage","type":"uint256[]"},{"indexed":false,"internalType":"uint64[]","name":"_ySlippage","type":"uint64[]"}],"name":"SlippageUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_collatRatio","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_bonusMalusMint","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"_bonusMalusBurn","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"_slippage","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"_slippageFee","type":"uint64"}],"name":"UserAndSLPFeesUpdated","type":"event"},{"inputs":[],"name":"BASE_PARAMS_CASTED","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GUARDIAN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POOLMANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"governorList","type":"address[]"},{"internalType":"address","name":"guardian","type":"address"},{"internalType":"address","name":"_perpetualManager","type":"address"}],"name":"deployCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"haFeeDeposit","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"haFeeWithdraw","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"perpetualManager","outputs":[{"internalType":"contract IPerpetualManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"xArray","type":"uint256[]"},{"internalType":"uint64[]","name":"yArray","type":"uint64[]"},{"internalType":"uint8","name":"typeChange","type":"uint8"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_haFeeDeposit","type":"uint64"},{"internalType":"uint64","name":"_haFeeWithdraw","type":"uint64"}],"name":"setHAFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stableMaster","outputs":[{"internalType":"contract IStableMaster","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateHA","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateUsersSLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"xBonusMalusBurn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"xBonusMalusMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"xSlippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"xSlippageFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"yBonusMalusBurn","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"yBonusMalusMint","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ySlippage","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ySlippageFee","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506040516200253538038062002535833981016040819052620000349162000249565b806001600160a01b0316636ac5dc466040518163ffffffff1660e01b815260040160206040518083038186803b1580156200006e57600080fd5b505afa15801562000083573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000a9919062000249565b600080546001600160a01b0319166001600160a01b0392909216919091179055620000e4600080516020620025158339815191528262000141565b620000ff600080516020620025158339815191528062000151565b6200013a7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a50416000805160206200251583398151915262000151565b5062000289565b6200014d8282620001a5565b5050565b6000828152600b6020526040902060010154819060405184907fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff90600090a46000918252600b602052604090912060010155565b6000828152600b602090815260408083206001600160a01b038516845290915290205460ff166200014d576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002053390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000602082840312156200025c57600080fd5b8151620002698162000270565b9392505050565b6001600160a01b03811681146200028657600080fd5b50565b61227c80620002996000396000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c80634e6b13f1116100ee57806391d1485411610097578063c011c5b011610071578063c011c5b014610421578063ccde501e14610434578063d547741f14610447578063efce9edd1461045a57600080fd5b806391d14854146103b0578063a217fddf14610406578063aa4bef8d1461040e57600080fd5b80636ac5dc46116100c85780636ac5dc461461036a5780637597323d1461038a5780638d4045271461039d57600080fd5b80634e6b13f11461030a5780635d34082b1461031d5780635da3e6f51461036257600080fd5b806329ba62381161015b57806336568abe1161013557806336568abe146102b957806342746072146102cc57806343223da9146102ec5780634c405020146102f757600080fd5b806329ba6238146102675780632f2ff15d14610293578063329c3e3d146102a657600080fd5b8063232c28c41161018c578063232c28c41461020a578063248a9ca31461021d57806324ea54f41461024057600080fd5b80630c016dc0146101b35780631573087c146101ed57806320be420a14610200575b600080fd5b6101da7f5916f72c85af4ac6f7e34636ecc97619c4b2085da099a5d28f3e58436cfbe56281565b6040519081526020015b60405180910390f35b6101da6101fb366004611d53565b61046e565b61020861048f565b005b610208610218366004611db1565b61058c565b6101da61022b366004611d53565b6000908152600b602052604090206001015490565b6101da7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504181565b61027a610275366004611d53565b610607565b60405167ffffffffffffffff90911681526020016101e4565b6102086102a1366004611d6c565b610645565b61027a6102b4366004611d53565b610670565b6102086102c7366004611d6c565b610680565b600a5461027a9068010000000000000000900467ffffffffffffffff1681565b61027a633b9aca0081565b61027a610305366004611d53565b610712565b610208610318366004611c8c565b610722565b60015461033d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e4565b610208610a55565b60005461033d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101da610398366004611d53565b610c46565b6102086103ab366004611bcb565b610c56565b6103f66103be366004611d6c565b6000918252600b6020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b60405190151581526020016101e4565b6101da600081565b6101da61041c366004611d53565b610e67565b61027a61042f366004611d53565b610e77565b6101da610442366004611d53565b610e87565b610208610455366004611d6c565b610e97565b600a5461027a9067ffffffffffffffff1681565b6004818154811061047e57600080fd5b600091825260209091200154905081565b600a546040805167ffffffffffffffff80841682526801000000000000000090930490921660208301527f8c2ad681201eaf10e67f2557b964de22af47dca1eb2fb61416379905ade5e0c1910160405180910390a1600154600a546040517fc628a6f700000000000000000000000000000000000000000000000000000000815267ffffffffffffffff808316600483015268010000000000000000909204909116602482015273ffffffffffffffffffffffffffffffffffffffff9091169063c628a6f790604401600060405180830381600087803b15801561057257600080fd5b505af1158015610586573d6000803e3d6000fd5b50505050565b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a50416105b78133610ebd565b50600a805467ffffffffffffffff92831668010000000000000000027fffffffffffffffffffffffffffffffff000000000000000000000000000000009091169290931691909117919091179055565b6007818154811061061757600080fd5b9060005260206000209060049182820401919006600802915054906101000a900467ffffffffffffffff1681565b6000828152600b60205260409020600101546106618133610ebd565b61066b8383610f8f565b505050565b6003818154811061061757600080fd5b73ffffffffffffffffffffffffffffffffffffffff81163314610704576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f373100000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b61070e8282611083565b5050565b6009818154811061061757600080fd5b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504161074d8133610ebd565b8251845114801561075f575060008351115b6107c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f350000000000000000000000000000000000000000000000000000000000000060448201526064016106fb565b60005b600184516107d691906120df565b811161089957801561088757846107ee6001836120df565b815181106107fe576107fe6121e8565b6020026020010151858281518110610818576108186121e8565b602002602001015111610887576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f370000000000000000000000000000000000000000000000000000000000000060448201526064016106fb565b8061089181612180565b9150506107c8565b508160ff166001141561090e5783516108b99060029060208701906119ee565b5082516108cd906003906020860190611a39565b507f282808efb3e9ee96e0e38e46472797400e1adcf286e677897d7b566b279d2fc060026003604051610901929190611e5c565b60405180910390a1610586565b8160ff166002141561097557835161092d9060049060208701906119ee565b508251610941906005906020860190611a39565b507fac73cc8727e7a285f6f27260964016bb8a3e79bc7f1eed15994d486d161f952260046005604051610901929190611e5c565b8160ff16600314156109e45783516109949060069060208701906119ee565b5082516109a8906007906020860190611a39565b506109b161113e565b7f4baeeda8a3b1ec443944dc906aee519e7239a4fea7e774772af5bb3c86b48b8460066007604051610901929190611e5c565b83516109f79060089060208701906119ee565b508251610a0b906009906020860190611a39565b50610a1461113e565b7fbcccb929773c04c1dc7062d7adea041d6b0bcdbb2d7743c1a655e018844dac3560086009604051610a47929190611e5c565b60405180910390a150505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cd377c536040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610ac057600080fd5b505af1158015610ad4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af89190611d98565b90506000610b098260026003611319565b90506000610b1a8360046005611319565b90506000610b2b8460066007611319565b90506000610b3c8560086009611319565b6040805187815267ffffffffffffffff87811660208301528681168284015285811660608301528316608082015290519192507fab79e7364d434b5fbbc74047c5f889087f2502936ec4d0d3df245a0cae08f5aa919081900360a00190a16000546040517f91a9ca4800000000000000000000000000000000000000000000000000000000815267ffffffffffffffff8087166004830152808616602483015280851660448301528316606482015273ffffffffffffffffffffffffffffffffffffffff909116906391a9ca4890608401600060405180830381600087803b158015610c2757600080fd5b505af1158015610c3b573d6000803e3d6000fd5b505050505050505050565b6002818154811061047e57600080fd5b7f5916f72c85af4ac6f7e34636ecc97619c4b2085da099a5d28f3e58436cfbe562610c818133610ebd565b600c54610100900460ff1680610c9a5750600c5460ff16155b610d26576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016106fb565b600c54610100900460ff16158015610d6557600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b60005b8551811015610dc657610db47f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a5041878381518110610da757610da76121e8565b6020026020010151610f8f565b80610dbe81612180565b915050610d68565b50610df17f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504185610f8f565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790558015610e6057600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050505050565b6008818154811061047e57600080fd5b6005818154811061061757600080fd5b6006818154811061047e57600080fd5b6000828152600b6020526040902060010154610eb38133610ebd565b61066b8383611083565b6000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661070e57610f158173ffffffffffffffffffffffffffffffffffffffff1660146117ab565b610f208360206117ab565b604051602001610f31929190611ddb565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526106fb91600401611f8b565b6000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661070e576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556110253390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561070e576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6006546001118015906111545750600854600111155b156113175760005b60095461116b906001906120df565b811161131557600060098281548110611186576111866121e8565b6000918252602090912060048204015460039091166008026101000a900467ffffffffffffffff16111561130357633b9aca0067ffffffffffffffff16600982815481106111d6576111d66121e8565b6000918252602090912060048204015460039091166008026101000a900467ffffffffffffffff161115611266576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f333700000000000000000000000000000000000000000000000000000000000060448201526064016106fb565b60006112926008838154811061127e5761127e6121e8565b906000526020600020015460066007611319565b67ffffffffffffffff1611611303576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f333800000000000000000000000000000000000000000000000000000000000060448201526064016106fb565b8061130d81612180565b91505061115c565b505b565b8154600090839061132c906001906120df565b8154811061133c5761133c6121e8565b9060005260206000200154841061139e578254829061135d906001906120df565b8154811061136d5761136d6121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1690506117a4565b826000815481106113b1576113b16121e8565b906000526020600020015484116113d5578160008154811061136d5761136d6121e8565b825460009081906113e8906001906120df565b905060005b60016113f984846120df565b111561145457600261140b84846120df565b6114159190612067565b61141f908461204f565b905086868281548110611434576114346121e8565b90600052602060002001541161144c578092506113ed565b8091506113ed565b6000858481548110611468576114686121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1667ffffffffffffffff168684815481106114ae576114ae6121e8565b6000918252602090912060048204015460039091166008026101000a900467ffffffffffffffff16111561163f578684815481106114ee576114ee6121e8565b906000526020600020015487848154811061150b5761150b6121e8565b906000526020600020015461152091906120df565b878581548110611532576115326121e8565b90600052602060002001548961154891906120df565b87868154811061155a5761155a6121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff16888681548110611596576115966121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff166115ca91906120f6565b67ffffffffffffffff166115de91906120a2565b6115e89190612067565b8685815481106115fa576115fa6121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1667ffffffffffffffff16611638919061204f565b905061179e565b868481548110611651576116516121e8565b906000526020600020015487848154811061166e5761166e6121e8565b906000526020600020015461168391906120df565b878581548110611695576116956121e8565b9060005260206000200154896116ab91906120df565b8785815481106116bd576116bd6121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff168887815481106116f9576116f96121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1661172d91906120f6565b67ffffffffffffffff1661174191906120a2565b61174b9190612067565b86858154811061175d5761175d6121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1667ffffffffffffffff1661179b91906120df565b90505b93505050505b9392505050565b606060006117ba8360026120a2565b6117c590600261204f565b67ffffffffffffffff8111156117dd576117dd612217565b6040519080825280601f01601f191660200182016040528015611807576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061183e5761183e6121e8565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106118a1576118a16121e8565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006118dd8460026120a2565b6118e890600161204f565b90505b6001811115611985577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611929576119296121e8565b1a60f81b82828151811061193f5761193f6121e8565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361197e8161214b565b90506118eb565b5083156117a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106fb565b828054828255906000526020600020908101928215611a29579160200282015b82811115611a29578251825591602001919060010190611a0e565b50611a35929150611aeb565b5090565b82805482825590600052602060002090600301600490048101928215611a295791602002820160005b83821115611aae57835183826101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055509260200192600801602081600701049283019260010302611a62565b8015611ae25782816101000a81549067ffffffffffffffff0219169055600801602081600701049283019260010302611aae565b5050611a359291505b5b80821115611a355760008155600101611aec565b803573ffffffffffffffffffffffffffffffffffffffff81168114611b2457600080fd5b919050565b600082601f830112611b3a57600080fd5b81356020611b4f611b4a8361202b565b611fdc565b80838252828201915082860187848660051b8901011115611b6f57600080fd5b60005b85811015611b9557611b8382611ba2565b84529284019290840190600101611b72565b5090979650505050505050565b803567ffffffffffffffff81168114611b2457600080fd5b803560ff81168114611b2457600080fd5b600080600060608486031215611be057600080fd5b833567ffffffffffffffff811115611bf757600080fd5b8401601f81018613611c0857600080fd5b80356020611c18611b4a8361202b565b8083825282820191508285018a848660051b8801011115611c3857600080fd5b600095505b84861015611c6257611c4e81611b00565b835260019590950194918301918301611c3d565b509650611c729050878201611b00565b9450505050611c8360408501611b00565b90509250925092565b600080600060608486031215611ca157600080fd5b833567ffffffffffffffff80821115611cb957600080fd5b818601915086601f830112611ccd57600080fd5b81356020611cdd611b4a8361202b565b8083825282820191508286018b848660051b8901011115611cfd57600080fd5b600096505b84871015611d20578035835260019690960195918301918301611d02565b5097505087013592505080821115611d3757600080fd5b50611d4486828701611b29565b925050611c8360408501611bba565b600060208284031215611d6557600080fd5b5035919050565b60008060408385031215611d7f57600080fd5b82359150611d8f60208401611b00565b90509250929050565b600060208284031215611daa57600080fd5b5051919050565b60008060408385031215611dc457600080fd5b611dcd83611ba2565b9150611d8f60208401611ba2565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611e1381601785016020880161211f565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611e5081602884016020880161211f565b01602801949350505050565b600060408083018184528086548083526060925082860191508760005260208060002060005b83811015611e9e57815485529382019360019182019101611e82565b505086830381880152875480845260008981526020808220950193505b81600382011015611f0757845467ffffffffffffffff808216865281891c811685870152608082811c9091168987015260c09190911c8786015260019095019490930192600401611ebb565b8454955081811015611f285767ffffffffffffffff86168452928201926001015b81811015611f475785871c67ffffffffffffffff168452928201926001015b81811015611f6857608086901c67ffffffffffffffff168452928201926001015b81811015611f7c5760c086901c8452928201925b50919998505050505050505050565b6020815260008251806020840152611faa81604085016020870161211f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561202357612023612217565b604052919050565b600067ffffffffffffffff82111561204557612045612217565b5060051b60200190565b60008219821115612062576120626121b9565b500190565b60008261209d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156120da576120da6121b9565b500290565b6000828210156120f1576120f16121b9565b500390565b600067ffffffffffffffff83811690831681811015612117576121176121b9565b039392505050565b60005b8381101561213a578181015183820152602001612122565b838111156105865750506000910152565b60008161215a5761215a6121b9565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156121b2576121b26121b9565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea26469706673582212202977ebb4c14113cfcb619a9873c53181a4cfb74943ff7d2081d15d8dccffb01564736f6c634300080700335916f72c85af4ac6f7e34636ecc97619c4b2085da099a5d28f3e58436cfbe562000000000000000000000000c9daabc677f3d1301006e723bd21c60be57a5915

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101ae5760003560e01c80634e6b13f1116100ee57806391d1485411610097578063c011c5b011610071578063c011c5b014610421578063ccde501e14610434578063d547741f14610447578063efce9edd1461045a57600080fd5b806391d14854146103b0578063a217fddf14610406578063aa4bef8d1461040e57600080fd5b80636ac5dc46116100c85780636ac5dc461461036a5780637597323d1461038a5780638d4045271461039d57600080fd5b80634e6b13f11461030a5780635d34082b1461031d5780635da3e6f51461036257600080fd5b806329ba62381161015b57806336568abe1161013557806336568abe146102b957806342746072146102cc57806343223da9146102ec5780634c405020146102f757600080fd5b806329ba6238146102675780632f2ff15d14610293578063329c3e3d146102a657600080fd5b8063232c28c41161018c578063232c28c41461020a578063248a9ca31461021d57806324ea54f41461024057600080fd5b80630c016dc0146101b35780631573087c146101ed57806320be420a14610200575b600080fd5b6101da7f5916f72c85af4ac6f7e34636ecc97619c4b2085da099a5d28f3e58436cfbe56281565b6040519081526020015b60405180910390f35b6101da6101fb366004611d53565b61046e565b61020861048f565b005b610208610218366004611db1565b61058c565b6101da61022b366004611d53565b6000908152600b602052604090206001015490565b6101da7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504181565b61027a610275366004611d53565b610607565b60405167ffffffffffffffff90911681526020016101e4565b6102086102a1366004611d6c565b610645565b61027a6102b4366004611d53565b610670565b6102086102c7366004611d6c565b610680565b600a5461027a9068010000000000000000900467ffffffffffffffff1681565b61027a633b9aca0081565b61027a610305366004611d53565b610712565b610208610318366004611c8c565b610722565b60015461033d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e4565b610208610a55565b60005461033d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101da610398366004611d53565b610c46565b6102086103ab366004611bcb565b610c56565b6103f66103be366004611d6c565b6000918252600b6020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b60405190151581526020016101e4565b6101da600081565b6101da61041c366004611d53565b610e67565b61027a61042f366004611d53565b610e77565b6101da610442366004611d53565b610e87565b610208610455366004611d6c565b610e97565b600a5461027a9067ffffffffffffffff1681565b6004818154811061047e57600080fd5b600091825260209091200154905081565b600a546040805167ffffffffffffffff80841682526801000000000000000090930490921660208301527f8c2ad681201eaf10e67f2557b964de22af47dca1eb2fb61416379905ade5e0c1910160405180910390a1600154600a546040517fc628a6f700000000000000000000000000000000000000000000000000000000815267ffffffffffffffff808316600483015268010000000000000000909204909116602482015273ffffffffffffffffffffffffffffffffffffffff9091169063c628a6f790604401600060405180830381600087803b15801561057257600080fd5b505af1158015610586573d6000803e3d6000fd5b50505050565b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a50416105b78133610ebd565b50600a805467ffffffffffffffff92831668010000000000000000027fffffffffffffffffffffffffffffffff000000000000000000000000000000009091169290931691909117919091179055565b6007818154811061061757600080fd5b9060005260206000209060049182820401919006600802915054906101000a900467ffffffffffffffff1681565b6000828152600b60205260409020600101546106618133610ebd565b61066b8383610f8f565b505050565b6003818154811061061757600080fd5b73ffffffffffffffffffffffffffffffffffffffff81163314610704576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f373100000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b61070e8282611083565b5050565b6009818154811061061757600080fd5b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504161074d8133610ebd565b8251845114801561075f575060008351115b6107c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f350000000000000000000000000000000000000000000000000000000000000060448201526064016106fb565b60005b600184516107d691906120df565b811161089957801561088757846107ee6001836120df565b815181106107fe576107fe6121e8565b6020026020010151858281518110610818576108186121e8565b602002602001015111610887576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f370000000000000000000000000000000000000000000000000000000000000060448201526064016106fb565b8061089181612180565b9150506107c8565b508160ff166001141561090e5783516108b99060029060208701906119ee565b5082516108cd906003906020860190611a39565b507f282808efb3e9ee96e0e38e46472797400e1adcf286e677897d7b566b279d2fc060026003604051610901929190611e5c565b60405180910390a1610586565b8160ff166002141561097557835161092d9060049060208701906119ee565b508251610941906005906020860190611a39565b507fac73cc8727e7a285f6f27260964016bb8a3e79bc7f1eed15994d486d161f952260046005604051610901929190611e5c565b8160ff16600314156109e45783516109949060069060208701906119ee565b5082516109a8906007906020860190611a39565b506109b161113e565b7f4baeeda8a3b1ec443944dc906aee519e7239a4fea7e774772af5bb3c86b48b8460066007604051610901929190611e5c565b83516109f79060089060208701906119ee565b508251610a0b906009906020860190611a39565b50610a1461113e565b7fbcccb929773c04c1dc7062d7adea041d6b0bcdbb2d7743c1a655e018844dac3560086009604051610a47929190611e5c565b60405180910390a150505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cd377c536040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610ac057600080fd5b505af1158015610ad4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af89190611d98565b90506000610b098260026003611319565b90506000610b1a8360046005611319565b90506000610b2b8460066007611319565b90506000610b3c8560086009611319565b6040805187815267ffffffffffffffff87811660208301528681168284015285811660608301528316608082015290519192507fab79e7364d434b5fbbc74047c5f889087f2502936ec4d0d3df245a0cae08f5aa919081900360a00190a16000546040517f91a9ca4800000000000000000000000000000000000000000000000000000000815267ffffffffffffffff8087166004830152808616602483015280851660448301528316606482015273ffffffffffffffffffffffffffffffffffffffff909116906391a9ca4890608401600060405180830381600087803b158015610c2757600080fd5b505af1158015610c3b573d6000803e3d6000fd5b505050505050505050565b6002818154811061047e57600080fd5b7f5916f72c85af4ac6f7e34636ecc97619c4b2085da099a5d28f3e58436cfbe562610c818133610ebd565b600c54610100900460ff1680610c9a5750600c5460ff16155b610d26576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016106fb565b600c54610100900460ff16158015610d6557600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b60005b8551811015610dc657610db47f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a5041878381518110610da757610da76121e8565b6020026020010151610f8f565b80610dbe81612180565b915050610d68565b50610df17f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504185610f8f565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790558015610e6057600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050505050565b6008818154811061047e57600080fd5b6005818154811061061757600080fd5b6006818154811061047e57600080fd5b6000828152600b6020526040902060010154610eb38133610ebd565b61066b8383611083565b6000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661070e57610f158173ffffffffffffffffffffffffffffffffffffffff1660146117ab565b610f208360206117ab565b604051602001610f31929190611ddb565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526106fb91600401611f8b565b6000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661070e576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556110253390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561070e576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6006546001118015906111545750600854600111155b156113175760005b60095461116b906001906120df565b811161131557600060098281548110611186576111866121e8565b6000918252602090912060048204015460039091166008026101000a900467ffffffffffffffff16111561130357633b9aca0067ffffffffffffffff16600982815481106111d6576111d66121e8565b6000918252602090912060048204015460039091166008026101000a900467ffffffffffffffff161115611266576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f333700000000000000000000000000000000000000000000000000000000000060448201526064016106fb565b60006112926008838154811061127e5761127e6121e8565b906000526020600020015460066007611319565b67ffffffffffffffff1611611303576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f333800000000000000000000000000000000000000000000000000000000000060448201526064016106fb565b8061130d81612180565b91505061115c565b505b565b8154600090839061132c906001906120df565b8154811061133c5761133c6121e8565b9060005260206000200154841061139e578254829061135d906001906120df565b8154811061136d5761136d6121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1690506117a4565b826000815481106113b1576113b16121e8565b906000526020600020015484116113d5578160008154811061136d5761136d6121e8565b825460009081906113e8906001906120df565b905060005b60016113f984846120df565b111561145457600261140b84846120df565b6114159190612067565b61141f908461204f565b905086868281548110611434576114346121e8565b90600052602060002001541161144c578092506113ed565b8091506113ed565b6000858481548110611468576114686121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1667ffffffffffffffff168684815481106114ae576114ae6121e8565b6000918252602090912060048204015460039091166008026101000a900467ffffffffffffffff16111561163f578684815481106114ee576114ee6121e8565b906000526020600020015487848154811061150b5761150b6121e8565b906000526020600020015461152091906120df565b878581548110611532576115326121e8565b90600052602060002001548961154891906120df565b87868154811061155a5761155a6121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff16888681548110611596576115966121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff166115ca91906120f6565b67ffffffffffffffff166115de91906120a2565b6115e89190612067565b8685815481106115fa576115fa6121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1667ffffffffffffffff16611638919061204f565b905061179e565b868481548110611651576116516121e8565b906000526020600020015487848154811061166e5761166e6121e8565b906000526020600020015461168391906120df565b878581548110611695576116956121e8565b9060005260206000200154896116ab91906120df565b8785815481106116bd576116bd6121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff168887815481106116f9576116f96121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1661172d91906120f6565b67ffffffffffffffff1661174191906120a2565b61174b9190612067565b86858154811061175d5761175d6121e8565b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1667ffffffffffffffff1661179b91906120df565b90505b93505050505b9392505050565b606060006117ba8360026120a2565b6117c590600261204f565b67ffffffffffffffff8111156117dd576117dd612217565b6040519080825280601f01601f191660200182016040528015611807576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061183e5761183e6121e8565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106118a1576118a16121e8565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006118dd8460026120a2565b6118e890600161204f565b90505b6001811115611985577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611929576119296121e8565b1a60f81b82828151811061193f5761193f6121e8565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361197e8161214b565b90506118eb565b5083156117a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106fb565b828054828255906000526020600020908101928215611a29579160200282015b82811115611a29578251825591602001919060010190611a0e565b50611a35929150611aeb565b5090565b82805482825590600052602060002090600301600490048101928215611a295791602002820160005b83821115611aae57835183826101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055509260200192600801602081600701049283019260010302611a62565b8015611ae25782816101000a81549067ffffffffffffffff0219169055600801602081600701049283019260010302611aae565b5050611a359291505b5b80821115611a355760008155600101611aec565b803573ffffffffffffffffffffffffffffffffffffffff81168114611b2457600080fd5b919050565b600082601f830112611b3a57600080fd5b81356020611b4f611b4a8361202b565b611fdc565b80838252828201915082860187848660051b8901011115611b6f57600080fd5b60005b85811015611b9557611b8382611ba2565b84529284019290840190600101611b72565b5090979650505050505050565b803567ffffffffffffffff81168114611b2457600080fd5b803560ff81168114611b2457600080fd5b600080600060608486031215611be057600080fd5b833567ffffffffffffffff811115611bf757600080fd5b8401601f81018613611c0857600080fd5b80356020611c18611b4a8361202b565b8083825282820191508285018a848660051b8801011115611c3857600080fd5b600095505b84861015611c6257611c4e81611b00565b835260019590950194918301918301611c3d565b509650611c729050878201611b00565b9450505050611c8360408501611b00565b90509250925092565b600080600060608486031215611ca157600080fd5b833567ffffffffffffffff80821115611cb957600080fd5b818601915086601f830112611ccd57600080fd5b81356020611cdd611b4a8361202b565b8083825282820191508286018b848660051b8901011115611cfd57600080fd5b600096505b84871015611d20578035835260019690960195918301918301611d02565b5097505087013592505080821115611d3757600080fd5b50611d4486828701611b29565b925050611c8360408501611bba565b600060208284031215611d6557600080fd5b5035919050565b60008060408385031215611d7f57600080fd5b82359150611d8f60208401611b00565b90509250929050565b600060208284031215611daa57600080fd5b5051919050565b60008060408385031215611dc457600080fd5b611dcd83611ba2565b9150611d8f60208401611ba2565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611e1381601785016020880161211f565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611e5081602884016020880161211f565b01602801949350505050565b600060408083018184528086548083526060925082860191508760005260208060002060005b83811015611e9e57815485529382019360019182019101611e82565b505086830381880152875480845260008981526020808220950193505b81600382011015611f0757845467ffffffffffffffff808216865281891c811685870152608082811c9091168987015260c09190911c8786015260019095019490930192600401611ebb565b8454955081811015611f285767ffffffffffffffff86168452928201926001015b81811015611f475785871c67ffffffffffffffff168452928201926001015b81811015611f6857608086901c67ffffffffffffffff168452928201926001015b81811015611f7c5760c086901c8452928201925b50919998505050505050505050565b6020815260008251806020840152611faa81604085016020870161211f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561202357612023612217565b604052919050565b600067ffffffffffffffff82111561204557612045612217565b5060051b60200190565b60008219821115612062576120626121b9565b500190565b60008261209d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156120da576120da6121b9565b500290565b6000828210156120f1576120f16121b9565b500390565b600067ffffffffffffffff83811690831681811015612117576121176121b9565b039392505050565b60005b8381101561213a578181015183820152602001612122565b838111156105865750506000910152565b60008161215a5761215a6121b9565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156121b2576121b26121b9565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea26469706673582212202977ebb4c14113cfcb619a9873c53181a4cfb74943ff7d2081d15d8dccffb01564736f6c63430008070033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000c9daabc677f3d1301006e723bd21c60be57a5915

-----Decoded View---------------
Arg [0] : _poolManager (address): 0xc9daabC677F3d1301006e723bD21C60be57a5915

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c9daabc677f3d1301006e723bd21c60be57a5915


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.