ETH Price: $2,708.03 (-3.52%)

Contract

0x2E2063080A05FfdaA6D57f9358C2a5e1C65c70EC
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Buyback167826702023-03-08 9:32:23701 days ago1678267943IN
0x2E206308...1C65c70EC
0 ETH0.0035505119.13003243
Buyback167358612023-03-01 19:31:47708 days ago1677699107IN
0x2E206308...1C65c70EC
0 ETH0.0072783646.4788805
Buyback166859312023-02-22 19:03:59715 days ago1677092639IN
0x2E206308...1C65c70EC
0 ETH0.0076602550.45917349
Buyback166352022023-02-15 16:01:59722 days ago1676476919IN
0x2E206308...1C65c70EC
0 ETH0.0177734795.76276978
Buyback165831812023-02-08 9:31:23729 days ago1675848683IN
0x2E206308...1C65c70EC
0 ETH0.0049268926.5459397
Buyback165330862023-02-01 9:31:11736 days ago1675243871IN
0x2E206308...1C65c70EC
0 ETH0.0034781118.73992264
Buyback164829562023-01-25 9:31:35743 days ago1674639095IN
0x2E206308...1C65c70EC
0 ETH0.0030629116.50285259
Buyback164328082023-01-18 9:31:23750 days ago1674034283IN
0x2E206308...1C65c70EC
0 ETH0.0029525215.90810961
Buyback163826912023-01-11 9:31:35757 days ago1673429495IN
0x2E206308...1C65c70EC
0 ETH0.002882517.1069839
Buyback163395042023-01-05 8:49:35763 days ago1672908575IN
0x2E206308...1C65c70EC
0 ETH0.0031840615.2949673
Buyback162823682022-12-28 9:31:23771 days ago1672219883IN
0x2E206308...1C65c70EC
0 ETH0.0020677114.09362122
Buyback162321992022-12-21 9:31:35778 days ago1671615095IN
0x2E206308...1C65c70EC
0 ETH0.0019112812.58991801
Buyback161820542022-12-14 9:31:23785 days ago1671010283IN
0x2E206308...1C65c70EC
0 ETH0.00266314.34815241
Buyback161319542022-12-07 9:31:23792 days ago1670405483IN
0x2E206308...1C65c70EC
0 ETH0.0023338415.37332858
Buyback160819272022-11-30 9:31:59799 days ago1669800719IN
0x2E206308...1C65c70EC
0 ETH0.0018157411.9605733
Buyback160331992022-11-23 14:09:47806 days ago1669212587IN
0x2E206308...1C65c70EC
0 ETH0.0021044613.86237439
Buyback159817082022-11-16 9:31:35813 days ago1668591095IN
0x2E206308...1C65c70EC
0 ETH0.0021275715.20446021
Buyback159321062022-11-09 11:14:23820 days ago1667992463IN
0x2E206308...1C65c70EC
0 ETH0.0074933640.3739521
Buyback158815062022-11-02 9:41:11827 days ago1667382071IN
0x2E206308...1C65c70EC
0 ETH0.0016816811.07749722
Buyback158310662022-10-26 8:31:35834 days ago1666773095IN
0x2E206308...1C65c70EC
0 ETH0.0027233814.6735058
Buyback156807292022-10-05 8:31:47855 days ago1664958707IN
0x2E206308...1C65c70EC
0 ETH0.000953526.49923567
Buyback156306592022-09-28 8:31:47862 days ago1664353907IN
0x2E206308...1C65c70EC
0 ETH0.0019977213.15931686
Buyback155806032022-09-21 8:31:35869 days ago1663749095IN
0x2E206308...1C65c70EC
0 ETH0.000911646.21381242
Buyback155319432022-09-14 8:31:17876 days ago1663144277IN
0x2E206308...1C65c70EC
0 ETH0.000873626.37127864
Buyback154892792022-09-07 8:31:35883 days ago1662539495IN
0x2E206308...1C65c70EC
0 ETH0.001567710.32671478
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SurplusConverterSanTokens

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 1000000 runs

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

pragma solidity ^0.8.7;

import "../interfaces/IPoolManager.sol";
import "../interfaces/IStableMaster.sol";
import "../interfaces/ISanToken.sol";
import "./BaseSurplusConverter.sol";

interface IStableMasterFront {
    function deposit(
        uint256 amount,
        address to,
        address poolManager
    ) external;
}

/// @title SurplusConverterSanTokens
/// @author Angle Core Team
/// @notice A contract to swap tokens from the surplus of the protocol to a reward token
/// (could be ANGLE tokens, or another type of token)
/// @dev This contract gets sanTokens from a token of the Angle protocol
contract SurplusConverterSanTokens is BaseSurplusConverter {
    using SafeERC20 for IERC20;

    event PathUpdated(address indexed token, bytes newPath, bytes oldPath);
    event TokenRevoked(address indexed token);

    IStableMasterFront public immutable stableMaster;
    address public immutable poolManager;
    address public immutable supportedToken;

    /// @notice Constructor of the `SurplusConverterSanTokens`
    /// @param _rewardToken Reward token that this contract tries to buy
    /// @param _feeDistributor Reference to the contract handling fee distribution
    /// @param _stableMaster Reference to the `stableMaster` contract
    /// @param whitelisted Reference to the first whitelisted address that will have the right
    /// @param governor Governor of the protocol
    /// @param guardians List of guardians of the protocol
    constructor(
        address _rewardToken,
        address _feeDistributor,
        address _stableMaster,
        address whitelisted,
        address governor,
        address[] memory guardians
    ) BaseSurplusConverter(_rewardToken, _feeDistributor, whitelisted, governor, guardians) {
        require(_stableMaster != address(0), "0");
        stableMaster = IStableMasterFront(_stableMaster);
        // This will revert if the rewardToken of this contract is not a sanToken
        address poolManagerInt = ISanToken(_rewardToken).poolManager();
        poolManager = poolManagerInt;
        address supportedTokenInt = IPoolManager(poolManagerInt).token();
        supportedToken = supportedTokenInt;
        IERC20(supportedTokenInt).safeApprove(_stableMaster, type(uint256).max);
    }

    /// @notice Mints `rewardToken` from the protocol itself using the accumulated `token` and distributes
    /// the results of the swaps to the `FeeDistributor` or some other `SurplusConverter` contract
    /// @param token Token to use for buybacks of `rewardToken`
    /// @param amount Amount of tokens to use for the buyback
    /// @param transfer Whether the function should transfer the bought back `rewardToken` directly to the `FeeDistributor`
    /// contract or to the associated `SurplusConverter` contract
    /// @dev In this contract the `rewardToken` is a sanToken, so this function essentially deposits collateral
    /// in the Angle Protocol
    /// @dev There is no need to put slippage protection here as there is no slippage for SLPs deposits in the Angle
    /// Protocol
    function buyback(
        address token,
        uint256 amount,
        uint256,
        bool transfer
    ) external override whenNotPaused onlyRole(WHITELISTED_ROLE) {
        require(token == supportedToken, "20");
        stableMaster.deposit(amount, address(this), poolManager);
        if (transfer) {
            // This call will automatically transfer all the `rewardToken` balance of this contract to the `FeeDistributor`
            feeDistributor.burn(address(rewardToken));
        }
    }
}

File 2 of 20 : 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 3 of 20 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 4 of 20 : 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 20 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 6 of 20 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 7 of 20 : 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 8 of 20 : 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 9 of 20 : 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 10 of 20 : AccessControl.sol
// SPDX-License-Identifier: GPL-3.0

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 11 of 20 : 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 20 : 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 20 : IFeeDistributor.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

/// @title IFeeDistributor
/// @author Interface of the `FeeDistributor` contract
/// @dev This interface is used by the `SurplusConverter` contract to send funds to the `FeeDistributor`
interface IFeeDistributor {
    function burn(address token) external;
}

File 14 of 20 : 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 15 of 20 : 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 16 of 20 : 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 17 of 20 : 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 18 of 20 : 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 19 of 20 : 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
        );
}

File 20 of 20 : BaseSurplusConverter.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

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

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

/// @title BaseSurplusConverter
/// @author Angle Core Team
/// @notice A base contract for the swap tokens from the surplus of the protocol to a reward token
/// (could be ANGLE tokens, or another type of token like sanTokens)
/// @dev All contracts implementing such swap features in Angle should implement this base contract
abstract contract BaseSurplusConverter is AccessControl, Pausable, IFeeDistributor {
    using SafeERC20 for IERC20;

    event FeeDistributorUpdated(address indexed newFeeDistributor, address indexed oldFeeDistributor);
    event Recovered(address indexed tokenAddress, address indexed to, uint256 amount);

    /// @notice Role for governor of this contract
    bytes32 public constant GOVERNOR_ROLE = keccak256("GOVERNOR_ROLE");

    /// @notice Role for guardians of this contract
    bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");

    /// @notice Role for addresses allowed to redistribute the protocol's surplus
    bytes32 public constant WHITELISTED_ROLE = keccak256("WHITELISTED_ROLE");

    /// @notice Address responsible for distributing bought back reward tokens to veANGLE holders or for swapping
    /// the reward token of this contract to another token
    IFeeDistributor public feeDistributor;

    /// @notice Reward Token obtained by this contract
    IERC20 public immutable rewardToken;

    /// @notice Constructor of the `BaseSurplusConverter`
    /// @param _rewardToken Reward token that this contract tries to buy or otain
    /// @param _feeDistributor Reference to the contract handling fee distribution
    /// @param whitelisted Reference to the first whitelisted address that will have the right to perform buybacks
    /// @param governor Governor of the protocol
    /// @param guardians List of guardians of the protocol
    /// @dev Having a list of guardians as a parameter facilitates deployment of the contract
    constructor(
        address _rewardToken,
        address _feeDistributor,
        address whitelisted,
        address governor,
        address[] memory guardians
    ) {
        require(_feeDistributor != address(0) && whitelisted != address(0) && governor != address(0), "0");
        feeDistributor = IFeeDistributor(_feeDistributor);
        rewardToken = IERC20(_rewardToken);
        // The function is going to revert because of the following call if the `_rewardToken` parameter is the
        // zero address
        IERC20(_rewardToken).safeApprove(_feeDistributor, type(uint256).max);
        require(guardians.length > 0, "101");
        for (uint256 i = 0; i < guardians.length; i++) {
            require(guardians[i] != address(0), "0");
            _setupRole(GUARDIAN_ROLE, guardians[i]);
        }
        _setupRole(WHITELISTED_ROLE, whitelisted);
        _setupRole(GOVERNOR_ROLE, governor);
        _setRoleAdmin(GOVERNOR_ROLE, GOVERNOR_ROLE);
        _setRoleAdmin(GUARDIAN_ROLE, GOVERNOR_ROLE);
        _setRoleAdmin(WHITELISTED_ROLE, GUARDIAN_ROLE);
        // Contract is paused after deployment
        _pause();
    }

    /// @notice Changes the reference to the `FeeDistributor` allowed to distribute rewards to veANGLE holders
    /// or to swap the reward token to another token
    /// @param _feeDistributor Reference to the new `FeeDistributor`
    /// @dev This function is a governor only function as it could technically be used to withdraw funds from the protocol
    function setFeeDistributor(address _feeDistributor) external onlyRole(GOVERNOR_ROLE) {
        require(_feeDistributor != address(0), "0");
        address oldFeeDistributor = address(feeDistributor);
        feeDistributor = IFeeDistributor(_feeDistributor);
        IERC20 rewardTokenMem = rewardToken;
        rewardTokenMem.safeApprove(_feeDistributor, type(uint256).max);
        rewardTokenMem.safeApprove(oldFeeDistributor, 0);
        emit FeeDistributorUpdated(_feeDistributor, oldFeeDistributor);
    }

    /// @notice Withdraws ERC20 tokens that could accrue on this contract
    /// @param tokenAddress Address of the ERC20 token to withdraw
    /// @param to Address to transfer to
    /// @param amount Amount to transfer
    /// @dev Added to support recovering rewardToken in case of impossible buybacks
    /// and other tokens mistakenly sent to this contract
    function recoverERC20(
        address tokenAddress,
        address to,
        uint256 amount
    ) external onlyRole(GOVERNOR_ROLE) {
        IERC20(tokenAddress).safeTransfer(to, amount);
        emit Recovered(tokenAddress, to, amount);
    }

    /// @notice Pauses the `buyback`, `sendToFeeDistributor` and `burn` methods
    /// @dev After calling this function, it is going to be impossible for whitelisted addresses to buyback
    /// reward tokens or to send the bought back tokens to the `FeeDistributor`
    function pause() external onlyRole(GUARDIAN_ROLE) {
        _pause();
    }

    /// @notice Unpauses the `buyback` and `sendToFeeDistributor` methods
    function unpause() external onlyRole(GUARDIAN_ROLE) {
        _unpause();
    }

    /// @notice Buys back `rewardToken` using the accumulated `token` and distributes the results of the
    /// swaps to the `feeDistributor` contract (which can be another `SurplusConverter`)
    /// @param token Token to use for buybacks of `rewardToken`
    /// @param amount Amount of tokens to use for the buyback
    /// @param minAmount Specify the minimum amount to receive - slippage protection
    /// @param transfer Whether the function should transfer the bought back `rewardToken` directly to the `FeeDistributor`
    /// contract
    /// @dev This function should revert if `amount` is inferior to the amount of `token` owned by this contract
    /// @dev The reason for the variable `amount` instead of simply using the whole contract's balance for buybacks
    /// is that it gives more flexibility to the addresses handling buyback to optimize for the swap prices
    /// @dev This function should be whitelisted because arbitrageurs could take advantage of it to do sandwich attacks
    /// by just calling this function. Calls to this function could be sandwiched too but it's going harder for miners to
    /// setup sandwich attacks
    function buyback(
        address token,
        uint256 amount,
        uint256 minAmount,
        bool transfer
    ) external virtual;

    /// @notice Pulls tokens from another `SurplusConverter` contract
    /// @param token Address of the token to pull
    /// @dev This function is what allows for composability between different `SurplusConverter` contracts: a surplus converter
    /// having swapped tokens can send its output token to another surplus converter, responsible for doing another type
    /// of conversion, by calling this contract
    function burn(address token) external override whenNotPaused {
        IERC20(token).safeTransferFrom(msg.sender, address(this), IERC20(token).balanceOf(msg.sender));
    }

    /// @notice This function transfers all the accumulated `rewardToken` to the `FeeDistributor` contract
    /// @dev The reason for having this function rather than doing such transfers directly in the `buyback` function is that
    /// it can allow to batch transfers and thus optimizes for gas
    function sendToFeeDistributor() external whenNotPaused {
        feeDistributor.burn(address(rewardToken));
    }
}

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":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_feeDistributor","type":"address"},{"internalType":"address","name":"_stableMaster","type":"address"},{"internalType":"address","name":"whitelisted","type":"address"},{"internalType":"address","name":"governor","type":"address"},{"internalType":"address[]","name":"guardians","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newFeeDistributor","type":"address"},{"indexed":true,"internalType":"address","name":"oldFeeDistributor","type":"address"}],"name":"FeeDistributorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes","name":"newPath","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"oldPath","type":"bytes"}],"name":"PathUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","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":true,"internalType":"address","name":"token","type":"address"}],"name":"TokenRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNOR_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":"WHITELISTED_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"transfer","type":"bool"}],"name":"buyback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeDistributor","outputs":[{"internalType":"contract IFeeDistributor","name":"","type":"address"}],"stateMutability":"view","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":[{"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":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","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":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sendToFeeDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeDistributor","type":"address"}],"name":"setFeeDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stableMaster","outputs":[{"internalType":"contract IStableMasterFront","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"supportedToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101006040523480156200001257600080fd5b50604051620029ea380380620029ea8339810160408190526200003591620009f6565b6001805460ff1916905585858484846001600160a01b038416158015906200006557506001600160a01b03831615155b80156200007a57506001600160a01b03821615155b620000b05760405162461bcd60e51b81526020600482015260016024820152600360fc1b60448201526064015b60405180910390fd5b60018054610100600160a81b0319166101006001600160a01b038781169190910291909117909155606086901b6001600160601b031916608052620001079086168560001962000465602090811b62000d0617901c565b6000815111620001405760405162461bcd60e51b815260206004820152600360248201526231303160e81b6044820152606401620000a7565b60005b8151811015620002045760006001600160a01b03168282815181106200016d576200016d62000c1c565b60200260200101516001600160a01b03161415620001b25760405162461bcd60e51b81526020600482015260016024820152600360fc1b6044820152606401620000a7565b620001ef600080516020620029ca833981519152838381518110620001db57620001db62000c1c565b6020026020010151620005c460201b60201c565b80620001fb8162000bf2565b91505062000143565b5062000220600080516020620029aa83398151915284620005c4565b6200023b6000805160206200298a83398151915283620005c4565b620002566000805160206200298a83398151915280620005d4565b62000280600080516020620029ca8339815191526000805160206200298a833981519152620005d4565b620002aa600080516020620029aa833981519152600080516020620029ca833981519152620005d4565b620002b462000628565b50505050506001600160a01b038416620002f55760405162461bcd60e51b81526020600482015260016024820152600360fc1b6044820152606401620000a7565b836001600160a01b031660a0816001600160a01b031660601b815250506000866001600160a01b031663dc4c90d36040518163ffffffff1660e01b815260040160206040518083038186803b1580156200034e57600080fd5b505afa15801562000363573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003899190620009d8565b9050806001600160a01b031660c0816001600160a01b031660601b815250506000816001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015620003e457600080fd5b505afa158015620003f9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200041f9190620009d8565b606081901b6001600160601b03191660e0529050620004576001600160a01b0382168760001962000465602090811b62000d0617901c565b505050505050505062000c48565b801580620004f35750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015620004b657600080fd5b505afa158015620004cb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004f1919062000b52565b155b620005675760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401620000a7565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620005bf918591620006b116565b505050565b620005d082826200078f565b5050565b600082815260208190526040902060010154819060405184907fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff90600090a460009182526020829052604090912060010155565b60015460ff1615620006705760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401620000a7565b6001805460ff1916811790556040805133815290517f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589181900360200190a1565b60006200070d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200082f60201b62000f15179092919060201c565b805190915015620005bf57808060200190518101906200072e919062000b2e565b620005bf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401620000a7565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620005d0576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620007eb3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60606200084084846000856200084a565b90505b9392505050565b606082471015620008ad5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401620000a7565b843b620008fd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620000a7565b600080866001600160a01b031685876040516200091b919062000b6c565b60006040518083038185875af1925050503d80600081146200095a576040519150601f19603f3d011682016040523d82523d6000602084013e6200095f565b606091505b509092509050620009728282866200097d565b979650505050505050565b606083156200098e57508162000843565b8251156200099f5782518084602001fd5b8160405162461bcd60e51b8152600401620000a7919062000b8a565b80516001600160a01b0381168114620009d357600080fd5b919050565b600060208284031215620009eb57600080fd5b6200084382620009bb565b60008060008060008060c0878903121562000a1057600080fd5b62000a1b87620009bb565b9550602062000a2c818901620009bb565b955062000a3c60408901620009bb565b945062000a4c60608901620009bb565b935062000a5c60808901620009bb565b60a08901519093506001600160401b038082111562000a7a57600080fd5b818a0191508a601f83011262000a8f57600080fd5b81518181111562000aa45762000aa462000c32565b8060051b604051601f19603f8301168101818110858211171562000acc5762000acc62000c32565b604052828152858101935084860182860187018f101562000aec57600080fd5b600095505b8386101562000b1a5762000b0581620009bb565b85526001959095019493860193860162000af1565b508096505050505050509295509295509295565b60006020828403121562000b4157600080fd5b815180151581146200084357600080fd5b60006020828403121562000b6557600080fd5b5051919050565b6000825162000b8081846020870162000bbf565b9190910192915050565b602081526000825180602084015262000bab81604085016020870162000bbf565b601f01601f19169190910160400192915050565b60005b8381101562000bdc57818101518382015260200162000bc2565b8381111562000bec576000848401525b50505050565b600060001982141562000c1557634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60805160601c60a05160601c60c05160601c60e05160601c611cd262000cb8600039600081816101db01526108de0152600081816103d101526109db0152600081816102bc0152610a030152600081816103f8015281816105b001528181610aa50152610c110152611cd26000f3fe608060405234801561001057600080fd5b50600436106101825760003560e01c80637a3226ec116100d8578063adce20581161008c578063d547741f11610066578063d547741f146103b9578063dc4c90d3146103cc578063f7c618c1146103f357600080fd5b8063adce20581461036c578063ccc574901461037f578063ccfc2e8d146103a657600080fd5b806389afcb44116100bd57806389afcb441461030d57806391d1485414610320578063a217fddf1461036457600080fd5b80637a3226ec146102de5780638456cb591461030557600080fd5b80632f2ff15d1161013a5780633f4ba83a116101145780633f4ba83a146102985780635c975abb146102a05780636ac5dc46146102b757600080fd5b80632f2ff15d1461026a57806333baecb21461027d57806336568abe1461028557600080fd5b80631171bda91161016b5780631171bda9146101fd578063248a9ca31461021257806324ea54f41461024357600080fd5b80630d43e8ad146101875780630ee0599c146101d6575b600080fd5b6001546101ac90610100900473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101ac7f000000000000000000000000000000000000000000000000000000000000000081565b61021061020b36600461195e565b61041a565b005b6102356102203660046119ff565b60009081526020819052604090206001015490565b6040519081526020016101cd565b6102357f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504181565b610210610278366004611a18565b6104d3565b6102106104fe565b610210610293366004611a18565b61061d565b6102106106aa565b60015460ff165b60405190151581526020016101cd565b6101ac7f000000000000000000000000000000000000000000000000000000000000000081565b6102357f8429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b4981565b6102106106e0565b61021061031b366004611943565b610713565b6102a761032e366004611a18565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b610235600081565b61021061037a36600461199a565b610844565b6102357f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6102106103b4366004611943565b610b18565b6102106103c7366004611a18565b610ce0565b6101ac7f000000000000000000000000000000000000000000000000000000000000000081565b6101ac7f000000000000000000000000000000000000000000000000000000000000000081565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556104458133610f2e565b61046673ffffffffffffffffffffffffffffffffffffffff85168484610ffe565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b648846040516104c591815260200190565b60405180910390a350505050565b6000828152602081905260409020600101546104ef8133610f2e565b6104f98383611054565b505050565b60015460ff1615610570576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064015b60405180910390fd5b6001546040517f89afcb4400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081166004830152610100909204909116906389afcb4490602401600060405180830381600087803b15801561060357600080fd5b505af1158015610617573d6000803e3d6000fd5b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116331461069c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f37310000000000000000000000000000000000000000000000000000000000006044820152606401610567565b6106a68282611144565b5050565b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a50416106d58133610f2e565b6106dd6111fb565b50565b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504161070b8133610f2e565b6106dd6112dc565b60015460ff1615610780576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610567565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482018190526106dd91309073ffffffffffffffffffffffffffffffffffffffff8516906370a082319060240160206040518083038186803b1580156107ed57600080fd5b505afa158015610801573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108259190611a44565b73ffffffffffffffffffffffffffffffffffffffff851692919061139a565b60015460ff16156108b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610567565b7f8429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b496108dc8133610f2e565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614610991576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f32300000000000000000000000000000000000000000000000000000000000006044820152606401610567565b6040517f2e2d29840000000000000000000000000000000000000000000000000000000081526004810185905230602482015273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660448301527f00000000000000000000000000000000000000000000000000000000000000001690632e2d298490606401600060405180830381600087803b158015610a4757600080fd5b505af1158015610a5b573d6000803e3d6000fd5b505050508115610b11576001546040517f89afcb4400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081166004830152610100909204909116906389afcb4490602401600060405180830381600087803b158015610af857600080fd5b505af1158015610b0c573d6000803e3d6000fd5b505050505b5050505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610b438133610f2e565b73ffffffffffffffffffffffffffffffffffffffff8216610bc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f30000000000000000000000000000000000000000000000000000000000000006044820152606401610567565b6001805473ffffffffffffffffffffffffffffffffffffffff8481166101009081027fffffffffffffffffffffff0000000000000000000000000000000000000000ff8416179093559190048116907f000000000000000000000000000000000000000000000000000000000000000090610c5e908216857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610d06565b610c8073ffffffffffffffffffffffffffffffffffffffff8216836000610d06565b8173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fbb470d12faa974cbae56bc3c345446451b4d504aa13806836f3df6d032fa9a9160405160405180910390a350505050565b600082815260208190526040902060010154610cfc8133610f2e565b6104f98383611144565b801580610db557506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e9060440160206040518083038186803b158015610d7b57600080fd5b505afa158015610d8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db39190611a44565b155b610e41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610567565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104f99084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526113f8565b6060610f248484600085611504565b90505b9392505050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166106a657610f848173ffffffffffffffffffffffffffffffffffffffff166014611684565b610f8f836020611684565b604051602001610fa0929190611a79565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261056791600401611afa565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104f99084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610e93565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166106a65760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556110e63390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156106a65760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60015460ff16611267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610567565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b60015460ff1615611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610567565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336112b2565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526106179085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610e93565b600061145a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610f159092919063ffffffff16565b8051909150156104f9578080602001905181019061147891906119e2565b6104f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610567565b606082471015611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610567565b843b6115fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610567565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516116279190611a5d565b60006040518083038185875af1925050503d8060008114611664576040519150601f19603f3d011682016040523d82523d6000602084013e611669565b606091505b50915091506116798282866118c7565b979650505050505050565b60606000611693836002611b63565b61169e906002611b4b565b67ffffffffffffffff8111156116b6576116b6611c5f565b6040519080825280601f01601f1916602001820160405280156116e0576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061171757611717611c30565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061177a5761177a611c30565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006117b6846002611b63565b6117c1906001611b4b565b90505b600181111561185e577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061180257611802611c30565b1a60f81b82828151811061181857611818611c30565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361185781611bcc565b90506117c4565b508315610f27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610567565b606083156118d6575081610f27565b8251156118e65782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105679190611afa565b803573ffffffffffffffffffffffffffffffffffffffff8116811461193e57600080fd5b919050565b60006020828403121561195557600080fd5b610f278261191a565b60008060006060848603121561197357600080fd5b61197c8461191a565b925061198a6020850161191a565b9150604084013590509250925092565b600080600080608085870312156119b057600080fd5b6119b98561191a565b9350602085013592506040850135915060608501356119d781611c8e565b939692955090935050565b6000602082840312156119f457600080fd5b8151610f2781611c8e565b600060208284031215611a1157600080fd5b5035919050565b60008060408385031215611a2b57600080fd5b82359150611a3b6020840161191a565b90509250929050565b600060208284031215611a5657600080fd5b5051919050565b60008251611a6f818460208701611ba0565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611ab1816017850160208801611ba0565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611aee816028840160208801611ba0565b01602801949350505050565b6020815260008251806020840152611b19816040850160208701611ba0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008219821115611b5e57611b5e611c01565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611b9b57611b9b611c01565b500290565b60005b83811015611bbb578181015183820152602001611ba3565b838111156106175750506000910152565b600081611bdb57611bdb611c01565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b80151581146106dd57600080fdfea26469706673582212208e60ce30d4c86e17b95ae9d97faf23f0cdb79e09a988c035097ce068377f06c264736f6c634300080700337935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f558429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b4955435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a50410000000000000000000000009c215206da4bf108ae5aeef9da7cad3352a36dad0000000000000000000000007f82ff050128e29fd89d85d01b93246f744e62a00000000000000000000000005addc89785d75c86ab939e9e15bfbbb7fc086a870000000000000000000000002acd062cf718c87c9a58382f01c5b51a0f287c8d000000000000000000000000dc4e6dfe07efca50a197df15d9200883ef4eb1c800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000c2553e4b9dfa9f83b1a6d3eab96c4baab42d430

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101825760003560e01c80637a3226ec116100d8578063adce20581161008c578063d547741f11610066578063d547741f146103b9578063dc4c90d3146103cc578063f7c618c1146103f357600080fd5b8063adce20581461036c578063ccc574901461037f578063ccfc2e8d146103a657600080fd5b806389afcb44116100bd57806389afcb441461030d57806391d1485414610320578063a217fddf1461036457600080fd5b80637a3226ec146102de5780638456cb591461030557600080fd5b80632f2ff15d1161013a5780633f4ba83a116101145780633f4ba83a146102985780635c975abb146102a05780636ac5dc46146102b757600080fd5b80632f2ff15d1461026a57806333baecb21461027d57806336568abe1461028557600080fd5b80631171bda91161016b5780631171bda9146101fd578063248a9ca31461021257806324ea54f41461024357600080fd5b80630d43e8ad146101875780630ee0599c146101d6575b600080fd5b6001546101ac90610100900473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101ac7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b61021061020b36600461195e565b61041a565b005b6102356102203660046119ff565b60009081526020819052604090206001015490565b6040519081526020016101cd565b6102357f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504181565b610210610278366004611a18565b6104d3565b6102106104fe565b610210610293366004611a18565b61061d565b6102106106aa565b60015460ff165b60405190151581526020016101cd565b6101ac7f0000000000000000000000005addc89785d75c86ab939e9e15bfbbb7fc086a8781565b6102357f8429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b4981565b6102106106e0565b61021061031b366004611943565b610713565b6102a761032e366004611a18565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b610235600081565b61021061037a36600461199a565b610844565b6102357f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6102106103b4366004611943565b610b18565b6102106103c7366004611a18565b610ce0565b6101ac7f000000000000000000000000e9f183fc656656f1f17af1f2b0df79b8ff9ad8ed81565b6101ac7f0000000000000000000000009c215206da4bf108ae5aeef9da7cad3352a36dad81565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556104458133610f2e565b61046673ffffffffffffffffffffffffffffffffffffffff85168484610ffe565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b648846040516104c591815260200190565b60405180910390a350505050565b6000828152602081905260409020600101546104ef8133610f2e565b6104f98383611054565b505050565b60015460ff1615610570576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064015b60405180910390fd5b6001546040517f89afcb4400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009c215206da4bf108ae5aeef9da7cad3352a36dad81166004830152610100909204909116906389afcb4490602401600060405180830381600087803b15801561060357600080fd5b505af1158015610617573d6000803e3d6000fd5b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116331461069c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f37310000000000000000000000000000000000000000000000000000000000006044820152606401610567565b6106a68282611144565b5050565b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a50416106d58133610f2e565b6106dd6111fb565b50565b7f55435dd261a4b9b3364963f7738a7a662ad9c84396d64be3365284bb7f0a504161070b8133610f2e565b6106dd6112dc565b60015460ff1615610780576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610567565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482018190526106dd91309073ffffffffffffffffffffffffffffffffffffffff8516906370a082319060240160206040518083038186803b1580156107ed57600080fd5b505afa158015610801573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108259190611a44565b73ffffffffffffffffffffffffffffffffffffffff851692919061139a565b60015460ff16156108b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610567565b7f8429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b496108dc8133610f2e565b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4873ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614610991576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f32300000000000000000000000000000000000000000000000000000000000006044820152606401610567565b6040517f2e2d29840000000000000000000000000000000000000000000000000000000081526004810185905230602482015273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e9f183fc656656f1f17af1f2b0df79b8ff9ad8ed811660448301527f0000000000000000000000005addc89785d75c86ab939e9e15bfbbb7fc086a871690632e2d298490606401600060405180830381600087803b158015610a4757600080fd5b505af1158015610a5b573d6000803e3d6000fd5b505050508115610b11576001546040517f89afcb4400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009c215206da4bf108ae5aeef9da7cad3352a36dad81166004830152610100909204909116906389afcb4490602401600060405180830381600087803b158015610af857600080fd5b505af1158015610b0c573d6000803e3d6000fd5b505050505b5050505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610b438133610f2e565b73ffffffffffffffffffffffffffffffffffffffff8216610bc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f30000000000000000000000000000000000000000000000000000000000000006044820152606401610567565b6001805473ffffffffffffffffffffffffffffffffffffffff8481166101009081027fffffffffffffffffffffff0000000000000000000000000000000000000000ff8416179093559190048116907f0000000000000000000000009c215206da4bf108ae5aeef9da7cad3352a36dad90610c5e908216857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610d06565b610c8073ffffffffffffffffffffffffffffffffffffffff8216836000610d06565b8173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fbb470d12faa974cbae56bc3c345446451b4d504aa13806836f3df6d032fa9a9160405160405180910390a350505050565b600082815260208190526040902060010154610cfc8133610f2e565b6104f98383611144565b801580610db557506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e9060440160206040518083038186803b158015610d7b57600080fd5b505afa158015610d8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db39190611a44565b155b610e41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610567565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104f99084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526113f8565b6060610f248484600085611504565b90505b9392505050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166106a657610f848173ffffffffffffffffffffffffffffffffffffffff166014611684565b610f8f836020611684565b604051602001610fa0929190611a79565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261056791600401611afa565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104f99084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610e93565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166106a65760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556110e63390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156106a65760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60015460ff16611267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610567565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b60015460ff1615611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610567565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336112b2565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526106179085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610e93565b600061145a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610f159092919063ffffffff16565b8051909150156104f9578080602001905181019061147891906119e2565b6104f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610567565b606082471015611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610567565b843b6115fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610567565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516116279190611a5d565b60006040518083038185875af1925050503d8060008114611664576040519150601f19603f3d011682016040523d82523d6000602084013e611669565b606091505b50915091506116798282866118c7565b979650505050505050565b60606000611693836002611b63565b61169e906002611b4b565b67ffffffffffffffff8111156116b6576116b6611c5f565b6040519080825280601f01601f1916602001820160405280156116e0576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061171757611717611c30565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061177a5761177a611c30565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006117b6846002611b63565b6117c1906001611b4b565b90505b600181111561185e577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061180257611802611c30565b1a60f81b82828151811061181857611818611c30565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361185781611bcc565b90506117c4565b508315610f27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610567565b606083156118d6575081610f27565b8251156118e65782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105679190611afa565b803573ffffffffffffffffffffffffffffffffffffffff8116811461193e57600080fd5b919050565b60006020828403121561195557600080fd5b610f278261191a565b60008060006060848603121561197357600080fd5b61197c8461191a565b925061198a6020850161191a565b9150604084013590509250925092565b600080600080608085870312156119b057600080fd5b6119b98561191a565b9350602085013592506040850135915060608501356119d781611c8e565b939692955090935050565b6000602082840312156119f457600080fd5b8151610f2781611c8e565b600060208284031215611a1157600080fd5b5035919050565b60008060408385031215611a2b57600080fd5b82359150611a3b6020840161191a565b90509250929050565b600060208284031215611a5657600080fd5b5051919050565b60008251611a6f818460208701611ba0565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611ab1816017850160208801611ba0565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611aee816028840160208801611ba0565b01602801949350505050565b6020815260008251806020840152611b19816040850160208701611ba0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008219821115611b5e57611b5e611c01565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611b9b57611b9b611c01565b500290565b60005b83811015611bbb578181015183820152602001611ba3565b838111156106175750506000910152565b600081611bdb57611bdb611c01565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b80151581146106dd57600080fdfea26469706673582212208e60ce30d4c86e17b95ae9d97faf23f0cdb79e09a988c035097ce068377f06c264736f6c63430008070033

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

0000000000000000000000009c215206da4bf108ae5aeef9da7cad3352a36dad0000000000000000000000007f82ff050128e29fd89d85d01b93246f744e62a00000000000000000000000005addc89785d75c86ab939e9e15bfbbb7fc086a870000000000000000000000002acd062cf718c87c9a58382f01c5b51a0f287c8d000000000000000000000000dc4e6dfe07efca50a197df15d9200883ef4eb1c800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000c2553e4b9dfa9f83b1a6d3eab96c4baab42d430

-----Decoded View---------------
Arg [0] : _rewardToken (address): 0x9C215206Da4bf108aE5aEEf9dA7caD3352A36Dad
Arg [1] : _feeDistributor (address): 0x7F82ff050128e29Fd89D85d01b93246F744E62A0
Arg [2] : _stableMaster (address): 0x5adDc89785D75C86aB939E9e15bfBBb7Fc086A87
Arg [3] : whitelisted (address): 0x2Acd062Cf718c87c9A58382f01C5b51a0f287C8D
Arg [4] : governor (address): 0xdC4e6DFe07EFCa50a197DF15D9200883eF4Eb1c8
Arg [5] : guardians (address[]): 0x0C2553e4B9dFA9f83b1A6D3EAB96c4bAaB42d430

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000009c215206da4bf108ae5aeef9da7cad3352a36dad
Arg [1] : 0000000000000000000000007f82ff050128e29fd89d85d01b93246f744e62a0
Arg [2] : 0000000000000000000000005addc89785d75c86ab939e9e15bfbbb7fc086a87
Arg [3] : 0000000000000000000000002acd062cf718c87c9a58382f01c5b51a0f287c8d
Arg [4] : 000000000000000000000000dc4e6dfe07efca50a197df15d9200883ef4eb1c8
Arg [5] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [7] : 0000000000000000000000000c2553e4b9dfa9f83b1a6d3eab96c4baab42d430


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.