Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
9338926 | 2 days ago | Contract Creation | 0 S |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
ActionCallbackV3
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "../interfaces/IPActionCallbackV3.sol"; import "../core/libraries/Errors.sol"; import "./base/CallbackHelper.sol"; import "../core/libraries/TokenHelper.sol"; contract ActionCallbackV3 is IPLimitOrderType, IPActionCallbackV3, CallbackHelper, TokenHelper { using PMath for int256; using PMath for uint256; using PYIndexLib for PYIndex; using PYIndexLib for IPYieldToken; function swapCallback(int256 ptToAccount, int256 syToAccount, bytes calldata data) external override { ActionType swapType = _getActionType(data); if (swapType == ActionType.SwapExactSyForYt) { _callbackSwapExactSyForYt(ptToAccount, syToAccount, data); } else if (swapType == ActionType.SwapYtForSy) { _callbackSwapYtForSy(ptToAccount, syToAccount, data); } else if (swapType == ActionType.SwapExactYtForPt) { _callbackSwapExactYtForPt(ptToAccount, syToAccount, data); } else if (swapType == ActionType.SwapExactPtForYt) { _callbackSwapExactPtForYt(ptToAccount, syToAccount, data); } else { assert(false); } } function limitRouterCallback( uint256 actualMaking, uint256 actualTaking, uint256 totalFee, bytes memory data ) external returns ( bytes memory // encode as netTransferToLimit, netOutputFromLimit ) { bool isEmptyFill = (actualMaking == 0 && actualTaking == 0 && totalFee == 0); if (isEmptyFill) { return abi.encode(0, 0); } (OrderType orderType, IPYieldToken YT, uint256 netRemaining, address receiver) = abi.decode( data, (OrderType, IPYieldToken, uint256, address) ); if (orderType == OrderType.SY_FOR_PT || orderType == OrderType.SY_FOR_YT) { PYIndex index = YT.newIndex(); uint256 totalSyToMintPy = index.assetToSyUp(actualTaking); uint256 additionalSyToMint = totalSyToMintPy - actualMaking; require(additionalSyToMint <= netRemaining, "Slippage: INSUFFICIENT_SY_LIMIT"); _transferOut(YT.SY(), address(YT), additionalSyToMint); uint256 netPyToReceiver; if (orderType == OrderType.SY_FOR_PT) { netPyToReceiver = YT.mintPY(address(this), receiver); _safeApproveInf(YT.PT(), msg.sender); } else { netPyToReceiver = YT.mintPY(receiver, address(this)); _safeApproveInf(address(YT), msg.sender); } return abi.encode(additionalSyToMint, netPyToReceiver); } else { require(actualMaking <= netRemaining, "Slippage: INSUFFICIENT_PY_LIMIT"); if (orderType == OrderType.PT_FOR_SY) { _transferOut(address(YT), address(YT), actualMaking); } else { _transferOut(YT.PT(), address(YT), actualMaking); } uint256 netSyRedeemed = IPYieldToken(YT).redeemPY(address(this)); require(actualTaking <= netSyRedeemed, "Slippage: INSUFFICIENT_PY_REDEEM"); uint256 netSyToReceiver = netSyRedeemed - actualTaking; address SY = YT.SY(); _transferOut(SY, receiver, netSyToReceiver); _safeApproveInf(SY, msg.sender); return abi.encode(actualMaking, netSyToReceiver); } } function _callbackSwapExactSyForYt(int256 ptToAccount, int256, /*syToAccount*/ bytes calldata data) internal { (address receiver, IPYieldToken YT) = _decodeSwapExactSyForYt(data); uint256 ptOwed = ptToAccount.abs(); uint256 netPyOut = YT.mintPY(msg.sender, receiver); if (netPyOut < ptOwed) revert("Slippage: INSUFFICIENT_PT_REPAY"); } function _callbackSwapYtForSy(int256 ptToAccount, int256 syToAccount, bytes calldata data) internal { (address receiver, IPYieldToken YT) = _decodeSwapYtForSy(data); PYIndex pyIndex = YT.newIndex(); uint256 syOwed = syToAccount.neg().Uint(); address[] memory receivers = new address[](2); uint256[] memory amountPYToRedeems = new uint256[](2); (receivers[0], amountPYToRedeems[0]) = (msg.sender, pyIndex.syToAssetUp(syOwed)); (receivers[1], amountPYToRedeems[1]) = (receiver, ptToAccount.Uint() - amountPYToRedeems[0]); YT.redeemPYMulti(receivers, amountPYToRedeems); } function _callbackSwapExactPtForYt(int256 ptToAccount, int256, /*syToAccount*/ bytes calldata data) internal { (address receiver, uint256 exactPtIn, uint256 minYtOut, IPYieldToken YT) = _decodeSwapExactPtForYt(data); uint256 netPtOwed = ptToAccount.abs(); uint256 netPyOut = YT.mintPY(msg.sender, receiver); if (netPyOut < minYtOut) revert("Slippage: INSUFFICIENT_YT_OUT"); if (exactPtIn + netPyOut < netPtOwed) revert("Slippage: INSUFFICIENT_PT_REPAY"); } function _callbackSwapExactYtForPt(int256 ptToAccount, int256 syToAccount, bytes calldata data) internal { (address receiver, uint256 netPtOut, IPPrincipalToken PT, IPYieldToken YT) = _decodeSwapExactYtForPt(data); uint256 netSyOwed = syToAccount.abs(); uint256 netPtRedeemSy = ptToAccount.Uint() - netPtOut; _transferOut(address(PT), address(YT), netPtRedeemSy); uint256 netSyToMarket = YT.redeemPY(msg.sender); if (netSyToMarket < netSyOwed) revert("Slippage: INSUFFICIENT_SY_REPAY"); _transferOut(address(PT), receiver, netPtOut); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; library Errors { // BulkSeller error BulkInsufficientSyForTrade(uint256 currentAmount, uint256 requiredAmount); error BulkInsufficientTokenForTrade(uint256 currentAmount, uint256 requiredAmount); error BulkInSufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut); error BulkInSufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut); error BulkInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance); error BulkNotMaintainer(); error BulkNotAdmin(); error BulkSellerAlreadyExisted(address token, address SY, address bulk); error BulkSellerInvalidToken(address token, address SY); error BulkBadRateTokenToSy(uint256 actualRate, uint256 currentRate, uint256 eps); error BulkBadRateSyToToken(uint256 actualRate, uint256 currentRate, uint256 eps); // APPROX error ApproxFail(); error ApproxParamsInvalid(uint256 guessMin, uint256 guessMax, uint256 eps); error ApproxBinarySearchInputInvalid( uint256 approxGuessMin, uint256 approxGuessMax, uint256 minGuessMin, uint256 maxGuessMax ); // MARKET + MARKET MATH CORE error MarketExpired(); error MarketZeroAmountsInput(); error MarketZeroAmountsOutput(); error MarketZeroLnImpliedRate(); error MarketInsufficientPtForTrade(int256 currentAmount, int256 requiredAmount); error MarketInsufficientPtReceived(uint256 actualBalance, uint256 requiredBalance); error MarketInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance); error MarketZeroTotalPtOrTotalAsset(int256 totalPt, int256 totalAsset); error MarketExchangeRateBelowOne(int256 exchangeRate); error MarketProportionMustNotEqualOne(); error MarketRateScalarBelowZero(int256 rateScalar); error MarketScalarRootBelowZero(int256 scalarRoot); error MarketProportionTooHigh(int256 proportion, int256 maxProportion); error OracleUninitialized(); error OracleTargetTooOld(uint32 target, uint32 oldest); error OracleZeroCardinality(); error MarketFactoryExpiredPt(); error MarketFactoryInvalidPt(); error MarketFactoryMarketExists(); error MarketFactoryLnFeeRateRootTooHigh(uint80 lnFeeRateRoot, uint256 maxLnFeeRateRoot); error MarketFactoryOverriddenFeeTooHigh(uint80 overriddenFee, uint256 marketLnFeeRateRoot); error MarketFactoryReserveFeePercentTooHigh(uint8 reserveFeePercent, uint8 maxReserveFeePercent); error MarketFactoryZeroTreasury(); error MarketFactoryInitialAnchorTooLow(int256 initialAnchor, int256 minInitialAnchor); error MFNotPendleMarket(address addr); // ROUTER error RouterInsufficientLpOut(uint256 actualLpOut, uint256 requiredLpOut); error RouterInsufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut); error RouterInsufficientPtOut(uint256 actualPtOut, uint256 requiredPtOut); error RouterInsufficientYtOut(uint256 actualYtOut, uint256 requiredYtOut); error RouterInsufficientPYOut(uint256 actualPYOut, uint256 requiredPYOut); error RouterInsufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut); error RouterInsufficientSyRepay(uint256 actualSyRepay, uint256 requiredSyRepay); error RouterInsufficientPtRepay(uint256 actualPtRepay, uint256 requiredPtRepay); error RouterNotAllSyUsed(uint256 netSyDesired, uint256 netSyUsed); error RouterTimeRangeZero(); error RouterCallbackNotPendleMarket(address caller); error RouterInvalidAction(bytes4 selector); error RouterInvalidFacet(address facet); error RouterKyberSwapDataZero(); error SimulationResults(bool success, bytes res); // YIELD CONTRACT error YCExpired(); error YCNotExpired(); error YieldContractInsufficientSy(uint256 actualSy, uint256 requiredSy); error YCNothingToRedeem(); error YCPostExpiryDataNotSet(); error YCNoFloatingSy(); // YieldFactory error YCFactoryInvalidExpiry(); error YCFactoryYieldContractExisted(); error YCFactoryZeroExpiryDivisor(); error YCFactoryZeroTreasury(); error YCFactoryInterestFeeRateTooHigh(uint256 interestFeeRate, uint256 maxInterestFeeRate); error YCFactoryRewardFeeRateTooHigh(uint256 newRewardFeeRate, uint256 maxRewardFeeRate); // SY error SYInvalidTokenIn(address token); error SYInvalidTokenOut(address token); error SYZeroDeposit(); error SYZeroRedeem(); error SYInsufficientSharesOut(uint256 actualSharesOut, uint256 requiredSharesOut); error SYInsufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut); // SY-specific error SYQiTokenMintFailed(uint256 errCode); error SYQiTokenRedeemFailed(uint256 errCode); error SYQiTokenRedeemRewardsFailed(uint256 rewardAccruedType0, uint256 rewardAccruedType1); error SYQiTokenBorrowRateTooHigh(uint256 borrowRate, uint256 borrowRateMax); error SYCurveInvalidPid(); error SYCurve3crvPoolNotFound(); error SYApeDepositAmountTooSmall(uint256 amountDeposited); error SYBalancerInvalidPid(); error SYInvalidRewardToken(address token); error SYStargateRedeemCapExceeded(uint256 amountLpDesired, uint256 amountLpRedeemable); error SYBalancerReentrancy(); error NotFromTrustedRemote(uint16 srcChainId, bytes path); error ApxETHNotEnoughBuffer(); // Liquidity Mining error VCInactivePool(address pool); error VCPoolAlreadyActive(address pool); error VCZeroVePendle(address user); error VCExceededMaxWeight(uint256 totalWeight, uint256 maxWeight); error VCEpochNotFinalized(uint256 wTime); error VCPoolAlreadyAddAndRemoved(address pool); error VEInvalidNewExpiry(uint256 newExpiry); error VEExceededMaxLockTime(); error VEInsufficientLockTime(); error VENotAllowedReduceExpiry(); error VEZeroAmountLocked(); error VEPositionNotExpired(); error VEZeroPosition(); error VEZeroSlope(uint128 bias, uint128 slope); error VEReceiveOldSupply(uint256 msgTime); error GCNotPendleMarket(address caller); error GCNotVotingController(address caller); error InvalidWTime(uint256 wTime); error ExpiryInThePast(uint256 expiry); error ChainNotSupported(uint256 chainId); error FDTotalAmountFundedNotMatch(uint256 actualTotalAmount, uint256 expectedTotalAmount); error FDEpochLengthMismatch(); error FDInvalidPool(address pool); error FDPoolAlreadyExists(address pool); error FDInvalidNewFinishedEpoch(uint256 oldFinishedEpoch, uint256 newFinishedEpoch); error FDInvalidStartEpoch(uint256 startEpoch); error FDInvalidWTimeFund(uint256 lastFunded, uint256 wTime); error FDFutureFunding(uint256 lastFunded, uint256 currentWTime); error BDInvalidEpoch(uint256 epoch, uint256 startTime); // Cross-Chain error MsgNotFromSendEndpoint(uint16 srcChainId, bytes path); error MsgNotFromReceiveEndpoint(address sender); error InsufficientFeeToSendMsg(uint256 currentFee, uint256 requiredFee); error ApproxDstExecutionGasNotSet(); error InvalidRetryData(); // GENERIC MSG error ArrayLengthMismatch(); error ArrayEmpty(); error ArrayOutOfBounds(); error ZeroAddress(); error FailedToSendEther(); error InvalidMerkleProof(); error OnlyLayerZeroEndpoint(); error OnlyYT(); error OnlyYCFactory(); error OnlyWhitelisted(); // Swap Aggregator error SAInsufficientTokenIn(address tokenIn, uint256 amountExpected, uint256 amountActual); error UnsupportedSelector(uint256 aggregatorType, bytes4 selector); }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.8.0; /* solhint-disable private-vars-leading-underscore, reason-string */ library PMath { uint256 internal constant ONE = 1e18; // 18 decimal places int256 internal constant IONE = 1e18; // 18 decimal places function subMax0(uint256 a, uint256 b) internal pure returns (uint256) { unchecked { return (a >= b ? a - b : 0); } } function subNoNeg(int256 a, int256 b) internal pure returns (int256) { require(a >= b, "negative"); return a - b; // no unchecked since if b is very negative, a - b might overflow } function mulDown(uint256 a, uint256 b) internal pure returns (uint256) { uint256 product = a * b; unchecked { return product / ONE; } } function mulDown(int256 a, int256 b) internal pure returns (int256) { int256 product = a * b; unchecked { return product / IONE; } } function divDown(uint256 a, uint256 b) internal pure returns (uint256) { uint256 aInflated = a * ONE; unchecked { return aInflated / b; } } function divDown(int256 a, int256 b) internal pure returns (int256) { int256 aInflated = a * IONE; unchecked { return aInflated / b; } } function rawDivUp(uint256 a, uint256 b) internal pure returns (uint256) { return (a + b - 1) / b; } function rawDivUp(int256 a, int256 b) internal pure returns (int256) { return (a + b - 1) / b; } function tweakUp(uint256 a, uint256 factor) internal pure returns (uint256) { return mulDown(a, ONE + factor); } function tweakDown(uint256 a, uint256 factor) internal pure returns (uint256) { return mulDown(a, ONE - factor); } /// @return res = min(a + b, bound) /// @dev This function should handle arithmetic operation and bound check without overflow/underflow function addWithUpperBound(uint256 a, uint256 b, uint256 bound) internal pure returns (uint256 res) { unchecked { if (type(uint256).max - b < a) res = bound; else res = min(bound, a + b); } } /// @return res = max(a - b, bound) /// @dev This function should handle arithmetic operation and bound check without overflow/underflow function subWithLowerBound(uint256 a, uint256 b, uint256 bound) internal pure returns (uint256 res) { unchecked { if (b > a) res = bound; else res = max(a - b, bound); } } function clamp(uint256 x, uint256 lower, uint256 upper) internal pure returns (uint256 res) { res = x; if (x < lower) res = lower; else if (x > upper) res = upper; } // @author Uniswap function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } function square(uint256 x) internal pure returns (uint256) { return x * x; } function squareDown(uint256 x) internal pure returns (uint256) { return mulDown(x, x); } function abs(int256 x) internal pure returns (uint256) { return uint256(x > 0 ? x : -x); } function neg(int256 x) internal pure returns (int256) { return x * (-1); } function neg(uint256 x) internal pure returns (int256) { return Int(x) * (-1); } function max(uint256 x, uint256 y) internal pure returns (uint256) { return (x > y ? x : y); } function max(int256 x, int256 y) internal pure returns (int256) { return (x > y ? x : y); } function min(uint256 x, uint256 y) internal pure returns (uint256) { return (x < y ? x : y); } function min(int256 x, int256 y) internal pure returns (int256) { return (x < y ? x : y); } /*/////////////////////////////////////////////////////////////// SIGNED CASTS //////////////////////////////////////////////////////////////*/ function Int(uint256 x) internal pure returns (int256) { require(x <= uint256(type(int256).max)); return int256(x); } function Int128(int256 x) internal pure returns (int128) { require(type(int128).min <= x && x <= type(int128).max); return int128(x); } function Int128(uint256 x) internal pure returns (int128) { return Int128(Int(x)); } /*/////////////////////////////////////////////////////////////// UNSIGNED CASTS //////////////////////////////////////////////////////////////*/ function Uint(int256 x) internal pure returns (uint256) { require(x >= 0); return uint256(x); } function Uint32(uint256 x) internal pure returns (uint32) { require(x <= type(uint32).max); return uint32(x); } function Uint64(uint256 x) internal pure returns (uint64) { require(x <= type(uint64).max); return uint64(x); } function Uint112(uint256 x) internal pure returns (uint112) { require(x <= type(uint112).max); return uint112(x); } function Uint96(uint256 x) internal pure returns (uint96) { require(x <= type(uint96).max); return uint96(x); } function Uint128(uint256 x) internal pure returns (uint128) { require(x <= type(uint128).max); return uint128(x); } function Uint192(uint256 x) internal pure returns (uint192) { require(x <= type(uint192).max); return uint192(x); } function Uint80(uint256 x) internal pure returns (uint80) { require(x <= type(uint80).max); return uint80(x); } function isAApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) { return mulDown(b, ONE - eps) <= a && a <= mulDown(b, ONE + eps); } function isAGreaterApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) { return a >= b && a <= mulDown(b, ONE + eps); } function isASmallerApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) { return a <= b && a >= mulDown(b, ONE - eps); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../../interfaces/IWETH.sol"; abstract contract TokenHelper { using SafeERC20 for IERC20; address internal constant NATIVE = address(0); uint256 internal constant LOWER_BOUND_APPROVAL = type(uint96).max / 2; // some tokens use 96 bits for approval function _transferIn(address token, address from, uint256 amount) internal { if (token == NATIVE) require(msg.value == amount, "eth mismatch"); else if (amount != 0) IERC20(token).safeTransferFrom(from, address(this), amount); } function _transferFrom(IERC20 token, address from, address to, uint256 amount) internal { if (amount != 0) token.safeTransferFrom(from, to, amount); } function _transferOut(address token, address to, uint256 amount) internal { if (amount == 0) return; if (token == NATIVE) { (bool success, ) = to.call{value: amount}(""); require(success, "eth send failed"); } else { IERC20(token).safeTransfer(to, amount); } } function _transferOut(address[] memory tokens, address to, uint256[] memory amounts) internal { uint256 numTokens = tokens.length; require(numTokens == amounts.length, "length mismatch"); for (uint256 i = 0; i < numTokens; ) { _transferOut(tokens[i], to, amounts[i]); unchecked { i++; } } } function _selfBalance(address token) internal view returns (uint256) { return (token == NATIVE) ? address(this).balance : IERC20(token).balanceOf(address(this)); } function _selfBalance(IERC20 token) internal view returns (uint256) { return token.balanceOf(address(this)); } /// @notice Approves the stipulated contract to spend the given allowance in the given token /// @dev PLS PAY ATTENTION to tokens that requires the approval to be set to 0 before changing it function _safeApprove(address token, address to, uint256 value) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "Safe Approve"); } function _safeApproveInf(address token, address to) internal { if (token == NATIVE) return; if (IERC20(token).allowance(address(this), to) < LOWER_BOUND_APPROVAL) { _safeApprove(token, to, 0); _safeApprove(token, to, type(uint256).max); } } function _wrap_unwrap_ETH(address tokenIn, address tokenOut, uint256 netTokenIn) internal { if (tokenIn == NATIVE) IWETH(tokenOut).deposit{value: netTokenIn}(); else IWETH(tokenIn).withdraw(netTokenIn); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "../../interfaces/IPYieldToken.sol"; import "../../interfaces/IPPrincipalToken.sol"; import "./SYUtils.sol"; import "../libraries/math/PMath.sol"; type PYIndex is uint256; library PYIndexLib { using PMath for uint256; using PMath for int256; function newIndex(IPYieldToken YT) internal returns (PYIndex) { return PYIndex.wrap(YT.pyIndexCurrent()); } function syToAsset(PYIndex index, uint256 syAmount) internal pure returns (uint256) { return SYUtils.syToAsset(PYIndex.unwrap(index), syAmount); } function assetToSy(PYIndex index, uint256 assetAmount) internal pure returns (uint256) { return SYUtils.assetToSy(PYIndex.unwrap(index), assetAmount); } function assetToSyUp(PYIndex index, uint256 assetAmount) internal pure returns (uint256) { return SYUtils.assetToSyUp(PYIndex.unwrap(index), assetAmount); } function syToAssetUp(PYIndex index, uint256 syAmount) internal pure returns (uint256) { uint256 _index = PYIndex.unwrap(index); return SYUtils.syToAssetUp(_index, syAmount); } function syToAsset(PYIndex index, int256 syAmount) internal pure returns (int256) { int256 sign = syAmount < 0 ? int256(-1) : int256(1); return sign * (SYUtils.syToAsset(PYIndex.unwrap(index), syAmount.abs())).Int(); } function assetToSy(PYIndex index, int256 assetAmount) internal pure returns (int256) { int256 sign = assetAmount < 0 ? int256(-1) : int256(1); return sign * (SYUtils.assetToSy(PYIndex.unwrap(index), assetAmount.abs())).Int(); } function assetToSyUp(PYIndex index, int256 assetAmount) internal pure returns (int256) { int256 sign = assetAmount < 0 ? int256(-1) : int256(1); return sign * (SYUtils.assetToSyUp(PYIndex.unwrap(index), assetAmount.abs())).Int(); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; library SYUtils { uint256 internal constant ONE = 1e18; function syToAsset(uint256 exchangeRate, uint256 syAmount) internal pure returns (uint256) { return (syAmount * exchangeRate) / ONE; } function syToAssetUp(uint256 exchangeRate, uint256 syAmount) internal pure returns (uint256) { return (syAmount * exchangeRate + ONE - 1) / ONE; } function assetToSy(uint256 exchangeRate, uint256 assetAmount) internal pure returns (uint256) { return (assetAmount * ONE) / exchangeRate; } function assetToSyUp(uint256 exchangeRate, uint256 assetAmount) internal pure returns (uint256) { return (assetAmount * ONE + exchangeRate - 1) / exchangeRate; } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "./IPMarketSwapCallback.sol"; import "./IPLimitRouter.sol"; interface IPActionCallbackV3 is IPMarketSwapCallback, IPLimitRouterCallback {}
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; interface IPInterestManagerYT { event CollectInterestFee(uint256 amountInterestFee); function userInterest(address user) external view returns (uint128 lastPYIndex, uint128 accruedInterest); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "../core/StandardizedYield/PYIndex.sol"; interface IPLimitOrderType { enum OrderType { SY_FOR_PT, PT_FOR_SY, SY_FOR_YT, YT_FOR_SY } // Fixed-size order part with core information struct StaticOrder { uint256 salt; uint256 expiry; uint256 nonce; OrderType orderType; address token; address YT; address maker; address receiver; uint256 makingAmount; uint256 lnImpliedRate; uint256 failSafeRate; } struct FillResults { uint256 totalMaking; uint256 totalTaking; uint256 totalFee; uint256 totalNotionalVolume; uint256[] netMakings; uint256[] netTakings; uint256[] netFees; uint256[] notionalVolumes; } } struct Order { uint256 salt; uint256 expiry; uint256 nonce; IPLimitOrderType.OrderType orderType; address token; address YT; address maker; address receiver; uint256 makingAmount; uint256 lnImpliedRate; uint256 failSafeRate; bytes permit; } struct FillOrderParams { Order order; bytes signature; uint256 makingAmount; } interface IPLimitRouterCallback is IPLimitOrderType { function limitRouterCallback( uint256 actualMaking, uint256 actualTaking, uint256 totalFee, bytes memory data ) external returns (bytes memory); } interface IPLimitRouter is IPLimitOrderType { struct OrderStatus { uint128 filledAmount; uint128 remaining; } event OrderCanceled(address indexed maker, bytes32 indexed orderHash); event OrderFilledV2( bytes32 indexed orderHash, OrderType indexed orderType, address indexed YT, address token, uint256 netInputFromMaker, uint256 netOutputToMaker, uint256 feeAmount, uint256 notionalVolume, address maker, address taker ); // event added on 2/1/2025 event LnFeeRateRootsSet(address[] YTs, uint256[] lnFeeRateRoots); // @dev actualMaking, actualTaking are in the SY form function fill( FillOrderParams[] memory params, address receiver, uint256 maxTaking, bytes calldata optData, bytes calldata callback ) external returns (uint256 actualMaking, uint256 actualTaking, uint256 totalFee, bytes memory callbackReturn); function feeRecipient() external view returns (address); function hashOrder(Order memory order) external view returns (bytes32); function cancelSingle(Order calldata order) external; function cancelBatch(Order[] calldata orders) external; function orderStatusesRaw( bytes32[] memory orderHashes ) external view returns (uint256[] memory remainingsRaw, uint256[] memory filledAmounts); function orderStatuses( bytes32[] memory orderHashes ) external view returns (uint256[] memory remainings, uint256[] memory filledAmounts); function DOMAIN_SEPARATOR() external view returns (bytes32); function simulate(address target, bytes calldata data) external payable; function WNATIVE() external view returns (address); function _checkSig( Order memory order, bytes memory signature ) external view returns ( bytes32, /*orderHash*/ uint256, /*remainingMakerAmount*/ uint256 ); /*filledMakerAmount*/ /* --- Deprecated events --- */ // deprecate on 7/1/2024, prior to official launch event OrderFilled( bytes32 indexed orderHash, OrderType indexed orderType, address indexed YT, address token, uint256 netInputFromMaker, uint256 netOutputToMaker, uint256 feeAmount, uint256 notionalVolume ); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; interface IPMarketSwapCallback { function swapCallback(int256 ptToAccount, int256 syToAccount, bytes calldata data) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface IPPrincipalToken is IERC20Metadata { function burnByYT(address user, uint256 amount) external; function mintByYT(address user, uint256 amount) external; function initialize(address _YT) external; function SY() external view returns (address); function YT() external view returns (address); function factory() external view returns (address); function expiry() external view returns (uint256); function isExpired() external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "./IRewardManager.sol"; import "./IPInterestManagerYT.sol"; interface IPYieldToken is IERC20Metadata, IRewardManager, IPInterestManagerYT { event NewInterestIndex(uint256 indexed newIndex); event Mint( address indexed caller, address indexed receiverPT, address indexed receiverYT, uint256 amountSyToMint, uint256 amountPYOut ); event Burn(address indexed caller, address indexed receiver, uint256 amountPYToRedeem, uint256 amountSyOut); event RedeemRewards(address indexed user, uint256[] amountRewardsOut); event RedeemInterest(address indexed user, uint256 interestOut); event CollectRewardFee(address indexed rewardToken, uint256 amountRewardFee); function mintPY(address receiverPT, address receiverYT) external returns (uint256 amountPYOut); function redeemPY(address receiver) external returns (uint256 amountSyOut); function redeemPYMulti( address[] calldata receivers, uint256[] calldata amountPYToRedeems ) external returns (uint256[] memory amountSyOuts); function redeemDueInterestAndRewards( address user, bool redeemInterest, bool redeemRewards ) external returns (uint256 interestOut, uint256[] memory rewardsOut); function rewardIndexesCurrent() external returns (uint256[] memory); function pyIndexCurrent() external returns (uint256); function pyIndexStored() external view returns (uint256); function getRewardTokens() external view returns (address[] memory); function SY() external view returns (address); function PT() external view returns (address); function factory() external view returns (address); function expiry() external view returns (uint256); function isExpired() external view returns (bool); function doCacheIndexSameBlock() external view returns (bool); function pyIndexLastUpdatedBlock() external view returns (uint128); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; interface IRewardManager { function userReward(address token, address user) external view returns (uint128 index, uint128 accrued); }
// SPDX-License-Identifier: GPL-3.0-or-later /* * MIT License * =========== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface IStandardizedYield is IERC20Metadata { /// @dev Emitted when any base tokens is deposited to mint shares event Deposit( address indexed caller, address indexed receiver, address indexed tokenIn, uint256 amountDeposited, uint256 amountSyOut ); /// @dev Emitted when any shares are redeemed for base tokens event Redeem( address indexed caller, address indexed receiver, address indexed tokenOut, uint256 amountSyToRedeem, uint256 amountTokenOut ); /// @dev check `assetInfo()` for more information enum AssetType { TOKEN, LIQUIDITY } /// @dev Emitted when (`user`) claims their rewards event ClaimRewards(address indexed user, address[] rewardTokens, uint256[] rewardAmounts); /** * @notice mints an amount of shares by depositing a base token. * @param receiver shares recipient address * @param tokenIn address of the base tokens to mint shares * @param amountTokenToDeposit amount of base tokens to be transferred from (`msg.sender`) * @param minSharesOut reverts if amount of shares minted is lower than this * @return amountSharesOut amount of shares minted * @dev Emits a {Deposit} event * * Requirements: * - (`tokenIn`) must be a valid base token. */ function deposit( address receiver, address tokenIn, uint256 amountTokenToDeposit, uint256 minSharesOut ) external payable returns (uint256 amountSharesOut); /** * @notice redeems an amount of base tokens by burning some shares * @param receiver recipient address * @param amountSharesToRedeem amount of shares to be burned * @param tokenOut address of the base token to be redeemed * @param minTokenOut reverts if amount of base token redeemed is lower than this * @param burnFromInternalBalance if true, burns from balance of `address(this)`, otherwise burns from `msg.sender` * @return amountTokenOut amount of base tokens redeemed * @dev Emits a {Redeem} event * * Requirements: * - (`tokenOut`) must be a valid base token. */ function redeem( address receiver, uint256 amountSharesToRedeem, address tokenOut, uint256 minTokenOut, bool burnFromInternalBalance ) external returns (uint256 amountTokenOut); /** * @notice exchangeRate * syBalance / 1e18 must return the asset balance of the account * @notice vice-versa, if a user uses some amount of tokens equivalent to X asset, the amount of sy he can mint must be X * exchangeRate / 1e18 * @dev SYUtils's assetToSy & syToAsset should be used instead of raw multiplication & division */ function exchangeRate() external view returns (uint256 res); /** * @notice claims reward for (`user`) * @param user the user receiving their rewards * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens` * @dev * Emits a `ClaimRewards` event * See {getRewardTokens} for list of reward tokens */ function claimRewards(address user) external returns (uint256[] memory rewardAmounts); /** * @notice get the amount of unclaimed rewards for (`user`) * @param user the user to check for * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens` */ function accruedRewards(address user) external view returns (uint256[] memory rewardAmounts); function rewardIndexesCurrent() external returns (uint256[] memory indexes); function rewardIndexesStored() external view returns (uint256[] memory indexes); /** * @notice returns the list of reward token addresses */ function getRewardTokens() external view returns (address[] memory); /** * @notice returns the address of the underlying yield token */ function yieldToken() external view returns (address); /** * @notice returns all tokens that can mint this SY */ function getTokensIn() external view returns (address[] memory res); /** * @notice returns all tokens that can be redeemed by this SY */ function getTokensOut() external view returns (address[] memory res); function isValidTokenIn(address token) external view returns (bool); function isValidTokenOut(address token) external view returns (bool); function previewDeposit( address tokenIn, uint256 amountTokenToDeposit ) external view returns (uint256 amountSharesOut); function previewRedeem( address tokenOut, uint256 amountSharesToRedeem ) external view returns (uint256 amountTokenOut); /** * @notice This function contains information to interpret what the asset is * @return assetType the type of the asset (0 for ERC20 tokens, 1 for AMM liquidity tokens, 2 for bridged yield bearing tokens like wstETH, rETH on Arbi whose the underlying asset doesn't exist on the chain) * @return assetAddress the address of the asset * @return assetDecimals the decimals of the asset */ function assetInfo() external view returns (AssetType assetType, address assetAddress, uint8 assetDecimals); }
// SPDX-License-Identifier: GPL-3.0-or-later /* * MIT License * =========== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IWETH is IERC20 { event Deposit(address indexed dst, uint256 wad); event Withdrawal(address indexed src, uint256 wad); function deposit() external payable; function withdraw(uint256 wad) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "../../interfaces/IPYieldToken.sol"; import "../../interfaces/IPPrincipalToken.sol"; import "../../interfaces/IStandardizedYield.sol"; abstract contract CallbackHelper { enum ActionType { SwapExactSyForYt, SwapYtForSy, SwapExactYtForPt, SwapExactPtForYt } /// ------------------------------------------------------------ /// SwapExactSyForYt /// ------------------------------------------------------------ function _encodeSwapExactSyForYt(address receiver, IPYieldToken YT) internal pure returns (bytes memory res) { res = new bytes(96); uint256 actionType = uint256(ActionType.SwapExactSyForYt); assembly { mstore(add(res, 32), actionType) mstore(add(res, 64), receiver) mstore(add(res, 96), YT) } } function _decodeSwapExactSyForYt(bytes calldata data) internal pure returns (address receiver, IPYieldToken YT) { assembly { // first 32 bytes is ActionType receiver := calldataload(add(data.offset, 32)) YT := calldataload(add(data.offset, 64)) } } /// ------------------------------------------------------------ /// SwapYtForSy (common encode & decode) /// ------------------------------------------------------------ function _encodeSwapYtForSy(address receiver, IPYieldToken YT) internal pure returns (bytes memory res) { res = new bytes(96); uint256 actionType = uint256(ActionType.SwapYtForSy); assembly { mstore(add(res, 32), actionType) mstore(add(res, 64), receiver) mstore(add(res, 96), YT) } } function _decodeSwapYtForSy(bytes calldata data) internal pure returns (address receiver, IPYieldToken YT) { assembly { // first 32 bytes is ActionType receiver := calldataload(add(data.offset, 32)) YT := calldataload(add(data.offset, 64)) } } function _encodeSwapExactYtForPt( address receiver, uint256 netPtOut, IPPrincipalToken PT, IPYieldToken YT ) internal pure returns (bytes memory res) { res = new bytes(160); uint256 actionType = uint256(ActionType.SwapExactYtForPt); assembly { mstore(add(res, 32), actionType) mstore(add(res, 64), receiver) mstore(add(res, 96), netPtOut) mstore(add(res, 128), PT) mstore(add(res, 160), YT) } } function _decodeSwapExactYtForPt( bytes calldata data ) internal pure returns (address receiver, uint256 netPtOut, IPPrincipalToken PT, IPYieldToken YT) { assembly { // first 32 bytes is ActionType receiver := calldataload(add(data.offset, 32)) netPtOut := calldataload(add(data.offset, 64)) PT := calldataload(add(data.offset, 96)) YT := calldataload(add(data.offset, 128)) } } function _encodeSwapExactPtForYt( address receiver, uint256 exactPtIn, uint256 minYtOut, IPYieldToken YT ) internal pure returns (bytes memory res) { res = new bytes(160); uint256 actionType = uint256(ActionType.SwapExactPtForYt); assembly { mstore(add(res, 32), actionType) mstore(add(res, 64), receiver) mstore(add(res, 96), exactPtIn) mstore(add(res, 128), minYtOut) mstore(add(res, 160), YT) } } function _decodeSwapExactPtForYt( bytes calldata data ) internal pure returns (address receiver, uint256 exactPtIn, uint256 minYtOut, IPYieldToken YT) { assembly { // first 32 bytes is ActionType receiver := calldataload(add(data.offset, 32)) exactPtIn := calldataload(add(data.offset, 64)) minYtOut := calldataload(add(data.offset, 96)) YT := calldataload(add(data.offset, 128)) } } /// ------------------------------------------------------------ /// Misc functions /// ------------------------------------------------------------ function _getActionType(bytes calldata data) internal pure returns (ActionType actionType) { assembly { actionType := calldataload(data.offset) } } }
{ "optimizer": { "enabled": true, "runs": 1000000 }, "viaIR": true, "evmVersion": "shanghai", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"actualMaking","type":"uint256"},{"internalType":"uint256","name":"actualTaking","type":"uint256"},{"internalType":"uint256","name":"totalFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"limitRouterCallback","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"ptToAccount","type":"int256"},{"internalType":"int256","name":"syToAccount","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608080604052346015576117e6908161001a8239f35b5f80fdfe60806040526004361015610011575f80fd5b5f3560e01c8063eb3a7d47146108725763fa483e721461002f575f80fd5b346101eb5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101eb5760043560443560243567ffffffffffffffff82116101eb57366023830112156101eb57816004013567ffffffffffffffff81116101eb57602483019060243691850101116101eb5780356100b1816109fe565b8061020257505050906100c3906116ad565b90602060405180927fdb74aa15000000000000000000000000000000000000000000000000000000008252815f73ffffffffffffffffffffffffffffffffffffffff60648361013f6044870135336004840190929173ffffffffffffffffffffffffffffffffffffffff60209181604085019616845216910152565b03940135165af19081156101f7575f916101c1575b501061015d575b005b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f536c6970706167653a20494e53554646494349454e545f50545f524550415900604482015280606481015b0390fd5b90506020813d6020116101ef575b816101dc60209383610926565b810103126101eb57515f610154565b5f80fd5b3d91506101cf565b6040513d5f823e3d90fd5b61020b816109fe565b60018103610524575050606482013591610224836115b5565b825f039183159383057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff148417156104f7575f83126101eb576040519561026c606088610926565b60028752604094602088019490863687376040519461028c606087610926565b6002865260208601973689378083029283041417156104f757670de0b6b3a76400008101908181116104f757670de0b6b3a763ffff019081116104f757670de0b6b3a764000090046102dd8461164b565b52336102e88861164b565b525f81126101eb5761030890610301849896959461164b565b5190610a61565b61031187611685565b5273ffffffffffffffffffffffffffffffffffffffff604461033286611685565b9201351690526040519485937fb0d88981000000000000000000000000000000000000000000000000000000008552604485019060406004870152518091526064850192905f5b8181106104c8575050506020907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc85840301602486015251918281520191905f5b8181106104af5750505091815f73ffffffffffffffffffffffffffffffffffffffff8282960393165af180156101f7576103f057005b3d805f833e6103ff8183610926565b8101906020818303126101eb5780519067ffffffffffffffff82116101eb57019080601f830112156101eb5781519167ffffffffffffffff8311610482576020808460051b94818601906104566040519283610926565b815201938201019182116101eb57602001915b81831061047257005b8251815260209283019201610469565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b82518452869450602093840193909201916001016103ba565b825173ffffffffffffffffffffffffffffffffffffffff16855288965060209485019490920191600101610379565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b90919250610531816109fe565b600281036106765750608081013592604082013592602083013592606001359061055a906116ad565b915f81126101eb575f9161059573ffffffffffffffffffffffffffffffffffffffff8061058989602096610a61565b93169816918289611100565b6024604051809481937fbcb7ea5d0000000000000000000000000000000000000000000000000000000083523360048401525af19081156101f7575f91610644575b50106105e65761015b92611100565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f536c6970706167653a20494e53554646494349454e545f53595f5245504159006044820152fd5b90506020813d60201161066e575b8161065f60209383610926565b810103126101eb57515f6105d7565b3d9150610652565b600391939250610685816109fe565b036108455773ffffffffffffffffffffffffffffffffffffffff61072b9160206106c66106d195906020820135916040810135916080606083013592013590565b9196929790946116ad565b6040517fdb74aa1500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff90981660248901529694859283915f9183906044820190565b0393165af19182156101f7575f92610811575b5081106107b35761074e9161163e565b101561015b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f536c6970706167653a20494e53554646494349454e545f50545f5245504159006044820152606490fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f536c6970706167653a20494e53554646494349454e545f59545f4f55540000006044820152fd5b9091506020813d60201161083d575b8161082d60209383610926565b810103126101eb5751905f61073e565b3d9150610820565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52600160045260245ffd5b346101eb5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101eb5760643567ffffffffffffffff81116101eb57366023820112156101eb578060040135906108cd82610967565b6108da6040519182610926565b82815236602484840101116101eb575f60208461092295602461090e96018386013783010152604435602435600435610a6e565b6040519182916020835260208301906109a1565b0390f35b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761048257604052565b67ffffffffffffffff811161048257601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b91908251928382525f5b8481106109e95750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6020809697860101520116010190565b806020809284010151828286010152016109ab565b60041115610a0857565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b908160209103126101eb575173ffffffffffffffffffffffffffffffffffffffff811681036101eb5790565b919082039182116104f757565b9091811590816110c8575b816110bf575b5061109e576080838051810103126101eb57602083015160048110156101eb5760408401519073ffffffffffffffffffffffffffffffffffffffff8216938483036101eb57608060608701519601519373ffffffffffffffffffffffffffffffffffffffff85168095036101eb57610af6836109fe565b82159384801561108b575b15610e5657610b0f906115b5565b91670de0b6b3a7640000810290808204670de0b6b3a764000014901517156104f75782610b3b9161163e565b917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83019283116104f7578015610e2957610b769204610a61565b948511610dcb57604051907fafd27bf5000000000000000000000000000000000000000000000000000000008252602082600481885afa9182156101f7578686610bd094610bcb935f91610dac575b50611100565b6109fe565b15610d05576040517fdb74aa1500000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9190911660248201526020816044815f865af19081156101f7575f91610cd2575b50602060049192604051928380927fd94073d40000000000000000000000000000000000000000000000000000000082525afa80156101f757610c83915f91610ca3575b503390611325565b604051916020830152604082015260408152610ca0606082610926565b90565b610cc5915060203d602011610ccb575b610cbd8183610926565b810190610a35565b5f610c7b565b503d610cb3565b90506020813d602011610cfd575b81610ced60209383610926565b810103126101eb57516020610c37565b3d9150610ce0565b6040517fdb74aa1500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9190911660048201523060248201526020816044815f865af180156101f7575f90610d78575b610d739150913390611325565b610c83565b506020813d602011610da4575b81610d9260209383610926565b810103126101eb57610d739051610d66565b3d9150610d85565b610dc5915060203d602011610ccb57610cbd8183610926565b5f610bc5565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f536c6970706167653a20494e53554646494349454e545f53595f4c494d4954006044820152fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b508096919493501161102d57600190610e6e816109fe565b03610fe057610e7e848480611100565b604051917fbcb7ea5d0000000000000000000000000000000000000000000000000000000083523060048401526020836024815f885af19283156101f7575f93610fac575b50828111610f4e57610ed9602091600494610a61565b93604051938480927fafd27bf50000000000000000000000000000000000000000000000000000000082525afa80156101f75783610c83935f92610f2b575b508192610f2492611100565b3390611325565b610f249250610f489060203d602011610ccb57610cbd8183610926565b91610f18565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f536c6970706167653a20494e53554646494349454e545f50595f52454445454d6044820152fd5b9092506020813d602011610fd8575b81610fc860209383610926565b810103126101eb5751915f610ec3565b3d9150610fbb565b6040517fd94073d4000000000000000000000000000000000000000000000000000000008152602081600481875afa80156101f757848691611028935f91610dac5750611100565b610e7e565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f536c6970706167653a20494e53554646494349454e545f50595f4c494d4954006044820152fd5b50611095846109fe565b60028414610b01565b5050506040515f60208201525f604082015260408152610ca0606082610926565b9050155f610a7f565b83159150610a79565b3d156110fb573d906110e282610967565b916110f06040519384610926565b82523d5f602084013e565b606090565b82156113205773ffffffffffffffffffffffffffffffffffffffff168061119857505f80809381935af16111326110d1565b501561113a57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b5f8061126c9461121f604051809660208201937fa9059cbb00000000000000000000000000000000000000000000000000000000855260206024840173ffffffffffffffffffffffffffffffffffffffff60408201941681520152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101875286610926565b6040519461122e604087610926565b602086527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020870152519082855af16112666110d1565b916116e4565b8051908115918215611306575b50501561128257565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b6113199250602080918301019101611695565b5f80611279565b505050565b9073ffffffffffffffffffffffffffffffffffffffff82168015611320576040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8316602482015290602090829060449082905afa80156101f7575f90611577575b6b7fffffffffffffffffffffff9150106113bd575050565b5f806040519273ffffffffffffffffffffffffffffffffffffffff60208501917f095ea7b300000000000000000000000000000000000000000000000000000000835216938460248201528260448201526044815261141d606482610926565b519082865af161142b6110d1565b81611548575b50156114bb575f9182918260405160208101927f095ea7b300000000000000000000000000000000000000000000000000000000845260248201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6044820152604481526114a1606482610926565b51925af16114ad6110d1565b81611519575b50156114bb57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5361666520417070726f766500000000000000000000000000000000000000006044820152fd5b805180159250821561152e575b50505f6114b3565b6115419250602080918301019101611695565b5f80611526565b805180159250821561155d575b50505f611431565b6115709250602080918301019101611695565b5f80611555565b506020813d6020116115ad575b8161159160209383610926565b810103126101eb576b7fffffffffffffffffffffff90516113a5565b3d9150611584565b602073ffffffffffffffffffffffffffffffffffffffff60045f9360405194859384927f1d52edc4000000000000000000000000000000000000000000000000000000008452165af19081156101f7575f9161160f575090565b90506020813d602011611636575b8161162a60209383610926565b810103126101eb575190565b3d915061161d565b919082018092116104f757565b8051156116585760200190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b8051600110156116585760400190565b908160209103126101eb575180151581036101eb5790565b5f8113156116b85790565b7f800000000000000000000000000000000000000000000000000000000000000081146104f7575f0390565b9192901561175f57508151156116f8575090565b3b156117015790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156117725750805190602001fd5b6101bd906040519182917f08c379a00000000000000000000000000000000000000000000000000000000083526020600484015260248301906109a156fea26469706673582212200b0b2f9000a15a8fcd167795d8c6216b79a6b4910c2bbe5727189cf473390c5264736f6c634300081c0033
Deployed Bytecode
0x60806040526004361015610011575f80fd5b5f3560e01c8063eb3a7d47146108725763fa483e721461002f575f80fd5b346101eb5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101eb5760043560443560243567ffffffffffffffff82116101eb57366023830112156101eb57816004013567ffffffffffffffff81116101eb57602483019060243691850101116101eb5780356100b1816109fe565b8061020257505050906100c3906116ad565b90602060405180927fdb74aa15000000000000000000000000000000000000000000000000000000008252815f73ffffffffffffffffffffffffffffffffffffffff60648361013f6044870135336004840190929173ffffffffffffffffffffffffffffffffffffffff60209181604085019616845216910152565b03940135165af19081156101f7575f916101c1575b501061015d575b005b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f536c6970706167653a20494e53554646494349454e545f50545f524550415900604482015280606481015b0390fd5b90506020813d6020116101ef575b816101dc60209383610926565b810103126101eb57515f610154565b5f80fd5b3d91506101cf565b6040513d5f823e3d90fd5b61020b816109fe565b60018103610524575050606482013591610224836115b5565b825f039183159383057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff148417156104f7575f83126101eb576040519561026c606088610926565b60028752604094602088019490863687376040519461028c606087610926565b6002865260208601973689378083029283041417156104f757670de0b6b3a76400008101908181116104f757670de0b6b3a763ffff019081116104f757670de0b6b3a764000090046102dd8461164b565b52336102e88861164b565b525f81126101eb5761030890610301849896959461164b565b5190610a61565b61031187611685565b5273ffffffffffffffffffffffffffffffffffffffff604461033286611685565b9201351690526040519485937fb0d88981000000000000000000000000000000000000000000000000000000008552604485019060406004870152518091526064850192905f5b8181106104c8575050506020907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc85840301602486015251918281520191905f5b8181106104af5750505091815f73ffffffffffffffffffffffffffffffffffffffff8282960393165af180156101f7576103f057005b3d805f833e6103ff8183610926565b8101906020818303126101eb5780519067ffffffffffffffff82116101eb57019080601f830112156101eb5781519167ffffffffffffffff8311610482576020808460051b94818601906104566040519283610926565b815201938201019182116101eb57602001915b81831061047257005b8251815260209283019201610469565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b82518452869450602093840193909201916001016103ba565b825173ffffffffffffffffffffffffffffffffffffffff16855288965060209485019490920191600101610379565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b90919250610531816109fe565b600281036106765750608081013592604082013592602083013592606001359061055a906116ad565b915f81126101eb575f9161059573ffffffffffffffffffffffffffffffffffffffff8061058989602096610a61565b93169816918289611100565b6024604051809481937fbcb7ea5d0000000000000000000000000000000000000000000000000000000083523360048401525af19081156101f7575f91610644575b50106105e65761015b92611100565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f536c6970706167653a20494e53554646494349454e545f53595f5245504159006044820152fd5b90506020813d60201161066e575b8161065f60209383610926565b810103126101eb57515f6105d7565b3d9150610652565b600391939250610685816109fe565b036108455773ffffffffffffffffffffffffffffffffffffffff61072b9160206106c66106d195906020820135916040810135916080606083013592013590565b9196929790946116ad565b6040517fdb74aa1500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff90981660248901529694859283915f9183906044820190565b0393165af19182156101f7575f92610811575b5081106107b35761074e9161163e565b101561015b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f536c6970706167653a20494e53554646494349454e545f50545f5245504159006044820152606490fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f536c6970706167653a20494e53554646494349454e545f59545f4f55540000006044820152fd5b9091506020813d60201161083d575b8161082d60209383610926565b810103126101eb5751905f61073e565b3d9150610820565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52600160045260245ffd5b346101eb5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101eb5760643567ffffffffffffffff81116101eb57366023820112156101eb578060040135906108cd82610967565b6108da6040519182610926565b82815236602484840101116101eb575f60208461092295602461090e96018386013783010152604435602435600435610a6e565b6040519182916020835260208301906109a1565b0390f35b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761048257604052565b67ffffffffffffffff811161048257601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b91908251928382525f5b8481106109e95750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6020809697860101520116010190565b806020809284010151828286010152016109ab565b60041115610a0857565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b908160209103126101eb575173ffffffffffffffffffffffffffffffffffffffff811681036101eb5790565b919082039182116104f757565b9091811590816110c8575b816110bf575b5061109e576080838051810103126101eb57602083015160048110156101eb5760408401519073ffffffffffffffffffffffffffffffffffffffff8216938483036101eb57608060608701519601519373ffffffffffffffffffffffffffffffffffffffff85168095036101eb57610af6836109fe565b82159384801561108b575b15610e5657610b0f906115b5565b91670de0b6b3a7640000810290808204670de0b6b3a764000014901517156104f75782610b3b9161163e565b917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83019283116104f7578015610e2957610b769204610a61565b948511610dcb57604051907fafd27bf5000000000000000000000000000000000000000000000000000000008252602082600481885afa9182156101f7578686610bd094610bcb935f91610dac575b50611100565b6109fe565b15610d05576040517fdb74aa1500000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9190911660248201526020816044815f865af19081156101f7575f91610cd2575b50602060049192604051928380927fd94073d40000000000000000000000000000000000000000000000000000000082525afa80156101f757610c83915f91610ca3575b503390611325565b604051916020830152604082015260408152610ca0606082610926565b90565b610cc5915060203d602011610ccb575b610cbd8183610926565b810190610a35565b5f610c7b565b503d610cb3565b90506020813d602011610cfd575b81610ced60209383610926565b810103126101eb57516020610c37565b3d9150610ce0565b6040517fdb74aa1500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9190911660048201523060248201526020816044815f865af180156101f7575f90610d78575b610d739150913390611325565b610c83565b506020813d602011610da4575b81610d9260209383610926565b810103126101eb57610d739051610d66565b3d9150610d85565b610dc5915060203d602011610ccb57610cbd8183610926565b5f610bc5565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f536c6970706167653a20494e53554646494349454e545f53595f4c494d4954006044820152fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b508096919493501161102d57600190610e6e816109fe565b03610fe057610e7e848480611100565b604051917fbcb7ea5d0000000000000000000000000000000000000000000000000000000083523060048401526020836024815f885af19283156101f7575f93610fac575b50828111610f4e57610ed9602091600494610a61565b93604051938480927fafd27bf50000000000000000000000000000000000000000000000000000000082525afa80156101f75783610c83935f92610f2b575b508192610f2492611100565b3390611325565b610f249250610f489060203d602011610ccb57610cbd8183610926565b91610f18565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f536c6970706167653a20494e53554646494349454e545f50595f52454445454d6044820152fd5b9092506020813d602011610fd8575b81610fc860209383610926565b810103126101eb5751915f610ec3565b3d9150610fbb565b6040517fd94073d4000000000000000000000000000000000000000000000000000000008152602081600481875afa80156101f757848691611028935f91610dac5750611100565b610e7e565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f536c6970706167653a20494e53554646494349454e545f50595f4c494d4954006044820152fd5b50611095846109fe565b60028414610b01565b5050506040515f60208201525f604082015260408152610ca0606082610926565b9050155f610a7f565b83159150610a79565b3d156110fb573d906110e282610967565b916110f06040519384610926565b82523d5f602084013e565b606090565b82156113205773ffffffffffffffffffffffffffffffffffffffff168061119857505f80809381935af16111326110d1565b501561113a57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b5f8061126c9461121f604051809660208201937fa9059cbb00000000000000000000000000000000000000000000000000000000855260206024840173ffffffffffffffffffffffffffffffffffffffff60408201941681520152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101875286610926565b6040519461122e604087610926565b602086527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020870152519082855af16112666110d1565b916116e4565b8051908115918215611306575b50501561128257565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b6113199250602080918301019101611695565b5f80611279565b505050565b9073ffffffffffffffffffffffffffffffffffffffff82168015611320576040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8316602482015290602090829060449082905afa80156101f7575f90611577575b6b7fffffffffffffffffffffff9150106113bd575050565b5f806040519273ffffffffffffffffffffffffffffffffffffffff60208501917f095ea7b300000000000000000000000000000000000000000000000000000000835216938460248201528260448201526044815261141d606482610926565b519082865af161142b6110d1565b81611548575b50156114bb575f9182918260405160208101927f095ea7b300000000000000000000000000000000000000000000000000000000845260248201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6044820152604481526114a1606482610926565b51925af16114ad6110d1565b81611519575b50156114bb57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5361666520417070726f766500000000000000000000000000000000000000006044820152fd5b805180159250821561152e575b50505f6114b3565b6115419250602080918301019101611695565b5f80611526565b805180159250821561155d575b50505f611431565b6115709250602080918301019101611695565b5f80611555565b506020813d6020116115ad575b8161159160209383610926565b810103126101eb576b7fffffffffffffffffffffff90516113a5565b3d9150611584565b602073ffffffffffffffffffffffffffffffffffffffff60045f9360405194859384927f1d52edc4000000000000000000000000000000000000000000000000000000008452165af19081156101f7575f9161160f575090565b90506020813d602011611636575b8161162a60209383610926565b810103126101eb575190565b3d915061161d565b919082018092116104f757565b8051156116585760200190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b8051600110156116585760400190565b908160209103126101eb575180151581036101eb5790565b5f8113156116b85790565b7f800000000000000000000000000000000000000000000000000000000000000081146104f7575f0390565b9192901561175f57508151156116f8575090565b3b156117015790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156117725750805190602001fd5b6101bd906040519182917f08c379a00000000000000000000000000000000000000000000000000000000083526020600484015260248301906109a156fea26469706673582212200b0b2f9000a15a8fcd167795d8c6216b79a6b4910c2bbe5727189cf473390c5264736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.