Overview
Max Total Supply
111,499.871399 SY-Stargate USDT
Holders
25 (0.00%)
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 6 Decimals)
Balance
0 SY-Stargate USDTValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
PendleStargateLPSY
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "../SYBaseWithRewards.sol"; import "../../../interfaces/IStargateRouter.sol"; import "../../../interfaces/IStargateLP.sol"; import "../../../interfaces/IStargateStaking.sol"; contract PendleStargateLPSY is SYBaseWithRewards { uint256 public constant STARGATE_BP_DENOMINATOR = 10000; using Math for uint256; uint16 public immutable pid; // pool id uint256 public immutable sid; // staking id address public immutable lp; address public immutable underlying; address public immutable stargateRouter; address public immutable stargateStaking; address public immutable stgToken; // preview variables uint256 public immutable convertRate; constructor( string memory _name, string memory _symbol, address _stargateLP, address _stargateStaking, uint256 _sid ) SYBaseWithRewards(_name, _symbol, _stargateLP) { lp = _stargateLP; underlying = IStargateLP(lp).token(); stargateRouter = IStargateLP(lp).router(); pid = uint16(IStargateLP(lp).poolId()); stargateStaking = _stargateStaking; sid = _sid; stgToken = IStargateStaking(stargateStaking).stargate(); // preview variables convertRate = IStargateLP(lp).convertRate(); _safeApproveInf(underlying, stargateRouter); _safeApproveInf(lp, stargateStaking); _validateStargateStakingId(stargateStaking, sid, lp); } function _validateStargateStakingId( address staking, uint256 id, address lpToken ) internal view { (address _lpToken, , , ) = IStargateStaking(staking).poolInfo(id); // Custom error not needed here since this only happens on deployment require(_lpToken == lpToken, "invalid sid & lpToken"); } /*/////////////////////////////////////////////////////////////// DEPOSIT/REDEEM USING BASE TOKENS //////////////////////////////////////////////////////////////*/ /** * The underlying yield token is startgateLP. If the base token deposited is underlying, the function * deposits received underlying into the startgateLP contract. */ function _deposit( address tokenIn, uint256 amountDeposited ) internal virtual override returns (uint256 amountSharesOut) { if (tokenIn == underlying) { IStargateRouter(stargateRouter).addLiquidity(pid, amountDeposited, address(this)); amountSharesOut = _selfBalance(lp); // all outstanding LP will be staked } else { amountSharesOut = amountDeposited; } IStargateStaking(stargateStaking).deposit(sid, amountSharesOut); } function _redeem( address receiver, address tokenOut, uint256 amountSharesToRedeem ) internal virtual override returns (uint256 amountTokenOut) { IStargateStaking(stargateStaking).withdraw(sid, amountSharesToRedeem); if (tokenOut == lp) { amountTokenOut = amountSharesToRedeem; _transferOut(lp, receiver, amountTokenOut); } else { /** * @dev There is an lp cap variable in stargate to define the maximum amount of lp * which can be burned. * In case there is not enough liquidity in the pool to proceed the withdrawal, * stargatePool will not revert and try to withdraw as much lp as it can instead. * * When this rare case happens, Pendle's SY should guarantee to revert. */ uint256 preBalanceLp = _selfBalance(lp); uint256 amountSD = IStargateRouter(stargateRouter).instantRedeemLocal( pid, amountSharesToRedeem, receiver ); uint256 lpUsed = preBalanceLp - _selfBalance(lp); if (lpUsed < amountSharesToRedeem) { revert Errors.SYStargateRedeemCapExceeded(amountSharesToRedeem, lpUsed); } amountTokenOut = amountSD * convertRate; } } /*/////////////////////////////////////////////////////////////// EXCHANGE-RATE //////////////////////////////////////////////////////////////*/ /** * @notice Calculates and updates the exchange rate of shares to underlying asset token * @dev It is the exchange rate of lp to underlying */ function exchangeRate() public view virtual override returns (uint256) { return IStargateLP(lp).totalLiquidity().divDown(IStargateLP(lp).totalSupply()) * convertRate; } /*/////////////////////////////////////////////////////////////// REWARDS-RELATED //////////////////////////////////////////////////////////////*/ /** * @dev See {IStandardizedYield-getRewardTokens} */ function _getRewardTokens() internal view override returns (address[] memory res) { res = new address[](1); res[0] = stgToken; } function _redeemExternalReward() internal override { IStargateStaking(stargateStaking).withdraw(sid, 0); } /*/////////////////////////////////////////////////////////////// MISC FUNCTIONS FOR METADATA //////////////////////////////////////////////////////////////*/ function _previewDeposit( address tokenIn, uint256 amountTokenToDeposit ) internal view override returns (uint256 amountSharesOut) { if (tokenIn == lp) { amountSharesOut = amountTokenToDeposit; } else { uint256 totalLiquidity = IStargateLP(lp).totalLiquidity(); uint256 totalSupply = IStargateLP(lp).totalSupply(); uint256 mintFeeBP = IStargateLP(lp).mintFeeBP(); uint256 amountSD = amountTokenToDeposit / convertRate; // Tho fee is always enabled, it is currently set to zero uint256 mintFeeSD = (amountSD * mintFeeBP) / STARGATE_BP_DENOMINATOR; amountSD = amountSD - mintFeeSD; // skip check for lp.totalSupply() == 0 amountSharesOut = (amountSD * totalSupply) / totalLiquidity; } } function _previewRedeem( address tokenOut, uint256 amountSharesToRedeem ) internal view override returns (uint256 amountTokenOut) { if (tokenOut == lp) { amountTokenOut = amountSharesToRedeem; } else { uint256 totalLiquidity = IStargateLP(lp).totalLiquidity(); uint256 totalSupply = IStargateLP(lp).totalSupply(); uint256 deltaCredit = IStargateLP(lp).deltaCredit(); uint256 capAmountLp = (deltaCredit * totalSupply) / totalLiquidity; if (amountSharesToRedeem > capAmountLp) { revert Errors.SYStargateRedeemCapExceeded(amountSharesToRedeem, capAmountLp); } uint256 amountSD = (amountSharesToRedeem * totalLiquidity) / totalSupply; amountTokenOut = amountSD * convertRate; } } function getTokensIn() public view virtual override returns (address[] memory res) { res = new address[](2); res[0] = underlying; res[1] = lp; } function getTokensOut() public view virtual override returns (address[] memory res) { res = new address[](2); res[0] = underlying; res[1] = lp; } function isValidTokenIn(address token) public view virtual override returns (bool) { return token == underlying || token == lp; } function isValidTokenOut(address token) public view virtual override returns (bool) { return token == underlying || token == lp; } function assetInfo() external view returns (AssetType assetType, address assetAddress, uint8 assetDecimals) { return (AssetType.TOKEN, underlying, IERC20Metadata(underlying).decimals()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract 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}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ 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 value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; import "./draft-IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/draft-EIP712.sol"; import "../../../utils/cryptography/ECDSA.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/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: 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 v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.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]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // 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 _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @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) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.3) (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 } 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"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' 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 (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // 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) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @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) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_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) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @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); } }
// 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; } // 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; } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract BoringOwnableUpgradeableData { address public owner; address public pendingOwner; } abstract contract BoringOwnableUpgradeable is BoringOwnableUpgradeableData, Initializable { event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function __BoringOwnable_init() internal onlyInitializing { owner = msg.sender; } /// @notice Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner. /// Can only be invoked by the current `owner`. /// @param newOwner Address of the new owner. /// @param direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`. /// @param renounce Allows the `newOwner` to be `address(0)` if `direct` and `renounce` is True. Has no effect otherwise. function transferOwnership(address newOwner, bool direct, bool renounce) public onlyOwner { if (direct) { // Checks require(newOwner != address(0) || renounce, "Ownable: zero address"); // Effects emit OwnershipTransferred(owner, newOwner); owner = newOwner; pendingOwner = address(0); } else { // Effects pendingOwner = newOwner; } } /// @notice Needs to be called by `pendingOwner` to claim ownership. function claimOwnership() public { address _pendingOwner = pendingOwner; // Checks require(msg.sender == _pendingOwner, "Ownable: caller != pending owner"); // Effects emit OwnershipTransferred(owner, _pendingOwner); owner = _pendingOwner; pendingOwner = address(0); } /// @notice Only allows the `owner` to execute the function. modifier onlyOwner() { require(msg.sender == owner, "Ownable: caller is not the owner"); _; } uint256[48] private __gap; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; 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 MarketFactoryReserveFeePercentTooHigh( uint8 reserveFeePercent, uint8 maxReserveFeePercent ); error MarketFactoryZeroTreasury(); error MarketFactoryInitialAnchorTooLow(int256 initialAnchor, int256 minInitialAnchor); // 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 RouterExceededLimitSyIn(uint256 actualSyIn, uint256 limitSyIn); error RouterExceededLimitPtIn(uint256 actualPtIn, uint256 limitPtIn); error RouterExceededLimitYtIn(uint256 actualYtIn, uint256 limitYtIn); 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(); // 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); // 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 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.17; /* solhint-disable private-vars-leading-underscore, reason-string */ library Math { 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 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 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 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.17; 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.17; import "./RewardManagerAbstract.sol"; /// NOTE: This RewardManager is used with SY & YTv2 & PendleMarket. For YTv1, it will use RewardManagerAbstract /// NOTE: RewardManager must not have duplicated rewardTokens abstract contract RewardManager is RewardManagerAbstract { using Math for uint256; using ArrayLib for uint256[]; uint256 public lastRewardBlock; mapping(address => RewardState) public rewardState; uint256 internal constant INITIAL_REWARD_INDEX = 1; function _updateRewardIndex() internal virtual override returns (address[] memory tokens, uint256[] memory indexes) { tokens = _getRewardTokens(); indexes = new uint256[](tokens.length); if (tokens.length == 0) return (tokens, indexes); if (lastRewardBlock != block.number) { // if we have not yet update the index for this block lastRewardBlock = block.number; uint256 totalShares = _rewardSharesTotal(); _redeemExternalReward(); for (uint256 i = 0; i < tokens.length; ++i) { address token = tokens[i]; // the entire token balance of the contract must be the rewards of the contract uint256 accrued = _selfBalance(tokens[i]) - rewardState[token].lastBalance; uint256 index = rewardState[token].index; if (index == 0) index = INITIAL_REWARD_INDEX; if (totalShares != 0) index += accrued.divDown(totalShares); rewardState[token].index = index.Uint128(); rewardState[token].lastBalance += accrued.Uint128(); } } for (uint256 i = 0; i < tokens.length; i++) indexes[i] = rewardState[tokens[i]].index; } /// @dev this function doesn't need redeemExternal since redeemExternal is bundled in updateRewardIndex /// @dev this function also has to update rewardState.lastBalance function _doTransferOutRewards( address user, address receiver ) internal virtual override returns (uint256[] memory rewardAmounts) { address[] memory tokens = _getRewardTokens(); rewardAmounts = new uint256[](tokens.length); for (uint256 i = 0; i < tokens.length; i++) { rewardAmounts[i] = userReward[tokens[i]][user].accrued; if (rewardAmounts[i] != 0) { userReward[tokens[i]][user].accrued = 0; rewardState[tokens[i]].lastBalance -= rewardAmounts[i].Uint128(); _transferOut(tokens[i], receiver, rewardAmounts[i]); } } } function _getRewardTokens() internal view virtual returns (address[] memory); function _rewardSharesTotal() internal view virtual returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "../../interfaces/IRewardManager.sol"; import "../libraries/ArrayLib.sol"; import "../libraries/TokenHelper.sol"; import "../libraries/math/Math.sol"; import "./RewardManagerAbstract.sol"; /// NOTE: RewardManager must not have duplicated rewardTokens abstract contract RewardManagerAbstract is IRewardManager, TokenHelper { using Math for uint256; 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) { userReward[token][user].index = index.Uint128(); continue; } 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.17; import "../../interfaces/IStandardizedYield.sol"; import "../erc20/PendleERC20Permit.sol"; import "../libraries/math/Math.sol"; import "../libraries/TokenHelper.sol"; import "../libraries/Errors.sol"; import "../libraries/BoringOwnableUpgradeable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; abstract contract SYBase is IStandardizedYield, PendleERC20Permit, TokenHelper, BoringOwnableUpgradeable, Pausable { using Math for uint256; address public immutable yieldToken; constructor( string memory _name, string memory _symbol, address _yieldToken ) PendleERC20Permit(_name, _symbol, IERC20Metadata(_yieldToken).decimals()) initializer { yieldToken = _yieldToken; __BoringOwnable_init(); } // solhint-disable no-empty-blocks receive() external payable {} /*/////////////////////////////////////////////////////////////// DEPOSIT/REDEEM USING BASE TOKENS //////////////////////////////////////////////////////////////*/ /** * @dev See {IStandardizedYield-deposit} */ function deposit( address receiver, address tokenIn, uint256 amountTokenToDeposit, uint256 minSharesOut ) external payable nonReentrant returns (uint256 amountSharesOut) { if (!isValidTokenIn(tokenIn)) revert Errors.SYInvalidTokenIn(tokenIn); if (amountTokenToDeposit == 0) revert Errors.SYZeroDeposit(); _transferIn(tokenIn, msg.sender, amountTokenToDeposit); amountSharesOut = _deposit(tokenIn, amountTokenToDeposit); if (amountSharesOut < minSharesOut) revert Errors.SYInsufficientSharesOut(amountSharesOut, minSharesOut); _mint(receiver, amountSharesOut); emit Deposit(msg.sender, receiver, tokenIn, amountTokenToDeposit, amountSharesOut); } /** * @dev See {IStandardizedYield-redeem} */ function redeem( address receiver, uint256 amountSharesToRedeem, address tokenOut, uint256 minTokenOut, bool burnFromInternalBalance ) external nonReentrant returns (uint256 amountTokenOut) { if (!isValidTokenOut(tokenOut)) revert Errors.SYInvalidTokenOut(tokenOut); if (amountSharesToRedeem == 0) revert Errors.SYZeroRedeem(); if (burnFromInternalBalance) { _burn(address(this), amountSharesToRedeem); } else { _burn(msg.sender, amountSharesToRedeem); } amountTokenOut = _redeem(receiver, tokenOut, amountSharesToRedeem); if (amountTokenOut < minTokenOut) revert Errors.SYInsufficientTokenOut(amountTokenOut, minTokenOut); emit Redeem(msg.sender, receiver, tokenOut, amountSharesToRedeem, amountTokenOut); } /** * @notice mint shares based on the deposited base tokens * @param tokenIn base token address used to mint shares * @param amountDeposited amount of base tokens deposited * @return amountSharesOut amount of shares minted */ function _deposit( address tokenIn, uint256 amountDeposited ) internal virtual returns (uint256 amountSharesOut); /** * @notice redeems base tokens based on amount of shares to be burned * @param tokenOut address of the base token to be redeemed * @param amountSharesToRedeem amount of shares to be burned * @return amountTokenOut amount of base tokens redeemed */ function _redeem( address receiver, address tokenOut, uint256 amountSharesToRedeem ) internal virtual returns (uint256 amountTokenOut); /*/////////////////////////////////////////////////////////////// EXCHANGE-RATE //////////////////////////////////////////////////////////////*/ /** * @dev See {IStandardizedYield-exchangeRate} */ function exchangeRate() external view virtual override returns (uint256 res); /*/////////////////////////////////////////////////////////////// REWARDS-RELATED //////////////////////////////////////////////////////////////*/ /** * @dev See {IStandardizedYield-claimRewards} */ function claimRewards( address /*user*/ ) external virtual override returns (uint256[] memory rewardAmounts) { rewardAmounts = new uint256[](0); } /** * @dev See {IStandardizedYield-getRewardTokens} */ function getRewardTokens() external view virtual override returns (address[] memory rewardTokens) { rewardTokens = new address[](0); } /** * @dev See {IStandardizedYield-accruedRewards} */ function accruedRewards( address /*user*/ ) external view virtual override returns (uint256[] memory rewardAmounts) { rewardAmounts = new uint256[](0); } function rewardIndexesCurrent() external virtual override returns (uint256[] memory indexes) { indexes = new uint256[](0); } function rewardIndexesStored() external view virtual override returns (uint256[] memory indexes) { indexes = new uint256[](0); } /*/////////////////////////////////////////////////////////////// MISC METADATA FUNCTIONS //////////////////////////////////////////////////////////////*/ function previewDeposit( address tokenIn, uint256 amountTokenToDeposit ) external view virtual returns (uint256 amountSharesOut) { if (!isValidTokenIn(tokenIn)) revert Errors.SYInvalidTokenIn(tokenIn); return _previewDeposit(tokenIn, amountTokenToDeposit); } function previewRedeem( address tokenOut, uint256 amountSharesToRedeem ) external view virtual returns (uint256 amountTokenOut) { if (!isValidTokenOut(tokenOut)) revert Errors.SYInvalidTokenOut(tokenOut); return _previewRedeem(tokenOut, amountSharesToRedeem); } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function _beforeTokenTransfer( address, address, uint256 ) internal virtual override whenNotPaused {} function _previewDeposit( address tokenIn, uint256 amountTokenToDeposit ) internal view virtual returns (uint256 amountSharesOut); function _previewRedeem( address tokenOut, uint256 amountSharesToRedeem ) internal view virtual returns (uint256 amountTokenOut); function getTokensIn() public view virtual returns (address[] memory res); function getTokensOut() public view virtual returns (address[] memory res); function isValidTokenIn(address token) public view virtual returns (bool); function isValidTokenOut(address token) public view virtual returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "../RewardManager/RewardManager.sol"; import "./SYBase.sol"; /// NOTE: yieldToken MUST NEVER BE a rewardToken, else the rewardManager will behave erroneously abstract contract SYBaseWithRewards is SYBase, RewardManager { using Math for uint256; using ArrayLib for address[]; constructor( string memory _name, string memory _symbol, address _yieldToken ) SYBase(_name, _symbol, _yieldToken) // solhint-disable-next-line no-empty-blocks {} /*/////////////////////////////////////////////////////////////// REWARDS-RELATED //////////////////////////////////////////////////////////////*/ /** * @dev See {IStandardizedYield-claimRewards} */ function claimRewards( address user ) external virtual override nonReentrant returns (uint256[] memory rewardAmounts) { _updateAndDistributeRewards(user); rewardAmounts = _doTransferOutRewards(user, user); emit ClaimRewards(user, _getRewardTokens(), rewardAmounts); } /** * @dev See {IStandardizedYield-getRewardTokens} */ function getRewardTokens() external view virtual override returns (address[] memory rewardTokens) { rewardTokens = _getRewardTokens(); } /** * @dev See {IStandardizedYield-accruedRewards} */ function accruedRewards( address user ) external view virtual override returns (uint256[] memory rewardAmounts) { address[] memory rewardTokens = _getRewardTokens(); rewardAmounts = new uint256[](rewardTokens.length); for (uint256 i = 0; i < rewardTokens.length; ) { rewardAmounts[i] = userReward[rewardTokens[i]][user].accrued; unchecked { i++; } } } function rewardIndexesCurrent() external override nonReentrant returns (uint256[] memory indexes) { _updateRewardIndex(); return rewardIndexesStored(); } function rewardIndexesStored() public view virtual override returns (uint256[] memory indexes) { address[] memory rewardTokens = _getRewardTokens(); indexes = new uint256[](rewardTokens.length); for (uint256 i = 0; i < rewardTokens.length; ) { indexes[i] = rewardState[rewardTokens[i]].index; unchecked { i++; } } } /** * @notice returns the total number of reward shares * @dev this is simply the total supply of shares, as rewards shares are equivalent to SY shares */ function _rewardSharesTotal() internal view virtual override returns (uint256) { return totalSupply(); } /** * @notice returns the reward shares of (`user`) * @dev this is simply the SY balance of (`user`), as rewards shares are equivalent to SY shares */ function _rewardSharesUser(address user) internal view virtual override returns (uint256) { return balanceOf(user); } /*/////////////////////////////////////////////////////////////// TRANSFER HOOKS //////////////////////////////////////////////////////////////*/ function _beforeTokenTransfer(address from, address to, uint256) internal virtual override { _updateAndDistributeRewardsForTwo(from, to); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; 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.17; 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) * @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.17; interface IStargateLP { struct SwapObj { uint256 amount; uint256 eqFee; uint256 eqReward; uint256 lpFee; uint256 protocolFee; uint256 lkbRemove; } function swapRemote( uint16 _srcChainId, uint256 _srcPoolId, address _to, SwapObj memory _s ) external returns (uint256 amountLD); function poolId() external view returns (uint256); function amountLPtoLD(uint256 _amountLP) external view returns (uint256); function token() external view returns (address); function router() external view returns (address); function totalSupply() external view returns (uint256); function totalLiquidity() external view returns (uint256); function mintFeeBP() external view returns (uint256); function convertRate() external view returns (uint256); function deltaCredit() external view returns (uint256); }
// 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.17; interface IStargateRouter { function addLiquidity(uint256 _poolId, uint256 _amountLD, address _to) external; function instantRedeemLocal( uint16 _srcPoolId, uint256 _amountLP, address _to ) external returns (uint256 amountSD); }
// 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.17; interface IStargateStaking { struct PoolInfo { address lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. STGs to distribute per block. uint256 lastRewardBlock; // Last block number that STGs distribution occurs. uint256 accStargatePerShare; // Accumulated STGs per share, times 1e12. See below. } struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. } function stargate() external view returns (address); function deposit(uint256 _pid, uint256 _amount) external; function withdraw(uint256 _pid, uint256 _amount) external; function poolInfo(uint256 _pid) external view returns (address, uint256, uint256, uint256); function userInfo(uint256 _pid, address _user) external view returns (UserInfo memory); }
// 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.17; 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, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_stargateLP","type":"address"},{"internalType":"address","name":"_stargateStaking","type":"address"},{"internalType":"uint256","name":"_sid","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"actualSharesOut","type":"uint256"},{"internalType":"uint256","name":"requiredSharesOut","type":"uint256"}],"name":"SYInsufficientSharesOut","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualTokenOut","type":"uint256"},{"internalType":"uint256","name":"requiredTokenOut","type":"uint256"}],"name":"SYInsufficientTokenOut","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SYInvalidTokenIn","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SYInvalidTokenOut","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountLpDesired","type":"uint256"},{"internalType":"uint256","name":"amountLpRedeemable","type":"uint256"}],"name":"SYStargateRedeemCapExceeded","type":"error"},{"inputs":[],"name":"SYZeroDeposit","type":"error"},{"inputs":[],"name":"SYZeroRedeem","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":"user","type":"address"},{"indexed":false,"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"name":"ClaimRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountDeposited","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSyOut","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSyToRedeem","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountTokenOut","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STARGATE_BP_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"accruedRewards","outputs":[{"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"assetInfo","outputs":[{"internalType":"enum IStandardizedYield.AssetType","name":"assetType","type":"uint8"},{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"uint8","name":"assetDecimals","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"claimRewards","outputs":[{"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"convertRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountTokenToDeposit","type":"uint256"},{"internalType":"uint256","name":"minSharesOut","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"amountSharesOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"exchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardTokens","outputs":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensIn","outputs":[{"internalType":"address[]","name":"res","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensOut","outputs":[{"internalType":"address[]","name":"res","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isValidTokenIn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isValidTokenOut","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lp","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"pid","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountTokenToDeposit","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"amountSharesOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountSharesToRedeem","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"amountTokenOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amountSharesToRedeem","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"minTokenOut","type":"uint256"},{"internalType":"bool","name":"burnFromInternalBalance","type":"bool"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"amountTokenOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardIndexesCurrent","outputs":[{"internalType":"uint256[]","name":"indexes","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardIndexesStored","outputs":[{"internalType":"uint256[]","name":"indexes","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardState","outputs":[{"internalType":"uint128","name":"index","type":"uint128"},{"internalType":"uint128","name":"lastBalance","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stargateRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stargateStaking","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stgToken","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"newOwner","type":"address"},{"internalType":"bool","name":"direct","type":"bool"},{"internalType":"bool","name":"renounce","type":"bool"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","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"},{"inputs":[],"name":"yieldToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
610280806040523462000bb057620059f1803803809162000021828562000bd1565b8339810160a08282031262000bb05781516001600160401b03811162000bb057816200004f91840162000c11565b602083015190916001600160401b03821162000bb0576200007291840162000c11565b620000806040840162000c7b565b906080620000916060860162000c7b565b94015160405163313ce56760e01b81529093906020816004816001600160a01b0388165afa908115620006a05760009162000b6d575b5060408051939084016001600160401b03811185821017620009225760405260018452603160f81b602085015282516001600160401b0381116200092257600354600181811c9116801562000b62575b602082101462000a4557601f811162000afc575b50806020601f821160011462000a725760009162000a66575b508160011b916000199060031b1c1916176003555b8051906001600160401b038211620009225760045490600182811c9216801562000a5b575b602083101462000a455781601f849311620009d3575b50602090601f8311600114620009445760009262000938575b50508160011b916000199060031b1c1916176004555b608052600160f81b60018060f81b036002541617600255602081519101209060208151910120816101005280610120524660c05260405191600080516020620059d18339815191526020840152604083015260608201524660808201523060a082015260a081528060c081011060018060401b0360c083011117620009225760c081016040528051602082012060a0523060e052600080516020620059d18339815191526101405260ff196038541660385560075460ff8160a81c16159182809362000911575b8015620008f5575b1562000895575060ff60a01b198116600160a01b17600755816200087c575b5081610160526007549160ff8360a81c16156200082357600680546001600160a01b03191633179055600492602092620007e6575b506101c0819052604051637e062a3560e11b815292839182906001600160a01b03165afa908115620006a057600091620007a4575b506101e0526101c0516040516303e21fa960e61b815290602090829060049082906001600160a01b03165afa908115620006a05760009162000762575b50610200526101c051604051631f06e1a760e11b815290602090829060049082906001600160a01b03165afa908115620006a05760009162000729575b5061ffff16610180526102208290526101a052604051633604cef760e11b815290602090829060049082906001600160a01b03165afa908115620006a057600091620006e4575b50610240526101c05160405163feb56b1560e01b815290602090829060049082906001600160a01b03165afa908115620006a057600091620006ac575b50610260526101e051610200516200043e916001600160a01b03918216911662000c90565b6101c051610220516200045e916001600160a01b03918216911662000c90565b610220516101a0516101c051604051631526fe2760e01b815260048101929092526001600160a01b039081169260809183916024918391165afa908115620006a0576000916200065b575b506001600160a01b0316036200061657604051614ac462000f0d8239608051816121c3015260a051816145c9015260c05181614695015260e0518161459a015261010051816146180152610120518161463e015261014051816145f5015261016051816117800152610180518181816103be01528181611a3d015261259601526101a0518181816110f9015281816118f00152818161265a01526135fb01526101c051818181610b1f01528181610e8a0152818161192c0152818161202f01528181612232015281816125d901528181612ffa0152613c6701526101e0518181816112e301528181611cab0152818161251301528181612fc70152613c370152610200518181816111a401528181611a78015261253d0152610220518181816118990152818161260201528181612e7701526135a20152610240518181816113ea0152613bbf01526102605181818161026c01528181610c4501528181610f920152611ac90152614ac490f35b60405162461bcd60e51b815260206004820152601560248201527f696e76616c6964207369642026206c70546f6b656e00000000000000000000006044820152606490fd5b906080823d60801162000697575b81620006786080938362000bd1565b810103126200069457506200068d9062000c7b565b38620004a9565b80fd5b3d915062000669565b6040513d6000823e3d90fd5b906020823d602011620006db575b81620006c96020938362000bd1565b81010312620006945750513862000419565b3d9150620006ba565b6020813d60201162000720575b81620007006020938362000bd1565b810103126200071c5762000715915062000c7b565b38620003dc565b5080fd5b3d9150620006f1565b906020823d60201162000759575b81620007466020938362000bd1565b8101031262000694575051602062000395565b3d915062000737565b906020823d6020116200079b575b816200077f6020938362000bd1565b81010312620006945750620007949062000c7b565b3862000358565b3d915062000770565b906020823d602011620007dd575b81620007c16020938362000bd1565b81010312620006945750620007d69062000c7b565b386200031b565b3d9150620007b2565b60ff60a81b1916600755604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498908390a138620002e6565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b61ffff60a01b191661010160a01b1760075538620002b1565b60c060849162461bcd60e51b82820152602060c4820152602e60e48201527f496e697469616c697a61626c653a20636f6e747261637420697320616c7265616101048201526d191e481a5b9a5d1a585b1a5e995960921b61012482015201fd5b50303b158015620002925750600160ff8360a01c161462000292565b50600160ff8360a01c16106200028a565b634e487b7160e01b600052604160045260246000fd5b015190503880620001ad565b6004600090815293507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b91905b601f1984168510620009b7576001945083601f198116106200099d575b505050811b01600455620001c3565b015160001960f88460031b161c191690553880806200098e565b8181015183556020948501946001909301929091019062000971565b60046000529091507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f840160051c81016020851062000a3d575b90849392915b601f830160051c8201811062000a2d57505062000194565b6000815585945060010162000a15565b508062000a0f565b634e487b7160e01b600052602260045260246000fd5b91607f16916200017e565b90508401513862000144565b6003600090815292507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b905b601f198316841062000ae3576001935082601f1981161062000ac9575b5050811b0160035562000159565b86015160001960f88460031b161c19169055388062000abb565b8681015182556020938401936001909201910162000a9e565b60036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f830160051c81016020841062000b5a575b601f830160051c8201811062000b4d5750506200012b565b6000815560010162000b35565b508062000b35565b90607f169062000117565b6020813d60201162000ba7575b8162000b896020938362000bd1565b810103126200071c57519060ff8216820362000694575038620000c7565b3d915062000b7a565b600080fd5b608081019081106001600160401b038211176200092257604052565b601f909101601f19168101906001600160401b038211908210176200092257604052565b6001600160401b0381116200092257601f01601f191660200190565b919080601f8401121562000bb05782519062000c2d8262000bf5565b9162000c3d604051938462000bd1565b80835260209182828701011162000bb05760005b81811062000c6757508260009394955001015290565b858101830151848201840152820162000c51565b51906001600160a01b038216820362000bb057565b6001600160a01b03919082811690811562000f0657604091825180958195636eb1769f60e11b83523060048401521691826024830152602096879160449788915afa90811562000efb5760009162000ec8575b5060016001605f1b031162000cfa575b5050505050565b82519060008087840163095ea7b360e01b94858252846024820152828982015288815262000d288162000bb5565b519082875af13d1562000ec0573d62000d418162000bf5565b9062000d508751928362000bd1565b81523d60008983013e5b8162000e82575b501562000e50579160009291838093865190898201938452602482015281198882015287815262000d928162000bb5565b51925af13d1562000e48573d62000da98162000bf5565b9062000db88451928362000bd1565b81523d60008683013e5b8162000e0a575b501562000dd857808062000cf3565b5162461bcd60e51b81526004810192909252600c60248301526b5361666520417070726f766560a01b90820152606490fd5b8091505184811591821562000e25575b505090503862000dc9565b838092935001031262000bb057830151801515810362000bb05780843862000e1a565b606062000dc2565b835162461bcd60e51b815260048101879052600c60248201526b5361666520417070726f766560a01b81870152606490fd5b8091505187811591821562000e9d575b505090503862000d61565b838092935001031262000bb057860151801515810362000bb05780873862000e92565b606062000d5a565b908682813d831162000ef3575b62000ee1818362000bd1565b81010312620006945750513862000ce3565b503d62000ed5565b84513d6000823e3d90fd5b5050505056fe6080604081815260049182361015610022575b505050361561002057600080fd5b005b600092833560e01c9182630419738e14612e2d5750816306fdde0314612ce3578163071bc3c914612428578163078dfbe714612b55578163095ea7b314612b06578163128fced114612a4a57816318160ddd146129ec57816320e8c56514612434578163213cae631461242857816323b872dd14612256578163313c06a0146121e7578163313ce5671461218b5781633644e515146121505781633ba0b9a914611fe85781633f4ba83a14611ed85781634e71e0c814611dc95781635c975abb14611d875781635cbadbe414611ccf5781636f307dc314611c6057816370a0823114611bf3578163769f8e5d146117a457816376d5de8514611735578163784367d6146117295781637ecebe00146116c75781638456cb59146115b55781638da5cb5b1461156257816395d89b411461140e5781639afb25de1461139f578163a40bee501461129c578163a9059cbb146111c8578163a9e56f3c14611159578163a9f8d1811461111c578163b1e8eb95146110c3578163b8f82b2614610e28578163c4f59f9b14610dd9578163c9616b0414610d9e578163cbe52ae314610abd578163d505accf1461085c578163da88ecb41461080d578163dd62ed3e14610796578163e30c397814610743578163ea64a820146106b7578163ef5cfb8c146103e257508063f106845414610386578063f8b2f991146102a5578063fa5a4f06146102935763feb56b1514610238575b80610012565b3461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b5080fd5b50505061029e613107565b3880610232565b503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761038290600254906102ec60028360f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8093161760025561033c6134d1565b50507f0100000000000000000000000000000000000000000000000000000000000000610367613ae2565b926002541617600255519182916020835260208301906130d3565b0390f35b503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905161ffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b83833461028f576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b3579161041d61308d565b906002549361043260028660f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80961617600255610483836133ec565b61048b613b87565b9061049682516132f1565b9473ffffffffffffffffffffffffffffffffffffffff93858516815b855181101561062357866104c682886133d8565b511683526039808652848420836000528652846000205490608091821c6104ed848d6133d8565b526104f8838c6133d8565b5161050e575b505061050990613340565b6104b2565b88610519848a6133d8565b51168552865284842083600052865284600020906fffffffffffffffffffffffffffffffff9182815416905561054f838c6133d8565b519082821161061e5789610563858b6133d8565b51168652603b8852828787209216908254901c039182116105f2578a8a6105e4858c6105dc828e6105d76105099b9a6105eb9a906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b6133d8565b5116936133d8565b51916148fc565b908c6104fe565b60248560118f7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b600080fd5b8885610382867f01000000000000000000000000000000000000000000000000000000000000008e877f2193aa20a3717f5f4ac79482f4f553e5f0afe8f4e6ec3e3d1aa2e138adc4763f61068c610678613b87565b610699875192839289845289840190612f01565b8281038b8401528b6130d3565b0390a26002541617600255519282849384528301906130d3565b8280fd5b50503461028f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57806103829273ffffffffffffffffffffffffffffffffffffffff61070a61308d565b168152603b60209081529190205491516fffffffffffffffffffffffffffffffff8316815260809290921c908201529081906040820190565b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5760209073ffffffffffffffffffffffffffffffffffffffff600754169051908152f35b50503461028f57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020916107d161308d565b826107da6130b0565b9273ffffffffffffffffffffffffffffffffffffffff809316815260018652209116600052825280600020549051908152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761038290610849613ae2565b90519182916020835260208301906130d3565b8391503461028f5760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761089661308d565b61089e6130b0565b906044359260643560843560ff81168103610ab957814211610a5c5773ffffffffffffffffffffffffffffffffffffffff90818516928389526005602052898920908154916001830190558a519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452868d840152858a1660608401528a608084015260a083015260c082015260c0815260e0810181811067ffffffffffffffff821117610a2e578b525190206109bc916109b491610961614583565b918c519160208301937f1901000000000000000000000000000000000000000000000000000000000000855260228401526042830152604282526109a482613260565b60c4359260a435925190206144c1565b91909161429c565b16036109d157506109ce939450614127565b80f35b60649060208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b6041877f4e487b71000000000000000000000000000000000000000000000000000000006000525260246000fd5b60648360208a51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b8680fd5b9050346106b357817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b357610af561308d565b9260243591610b0385613c1c565b15610d585773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811695168503610b5657505060209250905b51908152f35b83517f15770f9200000000000000000000000000000000000000000000000000000000815292916020808584818a5afa948515610d4e578295610d1f575b508551967f18160ddd00000000000000000000000000000000000000000000000000000000885281888581845afa978815610d15578398610ce4575b50908084928851938480927f1e8e51da0000000000000000000000000000000000000000000000000000000082525afa928315610cd95791889391879392610ca3575b5050610c2792610c2291613b74565b613be3565b808311610c70575050602093610c22610c6a93610c4393613b74565b7f000000000000000000000000000000000000000000000000000000000000000090613b74565b90610b50565b6044928551927f5d8468630000000000000000000000000000000000000000000000000000000084528301526024820152fd5b925092505081813d8311610cd2575b610cbc8183613298565b8101031261061e57518590849082610c22610c13565b503d610cb2565b8751903d90823e3d90fd5b918091985082813d8311610d0e575b610cfd8183613298565b8101031261061e5790519681610bd0565b503d610cf3565b87513d85823e3d90fd5b9080955081813d8311610d47575b610d378183613298565b8101031261061e57519338610b94565b503d610d2d565b86513d84823e3d90fd5b8460249173ffffffffffffffffffffffffffffffffffffffff8651927f88a505610000000000000000000000000000000000000000000000000000000084521690820152fd5b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090516127108152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761038290610e15613b87565b9051918291602083526020830190612f01565b8284346110c057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126110c057610e6061308d565b9260243591610e6e85613c1c565b1561107b5773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811695168503610ec0575050602092509051908152f35b90918351927f15770f920000000000000000000000000000000000000000000000000000000084526020808583818a5afa948515611071578495611042575b508551967f18160ddd00000000000000000000000000000000000000000000000000000000885281888481845afa978815611038578598611009575b5081908751938480927ffaa24f070000000000000000000000000000000000000000000000000000000082525afa938415610ffe5793610fca575b5050602094610fc5610c6a9493612710610fbe610fb7610c22967f000000000000000000000000000000000000000000000000000000000000000090613be3565b9283613b74565b04906134b7565b613b74565b9080949350813d8311610ff7575b610fe28183613298565b8101031261061e579151909184610fc5610f76565b503d610fd8565b8651903d90823e3d90fd5b9097508181813d8311611031575b6110218183613298565b8101031261061e57519681610f3b565b503d611017565b87513d87823e3d90fd5b9080955081813d831161106a575b61105a8183613298565b8101031261061e57519387610eff565b503d611050565b86513d86823e3d90fd5b83517faeabe71800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861681840152602490fd5b80fd5b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090603a549051908152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50503461028f57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020907f010000000000000000000000000000000000000000000000000000000000000061122461308d565b61128d6002549161123b60028460f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556024359033613c8d565b60025416176002555160018152f35b83833461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016926020825180927f313ce56700000000000000000000000000000000000000000000000000000000825281875afa908115611393578391611357575b5060ff90606094835194855260208501521690820152f35b90506020813d821161138b575b8161137160209383613298565b810103126106b3575160ff811681036106b357606061133f565b3d9150611364565b505051903d90823e3d90fd5b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b83833461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57805191809380549160019083821c92828516948515611558575b602095868610811461152c578589529081156114ea5750600114611492575b6103828787611488828c0383613298565b5191829182612e9b565b81529295507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8284106114d757505050826103829461148892820101948680611477565b80548685018801529286019281016114b9565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168887015250505050151560051b8301019250611488826103828680611477565b6024846022857f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b93607f1693611458565b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5760209073ffffffffffffffffffffffffffffffffffffffff600654169051908152f35b9050346106b357827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b35761160873ffffffffffffffffffffffffffffffffffffffff6006541633146131b8565b6038549060ff821661166a57507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589160017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00602093161760385551338152a180f35b60649060208451917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b50503461028f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f578060209273ffffffffffffffffffffffffffffffffffffffff61171961308d565b1681526005845220549051908152f35b5050505061029e613107565b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b8391503461028f5760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576117de61308d565b6044359173ffffffffffffffffffffffffffffffffffffffff8084169260248035939085870361061e5760643590608435801515810361061e5761187c6002549961182f60028c60f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809c1617600255613c1c565b15611bc5578615611b9d5715611b8e576118968630613f15565b847f000000000000000000000000000000000000000000000000000000000000000016803b15611b8a5789809160448d51809481937f441a3e700000000000000000000000000000000000000000000000000000000083527f00000000000000000000000000000000000000000000000000000000000000008a8401528c888401525af18015611b8057908a91611b68575b50507f000000000000000000000000000000000000000000000000000000000000000098858a168814600014611a0857506119658685819b6148fc565b8189106119d5576020898b7f01000000000000000000000000000000000000000000000000000000000000008b8b8b8b8b8651928352878984015216907faee47cdf925cf525fdae94f9777ee5a06cac37e1c41220d0a8a89ed154f62d1c863392a4600254161760025551908152f35b60449350888a51937fbfee4ca0000000000000000000000000000000000000000000000000000000008552840152820152fd5b611a138a929a6149e5565b8b517fc4de93a500000000000000000000000000000000000000000000000000000000815261ffff7f00000000000000000000000000000000000000000000000000000000000000001686820152888c8201528787166044820152602081606481868c7f0000000000000000000000000000000000000000000000000000000000000000165af1928315611b5d5792611b28575b50611ab5611abb92936149e5565b906134b7565b868110611af45750611aee907f000000000000000000000000000000000000000000000000000000000000000090613b74565b97611965565b836044918b898e51937f5d846863000000000000000000000000000000000000000000000000000000008552840152820152fd5b91506020823d8211611b55575b81611b4260209383613298565b8101031261061e57905190611ab5611aa7565b3d9150611b35565b8d51903d90823e3d90fd5b611b719061321d565b611b7c57888b611928565b8880fd5b8b513d8c823e3d90fd5b8980fd5b611b988633613f15565b611896565b838b517fc3d83b07000000000000000000000000000000000000000000000000000000008152fd5b5082878b51917f88a50561000000000000000000000000000000000000000000000000000000008352820152fd5b50503461028f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090611c59611c3261308d565b73ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b9051908152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50503461028f57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761038291611d0b61308d565b82611d146130b0565b9273ffffffffffffffffffffffffffffffffffffffff809316815260396020522091166000526020528060002054905191816fffffffffffffffffffffffffffffffff849360801c9116839060209093929360408301946fffffffffffffffffffffffffffffffff809216845216910152565b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5760209060ff6038541690519015158152f35b919050346106b357827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b3576007549073ffffffffffffffffffffffffffffffffffffffff9283831691823303611e7b575050806006549384167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809316176006551660075580f35b90602060649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602060248201527f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e65726044820152fd5b9050346106b357827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b357611f2b73ffffffffffffffffffffffffffffffffffffffff6006541633146131b8565b6038549060ff821615611f8b57507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff006020921660385551338152a180f35b60649060208451917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b9050346106b357827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b35773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016928251917f15770f9200000000000000000000000000000000000000000000000000000000835260209485848381845afa938415612146579086918495612115575b508551928380927f18160ddd0000000000000000000000000000000000000000000000000000000082525afa91821561210a57916120db575b50610c4390610c22611c5993613b57565b90508381813d8311612103575b6120f28183613298565b8101031261061e5751611c596120ca565b503d6120e8565b8451903d90823e3d90fd5b8281939296503d831161213f575b61212d8183613298565b8101031261061e578590519338612091565b503d612123565b85513d85823e3d90fd5b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090611c59614583565b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b8391503461028f5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761229061308d565b6122986130b0565b906044359285600254956122b260028860f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8098161760025573ffffffffffffffffffffffffffffffffffffffff84168152600160205220336000526020528560002054907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361237e575b6020877f01000000000000000000000000000000000000000000000000000000000000008861128d898989613c8d565b8482106123cb575092602095949261128d926123be837f010000000000000000000000000000000000000000000000000000000000000097033383614127565b925092949581945061234e565b60649060208851917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b5050505061029e612f4b565b91905060807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b35761246961308d565b6124716130b0565b60448035606496873596600295865499612490888c60f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809c161788556124e087613c1c565b156129a757841561297f5773ffffffffffffffffffffffffffffffffffffffff96871696876128f057853403612896575b7f00000000000000000000000000000000000000000000000000000000000000008116880361288f57807f000000000000000000000000000000000000000000000000000000000000000016803b1561286457858091848d51809481937f87b21efc00000000000000000000000000000000000000000000000000000000835261ffff7f0000000000000000000000000000000000000000000000000000000000000000168b8401528c60248401528d30908401525af1801561288557612872575b506125fd7f00000000000000000000000000000000000000000000000000000000000000006149e5565b9a5b817f000000000000000000000000000000000000000000000000000000000000000016803b15610ab9578680918a8f8f5194859384927fe2bbb1580000000000000000000000000000000000000000000000000000000084527f00000000000000000000000000000000000000000000000000000000000000008d85015260248401525af1801561286857908791612850575b5050808c1061281c575082169586156127c25750506126b0906133ec565b88881161061e578554908989168a831601908a821161279657509380927f01000000000000000000000000000000000000000000000000000000000000009694927fff000000000000000000000000000000000000000000000000000000000000008c60209d98169116178855818152808b528881206127318b82546134c4565b90557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8b8a518c8152a3865190815287898201527f5fe47ed6d4225326d3303476197d782ded5a4e9c14f479dc9ec4992af4e85d59873392a482541617905551908152f35b8360116024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300849160208c51937f08c379a0000000000000000000000000000000000000000000000000000000008552840152601f6024840152820152fd5b8488918d8d51927fbc71f2ba0000000000000000000000000000000000000000000000000000000084528301526024820152fd5b6128599061321d565b612864578538612692565b8580fd5b8c513d89823e3d90fd5b61287e9095919561321d565b93386125d3565b8b513d88823e3d90fd5b859a6125ff565b5088517f08c379a0000000000000000000000000000000000000000000000000000000008152602081850152600c60248201527f657468206d69736d61746368000000000000000000000000000000000000000081880152fd5b89517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523088820152868382015282815260a0810181811067ffffffffffffffff821117612953578b5261294e90896146bb565b612511565b6024876041887f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8289517fa907f2f0000000000000000000000000000000000000000000000000000000008152fd5b88517faeabe71800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff881681850152602490fd5b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600254169051908152f35b8284346110c057602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57612a8561308d565b91612a8e613b87565b92612a9984516132f1565b9473ffffffffffffffffffffffffffffffffffffffff91821691835b8651811015612af4578082612acc6001938a6133d8565b511686526039845286862085875284528686205460801c612aed828b6133d8565b5201612ab5565b8551838152806103828186018b6130d3565b50503461028f57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090612b4e612b4461308d565b6024359033614127565b5160018152f35b919050346106b35760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b357612b8f61308d565b91602435918215158303612cdf576044359283151584036128645773ffffffffffffffffffffffffffffffffffffffff948591612bd1836006541633146131b8565b15612cad571692831590811591612ca5575b5015612c48575050806006549283167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809216176006556007541660075580f35b90602060649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601560248201527f4f776e61626c653a207a65726f206164647265737300000000000000000000006044820152fd5b905038612be3565b9350505050167fffffffffffffffffffffffff0000000000000000000000000000000000000000600754161760075580f35b8480fd5b919050346106b357827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b357805191836003549060019082821c928281168015612e23575b6020958686108214612df75750848852908115612db75750600114612d5e575b6103828686611488828b0383613298565b929550600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b828410612da4575050508261038294611488928201019438612d4d565b8054868501880152928601928101612d87565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001687860152505050151560051b83010192506114888261038238612d4d565b8360226024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b93607f1693612d2d565b84903461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b60208082528251818301819052939260005b858110612eed575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006040809697860101520116010190565b818101830151848201604001528201612ead565b90815180825260208080930193019160005b828110612f21575050505090565b835173ffffffffffffffffffffffffffffffffffffffff1685529381019392810192600101612f13565b503461061e576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126110c0576040516060810181811067ffffffffffffffff82111761306057604052600281526040366020830137612fae8161339c565b73ffffffffffffffffffffffffffffffffffffffff90817f00000000000000000000000000000000000000000000000000000000000000001690528151600110156130335761038292507f0000000000000000000000000000000000000000000000000000000000000000166040820152604051918291602083526020830190612f01565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361061e57565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361061e57565b90815180825260208080930193019160005b8281106130f3575050505090565b8351855293810193928101926001016130e5565b503461061e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261061e57602061314961314461308d565b613c1c565b6040519015158152f35b1561315a57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b156131bf57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff811161323157604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6080810190811067ffffffffffffffff82111761323157604052565b6040810190811067ffffffffffffffff82111761323157604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761323157604052565b67ffffffffffffffff81116132315760051b60200190565b906132fb826132d9565b6133086040519182613298565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061333682946132d9565b0190602036910137565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461336d5760010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8051156133a95760200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b80518210156133a95760209160051b010190565b6133f46134d1565b9080511561343d5773ffffffffffffffffffffffffffffffffffffffff83168015159081613432575b5061342757505050565b61343092613882565b565b90503014153861341d565b505050565b61344a6134d1565b918151156134b15773ffffffffffffffffffffffffffffffffffffffff90838383831680151590816134a6575b50613495575b50505083168015159081613432575061342757505050565b61349e92613882565b38838361347d565b905030141538613477565b50505050565b9190820391821161336d57565b9190820180921161336d57565b6134d9613b87565b906134e482516132f1565b82516000901561387e57603a544303613560575b805b845181101561355b578073ffffffffffffffffffffffffffffffffffffffff61352661355693886133d8565b51168352603b6020526fffffffffffffffffffffffffffffffff60408420541661355082866133d8565b52613340565b6134fa565b505090565b90919243603a557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002541673ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001694853b1561387a576040517f441a3e7000000000000000000000000000000000000000000000000000000000815284816044818360049b7f00000000000000000000000000000000000000000000000000000000000000008d8401528160248401525af1801561386f57613827575b50835b835181101561381b5773ffffffffffffffffffffffffffffffffffffffff61365c82866133d8565b511661368773ffffffffffffffffffffffffffffffffffffffff61368084886133d8565b51166149e5565b90808752603b6136a460209382855260408a205460801c906134b7565b928289528181526fffffffffffffffffffffffffffffffff60408a205416928315613812575b876137f4575b6fffffffffffffffffffffffffffffffff841161061e578952526fffffffffffffffffffffffffffffffff6040882091167fffffffffffffffffffffffffffffffff000000000000000000000000000000008254161790556fffffffffffffffffffffffffffffffff811161061e576fffffffffffffffffffffffffffffffff604087209116815460801c01906fffffffffffffffffffffffffffffffff82116137c8576137c392916137be91906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b613340565b613634565b60248760118b7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b9261380c9061380689610c2288613b57565b906134c4565b926136d0565b600193506136ca565b509392919450506134f8565b67ffffffffffffffff8195929511613843576040529238613631565b6024826041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6040513d87823e3d90fd5b8380fd5b5090565b9092919273ffffffffffffffffffffffffffffffffffffffff8083169283151580613ad8575b15613aa9576138d89073ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b9160005b8151811015613aa057826138f082846133d8565b5116906138fd81896133d8565b51826000526039906020908282526040806000208a60005283526fffffffffffffffffffffffffffffffff91828260002054168015613a4f57818114613a3f57670de0b6b3a764000061395c61395661397b93856134b7565b8d613b74565b0488600052868652836000208d6000528652836000205460801c6134c4565b9183821161061e5783831161061e578051948186019686881067ffffffffffffffff89111761323157613a3a998680956137be9a86521688528483890196168652600052815281600020908d600052526000209351167fffffffffffffffffffffffffffffffff0000000000000000000000000000000084541617835551166fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b6138dc565b505050505050613a3a9150613340565b50938285949293941161061e57613a3a96600052815281600020908a6000525260002091167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055613340565b50505050509050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b50308414156138a8565b613aea613b87565b90613af582516132f1565b91600090815b815181101561343d578073ffffffffffffffffffffffffffffffffffffffff613b26600193856133d8565b51168452603b6020526fffffffffffffffffffffffffffffffff604085205416613b5082886133d8565b5201613afb565b90670de0b6b3a76400009182810292818404149015171561336d57565b8181029291811591840414171561336d57565b60405190613b948261327c565b6001825260203681840137613ba88261339c565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169052565b8115613bed570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff809116817f0000000000000000000000000000000000000000000000000000000000000000168114918215613c6557505090565b7f00000000000000000000000000000000000000000000000000000000000000001614919050565b909173ffffffffffffffffffffffffffffffffffffffff91828116928315613e91578416938415613e0d57848414613daf57613cc891613442565b600082815280602052604081205491808310613d2b57604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220613d208282546134c4565b9055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f45524332303a207472616e7366657220746f2073656c660000000000000000006044820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff81169081156140a357613f3c906133ec565b60009181835282602052604083205481811061401f578190838552846020520360408420557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80821161387a576002549080831681831603818111613ff257917fff000000000000000000000000000000000000000000000000000000000000007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef949260209416911617600255604051908152a3565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561421957169182156141955760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b600581101561449257806142ad5750565b600181036143135760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b600281036143795760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b600381036144055760846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b60041461440e57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116145775760ff16601b8114158061456c575b614560579160809493916020936040519384528484015260408301526060820152600093849182805260015afa1561455357815173ffffffffffffffffffffffffffffffffffffffff81161561454d579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600490565b50601c8114156144f9565b50505050600090600390565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016301480614692575b156145eb577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f000000000000000000000000000000000000000000000000000000000000000082527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176132315760405251902090565b507f000000000000000000000000000000000000000000000000000000000000000046146145c2565b73ffffffffffffffffffffffffffffffffffffffff16906040516146de8161327c565b6020928382527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656484830152803b156147ea57906147339160008481959282888195519301915af161472d614848565b906148a6565b8051806147405750505050565b8184918101031261028f57820151908115918215036110c05750614766578080806134b1565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b606484604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b3d156148a1573d9067ffffffffffffffff8211613231576040519161489560207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184613298565b82523d6000602084013e565b606090565b909190156148b2575090565b8151156148c25750805190602001fd5b6148f8906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301612e9b565b0390fd5b821561343d5773ffffffffffffffffffffffffffffffffffffffff9081169081614999575050600080809381935af1614933614848565b501561493b57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b9261343093604051937fa9059cbb0000000000000000000000000000000000000000000000000000000060208601521660248401526044830152604482526149e082613260565b6146bb565b60009073ffffffffffffffffffffffffffffffffffffffff1680614a095750504790565b6020602491604051928380927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa918215614a82578092614a5257505090565b9091506020823d8211614a7a575b81614a6d60209383613298565b810103126110c057505190565b3d9150614a60565b604051903d90823e3d90fdfea26469706673582212203907607c7ad661cbe5daca1e03c88e54b1e14c60e496d69b9f0c2475ab93520e64736f6c634300081100338b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd783000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000105359205374617267617465205553445400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001053592d5374617267617465205553445400000000000000000000000000000000
Deployed Bytecode
0x6080604081815260049182361015610022575b505050361561002057600080fd5b005b600092833560e01c9182630419738e14612e2d5750816306fdde0314612ce3578163071bc3c914612428578163078dfbe714612b55578163095ea7b314612b06578163128fced114612a4a57816318160ddd146129ec57816320e8c56514612434578163213cae631461242857816323b872dd14612256578163313c06a0146121e7578163313ce5671461218b5781633644e515146121505781633ba0b9a914611fe85781633f4ba83a14611ed85781634e71e0c814611dc95781635c975abb14611d875781635cbadbe414611ccf5781636f307dc314611c6057816370a0823114611bf3578163769f8e5d146117a457816376d5de8514611735578163784367d6146117295781637ecebe00146116c75781638456cb59146115b55781638da5cb5b1461156257816395d89b411461140e5781639afb25de1461139f578163a40bee501461129c578163a9059cbb146111c8578163a9e56f3c14611159578163a9f8d1811461111c578163b1e8eb95146110c3578163b8f82b2614610e28578163c4f59f9b14610dd9578163c9616b0414610d9e578163cbe52ae314610abd578163d505accf1461085c578163da88ecb41461080d578163dd62ed3e14610796578163e30c397814610743578163ea64a820146106b7578163ef5cfb8c146103e257508063f106845414610386578063f8b2f991146102a5578063fa5a4f06146102935763feb56b1514610238575b80610012565b3461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090517f00000000000000000000000000000000000000000000000000000000000000018152f35b5080fd5b50505061029e613107565b3880610232565b503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761038290600254906102ec60028360f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8093161760025561033c6134d1565b50507f0100000000000000000000000000000000000000000000000000000000000000610367613ae2565b926002541617600255519182916020835260208301906130d3565b0390f35b503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905161ffff7f0000000000000000000000000000000000000000000000000000000000000002168152f35b83833461028f576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b3579161041d61308d565b906002549361043260028660f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80961617600255610483836133ec565b61048b613b87565b9061049682516132f1565b9473ffffffffffffffffffffffffffffffffffffffff93858516815b855181101561062357866104c682886133d8565b511683526039808652848420836000528652846000205490608091821c6104ed848d6133d8565b526104f8838c6133d8565b5161050e575b505061050990613340565b6104b2565b88610519848a6133d8565b51168552865284842083600052865284600020906fffffffffffffffffffffffffffffffff9182815416905561054f838c6133d8565b519082821161061e5789610563858b6133d8565b51168652603b8852828787209216908254901c039182116105f2578a8a6105e4858c6105dc828e6105d76105099b9a6105eb9a906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b6133d8565b5116936133d8565b51916148fc565b908c6104fe565b60248560118f7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b600080fd5b8885610382867f01000000000000000000000000000000000000000000000000000000000000008e877f2193aa20a3717f5f4ac79482f4f553e5f0afe8f4e6ec3e3d1aa2e138adc4763f61068c610678613b87565b610699875192839289845289840190612f01565b8281038b8401528b6130d3565b0390a26002541617600255519282849384528301906130d3565b8280fd5b50503461028f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57806103829273ffffffffffffffffffffffffffffffffffffffff61070a61308d565b168152603b60209081529190205491516fffffffffffffffffffffffffffffffff8316815260809290921c908201529081906040820190565b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5760209073ffffffffffffffffffffffffffffffffffffffff600754169051908152f35b50503461028f57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020916107d161308d565b826107da6130b0565b9273ffffffffffffffffffffffffffffffffffffffff809316815260018652209116600052825280600020549051908152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761038290610849613ae2565b90519182916020835260208301906130d3565b8391503461028f5760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761089661308d565b61089e6130b0565b906044359260643560843560ff81168103610ab957814211610a5c5773ffffffffffffffffffffffffffffffffffffffff90818516928389526005602052898920908154916001830190558a519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452868d840152858a1660608401528a608084015260a083015260c082015260c0815260e0810181811067ffffffffffffffff821117610a2e578b525190206109bc916109b491610961614583565b918c519160208301937f1901000000000000000000000000000000000000000000000000000000000000855260228401526042830152604282526109a482613260565b60c4359260a435925190206144c1565b91909161429c565b16036109d157506109ce939450614127565b80f35b60649060208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b6041877f4e487b71000000000000000000000000000000000000000000000000000000006000525260246000fd5b60648360208a51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b8680fd5b9050346106b357817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b357610af561308d565b9260243591610b0385613c1c565b15610d585773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd783811695168503610b5657505060209250905b51908152f35b83517f15770f9200000000000000000000000000000000000000000000000000000000815292916020808584818a5afa948515610d4e578295610d1f575b508551967f18160ddd00000000000000000000000000000000000000000000000000000000885281888581845afa978815610d15578398610ce4575b50908084928851938480927f1e8e51da0000000000000000000000000000000000000000000000000000000082525afa928315610cd95791889391879392610ca3575b5050610c2792610c2291613b74565b613be3565b808311610c70575050602093610c22610c6a93610c4393613b74565b7f000000000000000000000000000000000000000000000000000000000000000190613b74565b90610b50565b6044928551927f5d8468630000000000000000000000000000000000000000000000000000000084528301526024820152fd5b925092505081813d8311610cd2575b610cbc8183613298565b8101031261061e57518590849082610c22610c13565b503d610cb2565b8751903d90823e3d90fd5b918091985082813d8311610d0e575b610cfd8183613298565b8101031261061e5790519681610bd0565b503d610cf3565b87513d85823e3d90fd5b9080955081813d8311610d47575b610d378183613298565b8101031261061e57519338610b94565b503d610d2d565b86513d84823e3d90fd5b8460249173ffffffffffffffffffffffffffffffffffffffff8651927f88a505610000000000000000000000000000000000000000000000000000000084521690820152fd5b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090516127108152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761038290610e15613b87565b9051918291602083526020830190612f01565b8284346110c057817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126110c057610e6061308d565b9260243591610e6e85613c1c565b1561107b5773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd783811695168503610ec0575050602092509051908152f35b90918351927f15770f920000000000000000000000000000000000000000000000000000000084526020808583818a5afa948515611071578495611042575b508551967f18160ddd00000000000000000000000000000000000000000000000000000000885281888481845afa978815611038578598611009575b5081908751938480927ffaa24f070000000000000000000000000000000000000000000000000000000082525afa938415610ffe5793610fca575b5050602094610fc5610c6a9493612710610fbe610fb7610c22967f000000000000000000000000000000000000000000000000000000000000000190613be3565b9283613b74565b04906134b7565b613b74565b9080949350813d8311610ff7575b610fe28183613298565b8101031261061e579151909184610fc5610f76565b503d610fd8565b8651903d90823e3d90fd5b9097508181813d8311611031575b6110218183613298565b8101031261061e57519681610f3b565b503d611017565b87513d87823e3d90fd5b9080955081813d831161106a575b61105a8183613298565b8101031261061e57519387610eff565b503d611050565b86513d86823e3d90fd5b83517faeabe71800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861681840152602490fd5b80fd5b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090517f00000000000000000000000000000000000000000000000000000000000000018152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090603a549051908152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000008731d54e9d02c286767d56ac03e8037c07e01e98168152f35b50503461028f57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020907f010000000000000000000000000000000000000000000000000000000000000061122461308d565b61128d6002549161123b60028460f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556024359033613c8d565b60025416176002555160018152f35b83833461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec716926020825180927f313ce56700000000000000000000000000000000000000000000000000000000825281875afa908115611393578391611357575b5060ff90606094835194855260208501521690820152f35b90506020813d821161138b575b8161137160209383613298565b810103126106b3575160ff811681036106b357606061133f565b3d9150611364565b505051903d90823e3d90fd5b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6168152f35b83833461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57805191809380549160019083821c92828516948515611558575b602095868610811461152c578589529081156114ea5750600114611492575b6103828787611488828c0383613298565b5191829182612e9b565b81529295507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8284106114d757505050826103829461148892820101948680611477565b80548685018801529286019281016114b9565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168887015250505050151560051b8301019250611488826103828680611477565b6024846022857f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b93607f1693611458565b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5760209073ffffffffffffffffffffffffffffffffffffffff600654169051908152f35b9050346106b357827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b35761160873ffffffffffffffffffffffffffffffffffffffff6006541633146131b8565b6038549060ff821661166a57507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589160017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00602093161760385551338152a180f35b60649060208451917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b50503461028f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f578060209273ffffffffffffffffffffffffffffffffffffffff61171961308d565b1681526005845220549051908152f35b5050505061029e613107565b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd783168152f35b8391503461028f5760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576117de61308d565b6044359173ffffffffffffffffffffffffffffffffffffffff8084169260248035939085870361061e5760643590608435801515810361061e5761187c6002549961182f60028c60f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809c1617600255613c1c565b15611bc5578615611b9d5715611b8e576118968630613f15565b847f000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b16803b15611b8a5789809160448d51809481937f441a3e700000000000000000000000000000000000000000000000000000000083527f00000000000000000000000000000000000000000000000000000000000000018a8401528c888401525af18015611b8057908a91611b68575b50507f00000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd78398858a168814600014611a0857506119658685819b6148fc565b8189106119d5576020898b7f01000000000000000000000000000000000000000000000000000000000000008b8b8b8b8b8651928352878984015216907faee47cdf925cf525fdae94f9777ee5a06cac37e1c41220d0a8a89ed154f62d1c863392a4600254161760025551908152f35b60449350888a51937fbfee4ca0000000000000000000000000000000000000000000000000000000008552840152820152fd5b611a138a929a6149e5565b8b517fc4de93a500000000000000000000000000000000000000000000000000000000815261ffff7f00000000000000000000000000000000000000000000000000000000000000021686820152888c8201528787166044820152602081606481868c7f0000000000000000000000008731d54e9d02c286767d56ac03e8037c07e01e98165af1928315611b5d5792611b28575b50611ab5611abb92936149e5565b906134b7565b868110611af45750611aee907f000000000000000000000000000000000000000000000000000000000000000190613b74565b97611965565b836044918b898e51937f5d846863000000000000000000000000000000000000000000000000000000008552840152820152fd5b91506020823d8211611b55575b81611b4260209383613298565b8101031261061e57905190611ab5611aa7565b3d9150611b35565b8d51903d90823e3d90fd5b611b719061321d565b611b7c57888b611928565b8880fd5b8b513d8c823e3d90fd5b8980fd5b611b988633613f15565b611896565b838b517fc3d83b07000000000000000000000000000000000000000000000000000000008152fd5b5082878b51917f88a50561000000000000000000000000000000000000000000000000000000008352820152fd5b50503461028f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090611c59611c3261308d565b73ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b9051908152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7168152f35b50503461028f57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761038291611d0b61308d565b82611d146130b0565b9273ffffffffffffffffffffffffffffffffffffffff809316815260396020522091166000526020528060002054905191816fffffffffffffffffffffffffffffffff849360801c9116839060209093929360408301946fffffffffffffffffffffffffffffffff809216845216910152565b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5760209060ff6038541690519015158152f35b919050346106b357827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b3576007549073ffffffffffffffffffffffffffffffffffffffff9283831691823303611e7b575050806006549384167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809316176006551660075580f35b90602060649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602060248201527f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e65726044820152fd5b9050346106b357827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b357611f2b73ffffffffffffffffffffffffffffffffffffffff6006541633146131b8565b6038549060ff821615611f8b57507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff006020921660385551338152a180f35b60649060208451917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b9050346106b357827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b35773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd78316928251917f15770f9200000000000000000000000000000000000000000000000000000000835260209485848381845afa938415612146579086918495612115575b508551928380927f18160ddd0000000000000000000000000000000000000000000000000000000082525afa91821561210a57916120db575b50610c4390610c22611c5993613b57565b90508381813d8311612103575b6120f28183613298565b8101031261061e5751611c596120ca565b503d6120e8565b8451903d90823e3d90fd5b8281939296503d831161213f575b61212d8183613298565b8101031261061e578590519338612091565b503d612123565b85513d85823e3d90fd5b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090611c59614583565b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905160ff7f0000000000000000000000000000000000000000000000000000000000000006168152f35b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020905173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd783168152f35b8391503461028f5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5761229061308d565b6122986130b0565b906044359285600254956122b260028860f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8098161760025573ffffffffffffffffffffffffffffffffffffffff84168152600160205220336000526020528560002054907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361237e575b6020877f01000000000000000000000000000000000000000000000000000000000000008861128d898989613c8d565b8482106123cb575092602095949261128d926123be837f010000000000000000000000000000000000000000000000000000000000000097033383614127565b925092949581945061234e565b60649060208851917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b5050505061029e612f4b565b91905060807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b35761246961308d565b6124716130b0565b60448035606496873596600295865499612490888c60f81c1415613153565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809c161788556124e087613c1c565b156129a757841561297f5773ffffffffffffffffffffffffffffffffffffffff96871696876128f057853403612896575b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec78116880361288f57807f0000000000000000000000008731d54e9d02c286767d56ac03e8037c07e01e9816803b1561286457858091848d51809481937f87b21efc00000000000000000000000000000000000000000000000000000000835261ffff7f0000000000000000000000000000000000000000000000000000000000000002168b8401528c60248401528d30908401525af1801561288557612872575b506125fd7f00000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd7836149e5565b9a5b817f000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b16803b15610ab9578680918a8f8f5194859384927fe2bbb1580000000000000000000000000000000000000000000000000000000084527f00000000000000000000000000000000000000000000000000000000000000018d85015260248401525af1801561286857908791612850575b5050808c1061281c575082169586156127c25750506126b0906133ec565b88881161061e578554908989168a831601908a821161279657509380927f01000000000000000000000000000000000000000000000000000000000000009694927fff000000000000000000000000000000000000000000000000000000000000008c60209d98169116178855818152808b528881206127318b82546134c4565b90557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8b8a518c8152a3865190815287898201527f5fe47ed6d4225326d3303476197d782ded5a4e9c14f479dc9ec4992af4e85d59873392a482541617905551908152f35b8360116024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300849160208c51937f08c379a0000000000000000000000000000000000000000000000000000000008552840152601f6024840152820152fd5b8488918d8d51927fbc71f2ba0000000000000000000000000000000000000000000000000000000084528301526024820152fd5b6128599061321d565b612864578538612692565b8580fd5b8c513d89823e3d90fd5b61287e9095919561321d565b93386125d3565b8b513d88823e3d90fd5b859a6125ff565b5088517f08c379a0000000000000000000000000000000000000000000000000000000008152602081850152600c60248201527f657468206d69736d61746368000000000000000000000000000000000000000081880152fd5b89517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523088820152868382015282815260a0810181811067ffffffffffffffff821117612953578b5261294e90896146bb565b612511565b6024876041887f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8289517fa907f2f0000000000000000000000000000000000000000000000000000000008152fd5b88517faeabe71800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff881681850152602490fd5b50503461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f576020907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600254169051908152f35b8284346110c057602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57612a8561308d565b91612a8e613b87565b92612a9984516132f1565b9473ffffffffffffffffffffffffffffffffffffffff91821691835b8651811015612af4578082612acc6001938a6133d8565b511686526039845286862085875284528686205460801c612aed828b6133d8565b5201612ab5565b8551838152806103828186018b6130d3565b50503461028f57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f57602090612b4e612b4461308d565b6024359033614127565b5160018152f35b919050346106b35760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b357612b8f61308d565b91602435918215158303612cdf576044359283151584036128645773ffffffffffffffffffffffffffffffffffffffff948591612bd1836006541633146131b8565b15612cad571692831590811591612ca5575b5015612c48575050806006549283167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809216176006556007541660075580f35b90602060649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601560248201527f4f776e61626c653a207a65726f206164647265737300000000000000000000006044820152fd5b905038612be3565b9350505050167fffffffffffffffffffffffff0000000000000000000000000000000000000000600754161760075580f35b8480fd5b919050346106b357827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106b357805191836003549060019082821c928281168015612e23575b6020958686108214612df75750848852908115612db75750600114612d5e575b6103828686611488828b0383613298565b929550600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b828410612da4575050508261038294611488928201019438612d4d565b8054868501880152928601928101612d87565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001687860152505050151560051b83010192506114888261038238612d4d565b8360226024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b93607f1693612d2d565b84903461028f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028f5760209073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b168152f35b60208082528251818301819052939260005b858110612eed575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006040809697860101520116010190565b818101830151848201604001528201612ead565b90815180825260208080930193019160005b828110612f21575050505090565b835173ffffffffffffffffffffffffffffffffffffffff1685529381019392810192600101612f13565b503461061e576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126110c0576040516060810181811067ffffffffffffffff82111761306057604052600281526040366020830137612fae8161339c565b73ffffffffffffffffffffffffffffffffffffffff90817f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec71690528151600110156130335761038292507f00000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd783166040820152604051918291602083526020830190612f01565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361061e57565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361061e57565b90815180825260208080930193019160005b8281106130f3575050505090565b8351855293810193928101926001016130e5565b503461061e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261061e57602061314961314461308d565b613c1c565b6040519015158152f35b1561315a57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b156131bf57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff811161323157604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6080810190811067ffffffffffffffff82111761323157604052565b6040810190811067ffffffffffffffff82111761323157604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761323157604052565b67ffffffffffffffff81116132315760051b60200190565b906132fb826132d9565b6133086040519182613298565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061333682946132d9565b0190602036910137565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461336d5760010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8051156133a95760200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b80518210156133a95760209160051b010190565b6133f46134d1565b9080511561343d5773ffffffffffffffffffffffffffffffffffffffff83168015159081613432575b5061342757505050565b61343092613882565b565b90503014153861341d565b505050565b61344a6134d1565b918151156134b15773ffffffffffffffffffffffffffffffffffffffff90838383831680151590816134a6575b50613495575b50505083168015159081613432575061342757505050565b61349e92613882565b38838361347d565b905030141538613477565b50505050565b9190820391821161336d57565b9190820180921161336d57565b6134d9613b87565b906134e482516132f1565b82516000901561387e57603a544303613560575b805b845181101561355b578073ffffffffffffffffffffffffffffffffffffffff61352661355693886133d8565b51168352603b6020526fffffffffffffffffffffffffffffffff60408420541661355082866133d8565b52613340565b6134fa565b505090565b90919243603a557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002541673ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b1694853b1561387a576040517f441a3e7000000000000000000000000000000000000000000000000000000000815284816044818360049b7f00000000000000000000000000000000000000000000000000000000000000018d8401528160248401525af1801561386f57613827575b50835b835181101561381b5773ffffffffffffffffffffffffffffffffffffffff61365c82866133d8565b511661368773ffffffffffffffffffffffffffffffffffffffff61368084886133d8565b51166149e5565b90808752603b6136a460209382855260408a205460801c906134b7565b928289528181526fffffffffffffffffffffffffffffffff60408a205416928315613812575b876137f4575b6fffffffffffffffffffffffffffffffff841161061e578952526fffffffffffffffffffffffffffffffff6040882091167fffffffffffffffffffffffffffffffff000000000000000000000000000000008254161790556fffffffffffffffffffffffffffffffff811161061e576fffffffffffffffffffffffffffffffff604087209116815460801c01906fffffffffffffffffffffffffffffffff82116137c8576137c392916137be91906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b613340565b613634565b60248760118b7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b9261380c9061380689610c2288613b57565b906134c4565b926136d0565b600193506136ca565b509392919450506134f8565b67ffffffffffffffff8195929511613843576040529238613631565b6024826041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6040513d87823e3d90fd5b8380fd5b5090565b9092919273ffffffffffffffffffffffffffffffffffffffff8083169283151580613ad8575b15613aa9576138d89073ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b9160005b8151811015613aa057826138f082846133d8565b5116906138fd81896133d8565b51826000526039906020908282526040806000208a60005283526fffffffffffffffffffffffffffffffff91828260002054168015613a4f57818114613a3f57670de0b6b3a764000061395c61395661397b93856134b7565b8d613b74565b0488600052868652836000208d6000528652836000205460801c6134c4565b9183821161061e5783831161061e578051948186019686881067ffffffffffffffff89111761323157613a3a998680956137be9a86521688528483890196168652600052815281600020908d600052526000209351167fffffffffffffffffffffffffffffffff0000000000000000000000000000000084541617835551166fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b6138dc565b505050505050613a3a9150613340565b50938285949293941161061e57613a3a96600052815281600020908a6000525260002091167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055613340565b50505050509050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b50308414156138a8565b613aea613b87565b90613af582516132f1565b91600090815b815181101561343d578073ffffffffffffffffffffffffffffffffffffffff613b26600193856133d8565b51168452603b6020526fffffffffffffffffffffffffffffffff604085205416613b5082886133d8565b5201613afb565b90670de0b6b3a76400009182810292818404149015171561336d57565b8181029291811591840414171561336d57565b60405190613b948261327c565b6001825260203681840137613ba88261339c565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6169052565b8115613bed570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff809116817f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7168114918215613c6557505090565b7f00000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd7831614919050565b909173ffffffffffffffffffffffffffffffffffffffff91828116928315613e91578416938415613e0d57848414613daf57613cc891613442565b600082815280602052604081205491808310613d2b57604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220613d208282546134c4565b9055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f45524332303a207472616e7366657220746f2073656c660000000000000000006044820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff81169081156140a357613f3c906133ec565b60009181835282602052604083205481811061401f578190838552846020520360408420557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80821161387a576002549080831681831603818111613ff257917fff000000000000000000000000000000000000000000000000000000000000007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef949260209416911617600255604051908152a3565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561421957169182156141955760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b600581101561449257806142ad5750565b600181036143135760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b600281036143795760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b600381036144055760846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b60041461440e57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116145775760ff16601b8114158061456c575b614560579160809493916020936040519384528484015260408301526060820152600093849182805260015afa1561455357815173ffffffffffffffffffffffffffffffffffffffff81161561454d579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600490565b50601c8114156144f9565b50505050600090600390565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003025680925349c9c01c0f01cf300ec963832ec6416301480614692575b156145eb577fb6be51710dcdc1d5c0fe997d03f0c228cce6acc039dd22a571cc1e3cf420760d90565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f3588b180ec99489bf95123901f20ea35b717edf99ba5f41affe7318c40b0e60a60408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176132315760405251902090565b507f000000000000000000000000000000000000000000000000000000000000000146146145c2565b73ffffffffffffffffffffffffffffffffffffffff16906040516146de8161327c565b6020928382527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656484830152803b156147ea57906147339160008481959282888195519301915af161472d614848565b906148a6565b8051806147405750505050565b8184918101031261028f57820151908115918215036110c05750614766578080806134b1565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b606484604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b3d156148a1573d9067ffffffffffffffff8211613231576040519161489560207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184613298565b82523d6000602084013e565b606090565b909190156148b2575090565b8151156148c25750805190602001fd5b6148f8906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301612e9b565b0390fd5b821561343d5773ffffffffffffffffffffffffffffffffffffffff9081169081614999575050600080809381935af1614933614848565b501561493b57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b9261343093604051937fa9059cbb0000000000000000000000000000000000000000000000000000000060208601521660248401526044830152604482526149e082613260565b6146bb565b60009073ffffffffffffffffffffffffffffffffffffffff1680614a095750504790565b6020602491604051928380927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa918215614a82578092614a5257505090565b9091506020823d8211614a7a575b81614a6d60209383613298565b810103126110c057505190565b3d9150614a60565b604051903d90823e3d90fdfea26469706673582212203907607c7ad661cbe5daca1e03c88e54b1e14c60e496d69b9f0c2475ab93520e64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd783000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000105359205374617267617465205553445400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001053592d5374617267617465205553445400000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): SY Stargate USDT
Arg [1] : _symbol (string): SY-Stargate USDT
Arg [2] : _stargateLP (address): 0x38EA452219524Bb87e18dE1C24D3bB59510BD783
Arg [3] : _stargateStaking (address): 0xB0D502E938ed5f4df2E681fE6E419ff29631d62b
Arg [4] : _sid (uint256): 1
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 00000000000000000000000038ea452219524bb87e18de1c24d3bb59510bd783
Arg [3] : 000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000010
Arg [6] : 5359205374617267617465205553445400000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000010
Arg [8] : 53592d5374617267617465205553445400000000000000000000000000000000
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.