Feature Tip: Add private address tag to any address under My Name Tag !
Overview
Max Total Supply
70,016.133441667041155813 YT-pufETH-26SEP2024
Holders
7,858 (0.00%)
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
0 YT-pufETH-26SEP2024Value
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xAf86Da90...81087b7Aa The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
PendleYieldToken
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../../interfaces/IStandardizedYield.sol"; import "../../interfaces/IPYieldToken.sol"; import "../../interfaces/IPPrincipalToken.sol"; import "../libraries/math/PMath.sol"; import "../libraries/ArrayLib.sol"; import "../../interfaces/IPYieldContractFactory.sol"; import "../StandardizedYield/SYUtils.sol"; import "../libraries/Errors.sol"; import "../libraries/MiniHelpers.sol"; import "../RewardManager/RewardManagerAbstract.sol"; import "../erc20/PendleERC20Permit.sol"; import "./InterestManagerYT.sol"; /** Invariance to maintain: - address(0) & address(this) should never have any rewards & activeBalance accounting done. This is guaranteed by address(0) & address(this) check in each updateForTwo function */ contract PendleYieldToken is IPYieldToken, PendleERC20Permit, RewardManagerAbstract, InterestManagerYT { using PMath for uint256; using SafeERC20 for IERC20; using ArrayLib for uint256[]; struct PostExpiryData { uint128 firstPYIndex; uint128 totalSyInterestForTreasury; mapping(address => uint256) firstRewardIndex; mapping(address => uint256) userRewardOwed; } address public immutable SY; address public immutable PT; address public immutable factory; uint256 public immutable expiry; bool public immutable doCacheIndexSameBlock; uint256 public syReserve; uint128 public pyIndexLastUpdatedBlock; uint128 internal _pyIndexStored; PostExpiryData public postExpiry; modifier updateData() { if (isExpired()) _setPostExpiryData(); _; _updateSyReserve(); } modifier notExpired() { if (isExpired()) revert Errors.YCExpired(); _; } /** * @param _doCacheIndexSameBlock if true, the PY index is cached for each block, and thus is * constant for all txs within the same block. Otherwise, the PY index is recalculated for * every tx. */ constructor( address _SY, address _PT, string memory _name, string memory _symbol, uint8 __decimals, uint256 _expiry, bool _doCacheIndexSameBlock ) PendleERC20Permit(_name, _symbol, __decimals) { SY = _SY; PT = _PT; expiry = _expiry; factory = msg.sender; doCacheIndexSameBlock = _doCacheIndexSameBlock; } /** * @notice Tokenize SY into PT + YT of equal qty. Every unit of asset of SY will create 1 PT + 1 YT * @dev SY must be transferred to this contract prior to calling */ function mintPY( address receiverPT, address receiverYT ) external nonReentrant notExpired updateData returns (uint256 amountPYOut) { address[] memory receiverPTs = new address[](1); address[] memory receiverYTs = new address[](1); uint256[] memory amountSyToMints = new uint256[](1); (receiverPTs[0], receiverYTs[0], amountSyToMints[0]) = (receiverPT, receiverYT, _getFloatingSyAmount()); uint256[] memory amountPYOuts = _mintPY(receiverPTs, receiverYTs, amountSyToMints); amountPYOut = amountPYOuts[0]; } /// @notice Tokenize SY into PT + YT for multiple receivers. See `mintPY()` for more details function mintPYMulti( address[] calldata receiverPTs, address[] calldata receiverYTs, uint256[] calldata amountSyToMints ) external nonReentrant notExpired updateData returns (uint256[] memory amountPYOuts) { uint256 length = receiverPTs.length; if (length == 0) revert Errors.ArrayEmpty(); if (receiverYTs.length != length || amountSyToMints.length != length) revert Errors.ArrayLengthMismatch(); uint256 totalSyToMint = amountSyToMints.sum(); if (totalSyToMint > _getFloatingSyAmount()) revert Errors.YieldContractInsufficientSy(totalSyToMint, _getFloatingSyAmount()); amountPYOuts = _mintPY(receiverPTs, receiverYTs, amountSyToMints); } /** * @notice converts PT(+YT) tokens into SY, but interests & rewards are not redeemed at the * same time * @dev PT/YT must be transferred to this contract prior to calling */ function redeemPY(address receiver) external nonReentrant updateData returns (uint256 amountSyOut) { address[] memory receivers = new address[](1); uint256[] memory amounts = new uint256[](1); (receivers[0], amounts[0]) = (receiver, _getAmountPYToRedeem()); uint256[] memory amountSyOuts; amountSyOuts = _redeemPY(receivers, amounts); amountSyOut = amountSyOuts[0]; } /** * @notice redeems PT(+YT) for multiple users. See `redeemPY()` * @dev PT/YT must be transferred to this contract prior to calling * @dev fails if unable to redeem the total PY amount in `amountPYToRedeems` */ function redeemPYMulti( address[] calldata receivers, uint256[] calldata amountPYToRedeems ) external nonReentrant updateData returns (uint256[] memory amountSyOuts) { if (receivers.length != amountPYToRedeems.length) revert Errors.ArrayLengthMismatch(); if (receivers.length == 0) revert Errors.ArrayEmpty(); amountSyOuts = _redeemPY(receivers, amountPYToRedeems); } /** * @notice Redeems interests and rewards for `user` * @param redeemInterest will only transfer out interest for user if true * @param redeemRewards will only transfer out rewards for user if true * @dev With YT yielding interest in the form of SY, which is redeemable by users, the reward * distribution should be based on the amount of SYs that their YT currently represent, plus * their dueInterest. It has been proven and tested that _rewardSharesUser will not change over * time, unless users redeem their dueInterest or redeemPY. Due to this, it is required to * update users' accruedReward STRICTLY BEFORE transferring out their interest. */ function redeemDueInterestAndRewards( address user, bool redeemInterest, bool redeemRewards ) external nonReentrant updateData returns (uint256 interestOut, uint256[] memory rewardsOut) { if (!redeemInterest && !redeemRewards) revert Errors.YCNothingToRedeem(); // if redeemRewards == true, this line must be here for obvious reason // if redeemInterest == true, this line must be here because of the reason above _updateAndDistributeRewards(user); if (redeemRewards) { rewardsOut = _doTransferOutRewards(user, user); emit RedeemRewards(user, rewardsOut); } else { address[] memory tokens = getRewardTokens(); rewardsOut = new uint256[](tokens.length); } if (redeemInterest) { _distributeInterest(user); interestOut = _doTransferOutInterest(user, SY, factory); emit RedeemInterest(user, interestOut); } else { interestOut = 0; } } /** * @dev All rewards and interests accrued post-expiry goes to the treasury. * Reverts if called pre-expiry. */ function redeemInterestAndRewardsPostExpiryForTreasury() external nonReentrant updateData returns (uint256 interestOut, uint256[] memory rewardsOut) { if (!isExpired()) revert Errors.YCNotExpired(); address treasury = IPYieldContractFactory(factory).treasury(); address[] memory tokens = getRewardTokens(); rewardsOut = new uint256[](tokens.length); _redeemExternalReward(); for (uint256 i = 0; i < tokens.length; i++) { rewardsOut[i] = _selfBalance(tokens[i]) - postExpiry.userRewardOwed[tokens[i]]; emit CollectRewardFee(tokens[i], rewardsOut[i]); } _transferOut(tokens, treasury, rewardsOut); interestOut = postExpiry.totalSyInterestForTreasury; postExpiry.totalSyInterestForTreasury = 0; _transferOut(SY, treasury, interestOut); emit CollectInterestFee(interestOut); } /// @notice updates and returns the reward indexes function rewardIndexesCurrent() external override nonReentrant returns (uint256[] memory) { return IStandardizedYield(SY).rewardIndexesCurrent(); } /** * @notice updates and returns the current PY index * @dev this function maximizes the current PY index with the previous index, guaranteeing * non-decreasing PY index * @dev if `doCacheIndexSameBlock` is true, PY index only updates at most once per block, * and has no state changes on the second call onwards (within the same block). * @dev see `pyIndexStored()` for view function for cached value. */ function pyIndexCurrent() public nonReentrant returns (uint256 currentIndex) { currentIndex = _pyIndexCurrent(); } /// @notice returns the last-updated PY index function pyIndexStored() public view returns (uint256) { return _pyIndexStored; } /** * @notice do a final rewards redeeming, and sets post-expiry data * @dev has no effect if called pre-expiry */ function setPostExpiryData() external nonReentrant { if (isExpired()) { _setPostExpiryData(); } } /** * @notice returns the current data post-expiry, if exists * @dev reverts if post-expiry data not set (see `setPostExpiryData()`) * @return firstPYIndex the earliest PY index post-expiry * @return totalSyInterestForTreasury current amount of SY interests post-expiry for treasury * @return firstRewardIndexes the earliest reward indices post-expiry, for each reward token * @return userRewardOwed amount of unclaimed user rewards, for each reward token */ function getPostExpiryData() external view returns ( uint256 firstPYIndex, uint256 totalSyInterestForTreasury, uint256[] memory firstRewardIndexes, uint256[] memory userRewardOwed ) { if (postExpiry.firstPYIndex == 0) revert Errors.YCPostExpiryDataNotSet(); firstPYIndex = postExpiry.firstPYIndex; totalSyInterestForTreasury = postExpiry.totalSyInterestForTreasury; address[] memory tokens = getRewardTokens(); firstRewardIndexes = new uint256[](tokens.length); userRewardOwed = new uint256[](tokens.length); for (uint256 i = 0; i < tokens.length; ++i) { firstRewardIndexes[i] = postExpiry.firstRewardIndex[tokens[i]]; userRewardOwed[i] = postExpiry.userRewardOwed[tokens[i]]; } } function _mintPY( address[] memory receiverPTs, address[] memory receiverYTs, uint256[] memory amountSyToMints ) internal returns (uint256[] memory amountPYOuts) { amountPYOuts = new uint256[](amountSyToMints.length); uint256 index = _pyIndexCurrent(); for (uint256 i = 0; i < amountSyToMints.length; i++) { amountPYOuts[i] = _calcPYToMint(amountSyToMints[i], index); _mint(receiverYTs[i], amountPYOuts[i]); IPPrincipalToken(PT).mintByYT(receiverPTs[i], amountPYOuts[i]); emit Mint(msg.sender, receiverPTs[i], receiverYTs[i], amountSyToMints[i], amountPYOuts[i]); } } function isExpired() public view returns (bool) { return MiniHelpers.isCurrentlyExpired(expiry); } function _redeemPY( address[] memory receivers, uint256[] memory amountPYToRedeems ) internal returns (uint256[] memory amountSyOuts) { uint256 totalAmountPYToRedeem = amountPYToRedeems.sum(); IPPrincipalToken(PT).burnByYT(address(this), totalAmountPYToRedeem); if (!isExpired()) _burn(address(this), totalAmountPYToRedeem); uint256 index = _pyIndexCurrent(); uint256 totalSyInterestPostExpiry; amountSyOuts = new uint256[](receivers.length); for (uint256 i = 0; i < receivers.length; i++) { uint256 syInterestPostExpiry; (amountSyOuts[i], syInterestPostExpiry) = _calcSyRedeemableFromPY(amountPYToRedeems[i], index); _transferOut(SY, receivers[i], amountSyOuts[i]); totalSyInterestPostExpiry += syInterestPostExpiry; emit Burn(msg.sender, receivers[i], amountPYToRedeems[i], amountSyOuts[i]); } if (totalSyInterestPostExpiry != 0) { postExpiry.totalSyInterestForTreasury += totalSyInterestPostExpiry.Uint128(); } } function _calcPYToMint(uint256 amountSy, uint256 indexCurrent) internal pure returns (uint256 amountPY) { // doesn't matter before or after expiry, since mintPY is only allowed before expiry return SYUtils.syToAsset(indexCurrent, amountSy); } function _calcSyRedeemableFromPY( uint256 amountPY, uint256 indexCurrent ) internal view returns (uint256 syToUser, uint256 syInterestPostExpiry) { syToUser = SYUtils.assetToSy(indexCurrent, amountPY); if (isExpired()) { uint256 totalSyRedeemable = SYUtils.assetToSy(postExpiry.firstPYIndex, amountPY); syInterestPostExpiry = totalSyRedeemable - syToUser; } } function _getAmountPYToRedeem() internal view returns (uint256) { if (!isExpired()) return PMath.min(_selfBalance(PT), balanceOf(address(this))); else return _selfBalance(PT); } function _updateSyReserve() internal virtual { syReserve = _selfBalance(SY); } function _getFloatingSyAmount() internal view returns (uint256 amount) { amount = _selfBalance(SY) - syReserve; if (amount == 0) revert Errors.YCNoFloatingSy(); } function _setPostExpiryData() internal { PostExpiryData storage local = postExpiry; if (local.firstPYIndex != 0) return; // already set _redeemExternalReward(); // do a final redeem. All the future reward income will belong to the treasury local.firstPYIndex = _pyIndexCurrent().Uint128(); address[] memory rewardTokens = IStandardizedYield(SY).getRewardTokens(); uint256[] memory rewardIndexes = IStandardizedYield(SY).rewardIndexesCurrent(); for (uint256 i = 0; i < rewardTokens.length; i++) { local.firstRewardIndex[rewardTokens[i]] = rewardIndexes[i]; local.userRewardOwed[rewardTokens[i]] = _selfBalance(rewardTokens[i]); } } /*/////////////////////////////////////////////////////////////// INTEREST-RELATED //////////////////////////////////////////////////////////////*/ function _getInterestIndex() internal virtual override returns (uint256 index) { if (isExpired()) index = postExpiry.firstPYIndex; else index = _pyIndexCurrent(); } function _pyIndexCurrent() internal returns (uint256 currentIndex) { if (doCacheIndexSameBlock && pyIndexLastUpdatedBlock == block.number) return _pyIndexStored; uint128 index128 = PMath.max(IStandardizedYield(SY).exchangeRate(), _pyIndexStored).Uint128(); currentIndex = index128; _pyIndexStored = index128; pyIndexLastUpdatedBlock = uint128(block.number); emit NewInterestIndex(currentIndex); } function _YTbalance(address user) internal view override returns (uint256) { return balanceOf(user); } /*/////////////////////////////////////////////////////////////// REWARDS-RELATED //////////////////////////////////////////////////////////////*/ function getRewardTokens() public view returns (address[] memory) { return IStandardizedYield(SY).getRewardTokens(); } function _doTransferOutRewards( address user, address receiver ) internal virtual override returns (uint256[] memory rewardAmounts) { address[] memory tokens = getRewardTokens(); if (isExpired()) { // post-expiry, all incoming rewards will go to the treasury // hence, we can save users one _redeemExternal here for (uint256 i = 0; i < tokens.length; i++) postExpiry.userRewardOwed[tokens[i]] -= userReward[tokens[i]][user].accrued; rewardAmounts = __doTransferOutRewardsLocal(tokens, user, receiver, false); } else { rewardAmounts = __doTransferOutRewardsLocal(tokens, user, receiver, true); } } function __doTransferOutRewardsLocal( address[] memory tokens, address user, address receiver, bool allowedToRedeemExternalReward ) internal returns (uint256[] memory rewardAmounts) { address treasury = IPYieldContractFactory(factory).treasury(); uint256 feeRate = IPYieldContractFactory(factory).rewardFeeRate(); bool redeemExternalThisRound; rewardAmounts = new uint256[](tokens.length); for (uint256 i = 0; i < tokens.length; i++) { uint256 rewardPreFee = userReward[tokens[i]][user].accrued; userReward[tokens[i]][user].accrued = 0; uint256 feeAmount = rewardPreFee.mulDown(feeRate); rewardAmounts[i] = rewardPreFee - feeAmount; if (!redeemExternalThisRound && allowedToRedeemExternalReward) { if (_selfBalance(tokens[i]) < rewardPreFee) { _redeemExternalReward(); redeemExternalThisRound = true; } } _transferOut(tokens[i], treasury, feeAmount); _transferOut(tokens[i], receiver, rewardAmounts[i]); emit CollectRewardFee(tokens[i], feeAmount); } } function _redeemExternalReward() internal virtual override { IStandardizedYield(SY).claimRewards(address(this)); } /// @dev effectively returning the amount of SY generating rewards for this user function _rewardSharesUser(address user) internal view virtual override returns (uint256) { uint256 index = userInterest[user].index; if (index == 0) return 0; return SYUtils.assetToSy(index, balanceOf(user)) + userInterest[user].accrued; } function _updateRewardIndex() internal override returns (address[] memory tokens, uint256[] memory indexes) { tokens = getRewardTokens(); if (isExpired()) { indexes = new uint256[](tokens.length); for (uint256 i = 0; i < tokens.length; i++) indexes[i] = postExpiry.firstRewardIndex[tokens[i]]; } else { indexes = IStandardizedYield(SY).rewardIndexesCurrent(); } } //solhint-disable-next-line ordering function _beforeTokenTransfer(address from, address to, uint256) internal override { if (isExpired()) _setPostExpiryData(); _updateAndDistributeRewardsForTwo(from, to); _distributeInterestForTwo(from, to); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * 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 ERC20 is Context, IERC20, IERC20Metadata { 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}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _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 default value returned by this function, unless * it's 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; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _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; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _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; // Overflow not possible: amount <= accountBalance <= totalSupply. _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 {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; // EIP-2612 is Final as of 2022-11-01. This file is deprecated. import "./ERC20Permit.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.0; import "./IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/cryptography/EIP712.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation 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. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @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 (last updated v4.9.0) (token/ERC20/extensions/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.9.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 (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/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; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.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)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ 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"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ 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"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // 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 cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; // EIP-712 is Final as of 2022-08-11. This file is deprecated. import "./EIP712.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.8; import "./ECDSA.sol"; import "../ShortStrings.sol"; import "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * _Available since v3.4._ * * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {EIP-5267}. * * _Available since v4.9._ */ function eip712Domain() public view virtual override returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _name.toStringWithFallback(_nameFallback), _version.toStringWithFallback(_versionFallback), block.chainid, address(this), bytes32(0), new uint256[](0) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { 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) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 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. If 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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 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) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol) pragma solidity ^0.8.8; import "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(_FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: GPL-3.0-or-later // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/utils/Context.sol"; /** * @dev Pendle's ERC20 implementation, modified from @openzeppelin implementation * Changes are: * - comes with built-in reentrancy protection, storage-packed with totalSupply variable * - delete increaseAllowance / decreaseAllowance * - add nonReentrancy protection to transfer / transferFrom functions * - allow decimals to be passed in * - block self-transfer by default */ // solhint-disable contract PendleERC20 is Context, IERC20, IERC20Metadata { uint8 private constant _NOT_ENTERED = 1; uint8 private constant _ENTERED = 2; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint248 private _totalSupply; uint8 private _status; string private _name; string private _symbol; uint8 public immutable decimals; /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Sets the values for {name}, {symbol} and {decimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_, uint8 decimals_) { _name = name_; _symbol = symbol_; decimals = decimals_; _status = _NOT_ENTERED; } /** * @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 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) external virtual override nonReentrant 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) external 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 ) external virtual override nonReentrant returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * 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"); require(from != to, "ERC20: transfer to self"); _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 += toUint248(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 -= toUint248(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 {} function toUint248(uint256 x) internal virtual returns (uint248) { require(x <= type(uint248).max); // signed, lim = bit-1 return uint248(x); } }
// SPDX-License-Identifier: GPL-3.0-or-later // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./PendleERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; /// @dev forked from OZ's ERC20Permit contract PendleERC20Permit is PendleERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); constructor( string memory name_, string memory symbol_, uint8 decimals_ ) PendleERC20(name_, symbol_, decimals_) EIP712(name_, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; library ArrayLib { function sum(uint256[] memory input) internal pure returns (uint256) { uint256 value = 0; for (uint256 i = 0; i < input.length; ) { value += input[i]; unchecked { i++; } } return value; } /// @notice return index of the element if found, else return uint256.max function find(address[] memory array, address element) internal pure returns (uint256 index) { uint256 length = array.length; for (uint256 i = 0; i < length; ) { if (array[i] == element) return i; unchecked { i++; } } return type(uint256).max; } function append(address[] memory inp, address element) internal pure returns (address[] memory out) { uint256 length = inp.length; out = new address[](length + 1); for (uint256 i = 0; i < length; ) { out[i] = inp[i]; unchecked { i++; } } out[length] = element; } /** * @dev This function assumes a and b each contains unidentical elements * @param a array of addresses a * @param b array of addresses b * @return out Concatenation of a and b containing unidentical elements */ function merge(address[] memory a, address[] memory b) internal pure returns (address[] memory out) { unchecked { uint256 countUnidenticalB = 0; bool[] memory isUnidentical = new bool[](b.length); for (uint256 i = 0; i < b.length; ++i) { if (!contains(a, b[i])) { countUnidenticalB++; isUnidentical[i] = true; } } out = new address[](a.length + countUnidenticalB); for (uint256 i = 0; i < a.length; ++i) { out[i] = a[i]; } uint256 id = a.length; for (uint256 i = 0; i < b.length; ++i) { if (isUnidentical[i]) { out[id++] = b[i]; } } } } // various version of contains function contains(address[] memory array, address element) internal pure returns (bool) { uint256 length = array.length; for (uint256 i = 0; i < length; ) { if (array[i] == element) return true; unchecked { i++; } } return false; } function contains(bytes4[] memory array, bytes4 element) internal pure returns (bool) { uint256 length = array.length; for (uint256 i = 0; i < length; ) { if (array[i] == element) return true; unchecked { i++; } } return false; } function create(address a) internal pure returns (address[] memory res) { res = new address[](1); res[0] = a; } function create(address a, address b) internal pure returns (address[] memory res) { res = new address[](2); res[0] = a; res[1] = b; } function create(uint256 a) internal pure returns (uint256[] memory res) { res = new uint256[](1); res[0] = a; } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; library Errors { // BulkSeller error BulkInsufficientSyForTrade(uint256 currentAmount, uint256 requiredAmount); error BulkInsufficientTokenForTrade(uint256 currentAmount, uint256 requiredAmount); error BulkInSufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut); error BulkInSufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut); error BulkInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance); error BulkNotMaintainer(); error BulkNotAdmin(); error BulkSellerAlreadyExisted(address token, address SY, address bulk); error BulkSellerInvalidToken(address token, address SY); error BulkBadRateTokenToSy(uint256 actualRate, uint256 currentRate, uint256 eps); error BulkBadRateSyToToken(uint256 actualRate, uint256 currentRate, uint256 eps); // APPROX error ApproxFail(); error ApproxParamsInvalid(uint256 guessMin, uint256 guessMax, uint256 eps); error ApproxBinarySearchInputInvalid( uint256 approxGuessMin, uint256 approxGuessMax, uint256 minGuessMin, uint256 maxGuessMax ); // MARKET + MARKET MATH CORE error MarketExpired(); error MarketZeroAmountsInput(); error MarketZeroAmountsOutput(); error MarketZeroLnImpliedRate(); error MarketInsufficientPtForTrade(int256 currentAmount, int256 requiredAmount); error MarketInsufficientPtReceived(uint256 actualBalance, uint256 requiredBalance); error MarketInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance); error MarketZeroTotalPtOrTotalAsset(int256 totalPt, int256 totalAsset); error MarketExchangeRateBelowOne(int256 exchangeRate); error MarketProportionMustNotEqualOne(); error MarketRateScalarBelowZero(int256 rateScalar); error MarketScalarRootBelowZero(int256 scalarRoot); error MarketProportionTooHigh(int256 proportion, int256 maxProportion); error OracleUninitialized(); error OracleTargetTooOld(uint32 target, uint32 oldest); error OracleZeroCardinality(); error MarketFactoryExpiredPt(); error MarketFactoryInvalidPt(); error MarketFactoryMarketExists(); error MarketFactoryLnFeeRateRootTooHigh(uint80 lnFeeRateRoot, uint256 maxLnFeeRateRoot); error MarketFactoryOverriddenFeeTooHigh(uint80 overriddenFee, uint256 marketLnFeeRateRoot); error MarketFactoryReserveFeePercentTooHigh(uint8 reserveFeePercent, uint8 maxReserveFeePercent); error MarketFactoryZeroTreasury(); error MarketFactoryInitialAnchorTooLow(int256 initialAnchor, int256 minInitialAnchor); error MFNotPendleMarket(address addr); // ROUTER error RouterInsufficientLpOut(uint256 actualLpOut, uint256 requiredLpOut); error RouterInsufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut); error RouterInsufficientPtOut(uint256 actualPtOut, uint256 requiredPtOut); error RouterInsufficientYtOut(uint256 actualYtOut, uint256 requiredYtOut); error RouterInsufficientPYOut(uint256 actualPYOut, uint256 requiredPYOut); error RouterInsufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut); error RouterInsufficientSyRepay(uint256 actualSyRepay, uint256 requiredSyRepay); error RouterInsufficientPtRepay(uint256 actualPtRepay, uint256 requiredPtRepay); error RouterNotAllSyUsed(uint256 netSyDesired, uint256 netSyUsed); error RouterTimeRangeZero(); error RouterCallbackNotPendleMarket(address caller); error RouterInvalidAction(bytes4 selector); error RouterInvalidFacet(address facet); error RouterKyberSwapDataZero(); error SimulationResults(bool success, bytes res); // YIELD CONTRACT error YCExpired(); error YCNotExpired(); error YieldContractInsufficientSy(uint256 actualSy, uint256 requiredSy); error YCNothingToRedeem(); error YCPostExpiryDataNotSet(); error YCNoFloatingSy(); // YieldFactory error YCFactoryInvalidExpiry(); error YCFactoryYieldContractExisted(); error YCFactoryZeroExpiryDivisor(); error YCFactoryZeroTreasury(); error YCFactoryInterestFeeRateTooHigh(uint256 interestFeeRate, uint256 maxInterestFeeRate); error YCFactoryRewardFeeRateTooHigh(uint256 newRewardFeeRate, uint256 maxRewardFeeRate); // SY error SYInvalidTokenIn(address token); error SYInvalidTokenOut(address token); error SYZeroDeposit(); error SYZeroRedeem(); error SYInsufficientSharesOut(uint256 actualSharesOut, uint256 requiredSharesOut); error SYInsufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut); // SY-specific error SYQiTokenMintFailed(uint256 errCode); error SYQiTokenRedeemFailed(uint256 errCode); error SYQiTokenRedeemRewardsFailed(uint256 rewardAccruedType0, uint256 rewardAccruedType1); error SYQiTokenBorrowRateTooHigh(uint256 borrowRate, uint256 borrowRateMax); error SYCurveInvalidPid(); error SYCurve3crvPoolNotFound(); error SYApeDepositAmountTooSmall(uint256 amountDeposited); error SYBalancerInvalidPid(); error SYInvalidRewardToken(address token); error SYStargateRedeemCapExceeded(uint256 amountLpDesired, uint256 amountLpRedeemable); error SYBalancerReentrancy(); error NotFromTrustedRemote(uint16 srcChainId, bytes path); // Liquidity Mining error VCInactivePool(address pool); error VCPoolAlreadyActive(address pool); error VCZeroVePendle(address user); error VCExceededMaxWeight(uint256 totalWeight, uint256 maxWeight); error VCEpochNotFinalized(uint256 wTime); error VCPoolAlreadyAddAndRemoved(address pool); error VEInvalidNewExpiry(uint256 newExpiry); error VEExceededMaxLockTime(); error VEInsufficientLockTime(); error VENotAllowedReduceExpiry(); error VEZeroAmountLocked(); error VEPositionNotExpired(); error VEZeroPosition(); error VEZeroSlope(uint128 bias, uint128 slope); error VEReceiveOldSupply(uint256 msgTime); error GCNotPendleMarket(address caller); error GCNotVotingController(address caller); error InvalidWTime(uint256 wTime); error ExpiryInThePast(uint256 expiry); error ChainNotSupported(uint256 chainId); error FDTotalAmountFundedNotMatch(uint256 actualTotalAmount, uint256 expectedTotalAmount); error FDEpochLengthMismatch(); error FDInvalidPool(address pool); error FDPoolAlreadyExists(address pool); error FDInvalidNewFinishedEpoch(uint256 oldFinishedEpoch, uint256 newFinishedEpoch); error FDInvalidStartEpoch(uint256 startEpoch); error FDInvalidWTimeFund(uint256 lastFunded, uint256 wTime); error FDFutureFunding(uint256 lastFunded, uint256 currentWTime); error BDInvalidEpoch(uint256 epoch, uint256 startTime); // Cross-Chain error MsgNotFromSendEndpoint(uint16 srcChainId, bytes path); error MsgNotFromReceiveEndpoint(address sender); error InsufficientFeeToSendMsg(uint256 currentFee, uint256 requiredFee); error ApproxDstExecutionGasNotSet(); error InvalidRetryData(); // GENERIC MSG error ArrayLengthMismatch(); error ArrayEmpty(); error ArrayOutOfBounds(); error ZeroAddress(); error FailedToSendEther(); error InvalidMerkleProof(); error OnlyLayerZeroEndpoint(); error OnlyYT(); error OnlyYCFactory(); error OnlyWhitelisted(); // Swap Aggregator error SAInsufficientTokenIn(address tokenIn, uint256 amountExpected, uint256 amountActual); error UnsupportedSelector(uint256 aggregatorType, bytes4 selector); }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.8.0; /* solhint-disable private-vars-leading-underscore, reason-string */ library PMath { uint256 internal constant ONE = 1e18; // 18 decimal places int256 internal constant IONE = 1e18; // 18 decimal places function subMax0(uint256 a, uint256 b) internal pure returns (uint256) { unchecked { return (a >= b ? a - b : 0); } } function subNoNeg(int256 a, int256 b) internal pure returns (int256) { require(a >= b, "negative"); return a - b; // no unchecked since if b is very negative, a - b might overflow } function mulDown(uint256 a, uint256 b) internal pure returns (uint256) { uint256 product = a * b; unchecked { return product / ONE; } } function mulDown(int256 a, int256 b) internal pure returns (int256) { int256 product = a * b; unchecked { return product / IONE; } } function divDown(uint256 a, uint256 b) internal pure returns (uint256) { uint256 aInflated = a * ONE; unchecked { return aInflated / b; } } function divDown(int256 a, int256 b) internal pure returns (int256) { int256 aInflated = a * IONE; unchecked { return aInflated / b; } } function rawDivUp(uint256 a, uint256 b) internal pure returns (uint256) { return (a + b - 1) / b; } // @author Uniswap function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } function square(uint256 x) internal pure returns (uint256) { return x * x; } function squareDown(uint256 x) internal pure returns (uint256) { return mulDown(x, x); } function abs(int256 x) internal pure returns (uint256) { return uint256(x > 0 ? x : -x); } function neg(int256 x) internal pure returns (int256) { return x * (-1); } function neg(uint256 x) internal pure returns (int256) { return Int(x) * (-1); } function max(uint256 x, uint256 y) internal pure returns (uint256) { return (x > y ? x : y); } function max(int256 x, int256 y) internal pure returns (int256) { return (x > y ? x : y); } function min(uint256 x, uint256 y) internal pure returns (uint256) { return (x < y ? x : y); } function min(int256 x, int256 y) internal pure returns (int256) { return (x < y ? x : y); } /*/////////////////////////////////////////////////////////////// SIGNED CASTS //////////////////////////////////////////////////////////////*/ function Int(uint256 x) internal pure returns (int256) { require(x <= uint256(type(int256).max)); return int256(x); } function Int128(int256 x) internal pure returns (int128) { require(type(int128).min <= x && x <= type(int128).max); return int128(x); } function Int128(uint256 x) internal pure returns (int128) { return Int128(Int(x)); } /*/////////////////////////////////////////////////////////////// UNSIGNED CASTS //////////////////////////////////////////////////////////////*/ function Uint(int256 x) internal pure returns (uint256) { require(x >= 0); return uint256(x); } function Uint32(uint256 x) internal pure returns (uint32) { require(x <= type(uint32).max); return uint32(x); } function Uint64(uint256 x) internal pure returns (uint64) { require(x <= type(uint64).max); return uint64(x); } function Uint112(uint256 x) internal pure returns (uint112) { require(x <= type(uint112).max); return uint112(x); } function Uint96(uint256 x) internal pure returns (uint96) { require(x <= type(uint96).max); return uint96(x); } function Uint128(uint256 x) internal pure returns (uint128) { require(x <= type(uint128).max); return uint128(x); } function Uint192(uint256 x) internal pure returns (uint192) { require(x <= type(uint192).max); return uint192(x); } function isAApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) { return mulDown(b, ONE - eps) <= a && a <= mulDown(b, ONE + eps); } function isAGreaterApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) { return a >= b && a <= mulDown(b, ONE + eps); } function isASmallerApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) { return a <= b && a >= mulDown(b, ONE - eps); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; library MiniHelpers { function isCurrentlyExpired(uint256 expiry) internal view returns (bool) { return (expiry <= block.timestamp); } function isExpired(uint256 expiry, uint256 blockTime) internal pure returns (bool) { return (expiry <= blockTime); } function isTimeInThePast(uint256 timestamp) internal view returns (bool) { return (timestamp <= block.timestamp); // same definition as isCurrentlyExpired } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../../interfaces/IWETH.sol"; abstract contract TokenHelper { using SafeERC20 for IERC20; address internal constant NATIVE = address(0); uint256 internal constant LOWER_BOUND_APPROVAL = type(uint96).max / 2; // some tokens use 96 bits for approval function _transferIn(address token, address from, uint256 amount) internal { if (token == NATIVE) require(msg.value == amount, "eth mismatch"); else if (amount != 0) IERC20(token).safeTransferFrom(from, address(this), amount); } function _transferFrom(IERC20 token, address from, address to, uint256 amount) internal { if (amount != 0) token.safeTransferFrom(from, to, amount); } function _transferOut(address token, address to, uint256 amount) internal { if (amount == 0) return; if (token == NATIVE) { (bool success, ) = to.call{value: amount}(""); require(success, "eth send failed"); } else { IERC20(token).safeTransfer(to, amount); } } function _transferOut(address[] memory tokens, address to, uint256[] memory amounts) internal { uint256 numTokens = tokens.length; require(numTokens == amounts.length, "length mismatch"); for (uint256 i = 0; i < numTokens; ) { _transferOut(tokens[i], to, amounts[i]); unchecked { i++; } } } function _selfBalance(address token) internal view returns (uint256) { return (token == NATIVE) ? address(this).balance : IERC20(token).balanceOf(address(this)); } function _selfBalance(IERC20 token) internal view returns (uint256) { return token.balanceOf(address(this)); } /// @notice Approves the stipulated contract to spend the given allowance in the given token /// @dev PLS PAY ATTENTION to tokens that requires the approval to be set to 0 before changing it function _safeApprove(address token, address to, uint256 value) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "Safe Approve"); } function _safeApproveInf(address token, address to) internal { if (token == NATIVE) return; if (IERC20(token).allowance(address(this), to) < LOWER_BOUND_APPROVAL) { _safeApprove(token, to, 0); _safeApprove(token, to, type(uint256).max); } } function _wrap_unwrap_ETH(address tokenIn, address tokenOut, uint256 netTokenIn) internal { if (tokenIn == NATIVE) IWETH(tokenOut).deposit{value: netTokenIn}(); else IWETH(tokenIn).withdraw(netTokenIn); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "../../interfaces/IRewardManager.sol"; import "../libraries/ArrayLib.sol"; import "../libraries/TokenHelper.sol"; import "../libraries/math/PMath.sol"; import "./RewardManagerAbstract.sol"; /// NOTE: RewardManager must not have duplicated rewardTokens abstract contract RewardManagerAbstract is IRewardManager, TokenHelper { using PMath for uint256; uint256 internal constant INITIAL_REWARD_INDEX = 1; struct RewardState { uint128 index; uint128 lastBalance; } struct UserReward { uint128 index; uint128 accrued; } // [token] => [user] => (index,accrued) mapping(address => mapping(address => UserReward)) public userReward; function _updateAndDistributeRewards(address user) internal virtual { _updateAndDistributeRewardsForTwo(user, address(0)); } function _updateAndDistributeRewardsForTwo(address user1, address user2) internal virtual { (address[] memory tokens, uint256[] memory indexes) = _updateRewardIndex(); if (tokens.length == 0) return; if (user1 != address(0) && user1 != address(this)) _distributeRewardsPrivate(user1, tokens, indexes); if (user2 != address(0) && user2 != address(this)) _distributeRewardsPrivate(user2, tokens, indexes); } // should only be callable from `_updateAndDistributeRewardsForTwo` to guarantee user != address(0) && user != address(this) function _distributeRewardsPrivate(address user, address[] memory tokens, uint256[] memory indexes) private { assert(user != address(0) && user != address(this)); uint256 userShares = _rewardSharesUser(user); for (uint256 i = 0; i < tokens.length; ++i) { address token = tokens[i]; uint256 index = indexes[i]; uint256 userIndex = userReward[token][user].index; if (userIndex == 0) { userIndex = INITIAL_REWARD_INDEX.Uint128(); } if (userIndex == index) continue; uint256 deltaIndex = index - userIndex; uint256 rewardDelta = userShares.mulDown(deltaIndex); uint256 rewardAccrued = userReward[token][user].accrued + rewardDelta; userReward[token][user] = UserReward({index: index.Uint128(), accrued: rewardAccrued.Uint128()}); } } function _updateRewardIndex() internal virtual returns (address[] memory tokens, uint256[] memory indexes); function _redeemExternalReward() internal virtual; function _doTransferOutRewards( address user, address receiver ) internal virtual returns (uint256[] memory rewardAmounts); function _rewardSharesUser(address user) internal view virtual returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; library SYUtils { uint256 internal constant ONE = 1e18; function syToAsset(uint256 exchangeRate, uint256 syAmount) internal pure returns (uint256) { return (syAmount * exchangeRate) / ONE; } function syToAssetUp(uint256 exchangeRate, uint256 syAmount) internal pure returns (uint256) { return (syAmount * exchangeRate + ONE - 1) / ONE; } function assetToSy(uint256 exchangeRate, uint256 assetAmount) internal pure returns (uint256) { return (assetAmount * ONE) / exchangeRate; } function assetToSyUp(uint256 exchangeRate, uint256 assetAmount) internal pure returns (uint256) { return (assetAmount * ONE + exchangeRate - 1) / exchangeRate; } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; import "../../interfaces/IPYieldToken.sol"; import "../../interfaces/IPPrincipalToken.sol"; import "../../interfaces/IPInterestManagerYT.sol"; import "../../interfaces/IPYieldContractFactory.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../libraries/math/PMath.sol"; import "../libraries/TokenHelper.sol"; import "../StandardizedYield/SYUtils.sol"; /* With YT yielding more SYs overtime, which is allowed to be redeemed by users, the reward distribution should be based on the amount of SYs that their YT currently represent, plus with their dueInterest. It has been proven and tested that totalSyRedeemable will not change over time, unless users redeem their interest or redeemPY. Due to this, it is required to update users' accruedReward STRICTLY BEFORE redeeming their interest. */ abstract contract InterestManagerYT is TokenHelper, IPInterestManagerYT { using PMath for uint256; struct UserInterest { uint128 index; uint128 accrued; } mapping(address => UserInterest) public userInterest; function _distributeInterest(address user) internal { _distributeInterestForTwo(user, address(0)); } function _distributeInterestForTwo(address user1, address user2) internal { uint256 index = _getInterestIndex(); if (user1 != address(0) && user1 != address(this)) _distributeInterestPrivate(user1, index); if (user2 != address(0) && user2 != address(this)) _distributeInterestPrivate(user2, index); } function _doTransferOutInterest( address user, address SY, address factory ) internal returns (uint256 interestAmount) { address treasury = IPYieldContractFactory(factory).treasury(); uint256 feeRate = IPYieldContractFactory(factory).interestFeeRate(); uint256 interestPreFee = userInterest[user].accrued; userInterest[user].accrued = 0; uint256 feeAmount = interestPreFee.mulDown(feeRate); interestAmount = interestPreFee - feeAmount; _transferOut(SY, treasury, feeAmount); _transferOut(SY, user, interestAmount); emit CollectInterestFee(feeAmount); } // should only be callable from `_distributeInterestForTwo` & make sure user != address(0) && user != address(this) function _distributeInterestPrivate(address user, uint256 currentIndex) private { assert(user != address(0) && user != address(this)); uint256 prevIndex = userInterest[user].index; if (prevIndex == currentIndex) return; if (prevIndex == 0) { userInterest[user].index = currentIndex.Uint128(); return; } uint256 principal = _YTbalance(user); uint256 interestFromYT = (principal * (currentIndex - prevIndex)).divDown(prevIndex * currentIndex); userInterest[user].accrued += interestFromYT.Uint128(); userInterest[user].index = currentIndex.Uint128(); } function _getInterestIndex() internal virtual returns (uint256 index); function _YTbalance(address user) internal view virtual returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; interface IPInterestManagerYT { event CollectInterestFee(uint256 amountInterestFee); function userInterest(address user) external view returns (uint128 lastPYIndex, uint128 accruedInterest); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface IPPrincipalToken is IERC20Metadata { function burnByYT(address user, uint256 amount) external; function mintByYT(address user, uint256 amount) external; function initialize(address _YT) external; function SY() external view returns (address); function YT() external view returns (address); function factory() external view returns (address); function expiry() external view returns (uint256); function isExpired() external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later /* * MIT License * =========== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ pragma solidity ^0.8.0; interface IPYieldContractFactory { event CreateYieldContract(address indexed SY, uint256 indexed expiry, address PT, address YT); event SetExpiryDivisor(uint256 newExpiryDivisor); event SetInterestFeeRate(uint256 newInterestFeeRate); event SetRewardFeeRate(uint256 newRewardFeeRate); event SetTreasury(address indexed treasury); function getPT(address SY, uint256 expiry) external view returns (address); function getYT(address SY, uint256 expiry) external view returns (address); function expiryDivisor() external view returns (uint96); function interestFeeRate() external view returns (uint128); function rewardFeeRate() external view returns (uint128); function treasury() external view returns (address); function isPT(address) external view returns (bool); function isYT(address) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "./IRewardManager.sol"; import "./IPInterestManagerYT.sol"; interface IPYieldToken is IERC20Metadata, IRewardManager, IPInterestManagerYT { event NewInterestIndex(uint256 indexed newIndex); event Mint( address indexed caller, address indexed receiverPT, address indexed receiverYT, uint256 amountSyToMint, uint256 amountPYOut ); event Burn(address indexed caller, address indexed receiver, uint256 amountPYToRedeem, uint256 amountSyOut); event RedeemRewards(address indexed user, uint256[] amountRewardsOut); event RedeemInterest(address indexed user, uint256 interestOut); event CollectRewardFee(address indexed rewardToken, uint256 amountRewardFee); function mintPY(address receiverPT, address receiverYT) external returns (uint256 amountPYOut); function redeemPY(address receiver) external returns (uint256 amountSyOut); function redeemPYMulti( address[] calldata receivers, uint256[] calldata amountPYToRedeems ) external returns (uint256[] memory amountSyOuts); function redeemDueInterestAndRewards( address user, bool redeemInterest, bool redeemRewards ) external returns (uint256 interestOut, uint256[] memory rewardsOut); function rewardIndexesCurrent() external returns (uint256[] memory); function pyIndexCurrent() external returns (uint256); function pyIndexStored() external view returns (uint256); function getRewardTokens() external view returns (address[] memory); function SY() external view returns (address); function PT() external view returns (address); function factory() external view returns (address); function expiry() external view returns (uint256); function isExpired() external view returns (bool); function doCacheIndexSameBlock() external view returns (bool); function pyIndexLastUpdatedBlock() external view returns (uint128); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; interface IRewardManager { function userReward(address token, address user) external view returns (uint128 index, uint128 accrued); }
// SPDX-License-Identifier: GPL-3.0-or-later /* * MIT License * =========== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface IStandardizedYield is IERC20Metadata { /// @dev Emitted when any base tokens is deposited to mint shares event Deposit( address indexed caller, address indexed receiver, address indexed tokenIn, uint256 amountDeposited, uint256 amountSyOut ); /// @dev Emitted when any shares are redeemed for base tokens event Redeem( address indexed caller, address indexed receiver, address indexed tokenOut, uint256 amountSyToRedeem, uint256 amountTokenOut ); /// @dev check `assetInfo()` for more information enum AssetType { TOKEN, LIQUIDITY } /// @dev Emitted when (`user`) claims their rewards event ClaimRewards(address indexed user, address[] rewardTokens, uint256[] rewardAmounts); /** * @notice mints an amount of shares by depositing a base token. * @param receiver shares recipient address * @param tokenIn address of the base tokens to mint shares * @param amountTokenToDeposit amount of base tokens to be transferred from (`msg.sender`) * @param minSharesOut reverts if amount of shares minted is lower than this * @return amountSharesOut amount of shares minted * @dev Emits a {Deposit} event * * Requirements: * - (`tokenIn`) must be a valid base token. */ function deposit( address receiver, address tokenIn, uint256 amountTokenToDeposit, uint256 minSharesOut ) external payable returns (uint256 amountSharesOut); /** * @notice redeems an amount of base tokens by burning some shares * @param receiver recipient address * @param amountSharesToRedeem amount of shares to be burned * @param tokenOut address of the base token to be redeemed * @param minTokenOut reverts if amount of base token redeemed is lower than this * @param burnFromInternalBalance if true, burns from balance of `address(this)`, otherwise burns from `msg.sender` * @return amountTokenOut amount of base tokens redeemed * @dev Emits a {Redeem} event * * Requirements: * - (`tokenOut`) must be a valid base token. */ function redeem( address receiver, uint256 amountSharesToRedeem, address tokenOut, uint256 minTokenOut, bool burnFromInternalBalance ) external returns (uint256 amountTokenOut); /** * @notice exchangeRate * syBalance / 1e18 must return the asset balance of the account * @notice vice-versa, if a user uses some amount of tokens equivalent to X asset, the amount of sy he can mint must be X * exchangeRate / 1e18 * @dev SYUtils's assetToSy & syToAsset should be used instead of raw multiplication & division */ function exchangeRate() external view returns (uint256 res); /** * @notice claims reward for (`user`) * @param user the user receiving their rewards * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens` * @dev * Emits a `ClaimRewards` event * See {getRewardTokens} for list of reward tokens */ function claimRewards(address user) external returns (uint256[] memory rewardAmounts); /** * @notice get the amount of unclaimed rewards for (`user`) * @param user the user to check for * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens` */ function accruedRewards(address user) external view returns (uint256[] memory rewardAmounts); function rewardIndexesCurrent() external returns (uint256[] memory indexes); function rewardIndexesStored() external view returns (uint256[] memory indexes); /** * @notice returns the list of reward token addresses */ function getRewardTokens() external view returns (address[] memory); /** * @notice returns the address of the underlying yield token */ function yieldToken() external view returns (address); /** * @notice returns all tokens that can mint this SY */ function getTokensIn() external view returns (address[] memory res); /** * @notice returns all tokens that can be redeemed by this SY */ function getTokensOut() external view returns (address[] memory res); function isValidTokenIn(address token) external view returns (bool); function isValidTokenOut(address token) external view returns (bool); function previewDeposit( address tokenIn, uint256 amountTokenToDeposit ) external view returns (uint256 amountSharesOut); function previewRedeem( address tokenOut, uint256 amountSharesToRedeem ) external view returns (uint256 amountTokenOut); /** * @notice This function contains information to interpret what the asset is * @return assetType the type of the asset (0 for ERC20 tokens, 1 for AMM liquidity tokens, 2 for bridged yield bearing tokens like wstETH, rETH on Arbi whose the underlying asset doesn't exist on the chain) * @return assetAddress the address of the asset * @return assetDecimals the decimals of the asset */ function assetInfo() external view returns (AssetType assetType, address assetAddress, uint8 assetDecimals); }
// SPDX-License-Identifier: GPL-3.0-or-later /* * MIT License * =========== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IWETH is IERC20 { event Deposit(address indexed dst, uint256 wad); event Withdrawal(address indexed src, uint256 wad); function deposit() external payable; function withdraw(uint256 wad) external; }
{ "optimizer": { "enabled": true, "runs": 1000000 }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_SY","type":"address"},{"internalType":"address","name":"_PT","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"__decimals","type":"uint8"},{"internalType":"uint256","name":"_expiry","type":"uint256"},{"internalType":"bool","name":"_doCacheIndexSameBlock","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayEmpty","type":"error"},{"inputs":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[],"name":"YCExpired","type":"error"},{"inputs":[],"name":"YCNoFloatingSy","type":"error"},{"inputs":[],"name":"YCNotExpired","type":"error"},{"inputs":[],"name":"YCNothingToRedeem","type":"error"},{"inputs":[],"name":"YCPostExpiryDataNotSet","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualSy","type":"uint256"},{"internalType":"uint256","name":"requiredSy","type":"uint256"}],"name":"YieldContractInsufficientSy","type":"error"},{"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":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountPYToRedeem","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSyOut","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountInterestFee","type":"uint256"}],"name":"CollectInterestFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountRewardFee","type":"uint256"}],"name":"CollectRewardFee","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiverPT","type":"address"},{"indexed":true,"internalType":"address","name":"receiverYT","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSyToMint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountPYOut","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"newIndex","type":"uint256"}],"name":"NewInterestIndex","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"interestOut","type":"uint256"}],"name":"RedeemInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"amountRewardsOut","type":"uint256[]"}],"name":"RedeemRewards","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"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SY","outputs":[{"internalType":"address","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":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"doCacheIndexSameBlock","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expiry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPostExpiryData","outputs":[{"internalType":"uint256","name":"firstPYIndex","type":"uint256"},{"internalType":"uint256","name":"totalSyInterestForTreasury","type":"uint256"},{"internalType":"uint256[]","name":"firstRewardIndexes","type":"uint256[]"},{"internalType":"uint256[]","name":"userRewardOwed","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isExpired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiverPT","type":"address"},{"internalType":"address","name":"receiverYT","type":"address"}],"name":"mintPY","outputs":[{"internalType":"uint256","name":"amountPYOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"receiverPTs","type":"address[]"},{"internalType":"address[]","name":"receiverYTs","type":"address[]"},{"internalType":"uint256[]","name":"amountSyToMints","type":"uint256[]"}],"name":"mintPYMulti","outputs":[{"internalType":"uint256[]","name":"amountPYOuts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"postExpiry","outputs":[{"internalType":"uint128","name":"firstPYIndex","type":"uint128"},{"internalType":"uint128","name":"totalSyInterestForTreasury","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pyIndexCurrent","outputs":[{"internalType":"uint256","name":"currentIndex","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pyIndexLastUpdatedBlock","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pyIndexStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bool","name":"redeemInterest","type":"bool"},{"internalType":"bool","name":"redeemRewards","type":"bool"}],"name":"redeemDueInterestAndRewards","outputs":[{"internalType":"uint256","name":"interestOut","type":"uint256"},{"internalType":"uint256[]","name":"rewardsOut","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redeemInterestAndRewardsPostExpiryForTreasury","outputs":[{"internalType":"uint256","name":"interestOut","type":"uint256"},{"internalType":"uint256[]","name":"rewardsOut","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"redeemPY","outputs":[{"internalType":"uint256","name":"amountSyOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"amountPYToRedeems","type":"uint256[]"}],"name":"redeemPYMulti","outputs":[{"internalType":"uint256[]","name":"amountSyOuts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardIndexesCurrent","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setPostExpiryData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"syReserve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"address","name":"","type":"address"}],"name":"userInterest","outputs":[{"internalType":"uint128","name":"index","type":"uint128"},{"internalType":"uint128","name":"accrued","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userReward","outputs":[{"internalType":"uint128","name":"index","type":"uint128"},{"internalType":"uint128","name":"accrued","type":"uint128"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
61022080604052346200064d5762005f30803803809162000021828562000652565b833981019060e0818303126200064d576200003c8162000676565b6200004a6020830162000676565b60408301519092906001600160401b0381116200064d57846200006f918301620006b0565b606082015190946001600160401b0382116200064d5762000092918301620006b0565b9260808201519060ff821682036200064d5760c060a08401519301519384151585036200064d5760408051979088016001600160401b038111898210176200051b5760405260018852603160f81b6020890190815281519094906001600160401b0381116200051b57600354600181811c9116801562000642575b60208210146200062c57601f8111620005c6575b50806020601f82116001146200053d5760009162000531575b508160011b916000199060031b1c1916176003555b87516001600160401b0381116200051b576004988954600181811c9116801562000510575b6020821014620004fb579081601f849311620004a3575b50602090601f831160011462000438576000926200042c575b50508160011b916000199060031b1c19161788555b608052600280546001600160f81b0316600160f81b179055620001dc816200070b565b610140908152620001ed89620008b0565b91610160928352602081519101209461010099868b5251902094610120958087524660c0526040519060208201927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f8452604083015260608201524660808201523060a082015260a0815260c0810199818b1060018060401b038c11176200041757508960405251902060a0523060e0526101809283526101a09384526101e09586526101c094338652610200978852615528998a62000a088b396080518a61255f015260a0518a61377b015260c0518a613847015260e0518a61374c015251896137ca015251886137f0015251876115080152518661153101525185818161027a015281816105a601528181610e1701528181610f060152818161117601528181611b3401528181611cce0152818161303e015281816132ef015281816138e101528181613a6b015281816140440152818161450201528181614aba0152614c5001525184818161065201528181613afc015281816144200152818161492c0152614977015251838181610b54015281816110290152818161180c01528181611b6d0152611e47015251828181610380015281816104be01528181610a3701528181610c3601528181610d9901528181610fb70152818161170201528181612368015281816125ba0152818161344401528181613b20015281816144c001528181614902015281816149aa01528181614b1c0152614ca601525181818161248d01526132830152f35b604190634e487b7160e01b6000525260246000fd5b015190503880620001a4565b60008c8152602081209350601f198516905b8181106200048a575090846001959493921062000470575b505050811b018855620001b9565b015160001960f88460031b161c1916905538808062000462565b929360206001819287860151815501950193016200044a565b9091508a6000526020600020601f840160051c81019160208510620004f0575b90601f859493920160051c01905b818110620004e057506200018b565b60008155849350600101620004d1565b9091508190620004c3565b60228b634e487b7160e01b6000525260246000fd5b90607f169062000174565b634e487b7160e01b600052604160045260246000fd5b9050830151386200013a565b600360009081527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9250601f198416905b818110620005ad5750908360019493921062000593575b5050811b016003556200014f565b85015160001960f88460031b161c19169055388062000585565b9192602060018192868a0151815501940192016200056e565b60036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f830160051c81016020841062000624575b601f830160051c820181106200061757505062000121565b60008155600101620005ff565b5080620005ff565b634e487b7160e01b600052602260045260246000fd5b90607f16906200010d565b600080fd5b601f909101601f19168101906001600160401b038211908210176200051b57604052565b51906001600160a01b03821682036200064d57565b60005b8381106200069f5750506000910152565b81810151838201526020016200068e565b81601f820112156200064d5780516001600160401b0381116200051b5760405192620006e7601f8301601f19166020018562000652565b818452602082840101116200064d576200070891602080850191016200068b565b90565b805160209190828110156200078b575090601f8251116200074957808251920151908083106200073a57501790565b82600019910360031b1b161790565b6044906200077d9260405193849263305a27a960e01b8452806004850152825192839182602487015286860191016200068b565b601f01601f19168101030190fd5b6001600160401b0381116200051b576005928354926001938481811c91168015620008a5575b838210146200062c57601f81116200086e575b5081601f8411600114620008045750928293918392600094620007f8575b50501b916000199060031b1c191617905560ff90565b015192503880620007e2565b919083601f1981168760005284600020946000905b8883831062000853575050501062000839575b505050811b01905560ff90565b015160001960f88460031b161c191690553880806200082c565b85870151885590960195948501948793509081019062000819565b8560005284601f846000209201871c820191601f8601881c015b82811062000898575050620007c4565b6000815501859062000888565b90607f1690620007b1565b805160209081811015620008dd5750601f8251116200074957808251920151908083106200073a57501790565b906001600160401b0382116200051b57600654926001938481811c91168015620009fc575b838210146200062c57601f8111620009c2575b5081601f84116001146200095657509282939183926000946200094a575b50501b916000199060031b1c19161760065560ff90565b01519250388062000933565b919083601f198116600660005284600020946000905b88838310620009a757505050106200098d575b505050811b0160065560ff90565b015160001960f88460031b161c191690553880806200097f565b8587015188559096019594850194879350908101906200096c565b600660005284601f84600020920160051c820191601f860160051c015b828110620009ef57505062000915565b60008155018590620009df565b90607f16906200090256fe608080604052600436101561001357600080fd5b60003560e01c90816306fdde0314612ab157508063095ea7b314612a625780630a2b83a714612a095780630b49fcef146128c857806318160ddd1461286b5780631d52edc4146127a557806323b872dd146125df5780632f13b60c14612583578063313ce567146125275780633644e515146124ee5780634ba6dcd7146124b2578063516399df1461245757806353335819146122815780635cbadbe4146121e657806360e0a9e11461219857806370a082311461212d5780637d24da4d146116525780637ecebe00146115ed57806384b0196e146114d457806395d89b41146113b5578063a9059cbb146112e1578063acc5da4c14610f2a578063afd27bf514610ebb578063b0d8898114610ccf578063bcb7ea5d14610b78578063c45a015514610b09578063c4f59f9b14610a77578063cdbb036114610989578063d2a3584e1461094a578063d505accf146106fc578063d68076c314610676578063d94073d414610607578063db74aa1514610420578063dd62ed3e146103a3578063e184c9be1461034a5763f8b2f991146101ab57600080fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576002546101ed60028260f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255604051907ff8b2f9910000000000000000000000000000000000000000000000000000000082526000826004818373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1908115610339576102ee926000926102f2575b507f0100000000000000000000000000000000000000000000000000000000000000906002541617600255604051918291602083526020830190612c1e565b0390f35b7f0100000000000000000000000000000000000000000000000000000000000000919250610332903d806000833e61032a8183612d06565b810190613092565b91906102af565b6040513d6000823e3d90fd5b600080fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576103da612bd8565b6103e2612bfb565b9073ffffffffffffffffffffffffffffffffffffffff8091166000526001602052604060002091166000526020526020604060002054604051908152f35b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557610457612bd8565b61045f612bfb565b6002549061047360028360f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80931617600255427f000000000000000000000000000000000000000000000000000000000000000011156105dd5761059f61059a7f0100000000000000000000000000000000000000000000000000000000000000926040519561051887612cea565b600187526020968736818301376040519161053283612cea565b600183528836818501376040519361054985612cea565b6001855289368187013761055b613a63565b61056486612dae565b5261056e84612dae565b73ffffffffffffffffffffffffffffffffffffffff809216905261059183612dae565b91169052613acb565b612dae565b51916105ca7f0000000000000000000000000000000000000000000000000000000000000000614087565b600a556002541617600255604051908152f35b60046040517f5b15a6da000000000000000000000000000000000000000000000000000000008152fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346103455760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455773ffffffffffffffffffffffffffffffffffffffff6106c2612bd8565b166000908152600960209081526040918290205482516fffffffffffffffffffffffffffffffff8216815260809190911c91810191909152f35b346103455760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557610733612bd8565b61073b612bfb565b6044359060843560643560ff82168203610345578042116108ec5773ffffffffffffffffffffffffffffffffffffffff90818616928360005260076020526040600020908154916001830190556040519260208401927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452866040860152858816606086015288608086015260a085015260c084015260c0835260e083019183831067ffffffffffffffff8411176108bd5761084e9361084693604052519020610804613735565b90604051917f190100000000000000000000000000000000000000000000000000000000000083526002830152602282015260c43591604260a4359220614d77565b919091614e13565b160361085f5761085d9261310c565b005b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576020600b5460801c604051908152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345577f01000000000000000000000000000000000000000000000000000000000000006002546109ec60028260f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255427f00000000000000000000000000000000000000000000000000000000000000001115610a6a575b6002541617600255600080f35b610a7261386d565b610a5d565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557610aae612ffb565b6040518091602080830160208452825180915260206040850193019160005b828110610adc57505050500390f35b835173ffffffffffffffffffffffffffffffffffffffff1685528695509381019392810192600101610acd565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b34610345576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557610bb0612bd8565b7f010000000000000000000000000000000000000000000000000000000000000061059f61059a60025493610beb60028660f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80961617600255427f00000000000000000000000000000000000000000000000000000000000000001115610cc2575b604051610c6881612cea565b6001815286368183013760405191610c7f83612cea565b60018352873681850137610c916148ff565b610c9a84612dae565b5273ffffffffffffffffffffffffffffffffffffffff610cb983612dae565b911690526143fc565b610cca61386d565b610c5c565b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455767ffffffffffffffff60043581811161034557610d1f903690600401612c52565b909160243590811161034557610d39903690600401612c52565b9160025492610d4e60028560f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80951617600255427f00000000000000000000000000000000000000000000000000000000000000001115610eae575b808203610e84578115610e5a57610e0b7f010000000000000000000000000000000000000000000000000000000000000093610e036102ee97610e11953691612eb1565b923691612e63565b906143fc565b91610e3b7f0000000000000000000000000000000000000000000000000000000000000000614087565b600a556002541617600255604051918291602083526020830190612c1e565b60046040517ff1364a74000000000000000000000000000000000000000000000000000000008152fd5b60046040517fa24a13a6000000000000000000000000000000000000000000000000000000008152fd5b610eb661386d565b610dbf565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557600254610f6c60028260f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255427f00000000000000000000000000000000000000000000000000000000000000001180156112d4575b6112aa5773ffffffffffffffffffffffffffffffffffffffff906040517f61d027b30000000000000000000000000000000000000000000000000000000081526020928382600481847f0000000000000000000000000000000000000000000000000000000000000000165afa91821561033957600092611273575b50611063612ffb565b61106d8151612d5f565b92611076613ffa565b60005b825181101561110f57806110bd61109d8661109660019588612dea565b5116614087565b866110a88488612dea565b5116600052600e8a5260406000205490612f3d565b6110c78288612dea565b52846110d38286612dea565b51167f880a48d40a6133941abdcfabd5c5f9a791b1e6c8afd23138c5a36e3d9503922289611101848a612dea565b51604051908152a201611079565b509391815191845183036112155760005b8381106111ea5787876102ee887f0100000000000000000000000000000000000000000000000000000000000000896111c9600c54956fffffffffffffffffffffffffffffffff8760801c9716600c5561119c877f00000000000000000000000000000000000000000000000000000000000000009283614193565b7e4e8d79e4b41c5fad7561dc7c07786ee4e52292da7a3f5dc7ab90e32cc3042388604051898152a1614087565b600a5560025416176002556040805194859485528401526040830190612c1e565b8061120f846111fb60019486612dea565b511689611208848b612dea565b5191614193565b01611120565b606487604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152600f60248201527f6c656e677468206d69736d6174636800000000000000000000000000000000006044820152fd5b9091508381813d83116112a3575b61128b8183612d06565b810103126103455761129c90612f1c565b908461105a565b503d611281565b60046040517fcd81a636000000000000000000000000000000000000000000000000000000008152fd5b6112dc61386d565b610fde565b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345577f0100000000000000000000000000000000000000000000000000000000000000611339612bd8565b6113a26002549161135060028460f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556024359033613410565b6002541617600255602060405160018152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576040516004546000826113f683612c83565b9182825260209360019085600182169182600014611496575050600114611439575b5061142592500383612d06565b6102ee604051928284938452830190612b7a565b84915060046000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b906000915b85831061147e575050611425935082010185611418565b80548389018501528794508693909201918101611467565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168582015261142595151560051b85010192508791506114189050565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455761152c7f0000000000000000000000000000000000000000000000000000000000000000613e02565b6115557f0000000000000000000000000000000000000000000000000000000000000000613f3a565b9060405191602083019280841067ffffffffffffffff8511176108bd576115cc6102ee926115be95604052600083526040519586957f0f00000000000000000000000000000000000000000000000000000000000000875260e0602088015260e0870190612b7a565b908582036040870152612b7a565b90466060850152306080850152600060a085015283820360c0850152612c1e565b346103455760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455773ffffffffffffffffffffffffffffffffffffffff611639612bd8565b1660005260076020526020604060002054604051908152f35b346103455760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557611689612bd8565b60243515908115602435036103455760443580159283158203610345577f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002546116fa60028260f81c1415612dfe565b1617600255427f000000000000000000000000000000000000000000000000000000000000000011159384612120575b81612118575b506120ee5761173e8261499b565b156120d55761174b612ffb565b9115611e2e5760005b82518110156117f4578073ffffffffffffffffffffffffffffffffffffffff61177f60019386612dea565b5116600052602060088152604060002073ffffffffffffffffffffffffffffffffffffffff85166000528152600e60406000205460801c9173ffffffffffffffffffffffffffffffffffffffff6117d68589612dea565b5116600052526117ec6040600020918254612f3d565b905501611754565b5073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691604051917f61d027b3000000000000000000000000000000000000000000000000000000008352602083600481875afa92831561033957600093611def575b50602060049394604051948580927ff5de2d1f0000000000000000000000000000000000000000000000000000000082525afa92831561033957600093611dce575b5060006118bb8351612d5f565b9460005b8451811015611ac65773ffffffffffffffffffffffffffffffffffffffff6118e78287612dea565b5116600052600880602052604060002073ffffffffffffffffffffffffffffffffffffffff861660005260205260406000205460801c9073ffffffffffffffffffffffffffffffffffffffff61193d8489612dea565b5116600052602052604060002073ffffffffffffffffffffffffffffffffffffffff861660005260205260406000206fffffffffffffffffffffffffffffffff8154169055670de0b6b3a76400006119a76fffffffffffffffffffffffffffffffff891683614d2b565b04906119b38282612f3d565b6119bd848b612dea565b52841580611abe575b611a7c575b5090816119fb6001938573ffffffffffffffffffffffffffffffffffffffff6119f4868c612dea565b5116614193565b611a2a73ffffffffffffffffffffffffffffffffffffffff611a1d848a612dea565b511687611208858d612dea565b7f880a48d40a6133941abdcfabd5c5f9a791b1e6c8afd23138c5a36e3d95039222602073ffffffffffffffffffffffffffffffffffffffff611a6c858b612dea565b511692604051908152a2016118bf565b611a9e73ffffffffffffffffffffffffffffffffffffffff611096858a612dea565b10611aaa575b886119cb565b9250600190611ab7613ffa565b9092611aa4565b5060006119c6565b509193505050505b817f78d61a0c27b13f43911095f9f356f14daa3cd8b125eea1aa22421245e90e813d6040516020815280611b1d73ffffffffffffffffffffffffffffffffffffffff8616946020830190612c1e565b0390a25b60243515611dc657611b3281614ca3565b7f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff90817f000000000000000000000000000000000000000000000000000000000000000016604051917f61d027b30000000000000000000000000000000000000000000000000000000083526020918284600481845afa93841561033957600094611d8b575b5082600491604051928380927fdd86fea10000000000000000000000000000000000000000000000000000000082525afa95861561033957611cac967f83a945bd12c713615b59a6e48a3467c05d1a7442350600d6f7fce6af9f7190e9957e4e8d79e4b41c5fad7561dc7c07786ee4e52292da7a3f5dc7ab90e32cc30423948694600093611d5a575b50611cba9293611cb5670de0b6b3a7640000611ca26fffffffffffffffffffffffffffffffff9c85169c8d60005260098a52604060002098895499828b60801c9b1690551688614d2b565b049b8c8097612f3d565b9b8c9483614193565b614193565b604051908152a1604051848152a25b611cf27f0000000000000000000000000000000000000000000000000000000000000000614087565b600a557f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416176002556102ee6040519283928352604060208401526040830190612c1e565b611cba9350611d7e90863d8811611d84575b611d768183612d06565b810190613dda565b92611c57565b503d611d6c565b9093508281813d8311611dbf575b611da38183612d06565b810103126103455782611db7600492612f1c565b949150611bce565b503d611d99565b506000611cc9565b611de891935060203d602011611d8457611d768183612d06565b91846118ae565b92506020833d602011611e26575b81611e0a60209383612d06565b81010312610345576020611e1f600494612f1c565b935061186c565b3d9150611dfd565b9073ffffffffffffffffffffffffffffffffffffffff807f00000000000000000000000000000000000000000000000000000000000000001691604051917f61d027b30000000000000000000000000000000000000000000000000000000083526020908184600481885afa9384156103395760009461209c575b508160049495604051958680927ff5de2d1f0000000000000000000000000000000000000000000000000000000082525afa9384156103395760009461207d575b506fffffffffffffffffffffffffffffffff94939480951693600093611f108151612d5f565b958884169060005b8a845182101561206c578989918789888f8d9083611f368a85612dea565b511660005260089182815260406000208c600052815260406000205460801c9285611f618c87612dea565b511660005281526040600020908c600052526040600020908154169055670de0b6b3a7640000611f918a83614d2b565b0496611f9d8883612f3d565b611fa78a89612dea565b521580612064575b612022575b508587969593611fe595936119f460019a611fce95612dea565b611208858c611fdd828d612dea565b511693612dea565b7f880a48d40a6133941abdcfabd5c5f9a791b1e6c8afd23138c5a36e3d950392228989612012858a612dea565b511692604051908152a201611f18565b9250906110968761203293612dea565b10612041575b87898838611fb4565b869a506001939291611fe591612055613ffa565b949b5092939192919050612038565b506001611faf565b505050505050505050905090611ace565b612095919450823d8411611d8457611d768183612d06565b9286611eea565b93508184813d83116120ce575b6120b38183612d06565b8101031261034557816120c7600495612f1c565b9450611ea9565b503d6120a9565b90506120e86120e2612ffb565b51612d5f565b90611b21565b60046040517f68146f1d000000000000000000000000000000000000000000000000000000008152fd5b905084611730565b61212861386d565b61172a565b346103455760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576020612190612169612bd8565b73ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b604051908152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455760206fffffffffffffffffffffffffffffffff600b5416604051908152f35b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455761221d612bd8565b612225612bfb565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526008602090815260408083209390941682529182528290205482516fffffffffffffffffffffffffffffffff8216815260809190911c91810191909152f35b346103455760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455767ffffffffffffffff600435818111610345576122d1903690600401612c52565b9091602435818111610345576122eb903690600401612c52565b93909160443590811161034557612306903690600401612c52565b9290916002549461231d60028760f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80971617600255427f000000000000000000000000000000000000000000000000000000000000000011156105dd578015610e5a5780871480159061244d575b610e84576123b56123b0368787612e63565b613a30565b6123bd613a63565b811161240f5750610e1193610e036102ee98946124017f01000000000000000000000000000000000000000000000000000000000000009895612409953691612eb1565b953691612eb1565b91613acb565b60449061241a613a63565b604051917fa2cb081900000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b508085141561239e565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455760206040517f000000000000000000000000000000000000000000000000000000000000000015158152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576020600a54604051908152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576020612190613735565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557602060405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576020604051427f000000000000000000000000000000000000000000000000000000000000000011158152f35b346103455760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557612616612bd8565b61261e612bfb565b6044356002549161263560028460f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094161760025573ffffffffffffffffffffffffffffffffffffffff841660005260016020526040600020336000526020526040600020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103612703575b50906113a2917f010000000000000000000000000000000000000000000000000000000000000094613410565b9190818310612747577f01000000000000000000000000000000000000000000000000000000000000009461273e836113a29503338361310c565b945090916126d6565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455760206002546127e960028260f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809216176002557f010000000000000000000000000000000000000000000000000000000000000061285a613281565b916002541617600255604051908152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455760207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557600c546fffffffffffffffffffffffffffffffff811680156129df5761291b612ffb565b916129268351612d5f565b6129308451612d5f565b9160005b85518110156129a657600190600e73ffffffffffffffffffffffffffffffffffffffff80612962848b612dea565b5116600052602090600d825260406000205461297e8589612dea565b52612989848b612dea565b51166000525260406000205461299f8287612dea565b5201612934565b5092916129d16102ee92604051958695865260801c6020860152608060408601526080850190612c1e565b908382036060850152612c1e565b60046040517fd2509633000000000000000000000000000000000000000000000000000000008152fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557600c54604080516fffffffffffffffffffffffffffffffff8316815260809290921c602083015290f35b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557612aa6612a9c612bd8565b602435903361310c565b602060405160018152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557600354600082612aef83612c83565b9182825260209360019085600182169182600014611496575050600114612b1d575061142592500383612d06565b84915060036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b906000915b858310612b62575050611425935082010185611418565b80548389018501528794508693909201918101612b4b565b919082519283825260005b848110612bc45750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201612b85565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361034557565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361034557565b90815180825260208080930193019160005b828110612c3e575050505090565b835185529381019392810192600101612c30565b9181601f840112156103455782359167ffffffffffffffff8311610345576020808501948460051b01011161034557565b90600182811c92168015612ccc575b6020831014612c9d57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691612c92565b67ffffffffffffffff81116108bd57604052565b6040810190811067ffffffffffffffff8211176108bd57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176108bd57604052565b67ffffffffffffffff81116108bd5760051b60200190565b90612d6982612d47565b612d766040519182612d06565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0612da48294612d47565b0190602036910137565b805115612dbb5760200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8051821015612dbb5760209160051b010190565b15612e0557565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b9291612e6e82612d47565b91612e7c6040519384612d06565b829481845260208094019160051b810192831161034557905b828210612ea25750505050565b81358152908301908301612e95565b9291612ebc82612d47565b91612eca6040519384612d06565b829481845260208094019160051b810192831161034557905b828210612ef05750505050565b813573ffffffffffffffffffffffffffffffffffffffff81168103610345578152908301908301612ee3565b519073ffffffffffffffffffffffffffffffffffffffff8216820361034557565b91908203918211612f4a57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60209081818403126103455780519067ffffffffffffffff821161034557019180601f84011215610345578251612faf81612d47565b93612fbd6040519586612d06565b818552838086019260051b820101928311610345578301905b828210612fe4575050505090565b838091612ff084612f1c565b815201910190612fd6565b6040517fc4f59f9b00000000000000000000000000000000000000000000000000000000815260008160048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa90811561033957600091613072575090565b61308f91503d806000833e6130878183612d06565b810190612f79565b90565b60209081818403126103455780519067ffffffffffffffff821161034557019180601f840112156103455782516130c881612d47565b936130d66040519586612d06565b818552838086019260051b820101928311610345578301905b8282106130fd575050505090565b815181529083019083016130ef565b73ffffffffffffffffffffffffffffffffffffffff8091169182156131fe571691821561317a5760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b7f0000000000000000000000000000000000000000000000000000000000000000806133e6575b6133dd576040517f3ba0b9a900000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa908115610339576000916133ab575b50600b5460801c808211156133a35750905b6fffffffffffffffffffffffffffffffff91828111610345577fffffffffffffffffffffffffffffffff000000000000000000000000000000008382169343169160801b1617600b55817f71475f2f645813fdbebf53a58968008bff11ee21a58f01c5a9cc263d0bc4703d600080a2565b905090613332565b90506020813d6020116133d5575b816133c660209383612d06565b81010312610345575138613320565b3d91506133b9565b600b5460801c90565b506fffffffffffffffffffffffffffffffff600b541643146132a8565b91908201809211612f4a57565b9173ffffffffffffffffffffffffffffffffffffffff918284169283156136b157811693841561362d578484146135cf57427f00000000000000000000000000000000000000000000000000000000000000001115806135c2575b6134758383614b0d565b156135b4576fffffffffffffffffffffffffffffffff600c5416905b813086036135a4575b5050308503613594575b505081600052600060205260406000205481811061351057817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092856000526000845203604060002055846000526040600020613505828254613403565b9055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b61359d916151a2565b38806134a4565b6135ad916151a2565b388161349a565b6135bc613281565b90613491565b6135ca61386d565b61346b565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f45524332303a207472616e7366657220746f2073656c660000000000000000006044820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016301480613844575b1561379d577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176108bd5760405251902090565b507f00000000000000000000000000000000000000000000000000000000000000004614613774565b6fffffffffffffffffffffffffffffffff80600c5416613a2d5761388f613ffa565b613897613281565b81811161034557167fffffffffffffffffffffffffffffffff00000000000000000000000000000000600c541617600c5573ffffffffffffffffffffffffffffffffffffffff90817f00000000000000000000000000000000000000000000000000000000000000001660408051917fc4f59f9b0000000000000000000000000000000000000000000000000000000083526000908184600481845afa938415613a03578294613a0d575b5081809160048551809481937ff8b2f9910000000000000000000000000000000000000000000000000000000083525af1908115613a035782916139e9575b50815b84518110156139e0578061399a60019284612dea565b51886139a68389612dea565b51168552602090600d825286862055600e6139c58a611096858b612dea565b918a6139d1858b612dea565b51168752528585205501613984565b50505050509050565b6139fd91503d8084833e61032a8183612d06565b38613981565b83513d84823e3d90fd5b82919450613a2582913d8084833e6130878183612d06565b949150613942565b50565b600090815b8151831015613a5d57613a55600191613a4e8585612dea565b5190613403565b920191613a35565b91505090565b613a98613a8f7f0000000000000000000000000000000000000000000000000000000000000000614087565b600a5490612f3d565b908115613aa157565b60046040517f22826619000000000000000000000000000000000000000000000000000000008152fd5b929190613ad88251612d5f565b613ae0613281565b60009573ffffffffffffffffffffffffffffffffffffffff90817f00000000000000000000000000000000000000000000000000000000000000001692427f00000000000000000000000000000000000000000000000000000000000000001115985b8751811015613dcf57670de0b6b3a7640000613b6983613b63848c612dea565b51614d2b565b04613b748288612dea565b5283613b808289612dea565b5116613b8c8288612dea565b51908015613d71578b613d64575b613ba38161499b565b613bac81614ca3565b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808311610345576002908154908085168183160190808211612f4a577fff0000000000000000000000000000000000000000000000000000000000000091169116179055806000526020906000825260007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604095868420613c50828254613403565b90558651908152a385613c638487612dea565b5116613c6f848a612dea565b5190883b156103455783517f12a31dcc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9190911660048201526024810191909152600081604481838c5af18015613d59577fc0025304673122449dd60b9b0093874b0e2fd6fe57af1c7c2fbfee0ccf5ead5885948d94613d37878f968f969a8e613d288f8260019f858093613d3098613d2093613d4a575b50612dea565b51169b612dea565b511699612dea565b5195612dea565b519082519485528401523392a401613b43565b613d5390612cd6565b38613d1a565b83513d6000823e3d90fd5b613d6c61386d565b613b9a565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b505050505093505050565b9081602091031261034557516fffffffffffffffffffffffffffffffff811681036103455790565b60ff8114613e585760ff811690601f8211613e2e5760405191613e2483612cea565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600554816000613e6b83612c83565b80835292602090600190818116908115613ef75750600114613e96575b505061308f92500382612d06565b91509260056000527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0936000925b828410613edf575061308f9450505081016020013880613e88565b85548785018301529485019486945092810192613ec4565b90506020935061308f9592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201013880613e88565b60ff8114613f5c5760ff811690601f8211613e2e5760405191613e2483612cea565b50604051600654816000613f6f83612c83565b80835292602090600190818116908115613ef75750600114613f9957505061308f92500382612d06565b91509260066000527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f936000925b828410613fe2575061308f9450505081016020013880613e88565b85548785018301529485019486945092810192613fc7565b6040517fef5cfb8c0000000000000000000000000000000000000000000000000000000081523060048201526000816024818373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af18015610339576140735750565b613a2d903d806000833e61032a8183612d06565b60009073ffffffffffffffffffffffffffffffffffffffff16806140ab5750504790565b6020602491604051928380927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa9182156141295780926140f5575b505090565b9091506020823d602011614121575b8161411160209383612d06565b8101031261411e57505190565b80fd5b3d9150614104565b604051903d90823e3d90fd5b3d1561418e573d9067ffffffffffffffff82116108bd576040519161418260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184612d06565b82523d6000602084013e565b606090565b82156143d35773ffffffffffffffffffffffffffffffffffffffff168061422c5750600080809381935af16141c6614135565b50156141ce57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b61430c90604051906142bd82614291602097888301977fa9059cbb000000000000000000000000000000000000000000000000000000008952602484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101845283612d06565b604051916142ca83612cea565b8583527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656486840152600080958192519082855af1614306614135565b91615422565b8051918215918483156143ab575b5050509050156143275750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b9193818094500103126143cf5782015190811515820361411e57508038808461431a565b5080fd5b505050565b9190916fffffffffffffffffffffffffffffffff80809416911601918211612f4a57565b919061440781613a30565b9273ffffffffffffffffffffffffffffffffffffffff807f00000000000000000000000000000000000000000000000000000000000000001691823b15610345576040958651937fb64761f900000000000000000000000000000000000000000000000000000000855260009485816004938183816144ad8930600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af180156148f5576148e2575b50427f000000000000000000000000000000000000000000000000000000000000000011918215926146cd575b506144f2613281565b856144fd8551612d5f565b9680927f0000000000000000000000000000000000000000000000000000000000000000925b875185101561466257614536858c612dea565b518390670de0b6b3a7640000808202908282041482151715614634578f918e8d8f928b978f91978f8a9961456b8d8c9a614d3e565b91614603575b5061457c8888612dea565b528c846145898986612dea565b51166145958989612dea565b51906145a092614193565b6145a991613403565b9b6145b391612dea565b5116946145bf91612dea565b51916145ca91612dea565b518251918252602082015233917f5d624aa9c148153ab3446c1b154f660ee7701e549fe9b62dab7171b1c80e6fa291a360010193614523565b8192509061462861462d926fffffffffffffffffffffffffffffffff600c5416615396565b612f3d565b9038614571565b6011897f4e487b71000000000000000000000000000000000000000000000000000000006000525260246000fd5b995050505050505050509250806146765750565b6fffffffffffffffffffffffffffffffff808211610345577fffffffffffffffffffffffffffffffff000000000000000000000000000000006146c182600c5494168460801c6143d8565b60801b16911617600c55565b301561485f5782614852575b6146e23061499b565b6146eb30614ca3565b30865285602052888620548181106147cf5781903088528760205203898720557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8082116103455760025490808316818316038181116147a257889392917fff00000000000000000000000000000000000000000000000000000000000000911691161760025589519081527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60203092a3386144e9565b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b60848a517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b61485a61386d565b6146d9565b608489517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b6148ee90959195612cd6565b93386144bc565b89513d88823e3d90fd5b427f00000000000000000000000000000000000000000000000000000000000000001115614972576149507f0000000000000000000000000000000000000000000000000000000000000000614087565b30600052600060205260406000205480821060001461496d575090565b905090565b61308f7f0000000000000000000000000000000000000000000000000000000000000000614087565b6000916149a6612ffb565b92427f000000000000000000000000000000000000000000000000000000000000000011614a7457506149d98351612d5f565b9060005b8451811015614a29578073ffffffffffffffffffffffffffffffffffffffff614a0860019388612dea565b5116600052600d602052604060002054614a228286612dea565b52016149dd565b50925b8051156143d35773ffffffffffffffffffffffffffffffffffffffff83168015159081614a69575b50614a5e57505050565b614a6792614fe2565b565b905030141538614a54565b6040939193517ff8b2f99100000000000000000000000000000000000000000000000000000000815281816004818373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1918215614129578092614af2575b505090614a2c565b614b0692503d8091833e61032a8183612d06565b3880614aea565b906000614b18612ffb565b90427f000000000000000000000000000000000000000000000000000000000000000011614c0a5750614b4b8151612d5f565b9160005b8251811015614b9b578073ffffffffffffffffffffffffffffffffffffffff614b7a60019386612dea565b5116600052600d602052604060002054614b948287612dea565b5201614b4f565b50925b815115614c045773ffffffffffffffffffffffffffffffffffffffff9083838383168015159081614bf9575b50614be8575b50505083168015159081614a695750614a5e57505050565b614bf192614fe2565b388383614bd0565b905030141538614bca565b50505050565b6040939293517ff8b2f99100000000000000000000000000000000000000000000000000000000815281816004818373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1918215614129578092614c88575b505091614b9e565b614c9c92503d8091833e61032a8183612d06565b3880614c80565b427f000000000000000000000000000000000000000000000000000000000000000011614d1e576fffffffffffffffffffffffffffffffff600c54165b73ffffffffffffffffffffffffffffffffffffffff82168015159081614d13575b50614d0a575050565b614a67916151a2565b905030141538614d01565b614d26613281565b614ce0565b81810292918115918404141715612f4a57565b8115614d48570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311614e075791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa15614dfa57815173ffffffffffffffffffffffffffffffffffffffff811615614df4579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b6005811015614f7d5780614e245750565b60018103614e8a5760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b60028103614ef05760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b600314614ef957565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b15614fb357565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b9092919273ffffffffffffffffffffffffffffffffffffffff6150198184169384151580615198575b61501490614fac565b6153b9565b9160005b81518110156139e057826150318284612dea565b51169061503e8189612dea565b51826000526008906020908282526040806000208a60005283526fffffffffffffffffffffffffffffffff91828260002054168015615190575b81811461518157670de0b6b3a764000061509e6150986150bd9385612f3d565b8d614d2b565b0488600052868652836000208d6000528652836000205460801c613403565b9183821161034557838311610345578051948186019686881067ffffffffffffffff8911176108bd5760019986809561517b9a86521688528483890196168652600052815281600020908d600052526000209351167fffffffffffffffffffffffffffffffff0000000000000000000000000000000084541617835551166fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b0161501d565b5050505050506001915061517b565b506001615078565b503085141561500b565b73ffffffffffffffffffffffffffffffffffffffff81168015158061538c575b6151cb90614fac565b600090808252600960205260408220928354906fffffffffffffffffffffffffffffffff94858316928784146153825783156153465750508561524561523561524b9373ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b61523f8584612f3d565b90614d2b565b92614d2b565b90670de0b6b3a764000090818102918183041490151715615319579061527091614d3e565b838111615315576152d790828452600960205261529785604086209216825460801c6143d8565b6fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b8284116143cf5790604091815260096020522091167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055565b8280fd5b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b95949250958093508491501161411e5750907fffffffffffffffffffffffffffffffff0000000000000000000000000000000091169116179055565b5050505050505050565b50308114156151c2565b670de0b6b3a764000091828102928184041490151715612f4a5761308f91614d3e565b73ffffffffffffffffffffffffffffffffffffffff1660009080825260096020526fffffffffffffffffffffffffffffffff60408320541680156140f0578261540f60409261308f956020528383205490615396565b9281526009602052205460801c90613403565b9192901561549d5750815115615436575090565b3b1561543f5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156154b05750805190602001fd5b6154ee906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190612b7a565b0390fdfea2646970667358221220affc153a08877a017e9561699ca4e2b643f3df59c9f77287552b6c29350fb7dc64736f6c6343000817003300000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c000000000000000000000000386bf9105ef88e79fb8ca53dcc9a4e6f04be010200000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000667cab800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001859542053696c6f206372765553442032374a554e323032340000000000000000000000000000000000000000000000000000000000000000000000000000001859542d53696c6f2d6372765553442d32374a554e323032340000000000000000
Deployed Bytecode
0x608080604052600436101561001357600080fd5b60003560e01c90816306fdde0314612ab157508063095ea7b314612a625780630a2b83a714612a095780630b49fcef146128c857806318160ddd1461286b5780631d52edc4146127a557806323b872dd146125df5780632f13b60c14612583578063313ce567146125275780633644e515146124ee5780634ba6dcd7146124b2578063516399df1461245757806353335819146122815780635cbadbe4146121e657806360e0a9e11461219857806370a082311461212d5780637d24da4d146116525780637ecebe00146115ed57806384b0196e146114d457806395d89b41146113b5578063a9059cbb146112e1578063acc5da4c14610f2a578063afd27bf514610ebb578063b0d8898114610ccf578063bcb7ea5d14610b78578063c45a015514610b09578063c4f59f9b14610a77578063cdbb036114610989578063d2a3584e1461094a578063d505accf146106fc578063d68076c314610676578063d94073d414610607578063db74aa1514610420578063dd62ed3e146103a3578063e184c9be1461034a5763f8b2f991146101ab57600080fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576002546101ed60028260f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255604051907ff8b2f9910000000000000000000000000000000000000000000000000000000082526000826004818373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c165af1908115610339576102ee926000926102f2575b507f0100000000000000000000000000000000000000000000000000000000000000906002541617600255604051918291602083526020830190612c1e565b0390f35b7f0100000000000000000000000000000000000000000000000000000000000000919250610332903d806000833e61032a8183612d06565b810190613092565b91906102af565b6040513d6000823e3d90fd5b600080fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455760206040517f00000000000000000000000000000000000000000000000000000000667cab808152f35b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576103da612bd8565b6103e2612bfb565b9073ffffffffffffffffffffffffffffffffffffffff8091166000526001602052604060002091166000526020526020604060002054604051908152f35b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557610457612bd8565b61045f612bfb565b6002549061047360028360f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80931617600255427f00000000000000000000000000000000000000000000000000000000667cab8011156105dd5761059f61059a7f0100000000000000000000000000000000000000000000000000000000000000926040519561051887612cea565b600187526020968736818301376040519161053283612cea565b600183528836818501376040519361054985612cea565b6001855289368187013761055b613a63565b61056486612dae565b5261056e84612dae565b73ffffffffffffffffffffffffffffffffffffffff809216905261059183612dae565b91169052613acb565b612dae565b51916105ca7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c614087565b600a556002541617600255604051908152f35b60046040517f5b15a6da000000000000000000000000000000000000000000000000000000008152fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000386bf9105ef88e79fb8ca53dcc9a4e6f04be0102168152f35b346103455760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455773ffffffffffffffffffffffffffffffffffffffff6106c2612bd8565b166000908152600960209081526040918290205482516fffffffffffffffffffffffffffffffff8216815260809190911c91810191909152f35b346103455760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557610733612bd8565b61073b612bfb565b6044359060843560643560ff82168203610345578042116108ec5773ffffffffffffffffffffffffffffffffffffffff90818616928360005260076020526040600020908154916001830190556040519260208401927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452866040860152858816606086015288608086015260a085015260c084015260c0835260e083019183831067ffffffffffffffff8411176108bd5761084e9361084693604052519020610804613735565b90604051917f190100000000000000000000000000000000000000000000000000000000000083526002830152602282015260c43591604260a4359220614d77565b919091614e13565b160361085f5761085d9261310c565b005b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576020600b5460801c604051908152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345577f01000000000000000000000000000000000000000000000000000000000000006002546109ec60028260f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255427f00000000000000000000000000000000000000000000000000000000667cab801115610a6a575b6002541617600255600080f35b610a7261386d565b610a5d565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557610aae612ffb565b6040518091602080830160208452825180915260206040850193019160005b828110610adc57505050500390f35b835173ffffffffffffffffffffffffffffffffffffffff1685528695509381019392810192600101610acd565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000df3601014686674e53d1fa52f7602525483f9122168152f35b34610345576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557610bb0612bd8565b7f010000000000000000000000000000000000000000000000000000000000000061059f61059a60025493610beb60028660f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80961617600255427f00000000000000000000000000000000000000000000000000000000667cab801115610cc2575b604051610c6881612cea565b6001815286368183013760405191610c7f83612cea565b60018352873681850137610c916148ff565b610c9a84612dae565b5273ffffffffffffffffffffffffffffffffffffffff610cb983612dae565b911690526143fc565b610cca61386d565b610c5c565b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455767ffffffffffffffff60043581811161034557610d1f903690600401612c52565b909160243590811161034557610d39903690600401612c52565b9160025492610d4e60028560f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80951617600255427f00000000000000000000000000000000000000000000000000000000667cab801115610eae575b808203610e84578115610e5a57610e0b7f010000000000000000000000000000000000000000000000000000000000000093610e036102ee97610e11953691612eb1565b923691612e63565b906143fc565b91610e3b7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c614087565b600a556002541617600255604051918291602083526020830190612c1e565b60046040517ff1364a74000000000000000000000000000000000000000000000000000000008152fd5b60046040517fa24a13a6000000000000000000000000000000000000000000000000000000008152fd5b610eb661386d565b610dbf565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557602060405173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c168152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557600254610f6c60028260f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255427f00000000000000000000000000000000000000000000000000000000667cab801180156112d4575b6112aa5773ffffffffffffffffffffffffffffffffffffffff906040517f61d027b30000000000000000000000000000000000000000000000000000000081526020928382600481847f000000000000000000000000df3601014686674e53d1fa52f7602525483f9122165afa91821561033957600092611273575b50611063612ffb565b61106d8151612d5f565b92611076613ffa565b60005b825181101561110f57806110bd61109d8661109660019588612dea565b5116614087565b866110a88488612dea565b5116600052600e8a5260406000205490612f3d565b6110c78288612dea565b52846110d38286612dea565b51167f880a48d40a6133941abdcfabd5c5f9a791b1e6c8afd23138c5a36e3d9503922289611101848a612dea565b51604051908152a201611079565b509391815191845183036112155760005b8381106111ea5787876102ee887f0100000000000000000000000000000000000000000000000000000000000000896111c9600c54956fffffffffffffffffffffffffffffffff8760801c9716600c5561119c877f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c9283614193565b7e4e8d79e4b41c5fad7561dc7c07786ee4e52292da7a3f5dc7ab90e32cc3042388604051898152a1614087565b600a5560025416176002556040805194859485528401526040830190612c1e565b8061120f846111fb60019486612dea565b511689611208848b612dea565b5191614193565b01611120565b606487604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152600f60248201527f6c656e677468206d69736d6174636800000000000000000000000000000000006044820152fd5b9091508381813d83116112a3575b61128b8183612d06565b810103126103455761129c90612f1c565b908461105a565b503d611281565b60046040517fcd81a636000000000000000000000000000000000000000000000000000000008152fd5b6112dc61386d565b610fde565b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345577f0100000000000000000000000000000000000000000000000000000000000000611339612bd8565b6113a26002549161135060028460f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556024359033613410565b6002541617600255602060405160018152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576040516004546000826113f683612c83565b9182825260209360019085600182169182600014611496575050600114611439575b5061142592500383612d06565b6102ee604051928284938452830190612b7a565b84915060046000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b906000915b85831061147e575050611425935082010185611418565b80548389018501528794508693909201918101611467565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168582015261142595151560051b85010192508791506114189050565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455761152c7f59542053696c6f206372765553442032374a554e323032340000000000000018613e02565b6115557f3100000000000000000000000000000000000000000000000000000000000001613f3a565b9060405191602083019280841067ffffffffffffffff8511176108bd576115cc6102ee926115be95604052600083526040519586957f0f00000000000000000000000000000000000000000000000000000000000000875260e0602088015260e0870190612b7a565b908582036040870152612b7a565b90466060850152306080850152600060a085015283820360c0850152612c1e565b346103455760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455773ffffffffffffffffffffffffffffffffffffffff611639612bd8565b1660005260076020526020604060002054604051908152f35b346103455760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557611689612bd8565b60243515908115602435036103455760443580159283158203610345577f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002546116fa60028260f81c1415612dfe565b1617600255427f00000000000000000000000000000000000000000000000000000000667cab8011159384612120575b81612118575b506120ee5761173e8261499b565b156120d55761174b612ffb565b9115611e2e5760005b82518110156117f4578073ffffffffffffffffffffffffffffffffffffffff61177f60019386612dea565b5116600052602060088152604060002073ffffffffffffffffffffffffffffffffffffffff85166000528152600e60406000205460801c9173ffffffffffffffffffffffffffffffffffffffff6117d68589612dea565b5116600052526117ec6040600020918254612f3d565b905501611754565b5073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000df3601014686674e53d1fa52f7602525483f91221691604051917f61d027b3000000000000000000000000000000000000000000000000000000008352602083600481875afa92831561033957600093611def575b50602060049394604051948580927ff5de2d1f0000000000000000000000000000000000000000000000000000000082525afa92831561033957600093611dce575b5060006118bb8351612d5f565b9460005b8451811015611ac65773ffffffffffffffffffffffffffffffffffffffff6118e78287612dea565b5116600052600880602052604060002073ffffffffffffffffffffffffffffffffffffffff861660005260205260406000205460801c9073ffffffffffffffffffffffffffffffffffffffff61193d8489612dea565b5116600052602052604060002073ffffffffffffffffffffffffffffffffffffffff861660005260205260406000206fffffffffffffffffffffffffffffffff8154169055670de0b6b3a76400006119a76fffffffffffffffffffffffffffffffff891683614d2b565b04906119b38282612f3d565b6119bd848b612dea565b52841580611abe575b611a7c575b5090816119fb6001938573ffffffffffffffffffffffffffffffffffffffff6119f4868c612dea565b5116614193565b611a2a73ffffffffffffffffffffffffffffffffffffffff611a1d848a612dea565b511687611208858d612dea565b7f880a48d40a6133941abdcfabd5c5f9a791b1e6c8afd23138c5a36e3d95039222602073ffffffffffffffffffffffffffffffffffffffff611a6c858b612dea565b511692604051908152a2016118bf565b611a9e73ffffffffffffffffffffffffffffffffffffffff611096858a612dea565b10611aaa575b886119cb565b9250600190611ab7613ffa565b9092611aa4565b5060006119c6565b509193505050505b817f78d61a0c27b13f43911095f9f356f14daa3cd8b125eea1aa22421245e90e813d6040516020815280611b1d73ffffffffffffffffffffffffffffffffffffffff8616946020830190612c1e565b0390a25b60243515611dc657611b3281614ca3565b7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c9073ffffffffffffffffffffffffffffffffffffffff90817f000000000000000000000000df3601014686674e53d1fa52f7602525483f912216604051917f61d027b30000000000000000000000000000000000000000000000000000000083526020918284600481845afa93841561033957600094611d8b575b5082600491604051928380927fdd86fea10000000000000000000000000000000000000000000000000000000082525afa95861561033957611cac967f83a945bd12c713615b59a6e48a3467c05d1a7442350600d6f7fce6af9f7190e9957e4e8d79e4b41c5fad7561dc7c07786ee4e52292da7a3f5dc7ab90e32cc30423948694600093611d5a575b50611cba9293611cb5670de0b6b3a7640000611ca26fffffffffffffffffffffffffffffffff9c85169c8d60005260098a52604060002098895499828b60801c9b1690551688614d2b565b049b8c8097612f3d565b9b8c9483614193565b614193565b604051908152a1604051848152a25b611cf27f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c614087565b600a557f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416176002556102ee6040519283928352604060208401526040830190612c1e565b611cba9350611d7e90863d8811611d84575b611d768183612d06565b810190613dda565b92611c57565b503d611d6c565b9093508281813d8311611dbf575b611da38183612d06565b810103126103455782611db7600492612f1c565b949150611bce565b503d611d99565b506000611cc9565b611de891935060203d602011611d8457611d768183612d06565b91846118ae565b92506020833d602011611e26575b81611e0a60209383612d06565b81010312610345576020611e1f600494612f1c565b935061186c565b3d9150611dfd565b9073ffffffffffffffffffffffffffffffffffffffff807f000000000000000000000000df3601014686674e53d1fa52f7602525483f91221691604051917f61d027b30000000000000000000000000000000000000000000000000000000083526020908184600481885afa9384156103395760009461209c575b508160049495604051958680927ff5de2d1f0000000000000000000000000000000000000000000000000000000082525afa9384156103395760009461207d575b506fffffffffffffffffffffffffffffffff94939480951693600093611f108151612d5f565b958884169060005b8a845182101561206c578989918789888f8d9083611f368a85612dea565b511660005260089182815260406000208c600052815260406000205460801c9285611f618c87612dea565b511660005281526040600020908c600052526040600020908154169055670de0b6b3a7640000611f918a83614d2b565b0496611f9d8883612f3d565b611fa78a89612dea565b521580612064575b612022575b508587969593611fe595936119f460019a611fce95612dea565b611208858c611fdd828d612dea565b511693612dea565b7f880a48d40a6133941abdcfabd5c5f9a791b1e6c8afd23138c5a36e3d950392228989612012858a612dea565b511692604051908152a201611f18565b9250906110968761203293612dea565b10612041575b87898838611fb4565b869a506001939291611fe591612055613ffa565b949b5092939192919050612038565b506001611faf565b505050505050505050905090611ace565b612095919450823d8411611d8457611d768183612d06565b9286611eea565b93508184813d83116120ce575b6120b38183612d06565b8101031261034557816120c7600495612f1c565b9450611ea9565b503d6120a9565b90506120e86120e2612ffb565b51612d5f565b90611b21565b60046040517f68146f1d000000000000000000000000000000000000000000000000000000008152fd5b905084611730565b61212861386d565b61172a565b346103455760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576020612190612169612bd8565b73ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b604051908152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455760206fffffffffffffffffffffffffffffffff600b5416604051908152f35b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455761221d612bd8565b612225612bfb565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526008602090815260408083209390941682529182528290205482516fffffffffffffffffffffffffffffffff8216815260809190911c91810191909152f35b346103455760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455767ffffffffffffffff600435818111610345576122d1903690600401612c52565b9091602435818111610345576122eb903690600401612c52565b93909160443590811161034557612306903690600401612c52565b9290916002549461231d60028760f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80971617600255427f00000000000000000000000000000000000000000000000000000000667cab8011156105dd578015610e5a5780871480159061244d575b610e84576123b56123b0368787612e63565b613a30565b6123bd613a63565b811161240f5750610e1193610e036102ee98946124017f01000000000000000000000000000000000000000000000000000000000000009895612409953691612eb1565b953691612eb1565b91613acb565b60449061241a613a63565b604051917fa2cb081900000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b508085141561239e565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455760206040517f000000000000000000000000000000000000000000000000000000000000000115158152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576020600a54604051908152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576020612190613735565b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557602060405160ff7f0000000000000000000000000000000000000000000000000000000000000012168152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610345576020604051427f00000000000000000000000000000000000000000000000000000000667cab8011158152f35b346103455760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557612616612bd8565b61261e612bfb565b6044356002549161263560028460f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094161760025573ffffffffffffffffffffffffffffffffffffffff841660005260016020526040600020336000526020526040600020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103612703575b50906113a2917f010000000000000000000000000000000000000000000000000000000000000094613410565b9190818310612747577f01000000000000000000000000000000000000000000000000000000000000009461273e836113a29503338361310c565b945090916126d6565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455760206002546127e960028260f81c1415612dfe565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809216176002557f010000000000000000000000000000000000000000000000000000000000000061285a613281565b916002541617600255604051908152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103455760207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557600c546fffffffffffffffffffffffffffffffff811680156129df5761291b612ffb565b916129268351612d5f565b6129308451612d5f565b9160005b85518110156129a657600190600e73ffffffffffffffffffffffffffffffffffffffff80612962848b612dea565b5116600052602090600d825260406000205461297e8589612dea565b52612989848b612dea565b51166000525260406000205461299f8287612dea565b5201612934565b5092916129d16102ee92604051958695865260801c6020860152608060408601526080850190612c1e565b908382036060850152612c1e565b60046040517fd2509633000000000000000000000000000000000000000000000000000000008152fd5b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557600c54604080516fffffffffffffffffffffffffffffffff8316815260809290921c602083015290f35b346103455760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557612aa6612a9c612bd8565b602435903361310c565b602060405160018152f35b346103455760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261034557600354600082612aef83612c83565b9182825260209360019085600182169182600014611496575050600114612b1d575061142592500383612d06565b84915060036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b906000915b858310612b62575050611425935082010185611418565b80548389018501528794508693909201918101612b4b565b919082519283825260005b848110612bc45750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201612b85565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361034557565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361034557565b90815180825260208080930193019160005b828110612c3e575050505090565b835185529381019392810192600101612c30565b9181601f840112156103455782359167ffffffffffffffff8311610345576020808501948460051b01011161034557565b90600182811c92168015612ccc575b6020831014612c9d57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691612c92565b67ffffffffffffffff81116108bd57604052565b6040810190811067ffffffffffffffff8211176108bd57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176108bd57604052565b67ffffffffffffffff81116108bd5760051b60200190565b90612d6982612d47565b612d766040519182612d06565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0612da48294612d47565b0190602036910137565b805115612dbb5760200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8051821015612dbb5760209160051b010190565b15612e0557565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b9291612e6e82612d47565b91612e7c6040519384612d06565b829481845260208094019160051b810192831161034557905b828210612ea25750505050565b81358152908301908301612e95565b9291612ebc82612d47565b91612eca6040519384612d06565b829481845260208094019160051b810192831161034557905b828210612ef05750505050565b813573ffffffffffffffffffffffffffffffffffffffff81168103610345578152908301908301612ee3565b519073ffffffffffffffffffffffffffffffffffffffff8216820361034557565b91908203918211612f4a57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60209081818403126103455780519067ffffffffffffffff821161034557019180601f84011215610345578251612faf81612d47565b93612fbd6040519586612d06565b818552838086019260051b820101928311610345578301905b828210612fe4575050505090565b838091612ff084612f1c565b815201910190612fd6565b6040517fc4f59f9b00000000000000000000000000000000000000000000000000000000815260008160048173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c165afa90811561033957600091613072575090565b61308f91503d806000833e6130878183612d06565b810190612f79565b90565b60209081818403126103455780519067ffffffffffffffff821161034557019180601f840112156103455782516130c881612d47565b936130d66040519586612d06565b818552838086019260051b820101928311610345578301905b8282106130fd575050505090565b815181529083019083016130ef565b73ffffffffffffffffffffffffffffffffffffffff8091169182156131fe571691821561317a5760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b7f0000000000000000000000000000000000000000000000000000000000000001806133e6575b6133dd576040517f3ba0b9a900000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c165afa908115610339576000916133ab575b50600b5460801c808211156133a35750905b6fffffffffffffffffffffffffffffffff91828111610345577fffffffffffffffffffffffffffffffff000000000000000000000000000000008382169343169160801b1617600b55817f71475f2f645813fdbebf53a58968008bff11ee21a58f01c5a9cc263d0bc4703d600080a2565b905090613332565b90506020813d6020116133d5575b816133c660209383612d06565b81010312610345575138613320565b3d91506133b9565b600b5460801c90565b506fffffffffffffffffffffffffffffffff600b541643146132a8565b91908201809211612f4a57565b9173ffffffffffffffffffffffffffffffffffffffff918284169283156136b157811693841561362d578484146135cf57427f00000000000000000000000000000000000000000000000000000000667cab801115806135c2575b6134758383614b0d565b156135b4576fffffffffffffffffffffffffffffffff600c5416905b813086036135a4575b5050308503613594575b505081600052600060205260406000205481811061351057817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092856000526000845203604060002055846000526040600020613505828254613403565b9055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b61359d916151a2565b38806134a4565b6135ad916151a2565b388161349a565b6135bc613281565b90613491565b6135ca61386d565b61346b565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f45524332303a207472616e7366657220746f2073656c660000000000000000006044820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000af86da90a5c1e1a41be3b944b16944081087b7aa16301480613844575b1561379d577f944cb2357867e37253971cad88ed2b684d7ad268b4af5d2d00b55c255f5b641390565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f21da2252f64f0757b8853a9e6d744ca2dbec32ca1af37f33fbcd3bb0f4f822a860408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176108bd5760405251902090565b507f00000000000000000000000000000000000000000000000000000000000000014614613774565b6fffffffffffffffffffffffffffffffff80600c5416613a2d5761388f613ffa565b613897613281565b81811161034557167fffffffffffffffffffffffffffffffff00000000000000000000000000000000600c541617600c5573ffffffffffffffffffffffffffffffffffffffff90817f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c1660408051917fc4f59f9b0000000000000000000000000000000000000000000000000000000083526000908184600481845afa938415613a03578294613a0d575b5081809160048551809481937ff8b2f9910000000000000000000000000000000000000000000000000000000083525af1908115613a035782916139e9575b50815b84518110156139e0578061399a60019284612dea565b51886139a68389612dea565b51168552602090600d825286862055600e6139c58a611096858b612dea565b918a6139d1858b612dea565b51168752528585205501613984565b50505050509050565b6139fd91503d8084833e61032a8183612d06565b38613981565b83513d84823e3d90fd5b82919450613a2582913d8084833e6130878183612d06565b949150613942565b50565b600090815b8151831015613a5d57613a55600191613a4e8585612dea565b5190613403565b920191613a35565b91505090565b613a98613a8f7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c614087565b600a5490612f3d565b908115613aa157565b60046040517f22826619000000000000000000000000000000000000000000000000000000008152fd5b929190613ad88251612d5f565b613ae0613281565b60009573ffffffffffffffffffffffffffffffffffffffff90817f000000000000000000000000386bf9105ef88e79fb8ca53dcc9a4e6f04be01021692427f00000000000000000000000000000000000000000000000000000000667cab801115985b8751811015613dcf57670de0b6b3a7640000613b6983613b63848c612dea565b51614d2b565b04613b748288612dea565b5283613b808289612dea565b5116613b8c8288612dea565b51908015613d71578b613d64575b613ba38161499b565b613bac81614ca3565b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808311610345576002908154908085168183160190808211612f4a577fff0000000000000000000000000000000000000000000000000000000000000091169116179055806000526020906000825260007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604095868420613c50828254613403565b90558651908152a385613c638487612dea565b5116613c6f848a612dea565b5190883b156103455783517f12a31dcc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9190911660048201526024810191909152600081604481838c5af18015613d59577fc0025304673122449dd60b9b0093874b0e2fd6fe57af1c7c2fbfee0ccf5ead5885948d94613d37878f968f969a8e613d288f8260019f858093613d3098613d2093613d4a575b50612dea565b51169b612dea565b511699612dea565b5195612dea565b519082519485528401523392a401613b43565b613d5390612cd6565b38613d1a565b83513d6000823e3d90fd5b613d6c61386d565b613b9a565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b505050505093505050565b9081602091031261034557516fffffffffffffffffffffffffffffffff811681036103455790565b60ff8114613e585760ff811690601f8211613e2e5760405191613e2483612cea565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600554816000613e6b83612c83565b80835292602090600190818116908115613ef75750600114613e96575b505061308f92500382612d06565b91509260056000527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0936000925b828410613edf575061308f9450505081016020013880613e88565b85548785018301529485019486945092810192613ec4565b90506020935061308f9592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201013880613e88565b60ff8114613f5c5760ff811690601f8211613e2e5760405191613e2483612cea565b50604051600654816000613f6f83612c83565b80835292602090600190818116908115613ef75750600114613f9957505061308f92500382612d06565b91509260066000527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f936000925b828410613fe2575061308f9450505081016020013880613e88565b85548785018301529485019486945092810192613fc7565b6040517fef5cfb8c0000000000000000000000000000000000000000000000000000000081523060048201526000816024818373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c165af18015610339576140735750565b613a2d903d806000833e61032a8183612d06565b60009073ffffffffffffffffffffffffffffffffffffffff16806140ab5750504790565b6020602491604051928380927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa9182156141295780926140f5575b505090565b9091506020823d602011614121575b8161411160209383612d06565b8101031261411e57505190565b80fd5b3d9150614104565b604051903d90823e3d90fd5b3d1561418e573d9067ffffffffffffffff82116108bd576040519161418260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184612d06565b82523d6000602084013e565b606090565b82156143d35773ffffffffffffffffffffffffffffffffffffffff168061422c5750600080809381935af16141c6614135565b50156141ce57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b61430c90604051906142bd82614291602097888301977fa9059cbb000000000000000000000000000000000000000000000000000000008952602484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101845283612d06565b604051916142ca83612cea565b8583527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656486840152600080958192519082855af1614306614135565b91615422565b8051918215918483156143ab575b5050509050156143275750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b9193818094500103126143cf5782015190811515820361411e57508038808461431a565b5080fd5b505050565b9190916fffffffffffffffffffffffffffffffff80809416911601918211612f4a57565b919061440781613a30565b9273ffffffffffffffffffffffffffffffffffffffff807f000000000000000000000000386bf9105ef88e79fb8ca53dcc9a4e6f04be01021691823b15610345576040958651937fb64761f900000000000000000000000000000000000000000000000000000000855260009485816004938183816144ad8930600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af180156148f5576148e2575b50427f00000000000000000000000000000000000000000000000000000000667cab8011918215926146cd575b506144f2613281565b856144fd8551612d5f565b9680927f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c925b875185101561466257614536858c612dea565b518390670de0b6b3a7640000808202908282041482151715614634578f918e8d8f928b978f91978f8a9961456b8d8c9a614d3e565b91614603575b5061457c8888612dea565b528c846145898986612dea565b51166145958989612dea565b51906145a092614193565b6145a991613403565b9b6145b391612dea565b5116946145bf91612dea565b51916145ca91612dea565b518251918252602082015233917f5d624aa9c148153ab3446c1b154f660ee7701e549fe9b62dab7171b1c80e6fa291a360010193614523565b8192509061462861462d926fffffffffffffffffffffffffffffffff600c5416615396565b612f3d565b9038614571565b6011897f4e487b71000000000000000000000000000000000000000000000000000000006000525260246000fd5b995050505050505050509250806146765750565b6fffffffffffffffffffffffffffffffff808211610345577fffffffffffffffffffffffffffffffff000000000000000000000000000000006146c182600c5494168460801c6143d8565b60801b16911617600c55565b301561485f5782614852575b6146e23061499b565b6146eb30614ca3565b30865285602052888620548181106147cf5781903088528760205203898720557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8082116103455760025490808316818316038181116147a257889392917fff00000000000000000000000000000000000000000000000000000000000000911691161760025589519081527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60203092a3386144e9565b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b60848a517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b61485a61386d565b6146d9565b608489517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b6148ee90959195612cd6565b93386144bc565b89513d88823e3d90fd5b427f00000000000000000000000000000000000000000000000000000000667cab801115614972576149507f000000000000000000000000386bf9105ef88e79fb8ca53dcc9a4e6f04be0102614087565b30600052600060205260406000205480821060001461496d575090565b905090565b61308f7f000000000000000000000000386bf9105ef88e79fb8ca53dcc9a4e6f04be0102614087565b6000916149a6612ffb565b92427f00000000000000000000000000000000000000000000000000000000667cab8011614a7457506149d98351612d5f565b9060005b8451811015614a29578073ffffffffffffffffffffffffffffffffffffffff614a0860019388612dea565b5116600052600d602052604060002054614a228286612dea565b52016149dd565b50925b8051156143d35773ffffffffffffffffffffffffffffffffffffffff83168015159081614a69575b50614a5e57505050565b614a6792614fe2565b565b905030141538614a54565b6040939193517ff8b2f99100000000000000000000000000000000000000000000000000000000815281816004818373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c165af1918215614129578092614af2575b505090614a2c565b614b0692503d8091833e61032a8183612d06565b3880614aea565b906000614b18612ffb565b90427f00000000000000000000000000000000000000000000000000000000667cab8011614c0a5750614b4b8151612d5f565b9160005b8251811015614b9b578073ffffffffffffffffffffffffffffffffffffffff614b7a60019386612dea565b5116600052600d602052604060002054614b948287612dea565b5201614b4f565b50925b815115614c045773ffffffffffffffffffffffffffffffffffffffff9083838383168015159081614bf9575b50614be8575b50505083168015159081614a695750614a5e57505050565b614bf192614fe2565b388383614bd0565b905030141538614bca565b50505050565b6040939293517ff8b2f99100000000000000000000000000000000000000000000000000000000815281816004818373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000060d1afd87c5ab1a13e27638f1e75277febf4908c165af1918215614129578092614c88575b505091614b9e565b614c9c92503d8091833e61032a8183612d06565b3880614c80565b427f00000000000000000000000000000000000000000000000000000000667cab8011614d1e576fffffffffffffffffffffffffffffffff600c54165b73ffffffffffffffffffffffffffffffffffffffff82168015159081614d13575b50614d0a575050565b614a67916151a2565b905030141538614d01565b614d26613281565b614ce0565b81810292918115918404141715612f4a57565b8115614d48570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311614e075791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa15614dfa57815173ffffffffffffffffffffffffffffffffffffffff811615614df4579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b6005811015614f7d5780614e245750565b60018103614e8a5760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b60028103614ef05760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b600314614ef957565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b15614fb357565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b9092919273ffffffffffffffffffffffffffffffffffffffff6150198184169384151580615198575b61501490614fac565b6153b9565b9160005b81518110156139e057826150318284612dea565b51169061503e8189612dea565b51826000526008906020908282526040806000208a60005283526fffffffffffffffffffffffffffffffff91828260002054168015615190575b81811461518157670de0b6b3a764000061509e6150986150bd9385612f3d565b8d614d2b565b0488600052868652836000208d6000528652836000205460801c613403565b9183821161034557838311610345578051948186019686881067ffffffffffffffff8911176108bd5760019986809561517b9a86521688528483890196168652600052815281600020908d600052526000209351167fffffffffffffffffffffffffffffffff0000000000000000000000000000000084541617835551166fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b0161501d565b5050505050506001915061517b565b506001615078565b503085141561500b565b73ffffffffffffffffffffffffffffffffffffffff81168015158061538c575b6151cb90614fac565b600090808252600960205260408220928354906fffffffffffffffffffffffffffffffff94858316928784146153825783156153465750508561524561523561524b9373ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b61523f8584612f3d565b90614d2b565b92614d2b565b90670de0b6b3a764000090818102918183041490151715615319579061527091614d3e565b838111615315576152d790828452600960205261529785604086209216825460801c6143d8565b6fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b8284116143cf5790604091815260096020522091167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055565b8280fd5b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b95949250958093508491501161411e5750907fffffffffffffffffffffffffffffffff0000000000000000000000000000000091169116179055565b5050505050505050565b50308114156151c2565b670de0b6b3a764000091828102928184041490151715612f4a5761308f91614d3e565b73ffffffffffffffffffffffffffffffffffffffff1660009080825260096020526fffffffffffffffffffffffffffffffff60408320541680156140f0578261540f60409261308f956020528383205490615396565b9281526009602052205460801c90613403565b9192901561549d5750815115615436575090565b3b1561543f5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156154b05750805190602001fd5b6154ee906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190612b7a565b0390fdfea2646970667358221220affc153a08877a017e9561699ca4e2b643f3df59c9f77287552b6c29350fb7dc64736f6c63430008170033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.