Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 216215579 | 606 days ago | Contract Creation | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SavingsNameable
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 1000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;
import "../Savings.sol";
/// @title SavingsNameable
/// @author Angle Labs, Inc.
contract SavingsNameable is Savings {
string internal __name;
string internal __symbol;
uint256[48] private __gapNameable;
/// @inheritdoc ERC20Upgradeable
function name() public view override(ERC20Upgradeable, IERC20MetadataUpgradeable) returns (string memory) {
return __name;
}
/// @inheritdoc ERC20Upgradeable
function symbol() public view override(ERC20Upgradeable, IERC20MetadataUpgradeable) returns (string memory) {
return __symbol;
}
/// @notice Updates the name and symbol of the token
function setNameAndSymbol(string memory newName, string memory newSymbol) external onlyGovernor {
_setNameAndSymbol(newName, newSymbol);
}
function _setNameAndSymbol(string memory newName, string memory newSymbol) internal override {
__name = newName;
__symbol = newSymbol;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;
import "./BaseSavings.sol";
/// @title Savings
/// @author Angle Labs, Inc.
/// @notice In this implementation, assets in the contract increase in value following a `rate` chosen by governance
contract Savings is BaseSavings {
using SafeERC20 for IERC20;
using MathUpgradeable for uint256;
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
PARAMETERS / REFERENCES
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Inflation rate (per second) in BASE_27
uint208 public rate;
/// @notice Last time rewards were accrued
uint40 public lastUpdate;
/// @notice Whether the contract is paused or not
uint8 public paused;
/// @notice Maximum inflation rate
/// @dev Note that `rate` can still be greater than `maxRate` if this `maxRate` is reduced by governance
/// to a level inferior to the current rate
uint256 public maxRate;
/// @notice Checks whether the address is trusted to set the rate
mapping(address => uint256) public isTrustedUpdater;
uint256[48] private __gap;
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
event Accrued(uint256 interest);
event MaxRateUpdated(uint256 newMaxRate);
event ToggledPause(uint128 pauseStatus);
event ToggledTrusted(address indexed trustedAddress, uint256 trustedStatus);
event RateUpdated(uint256 newRate);
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
INITIALIZATION
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
/// @notice Initializes the contract
/// @param _accessControlManager Reference to the `AccessControlManager` contract
/// @param name_ Name of the savings contract
/// @param symbol_ Symbol of the savings contract
/// @param divizer Quantifies the first initial deposit (should be typically 1 for tokens like agEUR)
/// @dev A first deposit is done at initialization to protect for the classical issue of ERC4626 contracts
/// where the the first user of the contract tries to steal everyone else's tokens
function initialize(
IAccessControlManager _accessControlManager,
IERC20MetadataUpgradeable asset_,
string memory name_,
string memory symbol_,
uint256 divizer
) public initializer {
if (address(_accessControlManager) == address(0)) revert ZeroAddress();
__ERC4626_init(asset_);
__ERC20_init(name_, symbol_);
_setNameAndSymbol(name_, symbol_);
accessControlManager = _accessControlManager;
_deposit(msg.sender, address(this), 10 ** (asset_.decimals()) / divizer, BASE_18 / divizer);
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MODIFIERS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Checks whether the whole contract is paused or not
modifier whenNotPaused() {
if (paused > 0) revert Paused();
_;
}
/// @notice Checks whether the sender is allowed to update the rate
modifier onlyTrustedOrGuardian() {
if (isTrustedUpdater[msg.sender] == 0 && !accessControlManager.isGovernorOrGuardian(msg.sender))
revert NotTrusted();
_;
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CONTRACT LOGIC
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Accrues interest to this contract by minting agTokens
function _accrue() internal returns (uint256 newTotalAssets) {
uint256 currentBalance = super.totalAssets();
newTotalAssets = _computeUpdatedAssets(currentBalance, block.timestamp - lastUpdate);
lastUpdate = uint40(block.timestamp);
uint256 earned = newTotalAssets - currentBalance;
if (earned > 0) {
IAgToken(asset()).mint(address(this), earned);
emit Accrued(earned);
}
}
/// @notice Computes how much `currentBalance` held in the contract would be after `exp` time following
/// the `rate` of increase
function _computeUpdatedAssets(uint256 currentBalance, uint256 exp) internal view returns (uint256) {
uint256 ratePerSecond = rate;
if (exp == 0 || ratePerSecond == 0) return currentBalance;
uint256 expMinusOne = exp - 1;
uint256 expMinusTwo = exp > 2 ? exp - 2 : 0;
uint256 basePowerTwo = (ratePerSecond * ratePerSecond + HALF_BASE_27) / BASE_27;
uint256 basePowerThree = (basePowerTwo * ratePerSecond + HALF_BASE_27) / BASE_27;
uint256 secondTerm = (exp * expMinusOne * basePowerTwo) / 2;
uint256 thirdTerm = (exp * expMinusOne * expMinusTwo * basePowerThree) / 6;
return (currentBalance * (BASE_27 + ratePerSecond * exp + secondTerm + thirdTerm)) / BASE_27;
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ERC4626 VIEW FUNCTIONS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @inheritdoc ERC4626Upgradeable
function totalAssets() public view override returns (uint256) {
return _computeUpdatedAssets(super.totalAssets(), block.timestamp - lastUpdate);
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ERC4626 INTERACTION FUNCTIONS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @inheritdoc ERC4626Upgradeable
function deposit(uint256 assets, address receiver) public override whenNotPaused returns (uint256 shares) {
uint256 newTotalAssets = _accrue();
shares = _convertToShares(assets, newTotalAssets, MathUpgradeable.Rounding.Down);
_deposit(_msgSender(), receiver, assets, shares);
}
/// @inheritdoc ERC4626Upgradeable
function mint(uint256 shares, address receiver) public override whenNotPaused returns (uint256 assets) {
uint256 newTotalAssets = _accrue();
assets = _convertToAssets(shares, newTotalAssets, MathUpgradeable.Rounding.Up);
_deposit(_msgSender(), receiver, assets, shares);
}
/// @inheritdoc ERC4626Upgradeable
function withdraw(
uint256 assets,
address receiver,
address owner
) public override whenNotPaused returns (uint256 shares) {
uint256 newTotalAssets = _accrue();
shares = _convertToShares(assets, newTotalAssets, MathUpgradeable.Rounding.Up);
_withdraw(_msgSender(), receiver, owner, assets, shares);
}
/// @inheritdoc ERC4626Upgradeable
function redeem(
uint256 shares,
address receiver,
address owner
) public override whenNotPaused returns (uint256 assets) {
uint256 newTotalAssets = _accrue();
assets = _convertToAssets(shares, newTotalAssets, MathUpgradeable.Rounding.Down);
_withdraw(_msgSender(), receiver, owner, assets, shares);
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
INTERNAL HELPERS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @inheritdoc ERC4626Upgradeable
function _convertToShares(
uint256 assets,
MathUpgradeable.Rounding rounding
) internal view override returns (uint256 shares) {
return _convertToShares(assets, totalAssets(), rounding);
}
/// @notice Same as the function above except that the `totalAssets` value does not have to be recomputed here
function _convertToShares(
uint256 assets,
uint256 newTotalAssets,
MathUpgradeable.Rounding rounding
) internal view returns (uint256 shares) {
uint256 supply = totalSupply();
return
(assets == 0 || supply == 0)
? assets.mulDiv(BASE_18, 10 ** (IERC20MetadataUpgradeable(asset()).decimals()), rounding)
: assets.mulDiv(supply, newTotalAssets, rounding);
}
/// @inheritdoc ERC4626Upgradeable
function _convertToAssets(
uint256 shares,
MathUpgradeable.Rounding rounding
) internal view override returns (uint256 assets) {
return _convertToAssets(shares, totalAssets(), rounding);
}
/// @notice Same as the function above except that the `totalAssets` value does not have to be recomputed here
function _convertToAssets(
uint256 shares,
uint256 newTotalAssets,
MathUpgradeable.Rounding rounding
) internal view returns (uint256 assets) {
uint256 supply = totalSupply();
return
(supply == 0)
? shares.mulDiv(10 ** (IERC20MetadataUpgradeable(asset()).decimals()), BASE_18, rounding)
: shares.mulDiv(newTotalAssets, supply, rounding);
}
function _setNameAndSymbol(string memory newName, string memory newSymbol) internal virtual {}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
HELPERS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Provides an estimated Annual Percentage Rate for base depositors on this contract
function estimatedAPR() external view returns (uint256 apr) {
// 365 days = 31536000 seconds
return _computeUpdatedAssets(BASE_18, 31536000) - BASE_18;
}
/// @notice Wrapper on top of the `computeUpdatedAssets` function
function computeUpdatedAssets(uint256 _totalAssets, uint256 exp) external view returns (uint256) {
return _computeUpdatedAssets(_totalAssets, exp);
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
GOVERNANCE
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Pauses the contract
function togglePause() external onlyGuardian {
uint8 pauseStatus = 1 - paused;
paused = pauseStatus;
emit ToggledPause(pauseStatus);
}
/// @notice Toggles an address
function toggleTrusted(address trustedAddress) external onlyGuardian {
uint256 trustedStatus = 1 - isTrustedUpdater[trustedAddress];
isTrustedUpdater[trustedAddress] = trustedStatus;
emit ToggledTrusted(trustedAddress, trustedStatus);
}
/// @notice Updates the inflation rate for depositing `asset` in this contract
/// @dev Any `rate` can be set by the guardian or by a trusted address provided that it is inferior to
///the `maxRate` settable by a governor address
function setRate(uint208 newRate) external onlyTrustedOrGuardian {
if (newRate > maxRate) revert InvalidRate();
_accrue();
rate = newRate;
emit RateUpdated(newRate);
}
/// @notice Updates the maximum rate settable
function setMaxRate(uint256 newMaxRate) external onlyGovernor {
maxRate = newMaxRate;
emit MaxRateUpdated(newMaxRate);
}
}// SPDX-License-Identifier: BUSL-1.1
/*
* █
***** ▓▓▓
* ▓▓▓▓▓▓▓
* ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓
***** //////// ▓▓▓▓▓▓▓
* ///////////// ▓▓▓
▓▓ ////////////////// █ ▓▓
▓▓ ▓▓ /////////////////////// ▓▓ ▓▓
▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓
▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓
▓▓ ,////////////////////////////////////// ▓▓ ▓▓
▓▓ ////////////////////////////////////////// ▓▓
▓▓ //////////////////////▓▓▓▓/////////////////////
,////////////////////////////////////////////////////
.//////////////////////////////////////////////////////////
.//////////////////////////██.,//////////////////////////█
.//////////////////////████..,./////////////////////██
...////////////////███████.....,.////////////////███
,.,////////////████████ ........,///////////████
.,.,//////█████████ ,.......///////████
,..//████████ ........./████
..,██████ .....,███
.██ ,.,█
▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓
▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓
▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓
*/
pragma solidity ^0.8.19;
import "oz-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol";
import "oz/interfaces/IERC20.sol";
import "oz/token/ERC20/utils/SafeERC20.sol";
import { IAgToken } from "interfaces/IAgToken.sol";
import { AccessControl, IAccessControlManager } from "../utils/AccessControl.sol";
import "../utils/Constants.sol";
import "../utils/Errors.sol";
/// @title BaseSavings
/// @author Angle Labs, Inc.
/// @notice Angle Savings contracts are contracts where users can deposit an `asset` and earn a yield on this asset
/// when it is distributed
/// @dev These contracts are functional within the Transmuter system if they have mint right on `asset` and
/// if they are trusted by the Transmuter contract
/// @dev Implementations assume that `asset` is safe to interact with, on which there cannot be reentrancy attacks
/// @dev The ERC4626 interface does not allow users to specify a slippage protection parameter for the main entry points
/// (like `deposit`, `mint`, `redeem` or `withdraw`). Even though there should be no specific sandwiching
/// issue with current implementations, it is still recommended to interact with Angle Savings contracts
/// through a router that can implement such a protection.
abstract contract BaseSavings is ERC4626Upgradeable, AccessControl {
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC4626.sol)
pragma solidity ^0.8.0;
import "../ERC20Upgradeable.sol";
import "../utils/SafeERC20Upgradeable.sol";
import "../../../interfaces/IERC4626Upgradeable.sol";
import "../../../utils/math/MathUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the ERC4626 "Tokenized Vault Standard" as defined in
* https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].
*
* This extension allows the minting and burning of "shares" (represented using the ERC20 inheritance) in exchange for
* underlying "assets" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends
* the ERC20 standard. Any additional extensions included along it would affect the "shares" token represented by this
* contract and not the "assets" token which is an independent contract.
*
* CAUTION: Deposits and withdrawals may incur unexpected slippage. Users should verify that the amount received of
* shares or assets is as expected. EOAs should operate through a wrapper that performs these checks such as
* https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].
*
* _Available since v4.7._
*/
abstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626Upgradeable {
using MathUpgradeable for uint256;
IERC20MetadataUpgradeable private _asset;
/**
* @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).
*/
function __ERC4626_init(IERC20MetadataUpgradeable asset_) internal onlyInitializing {
__ERC4626_init_unchained(asset_);
}
function __ERC4626_init_unchained(IERC20MetadataUpgradeable asset_) internal onlyInitializing {
_asset = asset_;
}
/** @dev See {IERC4262-asset}. */
function asset() public view virtual override returns (address) {
return address(_asset);
}
/** @dev See {IERC4262-totalAssets}. */
function totalAssets() public view virtual override returns (uint256) {
return _asset.balanceOf(address(this));
}
/** @dev See {IERC4262-convertToShares}. */
function convertToShares(uint256 assets) public view virtual override returns (uint256 shares) {
return _convertToShares(assets, MathUpgradeable.Rounding.Down);
}
/** @dev See {IERC4262-convertToAssets}. */
function convertToAssets(uint256 shares) public view virtual override returns (uint256 assets) {
return _convertToAssets(shares, MathUpgradeable.Rounding.Down);
}
/** @dev See {IERC4262-maxDeposit}. */
function maxDeposit(address) public view virtual override returns (uint256) {
return _isVaultCollateralized() ? type(uint256).max : 0;
}
/** @dev See {IERC4262-maxMint}. */
function maxMint(address) public view virtual override returns (uint256) {
return type(uint256).max;
}
/** @dev See {IERC4262-maxWithdraw}. */
function maxWithdraw(address owner) public view virtual override returns (uint256) {
return _convertToAssets(balanceOf(owner), MathUpgradeable.Rounding.Down);
}
/** @dev See {IERC4262-maxRedeem}. */
function maxRedeem(address owner) public view virtual override returns (uint256) {
return balanceOf(owner);
}
/** @dev See {IERC4262-previewDeposit}. */
function previewDeposit(uint256 assets) public view virtual override returns (uint256) {
return _convertToShares(assets, MathUpgradeable.Rounding.Down);
}
/** @dev See {IERC4262-previewMint}. */
function previewMint(uint256 shares) public view virtual override returns (uint256) {
return _convertToAssets(shares, MathUpgradeable.Rounding.Up);
}
/** @dev See {IERC4262-previewWithdraw}. */
function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {
return _convertToShares(assets, MathUpgradeable.Rounding.Up);
}
/** @dev See {IERC4262-previewRedeem}. */
function previewRedeem(uint256 shares) public view virtual override returns (uint256) {
return _convertToAssets(shares, MathUpgradeable.Rounding.Down);
}
/** @dev See {IERC4262-deposit}. */
function deposit(uint256 assets, address receiver) public virtual override returns (uint256) {
require(assets <= maxDeposit(receiver), "ERC4626: deposit more than max");
uint256 shares = previewDeposit(assets);
_deposit(_msgSender(), receiver, assets, shares);
return shares;
}
/** @dev See {IERC4262-mint}. */
function mint(uint256 shares, address receiver) public virtual override returns (uint256) {
require(shares <= maxMint(receiver), "ERC4626: mint more than max");
uint256 assets = previewMint(shares);
_deposit(_msgSender(), receiver, assets, shares);
return assets;
}
/** @dev See {IERC4262-withdraw}. */
function withdraw(
uint256 assets,
address receiver,
address owner
) public virtual override returns (uint256) {
require(assets <= maxWithdraw(owner), "ERC4626: withdraw more than max");
uint256 shares = previewWithdraw(assets);
_withdraw(_msgSender(), receiver, owner, assets, shares);
return shares;
}
/** @dev See {IERC4262-redeem}. */
function redeem(
uint256 shares,
address receiver,
address owner
) public virtual override returns (uint256) {
require(shares <= maxRedeem(owner), "ERC4626: redeem more than max");
uint256 assets = previewRedeem(shares);
_withdraw(_msgSender(), receiver, owner, assets, shares);
return assets;
}
/**
* @dev Internal conversion function (from assets to shares) with support for rounding direction.
*
* Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset
* would represent an infinite amout of shares.
*/
function _convertToShares(uint256 assets, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 shares) {
uint256 supply = totalSupply();
return
(assets == 0 || supply == 0)
? assets.mulDiv(10**decimals(), 10**_asset.decimals(), rounding)
: assets.mulDiv(supply, totalAssets(), rounding);
}
/**
* @dev Internal conversion function (from shares to assets) with support for rounding direction.
*/
function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 assets) {
uint256 supply = totalSupply();
return
(supply == 0)
? shares.mulDiv(10**_asset.decimals(), 10**decimals(), rounding)
: shares.mulDiv(totalAssets(), supply, rounding);
}
/**
* @dev Deposit/mint common workflow.
*/
function _deposit(
address caller,
address receiver,
uint256 assets,
uint256 shares
) internal virtual {
// If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the
// `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,
// calls the vault, which is assumed not malicious.
//
// Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the
// assets are transfered and before the shares are minted, which is a valid state.
// slither-disable-next-line reentrancy-no-eth
SafeERC20Upgradeable.safeTransferFrom(_asset, caller, address(this), assets);
_mint(receiver, shares);
emit Deposit(caller, receiver, assets, shares);
}
/**
* @dev Withdraw/redeem common workflow.
*/
function _withdraw(
address caller,
address receiver,
address owner,
uint256 assets,
uint256 shares
) internal virtual {
if (caller != owner) {
_spendAllowance(owner, caller, shares);
}
// If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the
// `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,
// calls the vault, which is assumed not malicious.
//
// Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the
// shares are burned and after the assets are transfered, which is a valid state.
_burn(owner, shares);
SafeERC20Upgradeable.safeTransfer(_asset, receiver, assets);
emit Withdraw(caller, receiver, owner, assets, shares);
}
function _isVaultCollateralized() private view returns (bool) {
return totalAssets() > 0 || totalSupply() == 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.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));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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");
}
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0;
import { IERC20 } from "oz/token/ERC20/IERC20.sol";
/// @title IAgToken
/// @author Angle Labs, Inc.
/// @notice Interface for the stablecoins `AgToken` contracts
interface IAgToken is IERC20 {
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MINTER ROLE ONLY FUNCTIONS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Lets a whitelisted contract mint agTokens
/// @param account Address to mint to
/// @param amount Amount to mint
function mint(address account, uint256 amount) external;
/// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`
/// @param amount Amount of tokens to burn
/// @param burner Address to burn from
/// @param sender Address which requested the burn from `burner`
/// @dev This method is to be called by a contract with the minter right after being requested
/// to do so by a `sender` address willing to burn tokens from another `burner` address
/// @dev The method checks the allowance between the `sender` and the `burner`
function burnFrom(uint256 amount, address burner, address sender) external;
/// @notice Burns `amount` tokens from a `burner` address
/// @param amount Amount of tokens to burn
/// @param burner Address to burn from
/// @dev This method is to be called by a contract with a minter right on the AgToken after being
/// requested to do so by an address willing to burn tokens from its address
function burnSelf(uint256 amount, address burner) external;
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TREASURY ONLY FUNCTIONS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Adds a minter in the contract
/// @param minter Minter address to add
/// @dev Zero address checks are performed directly in the `Treasury` contract
function addMinter(address minter) external;
/// @notice Removes a minter from the contract
/// @param minter Minter address to remove
/// @dev This function can also be called by a minter wishing to revoke itself
function removeMinter(address minter) external;
/// @notice Sets a new treasury contract
/// @param _treasury New treasury address
function setTreasury(address _treasury) external;
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Checks whether an address has the right to mint agTokens
/// @param minter Address for which the minting right should be checked
/// @return Whether the address has the right to mint agTokens or not
function isMinter(address minter) external view returns (bool);
/// @notice Amount of decimals of the stablecoin
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;
import { IAccessControlManager } from "interfaces/IAccessControlManager.sol";
import "../utils/Errors.sol";
/// @title AccessControl
/// @author Angle Labs, Inc.
contract AccessControl {
/// @notice `accessControlManager` used to check roles
IAccessControlManager public accessControlManager;
uint256[49] private __gapAccessControl;
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MODIFIERS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Checks whether the `msg.sender` has the governor role
modifier onlyGovernor() {
if (!accessControlManager.isGovernor(msg.sender)) revert NotGovernor();
_;
}
/// @notice Checks whether the `msg.sender` has the guardian role
modifier onlyGuardian() {
if (!accessControlManager.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();
_;
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
FUNCTIONS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Checks whether `admin` has the governor role
function isGovernor(address admin) external view returns (bool) {
return accessControlManager.isGovernor(admin);
}
/// @notice Checks whether `admin` has the guardian role
function isGovernorOrGuardian(address admin) external view returns (bool) {
return accessControlManager.isGovernorOrGuardian(admin);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;
import { ICbETH } from "interfaces/external/coinbase/ICbETH.sol";
import { ISfrxETH } from "interfaces/external/frax/ISfrxETH.sol";
import { IStETH } from "interfaces/external/lido/IStETH.sol";
import { IRETH } from "interfaces/external/rocketPool/IRETH.sol";
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
STORAGE SLOTS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @dev Storage position of `DiamondStorage` structure
/// @dev Equals `keccak256("diamond.standard.diamond.storage") - 1`
bytes32 constant DIAMOND_STORAGE_POSITION = 0xc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131b;
/// @dev Storage position of `TransmuterStorage` structure
/// @dev Equals `keccak256("diamond.standard.transmuter.storage") - 1`
bytes32 constant TRANSMUTER_STORAGE_POSITION = 0xc1f2f38dde3351ac0a64934139e816326caa800303a1235dc53707d0de05d8bd;
/// @dev Storage position of `ImplementationStorage` structure
/// @dev Equals `keccak256("eip1967.proxy.implementation") - 1`
bytes32 constant IMPLEMENTATION_STORAGE_POSITION = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MATHS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
uint256 constant BASE_6 = 1e6;
uint256 constant BASE_8 = 1e8;
uint256 constant BASE_9 = 1e9;
uint256 constant BASE_12 = 1e12;
uint256 constant BPS = 1e14;
uint256 constant BASE_18 = 1e18;
uint256 constant HALF_BASE_27 = 1e27 / 2;
uint256 constant BASE_27 = 1e27;
uint256 constant BASE_36 = 1e36;
uint256 constant MAX_BURN_FEE = 999_000_000;
uint256 constant MAX_MINT_FEE = BASE_12 - 1;
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
REENTRANT
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint8 constant NOT_ENTERED = 1;
uint8 constant ENTERED = 2;
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
COMMON ADDRESSES
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
address constant PERMIT_2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
address constant ONE_INCH_ROUTER = 0x1111111254EEB25477B68fb85Ed929f73A960582;
address constant AGEUR = 0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8;
ICbETH constant CBETH = ICbETH(0xBe9895146f7AF43049ca1c1AE358B0541Ea49704);
IRETH constant RETH = IRETH(0xae78736Cd615f374D3085123A210448E74Fc6393);
IStETH constant STETH = IStETH(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
ISfrxETH constant SFRXETH = ISfrxETH(0xac3E018457B222d93114458476f3E3416Abbe38F);// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.19; error AlreadyAdded(); error CannotAddFunctionToDiamondThatAlreadyExists(bytes4 _selector); error CannotAddSelectorsToZeroAddress(bytes4[] _selectors); error CannotRemoveFunctionThatDoesNotExist(bytes4 _selector); error CannotRemoveImmutableFunction(bytes4 _selector); error CannotReplaceFunctionsFromFacetWithZeroAddress(bytes4[] _selectors); error CannotReplaceFunctionThatDoesNotExists(bytes4 _selector); error CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet(bytes4 _selector); error CannotReplaceImmutableFunction(bytes4 _selector); error ContractHasNoCode(); error FunctionNotFound(bytes4 _functionSelector); error IncorrectFacetCutAction(uint8 _action); error InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata); error InvalidChainlinkRate(); error InvalidLengths(); error InvalidNegativeFees(); error InvalidOracleType(); error InvalidParam(); error InvalidParams(); error InvalidRate(); error InvalidSwap(); error InvalidTokens(); error ManagerHasAssets(); error NoSelectorsProvidedForFacetForCut(address _facetAddress); error NotAllowed(); error NotCollateral(); error NotGovernor(); error NotGovernorOrGuardian(); error NotTrusted(); error NotWhitelisted(); error OneInchSwapFailed(); error OracleUpdateFailed(); error Paused(); error ReentrantCall(); error RemoveFacetAddressMustBeZeroAddress(address _facetAddress); error TooBigAmountIn(); error TooLate(); error TooSmallAmountOut(); error ZeroAddress(); error ZeroAmount();
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
__ERC20_init_unchained(name_, symbol_);
}
function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[45] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
import "../extensions/draft-IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
using AddressUpgradeable for address;
function safeTransfer(
IERC20Upgradeable token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20Upgradeable 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(
IERC20Upgradeable 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(
IERC20Upgradeable 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(
IERC20Upgradeable 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));
}
}
function safePermit(
IERC20PermitUpgradeable token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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(IERC20Upgradeable 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");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)
pragma solidity ^0.8.0;
import "../token/ERC20/IERC20Upgradeable.sol";
import "../token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
/**
* @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
* https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
*
* _Available since v4.7._
*/
interface IERC4626Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable {
event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);
event Withdraw(
address indexed caller,
address indexed receiver,
address indexed owner,
uint256 assets,
uint256 shares
);
/**
* @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
*
* - MUST be an ERC-20 token contract.
* - MUST NOT revert.
*/
function asset() external view returns (address assetTokenAddress);
/**
* @dev Returns the total amount of the underlying asset that is “managed” by Vault.
*
* - SHOULD include any compounding that occurs from yield.
* - MUST be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT revert.
*/
function totalAssets() external view returns (uint256 totalManagedAssets);
/**
* @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToShares(uint256 assets) external view returns (uint256 shares);
/**
* @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToAssets(uint256 shares) external view returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
* through a deposit call.
*
* - MUST return a limited value if receiver is subject to some deposit limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
* - MUST NOT revert.
*/
function maxDeposit(address receiver) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
* call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
* in the same transaction.
* - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
* deposit would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewDeposit(uint256 assets) external view returns (uint256 shares);
/**
* @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* deposit execution, and are accounted for during deposit.
* - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
* - MUST return a limited value if receiver is subject to some mint limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
* - MUST NOT revert.
*/
function maxMint(address receiver) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
* in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
* same transaction.
* - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
* would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by minting.
*/
function previewMint(uint256 shares) external view returns (uint256 assets);
/**
* @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
* execution, and are accounted for during mint.
* - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function mint(uint256 shares, address receiver) external returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
* Vault, through a withdraw call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxWithdraw(address owner) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
* call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
* called
* in the same transaction.
* - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
* the withdrawal would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewWithdraw(uint256 assets) external view returns (uint256 shares);
/**
* @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* withdraw execution, and are accounted for during withdraw.
* - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function withdraw(
uint256 assets,
address receiver,
address owner
) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
* through a redeem call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxRedeem(address owner) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
* in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
* same transaction.
* - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
* redemption would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by redeeming.
*/
function previewRedeem(uint256 shares) external view returns (uint256 assets);
/**
* @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* redeem execution, and are accounted for during redeem.
* - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function redeem(
uint256 shares,
address receiver,
address owner
) external returns (uint256 assets);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`.
// We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.
// This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.
// Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a
// good first aproximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1;
uint256 x = a;
if (x >> 128 > 0) {
x >>= 128;
result <<= 64;
}
if (x >> 64 > 0) {
x >>= 64;
result <<= 32;
}
if (x >> 32 > 0) {
x >>= 32;
result <<= 16;
}
if (x >> 16 > 0) {
x >>= 16;
result <<= 8;
}
if (x >> 8 > 0) {
x >>= 8;
result <<= 4;
}
if (x >> 4 > 0) {
x >>= 4;
result <<= 2;
}
if (x >> 2 > 0) {
result <<= 1;
}
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
uint256 result = sqrt(a);
if (rounding == Rounding.Up && result * result < a) {
result += 1;
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
* initialization step. This is essential to configure modules that are added through upgrades and that require
* initialization.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the 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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0;
/// @title IAccessControlManager
/// @author Angle Labs, Inc.
interface IAccessControlManager {
/// @notice Checks whether an address is governor of the Angle Protocol or not
/// @param admin Address to check
/// @return Whether the address has the `GOVERNOR_ROLE` or not
function isGovernor(address admin) external view returns (bool);
/// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not
/// @param admin Address to check
/// @return Whether the address has the `GUARDIAN_ROLE` or not
/// @dev Governance should make sure when adding a governor to also give this governor the guardian
/// role by calling the `addGovernor` function
function isGovernorOrGuardian(address admin) external view returns (bool);
}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0;
/// @title ICbETH
/// @notice Interface for the `cbETH` contract
interface ICbETH {
function exchangeRate() external view returns (uint256);
}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0;
/// @title ISfrxETH
/// @notice Interface for the `sfrxETH` contract
interface ISfrxETH {
function pricePerShare() external view returns (uint256);
}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0;
/// @title IStETH
/// @notice Interface for the `StETH` contract
interface IStETH {
function getPooledEthByShares(uint256 _sharesAmount) external view returns (uint256);
function submit(address) external payable returns (uint256);
function getSharesByPooledEth(uint256 _ethAmount) external view returns (uint256);
}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0;
/// @title IRETH
/// @notice Interface for the `rETH` contract
interface IRETH {
function getExchangeRate() external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the 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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20PermitUpgradeable {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}{
"remappings": [
"ds-test/=lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"stringutils/=lib/solidity-stringutils/",
"contracts/=contracts/",
"test/=test/",
"interfaces/=contracts/interfaces/",
"oz/=lib/openzeppelin-contracts/contracts/",
"oz-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"mock/=test/mock/",
"prb/math/=lib/prb-math/src/",
"utils/=lib/utils/",
"@prb/test/=lib/prb-math/node_modules/@prb/test/",
"lz/=lib/utils/lib/solidity-examples/contracts/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"prb-math/=lib/prb-math/src/",
"solidity-examples/=lib/utils/lib/solidity-examples/contracts/",
"solidity-stringutils/=lib/solidity-stringutils/"
],
"optimizer": {
"enabled": true,
"runs": 1000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": true,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"InvalidRate","type":"error"},{"inputs":[],"name":"NotGovernor","type":"error"},{"inputs":[],"name":"NotGovernorOrGuardian","type":"error"},{"inputs":[],"name":"NotTrusted","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"interest","type":"uint256"}],"name":"Accrued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxRate","type":"uint256"}],"name":"MaxRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"RateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128","name":"pauseStatus","type":"uint128"}],"name":"ToggledPause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trustedAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"trustedStatus","type":"uint256"}],"name":"ToggledTrusted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"accessControlManager","outputs":[{"internalType":"contract IAccessControlManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalAssets","type":"uint256"},{"internalType":"uint256","name":"exp","type":"uint256"}],"name":"computeUpdatedAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"estimatedAPR","outputs":[{"internalType":"uint256","name":"apr","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IAccessControlManager","name":"_accessControlManager","type":"address"},{"internalType":"contract IERC20MetadataUpgradeable","name":"asset_","type":"address"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint256","name":"divizer","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"isGovernor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"isGovernorOrGuardian","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isTrustedUpdater","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdate","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rate","outputs":[{"internalType":"uint208","name":"","type":"uint208"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxRate","type":"uint256"}],"name":"setMaxRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newName","type":"string"},{"internalType":"string","name":"newSymbol","type":"string"}],"name":"setNameAndSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint208","name":"newRate","type":"uint208"}],"name":"setRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"togglePause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trustedAddress","type":"address"}],"name":"toggleTrusted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60808060405234620001275760005460ff8160081c16159182809362000119575b801562000100575b15620000a7575060ff1981166001176000558162000094575b5062000058575b604051612ab690816200012d8239f35b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a162000048565b61ffff1916610101176000553862000041565b62461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b158015620000285750600160ff83161462000028565b50600160ff83161062000020565b600080fdfe6080604052600436101561001257600080fd5b60003560e01c806301e1d1141461157a57806306fdde03146114d257806307a2d13a1461131f578063095ea7b3146114ac5780630a28a4771461148657806318160ddd1461146857806323b872dd146114305780632c4e722e14611409578063313ce567146113ed57806338d52e0f146113c65780633950935114611374578063402d267d146113245780634cdad5061461131f5780634d0046d5146112e5578063521d4de9146112855780635a446215146111d25780635a5cd45e1461119b5780635c975abb1461117a5780636e553f651461113357806370a0823114610332578063763e902314610fdc5780637ee8434914610f1057806393d239231461090957806394bf804d146108c457806395d89b41146107e1578063a457c2d714610722578063a9059cbb146106f1578063aa4abe7f14610625578063b3d7f6b9146105ff578063b460af94146105c4578063b4a0bdf31461059d578063ba08765214610539578063c046371114610511578063c4ae3168146103d3578063c63d75b6146103ad578063c6e6f59214610223578063ce96cb771461036a578063d905777e14610332578063dd62ed3e146102e0578063e43581b814610246578063ece1d6e514610228578063ef8b30f7146102235763f4f9b040146101f557600080fd5b3461021e57604036600319011261021e576020610216602435600435611952565b604051908152f35b600080fd5b6116ea565b3461021e57600036600319011261021e57602060ca54604051908152f35b3461021e57602036600319011261021e5761025f611604565b60206001600160a01b0360248160975416936040519485938492631c86b03760e31b84521660048301525afa80156102d4576020916000916102a7575b506040519015158152f35b6102c79150823d84116102cd575b6102bf8183611630565b81019061178e565b8261029c565b503d6102b5565b6040513d6000823e3d90fd5b3461021e57604036600319011261021e576102f9611604565b61030161161a565b906001600160a01b038091166000526034602052604060002091166000526020526020604060002054604051908152f35b3461021e57602036600319011261021e576020610216610350611604565b6001600160a01b0316600052603360205260406000205490565b3461021e57602036600319011261021e576001600160a01b0361038b611604565b16600052603360205260206102166040600020546103a761171d565b906124e0565b3461021e57602036600319011261021e576103c6611604565b5060206040516000198152f35b3461021e57600036600319011261021e57602460206001600160a01b03609754166040519283809263521d4de960e01b82523360048301525afa9081156102d4576000916104f2575b50156104c85760c9548060f81c6001039060ff82116104b257816020917effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fff000000000000000000000000000000000000000000000000000000000000007f1e47f7115d10ca14b574b88c5c0bb005076141cea47318c3a8a7fe177142e8a29560f81b1691161760c95560ff60405191168152a1005b634e487b7160e01b600052601160045260246000fd5b60046040517f99e120bc000000000000000000000000000000000000000000000000000000008152fd5b61050b915060203d6020116102cd576102bf8183611630565b8161041c565b3461021e57600036600319011261021e57602064ffffffffff60c95460d01c16604051908152f35b3461021e57610547366116b5565b9060c95460f81c610573576020926102169161056a610564612065565b836124e0565b93849133612532565b60046040517f9e87fac8000000000000000000000000000000000000000000000000000000008152fd5b3461021e57600036600319011261021e5760206001600160a01b0360975416604051908152f35b3461021e576105d2366116b5565b909160c95460f81c61057357602092610216916105f66105f0612065565b82612194565b93849233612532565b3461021e57602036600319011261021e57602061021661061d61171d565b60043561247c565b3461021e57602036600319011261021e57600435602460206001600160a01b036097541660405192838092631c86b03760e31b82523360048301525afa9081156102d4576000916106d2575b50156106a8576020817fcdfe38c4a8f52b3ca6577340cfb5046c68d9854c712200f932e420775132f0b99260ca55604051908152a1005b60046040517fee3675d4000000000000000000000000000000000000000000000000000000008152fd5b6106eb915060203d6020116102cd576102bf8183611630565b82610671565b3461021e57604036600319011261021e5761071761070d611604565b6024359033611c14565b602060405160018152f35b3461021e57604036600319011261021e5761073b611604565b6024359033600052603460205260406000206001600160a01b038216600052602052604060002054918083106107775761071792039033611a48565b608460405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152fd5b3461021e57600036600319011261021e57604051600060fd5461080381611747565b8084529060209060019081811690811561089a5750600114610840575b61083c8561083081870382611630565b60405191829182611595565b0390f35b60fd600090815293507f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2805b838510610887575050505081016020016108308261083c610820565b805486860184015293820193810161086b565b86955061083c9693506020925061083094915060ff191682840152151560051b8201019293610820565b3461021e57604036600319011261021e576004356108e061161a565b60c95460f81c610573576102166020926109016108fb612065565b8261247c565b8093336122c3565b3461021e5760a036600319011261021e576004356001600160a01b03808216820361021e57602435818116810361021e5760443567ffffffffffffffff811161021e5761095a90369060040161166e565b9060643567ffffffffffffffff811161021e5761097b90369060040161166e565b916000549460ff8660081c161595868097610f03575b8015610eec575b15610e825760ff19811660011760005586610e70575b5084811615610e4657610a0460ff60005460081c166109cc8161240b565b6109d58161240b565b86851673ffffffffffffffffffffffffffffffffffffffff1960655416176065556109ff8161240b565b61240b565b815167ffffffffffffffff8111610cfd57610a20603654611747565b601f8111610da3575b50806020601f8211600114610d1e57600091610d13575b508160011b916000199060031b1c1916176036555b83519367ffffffffffffffff8511610cfd578592610a74603754611747565b601f8111610c4c575b50602095601f8111600114610bbf579081610ab79392602098600091610bb4575b508160011b916000199060031b1c191617603755611dd1565b1673ffffffffffffffffffffffffffffffffffffffff19609754161760975560046040518094819363313ce56760e01b8352165afa80156102d457610b1091600091610b85575b50610b0b608435916117bf565b6117d0565b60843515610b6f57610b3190608435670de0b6b3a7640000049030336122c3565b610b3757005b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b634e487b7160e01b600052601260045260246000fd5b610ba7915060203d602011610bad575b610b9f8183611630565b8101906117a6565b83610afe565b503d610b95565b90508301518b610a9e565b601f1981169660376000527f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31ae9760005b818110610c3157509160209860019282610ab797969510610c18575b5050811b01603755611dd1565b85015160001960f88460031b161c191690558b80610c0b565b828601518a556001909901988a975060209283019201610bef565b90919293506037600052601f860160051c7f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31ae019060208710610cd5575b90601f88959493920160051c7f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31ae01905b818110610cc65750610a7d565b60008155889550600101610cb9565b7f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31ae9150610c89565b634e487b7160e01b600052604160045260246000fd5b905083015188610a40565b915060366000527f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b86000925b601f1983168410610d8b576001935082601f19811610610d72575b5050811b01603655610a55565b85015160001960f88460031b161c191690558880610d65565b85810151825560209384019360019092019101610d4a565b6036600052601f820160051c7f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8019060208310610e1e575b601f0160051c7f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b801905b818110610e125750610a29565b60008155600101610e05565b7f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b89150610ddb565b60046040517fd92e233d000000000000000000000000000000000000000000000000000000008152fd5b61ffff191661010117600055866109ae565b608460405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b1580156109985750600160ff821614610998565b50600160ff821610610991565b3461021e5760208060031936011261021e57610f2a611604565b6001600160a01b039060248383609754166040519283809263521d4de960e01b82523360048301525afa9081156102d457600091610fbf575b50156104c85716908160005260cb815260406000205460010390600182116104b2577fb4e4c17380256b9cc49fc909cfd80b70b57e922b2ada0ff351665e1da6493bd5918360005260cb825280604060002055604051908152a2005b610fd69150843d86116102cd576102bf8183611630565b84610f63565b3461021e5760208060031936011261021e57600435906001600160d01b03821680920361021e573360005260cb815260406000205415806110d7575b6110ad5760ca548211611083577fe65c987b2e4668e09ba867026921588005b2b2063607a1e7e7d91683c8f91b7b9161104f612065565b50807fffffffffffff000000000000000000000000000000000000000000000000000060c954161760c955604051908152a1005b60046040517f6a43f8d1000000000000000000000000000000000000000000000000000000008152fd5b60046040517fc22a648e000000000000000000000000000000000000000000000000000000008152fd5b506024816001600160a01b03609754166040519283809263521d4de960e01b82523360048301525afa9081156102d457600091611116575b5015611018565b61112d9150823d84116102cd576102bf8183611630565b8361110f565b3461021e57604036600319011261021e5760043561114f61161a565b9060c95460f81c6105735761021660209261117161116b612065565b84612258565b928391336122c3565b3461021e57600036600319011261021e57602060c95460f81c604051908152f35b3461021e57600036600319011261021e576111b4611870565b670de0b6b3a763ffff1981019081116104b257602090604051908152f35b3461021e57604036600319011261021e5767ffffffffffffffff60043581811161021e5761120490369060040161166e565b9060243590811161021e5761121d90369060040161166e565b602460206001600160a01b036097541660405192838092631c86b03760e31b82523360048301525afa9081156102d457600091611266575b50156106a85761126491611dd1565b005b61127f915060203d6020116102cd576102bf8183611630565b83611255565b3461021e57602036600319011261021e5761129e611604565b60206001600160a01b036024816097541693604051948593849263521d4de960e01b84521660048301525afa80156102d4576020916000916102a757506040519015158152f35b3461021e57602036600319011261021e576001600160a01b03611306611604565b1660005260cb6020526020604060002054604051908152f35b6115de565b3461021e57602036600319011261021e5761133d611604565b5061134661171d565b1580159061136a575b15611361576020600019604051908152f35b60206000610216565b506035541561134f565b3461021e57604036600319011261021e57610717611390611604565b33600052603460205260406000206001600160a01b0382166000526020526113bf602435604060002054611781565b9033611a48565b3461021e57600036600319011261021e5760206001600160a01b0360655416604051908152f35b3461021e57600036600319011261021e57602060405160128152f35b3461021e57600036600319011261021e5760206001600160d01b0360c95416604051908152f35b3461021e57606036600319011261021e5761071761144c611604565b61145461161a565b60443591611463833383611b7c565b611c14565b3461021e57600036600319011261021e576020603554604051908152f35b3461021e57602036600319011261021e5760206102166114a461171d565b600435612194565b3461021e57604036600319011261021e576107176114c8611604565b6024359033611a48565b3461021e57600036600319011261021e57604051600060fc546114f481611747565b8084529060209060019081811690811561089a57506001146115205761083c8561083081870382611630565b60fc600090815293507f371f36870d18f32a11fea0f144b021c8b407bb50f8e0267c711123f454b963c05b838510611567575050505081016020016108308261083c610820565b805486860184015293820193810161154b565b3461021e57600036600319011261021e57602061021661171d565b6020808252825181830181905290939260005b8281106115ca57505060409293506000838284010152601f8019910116010190565b8181018601518482016040015285016115a8565b3461021e57602036600319011261021e5760206102166115fc61171d565b6004356124e0565b600435906001600160a01b038216820361021e57565b602435906001600160a01b038216820361021e57565b90601f8019910116810190811067ffffffffffffffff821117610cfd57604052565b67ffffffffffffffff8111610cfd57601f01601f191660200190565b81601f8201121561021e5780359061168582611652565b926116936040519485611630565b8284526020838301011161021e57816000926020809301838601378301015290565b606090600319011261021e57600435906001600160a01b0390602435828116810361021e5791604435908116810361021e5790565b3461021e57602036600319011261021e57602061021661170861171d565b600435612258565b919082039182116104b257565b6117446117286117da565b61173e64ffffffffff60c95460d01c1642611710565b90611952565b90565b90600182811c92168015611777575b602083101461176157565b634e487b7160e01b600052602260045260246000fd5b91607f1691611756565b919082018092116104b257565b9081602091031261021e5751801515810361021e5790565b9081602091031261021e575160ff8116810361021e5790565b60ff16604d81116104b257600a0a90565b8115610b6f570490565b602460206001600160a01b0360655416604051928380927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa9081156102d45760009161182e575090565b90506020813d602011611855575b8161184960209383611630565b8101031261021e575190565b3d915061183c565b818102929181159184041417156104b257565b6001600160d01b0360c9541680156119455761188c818061185d565b906b019d971e4fe8401e740000008083018093116104b2576b033b2e3c9fd0803ce8000000809304906118bf838361185d565b9081018091116104b25783900491660388828f7b0c8091808302928304036104b2576906a4333ec90a9e8da70092808402938404036104b2576301e13380808202918204036104b2578301918284116104b25761192c92600661192792049260011c90611781565b611781565b670de0b6b3a764000090808202918204036104b2570490565b50670de0b6b3a764000090565b6001600160d01b0360c954169082158015611a40575b611a3a5760001983018381116104b2576002841115611a325760011984018481116104b257905b611999848061185d565b946b019d971e4fe8401e74000000928387018097116104b2576b033b2e3c9fd0803ce8000000809704906119cd878361185d565b9485018095116104b257836119f6611a07926119f68b6119fb6006976119f6611a0e9b8b61185d565b61185d565b60011c9904938761185d565b049461185d565b8401928385116104b257611927611a2892611a2e95611781565b9061185d565b0490565b60009061198f565b91505090565b508115611968565b6001600160a01b03809116918215611b135716918215611aa95760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260348252604060002085600052825280604060002055604051908152a3565b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b906001600160a01b0380831660005260346020526040600020908216600052602052604060002054926000198403611bb5575b50505050565b808410611bd057611bc7930391611a48565b38808080611baf565b606460405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b6001600160a01b03809116918215611d675716918215611cfd5760008281526033602052604081205491808310611c9357604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef95876020965260338652038282205586815220611c88828254611781565b9055604051908152a3565b608460405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b919082519067ffffffffffffffff91828111610cfd5780611df360fc54611747565b95601f96878111611ff4575b50602090878311600114611f6e57600092611f63575b50508160011b916000199060031b1c19161760fc555b8051918211610cfd57611e3f60fd54611747565b848111611f01575b506020938211600114611e825792819293600092611e77575b50508160011b916000199060031b1c19161760fd55565b015190503880611e60565b601f1982169360fd6000527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2809160005b868110611ee95750836001959610611ed0575b505050811b0160fd55565b015160001960f88460031b161c19169055388080611ec5565b91926020600181928685015181550194019201611eb2565b60fd6000527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2808580850160051c82019260208610611f5a575b0160051c01905b818110611f4e5750611e47565b60008155600101611f41565b92508192611f3a565b015190503880611e15565b60fc60009081527f371f36870d18f32a11fea0f144b021c8b407bb50f8e0267c711123f454b963c09350601f198516905b818110611fdc5750908460019594939210611fc3575b505050811b0160fc55611e2b565b015160001960f88460031b161c19169055388080611fb5565b92936020600181928786015181550195019301611f9f565b909150600060fc6000527f371f36870d18f32a11fea0f144b021c8b407bb50f8e0267c711123f454b963c08880860160051c8201936020871061205c575b908695949392910160051c01915b82811061204e575050611dff565b818155859450600101612040565b93508193612032565b61206d6117da565b906120e560c9549261209261208c64ffffffffff8660d01c1642611710565b82611952565b937fff0000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff7effffffffff00000000000000000000000000000000000000000000000000004260d01b1691161760c95583611710565b806120ed5750565b6001600160a01b0360655416803b1561021e576040517f40c10f1900000000000000000000000000000000000000000000000000000000815230600482015260248101839052906000908290604490829084905af180156102d45761217b575b5060207ff3486c8be7415104f077b000d812e60c482b6824642b7673b3f73d6faeca29a691604051908152a1565b67ffffffffffffffff8111610cfd57604052602061214d565b9060355482158015612250575b15612247575050600460206001600160a01b03606554166040519283809263313ce56760e01b82525afa80156102d4576121e391600091612228575b506117bf565b6121ed8183612757565b918115610b6f57670de0b6b3a764000090096122065790565b600181018091111561174457634e487b7160e01b600052601160045260246000fd5b612241915060203d602011610bad57610b9f8183611630565b386121dd565b6117449261272d565b5080156121a1565b90603554821580156122bb575b156122b257505060049060206001600160a01b03606554166040519384809263313ce56760e01b82525afa9182156102d457611744926122ac9160009161222857506117bf565b90612757565b61174492612858565b508015612265565b916001600160a01b03806065541692604093828551967f23b872dd00000000000000000000000000000000000000000000000000000000602089015216958660248201523060448201528460648201526064815260a081019181831067ffffffffffffffff841117610cfd5761233a9287526128ce565b169384156123c85790816123727fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d79493603554611781565b6035558560005260336020528260002061238d828254611781565b90558560007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60208651858152a382519182526020820152a3565b6064835162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b1561241257565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b603554909181612247575050600460206001600160a01b03606554166040519283809263313ce56760e01b82525afa9081156102d457670de0b6b3a7640000916124cd9160009161222857506117bf565b6124d781846127e4565b92096122065790565b6035549091816122b257505060049060206001600160a01b03606554166040519384809263313ce56760e01b82525afa9182156102d4576117449261252c9160009161222857506117bf565b906127e4565b9094936001600160a01b03808416949381841693839087860361271c575b50505084156126b2578460005260209660338852604092836000205498818a10612649578188999a7ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db979899600052603383520385600020556125b582603554611710565b6035556000897fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef838851868152a360655485517fa9059cbb00000000000000000000000000000000000000000000000000000000838201526001600160a01b038516602482015260448082018b9052815261263c918616612637606483611630565b6128ce565b84519788528701521693a4565b60849085519062461bcd60e51b82526004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b61272592611b7c565b388281612550565b919061273a828285612858565b928215610b6f57096127495790565b600181018091116104b25790565b90670de0b6b3a76400009060001982840992828102928380861095039480860395146127d7578483111561021e578291096001821901821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b50509061174492506117d0565b906000198183098183029182808310920391808303921461284757670de0b6b3a7640000908282111561021e577faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac10669940990828211900360ee1b910360121c170290565b5050670de0b6b3a764000091500490565b9160001982840992828102928380861095039480860395146127d7578483111561021e578291096001821901821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b6001600160a01b03169060409081519082820182811067ffffffffffffffff821117610cfd5783526020938483527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656485840152803b15612a0157600082819282886129669796519301915af13d156129f9573d9061294b82611652565b9161295886519384611630565b82523d60008784013e612a44565b805190816129745750505050565b838061298493830101910161178e565b15612990578080611baf565b60849250519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b606090612a44565b60648585519062461bcd60e51b82526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b90919015612a50575090565b815115612a605750805190602001fd5b612a7c9060405191829162461bcd60e51b835260048301611595565b0390fdfea26469706673582212206cf37e761287d4c7fa010001ab59fa6bd18d265925ef545d93a45811f3e732f064736f6c634300081700330000000000000000000000000000000000ffe8b47b3e2130213b802212439497000000000000000000000000a9ddd91249dfdd450e81e1c56ab60e1a6265170100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c806301e1d1141461157a57806306fdde03146114d257806307a2d13a1461131f578063095ea7b3146114ac5780630a28a4771461148657806318160ddd1461146857806323b872dd146114305780632c4e722e14611409578063313ce567146113ed57806338d52e0f146113c65780633950935114611374578063402d267d146113245780634cdad5061461131f5780634d0046d5146112e5578063521d4de9146112855780635a446215146111d25780635a5cd45e1461119b5780635c975abb1461117a5780636e553f651461113357806370a0823114610332578063763e902314610fdc5780637ee8434914610f1057806393d239231461090957806394bf804d146108c457806395d89b41146107e1578063a457c2d714610722578063a9059cbb146106f1578063aa4abe7f14610625578063b3d7f6b9146105ff578063b460af94146105c4578063b4a0bdf31461059d578063ba08765214610539578063c046371114610511578063c4ae3168146103d3578063c63d75b6146103ad578063c6e6f59214610223578063ce96cb771461036a578063d905777e14610332578063dd62ed3e146102e0578063e43581b814610246578063ece1d6e514610228578063ef8b30f7146102235763f4f9b040146101f557600080fd5b3461021e57604036600319011261021e576020610216602435600435611952565b604051908152f35b600080fd5b6116ea565b3461021e57600036600319011261021e57602060ca54604051908152f35b3461021e57602036600319011261021e5761025f611604565b60206001600160a01b0360248160975416936040519485938492631c86b03760e31b84521660048301525afa80156102d4576020916000916102a7575b506040519015158152f35b6102c79150823d84116102cd575b6102bf8183611630565b81019061178e565b8261029c565b503d6102b5565b6040513d6000823e3d90fd5b3461021e57604036600319011261021e576102f9611604565b61030161161a565b906001600160a01b038091166000526034602052604060002091166000526020526020604060002054604051908152f35b3461021e57602036600319011261021e576020610216610350611604565b6001600160a01b0316600052603360205260406000205490565b3461021e57602036600319011261021e576001600160a01b0361038b611604565b16600052603360205260206102166040600020546103a761171d565b906124e0565b3461021e57602036600319011261021e576103c6611604565b5060206040516000198152f35b3461021e57600036600319011261021e57602460206001600160a01b03609754166040519283809263521d4de960e01b82523360048301525afa9081156102d4576000916104f2575b50156104c85760c9548060f81c6001039060ff82116104b257816020917effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fff000000000000000000000000000000000000000000000000000000000000007f1e47f7115d10ca14b574b88c5c0bb005076141cea47318c3a8a7fe177142e8a29560f81b1691161760c95560ff60405191168152a1005b634e487b7160e01b600052601160045260246000fd5b60046040517f99e120bc000000000000000000000000000000000000000000000000000000008152fd5b61050b915060203d6020116102cd576102bf8183611630565b8161041c565b3461021e57600036600319011261021e57602064ffffffffff60c95460d01c16604051908152f35b3461021e57610547366116b5565b9060c95460f81c610573576020926102169161056a610564612065565b836124e0565b93849133612532565b60046040517f9e87fac8000000000000000000000000000000000000000000000000000000008152fd5b3461021e57600036600319011261021e5760206001600160a01b0360975416604051908152f35b3461021e576105d2366116b5565b909160c95460f81c61057357602092610216916105f66105f0612065565b82612194565b93849233612532565b3461021e57602036600319011261021e57602061021661061d61171d565b60043561247c565b3461021e57602036600319011261021e57600435602460206001600160a01b036097541660405192838092631c86b03760e31b82523360048301525afa9081156102d4576000916106d2575b50156106a8576020817fcdfe38c4a8f52b3ca6577340cfb5046c68d9854c712200f932e420775132f0b99260ca55604051908152a1005b60046040517fee3675d4000000000000000000000000000000000000000000000000000000008152fd5b6106eb915060203d6020116102cd576102bf8183611630565b82610671565b3461021e57604036600319011261021e5761071761070d611604565b6024359033611c14565b602060405160018152f35b3461021e57604036600319011261021e5761073b611604565b6024359033600052603460205260406000206001600160a01b038216600052602052604060002054918083106107775761071792039033611a48565b608460405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152fd5b3461021e57600036600319011261021e57604051600060fd5461080381611747565b8084529060209060019081811690811561089a5750600114610840575b61083c8561083081870382611630565b60405191829182611595565b0390f35b60fd600090815293507f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2805b838510610887575050505081016020016108308261083c610820565b805486860184015293820193810161086b565b86955061083c9693506020925061083094915060ff191682840152151560051b8201019293610820565b3461021e57604036600319011261021e576004356108e061161a565b60c95460f81c610573576102166020926109016108fb612065565b8261247c565b8093336122c3565b3461021e5760a036600319011261021e576004356001600160a01b03808216820361021e57602435818116810361021e5760443567ffffffffffffffff811161021e5761095a90369060040161166e565b9060643567ffffffffffffffff811161021e5761097b90369060040161166e565b916000549460ff8660081c161595868097610f03575b8015610eec575b15610e825760ff19811660011760005586610e70575b5084811615610e4657610a0460ff60005460081c166109cc8161240b565b6109d58161240b565b86851673ffffffffffffffffffffffffffffffffffffffff1960655416176065556109ff8161240b565b61240b565b815167ffffffffffffffff8111610cfd57610a20603654611747565b601f8111610da3575b50806020601f8211600114610d1e57600091610d13575b508160011b916000199060031b1c1916176036555b83519367ffffffffffffffff8511610cfd578592610a74603754611747565b601f8111610c4c575b50602095601f8111600114610bbf579081610ab79392602098600091610bb4575b508160011b916000199060031b1c191617603755611dd1565b1673ffffffffffffffffffffffffffffffffffffffff19609754161760975560046040518094819363313ce56760e01b8352165afa80156102d457610b1091600091610b85575b50610b0b608435916117bf565b6117d0565b60843515610b6f57610b3190608435670de0b6b3a7640000049030336122c3565b610b3757005b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b634e487b7160e01b600052601260045260246000fd5b610ba7915060203d602011610bad575b610b9f8183611630565b8101906117a6565b83610afe565b503d610b95565b90508301518b610a9e565b601f1981169660376000527f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31ae9760005b818110610c3157509160209860019282610ab797969510610c18575b5050811b01603755611dd1565b85015160001960f88460031b161c191690558b80610c0b565b828601518a556001909901988a975060209283019201610bef565b90919293506037600052601f860160051c7f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31ae019060208710610cd5575b90601f88959493920160051c7f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31ae01905b818110610cc65750610a7d565b60008155889550600101610cb9565b7f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31ae9150610c89565b634e487b7160e01b600052604160045260246000fd5b905083015188610a40565b915060366000527f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b86000925b601f1983168410610d8b576001935082601f19811610610d72575b5050811b01603655610a55565b85015160001960f88460031b161c191690558880610d65565b85810151825560209384019360019092019101610d4a565b6036600052601f820160051c7f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8019060208310610e1e575b601f0160051c7f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b801905b818110610e125750610a29565b60008155600101610e05565b7f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b89150610ddb565b60046040517fd92e233d000000000000000000000000000000000000000000000000000000008152fd5b61ffff191661010117600055866109ae565b608460405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b1580156109985750600160ff821614610998565b50600160ff821610610991565b3461021e5760208060031936011261021e57610f2a611604565b6001600160a01b039060248383609754166040519283809263521d4de960e01b82523360048301525afa9081156102d457600091610fbf575b50156104c85716908160005260cb815260406000205460010390600182116104b2577fb4e4c17380256b9cc49fc909cfd80b70b57e922b2ada0ff351665e1da6493bd5918360005260cb825280604060002055604051908152a2005b610fd69150843d86116102cd576102bf8183611630565b84610f63565b3461021e5760208060031936011261021e57600435906001600160d01b03821680920361021e573360005260cb815260406000205415806110d7575b6110ad5760ca548211611083577fe65c987b2e4668e09ba867026921588005b2b2063607a1e7e7d91683c8f91b7b9161104f612065565b50807fffffffffffff000000000000000000000000000000000000000000000000000060c954161760c955604051908152a1005b60046040517f6a43f8d1000000000000000000000000000000000000000000000000000000008152fd5b60046040517fc22a648e000000000000000000000000000000000000000000000000000000008152fd5b506024816001600160a01b03609754166040519283809263521d4de960e01b82523360048301525afa9081156102d457600091611116575b5015611018565b61112d9150823d84116102cd576102bf8183611630565b8361110f565b3461021e57604036600319011261021e5760043561114f61161a565b9060c95460f81c6105735761021660209261117161116b612065565b84612258565b928391336122c3565b3461021e57600036600319011261021e57602060c95460f81c604051908152f35b3461021e57600036600319011261021e576111b4611870565b670de0b6b3a763ffff1981019081116104b257602090604051908152f35b3461021e57604036600319011261021e5767ffffffffffffffff60043581811161021e5761120490369060040161166e565b9060243590811161021e5761121d90369060040161166e565b602460206001600160a01b036097541660405192838092631c86b03760e31b82523360048301525afa9081156102d457600091611266575b50156106a85761126491611dd1565b005b61127f915060203d6020116102cd576102bf8183611630565b83611255565b3461021e57602036600319011261021e5761129e611604565b60206001600160a01b036024816097541693604051948593849263521d4de960e01b84521660048301525afa80156102d4576020916000916102a757506040519015158152f35b3461021e57602036600319011261021e576001600160a01b03611306611604565b1660005260cb6020526020604060002054604051908152f35b6115de565b3461021e57602036600319011261021e5761133d611604565b5061134661171d565b1580159061136a575b15611361576020600019604051908152f35b60206000610216565b506035541561134f565b3461021e57604036600319011261021e57610717611390611604565b33600052603460205260406000206001600160a01b0382166000526020526113bf602435604060002054611781565b9033611a48565b3461021e57600036600319011261021e5760206001600160a01b0360655416604051908152f35b3461021e57600036600319011261021e57602060405160128152f35b3461021e57600036600319011261021e5760206001600160d01b0360c95416604051908152f35b3461021e57606036600319011261021e5761071761144c611604565b61145461161a565b60443591611463833383611b7c565b611c14565b3461021e57600036600319011261021e576020603554604051908152f35b3461021e57602036600319011261021e5760206102166114a461171d565b600435612194565b3461021e57604036600319011261021e576107176114c8611604565b6024359033611a48565b3461021e57600036600319011261021e57604051600060fc546114f481611747565b8084529060209060019081811690811561089a57506001146115205761083c8561083081870382611630565b60fc600090815293507f371f36870d18f32a11fea0f144b021c8b407bb50f8e0267c711123f454b963c05b838510611567575050505081016020016108308261083c610820565b805486860184015293820193810161154b565b3461021e57600036600319011261021e57602061021661171d565b6020808252825181830181905290939260005b8281106115ca57505060409293506000838284010152601f8019910116010190565b8181018601518482016040015285016115a8565b3461021e57602036600319011261021e5760206102166115fc61171d565b6004356124e0565b600435906001600160a01b038216820361021e57565b602435906001600160a01b038216820361021e57565b90601f8019910116810190811067ffffffffffffffff821117610cfd57604052565b67ffffffffffffffff8111610cfd57601f01601f191660200190565b81601f8201121561021e5780359061168582611652565b926116936040519485611630565b8284526020838301011161021e57816000926020809301838601378301015290565b606090600319011261021e57600435906001600160a01b0390602435828116810361021e5791604435908116810361021e5790565b3461021e57602036600319011261021e57602061021661170861171d565b600435612258565b919082039182116104b257565b6117446117286117da565b61173e64ffffffffff60c95460d01c1642611710565b90611952565b90565b90600182811c92168015611777575b602083101461176157565b634e487b7160e01b600052602260045260246000fd5b91607f1691611756565b919082018092116104b257565b9081602091031261021e5751801515810361021e5790565b9081602091031261021e575160ff8116810361021e5790565b60ff16604d81116104b257600a0a90565b8115610b6f570490565b602460206001600160a01b0360655416604051928380927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa9081156102d45760009161182e575090565b90506020813d602011611855575b8161184960209383611630565b8101031261021e575190565b3d915061183c565b818102929181159184041417156104b257565b6001600160d01b0360c9541680156119455761188c818061185d565b906b019d971e4fe8401e740000008083018093116104b2576b033b2e3c9fd0803ce8000000809304906118bf838361185d565b9081018091116104b25783900491660388828f7b0c8091808302928304036104b2576906a4333ec90a9e8da70092808402938404036104b2576301e13380808202918204036104b2578301918284116104b25761192c92600661192792049260011c90611781565b611781565b670de0b6b3a764000090808202918204036104b2570490565b50670de0b6b3a764000090565b6001600160d01b0360c954169082158015611a40575b611a3a5760001983018381116104b2576002841115611a325760011984018481116104b257905b611999848061185d565b946b019d971e4fe8401e74000000928387018097116104b2576b033b2e3c9fd0803ce8000000809704906119cd878361185d565b9485018095116104b257836119f6611a07926119f68b6119fb6006976119f6611a0e9b8b61185d565b61185d565b60011c9904938761185d565b049461185d565b8401928385116104b257611927611a2892611a2e95611781565b9061185d565b0490565b60009061198f565b91505090565b508115611968565b6001600160a01b03809116918215611b135716918215611aa95760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260348252604060002085600052825280604060002055604051908152a3565b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b906001600160a01b0380831660005260346020526040600020908216600052602052604060002054926000198403611bb5575b50505050565b808410611bd057611bc7930391611a48565b38808080611baf565b606460405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b6001600160a01b03809116918215611d675716918215611cfd5760008281526033602052604081205491808310611c9357604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef95876020965260338652038282205586815220611c88828254611781565b9055604051908152a3565b608460405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b919082519067ffffffffffffffff91828111610cfd5780611df360fc54611747565b95601f96878111611ff4575b50602090878311600114611f6e57600092611f63575b50508160011b916000199060031b1c19161760fc555b8051918211610cfd57611e3f60fd54611747565b848111611f01575b506020938211600114611e825792819293600092611e77575b50508160011b916000199060031b1c19161760fd55565b015190503880611e60565b601f1982169360fd6000527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2809160005b868110611ee95750836001959610611ed0575b505050811b0160fd55565b015160001960f88460031b161c19169055388080611ec5565b91926020600181928685015181550194019201611eb2565b60fd6000527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2808580850160051c82019260208610611f5a575b0160051c01905b818110611f4e5750611e47565b60008155600101611f41565b92508192611f3a565b015190503880611e15565b60fc60009081527f371f36870d18f32a11fea0f144b021c8b407bb50f8e0267c711123f454b963c09350601f198516905b818110611fdc5750908460019594939210611fc3575b505050811b0160fc55611e2b565b015160001960f88460031b161c19169055388080611fb5565b92936020600181928786015181550195019301611f9f565b909150600060fc6000527f371f36870d18f32a11fea0f144b021c8b407bb50f8e0267c711123f454b963c08880860160051c8201936020871061205c575b908695949392910160051c01915b82811061204e575050611dff565b818155859450600101612040565b93508193612032565b61206d6117da565b906120e560c9549261209261208c64ffffffffff8660d01c1642611710565b82611952565b937fff0000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff7effffffffff00000000000000000000000000000000000000000000000000004260d01b1691161760c95583611710565b806120ed5750565b6001600160a01b0360655416803b1561021e576040517f40c10f1900000000000000000000000000000000000000000000000000000000815230600482015260248101839052906000908290604490829084905af180156102d45761217b575b5060207ff3486c8be7415104f077b000d812e60c482b6824642b7673b3f73d6faeca29a691604051908152a1565b67ffffffffffffffff8111610cfd57604052602061214d565b9060355482158015612250575b15612247575050600460206001600160a01b03606554166040519283809263313ce56760e01b82525afa80156102d4576121e391600091612228575b506117bf565b6121ed8183612757565b918115610b6f57670de0b6b3a764000090096122065790565b600181018091111561174457634e487b7160e01b600052601160045260246000fd5b612241915060203d602011610bad57610b9f8183611630565b386121dd565b6117449261272d565b5080156121a1565b90603554821580156122bb575b156122b257505060049060206001600160a01b03606554166040519384809263313ce56760e01b82525afa9182156102d457611744926122ac9160009161222857506117bf565b90612757565b61174492612858565b508015612265565b916001600160a01b03806065541692604093828551967f23b872dd00000000000000000000000000000000000000000000000000000000602089015216958660248201523060448201528460648201526064815260a081019181831067ffffffffffffffff841117610cfd5761233a9287526128ce565b169384156123c85790816123727fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d79493603554611781565b6035558560005260336020528260002061238d828254611781565b90558560007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60208651858152a382519182526020820152a3565b6064835162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b1561241257565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b603554909181612247575050600460206001600160a01b03606554166040519283809263313ce56760e01b82525afa9081156102d457670de0b6b3a7640000916124cd9160009161222857506117bf565b6124d781846127e4565b92096122065790565b6035549091816122b257505060049060206001600160a01b03606554166040519384809263313ce56760e01b82525afa9182156102d4576117449261252c9160009161222857506117bf565b906127e4565b9094936001600160a01b03808416949381841693839087860361271c575b50505084156126b2578460005260209660338852604092836000205498818a10612649578188999a7ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db979899600052603383520385600020556125b582603554611710565b6035556000897fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef838851868152a360655485517fa9059cbb00000000000000000000000000000000000000000000000000000000838201526001600160a01b038516602482015260448082018b9052815261263c918616612637606483611630565b6128ce565b84519788528701521693a4565b60849085519062461bcd60e51b82526004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b61272592611b7c565b388281612550565b919061273a828285612858565b928215610b6f57096127495790565b600181018091116104b25790565b90670de0b6b3a76400009060001982840992828102928380861095039480860395146127d7578483111561021e578291096001821901821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b50509061174492506117d0565b906000198183098183029182808310920391808303921461284757670de0b6b3a7640000908282111561021e577faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac10669940990828211900360ee1b910360121c170290565b5050670de0b6b3a764000091500490565b9160001982840992828102928380861095039480860395146127d7578483111561021e578291096001821901821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b6001600160a01b03169060409081519082820182811067ffffffffffffffff821117610cfd5783526020938483527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656485840152803b15612a0157600082819282886129669796519301915af13d156129f9573d9061294b82611652565b9161295886519384611630565b82523d60008784013e612a44565b805190816129745750505050565b838061298493830101910161178e565b15612990578080611baf565b60849250519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b606090612a44565b60648585519062461bcd60e51b82526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b90919015612a50575090565b815115612a605750805190602001fd5b612a7c9060405191829162461bcd60e51b835260048301611595565b0390fdfea26469706673582212206cf37e761287d4c7fa010001ab59fa6bd18d265925ef545d93a45811f3e732f064736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000ffe8b47b3e2130213b802212439497000000000000000000000000a9ddd91249dfdd450e81e1c56ab60e1a6265170100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000ffe8b47b3e2130213b802212439497
Arg [1] : 000000000000000000000000a9ddd91249dfdd450e81e1c56ab60e1a62651701
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.