Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 470 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Route Single | 21474602 | 45 mins ago | IN | 1.1 ETH | 0.01003529 | ||||
Route Single | 21469555 | 17 hrs ago | IN | 0 ETH | 0.00303001 | ||||
Route Single | 21459702 | 2 days ago | IN | 0 ETH | 0.00397465 | ||||
Route Single | 21459657 | 2 days ago | IN | 0 ETH | 0.00107334 | ||||
Route Single | 21446690 | 3 days ago | IN | 0 ETH | 0.00500122 | ||||
Route Single | 21443026 | 4 days ago | IN | 0 ETH | 0.00613404 | ||||
Route Single | 21441430 | 4 days ago | IN | 0 ETH | 0.0016269 | ||||
Route Single | 21432311 | 5 days ago | IN | 0 ETH | 0.0191539 | ||||
Route Single | 21430102 | 6 days ago | IN | 0 ETH | 0.00496586 | ||||
Route Single | 21430066 | 6 days ago | IN | 0 ETH | 0.00490334 | ||||
Route Single | 21429455 | 6 days ago | IN | 26.95 ETH | 0.02955138 | ||||
Route Single | 21429410 | 6 days ago | IN | 27.51 ETH | 0.02682701 | ||||
Route Single | 21429330 | 6 days ago | IN | 0 ETH | 0.00270118 | ||||
Route Single | 21428138 | 6 days ago | IN | 0 ETH | 0.00222179 | ||||
Route Single | 21426910 | 6 days ago | IN | 16.29 ETH | 0.01602547 | ||||
Route Single | 21422430 | 7 days ago | IN | 0.095 ETH | 0.00661643 | ||||
Route Single | 21419834 | 7 days ago | IN | 0 ETH | 0.00241543 | ||||
Route Single | 21419730 | 7 days ago | IN | 0 ETH | 0.00595033 | ||||
Route Single | 21419684 | 7 days ago | IN | 0 ETH | 0.00250847 | ||||
Route Single | 21419667 | 7 days ago | IN | 0 ETH | 0.00712653 | ||||
Route Single | 21419601 | 7 days ago | IN | 0 ETH | 0.00613515 | ||||
Route Single | 21419481 | 7 days ago | IN | 0 ETH | 0.00558482 | ||||
Route Single | 21416381 | 8 days ago | IN | 0 ETH | 0.01098625 | ||||
Route Single | 21416319 | 8 days ago | IN | 0 ETH | 0.01213507 | ||||
Route Single | 21414537 | 8 days ago | IN | 0 ETH | 0.00328446 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
21474602 | 45 mins ago | 1.1 ETH | ||||
21435225 | 5 days ago | 0.099 ETH | ||||
21435225 | 5 days ago | 0.099 ETH | ||||
21429455 | 6 days ago | 26.95 ETH | ||||
21429410 | 6 days ago | 27.51 ETH | ||||
21426910 | 6 days ago | 16.29 ETH | ||||
21422430 | 7 days ago | 0.095 ETH | ||||
21418400 | 7 days ago | 10 ETH | ||||
21418400 | 7 days ago | 10 ETH | ||||
21418023 | 7 days ago | 0.00997 ETH | ||||
21418023 | 7 days ago | 0.00997 ETH | ||||
21409731 | 9 days ago | 0.297 ETH | ||||
21409731 | 9 days ago | 0.297 ETH | ||||
21407352 | 9 days ago | 0.025866 ETH | ||||
21405461 | 9 days ago | 0.26 ETH | ||||
21403676 | 9 days ago | 0.099 ETH | ||||
21403676 | 9 days ago | 0.099 ETH | ||||
21401078 | 10 days ago | 0.052 ETH | ||||
21397519 | 10 days ago | 0.01111771 ETH | ||||
21397519 | 10 days ago | 0.01111771 ETH | ||||
21397017 | 10 days ago | 0.099 ETH | ||||
21397017 | 10 days ago | 0.099 ETH | ||||
21395018 | 11 days ago | 0.01111771 ETH | ||||
21395018 | 11 days ago | 0.01111771 ETH | ||||
21394293 | 11 days ago | 0.01028611 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
EnsoShortcutRouter
Compiler Version
v0.8.23+commit.f704f362
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; import { EnsoShortcuts } from "./EnsoShortcuts.sol"; import { SafeERC20, IERC20 } from "openzeppelin/token/ERC20/utils/SafeERC20.sol"; struct Token { IERC20 token; uint256 amount; } contract EnsoShortcutRouter { using SafeERC20 for IERC20; IERC20 private constant _ETH = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); EnsoShortcuts public immutable enso; error WrongValue(uint256 value, uint256 amount); error AmountTooLow(address token); error Duplicate(address token); constructor(address owner_) { enso = new EnsoShortcuts(owner_, address(this)); } // @notice Route a single token via an Enso Shortcut // @param tokenIn The address of the token to send // @param amountIn The amount of the token to send // @param commands An array of bytes32 values that encode calls // @param state An array of bytes that are used to generate call data for each command function routeSingle( IERC20 tokenIn, uint256 amountIn, bytes32[] calldata commands, bytes[] calldata state ) public payable returns (bytes[] memory returnData) { if (tokenIn == _ETH) { if (msg.value != amountIn) revert WrongValue(msg.value, amountIn); } else { if (msg.value != 0) revert WrongValue(msg.value, 0); tokenIn.safeTransferFrom(msg.sender, address(enso), amountIn); } returnData = enso.executeShortcut{value: msg.value}(commands, state); } // @notice Route multiple tokens via an Enso Shortcut // @param tokensIn The addresses and amounts of the tokens to send // @param commands An array of bytes32 values that encode calls // @param state An array of bytes that are used to generate call data for each command function routeMulti( Token[] calldata tokensIn, bytes32[] calldata commands, bytes[] calldata state ) public payable returns (bytes[] memory returnData) { bool ethFlag; IERC20 tokenIn; uint256 amountIn; for (uint256 i; i < tokensIn.length; ++i) { tokenIn = tokensIn[i].token; amountIn = tokensIn[i].amount; if (tokenIn == _ETH) { if (ethFlag) revert Duplicate(address(_ETH)); ethFlag = true; if (msg.value != amountIn) revert WrongValue(msg.value, amountIn); } else { tokenIn.safeTransferFrom(msg.sender, address(enso), amountIn); } } if (!ethFlag && msg.value != 0) revert WrongValue(msg.value, 0); returnData = enso.executeShortcut{value: msg.value}(commands, state); } // @notice Route a single token via an Enso Shortcut and revert if there is insufficient token received // @param tokenIn The address of the token to send // @param tokenOut The address of the token to receive // @param amountIn The amount of the token to send // @param minAmountOut The minimum amount of the token to receive // @param receiver The address of the wallet that will receive the tokens // @param commands An array of bytes32 values that encode calls // @param state An array of bytes that are used to generate call data for each command function safeRouteSingle( IERC20 tokenIn, IERC20 tokenOut, uint256 amountIn, uint256 minAmountOut, address receiver, bytes32[] calldata commands, bytes[] calldata state ) external payable returns (bytes[] memory returnData) { uint256 balance = tokenOut == _ETH ? receiver.balance : tokenOut.balanceOf(receiver); returnData = routeSingle(tokenIn, amountIn, commands, state); uint256 amountOut; if (tokenOut == _ETH) { amountOut = receiver.balance - balance; } else { amountOut = tokenOut.balanceOf(receiver) - balance; } if (amountOut < minAmountOut) revert AmountTooLow(address(tokenOut)); } // @notice Route multiple tokens via an Enso Shortcut and revert if there is insufficient tokens received // @param tokensIn The addresses and amounts of the tokens to send // @param tokensOut The addresses and minimum amounts of the tokens to receive // @param receiver The address of the wallet that will receive the tokens // @param commands An array of bytes32 values that encode calls // @param state An array of bytes that are used to generate call data for each command function safeRouteMulti( Token[] calldata tokensIn, Token[] calldata tokensOut, address receiver, bytes32[] calldata commands, bytes[] calldata state ) external payable returns (bytes[] memory returnData) { uint256 length = tokensOut.length; uint256[] memory balances = new uint256[](length); IERC20 tokenOut; for (uint256 i; i < length; ++i) { tokenOut = tokensOut[i].token; balances[i] = tokenOut == _ETH ? receiver.balance : tokenOut.balanceOf(receiver); } returnData = routeMulti(tokensIn, commands, state); uint256 amountOut; for (uint256 i; i < length; ++i) { tokenOut = tokensOut[i].token; if (tokenOut == _ETH) { amountOut = receiver.balance - balances[i]; } else { amountOut = tokenOut.balanceOf(receiver) - balances[i]; } if (amountOut < tokensOut[i].amount) revert AmountTooLow(address(tokenOut)); } } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; import { VM } from "enso-weiroll/VM.sol"; import { MinimalWallet } from "shortcuts-contracts/wallet/MinimalWallet.sol"; import { AccessController } from "shortcuts-contracts/access/AccessController.sol"; contract EnsoShortcuts is VM, MinimalWallet, AccessController { address public executor; constructor(address owner_, address executor_) { _setPermission(OWNER_ROLE, owner_, true); executor = executor_; } // @notice Execute a shortcut // @param commands An array of bytes32 values that encode calls // @param state An array of bytes that are used to generate call data for each command function executeShortcut( bytes32[] calldata commands, bytes[] calldata state ) external payable returns (bytes[] memory) { // we could use the AccessController here to check if the msg.sender is the executor address // but as it's a hot path we do a less gas intensive check if (msg.sender != executor) revert NotPermitted(); return _execute(commands, state); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ 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: GPL-3.0-only pragma solidity ^0.8.16; import "./CommandBuilder.sol"; abstract contract VM { using CommandBuilder for bytes[]; uint256 constant FLAG_CT_DELEGATECALL = 0x00; // Delegate call not currently supported uint256 constant FLAG_CT_CALL = 0x01; uint256 constant FLAG_CT_STATICCALL = 0x02; uint256 constant FLAG_CT_VALUECALL = 0x03; uint256 constant FLAG_CT_MASK = 0x03; uint256 constant FLAG_DATA = 0x20; uint256 constant FLAG_EXTENDED_COMMAND = 0x40; uint256 constant FLAG_TUPLE_RETURN = 0x80; uint256 constant SHORT_COMMAND_FILL = 0x000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; error ExecutionFailed( uint256 command_index, address target, string message ); function _execute(bytes32[] calldata commands, bytes[] memory state) internal returns (bytes[] memory) { bytes32 command; uint256 flags; bytes32 indices; bool success; bytes memory outData; uint256 commandsLength = commands.length; uint256 indicesLength; for (uint256 i; i < commandsLength; i = _uncheckedIncrement(i)) { command = commands[i]; flags = uint256(uint8(bytes1(command << 32))); if (flags & FLAG_EXTENDED_COMMAND != 0) { i = _uncheckedIncrement(i); indices = commands[i]; indicesLength = 32; } else { indices = bytes32(uint256(command << 40) | SHORT_COMMAND_FILL); indicesLength = 6; } if (flags & FLAG_CT_MASK == FLAG_CT_CALL) { (success, outData) = address(uint160(uint256(command))).call( // target // inputs flags & FLAG_DATA == 0 ? state.buildInputs( bytes4(command), // selector indices, indicesLength ) : state[ uint8(bytes1(indices)) & CommandBuilder.IDX_VALUE_MASK ] ); } else if (flags & FLAG_CT_MASK == FLAG_CT_STATICCALL) { (success, outData) = address(uint160(uint256(command))) // target .staticcall( // inputs flags & FLAG_DATA == 0 ? state.buildInputs( bytes4(command), // selector indices, indicesLength ) : state[ uint8(bytes1(indices)) & CommandBuilder.IDX_VALUE_MASK ] ); } else if (flags & FLAG_CT_MASK == FLAG_CT_VALUECALL) { bytes memory v = state[ uint8(bytes1(indices)) & CommandBuilder.IDX_VALUE_MASK ]; require(v.length == 32, "Value must be 32 bytes"); uint256 callEth = uint256(bytes32(v)); (success, outData) = address(uint160(uint256(command))).call{ // target value: callEth }( // inputs flags & FLAG_DATA == 0 ? state.buildInputs( bytes4(command), // selector indices << 8, // skip value input indicesLength - 1 // max indices length reduced by value input ) : state[ uint8(bytes1(indices << 8)) & // first byte after value input CommandBuilder.IDX_VALUE_MASK ] ); } else { revert("Invalid calltype"); } if (!success) { string memory message = "Unknown"; if (outData.length > 68) { // This might be an error message, parse the outData // Estimate the bytes length of the possible error message uint256 estimatedLength = _estimateBytesLength(outData, 68); // Remove selector. First 32 bytes should be a pointer that indicates the start of data in memory assembly { outData := add(outData, 4) } uint256 pointer = uint256(bytes32(outData)); if (pointer == 32) { // Remove pointer. If it is a string, the next 32 bytes will hold the size assembly { outData := add(outData, 32) } uint256 size = uint256(bytes32(outData)); // If the size variable is the same as the estimated bytes length, we can be fairly certain // this is a dynamic string, so convert the bytes to a string and emit the message. While an // error function with 3 static parameters is capable of producing a similar output, there is // low risk of a contract unintentionally emitting a message. if (size == estimatedLength) { // Remove size. The remaining data should be the string content assembly { outData := add(outData, 32) } message = string(outData); } } } revert ExecutionFailed({ command_index: flags & FLAG_EXTENDED_COMMAND == 0 ? i : i - 1, target: address(uint160(uint256(command))), message: message }); } if (flags & FLAG_TUPLE_RETURN != 0) { state.writeTuple(bytes1(command << 88), outData); } else { state = state.writeOutputs(bytes1(command << 88), outData); } } return state; } function _estimateBytesLength(bytes memory data, uint256 pos) internal pure returns (uint256 estimate) { uint256 length = data.length; estimate = length - pos; // Assume length equals alloted space for (uint256 i = pos; i < length; ) { if (data[i] == 0) { // Zero bytes found, adjust estimated length estimate = i - pos; break; } unchecked { ++i; } } } function _uncheckedIncrement(uint256 i) private pure returns (uint256) { unchecked { ++i; } return i; } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.16; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import "../access/ACL.sol"; import "../access/Roles.sol"; contract MinimalWallet is ACL, Roles, ERC721Holder, ERC1155Holder { using SafeERC20 for IERC20; enum Protocol { ETH, ERC20, ERC721, ERC1155 } struct TransferNote { Protocol protocol; address token; uint256[] ids; uint256[] amounts; } struct ApprovalNote { Protocol protocol; address token; address[] operators; } error WithdrawFailed(); error InvalidArrayLength(); //////////////////////////////////////////////////// // External functions ////////////////////////////// //////////////////////////////////////////////////// // @notice Withdraw an array of assets // @dev Works for ETH, ERC20s, ERC721s, and ERC1155s // @param notes A tuple that contains the protocol id, token address, array of ids and amounts function withdraw(TransferNote[] calldata notes) external isPermitted(OWNER_ROLE) { TransferNote memory note; Protocol protocol; uint256[] memory ids; uint256[] memory amounts; uint256 length = notes.length; for (uint256 i; i < length; ) { note = notes[i]; protocol = note.protocol; if (protocol == Protocol.ETH) { amounts = note.amounts; if (amounts.length != 1) revert InvalidArrayLength(); _withdrawETH(amounts[0]); } else if (protocol == Protocol.ERC20) { amounts = note.amounts; if (amounts.length != 1) revert InvalidArrayLength(); _withdrawERC20(IERC20(note.token), amounts[0]); } else if (protocol == Protocol.ERC721) { ids = note.ids; _withdrawERC721s(IERC721(note.token), ids); } else if (protocol == Protocol.ERC1155) { ids = note.ids; amounts = note.amounts; _withdrawERC1155s(IERC1155(note.token), ids, amounts); } unchecked { ++i; } } } // @notice Withdraw ETH from this contract to the msg.sender // @param amount The amount of ETH to be withdrawn function withdrawETH(uint256 amount) external isPermitted(OWNER_ROLE) { _withdrawETH(amount); } // @notice Withdraw ERC20s // @param erc20s An array of erc20 addresses // @param amounts An array of amounts for each erc20 function withdrawERC20s( IERC20[] calldata erc20s, uint256[] calldata amounts ) external isPermitted(OWNER_ROLE) { uint256 length = erc20s.length; if (amounts.length != length) revert InvalidArrayLength(); for (uint256 i; i < length; ) { _withdrawERC20(erc20s[i], amounts[i]); unchecked { ++i; } } } // @notice Withdraw multiple ERC721 ids for a single ERC721 contract // @param erc721 The address of the ERC721 contract // @param ids An array of ids that are to be withdrawn function withdrawERC721s( IERC721 erc721, uint256[] calldata ids ) external isPermitted(OWNER_ROLE) { _withdrawERC721s(erc721, ids); } // @notice Withdraw multiple ERC1155 ids for a single ERC1155 contract // @param erc1155 The address of the ERC155 contract // @param ids An array of ids that are to be withdrawn // @param amounts An array of amounts per id function withdrawERC1155s( IERC1155 erc1155, uint256[] calldata ids, uint256[] calldata amounts ) external isPermitted(OWNER_ROLE) { _withdrawERC1155s(erc1155, ids, amounts); } // @notice Revoke approval on an array of assets and operators // @dev Works for ERC20s, ERC721s, and ERC1155s // @param notes A tuple that contains the protocol id, token address, and array of operators function revokeApprovals(ApprovalNote[] calldata notes) external isPermitted(OWNER_ROLE) { ApprovalNote memory note; Protocol protocol; uint256 length = notes.length; for (uint256 i; i < length; ) { note = notes[i]; protocol = note.protocol; if (protocol == Protocol.ERC20) { _revokeERC20Approvals(IERC20(note.token), note.operators); } else if (protocol == Protocol.ERC721) { _revokeERC721Approvals(IERC721(note.token), note.operators); } else if (protocol == Protocol.ERC1155) { _revokeERC1155Approvals(IERC1155(note.token), note.operators); } unchecked { ++i; } } } // @notice Revoke approval of an ERC20 for an array of operators // @param erc20 The address of the ERC20 token // @param operators The array of operators to have approval revoked function revokeERC20Approvals( IERC20 erc20, address[] calldata operators ) external isPermitted(OWNER_ROLE) { _revokeERC20Approvals(erc20, operators); } // @notice Revoke approval of an ERC721 for an array of operators // @param erc721 The address of the ERC721 token // @param operators The array of operators to have approval revoked function revokeERC721Approvals( IERC721 erc721, address[] calldata operators ) external isPermitted(OWNER_ROLE) { _revokeERC721Approvals(erc721, operators); } // @notice Revoke approval of an ERC1155 for an array of operators // @param erc1155 The address of the ERC1155 token // @param operators The array of operators to have approval revoked function revokeERC1155Approvals( IERC1155 erc1155, address[] calldata operators ) external isPermitted(OWNER_ROLE) { _revokeERC1155Approvals(erc1155, operators); } //////////////////////////////////////////////////// // Internal functions ////////////////////////////// //////////////////////////////////////////////////// function _withdrawETH(uint256 amount) internal { (bool success, ) = msg.sender.call{value: amount}(""); if (!success) revert WithdrawFailed(); } function _withdrawERC20(IERC20 erc20, uint256 amount) internal { erc20.safeTransfer(msg.sender, amount); } function _withdrawERC721s(IERC721 erc721, uint256[] memory ids) internal { uint256 length = ids.length; for (uint256 i; i < length; ) { erc721.safeTransferFrom(address(this), msg.sender, ids[i]); unchecked { ++i; } } } function _withdrawERC1155s(IERC1155 erc1155, uint256[] memory ids, uint256[] memory amounts) internal { // safeBatchTransferFrom will validate the array lengths erc1155.safeBatchTransferFrom(address(this), msg.sender, ids, amounts, ""); } function _revokeERC20Approvals(IERC20 erc20, address[] memory operators) internal { uint256 length = operators.length; for (uint256 i; i < length; ) { erc20.safeApprove(operators[i], 0); unchecked { ++i; } } } function _revokeERC721Approvals(IERC721 erc721, address[] memory operators) internal { uint256 length = operators.length; for (uint256 i; i < length; ) { erc721.setApprovalForAll(operators[i], false); unchecked { ++i; } } } function _revokeERC1155Approvals(IERC1155 erc1155, address[] memory operators) internal { uint256 length = operators.length; for (uint256 i; i < length; ) { erc1155.setApprovalForAll(operators[i], false); unchecked { ++i; } } } //////////////////////////////////////////////////// // Fallback functions ////////////////////////////// //////////////////////////////////////////////////// receive() external payable {} }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.16; import "./ACL.sol"; import "./Roles.sol"; // @notice The OWNER_ROLE must be set in the importing contract's constructor or initialize function abstract contract AccessController is ACL, Roles { using StorageAPI for bytes32; event PermissionSet(bytes32 role, address account, bool permission); error UnsafeSetting(); error InvalidAccount(); // @notice Sets user permission over a role // @param role The bytes32 value of the role // @param account The address of the account // @param permission The permission status function setPermission( bytes32 role, address account, bool permission ) external isPermitted(OWNER_ROLE) { if (account == address(0)) revert InvalidAccount(); if (role == OWNER_ROLE && account == msg.sender && permission == false) revert UnsafeSetting(); _setPermission(role, account, permission); } // @notice Internal function to set user permission over a role // @param role The bytes32 value of the role // @param account The address of the account // @param permission The permission status function _setPermission(bytes32 role, address account, bool permission) internal { bytes32 key = _getKey(role, account); key.setBool(permission); emit PermissionSet(role, account, permission); } }
// 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.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: GPL-3.0-only pragma solidity ^0.8.16; library CommandBuilder { uint256 constant IDX_VARIABLE_LENGTH = 0x80; uint256 constant IDX_VALUE_MASK = 0x7f; uint256 constant IDX_END_OF_ARGS = 0xff; uint256 constant IDX_USE_STATE = 0xfe; uint256 constant IDX_ARRAY_START = 0xfd; uint256 constant IDX_TUPLE_START = 0xfc; uint256 constant IDX_DYNAMIC_END = 0xfb; function buildInputs( bytes[] memory state, bytes4 selector, bytes32 indices, uint256 indicesLength ) internal view returns (bytes memory ret) { uint256 idx; // The current command index uint256 offsetIdx; // The index of the current free offset uint256 count; // Number of bytes in whole ABI encoded message uint256 free; // Pointer to first free byte in tail part of message uint256[] memory dynamicLengths = new uint256[](10); // Optionally store the length of all dynamic types (a command cannot fit more than 10 dynamic types) bytes memory stateData; // Optionally encode the current state if the call requires it // Determine the length of the encoded data for (uint256 i; i < indicesLength; ) { idx = uint8(indices[i]); if (idx == IDX_END_OF_ARGS) { indicesLength = i; break; } if (idx & IDX_VARIABLE_LENGTH != 0) { if (idx == IDX_USE_STATE) { if (stateData.length == 0) { stateData = abi.encode(state); } unchecked { count += stateData.length; } } else { (dynamicLengths, offsetIdx, count, i) = setupDynamicType( state, indices, dynamicLengths, idx, offsetIdx, count, i ); } } else { count = setupStaticVariable(state, count, idx); } unchecked { free += 32; ++i; } } // Encode it ret = new bytes(count + 4); assembly { mstore(add(ret, 32), selector) } offsetIdx = 0; // Use count to track current memory slot assembly { count := add(ret, 36) } for (uint256 i; i < indicesLength; ) { idx = uint8(indices[i]); if (idx & IDX_VARIABLE_LENGTH != 0) { if (idx == IDX_USE_STATE) { assembly { mstore(count, free) } memcpy(stateData, 32, ret, free + 4, stateData.length - 32); unchecked { free += stateData.length - 32; } } else if (idx == IDX_ARRAY_START) { // Start of dynamic type, put pointer in current slot assembly { mstore(count, free) } (offsetIdx, free, i, ) = encodeDynamicArray( ret, state, indices, dynamicLengths, offsetIdx, free, i ); } else if (idx == IDX_TUPLE_START) { // Start of dynamic type, put pointer in current slot assembly { mstore(count, free) } (offsetIdx, free, i, ) = encodeDynamicTuple( ret, state, indices, dynamicLengths, offsetIdx, free, i ); } else { // Variable length data uint256 argLen = state[idx & IDX_VALUE_MASK].length; // Put a pointer in the current slot and write the data to first free slot assembly { mstore(count, free) } memcpy( state[idx & IDX_VALUE_MASK], 0, ret, free + 4, argLen ); unchecked { free += argLen; } } } else { // Fixed length data (length previously checked to be 32 bytes) bytes memory stateVar = state[idx & IDX_VALUE_MASK]; // Write the data to current slot assembly { mstore(count, mload(add(stateVar, 32))) } } unchecked { count += 32; ++i; } } } function setupStaticVariable( bytes[] memory state, uint256 count, uint256 idx ) internal pure returns (uint256 newCount) { require( state[idx & IDX_VALUE_MASK].length == 32, "Static state variables must be 32 bytes" ); unchecked { newCount = count + 32; } } function setupDynamicVariable( bytes[] memory state, uint256 count, uint256 idx ) internal pure returns (uint256 newCount) { bytes memory arg = state[idx & IDX_VALUE_MASK]; // Validate the length of the data in state is a multiple of 32 uint256 argLen = arg.length; require( argLen != 0 && argLen % 32 == 0, "Dynamic state variables must be a multiple of 32 bytes" ); // Add the length of the value, rounded up to the next word boundary, plus space for pointer unchecked { newCount = count + argLen + 32; } } function setupDynamicType( bytes[] memory state, bytes32 indices, uint256[] memory dynamicLengths, uint256 idx, uint256 offsetIdx, uint256 count, uint256 index ) internal view returns ( uint256[] memory newDynamicLengths, uint256 newOffsetIdx, uint256 newCount, uint256 newIndex ) { if (idx == IDX_ARRAY_START) { (newDynamicLengths, newOffsetIdx, newCount, newIndex) = setupDynamicArray( state, indices, dynamicLengths, offsetIdx, count, index ); } else if (idx == IDX_TUPLE_START) { (newDynamicLengths, newOffsetIdx, newCount, newIndex) = setupDynamicTuple( state, indices, dynamicLengths, offsetIdx, count, index ); } else { newDynamicLengths = dynamicLengths; newOffsetIdx = offsetIdx; newIndex = index; newCount = setupDynamicVariable(state, count, idx); } } function setupDynamicArray( bytes[] memory state, bytes32 indices, uint256[] memory dynamicLengths, uint256 offsetIdx, uint256 count, uint256 index ) internal view returns ( uint256[] memory newDynamicLengths, uint256 newOffsetIdx, uint256 newCount, uint256 newIndex ) { // Current idx is IDX_ARRAY_START, next idx will contain the array length unchecked { newIndex = index + 1; newCount = count + 32; } uint256 idx = uint8(indices[newIndex]); require( state[idx & IDX_VALUE_MASK].length == 32, "Array length must be 32 bytes" ); (newDynamicLengths, newOffsetIdx, newCount, newIndex) = setupDynamicTuple( state, indices, dynamicLengths, offsetIdx, newCount, newIndex ); } function setupDynamicTuple( bytes[] memory state, bytes32 indices, uint256[] memory dynamicLengths, uint256 offsetIdx, uint256 count, uint256 index ) internal view returns ( uint256[] memory newDynamicLengths, uint256 newOffsetIdx, uint256 newCount, uint256 newIndex ) { uint256 idx; uint256 offset; newDynamicLengths = dynamicLengths; // Progress to first index of the data and progress the next offset idx unchecked { newIndex = index + 1; newOffsetIdx = offsetIdx + 1; newCount = count + 32; } while (newIndex < 32) { idx = uint8(indices[newIndex]); if (idx & IDX_VARIABLE_LENGTH != 0) { if (idx == IDX_DYNAMIC_END) { newDynamicLengths[offsetIdx] = offset; // explicit return saves gas ¯\_(ツ)_/¯ return (newDynamicLengths, newOffsetIdx, newCount, newIndex); } else { require(idx != IDX_USE_STATE, "Cannot use state from inside dynamic type"); (newDynamicLengths, newOffsetIdx, newCount, newIndex) = setupDynamicType( state, indices, newDynamicLengths, idx, newOffsetIdx, newCount, newIndex ); } } else { newCount = setupStaticVariable(state, newCount, idx); } unchecked { offset += 32; ++newIndex; } } revert("Dynamic type was not properly closed"); } function encodeDynamicArray( bytes memory ret, bytes[] memory state, bytes32 indices, uint256[] memory dynamicLengths, uint256 offsetIdx, uint256 currentSlot, uint256 index ) internal view returns ( uint256 newOffsetIdx, uint256 newSlot, uint256 newIndex, uint256 length ) { // Progress to array length metadata unchecked { newIndex = index + 1; newSlot = currentSlot + 32; } // Encode array length uint256 idx = uint8(indices[newIndex]); // Array length value previously checked to be 32 bytes bytes memory stateVar = state[idx & IDX_VALUE_MASK]; assembly { mstore(add(add(ret, 36), currentSlot), mload(add(stateVar, 32))) } (newOffsetIdx, newSlot, newIndex, length) = encodeDynamicTuple( ret, state, indices, dynamicLengths, offsetIdx, newSlot, newIndex ); unchecked { length += 32; // Increase length to account for array length metadata } } function encodeDynamicTuple( bytes memory ret, bytes[] memory state, bytes32 indices, uint256[] memory dynamicLengths, uint256 offsetIdx, uint256 currentSlot, uint256 index ) internal view returns ( uint256 newOffsetIdx, uint256 newSlot, uint256 newIndex, uint256 length ) { uint256 idx; uint256 argLen; uint256 freePointer = dynamicLengths[offsetIdx]; // The pointer to the next free slot unchecked { newSlot = currentSlot + freePointer; // Update the next slot newOffsetIdx = offsetIdx + 1; // Progress to next offsetIdx newIndex = index + 1; // Progress to first index of the data } // Shift currentSlot to correct location in memory assembly { currentSlot := add(add(ret, 36), currentSlot) } while (newIndex < 32) { idx = uint8(indices[newIndex]); if (idx & IDX_VARIABLE_LENGTH != 0) { if (idx == IDX_DYNAMIC_END) { break; } else if (idx == IDX_ARRAY_START) { // Start of dynamic type, put pointer in current slot assembly { mstore(currentSlot, freePointer) } (newOffsetIdx, newSlot, newIndex, argLen) = encodeDynamicArray( ret, state, indices, dynamicLengths, newOffsetIdx, newSlot, newIndex ); unchecked { freePointer += argLen; length += (argLen + 32); // data + pointer } } else if (idx == IDX_TUPLE_START) { // Start of dynamic type, put pointer in current slot assembly { mstore(currentSlot, freePointer) } (newOffsetIdx, newSlot, newIndex, argLen) = encodeDynamicTuple( ret, state, indices, dynamicLengths, newOffsetIdx, newSlot, newIndex ); unchecked { freePointer += argLen; length += (argLen + 32); // data + pointer } } else { // Variable length data argLen = state[idx & IDX_VALUE_MASK].length; // Start of dynamic type, put pointer in current slot assembly { mstore(currentSlot, freePointer) } memcpy( state[idx & IDX_VALUE_MASK], 0, ret, newSlot + 4, argLen ); unchecked { newSlot += argLen; freePointer += argLen; length += (argLen + 32); // data + pointer } } } else { // Fixed length data (length previously checked to be 32 bytes) bytes memory stateVar = state[idx & IDX_VALUE_MASK]; // Write to first free slot assembly { mstore(currentSlot, mload(add(stateVar, 32))) } unchecked { length += 32; } } unchecked { currentSlot += 32; ++newIndex; } } } function writeOutputs( bytes[] memory state, bytes1 index, bytes memory output ) internal pure returns (bytes[] memory) { uint256 idx = uint8(index); if (idx == IDX_END_OF_ARGS) return state; if (idx & IDX_VARIABLE_LENGTH != 0) { if (idx == IDX_USE_STATE) { state = abi.decode(output, (bytes[])); } else { require(idx & IDX_VALUE_MASK < state.length, "Index out-of-bounds"); // Check the first field is 0x20 (because we have only a single return value) uint256 argPtr; assembly { argPtr := mload(add(output, 32)) } require( argPtr == 32, "Only one return value permitted (variable)" ); assembly { // Overwrite the first word of the return data with the length - 32 mstore(add(output, 32), sub(mload(output), 32)) // Insert a pointer to the return data, starting at the second word, into state mstore( add(add(state, 32), mul(and(idx, IDX_VALUE_MASK), 32)), add(output, 32) ) } } } else { require(idx & IDX_VALUE_MASK < state.length, "Index out-of-bounds"); // Single word require( output.length == 32, "Only one return value permitted (static)" ); state[idx & IDX_VALUE_MASK] = output; } return state; } function writeTuple( bytes[] memory state, bytes1 index, bytes memory output ) internal view { uint256 idx = uint8(index); if (idx == IDX_END_OF_ARGS) return; bytes memory entry = state[idx & IDX_VALUE_MASK] = new bytes(output.length + 32); memcpy(output, 0, entry, 32, output.length); assembly { let l := mload(output) mstore(add(entry, 32), l) } } function memcpy( bytes memory src, uint256 srcIdx, bytes memory dest, uint256 destIdx, uint256 len ) internal view { assembly { pop( staticcall( gas(), 4, add(add(src, 32), srcIdx), len, add(add(dest, 32), destIdx), len ) ) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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.7.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 // OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol) pragma solidity ^0.8.0; import "../IERC721Receiver.sol"; /** * @dev Implementation of the {IERC721Receiver} interface. * * Accepts all token transfers. * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. */ contract ERC721Holder is IERC721Receiver { /** * @dev See {IERC721Receiver-onERC721Received}. * * Always returns `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address, address, uint256, bytes memory ) public virtual override returns (bytes4) { return this.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol) pragma solidity ^0.8.0; import "./ERC1155Receiver.sol"; /** * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens. * * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be * stuck. * * @dev _Available since v3.1._ */ contract ERC1155Holder is ERC1155Receiver { function onERC1155Received( address, address, uint256, uint256, bytes memory ) public virtual override returns (bytes4) { return this.onERC1155Received.selector; } function onERC1155BatchReceived( address, address, uint256[] memory, uint256[] memory, bytes memory ) public virtual override returns (bytes4) { return this.onERC1155BatchReceived.selector; } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.16; import "../libraries/StorageAPI.sol"; abstract contract ACL { using StorageAPI for bytes32; error NotPermitted(); modifier isPermitted(bytes32 role) { bool permitted = _getPermission(role, msg.sender); // TODO: support GSN/Account abstraction if (!permitted) revert NotPermitted(); _; } // @notice Gets user permission for a role // @param role The bytes32 value of the role // @param account The address of the account // @return The permission status function getPermission(bytes32 role, address account) external view returns (bool) { return _getPermission(role, account); } // @notice Internal function to get user permission for a role // @param role The bytes32 value of the role // @param account The address of the account // @return The permission status function _getPermission(bytes32 role, address account) internal view returns (bool) { bytes32 key = _getKey(role, account); return key.getBool(); } // @notice Internal function to get the key for the storage slot // @param role The bytes32 value of the role // @param account The address of the account // @return The bytes32 storage slot function _getKey(bytes32 role, address account) internal pure returns (bytes32) { return keccak256(abi.encode(role, account)); } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.16; abstract contract Roles { // Using same slot generation technique as eip-1967 -- https://eips.ethereum.org/EIPS/eip-1967 bytes32 public constant OWNER_ROLE = bytes32(uint256(keccak256("enso.access.roles.owner")) - 1); bytes32 public constant EXECUTOR_ROLE = bytes32(uint256(keccak256("enso.access.roles.executor")) - 1); bytes32 public constant MODULE_ROLE = bytes32(uint256(keccak256("enso.access.roles.module")) - 1); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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 // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol) pragma solidity ^0.8.0; import "../IERC1155Receiver.sol"; import "../../../utils/introspection/ERC165.sol"; /** * @dev _Available since v3.1._ */ abstract contract ERC1155Receiver is ERC165, IERC1155Receiver { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.16; library StorageAPI { function setBytes(bytes32 key, bytes memory data) internal { bytes32 slot = keccak256(abi.encodePacked(key)); assembly { let length := mload(data) switch gt(length, 0x1F) case 0x00 { sstore(key, or(mload(add(data, 0x20)), mul(length, 2))) } case 0x01 { sstore(key, add(mul(length, 2), 1)) for { let i := 0 } lt(mul(i, 0x20), length) { i := add(i, 0x01) } { sstore(add(slot, i), mload(add(data, mul(add(i, 1), 0x20)))) } } } } function setBytes32(bytes32 key, bytes32 val) internal { assembly { sstore(key, val) } } function setAddress(bytes32 key, address a) internal { assembly { sstore(key, a) } } function setUint256(bytes32 key, uint256 val) internal { assembly { sstore(key, val) } } function setInt256(bytes32 key, int256 val) internal { assembly { sstore(key, val) } } function setBool(bytes32 key, bool val) internal { assembly { sstore(key, val) } } function getBytes(bytes32 key) internal view returns (bytes memory data) { bytes32 slot = keccak256(abi.encodePacked(key)); assembly { let length := sload(key) switch and(length, 0x01) case 0x00 { let decodedLength := div(and(length, 0xFF), 2) mstore(data, decodedLength) mstore(add(data, 0x20), and(length, not(0xFF))) mstore(0x40, add(data, 0x40)) } case 0x01 { let decodedLength := div(length, 2) let i := 0 mstore(data, decodedLength) for { } lt(mul(i, 0x20), decodedLength) { i := add(i, 0x01) } { mstore(add(add(data, 0x20), mul(i, 0x20)), sload(add(slot, i))) } mstore(0x40, add(data, add(0x20, mul(i, 0x20)))) } } } function getBytes32(bytes32 key) internal view returns (bytes32 val) { assembly { val := sload(key) } } function getAddress(bytes32 key) internal view returns (address a) { assembly { a := sload(key) } } function getUint256(bytes32 key) internal view returns (uint256 val) { assembly { val := sload(key) } } function getInt256(bytes32 key) internal view returns (int256 val) { assembly { val := sload(key) } } function getBool(bytes32 key) internal view returns (bool val) { assembly { val := sload(key) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
{ "remappings": [ "@ensdomains/=lib/shortcuts-contracts/node_modules/@ensdomains/", "@ensofinance/=lib/shortcuts-contracts/node_modules/@ensofinance/", "@openzeppelin/=lib/shortcuts-contracts/node_modules/@openzeppelin/", "@rari-capital/=lib/shortcuts-contracts/node_modules/@rari-capital/", "clones-with-immutable-args/=lib/shortcuts-contracts/node_modules/clones-with-immutable-args/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "eth-gas-reporter/=lib/shortcuts-contracts/node_modules/eth-gas-reporter/", "forge-std/=lib/forge-std/src/", "hardhat-deploy/=lib/shortcuts-contracts/node_modules/hardhat-deploy/", "hardhat/=lib/shortcuts-contracts/node_modules/hardhat/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/", "shortcuts-contracts/=lib/shortcuts-contracts/contracts/", "@ethereum-waffle/=lib/shortcuts-contracts/node_modules/@ethereum-waffle/", "enso-weiroll/=lib/enso-weiroll/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"AmountTooLow","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"Duplicate","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WrongValue","type":"error"},{"inputs":[],"name":"enso","outputs":[{"internalType":"contract EnsoShortcuts","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Token[]","name":"tokensIn","type":"tuple[]"},{"internalType":"bytes32[]","name":"commands","type":"bytes32[]"},{"internalType":"bytes[]","name":"state","type":"bytes[]"}],"name":"routeMulti","outputs":[{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"bytes32[]","name":"commands","type":"bytes32[]"},{"internalType":"bytes[]","name":"state","type":"bytes[]"}],"name":"routeSingle","outputs":[{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Token[]","name":"tokensIn","type":"tuple[]"},{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Token[]","name":"tokensOut","type":"tuple[]"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bytes32[]","name":"commands","type":"bytes32[]"},{"internalType":"bytes[]","name":"state","type":"bytes[]"}],"name":"safeRouteMulti","outputs":[{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"contract IERC20","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bytes32[]","name":"commands","type":"bytes32[]"},{"internalType":"bytes[]","name":"state","type":"bytes[]"}],"name":"safeRouteSingle","outputs":[{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"payable","type":"function"}]
Contract Creation Code
60a0346100e0576001600160401b0390601f6133de38819003918201601f1916830191848311848410176100ca578084926020946040528339810103126100e057516001600160a01b038116908190036100e0576040519161249690818401908111848210176100ca576040928492610f48843981523060208201520301906000f080156100be57608052604051610e6290816100e6823960805181818161032f0152818161099e01528181610ac701528181610b790152610bdf0152f35b6040513d6000823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b600080fdfe6080604052600436101561001257600080fd5b60003560e01c8063083001ba146105725780630a512416146103cb578063b35d7e731461035e578063ce40c7cd146103195763da1a5f421461005357600080fd5b60a036600319011261023e5767ffffffffffffffff60043581811161023e576100809036906004016105e4565b909160243581811161023e5761009a9036906004016105e4565b9290916044356001600160a01b038116900361023e5760643581811161023e576100c8903690600401610615565b9160843590811161023e576100e1903690600401610615565b9290916100ed8761077a565b946100fb6040519687610742565b8786526101078861077a565b601f190136602088013760005b888110610257575061012895969798610959565b9160005b8481106101455760405180610141868261068e565b0390f35b6001600160a01b0361016061015b838886610708565b61072e565b1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81036101c9576101946044353161018d8487610c0c565b5190610af4565b60206101a1848987610708565b0135116101b1575060010161012c565b60249060405190636d53e03360e11b82526004820152fd5b6040516370a0823160e01b81526044356001600160a01b03166004820152602081602481855afa801561024b57600090610212575b61020d915061018d8487610c0c565b610194565b506020813d602011610243575b8161022c60209383610742565b8101031261023e5761020d90516101fe565b600080fd5b3d915061021f565b6040513d6000823e3d90fd5b6001600160a01b0361026d61015b838c8c610708565b169073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee82036102a45760019150604435315b61029d828a610c0c565b5201610114565b6040516370a0823160e01b81526044356001600160a01b0316600482015291602090839060249082905afa801561024b576000906102e6575b60019250610293565b506020823d602011610311575b8161030060209383610742565b8101031261023e57600191516102dd565b3d91506102f3565b3461023e57600036600319011261023e576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b608036600319011261023e576103726106f2565b67ffffffffffffffff60443581811161023e57610393903690600401610615565b9260643592831161023e57610141936103b36103bf943690600401610615565b93909260243590610b17565b6040519182918261068e565b60e036600319011261023e576103df6106f2565b6001600160a01b0390602435828116919082900361023e576084359283169081840361023e5767ffffffffffffffff9360a43585811161023e57610427903690600401610615565b9560c43590811161023e57610440903690600401610615565b9073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8714978860001461050757610472938531965b60443590610b17565b941561049957610483925031610af4565b606435116101b15760405180610141848261068e565b50604051916370a0823160e01b83526004830152602082602481865afa801561024b576000906104d3575b6104ce9250610af4565b610483565b506020823d6020116104ff575b816104ed60209383610742565b8101031261023e576104ce91516104c4565b3d91506104e0565b6040516370a0823160e01b815260048101889052936020856024818c5afa801561024b5760009061053e575b610472955096610469565b506020853d60201161056a575b8161055860209383610742565b8101031261023e576104729451610533565b3d915061054b565b606036600319011261023e5767ffffffffffffffff60043581811161023e5761059f9036906004016105e4565b60249291923582811161023e576105ba903690600401610615565b60449491943593841161023e57610141946105dc6103bf953690600401610615565b949093610959565b9181601f8401121561023e5782359167ffffffffffffffff831161023e576020808501948460061b01011161023e57565b9181601f8401121561023e5782359167ffffffffffffffff831161023e576020808501948460051b01011161023e57565b60005b8381106106595750506000910152565b8181015183820152602001610649565b9060209161068281518092818552858086019101610646565b601f01601f1916010190565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b8483106106c45750505050505090565b90919293949584806106e2600193603f198682030187528a51610669565b98019301930191949392906106b4565b600435906001600160a01b038216820361023e57565b91908110156107185760061b0190565b634e487b7160e01b600052603260045260246000fd5b356001600160a01b038116810361023e5790565b90601f8019910116810190811067ffffffffffffffff82111761076457604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff81116107645760051b60200190565b67ffffffffffffffff811161076457601f01601f191660200190565b602090818184031261023e57805167ffffffffffffffff9182821161023e57019083601f8301121561023e5781516107e58161077a565b946040926107f66040519788610742565b828752858088019360051b8601019482861161023e57868101935b86851061082357505050505050505090565b845183811161023e5782019084603f8301121561023e57888201519061084882610792565b61085489519182610742565b8281528689848601011161023e576108758b949385948b8685019101610646565b815201940193610811565b60408082528101839052929392916001600160fb1b03811161023e576005949392941b8091606086013783019281606085016020928360608289030191015252608084019360808360051b82010194846000925b8584106108e5575050505050505090565b90919293949596607f198282030184528735601e198436030181121561023e57830186810191903567ffffffffffffffff811161023e57803603831361023e5787828280600196849695859652848401376000828201840152601f01601f19160101990197969591909101930191906108d4565b9094939460009160005b828110610a22575050501580610a19575b6109fa576109996000936040519586948594633f6c27cf60e21b865260048601610880565b0381347f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af190811561024b576000916109da575090565b6109f791503d806000833e6109ef8183610742565b8101906107ae565b90565b60405163195a3ca160e01b815234600482015260006024820152604490fd5b50341515610974565b610a3061015b828585610708565b6020610a3d838686610708565b01359473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee916001600160a01b038082168403610ab9575050610aa15750600193803403610a8357506001905b01610963565b6044906040519063195a3ca160e01b82523460048301526024820152fd5b6024906040519063255f45bb60e21b82526004820152fd5b600194935090610aef9297917f000000000000000000000000000000000000000000000000000000000000000016903390610c20565b610a7d565b91908203918211610b0157565b634e487b7160e01b600052601160045260246000fd5b90959493926001600160a01b0392909183811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee03610bcc5750863403610bad576000949596505b610b7360405196879586948594633f6c27cf60e21b865260048601610880565b039134907f0000000000000000000000000000000000000000000000000000000000000000165af190811561024b576000916109da575090565b60405163195a3ca160e01b815234600482015260248101889052604490fd5b96949596346109fa57600095610c0791857f000000000000000000000000000000000000000000000000000000000000000016903390610c20565b610b53565b80518210156107185760209160051b010190565b6040516323b872dd60e01b60208083019182526001600160a01b039485166024840152948416604483015260648083019690965294815292939267ffffffffffffffff9260a08201928484118385101761076457169060e08101938385109085111761076457610cee936040528583527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c0820152600080958192519082855af13d15610d8b573d91610cd383610792565b92610ce16040519485610742565b83523d868885013e610d8f565b805191821591848315610d60575b505050905015610d095750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b919381809450010312610d8757820151908115158203610d84575080388084610cfc565b80fd5b5080fd5b6060915b91929015610df15750815115610da3575090565b3b15610dac5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610e045750805190602001fd5b60405162461bcd60e51b815260206004820152908190610e28906024830190610669565b0390fdfea26469706673582212204dbe6f58fa7ade9b294f0f6da7fca827503fda6075ce5d3ae3b452de561be01e64736f6c63430008170033608034620001265762002496906001600160401b03601f38849003908101601f19168301908282118483101762000110578084916040968794855283398101031262000126576200005e602062000056846200012b565b93016200012b565b83517f3fbe42dcb277543d3741131fe04ce9fb205e3b7154603a23a25efd63ed2c9e1b602082018181526001600160a01b0395861683880181905287845293949293926060850192919083118584101762000110577ff7682c7604ab581823c6ee4b22f8283179771e57c8115328f4a698be07430a41946060946001938460a094878d528451902055855260808201520152a11660018060a01b03196000541617600055516123559081620001418239f35b634e487b7160e01b600052604160045260246000fd5b600080fd5b51906001600160a01b0382168203620001265756fe6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806301ffc9a71461015b57806307bd0265146101565780630fe786e114610151578063150b7a021461014c57806331b455a51461014757806356255c5314610142578063599e4c701461013d57806360d6c7cf146101385780638a2685a914610133578063a4508b1f1461012e578063a6b520c014610129578063bc197c8114610124578063c34c08e51461011f578063dedd65241461011a578063e1084a1314610115578063e58378bb14610110578063e5cb37031461010b578063f14210a614610106578063f23a6e61146101015763fdb09f3c0361000e57610d32565b610c2d565b610c02565b610bf4565b610bb9565b610aa8565b610938565b6108e5565b610855565b610797565b61070f565b610699565b61061e565b610524565b6104e5565b610446565b6103ed565b610276565b6101fa565b346101b15760203660031901126101b15760043563ffffffff60e01b81168091036101b157602090630271189760e51b81149081156101a0575b506040519015158152f35b6301ffc9a760e01b14905038610195565b600080fd5b60009103126101b157565b634e487b7160e01b600052601160045260246000fd5b6000198101919082116101e657565b6101c1565b601f198101919082116101e657565b346101b15760003660031901126101b15760206040517fd931ed5eea9427443091b211e417e6f83bd1d1a5235f4e7adbb05b556120802f8152f35b6001600160a01b038116036101b157565b9181601f840112156101b1578235916001600160401b0383116101b1576020808501948460051b0101116101b157565b346101b15760403660031901126101b15760043561029381610235565b6024356001600160401b0381116101b1576102b2903690600401610246565b6102be929192336116a9565b54156102d957610019926102d3913691610dd4565b90611026565b6040516339218f3b60e01b8152600490fd5b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b0382111761031c57604052565b6102eb565b606081019081106001600160401b0382111761031c57604052565b6001600160401b03811161031c57604052565b604081019081106001600160401b0382111761031c57604052565b90601f801991011681019081106001600160401b0382111761031c57604052565b6001600160401b03811161031c57601f01601f191660200190565b81601f820112156101b1578035906103bd8261038b565b926103cb604051948561036a565b828452602083830101116101b157816000926020809301838601378301015290565b346101b15760803660031901126101b157610409600435610235565b610414602435610235565b6064356001600160401b0381116101b1576104339036906004016103a6565b50604051630a85bd0160e11b8152602090f35b346101b15760403660031901126101b15760043561046381610235565b6024356001600160401b0381116101b157610482903690600401610246565b61048e929192336116a9565b54156102d957610019926104a3913691610dd4565b906110b7565b9060406003198301126101b1576004356104c281610235565b91602435906001600160401b0382116101b1576104e191600401610246565b9091565b346101b1576104f3366104a9565b6104ff929192336116a9565b54156102d957610019926105149136916107e9565b90611134565b801515036101b157565b346101b15760603660031901126101b15760043560243561054481610235565b604435916105518361051a565b61055a336116a9565b54156102d9576001600160a01b03821692831561060c577f3fbe42dcb277543d3741131fe04ce9fb205e3b7154603a23a25efd63ed2c9e1b821480610603575b806105fb575b6105e9577ff7682c7604ab581823c6ee4b22f8283179771e57c8115328f4a698be07430a4193816105d3606095856116f6565b55604051928352602083015215156040820152a1005b604051630337b9b360e41b8152600490fd5b5080156105a0565b5033841461059a565b604051630da30f6560e31b8152600490fd5b346101b15760403660031901126101b157602061064860243561064081610235565b6004356116f6565b546040519015158152f35b60406003198201126101b1576001600160401b03916004358381116101b1578261067f91600401610246565b939093926024359182116101b1576104e191600401610246565b346101b1576106a736610653565b906106b1336116a9565b54156102d9578282036106fd5760005b8381106106ca57005b806106f76106db6001938789610e42565b356106e581610235565b6106f0838787610e42565b35906111bf565b016106c1565b604051634ec4810560e11b8152600490fd5b346101b15760603660031901126101b15760043561072c81610235565b6001600160401b03906024358281116101b15761074d903690600401610246565b926044359081116101b157610766903690600401610246565b9190610771336116a9565b54156102d957610789610791926100199636916107e9565b9236916107e9565b91611228565b346101b15760003660031901126101b15760206040517fc3757b2598fc76eee6f032de6e0c1a33b52273c8afc630e889b8d170f8a26b1a8152f35b6001600160401b03811161031c5760051b60200190565b92916107f4826107d2565b91610802604051938461036a565b829481845260208094019160051b81019283116101b157905b8282106108285750505050565b8135815290830190830161081b565b9080601f830112156101b157816020610852933591016107e9565b90565b346101b15760a03660031901126101b157610871600435610235565b61087c602435610235565b6001600160401b036044358181116101b15761089c903690600401610837565b506064358181116101b1576108b5903690600401610837565b506084359081116101b1576108ce9036906004016103a6565b5060405163bc197c8160e01b8152602090f35b0390f35b346101b15760003660031901126101b1576000546040516001600160a01b039091168152602090f35b60206003198201126101b157600435906001600160401b0382116101b1576104e191600401610246565b346101b1576109463661090e565b90610950336116a9565b54156102d95761095e610e57565b5060005b82811061096b57005b61097e610979828585610e7d565b610eac565b9081519161098b83610f28565b61099483610f28565b826109c457606001518051909250600019016106fd576109be6109b8600193610f48565b516112e4565b01610962565b6109cd83610f28565b600192808403610a2057506060810151928351036106fd5760200151600192610a1b91610a1490610a0e906001600160a01b03165b6001600160a01b031690565b91610f48565b51906111bf565b6109be565b60019350610a2d81610f28565b60028103610a5d57506040810151602090910151610a1b9190610a58906001600160a01b0316610a02565b611134565b80610a69600392610f28565b14610a75575b506109be565b60408101516060820151602090920151610aa2929190610a9d906001600160a01b0316610a02565b611228565b38610a6f565b346101b157610ab63661090e565b90610ac0336116a9565b54156102d957610ace610f69565b5060005b828110610adb57005b610aee610ae9828585610f8a565b610fac565b90815191610afb83610f28565b610b0483610f28565b600192808403610b3d57506020810151610b379190604090610b2e906001600160a01b0316610a02565b910151906110b7565b01610ad2565b610b4681610f28565b60028103610b7c57506020810151610b779190604090610b6e906001600160a01b0316610a02565b91015190611026565b610b37565b80610b88600392610f28565b14610b94575b50610b37565b6020810151610bb39190604090610b6e906001600160a01b0316610a02565b38610b8e565b346101b15760003660031901126101b15760206040517f3fbe42dcb277543d3741131fe04ce9fb205e3b7154603a23a25efd63ed2c9e1b8152f35b346101b1576102b2366104a9565b346101b15760203660031901126101b157610c1c336116a9565b54156102d9576100196004356112e4565b346101b15760a03660031901126101b157610c49600435610235565b610c54602435610235565b6084356001600160401b0381116101b157610c739036906004016103a6565b5060405163f23a6e6160e01b8152602090f35b60005b838110610c995750506000910152565b8181015183820152602001610c89565b90602091610cc281518092818552858086019101610c86565b601f01601f1916010190565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b848310610d045750505050505090565b9091929394958480610d22600193603f198682030187528a51610ca9565b9801930193019194939290610cf4565b610d3b36610653565b60008054919492916001600160a01b031633036102d957610d5b856107d2565b94610d69604051968761036a565b808652602092602087019160051b8101923684116101b15781925b848410610da5576108e1610d998a8a8a6113c2565b60405191829182610cce565b83356001600160401b038111610dd0578691610dc58392369087016103a6565b815201930192610d84565b8280fd5b9291610ddf826107d2565b91610ded604051938461036a565b829481845260208094019160051b81019283116101b157905b828210610e135750505050565b8380918335610e2181610235565b815201910190610e06565b634e487b7160e01b600052603260045260246000fd5b9190811015610e525760051b0190565b610e2c565b60405190610e6482610301565b6060808360008152600060208201528160408201520152565b9190811015610e525760051b81013590607e19813603018212156101b1570190565b359060048210156101b157565b6080813603126101b15760405190610ec382610301565b610ecc81610e9f565b82526020810135610edc81610235565b60208301526001600160401b039060408101358281116101b157610f039036908301610837565b604084015260608101359182116101b157610f2091369101610837565b606082015290565b60041115610f3257565b634e487b7160e01b600052602160045260246000fd5b805115610e525760200190565b8051821015610e525760209160051b010190565b60405190610f7682610321565b606060408360008152600060208201520152565b9190811015610e525760051b81013590605e19813603018212156101b1570190565b6060813603126101b15760405190610fc382610321565b610fcc81610e9f565b82526020810135610fdc81610235565b60208301526040810135906001600160401b0382116101b1570136601f820112156101b157611012903690602081359101610dd4565b604082015290565b6040513d6000823e3d90fd5b81519060005b8281106110395750505050565b6001600160a01b0382811691906110508287610f55565b511691803b156101b15760405163a22cb46560e01b81526001600160a01b03939093166004840152600060248401819052908390604490829084905af19182156110b2576001926110a3575b500161102c565b6110ac9061033c565b3861109c565b61101a565b81519160005b8381106110ca5750505050565b60019061112e61111a6111286001600160a01b036110e88588610f55565b5160405163095ea7b360e01b602082015291166001600160a01b03166024820152600060448201529182906064820190565b03601f19810183528261036a565b85611cdb565b016110bd565b81519060005b8281106111475750505050565b6001600160a01b0382169061115c8186610f55565b51823b156101b157600092606484926040519586938492632142170760e11b845230600485015233602485015260448401525af19182156110b2576001926111a6575b500161113a565b806111b36111b99261033c565b806101b6565b3861119f565b906111f2916040519163a9059cbb60e01b60208401523360248401526044830152604482526111ed82610301565b611cdb565b565b90815180825260208080930193019160005b828110611214575050505090565b835185529381019392810192600101611206565b6001600160a01b031691823b156101b15761128a9260009283602061127794826040519889978896631759616b60e11b885230600489015233602489015260a0604489015260a48801906111f4565b60031993848883030160648901526111f4565b85810392830160848701525201925af180156110b2576112a75750565b806111b36111f29261033c565b3d156112df573d906112c58261038b565b916112d3604051938461036a565b82523d6000602084013e565b606090565b600080808093335af16112f56112b4565b50156112fd57565b604051631d42c86760e21b8152600490fd5b1561131657565b60405162461bcd60e51b815260206004820152601660248201527556616c7565206d75737420626520333220627974657360501b6044820152606490fd5b602081519101519060208110611368575090565b6000199060200360031b1b1690565b604051906113848261034f565b60078252662ab735b737bbb760c91b6020830152565b9081526001600160a01b03909116602082015260606040820181905261085292910190610ca9565b9060005b8181106113d35750505090565b6113de818385610e42565b604091903560d881901c8381161592836116935760010193611401858789610e42565b3560205b60038481166001810361155b575060009283926020925086831661154357611438916001600160e01b031989168e611789565b905b81519101826001600160a01b0388165af1936114546112b4565b945b156114a55750506080161561148657600192916114809160581b6001600160f81b03191687611c81565b016113c6565b906001929561149f9260ff60f81b9060581b1690611bd6565b93611480565b6114eb858786936114b4611377565b92604490818151116114fe575b5050156114ef57935b5163ef3dcb2f60e01b81529384936001600160a01b0316906004850161139a565b0390fd5b6114f8906101d7565b936114ca565b611507816119a5565b602061151560048401611354565b14611521575b506114c1565b61152d60248301611354565b14611539575b8061151b565b0192508680611533565b50607f6115549160f81c168c610f55565b519061143a565b600281036115c257506000928392602092508683166115aa57611589916001600160e01b031989168e611789565b905b815191016001600160a01b0387165afa936115a46112b4565b94611456565b50607f6115bb9160f81c168c610f55565b519061158b565b0361165c576000918291607f906115df8d838560f81c1690610f55565b51928d6115f96020956115f48782511461130f565b611354565b93858a161587146116435750611611611627936101d7565b9160081b906001600160e01b03198b1690611789565b915b82519201906001600160a01b0388165af1936115a46112b4565b919050611655925060f01c168d610f55565b5191611629565b825162461bcd60e51b815260206004820152601060248201526f496e76616c69642063616c6c7479706560801b6044820152606490fd5b93602883901b6001600160d01b03176006611405565b604080517f3fbe42dcb277543d3741131fe04ce9fb205e3b7154603a23a25efd63ed2c9e1b602082019081526001600160a01b03909316818301529081526116f081610321565b51902090565b60408051602081019283526001600160a01b03909316838201528252906116f081610321565b6040519061016082018281106001600160401b0382111761031c57604052600a8252610140366020840137565b90600482018092116101e657565b906117618261038b565b61176e604051918261036a565b828152809261177f601f199161038b565b0190602036910137565b9392906000808161179861171c565b9060609281905b8782106118ee575b50506117b56117ba91611749565b611757565b9760209460208a0152600060248a019281955b8887106117e05750505050505050505050565b87871015610e525787908c8b808a1a60808116156118cd5760fe810361183a575050906118276001939282895261181683611749565b6118208b516101eb565b918b611f0f565b875101601f1901955b01960195936117cd565b939795929390919060fd810361186b5750918484928860019c9561185f978a52612073565b50979195909593611830565b60fc81036118885750918484928860019c9561185f978a52611f21565b6118b5925060019491607f6118c6929a95989a16906118a7828b610f55565b5151948592858d528b610f55565b51906118c085611749565b91611efd565b0195611830565b84939892506001949150607f6118e4911688610f55565b5101518152611830565b9092949160209081851015610e525789851a60ff811461198f578c608082161561197b578b9060fe830361195d5750505085511561193a575b90600191865101935b019593019061179f565b945060019061111a6119548d604051928391858301610cce565b95909150611927565b9861196f95929160019895979a611e2e565b94919390939296611930565b906001939261198992611dbb565b93611930565b5093975091949291506117b590506117ba6117a7565b9081516043198082018281116101e6579360445b8381106119c7575b50505050565b8151811015610e5257818101602001516001600160f81b031916156119ee576001016119b9565b93945050905081019081116101e65790388080806119c1565b15611a0e57565b60405162461bcd60e51b8152602060048201526013602482015272496e646578206f75742d6f662d626f756e647360681b6044820152606490fd5b15611a5057565b60405162461bcd60e51b815260206004820152602860248201527f4f6e6c79206f6e652072657475726e2076616c7565207065726d697474656420604482015267287374617469632960c01b6064820152608490fd5b15611aad57565b60405162461bcd60e51b815260206004820152602a60248201527f4f6e6c79206f6e652072657475726e2076616c7565207065726d697474656420604482015269287661726961626c652960b01b6064820152608490fd5b60209081818403126101b15780516001600160401b03918282116101b157019083601f830112156101b1578151611b3b816107d2565b94604092611b4c604051978861036a565b828752858088019360051b860101948286116101b157868101935b868510611b7957505050505050505090565b84518381116101b15782019084603f830112156101b1578882015190611b9e8261038b565b611baa8951918261036a565b828152868984860101116101b157611bcb8b949385948b8685019101610c86565b815201940193611b67565b91908060f81c60ff8114611c7b576080811615611c435760fe8103611c0b575050610852915060208082518301019101611b05565b602091611c21610fe092607f8751911610611a07565b82840193611c3184865114611aa6565b51601f1901845260f31c168301015290565b611c77929150607f1690611c5984518310611a07565b611c666020825114611a49565b611c708285610f55565b5282610f55565b5090565b50505090565b9060f81c60ff8114611cd657825190602082018092116101e657602092607f611cac611cbf94611757565b921691611cb98383610f55565b52610f55565b51918051604084018184840160045afa5051910152565b505050565b604051611d39916001600160a01b0316611cf48261034f565b6000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af1611d336112b4565b91612286565b805180611d4557505050565b818391810103126101b157810151611d5c8161051a565b15611d645750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b611dcc90607f602093941690610f55565b515103611dd95760200190565b60405162461bcd60e51b815260206004820152602760248201527f537461746963207374617465207661726961626c6573206d75737420626520336044820152663220627974657360c81b6064820152608490fd5b90969594939260fd8103611e4e575095611e48959661220a565b90919293565b60fc8103611e62575095611e489596612119565b9196509194939291611e7791607f1690610f55565b515180151580611ef2575b15611e8e570160200191565b60405162461bcd60e51b815260206004820152603660248201527f44796e616d6963207374617465207661726961626c6573206d7573742062652060448201527561206d756c7469706c65206f6620333220627974657360501b6064820152608490fd5b50601f811615611e82565b916020809185930101920160045afa50565b910160200190829060400160045afa50565b939596929091600094611f348884610f55565b51936024600180878b019b019b0198830101915b602094858a101561206a57848a1a60808116156120445760fb8103611f71575050505050505050565b9b8c60fd889d939598979c94969b999e14600014611fbc575090611f9c92918d8b52848c8988612073565b929c919b978301909501989101956001915b019301979291939093611f48565b9091929394955060fc8114600014611ffa575091611fe4918b9594938d8b52848c8988611f21565b929c919b97830190950198910195600191611fae565b9a89878e83949f9e95612038607f6001989b9a999b169461202d61201e8787610f55565b51519687968796879452610f55565b518b6118c085611749565b019d0198010198611fae565b9560019294998161205e607f8295979a9e999e168a610f55565b5101518b520198611fae565b50505050505050565b939291909495600101946020861015610e525760206120ad978161209c607f868b1a1685610f55565b510151602482890101520194611f21565b929391929091602090910190565b156120c257565b60405162461bcd60e51b815260206004820152602960248201527f43616e6e6f74207573652073746174652066726f6d20696e736964652064796e604482015268616d6963207479706560b81b6064820152608490fd5b6001808501976020968701978201969095600094909392915b80891061218a5760405162461bcd60e51b8152602060048201526024808201527f44796e616d6963207479706520776173206e6f742070726f7065726c7920636c6044820152631bdcd95960e21b6064820152608490fd5b81891a60808116156121f05760fb81036121b45750505050506121ad9083610f55565b5293929190565b99849b8b83989985879e986121d36121d8989f97999a60fe14156120bb565b611e2e565b9b929b9a919a96909a9b975b01950197909291612132565b906122048495939a979b9282959385611dbb565b9a6121e4565b9291909394600101936020851015610e5257602061222d607f83881a1686610f55565b515103612241576020611e48960193612119565b60405162461bcd60e51b815260206004820152601d60248201527f4172726179206c656e677468206d7573742062652033322062797465730000006044820152606490fd5b919290156122e8575081511561229a575090565b3b156122a35790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156122fb5750805190602001fd5b60405162461bcd60e51b8152602060048201529081906114eb906024830190610ca956fea264697066735822122021bf89a073c3ebc0affee7d2ceaac31d919db775b294891014d2accd020f539464736f6c63430008170033000000000000000000000000fae0bbfd75307865dcdf21d9defefedeee718431
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c8063083001ba146105725780630a512416146103cb578063b35d7e731461035e578063ce40c7cd146103195763da1a5f421461005357600080fd5b60a036600319011261023e5767ffffffffffffffff60043581811161023e576100809036906004016105e4565b909160243581811161023e5761009a9036906004016105e4565b9290916044356001600160a01b038116900361023e5760643581811161023e576100c8903690600401610615565b9160843590811161023e576100e1903690600401610615565b9290916100ed8761077a565b946100fb6040519687610742565b8786526101078861077a565b601f190136602088013760005b888110610257575061012895969798610959565b9160005b8481106101455760405180610141868261068e565b0390f35b6001600160a01b0361016061015b838886610708565b61072e565b1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81036101c9576101946044353161018d8487610c0c565b5190610af4565b60206101a1848987610708565b0135116101b1575060010161012c565b60249060405190636d53e03360e11b82526004820152fd5b6040516370a0823160e01b81526044356001600160a01b03166004820152602081602481855afa801561024b57600090610212575b61020d915061018d8487610c0c565b610194565b506020813d602011610243575b8161022c60209383610742565b8101031261023e5761020d90516101fe565b600080fd5b3d915061021f565b6040513d6000823e3d90fd5b6001600160a01b0361026d61015b838c8c610708565b169073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee82036102a45760019150604435315b61029d828a610c0c565b5201610114565b6040516370a0823160e01b81526044356001600160a01b0316600482015291602090839060249082905afa801561024b576000906102e6575b60019250610293565b506020823d602011610311575b8161030060209383610742565b8101031261023e57600191516102dd565b3d91506102f3565b3461023e57600036600319011261023e576040517f0000000000000000000000007d585b0e27bbb3d981b7757115ec11f47c4769946001600160a01b03168152602090f35b608036600319011261023e576103726106f2565b67ffffffffffffffff60443581811161023e57610393903690600401610615565b9260643592831161023e57610141936103b36103bf943690600401610615565b93909260243590610b17565b6040519182918261068e565b60e036600319011261023e576103df6106f2565b6001600160a01b0390602435828116919082900361023e576084359283169081840361023e5767ffffffffffffffff9360a43585811161023e57610427903690600401610615565b9560c43590811161023e57610440903690600401610615565b9073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8714978860001461050757610472938531965b60443590610b17565b941561049957610483925031610af4565b606435116101b15760405180610141848261068e565b50604051916370a0823160e01b83526004830152602082602481865afa801561024b576000906104d3575b6104ce9250610af4565b610483565b506020823d6020116104ff575b816104ed60209383610742565b8101031261023e576104ce91516104c4565b3d91506104e0565b6040516370a0823160e01b815260048101889052936020856024818c5afa801561024b5760009061053e575b610472955096610469565b506020853d60201161056a575b8161055860209383610742565b8101031261023e576104729451610533565b3d915061054b565b606036600319011261023e5767ffffffffffffffff60043581811161023e5761059f9036906004016105e4565b60249291923582811161023e576105ba903690600401610615565b60449491943593841161023e57610141946105dc6103bf953690600401610615565b949093610959565b9181601f8401121561023e5782359167ffffffffffffffff831161023e576020808501948460061b01011161023e57565b9181601f8401121561023e5782359167ffffffffffffffff831161023e576020808501948460051b01011161023e57565b60005b8381106106595750506000910152565b8181015183820152602001610649565b9060209161068281518092818552858086019101610646565b601f01601f1916010190565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b8483106106c45750505050505090565b90919293949584806106e2600193603f198682030187528a51610669565b98019301930191949392906106b4565b600435906001600160a01b038216820361023e57565b91908110156107185760061b0190565b634e487b7160e01b600052603260045260246000fd5b356001600160a01b038116810361023e5790565b90601f8019910116810190811067ffffffffffffffff82111761076457604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff81116107645760051b60200190565b67ffffffffffffffff811161076457601f01601f191660200190565b602090818184031261023e57805167ffffffffffffffff9182821161023e57019083601f8301121561023e5781516107e58161077a565b946040926107f66040519788610742565b828752858088019360051b8601019482861161023e57868101935b86851061082357505050505050505090565b845183811161023e5782019084603f8301121561023e57888201519061084882610792565b61085489519182610742565b8281528689848601011161023e576108758b949385948b8685019101610646565b815201940193610811565b60408082528101839052929392916001600160fb1b03811161023e576005949392941b8091606086013783019281606085016020928360608289030191015252608084019360808360051b82010194846000925b8584106108e5575050505050505090565b90919293949596607f198282030184528735601e198436030181121561023e57830186810191903567ffffffffffffffff811161023e57803603831361023e5787828280600196849695859652848401376000828201840152601f01601f19160101990197969591909101930191906108d4565b9094939460009160005b828110610a22575050501580610a19575b6109fa576109996000936040519586948594633f6c27cf60e21b865260048601610880565b0381347f0000000000000000000000007d585b0e27bbb3d981b7757115ec11f47c4769946001600160a01b03165af190811561024b576000916109da575090565b6109f791503d806000833e6109ef8183610742565b8101906107ae565b90565b60405163195a3ca160e01b815234600482015260006024820152604490fd5b50341515610974565b610a3061015b828585610708565b6020610a3d838686610708565b01359473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee916001600160a01b038082168403610ab9575050610aa15750600193803403610a8357506001905b01610963565b6044906040519063195a3ca160e01b82523460048301526024820152fd5b6024906040519063255f45bb60e21b82526004820152fd5b600194935090610aef9297917f0000000000000000000000007d585b0e27bbb3d981b7757115ec11f47c47699416903390610c20565b610a7d565b91908203918211610b0157565b634e487b7160e01b600052601160045260246000fd5b90959493926001600160a01b0392909183811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee03610bcc5750863403610bad576000949596505b610b7360405196879586948594633f6c27cf60e21b865260048601610880565b039134907f0000000000000000000000007d585b0e27bbb3d981b7757115ec11f47c476994165af190811561024b576000916109da575090565b60405163195a3ca160e01b815234600482015260248101889052604490fd5b96949596346109fa57600095610c0791857f0000000000000000000000007d585b0e27bbb3d981b7757115ec11f47c47699416903390610c20565b610b53565b80518210156107185760209160051b010190565b6040516323b872dd60e01b60208083019182526001600160a01b039485166024840152948416604483015260648083019690965294815292939267ffffffffffffffff9260a08201928484118385101761076457169060e08101938385109085111761076457610cee936040528583527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c0820152600080958192519082855af13d15610d8b573d91610cd383610792565b92610ce16040519485610742565b83523d868885013e610d8f565b805191821591848315610d60575b505050905015610d095750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b919381809450010312610d8757820151908115158203610d84575080388084610cfc565b80fd5b5080fd5b6060915b91929015610df15750815115610da3575090565b3b15610dac5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610e045750805190602001fd5b60405162461bcd60e51b815260206004820152908190610e28906024830190610669565b0390fdfea26469706673582212204dbe6f58fa7ade9b294f0f6da7fca827503fda6075ce5d3ae3b452de561be01e64736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000fae0bbFD75307865Dcdf21d9deFEFEDEee718431
-----Decoded View---------------
Arg [0] : owner_ (address): 0xfae0bbFD75307865Dcdf21d9deFEFEDEee718431
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000fae0bbFD75307865Dcdf21d9deFEFEDEee718431
Deployed Bytecode Sourcemap
258:5380:24:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;258:5380:24;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;-1:-1:-1;;;;;258:5380:24;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;356:50;258:5380;;356:50;;;:::i;:::-;258:5380;;;;;;:::i;:::-;-1:-1:-1;;258:5380:24;;;;;;;4988:10;;;;;;5176:37;;;;;;;:::i;:::-;5224:17;258:5380;5267:10;;;;;;258:5380;;;;;;;:::i;:::-;;;;5279:3;-1:-1:-1;;;;;5309:18:24;:12;;;;;:::i;:::-;:18;:::i;:::-;258:5380;363:42;5345:16;;363:42;;5393:30;258:5380;;5393:16;5412:11;;;;:::i;:::-;258:5380;5393:30;;:::i;:::-;258:5380;5560:12;;;;;:::i;:::-;:19;258:5380;-1:-1:-1;5544:75:24;;5279:3;258:5380;;5256:9;;5544:75;258:5380;;;;4040:31;;;;5588;;258:5380;5588:31;;356:50;5588:31;5341:190;258:5380;;-1:-1:-1;;;5474:28:24;;258:5380;;-1:-1:-1;;;;;258:5380:24;;5474:28;;356:50;258:5380;;;;5474:28;;;;;;;258:5380;5474:28;;;5341:190;5474:42;5505:11;;;;;;:::i;5474:42::-;5341:190;;5474:28;;258:5380;5474:28;;258:5380;5474:28;;;;;;258:5380;5474:28;;;:::i;:::-;;;258:5380;;;;5474:42;258:5380;;5474:28;;258:5380;;;;5474:28;;;-1:-1:-1;5474:28:24;;;258:5380;;356:50;258:5380;356:50;;;;;5000:3;-1:-1:-1;;;;;5030:18:24;:12;;;;;:::i;:18::-;258:5380;;363:42;5076:16;;363:42;;258:5380;;;;;5095:16;5076:66;5062:80;;;;:::i;:::-;258:5380;;4977:9;;5076:66;258:5380;;-1:-1:-1;;;5114:28:24;;258:5380;;-1:-1:-1;;;;;258:5380:24;;5114:28;;356:50;258:5380;;;;;;;;;5114:28;;;;;;258:5380;5114:28;;;5076:66;258:5380;5076:66;;;;5114:28;;258:5380;5114:28;;258:5380;5114:28;;;;;;258:5380;5114:28;;;:::i;:::-;;;258:5380;;;;;;;5114:28;;;;;-1:-1:-1;5114:28:24;;258:5380;;;;;;-1:-1:-1;;258:5380:24;;;;;;413:35;-1:-1:-1;;;;;258:5380:24;;;;;;;;;-1:-1:-1;;258:5380:24;;;;;;:::i;:::-;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;-1:-1:-1;;258:5380:24;;;;;;:::i;:::-;-1:-1:-1;;;;;258:5380:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;:::i;:::-;3655:16;363:42;3655:16;;:66;;;;;;3744:47;3674:16;;;3655:66;;258:5380;;3744:47;;:::i;:::-;3801:17;3828:166;;;3876:26;:16;;;:26;:::i;:::-;258:5380;;-1:-1:-1;4003:68:24;;258:5380;;;;;;;:::i;3828:166::-;258:5380;;;356:50;;;;3945:28;;258:5380;3945:28;;356:50;258:5380;3945:28;258:5380;3945:28;;;;;;;;258:5380;3945:28;;;3828:166;3945:38;;;;:::i;:::-;3828:166;;3945:28;;258:5380;3945:28;;258:5380;3945:28;;;;;;258:5380;3945:28;;;:::i;:::-;;;258:5380;;;;3945:38;258:5380;;3945:28;;;;;-1:-1:-1;3945:28:24;;3655:66;258:5380;;-1:-1:-1;;;3693:28:24;;258:5380;3693:28;;356:50;;;258:5380;;;;;3693:28;;;;;;;258:5380;3693:28;;;3655:66;3744:47;3655:66;;;;;3693:28;;258:5380;3693:28;;258:5380;3693:28;;;;;;258:5380;3693:28;;;:::i;:::-;;;258:5380;;;;3744:47;258:5380;;3693:28;;;;;-1:-1:-1;3693:28:24;;258:5380;;;-1:-1:-1;;258:5380:24;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;-1:-1:-1;;258:5380:24;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;-1:-1:-1;;258:5380:24;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;258:5380:24;;;;;;:::o;:::-;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;-1:-1:-1;;;;;258:5380:24;;;;;;;:::o;356:50::-;;258:5380;;;;;;356:50;;;;;;;;;;;;;:::o;:::-;258:5380;;;356:50;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;258:5380;;-1:-1:-1;;258:5380:24;356:50;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;258:5380;;;356:50;258:5380;;356:50;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;258:5380;;356:50;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;258:5380;;;356:50;;;;-1:-1:-1;;;;;356:50:24;;;;;;;;;;258:5380;;;;;356:50;;;;;258:5380;356:50;;258:5380;356:50;;258:5380;356:50;;;;;;;258:5380;;;;356:50;258:5380;356:50;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;258:5380;;;;356:50;258:5380;;;;;;;;;;356:50;;;;;;;;258:5380;;-1:-1:-1;;258:5380:24;356:50;;;258:5380;;356:50;;;;;;;;;;;;1861:892;;;;;-1:-1:-1;2129:9:24;-1:-1:-1;2140:19:24;;;;;;2600:8;;;;:26;;;2124:463;2596:63;;2691:55;-1:-1:-1;258:5380:24;;;356:50;;;;;;;;2691:55;;;;;;:::i;:::-;;2719:9;;2691:4;-1:-1:-1;;;;;258:5380:24;2691:55;;;;;;;-1:-1:-1;2691:55:24;;;2678:68;1861:892;:::o;2691:55::-;;;;;;-1:-1:-1;2691:55:24;;;;;;:::i;:::-;;;;;:::i;:::-;1861:892;:::o;2596:63::-;258:5380;;-1:-1:-1;;;2635:24:24;;2646:9;2635:24;;;356:50;-1:-1:-1;356:50:24;;;;;;2635:24;2600:26;2612:9;;:14;;2600:26;;2161:3;2190:17;:11;;;;;:::i;:17::-;2232:18;:11;;;;;:::i;:::-;:18;258:5380;;363:42;;-1:-1:-1;;;;;258:5380:24;;;2268:15;;363:42;;2303:44;;;;2365:14;258:5380;2401:9;;;:21;2397:65;;2264:313;258:5380;2264:313;;258:5380;2129:9;;2397:65;356:50;258:5380;;;2431:31;;;;;;2401:9;2431:31;;;356:50;;;;;2431:31;2303:44;356:50;258:5380;;;2323:24;;;;;;;;;356:50;2323:24;2264:313;258:5380;2546:4;;;;2553:8;2546:4;;;;258:5380;2526:10;;2553:8;;:::i;:::-;2264:313;;258:5380;;;;;;;;;;:::o;:::-;;;;;;;;;;;;1008:559;;;;;;-1:-1:-1;;;;;258:5380:24;1008:559;;258:5380;;;363:42;1219:15;363:42;;1254:9;;;:21;1250:65;;1505:55;1215:268;;;;;1505:55;258:5380;;356:50;;;;;;;;;;1505:55;;;;;;:::i;:::-;;1533:9;;1505:4;;258:5380;1505:55;;;;;;;;;;;1492:68;1008:559;:::o;1250:65::-;258:5380;;-1:-1:-1;;;1284:31:24;;1254:9;1284:31;;;356:50;;;;;;;;;1284:31;1215:268;1350:9;;;;;1346:51;;1505:55;1456:4;1463:8;1456:4;;;258:5380;1436:10;;1463:8;;:::i;:::-;1215:268;;258:5380;;;;;;;;;;;;;;;:::o;1355:203:4:-;258:5380:24;;-1:-1:-1;;;1482:68:4;;;;;;;-1:-1:-1;;;;;258:5380:24;;;1482:68:4;;;356:50:24;258:5380;;;;;;356:50;258:5380;;;;356:50;;;;1482:68:4;;;;;;356:50:24;;258:5380;356:50;;;;;;;;;;;;258:5380;356:50;;;;;;;;;;;;;;5535:69:5;356:50:24;258:5380;356:50;258:5380;;;;;;;;-1:-1:-1;5487:31:5;;;;;;;;;;258:5380:24;;;;;;;;;:::i;:::-;;356:50;258:5380;;356:50;;;:::i;:::-;258:5380;;;;;;;;5535:69:5;:::i;:::-;258:5380:24;;5705:22:4;;;:56;;;;;;258:5380:24;;;;;;;;;1355:203:4;:::o;258:5380:24:-;;;;;;;;;;;;;;;;1482:68:4;258:5380:24;;;;;;;;-1:-1:-1;;;258:5380:24;;;;;5705:56:4;5731:30;;;;;;;258:5380:24;;;;5731:30:4;;258:5380:24;356:50;;;;258:5380;;;;5705:56:4;;;;;;;258:5380:24;;;;;;;;;;7671:628:5;;;;7875:418;;;258:5380:24;;;7906:22:5;7902:286;;8201:17;;:::o;7902:286::-;1702:19;:23;258:5380:24;;8201:17:5;:::o;258:5380:24:-;;;-1:-1:-1;;;258:5380:24;;;;;;;;;;;;;;;;;;;;7875:418:5;258:5380:24;;;;-1:-1:-1;8980:21:5;:17;;9152:142;;;;;;;8976:379;258:5380:24;;-1:-1:-1;;;9324:20:5;;258:5380:24;9324:20:5;;;258:5380:24;;;;;;;;;;;:::i;:::-;9324:20:5;;
Swarm Source
ipfs://21bf89a073c3ebc0affee7d2ceaac31d919db775b294891014d2accd020f5394
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.