Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 6 from a total of 6 transactions
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
8420963 | 7 days ago | 0.1 S |
Loading...
Loading
Contract Name:
KSZapRouterPosition
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import {IKSZapRouterPosition} from 'contracts/interfaces/IKSZapRouterPosition.sol'; import {IKSZapValidatorActions} from 'contracts/interfaces/zap/validators/IKSZapValidatorActions.sol'; import {IKSZapExecutorActions} from 'contracts/interfaces/zap/executors/IKSZapExecutorActions.sol'; import {IZapDexEnum} from 'contracts/interfaces/zap/common/IZapDexEnum.sol'; import {KSRescueV2} from 'ks-growth-utils-sc/contracts/KSRescueV2.sol'; import {ReentrancyGuard} from 'openzeppelin/contracts/security/ReentrancyGuard.sol'; import {IERC20} from 'openzeppelin/contracts/token/ERC20/IERC20.sol'; import {SafeERC20} from 'openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import {IERC721} from 'openzeppelin/contracts/token/ERC721/IERC721.sol'; import {IERC1155} from 'openzeppelin/contracts/token/ERC1155/IERC1155.sol'; /// @notice Main KyberSwap Zap Router to allow users zapping into any dexes /// It uses Validator to validate the zap result with flexibility, to enable adding more dexes contract KSZapRouterPosition is IKSZapRouterPosition, IZapDexEnum, KSRescueV2, ReentrancyGuard { using SafeERC20 for IERC20; address private constant ETH_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); mapping(address => bool) public whitelistedExecutor; mapping(address => bool) public whitelistedValidator; modifier checkDeadline(uint32 _deadline) { require(block.timestamp <= _deadline, 'ZapRouter: expired'); _; } constructor() {} /// @notice Whitelist executors by the owner, can grant or revoke function whitelistExecutors( address[] calldata _executors, bool _grantOrRevoke ) external onlyOwner { for (uint256 i = 0; i < _executors.length; i++) { whitelistedExecutor[_executors[i]] = _grantOrRevoke; emit ExecutorWhitelisted(_executors[i], _grantOrRevoke); } } /// @notice Whitelist validators by the owner, can grant or revoke function whitelistValidators( address[] calldata _validators, bool _grantOrRevoke ) external onlyOwner { for (uint256 i = 0; i < _validators.length; i++) { whitelistedValidator[_validators[i]] = _grantOrRevoke; emit ValidatorWhitelisted(_validators[i], _grantOrRevoke); } } /// @inheritdoc IKSZapRouterPosition function zap( ZapDescription calldata _desc, ZapExecutionData calldata _exe ) external payable override whenNotPaused nonReentrant checkDeadline(_exe.deadline) returns (bytes memory zapResults) { uint8 dexType = uint8(_desc.zapFlags >> 8); uint8 srcType = uint8(_desc.zapFlags); require(whitelistedExecutor[_exe.executor], 'ZapRouter: non whitelisted executor'); // handle src token collection if (srcType == uint8(SrcType.ERC20Token)) { _handleCollectERC20Tokens(_desc.srcInfo, _exe.executor); } else if (srcType == uint8(SrcType.ERC721Token)) { _handleCollectERC721Tokens(_desc.srcInfo, _exe.executor); } else if (srcType == uint8(SrcType.ERC1155Token)) { _handleCollectERC1155Tokens(_desc.srcInfo, _exe.executor); } // prepare validation data bytes memory initialData; if (_exe.validator != address(0)) { require(whitelistedValidator[_exe.validator], 'ZapRouter: non whitelisted validator'); initialData = IKSZapValidatorActions(_exe.validator).prepareValidationData(dexType, _desc.zapInfo); } // calling executor to execute the zap logic zapResults = IKSZapExecutorActions(_exe.executor).executeZap{value: msg.value}(_exe.executorData); // validate data after zapping if needed if (_exe.validator != address(0)) { bool isValid = IKSZapValidatorActions(_exe.validator).validateData( dexType, _desc.extraData, initialData, zapResults ); require(isValid, 'ZapRouter: validation failed'); } emit ZapExecuted( dexType, _desc.srcInfo, _exe.validator, _exe.executor, _desc.zapInfo, _desc.extraData, initialData, zapResults ); emit ClientData(_exe.clientData); } /// @notice Handle collecting ERC20 tokens and transfer to executor function _handleCollectERC20Tokens(bytes memory _srcInfo, address _executor) internal { ERC20SrcInfo memory src = abi.decode(_srcInfo, (ERC20SrcInfo)); require( src.tokens.length == src.amounts.length && src.tokens.length > 0, 'ZapRouter: invalid data' ); uint256 msgValue = msg.value; address msgSender = msg.sender; for (uint256 i = 0; i < src.tokens.length;) { if (src.tokens[i] == ETH_ADDRESS) { // native token, should appear only once with correct msg.value require(msgValue > 0 && msgValue == src.amounts[i], 'ZapRouter: invalid msg value'); msgValue = 0; } else { IERC20(src.tokens[i]).safeTransferFrom(msgSender, _executor, src.amounts[i]); } emit ERC20Collected(src.tokens[i], src.amounts[i]); unchecked { ++i; } } require(msgValue == 0, 'ZapRouter: invalid msg value'); } /// @notice Handle collecting ERC721 token and transfer to executor function _handleCollectERC721Tokens(bytes memory _srcInfo, address _executor) internal { require(msg.value == 0, 'ZapRouter: invalid msg value'); ERC721SrcInfo memory src = abi.decode(_srcInfo, (ERC721SrcInfo)); require(src.tokens.length == src.ids.length && src.tokens.length > 0, 'ZapRouter: invalid data'); for (uint256 i = 0; i < src.tokens.length;) { IERC721(src.tokens[i]).safeTransferFrom(msg.sender, _executor, src.ids[i]); emit ERC721Collected(src.tokens[i], src.ids[i]); unchecked { ++i; } } } /// @notice Handle collecting ERC1155 token and transfer to executor function _handleCollectERC1155Tokens(bytes memory _srcInfo, address _executor) internal { require(msg.value == 0, 'ZapRouter: invalid msg value'); ERC1155SrcInfo memory src = abi.decode(_srcInfo, (ERC1155SrcInfo)); require(src.tokens.length > 0 && src.tokens.length == src.ids.length, 'ZapRouter: invalid data'); require(src.tokens.length == src.amounts.length, 'ZapRouter: invalid data'); require(src.tokens.length == src.datas.length, 'ZapRouter: invalid data'); for (uint256 i = 0; i < src.tokens.length;) { IERC1155(src.tokens[i]).safeTransferFrom( msg.sender, _executor, src.ids[i], src.amounts[i], src.datas[i] ); emit ERC1155Collected(src.tokens[i], src.ids[i], src.amounts[i]); unchecked { ++i; } } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IKSZapRouterPosition { event ClientData(bytes _clientData); event ZapExecuted( uint8 indexed _dexType, bytes indexed _srcInfo, address _validator, address _executor, bytes _zapInfo, bytes _extraData, bytes _initialData, bytes _zapResults ); event ExecutorWhitelisted(address indexed _executor, bool indexed _grantOrRevoke); event ValidatorWhitelisted(address indexed _validator, bool indexed _grantOrRevoke); event ERC20Collected(address indexed _token, uint256 indexed _amount); event ERC721Collected(address indexed _token, uint256 indexed _id); event ERC1155Collected(address indexed _token, uint256 indexed _id, uint256 indexed _amount); /// @dev Contains general data for zapping and validation /// @param zapFlags packed value of dexType (uint8) | srcType (uint8) /// @param srcInfo src position info /// @param zapInfo extra info, depends on each dex type /// @param extraData extra data to be used for validation struct ZapDescription { uint16 zapFlags; bytes srcInfo; bytes zapInfo; bytes extraData; } /// @dev Contains execution data for zapping /// @param validator validator address, must be whitelisted one /// @param executor zap executor address, must be whitelisted one /// @param deadline make sure the request is not expired yet /// @param executorData data for zap execution /// @param clientData for events and tracking purposes struct ZapExecutionData { address validator; address executor; uint32 deadline; bytes executorData; bytes clientData; } /// @dev Contains address and function for the delegatecall /// @param helper helper address /// @param funcSelector helper function struct DelegatecallData { address helper; bytes4 funcSelector; } struct ERC20SrcInfo { address[] tokens; uint256[] amounts; } struct ERC721SrcInfo { address[] tokens; uint256[] ids; } struct ERC1155SrcInfo { address[] tokens; uint256[] ids; uint256[] amounts; bytes[] datas; } /// @notice collect token, execute and validate zap function zap( ZapDescription calldata _desc, ZapExecutionData calldata _exe ) external payable returns (bytes memory zapResults); function whitelistExecutors(address[] calldata _executors, bool _grantOrRevoke) external; function whitelistValidators(address[] calldata _validators, bool _grantOrRevoke) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IKSZapValidatorActions { function prepareValidationData( uint8 dstType, bytes calldata _zapInfo ) external view returns (bytes memory _validationData); function validateData( uint8 dstType, bytes calldata _extraData, bytes calldata _validationData, bytes calldata _zapResults ) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IKSZapExecutorActions { // @notice Function execute zap /// @param _executorData bytes data and will be decoded into corresponding data depends on dex type /// @return zapResults result of the zap, depend on dex type function executeZap( bytes calldata _executorData ) external payable returns (bytes memory zapResults); }
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.0; interface IZapDexEnum { // There must be a slot for EMPTY enum DexType { UniswapV2, UniswapV3, EMPTY, Curve, Balancer, AlgebraV19, AlgebraV19DirFee, RamsesV2, AerodromeV1, RingV2, KoiV2, SolidlyV3, AerodromeCL, AlgebraIntegralV12, Gamma } enum SrcType { ERC20Token, ERC721Token, ERC1155Token } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {KSRescue} from '@src/KSRescue.sol'; import {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import {IERC1155} from '@openzeppelin/contracts/token/ERC1155/IERC1155.sol'; abstract contract KSRescueV2 is KSRescue { function rescueBatchERC721( address token, uint256[] calldata _ids, address recipient ) external onlyOwner { require(recipient != address(0), 'KSRescue: invalid recipient'); for (uint256 i = 0; i < _ids.length; i++) { IERC721(token).transferFrom(address(this), recipient, _ids[i]); } } function rescueBatchERC1155( address token, uint256[] calldata ids, uint256[] memory amounts, bytes calldata data, address recipient ) external onlyOwner { require(recipient != address(0), 'KSRescue: invalid recipient'); require(ids.length == amounts.length, 'KSRescue: invalid array length'); for (uint256 i = 0; i < ids.length; ++i) { if (amounts[i] == 0) amounts[i] = IERC1155(token).balanceOf(address(this), ids[i]); } IERC1155(token).safeBatchTransferFrom(address(this), recipient, ids, amounts, data); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @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() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// 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) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {KyberSwapRole} from '@src/KyberSwapRole.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; abstract contract KSRescue is KyberSwapRole { using SafeERC20 for IERC20; address private constant ETH_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); function rescueFunds(address token, uint256 amount, address recipient) external onlyOwner { require(recipient != address(0), 'KSRescue: invalid recipient'); if (amount == 0) amount = _getAvailableAmount(token); if (amount > 0) { if (_isETH(token)) { (bool success,) = recipient.call{value: amount}(''); require(success, 'KSRescue: ETH_TRANSFER_FAILED'); } else { IERC20(token).safeTransfer(recipient, amount); } } } function _getAvailableAmount(address token) internal view virtual returns (uint256 amount) { if (_isETH(token)) { amount = address(this).balance; } else { amount = IERC20(token).balanceOf(address(this)); } if (amount > 0) --amount; } function _isETH(address token) internal pure returns (bool) { return (token == ETH_ADDRESS); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// 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) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; import {Pausable} from '@openzeppelin/contracts/security/Pausable.sol'; abstract contract KyberSwapRole is Ownable, Pausable { mapping(address => bool) public operators; mapping(address => bool) public guardians; /** * @dev Emitted when the an user was grant or revoke operator role. */ event UpdateOperator(address user, bool grantOrRevoke); /** * @dev Emitted when the an user was grant or revoke guardian role. */ event UpdateGuardian(address user, bool grantOrRevoke); /** * @dev Modifier to make a function callable only when caller is operator. * * Requirements: * * - Caller must have operator role. */ modifier onlyOperator() { require(operators[msg.sender], 'KyberSwapRole: not operator'); _; } /** * @dev Modifier to make a function callable only when caller is guardian. * * Requirements: * * - Caller must have guardian role. */ modifier onlyGuardian() { require(guardians[msg.sender], 'KyberSwapRole: not guardian'); _; } /** * @dev Update Operator role for user. * Can only be called by the current owner. */ function updateOperator(address user, bool grantOrRevoke) external onlyOwner { operators[user] = grantOrRevoke; emit UpdateOperator(user, grantOrRevoke); } /** * @dev Update Guardian role for user. * Can only be called by the current owner. */ function updateGuardian(address user, bool grantOrRevoke) external onlyOwner { guardians[user] = grantOrRevoke; emit UpdateGuardian(user, grantOrRevoke); } /** * @dev Enable logic for contract. * Can only be called by the current owner. */ function enableLogic() external onlyOwner { _unpause(); } /** * @dev Disable logic for contract. * Can only be called by the guardians. */ function disableLogic() external onlyGuardian { _pause(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
{ "remappings": [ "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin/=lib/openzeppelin-contracts/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "ks-growth-utils-sc/=lib/ks-growth-utils-sc/", "@openzeppelin/=lib/ks-growth-utils-sc/lib/openzeppelin-contracts/", "@src/=lib/ks-growth-utils-sc/contracts/", "forge-zksync-std/=lib/forge-zksync-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"_clientData","type":"bytes"}],"name":"ClientData","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"uint256","name":"_id","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"ERC1155Collected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"ERC20Collected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"uint256","name":"_id","type":"uint256"}],"name":"ERC721Collected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_executor","type":"address"},{"indexed":true,"internalType":"bool","name":"_grantOrRevoke","type":"bool"}],"name":"ExecutorWhitelisted","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bool","name":"grantOrRevoke","type":"bool"}],"name":"UpdateGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bool","name":"grantOrRevoke","type":"bool"}],"name":"UpdateOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_validator","type":"address"},{"indexed":true,"internalType":"bool","name":"_grantOrRevoke","type":"bool"}],"name":"ValidatorWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"_dexType","type":"uint8"},{"indexed":true,"internalType":"bytes","name":"_srcInfo","type":"bytes"},{"indexed":false,"internalType":"address","name":"_validator","type":"address"},{"indexed":false,"internalType":"address","name":"_executor","type":"address"},{"indexed":false,"internalType":"bytes","name":"_zapInfo","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_extraData","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_initialData","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_zapResults","type":"bytes"}],"name":"ZapExecuted","type":"event"},{"inputs":[],"name":"disableLogic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableLogic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"guardians","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"operators","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"}],"name":"rescueBatchERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"address","name":"recipient","type":"address"}],"name":"rescueBatchERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bool","name":"grantOrRevoke","type":"bool"}],"name":"updateGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bool","name":"grantOrRevoke","type":"bool"}],"name":"updateOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_executors","type":"address[]"},{"internalType":"bool","name":"_grantOrRevoke","type":"bool"}],"name":"whitelistExecutors","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_validators","type":"address[]"},{"internalType":"bool","name":"_grantOrRevoke","type":"bool"}],"name":"whitelistValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedExecutor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedValidator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint16","name":"zapFlags","type":"uint16"},{"internalType":"bytes","name":"srcInfo","type":"bytes"},{"internalType":"bytes","name":"zapInfo","type":"bytes"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct IKSZapRouterPosition.ZapDescription","name":"_desc","type":"tuple"},{"components":[{"internalType":"address","name":"validator","type":"address"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"bytes","name":"executorData","type":"bytes"},{"internalType":"bytes","name":"clientData","type":"bytes"}],"internalType":"struct IKSZapRouterPosition.ZapExecutionData","name":"_exe","type":"tuple"}],"name":"zap","outputs":[{"internalType":"bytes","name":"zapResults","type":"bytes"}],"stateMutability":"payable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a33610031565b6000805460ff60a01b191690556001600355610081565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612c5f80620000916000396000f3fe6080604052600436106101095760003560e01c8063a827db4611610095578063cc15009711610064578063cc150097146102f6578063dff3ca7d14610316578063e83aa3a814610336578063f2fde38b14610356578063f9338d181461037657600080fd5b8063a827db4614610266578063aa5d82c314610296578063c2eb5282146102b6578063c5389017146102d657600080fd5b8063715018a6116100dc578063715018a6146101c457806388f4950f146101d95780638da5cb5b146101f95780639abf6f1f146102215780639dd392391461025157600080fd5b80630633b14a1461010e57806313e7c9d8146101535780635c975abb146101835780636d44a3b2146101a2575b600080fd5b34801561011a57600080fd5b5061013e610129366004611fc3565b60026020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561015f57600080fd5b5061013e61016e366004611fc3565b60016020526000908152604090205460ff1681565b34801561018f57600080fd5b50600054600160a01b900460ff1661013e565b3480156101ae57600080fd5b506101c26101bd366004611fee565b61038b565b005b3480156101d057600080fd5b506101c2610422565b3480156101e557600080fd5b506101c26101f4366004611fee565b610458565b34801561020557600080fd5b506000546040516001600160a01b03909116815260200161014a565b34801561022d57600080fd5b5061013e61023c366004611fc3565b60056020526000908152604090205460ff1681565b34801561025d57600080fd5b506101c26104de565b34801561027257600080fd5b5061013e610281366004611fc3565b60046020526000908152604090205460ff1681565b6102a96102a4366004612027565b610545565b60405161014a91906120e6565b3480156102c257600080fd5b506101c26102d1366004612144565b610bc3565b3480156102e257600080fd5b506101c26102f136600461219a565b610cc3565b34801561030257600080fd5b506101c26103113660046122d3565b610dca565b34801561032257600080fd5b506101c2610331366004612144565b610fe0565b34801561034257600080fd5b506101c26103513660046123e6565b6110da565b34801561036257600080fd5b506101c2610371366004611fc3565b611222565b34801561038257600080fd5b506101c26112bd565b6000546001600160a01b031633146103be5760405162461bcd60e51b81526004016103b59061241d565b60405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff19168515159081179091558251938452908301527f2ee52be9d342458b3d25e07faada7ff9bc06723b4aa24edb6321ac1316b8a9dd91015b60405180910390a15050565b6000546001600160a01b0316331461044c5760405162461bcd60e51b81526004016103b59061241d565b61045660006112ef565b565b6000546001600160a01b031633146104825760405162461bcd60e51b81526004016103b59061241d565b6001600160a01b038216600081815260026020908152604091829020805460ff19168515159081179091558251938452908301527f25d7ce8d7e0b3990938766275ee2d54fbe81347d287bfbf0429838409a889fdc9101610416565b3360009081526002602052604090205460ff1661053d5760405162461bcd60e51b815260206004820152601b60248201527f4b7962657253776170526f6c653a206e6f7420677561726469616e000000000060448201526064016103b5565b61045661133f565b600054606090600160a01b900460ff16156105955760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103b5565b61059d6113e4565b6105ad6060830160408401612452565b8063ffffffff164211156105f85760405162461bcd60e51b815260206004820152601260248201527116985c149bdd5d195c8e88195e1c1a5c995960721b60448201526064016103b5565b600060086106096020870187612478565b61ffff16901c905060006106206020870187612478565b9050600460006106366040880160208901611fc3565b6001600160a01b0316815260208101919091526040016000205460ff166106ab5760405162461bcd60e51b815260206004820152602360248201527f5a6170526f757465723a206e6f6e2077686974656c69737465642065786563756044820152623a37b960e91b60648201526084016103b5565b60ff81166107125761070d6106c3602088018861249c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610708925050506040880160208901611fc3565b61143e565b6107de565b60ff8116600114156107785761070d61072e602088018861249c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610773925050506040880160208901611fc3565b61161e565b60ff8116600214156107de576107de610794602088018861249c565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506107d9925050506040880160208901611fc3565b6117c2565b606060006107ef6020880188611fc3565b6001600160a01b031614610921576005600061080e6020890189611fc3565b6001600160a01b0316815260208101919091526040016000205460ff166108835760405162461bcd60e51b8152602060048201526024808201527f5a6170526f757465723a206e6f6e2077686974656c69737465642076616c696460448201526330ba37b960e11b60648201526084016103b5565b6108906020870187611fc3565b6001600160a01b031663c6256bef846108ac60408b018b61249c565b6040518463ffffffff1660e01b81526004016108ca9392919061250b565b60006040518083038186803b1580156108e257600080fd5b505afa1580156108f6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261091e9190810190612594565b90505b6109316040870160208801611fc3565b6001600160a01b031663f012a2b63461094d60608a018a61249c565b6040518463ffffffff1660e01b815260040161096a9291906125c8565b6000604051808303818588803b15801561098357600080fd5b505af1158015610997573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526109c09190810190612594565b945060006109d16020880188611fc3565b6001600160a01b031614610acd5760006109ee6020880188611fc3565b6001600160a01b031663af0a355785610a0a60608c018c61249c565b868b6040518663ffffffff1660e01b8152600401610a2c9594939291906125dc565b60206040518083038186803b158015610a4457600080fd5b505afa158015610a58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7c919061262b565b905080610acb5760405162461bcd60e51b815260206004820152601c60248201527f5a6170526f757465723a2076616c69646174696f6e206661696c65640000000060448201526064016103b5565b505b610ada602088018861249c565b604051610ae8929190612648565b60405190819003902060ff84167fc6c65320d36912d569b6a6e9cd567b0472cfe5c0e10c35f799df19912d6b9cef610b2360208a018a611fc3565b610b3360408b0160208c01611fc3565b610b4060408d018d61249c565b610b4d60608f018f61249c565b898e604051610b63989796959493929190612658565b60405180910390a37f095e66fa4dd6a6f7b43fb8444a7bd0edb870508c7abf639bc216efb0bcff9779610b99608088018861249c565b604051610ba79291906125c8565b60405180910390a150505050610bbd6001600355565b92915050565b6000546001600160a01b03163314610bed5760405162461bcd60e51b81526004016103b59061241d565b60005b82811015610cbd578160046000868685818110610c0f57610c0f6126cf565b9050602002016020810190610c249190611fc3565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055811515848483818110610c6157610c616126cf565b9050602002016020810190610c769190611fc3565b6001600160a01b03167f19f4c310cf148369e5605e8f3538cee4d3495da0612c9a45c0b89105ed6fee4d60405160405180910390a380610cb5816126fb565b915050610bf0565b50505050565b6000546001600160a01b03163314610ced5760405162461bcd60e51b81526004016103b59061241d565b6001600160a01b038116610d135760405162461bcd60e51b81526004016103b590612716565b60005b82811015610dc357846001600160a01b03166323b872dd3084878786818110610d4157610d416126cf565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015610d9857600080fd5b505af1158015610dac573d6000803e3d6000fd5b505050508080610dbb906126fb565b915050610d16565b5050505050565b6000546001600160a01b03163314610df45760405162461bcd60e51b81526004016103b59061241d565b6001600160a01b038116610e1a5760405162461bcd60e51b81526004016103b590612716565b83518514610e6a5760405162461bcd60e51b815260206004820152601e60248201527f4b535265736375653a20696e76616c6964206172726179206c656e677468000060448201526064016103b5565b60005b85811015610f6c57848181518110610e8757610e876126cf565b602002602001015160001415610f5c57876001600160a01b031662fdd58e30898985818110610eb857610eb86126cf565b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602002919091013560248301525060440160206040518083038186803b158015610f0557600080fd5b505afa158015610f19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3d919061274d565b858281518110610f4f57610f4f6126cf565b6020026020010181815250505b610f65816126fb565b9050610e6d565b50604051631759616b60e11b81526001600160a01b03881690632eb2c2d690610fa590309085908b908b908b908b908b90600401612766565b600060405180830381600087803b158015610fbf57600080fd5b505af1158015610fd3573d6000803e3d6000fd5b5050505050505050505050565b6000546001600160a01b0316331461100a5760405162461bcd60e51b81526004016103b59061241d565b60005b82811015610cbd57816005600086868581811061102c5761102c6126cf565b90506020020160208101906110419190611fc3565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905581151584848381811061107e5761107e6126cf565b90506020020160208101906110939190611fc3565b6001600160a01b03167f43572750395348a3948322f95d3b0bf4773311c6c19ec9a575cde194e5bac21160405160405180910390a3806110d2816126fb565b91505061100d565b6000546001600160a01b031633146111045760405162461bcd60e51b81526004016103b59061241d565b6001600160a01b03811661112a5760405162461bcd60e51b81526004016103b590612716565b8161113b57611138836119f4565b91505b811561121d5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0384161415611209576000816001600160a01b03168360405160006040518083038185875af1925050503d80600081146111b3576040519150601f19603f3d011682016040523d82523d6000602084013e6111b8565b606091505b5050905080610cbd5760405162461bcd60e51b815260206004820152601d60248201527f4b535265736375653a204554485f5452414e534645525f4641494c454400000060448201526064016103b5565b61121d6001600160a01b0384168284611ab3565b505050565b6000546001600160a01b0316331461124c5760405162461bcd60e51b81526004016103b59061241d565b6001600160a01b0381166112b15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103b5565b6112ba816112ef565b50565b6000546001600160a01b031633146112e75760405162461bcd60e51b81526004016103b59061241d565b610456611b05565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600054600160a01b900460ff161561138c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103b5565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586113c73390565b6040516001600160a01b03909116815260200160405180910390a1565b600260035414156114375760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103b5565b6002600355565b6000828060200190518101906114549190612972565b60208101515181515191925014801561146e575080515115155b61148a5760405162461bcd60e51b81526004016103b5906129a6565b343360005b8351518110156115ff578351805173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee9190839081106114c4576114c46126cf565b60200260200101516001600160a01b0316141561152c576000831180156115075750836020015181815181106114fc576114fc6126cf565b602002602001015183145b6115235760405162461bcd60e51b81526004016103b5906129dd565b60009250611586565b611586828686602001518481518110611547576115476126cf565b602002602001015187600001518581518110611565576115656126cf565b60200260200101516001600160a01b0316611b89909392919063ffffffff16565b8360200151818151811061159c5761159c6126cf565b6020026020010151846000015182815181106115ba576115ba6126cf565b60200260200101516001600160a01b03167f542ffabdd5320a08598fbaa483210c5e34df4cfbd7f2541470a88d43c640311460405160405180910390a360010161148f565b508115610dc35760405162461bcd60e51b81526004016103b5906129dd565b341561163c5760405162461bcd60e51b81526004016103b5906129dd565b6000828060200190518101906116529190612972565b60208101515181515191925014801561166c575080515115155b6116885760405162461bcd60e51b81526004016103b5906129a6565b60005b815151811015610cbd5781518051829081106116a9576116a96126cf565b60200260200101516001600160a01b03166342842e0e3385856020015185815181106116d7576116d76126cf565b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b15801561173157600080fd5b505af1158015611745573d6000803e3d6000fd5b505050508160200151818151811061175f5761175f6126cf565b60200260200101518260000151828151811061177d5761177d6126cf565b60200260200101516001600160a01b03167fa6fb63d713a5a606436dc801f04dfdfd00d8e5211c54bc1332aeb047992c06f760405160405180910390a360010161168b565b34156117e05760405162461bcd60e51b81526004016103b5906129dd565b6000828060200190518101906117f69190612a93565b805151909150158015906118105750602081015151815151145b61182c5760405162461bcd60e51b81526004016103b5906129a6565b604081015151815151146118525760405162461bcd60e51b81526004016103b5906129a6565b606081015151815151146118785760405162461bcd60e51b81526004016103b5906129a6565b60005b815151811015610cbd578151805182908110611899576118996126cf565b60200260200101516001600160a01b031663f242432a3385856020015185815181106118c7576118c76126cf565b6020026020010151866040015186815181106118e5576118e56126cf565b602002602001015187606001518781518110611903576119036126cf565b60200260200101516040518663ffffffff1660e01b815260040161192b959493929190612b6b565b600060405180830381600087803b15801561194557600080fd5b505af1158015611959573d6000803e3d6000fd5b5050505081604001518181518110611973576119736126cf565b602002602001015182602001518281518110611991576119916126cf565b6020026020010151836000015183815181106119af576119af6126cf565b60200260200101516001600160a01b03167fc9efed9c685f673048e2e1c9ddf550a10f21608098f48dd9cf18c3f77028486260405160405180910390a460010161187b565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0383161415611a22575047611a9c565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a082319060240160206040518083038186803b158015611a6157600080fd5b505afa158015611a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a99919061274d565b90505b8015611aae57611aab81612bb0565b90505b919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261121d908490611be3565b600054600160a01b900460ff16611b555760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103b5565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336113c7565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610cbd908590611cb5565b6000611c38826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d2b9092919063ffffffff16565b80519091501561121d5780806020019051810190611c56919061262b565b61121d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103b5565b6000611d0a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d449092919063ffffffff16565b9050805160001480611c56575080806020019051810190611c56919061262b565b6060611d3a8484600085611d53565b90505b9392505050565b6060611d3a8484600085611e3e565b606082471015611d755760405162461bcd60e51b81526004016103b590612bc7565b843b611dc35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103b5565b600080866001600160a01b03168587604051611ddf9190612c0d565b60006040518083038185875af1925050503d8060008114611e1c576040519150601f19603f3d011682016040523d82523d6000602084013e611e21565b606091505b5091509150611e31828286611ecf565b925050505b949350505050565b606082471015611e605760405162461bcd60e51b81526004016103b590612bc7565b600080866001600160a01b03168587604051611e7c9190612c0d565b60006040518083038185875af1925050503d8060008114611eb9576040519150601f19603f3d011682016040523d82523d6000602084013e611ebe565b606091505b5091509150611e3187838387611f08565b60608315611ede575081611d3d565b825115611eee5782518084602001fd5b8160405162461bcd60e51b81526004016103b591906120e6565b60608315611f74578251611f6d576001600160a01b0385163b611f6d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103b5565b5081611e36565b611e368383815115611f895781518083602001fd5b8060405162461bcd60e51b81526004016103b591906120e6565b6001600160a01b03811681146112ba57600080fd5b8035611aae81611fa3565b600060208284031215611fd557600080fd5b8135611d3d81611fa3565b80151581146112ba57600080fd5b6000806040838503121561200157600080fd5b823561200c81611fa3565b9150602083013561201c81611fe0565b809150509250929050565b6000806040838503121561203a57600080fd5b82356001600160401b038082111561205157600080fd5b908401906080828703121561206557600080fd5b9092506020840135908082111561207b57600080fd5b50830160a0818603121561201c57600080fd5b60005b838110156120a9578181015183820152602001612091565b83811115610cbd5750506000910152565b600081518084526120d281602086016020860161208e565b601f01601f19169290920160200192915050565b602081526000611d3d60208301846120ba565b60008083601f84011261210b57600080fd5b5081356001600160401b0381111561212257600080fd5b6020830191508360208260051b850101111561213d57600080fd5b9250929050565b60008060006040848603121561215957600080fd5b83356001600160401b0381111561216f57600080fd5b61217b868287016120f9565b909450925050602084013561218f81611fe0565b809150509250925092565b600080600080606085870312156121b057600080fd5b84356121bb81611fa3565b935060208501356001600160401b038111156121d657600080fd5b6121e2878288016120f9565b90945092505060408501356121f681611fa3565b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b038111828210171561223957612239612201565b60405290565b604051601f8201601f191681016001600160401b038111828210171561226757612267612201565b604052919050565b60006001600160401b0382111561228857612288612201565b5060051b60200190565b60008083601f8401126122a457600080fd5b5081356001600160401b038111156122bb57600080fd5b60208301915083602082850101111561213d57600080fd5b600080600080600080600060a0888a0312156122ee57600080fd5b87356122f981611fa3565b96506020888101356001600160401b038082111561231657600080fd5b6123228c838d016120f9565b909950975060408b013591508082111561233b57600080fd5b818b0191508b601f83011261234f57600080fd5b813561236261235d8261226f565b61223f565b81815260059190911b8301840190848101908e83111561238157600080fd5b938501935b8285101561239f57843582529385019390850190612386565b9850505060608b01359250808311156123b757600080fd5b50506123c58a828b01612292565b90945092506123d8905060808901611fb8565b905092959891949750929550565b6000806000606084860312156123fb57600080fd5b833561240681611fa3565b925060208401359150604084013561218f81611fa3565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561246457600080fd5b813563ffffffff81168114611d3d57600080fd5b60006020828403121561248a57600080fd5b813561ffff81168114611d3d57600080fd5b6000808335601e198436030181126124b357600080fd5b8301803591506001600160401b038211156124cd57600080fd5b60200191503681900382131561213d57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60ff841681526040602082015260006125286040830184866124e2565b95945050505050565b600082601f83011261254257600080fd5b81516001600160401b0381111561255b5761255b612201565b61256e601f8201601f191660200161223f565b81815284602083860101111561258357600080fd5b611e3682602083016020870161208e565b6000602082840312156125a657600080fd5b81516001600160401b038111156125bc57600080fd5b611e3684828501612531565b602081526000611d3a6020830184866124e2565b60ff861681526080602082015260006125f96080830186886124e2565b828103604084015261260b81866120ba565b9050828103606084015261261f81856120ba565b98975050505050505050565b60006020828403121561263d57600080fd5b8151611d3d81611fe0565b8183823760009101908152919050565b6001600160a01b0389811682528816602082015260c060408201819052600090612685908301888a6124e2565b82810360608401526126988187896124e2565b905082810360808401526126ac81866120ba565b905082810360a08401526126c081856120ba565b9b9a5050505050505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561270f5761270f6126e5565b5060010190565b6020808252601b908201527f4b535265736375653a20696e76616c696420726563697069656e740000000000604082015260600190565b60006020828403121561275f57600080fd5b5051919050565b6001600160a01b03888116825287811660208084019190915260a0604084018190528301879052600091906001600160fb1b038811156127a557600080fd5b8760051b9150818960c0860137600091840160c08181018481528683039091016060870152885190819052828901939160e001905b808310156127fa57845182529383019360019290920191908301906127da565b50858103608087015261280e81888a6124e2565b9d9c50505050505050505050505050565b600082601f83011261283057600080fd5b8151602061284061235d8361226f565b82815260059290921b8401810191818101908684111561285f57600080fd5b8286015b8481101561288357805161287681611fa3565b8352918301918301612863565b509695505050505050565b600082601f83011261289f57600080fd5b815160206128af61235d8361226f565b82815260059290921b840181019181810190868411156128ce57600080fd5b8286015b8481101561288357805183529183019183016128d2565b6000604082840312156128fb57600080fd5b604051604081016001600160401b03828210818311171561291e5761291e612201565b81604052829350845191508082111561293657600080fd5b6129428683870161281f565b8352602085015191508082111561295857600080fd5b506129658582860161288e565b6020830152505092915050565b60006020828403121561298457600080fd5b81516001600160401b0381111561299a57600080fd5b611e36848285016128e9565b60208082526017908201527f5a6170526f757465723a20696e76616c69642064617461000000000000000000604082015260600190565b6020808252601c908201527f5a6170526f757465723a20696e76616c6964206d73672076616c756500000000604082015260600190565b600082601f830112612a2557600080fd5b81516020612a3561235d8361226f565b82815260059290921b84018101918181019086841115612a5457600080fd5b8286015b848110156128835780516001600160401b03811115612a775760008081fd5b612a858986838b0101612531565b845250918301918301612a58565b600060208284031215612aa557600080fd5b81516001600160401b0380821115612abc57600080fd5b9083019060808286031215612ad057600080fd5b612ad8612217565b825182811115612ae757600080fd5b612af38782860161281f565b825250602083015182811115612b0857600080fd5b612b148782860161288e565b602083015250604083015182811115612b2c57600080fd5b612b388782860161288e565b604083015250606083015182811115612b5057600080fd5b612b5c87828601612a14565b60608301525095945050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090612ba5908301846120ba565b979650505050505050565b600081612bbf57612bbf6126e5565b506000190190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b60008251612c1f81846020870161208e565b919091019291505056fea26469706673582212207cc642b59637d659de0ab242cab879490c18e23064c047552748ac125cab6e7864736f6c63430008090033
Deployed Bytecode
0x6080604052600436106101095760003560e01c8063a827db4611610095578063cc15009711610064578063cc150097146102f6578063dff3ca7d14610316578063e83aa3a814610336578063f2fde38b14610356578063f9338d181461037657600080fd5b8063a827db4614610266578063aa5d82c314610296578063c2eb5282146102b6578063c5389017146102d657600080fd5b8063715018a6116100dc578063715018a6146101c457806388f4950f146101d95780638da5cb5b146101f95780639abf6f1f146102215780639dd392391461025157600080fd5b80630633b14a1461010e57806313e7c9d8146101535780635c975abb146101835780636d44a3b2146101a2575b600080fd5b34801561011a57600080fd5b5061013e610129366004611fc3565b60026020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561015f57600080fd5b5061013e61016e366004611fc3565b60016020526000908152604090205460ff1681565b34801561018f57600080fd5b50600054600160a01b900460ff1661013e565b3480156101ae57600080fd5b506101c26101bd366004611fee565b61038b565b005b3480156101d057600080fd5b506101c2610422565b3480156101e557600080fd5b506101c26101f4366004611fee565b610458565b34801561020557600080fd5b506000546040516001600160a01b03909116815260200161014a565b34801561022d57600080fd5b5061013e61023c366004611fc3565b60056020526000908152604090205460ff1681565b34801561025d57600080fd5b506101c26104de565b34801561027257600080fd5b5061013e610281366004611fc3565b60046020526000908152604090205460ff1681565b6102a96102a4366004612027565b610545565b60405161014a91906120e6565b3480156102c257600080fd5b506101c26102d1366004612144565b610bc3565b3480156102e257600080fd5b506101c26102f136600461219a565b610cc3565b34801561030257600080fd5b506101c26103113660046122d3565b610dca565b34801561032257600080fd5b506101c2610331366004612144565b610fe0565b34801561034257600080fd5b506101c26103513660046123e6565b6110da565b34801561036257600080fd5b506101c2610371366004611fc3565b611222565b34801561038257600080fd5b506101c26112bd565b6000546001600160a01b031633146103be5760405162461bcd60e51b81526004016103b59061241d565b60405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff19168515159081179091558251938452908301527f2ee52be9d342458b3d25e07faada7ff9bc06723b4aa24edb6321ac1316b8a9dd91015b60405180910390a15050565b6000546001600160a01b0316331461044c5760405162461bcd60e51b81526004016103b59061241d565b61045660006112ef565b565b6000546001600160a01b031633146104825760405162461bcd60e51b81526004016103b59061241d565b6001600160a01b038216600081815260026020908152604091829020805460ff19168515159081179091558251938452908301527f25d7ce8d7e0b3990938766275ee2d54fbe81347d287bfbf0429838409a889fdc9101610416565b3360009081526002602052604090205460ff1661053d5760405162461bcd60e51b815260206004820152601b60248201527f4b7962657253776170526f6c653a206e6f7420677561726469616e000000000060448201526064016103b5565b61045661133f565b600054606090600160a01b900460ff16156105955760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103b5565b61059d6113e4565b6105ad6060830160408401612452565b8063ffffffff164211156105f85760405162461bcd60e51b815260206004820152601260248201527116985c149bdd5d195c8e88195e1c1a5c995960721b60448201526064016103b5565b600060086106096020870187612478565b61ffff16901c905060006106206020870187612478565b9050600460006106366040880160208901611fc3565b6001600160a01b0316815260208101919091526040016000205460ff166106ab5760405162461bcd60e51b815260206004820152602360248201527f5a6170526f757465723a206e6f6e2077686974656c69737465642065786563756044820152623a37b960e91b60648201526084016103b5565b60ff81166107125761070d6106c3602088018861249c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610708925050506040880160208901611fc3565b61143e565b6107de565b60ff8116600114156107785761070d61072e602088018861249c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610773925050506040880160208901611fc3565b61161e565b60ff8116600214156107de576107de610794602088018861249c565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506107d9925050506040880160208901611fc3565b6117c2565b606060006107ef6020880188611fc3565b6001600160a01b031614610921576005600061080e6020890189611fc3565b6001600160a01b0316815260208101919091526040016000205460ff166108835760405162461bcd60e51b8152602060048201526024808201527f5a6170526f757465723a206e6f6e2077686974656c69737465642076616c696460448201526330ba37b960e11b60648201526084016103b5565b6108906020870187611fc3565b6001600160a01b031663c6256bef846108ac60408b018b61249c565b6040518463ffffffff1660e01b81526004016108ca9392919061250b565b60006040518083038186803b1580156108e257600080fd5b505afa1580156108f6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261091e9190810190612594565b90505b6109316040870160208801611fc3565b6001600160a01b031663f012a2b63461094d60608a018a61249c565b6040518463ffffffff1660e01b815260040161096a9291906125c8565b6000604051808303818588803b15801561098357600080fd5b505af1158015610997573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526109c09190810190612594565b945060006109d16020880188611fc3565b6001600160a01b031614610acd5760006109ee6020880188611fc3565b6001600160a01b031663af0a355785610a0a60608c018c61249c565b868b6040518663ffffffff1660e01b8152600401610a2c9594939291906125dc565b60206040518083038186803b158015610a4457600080fd5b505afa158015610a58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7c919061262b565b905080610acb5760405162461bcd60e51b815260206004820152601c60248201527f5a6170526f757465723a2076616c69646174696f6e206661696c65640000000060448201526064016103b5565b505b610ada602088018861249c565b604051610ae8929190612648565b60405190819003902060ff84167fc6c65320d36912d569b6a6e9cd567b0472cfe5c0e10c35f799df19912d6b9cef610b2360208a018a611fc3565b610b3360408b0160208c01611fc3565b610b4060408d018d61249c565b610b4d60608f018f61249c565b898e604051610b63989796959493929190612658565b60405180910390a37f095e66fa4dd6a6f7b43fb8444a7bd0edb870508c7abf639bc216efb0bcff9779610b99608088018861249c565b604051610ba79291906125c8565b60405180910390a150505050610bbd6001600355565b92915050565b6000546001600160a01b03163314610bed5760405162461bcd60e51b81526004016103b59061241d565b60005b82811015610cbd578160046000868685818110610c0f57610c0f6126cf565b9050602002016020810190610c249190611fc3565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055811515848483818110610c6157610c616126cf565b9050602002016020810190610c769190611fc3565b6001600160a01b03167f19f4c310cf148369e5605e8f3538cee4d3495da0612c9a45c0b89105ed6fee4d60405160405180910390a380610cb5816126fb565b915050610bf0565b50505050565b6000546001600160a01b03163314610ced5760405162461bcd60e51b81526004016103b59061241d565b6001600160a01b038116610d135760405162461bcd60e51b81526004016103b590612716565b60005b82811015610dc357846001600160a01b03166323b872dd3084878786818110610d4157610d416126cf565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015610d9857600080fd5b505af1158015610dac573d6000803e3d6000fd5b505050508080610dbb906126fb565b915050610d16565b5050505050565b6000546001600160a01b03163314610df45760405162461bcd60e51b81526004016103b59061241d565b6001600160a01b038116610e1a5760405162461bcd60e51b81526004016103b590612716565b83518514610e6a5760405162461bcd60e51b815260206004820152601e60248201527f4b535265736375653a20696e76616c6964206172726179206c656e677468000060448201526064016103b5565b60005b85811015610f6c57848181518110610e8757610e876126cf565b602002602001015160001415610f5c57876001600160a01b031662fdd58e30898985818110610eb857610eb86126cf565b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602002919091013560248301525060440160206040518083038186803b158015610f0557600080fd5b505afa158015610f19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3d919061274d565b858281518110610f4f57610f4f6126cf565b6020026020010181815250505b610f65816126fb565b9050610e6d565b50604051631759616b60e11b81526001600160a01b03881690632eb2c2d690610fa590309085908b908b908b908b908b90600401612766565b600060405180830381600087803b158015610fbf57600080fd5b505af1158015610fd3573d6000803e3d6000fd5b5050505050505050505050565b6000546001600160a01b0316331461100a5760405162461bcd60e51b81526004016103b59061241d565b60005b82811015610cbd57816005600086868581811061102c5761102c6126cf565b90506020020160208101906110419190611fc3565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905581151584848381811061107e5761107e6126cf565b90506020020160208101906110939190611fc3565b6001600160a01b03167f43572750395348a3948322f95d3b0bf4773311c6c19ec9a575cde194e5bac21160405160405180910390a3806110d2816126fb565b91505061100d565b6000546001600160a01b031633146111045760405162461bcd60e51b81526004016103b59061241d565b6001600160a01b03811661112a5760405162461bcd60e51b81526004016103b590612716565b8161113b57611138836119f4565b91505b811561121d5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0384161415611209576000816001600160a01b03168360405160006040518083038185875af1925050503d80600081146111b3576040519150601f19603f3d011682016040523d82523d6000602084013e6111b8565b606091505b5050905080610cbd5760405162461bcd60e51b815260206004820152601d60248201527f4b535265736375653a204554485f5452414e534645525f4641494c454400000060448201526064016103b5565b61121d6001600160a01b0384168284611ab3565b505050565b6000546001600160a01b0316331461124c5760405162461bcd60e51b81526004016103b59061241d565b6001600160a01b0381166112b15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103b5565b6112ba816112ef565b50565b6000546001600160a01b031633146112e75760405162461bcd60e51b81526004016103b59061241d565b610456611b05565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600054600160a01b900460ff161561138c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103b5565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586113c73390565b6040516001600160a01b03909116815260200160405180910390a1565b600260035414156114375760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103b5565b6002600355565b6000828060200190518101906114549190612972565b60208101515181515191925014801561146e575080515115155b61148a5760405162461bcd60e51b81526004016103b5906129a6565b343360005b8351518110156115ff578351805173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee9190839081106114c4576114c46126cf565b60200260200101516001600160a01b0316141561152c576000831180156115075750836020015181815181106114fc576114fc6126cf565b602002602001015183145b6115235760405162461bcd60e51b81526004016103b5906129dd565b60009250611586565b611586828686602001518481518110611547576115476126cf565b602002602001015187600001518581518110611565576115656126cf565b60200260200101516001600160a01b0316611b89909392919063ffffffff16565b8360200151818151811061159c5761159c6126cf565b6020026020010151846000015182815181106115ba576115ba6126cf565b60200260200101516001600160a01b03167f542ffabdd5320a08598fbaa483210c5e34df4cfbd7f2541470a88d43c640311460405160405180910390a360010161148f565b508115610dc35760405162461bcd60e51b81526004016103b5906129dd565b341561163c5760405162461bcd60e51b81526004016103b5906129dd565b6000828060200190518101906116529190612972565b60208101515181515191925014801561166c575080515115155b6116885760405162461bcd60e51b81526004016103b5906129a6565b60005b815151811015610cbd5781518051829081106116a9576116a96126cf565b60200260200101516001600160a01b03166342842e0e3385856020015185815181106116d7576116d76126cf565b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b15801561173157600080fd5b505af1158015611745573d6000803e3d6000fd5b505050508160200151818151811061175f5761175f6126cf565b60200260200101518260000151828151811061177d5761177d6126cf565b60200260200101516001600160a01b03167fa6fb63d713a5a606436dc801f04dfdfd00d8e5211c54bc1332aeb047992c06f760405160405180910390a360010161168b565b34156117e05760405162461bcd60e51b81526004016103b5906129dd565b6000828060200190518101906117f69190612a93565b805151909150158015906118105750602081015151815151145b61182c5760405162461bcd60e51b81526004016103b5906129a6565b604081015151815151146118525760405162461bcd60e51b81526004016103b5906129a6565b606081015151815151146118785760405162461bcd60e51b81526004016103b5906129a6565b60005b815151811015610cbd578151805182908110611899576118996126cf565b60200260200101516001600160a01b031663f242432a3385856020015185815181106118c7576118c76126cf565b6020026020010151866040015186815181106118e5576118e56126cf565b602002602001015187606001518781518110611903576119036126cf565b60200260200101516040518663ffffffff1660e01b815260040161192b959493929190612b6b565b600060405180830381600087803b15801561194557600080fd5b505af1158015611959573d6000803e3d6000fd5b5050505081604001518181518110611973576119736126cf565b602002602001015182602001518281518110611991576119916126cf565b6020026020010151836000015183815181106119af576119af6126cf565b60200260200101516001600160a01b03167fc9efed9c685f673048e2e1c9ddf550a10f21608098f48dd9cf18c3f77028486260405160405180910390a460010161187b565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0383161415611a22575047611a9c565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a082319060240160206040518083038186803b158015611a6157600080fd5b505afa158015611a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a99919061274d565b90505b8015611aae57611aab81612bb0565b90505b919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261121d908490611be3565b600054600160a01b900460ff16611b555760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103b5565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336113c7565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610cbd908590611cb5565b6000611c38826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d2b9092919063ffffffff16565b80519091501561121d5780806020019051810190611c56919061262b565b61121d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103b5565b6000611d0a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d449092919063ffffffff16565b9050805160001480611c56575080806020019051810190611c56919061262b565b6060611d3a8484600085611d53565b90505b9392505050565b6060611d3a8484600085611e3e565b606082471015611d755760405162461bcd60e51b81526004016103b590612bc7565b843b611dc35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103b5565b600080866001600160a01b03168587604051611ddf9190612c0d565b60006040518083038185875af1925050503d8060008114611e1c576040519150601f19603f3d011682016040523d82523d6000602084013e611e21565b606091505b5091509150611e31828286611ecf565b925050505b949350505050565b606082471015611e605760405162461bcd60e51b81526004016103b590612bc7565b600080866001600160a01b03168587604051611e7c9190612c0d565b60006040518083038185875af1925050503d8060008114611eb9576040519150601f19603f3d011682016040523d82523d6000602084013e611ebe565b606091505b5091509150611e3187838387611f08565b60608315611ede575081611d3d565b825115611eee5782518084602001fd5b8160405162461bcd60e51b81526004016103b591906120e6565b60608315611f74578251611f6d576001600160a01b0385163b611f6d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103b5565b5081611e36565b611e368383815115611f895781518083602001fd5b8060405162461bcd60e51b81526004016103b591906120e6565b6001600160a01b03811681146112ba57600080fd5b8035611aae81611fa3565b600060208284031215611fd557600080fd5b8135611d3d81611fa3565b80151581146112ba57600080fd5b6000806040838503121561200157600080fd5b823561200c81611fa3565b9150602083013561201c81611fe0565b809150509250929050565b6000806040838503121561203a57600080fd5b82356001600160401b038082111561205157600080fd5b908401906080828703121561206557600080fd5b9092506020840135908082111561207b57600080fd5b50830160a0818603121561201c57600080fd5b60005b838110156120a9578181015183820152602001612091565b83811115610cbd5750506000910152565b600081518084526120d281602086016020860161208e565b601f01601f19169290920160200192915050565b602081526000611d3d60208301846120ba565b60008083601f84011261210b57600080fd5b5081356001600160401b0381111561212257600080fd5b6020830191508360208260051b850101111561213d57600080fd5b9250929050565b60008060006040848603121561215957600080fd5b83356001600160401b0381111561216f57600080fd5b61217b868287016120f9565b909450925050602084013561218f81611fe0565b809150509250925092565b600080600080606085870312156121b057600080fd5b84356121bb81611fa3565b935060208501356001600160401b038111156121d657600080fd5b6121e2878288016120f9565b90945092505060408501356121f681611fa3565b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b038111828210171561223957612239612201565b60405290565b604051601f8201601f191681016001600160401b038111828210171561226757612267612201565b604052919050565b60006001600160401b0382111561228857612288612201565b5060051b60200190565b60008083601f8401126122a457600080fd5b5081356001600160401b038111156122bb57600080fd5b60208301915083602082850101111561213d57600080fd5b600080600080600080600060a0888a0312156122ee57600080fd5b87356122f981611fa3565b96506020888101356001600160401b038082111561231657600080fd5b6123228c838d016120f9565b909950975060408b013591508082111561233b57600080fd5b818b0191508b601f83011261234f57600080fd5b813561236261235d8261226f565b61223f565b81815260059190911b8301840190848101908e83111561238157600080fd5b938501935b8285101561239f57843582529385019390850190612386565b9850505060608b01359250808311156123b757600080fd5b50506123c58a828b01612292565b90945092506123d8905060808901611fb8565b905092959891949750929550565b6000806000606084860312156123fb57600080fd5b833561240681611fa3565b925060208401359150604084013561218f81611fa3565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561246457600080fd5b813563ffffffff81168114611d3d57600080fd5b60006020828403121561248a57600080fd5b813561ffff81168114611d3d57600080fd5b6000808335601e198436030181126124b357600080fd5b8301803591506001600160401b038211156124cd57600080fd5b60200191503681900382131561213d57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60ff841681526040602082015260006125286040830184866124e2565b95945050505050565b600082601f83011261254257600080fd5b81516001600160401b0381111561255b5761255b612201565b61256e601f8201601f191660200161223f565b81815284602083860101111561258357600080fd5b611e3682602083016020870161208e565b6000602082840312156125a657600080fd5b81516001600160401b038111156125bc57600080fd5b611e3684828501612531565b602081526000611d3a6020830184866124e2565b60ff861681526080602082015260006125f96080830186886124e2565b828103604084015261260b81866120ba565b9050828103606084015261261f81856120ba565b98975050505050505050565b60006020828403121561263d57600080fd5b8151611d3d81611fe0565b8183823760009101908152919050565b6001600160a01b0389811682528816602082015260c060408201819052600090612685908301888a6124e2565b82810360608401526126988187896124e2565b905082810360808401526126ac81866120ba565b905082810360a08401526126c081856120ba565b9b9a5050505050505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561270f5761270f6126e5565b5060010190565b6020808252601b908201527f4b535265736375653a20696e76616c696420726563697069656e740000000000604082015260600190565b60006020828403121561275f57600080fd5b5051919050565b6001600160a01b03888116825287811660208084019190915260a0604084018190528301879052600091906001600160fb1b038811156127a557600080fd5b8760051b9150818960c0860137600091840160c08181018481528683039091016060870152885190819052828901939160e001905b808310156127fa57845182529383019360019290920191908301906127da565b50858103608087015261280e81888a6124e2565b9d9c50505050505050505050505050565b600082601f83011261283057600080fd5b8151602061284061235d8361226f565b82815260059290921b8401810191818101908684111561285f57600080fd5b8286015b8481101561288357805161287681611fa3565b8352918301918301612863565b509695505050505050565b600082601f83011261289f57600080fd5b815160206128af61235d8361226f565b82815260059290921b840181019181810190868411156128ce57600080fd5b8286015b8481101561288357805183529183019183016128d2565b6000604082840312156128fb57600080fd5b604051604081016001600160401b03828210818311171561291e5761291e612201565b81604052829350845191508082111561293657600080fd5b6129428683870161281f565b8352602085015191508082111561295857600080fd5b506129658582860161288e565b6020830152505092915050565b60006020828403121561298457600080fd5b81516001600160401b0381111561299a57600080fd5b611e36848285016128e9565b60208082526017908201527f5a6170526f757465723a20696e76616c69642064617461000000000000000000604082015260600190565b6020808252601c908201527f5a6170526f757465723a20696e76616c6964206d73672076616c756500000000604082015260600190565b600082601f830112612a2557600080fd5b81516020612a3561235d8361226f565b82815260059290921b84018101918181019086841115612a5457600080fd5b8286015b848110156128835780516001600160401b03811115612a775760008081fd5b612a858986838b0101612531565b845250918301918301612a58565b600060208284031215612aa557600080fd5b81516001600160401b0380821115612abc57600080fd5b9083019060808286031215612ad057600080fd5b612ad8612217565b825182811115612ae757600080fd5b612af38782860161281f565b825250602083015182811115612b0857600080fd5b612b148782860161288e565b602083015250604083015182811115612b2c57600080fd5b612b388782860161288e565b604083015250606083015182811115612b5057600080fd5b612b5c87828601612a14565b60608301525095945050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090612ba5908301846120ba565b979650505050505050565b600081612bbf57612bbf6126e5565b506000190190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b60008251612c1f81846020870161208e565b919091019291505056fea26469706673582212207cc642b59637d659de0ab242cab879490c18e23064c047552748ac125cab6e7864736f6c63430008090033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ 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.