More Info
Private Name Tags
ContractCreator
Latest 21 from a total of 21 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Swap | 17138652 | 445 days ago | IN | 0.01 ETH | 0.0168568 | ||||
Swap | 17138639 | 445 days ago | IN | 0.01 ETH | 0.01758218 | ||||
Swap | 16990442 | 466 days ago | IN | 0.005 ETH | 0.00896844 | ||||
Swap | 16989450 | 466 days ago | IN | 0.005 ETH | 0.00906158 | ||||
Swap | 16989405 | 466 days ago | IN | 0.004 ETH | 0.00673105 | ||||
Swap | 16984504 | 467 days ago | IN | 0.0055 ETH | 0.01374419 | ||||
Swap | 16982199 | 467 days ago | IN | 0.005 ETH | 0.00661428 | ||||
Swap | 16982090 | 467 days ago | IN | 0.005 ETH | 0.0067452 | ||||
Swap | 16982029 | 467 days ago | IN | 0.005 ETH | 0.00883143 | ||||
Swap | 16981994 | 467 days ago | IN | 0.003 ETH | 0.00912488 | ||||
Swap | 16981939 | 467 days ago | IN | 0.005 ETH | 0.00691927 | ||||
Swap | 16981751 | 467 days ago | IN | 0.05 ETH | 0.01313996 | ||||
Swap | 16981735 | 467 days ago | IN | 0.001 ETH | 0.00724922 | ||||
Swap | 16976162 | 468 days ago | IN | 0.005 ETH | 0.00747275 | ||||
Swap | 16976117 | 468 days ago | IN | 0.005 ETH | 0.00666368 | ||||
Swap | 16976030 | 468 days ago | IN | 0.005 ETH | 0.00788551 | ||||
Swap | 16967001 | 469 days ago | IN | 0 ETH | 0.00965392 | ||||
Swap | 16960664 | 470 days ago | IN | 0.01 ETH | 0.00481472 | ||||
Swap | 16883291 | 481 days ago | IN | 0.01 ETH | 0.00694945 | ||||
Swap | 16846388 | 486 days ago | IN | 0.001 ETH | 0.00483603 | ||||
0x61014060 | 16776385 | 496 days ago | IN | Create: XSwap | 0 ETH | 0.06998613 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
17138652 | 445 days ago | 0.01 ETH | ||||
17138639 | 445 days ago | 0.01 ETH | ||||
16990442 | 466 days ago | 0.005 ETH | ||||
16989450 | 466 days ago | 0.005 ETH | ||||
16989405 | 466 days ago | 0.004 ETH | ||||
16984504 | 467 days ago | 0.0055 ETH | ||||
16982199 | 467 days ago | 0.005 ETH | ||||
16982199 | 467 days ago | 0.005 ETH | ||||
16982199 | 467 days ago | 0.005 ETH | ||||
16982090 | 467 days ago | 0.005 ETH | ||||
16982029 | 467 days ago | 0.005 ETH | ||||
16981994 | 467 days ago | 0.003 ETH | ||||
16981939 | 467 days ago | 0.005 ETH | ||||
16981939 | 467 days ago | 0.005 ETH | ||||
16981939 | 467 days ago | 0.005 ETH | ||||
16981751 | 467 days ago | 0.05 ETH | ||||
16981735 | 467 days ago | 0.001 ETH | ||||
16976162 | 468 days ago | 0.005 ETH | ||||
16976162 | 468 days ago | 0.005 ETH | ||||
16976162 | 468 days ago | 0.005 ETH | ||||
16976117 | 468 days ago | 0.005 ETH | ||||
16976117 | 468 days ago | 0.005 ETH | ||||
16976117 | 468 days ago | 0.005 ETH | ||||
16976030 | 468 days ago | 0.005 ETH | ||||
16960664 | 470 days ago | 0.01 ETH |
Loading...
Loading
Contract Name:
XSwap
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {Swapper} from "./core/swap/Swapper.sol"; import {WhitelistWithdrawable} from "./core/withdraw/WhitelistWithdrawable.sol"; import {LifeControl} from "./core/misc/LifeControl.sol"; struct XSwapConstructorParams { address swapSignatureValidator; address permitResolverWhitelist; address useProtocolWhitelist; address delegateManager; address withdrawWhitelist; address lifeControl; } contract XSwap is Swapper, WhitelistWithdrawable { address private immutable _lifeControl; constructor(XSwapConstructorParams memory params_) WhitelistWithdrawable(params_.withdrawWhitelist) Swapper(params_.swapSignatureValidator, params_.permitResolverWhitelist, params_.useProtocolWhitelist, params_.delegateManager) { _lifeControl = params_.lifeControl; } function _checkSwapEnabled() internal view override { require(!LifeControl(_lifeControl).paused(), "XS: swapping paused"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create(0, 0x09, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create2(0, 0x09, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(add(ptr, 0x38), deployer) mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff) mstore(add(ptr, 0x14), implementation) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73) mstore(add(ptr, 0x58), salt) mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37)) predicted := keccak256(add(ptr, 0x43), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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) (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/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; library NativeClaimer { struct State { uint256 _valueClaimed; } function claimed(NativeClaimer.State memory claimer_) internal pure returns (uint256) { return claimer_._valueClaimed; } function unclaimed(NativeClaimer.State memory claimer_) internal view returns (uint256) { return msg.value - claimer_._valueClaimed; } function claim(NativeClaimer.State memory claimer_, uint256 value_) internal view { require(unclaimed(claimer_) >= value_, "NC: insufficient msg value"); claimer_._valueClaimed += value_; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; abstract contract NativeReceiver { receive() external payable {} }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {NativeClaimer} from "./NativeClaimer.sol"; import {TokenHelper} from "./TokenHelper.sol"; abstract contract NativeReturnMods { using NativeClaimer for NativeClaimer.State; modifier returnUnclaimedNative(NativeClaimer.State memory claimer_) { require(claimer_.claimed() == 0, "NR: claimer already in use"); _; TokenHelper.transferFromThis(TokenHelper.NATIVE_TOKEN, msg.sender, claimer_.unclaimed()); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {TokenCheck} from "../swap/Swap.sol"; library TokenChecker { function checkMin(TokenCheck calldata check_, uint256 amount_) internal pure returns (uint256) { order(check_); min(check_, amount_); return capMax(check_, amount_); } function checkMinMax(TokenCheck calldata check_, uint256 amount_) internal pure { order(check_); min(check_, amount_); max(check_, amount_); } function checkMinMaxToken(TokenCheck calldata check_, uint256 amount_, address token_) internal pure { order(check_); min(check_, amount_); max(check_, amount_); token(check_, token_); } function order(TokenCheck calldata check_) private pure { require(check_.minAmount <= check_.maxAmount, "TC: unordered min/max amounts"); } function min(TokenCheck calldata check_, uint256 amount_) private pure { require(amount_ >= check_.minAmount, "TC: insufficient token amount"); } function max(TokenCheck calldata check_, uint256 amount_) private pure { require(amount_ <= check_.maxAmount, "TC: excessive token amount"); } function token(TokenCheck calldata check_, address token_) private pure { require(token_ == check_.token, "TC: wrong token address"); } function capMax(TokenCheck calldata check_, uint256 amount_) private pure returns (uint256) { return amount_ < check_.maxAmount ? amount_ : check_.maxAmount; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {NativeClaimer} from "./NativeClaimer.sol"; library TokenHelper { using NativeClaimer for NativeClaimer.State; address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; modifier whenNonZero(uint256 amount_) { if (amount_ == 0) return; _; } function isNative(address token_) internal pure returns (bool) { return token_ == NATIVE_TOKEN; } function balanceOf(address token_, address owner_, NativeClaimer.State memory claimer_) internal view returns (uint256) { return isNative(token_) ? _nativeBalanceOf(owner_, claimer_) : IERC20(token_).balanceOf(owner_); } function balanceOfThis(address token_, NativeClaimer.State memory claimer_) internal view returns (uint256) { return balanceOf(token_, address(this), claimer_); } function transferToThis(address token_, address from_, uint256 amount_, NativeClaimer.State memory claimer_) internal whenNonZero(amount_) { if (isNative(token_)) { require(from_ == msg.sender, "TH: native allows sender only"); claimer_.claim(amount_); } else SafeERC20.safeTransferFrom(IERC20(token_), from_, address(this), amount_); } function transferFromThis(address token_, address to_, uint256 amount_) internal whenNonZero(amount_) { isNative(token_) ? Address.sendValue(payable(to_), amount_) : SafeERC20.safeTransfer(IERC20(token_), to_, amount_); } function approveOfThis(address token_, address spender_, uint256 amount_) internal whenNonZero(amount_) returns (uint256 sendValue) { if (isNative(token_)) sendValue = amount_; else SafeERC20.safeApprove(IERC20(token_), spender_, amount_); } function revokeOfThis(address token_, address spender_) internal { if (!isNative(token_)) SafeERC20.safeApprove(IERC20(token_), spender_, 0); } function _nativeBalanceOf(address owner_, NativeClaimer.State memory claimer_) private view returns (uint256 balance) { if (owner_ == msg.sender) balance = claimer_.unclaimed(); else { balance = owner_.balance; if (owner_ == address(this)) balance -= claimer_.unclaimed(); } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {NativeReceiver} from "../asset/NativeReceiver.sol"; import {SimpleInitializable} from "../misc/SimpleInitializable.sol"; import {Withdrawable} from "../withdraw/Withdrawable.sol"; contract Delegate is SimpleInitializable, Ownable, Withdrawable, NativeReceiver { constructor() { _initializeWithSender(); } function _initialize() internal override { _transferOwnership(initializer()); } function setOwner(address newOwner_) external whenInitialized onlyInitializer { _transferOwnership(newOwner_); } function _checkWithdraw() internal view override { _ensureInitialized(); _checkOwner(); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {AccountWhitelist} from "../whitelist/AccountWhitelist.sol"; import {Withdraw} from "../withdraw/Withdrawable.sol"; import {Delegate} from "./Delegate.sol"; contract DelegateManager { address private immutable _delegatePrototype; address private immutable _withdrawWhitelist; constructor(address delegatePrototype_, address withdrawWhitelist_) { _delegatePrototype = delegatePrototype_; _withdrawWhitelist = withdrawWhitelist_; } modifier onlyWhitelistedWithdrawer() { require(AccountWhitelist(_withdrawWhitelist).isAccountWhitelisted(msg.sender), "DM: withdrawer not whitelisted"); _; } function predictDelegateDeploy(address account_) public view returns (address) { return Clones.predictDeterministicAddress(_delegatePrototype, _calcSalt(account_)); } function deployDelegate(address account_) public returns (address) { Delegate delegate = Delegate(payable(Clones.cloneDeterministic(_delegatePrototype, _calcSalt(account_)))); delegate.initialize(); delegate.transferOwnership(account_); return address(delegate); } function isDelegateDeployed(address account_) public view returns (bool) { return Address.isContract(predictDelegateDeploy(account_)); } function withdraw(address account_, Withdraw[] calldata withdraws_) external onlyWhitelistedWithdrawer { Delegate delegate = Delegate(payable(predictDelegateDeploy(account_))); address savedOwner = delegate.owner(); delegate.setOwner(address(this)); delegate.withdraw(withdraws_); delegate.setOwner(savedOwner); } function _calcSalt(address account_) private pure returns (bytes32) { return bytes20(account_); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; library AccountCounter { uint256 private constant _ACCOUNT_MIXIN = 0xacc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0; uint256 private constant _NULL_INDEX = type(uint256).max; struct State { uint256[] _accounts; uint256[] _counts; uint256 _size; } using AccountCounter for State; function create(uint256 maxSize_) internal pure returns (AccountCounter.State memory accountCounter) { accountCounter._accounts = new uint256[](maxSize_); accountCounter._counts = new uint256[](maxSize_); } function size(AccountCounter.State memory accountCounter_) internal pure returns (uint256) { return accountCounter_._size; } function indexOf(AccountCounter.State memory accountCounter_, address account_, bool insert_) internal pure returns (uint256) { uint256 targetAccount = uint160(account_) ^ _ACCOUNT_MIXIN; for (uint256 i = 0; i < accountCounter_._accounts.length; i++) { uint256 iAccount = accountCounter_._accounts[i]; if (iAccount == targetAccount) return i; if (iAccount == 0) { if (!insert_) return _NULL_INDEX; accountCounter_._accounts[i] = targetAccount; accountCounter_._size = i + 1; return i; } } if (!insert_) return _NULL_INDEX; revert("AC: insufficient size"); } function indexOf(AccountCounter.State memory accountCounter_, address account_) internal pure returns (uint256) { return indexOf(accountCounter_, account_, true); } function isNullIndex(uint256 index_) internal pure returns (bool) { return index_ == _NULL_INDEX; } function accountAt(AccountCounter.State memory accountCounter_, uint256 index_) internal pure returns (address) { return address(uint160(accountCounter_._accounts[index_] ^ _ACCOUNT_MIXIN)); } function get(AccountCounter.State memory accountCounter_, address account_) internal pure returns (uint256) { return getAt(accountCounter_, indexOf(accountCounter_, account_)); } function getAt(AccountCounter.State memory accountCounter_, uint256 index_) internal pure returns (uint256) { return accountCounter_._counts[index_]; } function set(AccountCounter.State memory accountCounter_, address account_, uint256 count_) internal pure { setAt(accountCounter_, indexOf(accountCounter_, account_), count_); } function setAt(AccountCounter.State memory accountCounter_, uint256 index_, uint256 count_) internal pure { accountCounter_._counts[index_] = count_; } function add(AccountCounter.State memory accountCounter_, address account_, uint256 count_) internal pure returns (uint256 newCount) { return addAt(accountCounter_, indexOf(accountCounter_, account_), count_); } function addAt(AccountCounter.State memory accountCounter_, uint256 index_, uint256 count_) internal pure returns (uint256 newCount) { newCount = getAt(accountCounter_, index_) + count_; setAt(accountCounter_, index_, newCount); } function sub(AccountCounter.State memory accountCounter_, address account_, uint256 count_) internal pure returns (uint256 newCount) { return subAt(accountCounter_, indexOf(accountCounter_, account_), count_); } function subAt(AccountCounter.State memory accountCounter_, uint256 index_, uint256 count_) internal pure returns (uint256 newCount) { newCount = getAt(accountCounter_, index_) - count_; setAt(accountCounter_, index_, newCount); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; contract LifeControl is Ownable, Pausable { event Terminated(address account); bool public terminated; function pause() public onlyOwner { _pause(); } function unpause() public onlyOwner { _requireNotTerminated(); _unpause(); } function terminate() public onlyOwner whenPaused { _requireNotTerminated(); terminated = true; emit Terminated(_msgSender()); } function _requireNotTerminated() private view { require(!terminated, "LC: terminated"); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {StorageSlot} from "@openzeppelin/contracts/utils/StorageSlot.sol"; abstract contract SimpleInitializable { function _initializerStorage() private pure returns (StorageSlot.AddressSlot storage) { return StorageSlot.getAddressSlot(0x4c943a984a6327bfee4b36cd148236ae13d07c9a3fe7f9857f4809df3e826db1); } modifier init() { _ensureNotInitialized(); _initializeWithSender(); _; } modifier whenInitialized() { _ensureInitialized(); _; } modifier onlyInitializer() { require(msg.sender == initializer(), "SI: sender not initializer"); _; } function initializer() public view returns (address) { return _initializerStorage().value; } function initialized() public view returns (bool) { return initializer() != address(0); } function initialize() external init { _initialize(); } function _initialize() internal virtual; function _initializeWithSender() internal { _initializerStorage().value = msg.sender; } function _ensureInitialized() internal view { require(initialized(), "SI: not initialized"); } function _ensureNotInitialized() internal view { require(!initialized(), "SI: already initialized"); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {SafeERC20, IERC20Permit} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {SignatureDecomposer} from "./SignatureDecomposer.sol"; contract PermitResolver is SignatureDecomposer { function resolvePermit(address token_, address from_, uint256 amount_, uint256 deadline_, bytes calldata signature_) external { SafeERC20.safePermit(IERC20Permit(token_), from_, msg.sender, amount_, deadline_, v(signature_), r(signature_), s(signature_)); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; abstract contract SignatureDecomposer { function r(bytes calldata sig_) internal pure returns (bytes32) { return bytes32(sig_[0:32]); } function s(bytes calldata sig_) internal pure returns (bytes32) { return bytes32(sig_[32:64]); } function v(bytes calldata sig_) internal pure returns (uint8) { return uint8(bytes1(sig_[64:65])); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.16; struct TokenCheck { address token; uint256 minAmount; uint256 maxAmount; } struct TokenUse { address protocol; uint256 chain; address account; uint256[] inIndices; TokenCheck[] outs; bytes args; // Example of reserved value: 0x44796E616D6963 ("Dynamic") } struct SwapStep { uint256 chain; address swapper; address sponsor; uint256 nonce; uint256 deadline; TokenCheck[] ins; TokenCheck[] outs; TokenUse[] uses; } struct Swap { address account; SwapStep[] steps; } struct StealthSwap { uint256 chain; address swapper; address account; bytes32[] stepHashes; } struct UseParams { uint256 chain; address account; TokenCheck[] ins; uint256[] inAmounts; TokenCheck[] outs; bytes args; address msgSender; bytes msgData; } interface IUseProtocol { function use(UseParams calldata params) external payable; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {NativeClaimer} from "../asset/NativeClaimer.sol"; import {NativeReceiver} from "../asset/NativeReceiver.sol"; import {NativeReturnMods} from "../asset/NativeReturnMods.sol"; import {TokenChecker} from "../asset/TokenChecker.sol"; import {TokenHelper} from "../asset/TokenHelper.sol"; import {DelegateManager} from "../delegate/DelegateManager.sol"; import {AccountCounter} from "../misc/AccountCounter.sol"; import {PermitResolver} from "../permit/PermitResolver.sol"; import {AccountWhitelist} from "../whitelist/AccountWhitelist.sol"; import {Withdraw} from "../withdraw/Withdrawable.sol"; import {Swap, SwapStep, TokenUse, StealthSwap, TokenCheck, IUseProtocol, UseParams} from "./Swap.sol"; import {SwapSignatureValidator} from "./SwapSignatureValidator.sol"; struct Permit { address resolver; address token; uint256 amount; uint256 deadline; bytes signature; } struct Call { address target; bytes data; } struct SwapParams { Swap swap; bytes swapSignature; uint256 stepIndex; Permit[] permits; uint256[] inAmounts; Call call; bytes[] useArgs; } struct StealthSwapParams { StealthSwap swap; bytes swapSignature; SwapStep step; Permit[] permits; uint256[] inAmounts; Call call; bytes[] useArgs; } contract Swapper is NativeReceiver, NativeReturnMods { using AccountCounter for AccountCounter.State; address private immutable _swapSignatureValidator; address private immutable _permitResolverWhitelist; address private immutable _useProtocolWhitelist; address private immutable _delegateManager; mapping(address => mapping(uint256 => bool)) private _usedNonces; constructor(address swapSignatureValidator_, address permitResolverWhitelist_, address useProtocolWhitelist_, address delegateManager_) { _swapSignatureValidator = swapSignatureValidator_; _permitResolverWhitelist = permitResolverWhitelist_; _useProtocolWhitelist = useProtocolWhitelist_; _delegateManager = delegateManager_; } function swap(SwapParams calldata params_) external payable { _checkSwapEnabled(); require(params_.stepIndex < params_.swap.steps.length, "SW: no step with provided index"); SwapStep calldata step = params_.swap.steps[params_.stepIndex]; _validateSwapSignature(params_.swap, params_.swapSignature); _performSwapStep(params_.swap.account, step, params_.permits, params_.inAmounts, params_.call, params_.useArgs); } function swapStealth(StealthSwapParams calldata params_) external payable { _checkSwapEnabled(); _validateStealthSwapSignature(params_.swap, params_.swapSignature, params_.step); _performSwapStep(params_.swap.account, params_.step, params_.permits, params_.inAmounts, params_.call, params_.useArgs); } function _checkSwapEnabled() internal view virtual {} // Nothing is hindering by default function _validateSwapSignature(Swap calldata swap_, bytes calldata swapSignature_) private view { if (_isSignaturePresented(swapSignature_)) SwapSignatureValidator(_swapSignatureValidator).validateSwapSignature(swap_, swapSignature_); else _validateSwapManualCaller(swap_.account); } function _validateStealthSwapSignature(StealthSwap calldata stealthSwap_, bytes calldata stealthSwapSignature_, SwapStep calldata step_) private view { if (_isSignaturePresented(stealthSwapSignature_)) SwapSignatureValidator(_swapSignatureValidator).validateStealthSwapStepSignature(step_, stealthSwap_, stealthSwapSignature_); else { _validateSwapManualCaller(stealthSwap_.account); SwapSignatureValidator(_swapSignatureValidator).findStealthSwapStepIndex(step_, stealthSwap_); // Ensure presented } } function _isSignaturePresented(bytes calldata signature_) private pure returns (bool) { return signature_.length > 0; } function _validateSwapManualCaller(address account_) private view { require(msg.sender == account_, "SW: caller must be swap account"); } function _performSwapStep(address account_, SwapStep calldata step_, Permit[] calldata permits_, uint256[] calldata inAmounts_, Call calldata call_, bytes[] calldata useArgs_) private { require(step_.deadline > block.timestamp, "SW: swap step expired"); require(step_.chain == block.chainid, "SW: wrong swap step chain"); require(step_.swapper == address(this), "SW: wrong swap step swapper"); require(step_.ins.length == inAmounts_.length, "SW: in amounts length mismatch"); _useNonce(account_, step_.nonce); _usePermits(account_, permits_); uint256[] memory outAmounts = _performCall(account_, step_.sponsor, step_.ins, inAmounts_, step_.outs, call_); _performUses(step_.uses, useArgs_, step_.outs, outAmounts); } function _useNonce(address account_, uint256 nonce_) private { require(!_usedNonces[account_][nonce_], "SW: invalid nonce"); _usedNonces[account_][nonce_] = true; } function _usePermits(address account_, Permit[] calldata permits_) private { for (uint256 i = 0; i < permits_.length; i++) _usePermit(account_, permits_[i]); } function _usePermit(address account_, Permit calldata permit_) private { require(_isWhitelistedResolver(permit_.resolver), "SW: permitter not whitelisted"); PermitResolver(permit_.resolver).resolvePermit(permit_.token, account_, permit_.amount, permit_.deadline, permit_.signature); } function _isWhitelistedResolver(address resolver_) private view returns (bool) { return AccountWhitelist(_permitResolverWhitelist).isAccountWhitelisted(resolver_); } function _performCall(address account_, address sponsor_, TokenCheck[] calldata ins_, uint256[] calldata inAmounts_, TokenCheck[] calldata outs_, Call calldata call_) private returns (uint256[] memory outAmounts) { NativeClaimer.State memory nativeClaimer; return _performCallWithReturn(account_, sponsor_, ins_, inAmounts_, outs_, call_, nativeClaimer); } function _performCallWithReturn(address account_, address sponsor_, TokenCheck[] calldata ins_, uint256[] calldata inAmounts_, TokenCheck[] calldata outs_, Call calldata call_, NativeClaimer.State memory nativeClaimer_) private returnUnclaimedNative(nativeClaimer_) returns (uint256[] memory outAmounts) { for (uint256 i = 0; i < ins_.length; i++) TokenChecker.checkMinMax(ins_[i], inAmounts_[i]); AccountCounter.State memory inAmountsByToken = AccountCounter.create(ins_.length); for (uint256 i = 0; i < ins_.length; i++) inAmountsByToken.add(ins_[i].token, inAmounts_[i]); address delegate = DelegateManager(_delegateManager).predictDelegateDeploy(account_); require(sponsor_ == account_ || sponsor_ == delegate || _isWhitelistedResolver(sponsor_), "SW: sponsor not allowed"); if (sponsor_ == delegate) _claimDelegateCallIns(account_, inAmountsByToken); else _claimSponsorCallIns(sponsor_, inAmountsByToken, nativeClaimer_); AccountCounter.State memory outBalances = AccountCounter.create(outs_.length); for (uint256 i = 0; i < outs_.length; i++) { address token = outs_[i].token; uint256 sizeBefore = outBalances.size(); uint256 tokenIndex = outBalances.indexOf(token); if (sizeBefore != outBalances.size()) outBalances.setAt(tokenIndex, TokenHelper.balanceOfThis(token, nativeClaimer_)); } uint256 totalOutTokens = outBalances.size(); uint256 sendValue = _approveAssets(inAmountsByToken, call_.target); bytes memory result = Address.functionCallWithValue(call_.target, call_.data, sendValue); _revokeAssets(inAmountsByToken, call_.target); for (uint256 i = 0; i < totalOutTokens; i++) { uint256 tokenInIndex = inAmountsByToken.indexOf(outBalances.accountAt(i), false); if (!AccountCounter.isNullIndex(tokenInIndex)) outBalances.subAt(i, inAmountsByToken.getAt(tokenInIndex)); } for (uint256 i = 0; i < totalOutTokens; i++) outBalances.setAt(i, TokenHelper.balanceOfThis(outBalances.accountAt(i), nativeClaimer_) - outBalances.getAt(i)); outAmounts = abi.decode(result, (uint256[])); require(outAmounts.length == outs_.length, "SW: out amounts length mismatch"); for (uint256 i = 0; i < outs_.length; i++) { uint256 amount = TokenChecker.checkMin(outs_[i], outAmounts[i]); outAmounts[i] = amount; uint256 tokenIndex = outBalances.indexOf(outs_[i].token, false); require(outBalances.getAt(tokenIndex) >= amount, "SW: insufficient out amount"); outBalances.subAt(tokenIndex, amount); } } function _claimDelegateCallIns(address account_, AccountCounter.State memory inAmountsByToken_) private { Withdraw[] memory withdraws = new Withdraw[](inAmountsByToken_.size()); for (uint256 i = 0; i < inAmountsByToken_.size(); i++) withdraws[i] = Withdraw({token: inAmountsByToken_.accountAt(i), amount: inAmountsByToken_.getAt(i), to: address(this)}); if (!DelegateManager(_delegateManager).isDelegateDeployed(account_)) DelegateManager(_delegateManager).deployDelegate(account_); DelegateManager(_delegateManager).withdraw(account_, withdraws); } function _claimSponsorCallIns(address sponsor_, AccountCounter.State memory inAmountsByToken_, NativeClaimer.State memory nativeClaimer_) private { for (uint256 i = 0; i < inAmountsByToken_.size(); i++) TokenHelper.transferToThis(inAmountsByToken_.accountAt(i), sponsor_, inAmountsByToken_.getAt(i), nativeClaimer_); } function _approveAssets(AccountCounter.State memory amountsByToken_, address spender_) private returns (uint256 sendValue) { for (uint256 i = 0; i < amountsByToken_.size(); i++) sendValue += TokenHelper.approveOfThis(amountsByToken_.accountAt(i), spender_, amountsByToken_.getAt(i)); } function _revokeAssets(AccountCounter.State memory amountsByToken_, address spender_) private { for (uint256 i = 0; i < amountsByToken_.size(); i++) TokenHelper.revokeOfThis(amountsByToken_.accountAt(i), spender_); } function _performUses(TokenUse[] calldata uses_, bytes[] calldata useArgs_, TokenCheck[] calldata useIns_, uint256[] memory useInAmounts_) private { uint256 dynamicArgsCursor = 0; for (uint256 i = 0; i < uses_.length; i++) { bytes calldata args = uses_[i].args; if (_shouldUseDynamicArgs(args)) { require(dynamicArgsCursor < useArgs_.length, "SW: not enough dynamic use args"); args = useArgs_[dynamicArgsCursor]; dynamicArgsCursor++; } _performUse(uses_[i], args, useIns_, useInAmounts_); } require(dynamicArgsCursor == useArgs_.length, "SW: too many dynamic use args"); } function _shouldUseDynamicArgs(bytes calldata args_) private pure returns (bool) { if (args_.length != 7) return false; return bytes7(args_) == 0x44796E616D6963; // "Dynamic" in ASCII } function _performUse(TokenUse calldata use_, bytes calldata args_, TokenCheck[] calldata useIns_, uint256[] memory useInAmounts_) private { require(AccountWhitelist(_useProtocolWhitelist).isAccountWhitelisted(use_.protocol), "SW: use protocol not whitelisted"); TokenCheck[] memory ins = new TokenCheck[](use_.inIndices.length); uint256[] memory inAmounts = new uint256[](use_.inIndices.length); for (uint256 i = 0; i < use_.inIndices.length; i++) { uint256 inIndex = use_.inIndices[i]; require(useInAmounts_[inIndex] != type(uint256).max, "SW: input already spent"); ins[i] = useIns_[inIndex]; inAmounts[i] = useInAmounts_[inIndex]; useInAmounts_[inIndex] = type(uint256).max; // Mark as spent } AccountCounter.State memory useInAmounts = AccountCounter.create(use_.inIndices.length); for (uint256 i = 0; i < use_.inIndices.length; i++) useInAmounts.add(ins[i].token, inAmounts[i]); uint256 sendValue = _approveAssets(useInAmounts, use_.protocol); IUseProtocol(use_.protocol).use{value: sendValue}(UseParams({chain: use_.chain, account: use_.account, ins: ins, inAmounts: inAmounts, outs: use_.outs, args: args_, msgSender: msg.sender, msgData: msg.data})); _revokeAssets(useInAmounts, use_.protocol); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {TokenCheck, TokenUse, SwapStep, Swap, StealthSwap} from "./Swap.sol"; contract SwapSignatureValidator { function validateSwapSignature(Swap calldata swap_, bytes calldata swapSignature_) public pure { require(swap_.steps.length > 0, "SV: swap has no steps"); address signer = ECDSA.recover(_hashTypedDataV4(_hashSwap(swap_), swap_.steps[0].chain, swap_.steps[0].swapper), swapSignature_); require(signer == swap_.account, "SV: invalid swap signature"); } function validateStealthSwapStepSignature(SwapStep calldata swapStep_, StealthSwap calldata stealthSwap_, bytes calldata stealthSwapSignature_) public pure returns (uint256 stepIndex) { address signer = ECDSA.recover(_hashTypedDataV4(_hashStealthSwap(stealthSwap_), stealthSwap_.chain, stealthSwap_.swapper), stealthSwapSignature_); require(signer == stealthSwap_.account, "SV: invalid s-swap signature"); return findStealthSwapStepIndex(swapStep_, stealthSwap_); } function findStealthSwapStepIndex(SwapStep calldata swapStep_, StealthSwap calldata stealthSwap_) public pure returns (uint256 stepIndex) { bytes32 stepHash = _hashSwapStep(swapStep_); for (uint256 i = 0; i < stealthSwap_.stepHashes.length; i++) if (stealthSwap_.stepHashes[i] == stepHash) return i; revert("SV: no step hash match in s-swap"); } function _hashTypedDataV4(bytes32 structHash_, uint256 chainId_, address verifyingContract_) private pure returns (bytes32) { bytes32 domainSeparator = keccak256(abi.encode(0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, 0x759f8d0a6b014b7601ff701e703719d70a717971c25deb97628336c51d9e7d86, 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, chainId_, verifyingContract_)); return ECDSA.toTypedDataHash(domainSeparator, structHash_); } function _hashSwap(Swap calldata swap_) private pure returns (bytes32) { return keccak256(abi.encode(0x09b148e744e0e1801943dd449b1fa4d29b7172ff190d22f95b1bb7e5df52e37d, swap_.account, _hashSwapSteps(swap_.steps))); } function _hashSwapSteps(SwapStep[] calldata swapSteps_) private pure returns (bytes32) { bytes memory bytesToHash = new bytes(swapSteps_.length << 5); // * 0x20 uint256 offset; assembly { offset := add(bytesToHash, 0x20) } for (uint256 i = 0; i < swapSteps_.length; i++) { bytes32 hash = _hashSwapStep(swapSteps_[i]); assembly { mstore(offset, hash) offset := add(offset, 0x20) } } return keccak256(bytesToHash); } function _hashSwapStep(SwapStep calldata swapStep_) private pure returns (bytes32) { return keccak256(abi.encode(0x5302e49a52f1122ff531999c0f7afcb4d2bfefa7562dfefbdb7ed114d495ea6a, swapStep_.chain, swapStep_.swapper, swapStep_.sponsor, swapStep_.nonce, swapStep_.deadline, _hashTokenChecks(swapStep_.ins), _hashTokenChecks(swapStep_.outs), _hashTokenUses(swapStep_.uses))); } function _hashTokenChecks(TokenCheck[] calldata tokenChecks_) private pure returns (bytes32) { bytes memory bytesToHash = new bytes(tokenChecks_.length << 5); // * 0x20 uint256 offset; assembly { offset := add(bytesToHash, 0x20) } for (uint256 i = 0; i < tokenChecks_.length; i++) { bytes32 hash = _hashTokenCheck(tokenChecks_[i]); assembly { mstore(offset, hash) offset := add(offset, 0x20) } } return keccak256(bytesToHash); } function _hashTokenCheck(TokenCheck calldata tokenCheck_) private pure returns (bytes32) { return keccak256(abi.encode(0x382391664c9ae06333b02668b6d763ab547bd70c71636e236fdafaacf1e55bdd, tokenCheck_.token, tokenCheck_.minAmount, tokenCheck_.maxAmount)); } function _hashTokenUses(TokenUse[] calldata tokenUses_) private pure returns (bytes32) { bytes memory bytesToHash = new bytes(tokenUses_.length << 5); // * 0x20 uint256 offset; assembly { offset := add(bytesToHash, 0x20) } for (uint256 i = 0; i < tokenUses_.length; i++) { bytes32 hash = _hashTokenUse(tokenUses_[i]); assembly { mstore(offset, hash) offset := add(offset, 0x20) } } return keccak256(bytesToHash); } function _hashTokenUse(TokenUse calldata tokenUse_) private pure returns (bytes32) { return keccak256(abi.encode(0x192f17c5e66907915b200bca0d866184770ff7faf25a0b4ccd2ef26ebd21725a, tokenUse_.protocol, tokenUse_.chain, tokenUse_.account, keccak256(abi.encodePacked(tokenUse_.inIndices)), _hashTokenChecks(tokenUse_.outs), keccak256(tokenUse_.args))); } function _hashStealthSwap(StealthSwap calldata stealthSwap_) private pure returns (bytes32) { return keccak256(abi.encode(0x0f2b1c8dae54aa1b96d626d678ec60a7c6d113b80ccaf635737a6f003d1cbaf5, stealthSwap_.chain, stealthSwap_.swapper, stealthSwap_.account, keccak256(abi.encodePacked(stealthSwap_.stepHashes)))); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {SimpleInitializable} from "../misc/SimpleInitializable.sol"; contract AccountWhitelist is Ownable, SimpleInitializable { using EnumerableSet for EnumerableSet.AddressSet; event AccountAdded(address account); event AccountRemoved(address account); EnumerableSet.AddressSet private _accounts; constructor() { _initializeWithSender(); } function getWhitelistedAccounts() external view returns (address[] memory) { return _accounts.values(); } function isAccountWhitelisted(address account_) external view returns (bool) { return _accounts.contains(account_); } function addAccountToWhitelist(address account_) external whenInitialized onlyOwner { require(_accounts.add(account_), "AW: account already included"); emit AccountAdded(account_); } function removeAccountFromWhitelist(address account_) external whenInitialized onlyOwner { require(_accounts.remove(account_), "AW: account already excluded"); emit AccountRemoved(account_); } function _initialize() internal override { _transferOwnership(initializer()); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {Withdrawable} from "./Withdrawable.sol"; import {AccountWhitelist} from "../whitelist/AccountWhitelist.sol"; abstract contract WhitelistWithdrawable is Withdrawable { address private immutable _withdrawWhitelist; constructor(address withdrawWhitelist_) { _withdrawWhitelist = withdrawWhitelist_; } function _checkWithdraw() internal view override { require(AccountWhitelist(_withdrawWhitelist).isAccountWhitelisted(msg.sender), "WW: withdrawer not whitelisted"); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; import {TokenHelper} from "../asset/TokenHelper.sol"; struct Withdraw { address token; uint256 amount; address to; } abstract contract Withdrawable { event Withdrawn(address token, uint256 amount, address to); function withdraw(Withdraw[] calldata withdraws_) external virtual { _checkWithdraw(); for (uint256 i = 0; i < withdraws_.length; i++) { Withdraw calldata w = withdraws_[i]; TokenHelper.transferFromThis(w.token, w.to, w.amount); emit Withdrawn(w.token, w.amount, w.to); } } function _checkWithdraw() internal view virtual; }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"components":[{"internalType":"address","name":"swapSignatureValidator","type":"address"},{"internalType":"address","name":"permitResolverWhitelist","type":"address"},{"internalType":"address","name":"useProtocolWhitelist","type":"address"},{"internalType":"address","name":"delegateManager","type":"address"},{"internalType":"address","name":"withdrawWhitelist","type":"address"},{"internalType":"address","name":"lifeControl","type":"address"}],"internalType":"struct XSwapConstructorParams","name":"params_","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"Withdrawn","type":"event"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"account","type":"address"},{"components":[{"internalType":"uint256","name":"chain","type":"uint256"},{"internalType":"address","name":"swapper","type":"address"},{"internalType":"address","name":"sponsor","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct TokenCheck[]","name":"ins","type":"tuple[]"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct TokenCheck[]","name":"outs","type":"tuple[]"},{"components":[{"internalType":"address","name":"protocol","type":"address"},{"internalType":"uint256","name":"chain","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"inIndices","type":"uint256[]"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct TokenCheck[]","name":"outs","type":"tuple[]"},{"internalType":"bytes","name":"args","type":"bytes"}],"internalType":"struct TokenUse[]","name":"uses","type":"tuple[]"}],"internalType":"struct SwapStep[]","name":"steps","type":"tuple[]"}],"internalType":"struct Swap","name":"swap","type":"tuple"},{"internalType":"bytes","name":"swapSignature","type":"bytes"},{"internalType":"uint256","name":"stepIndex","type":"uint256"},{"components":[{"internalType":"address","name":"resolver","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct Permit[]","name":"permits","type":"tuple[]"},{"internalType":"uint256[]","name":"inAmounts","type":"uint256[]"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Call","name":"call","type":"tuple"},{"internalType":"bytes[]","name":"useArgs","type":"bytes[]"}],"internalType":"struct SwapParams","name":"params_","type":"tuple"}],"name":"swap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256","name":"chain","type":"uint256"},{"internalType":"address","name":"swapper","type":"address"},{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32[]","name":"stepHashes","type":"bytes32[]"}],"internalType":"struct StealthSwap","name":"swap","type":"tuple"},{"internalType":"bytes","name":"swapSignature","type":"bytes"},{"components":[{"internalType":"uint256","name":"chain","type":"uint256"},{"internalType":"address","name":"swapper","type":"address"},{"internalType":"address","name":"sponsor","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct TokenCheck[]","name":"ins","type":"tuple[]"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct TokenCheck[]","name":"outs","type":"tuple[]"},{"components":[{"internalType":"address","name":"protocol","type":"address"},{"internalType":"uint256","name":"chain","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"inIndices","type":"uint256[]"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct TokenCheck[]","name":"outs","type":"tuple[]"},{"internalType":"bytes","name":"args","type":"bytes"}],"internalType":"struct TokenUse[]","name":"uses","type":"tuple[]"}],"internalType":"struct SwapStep","name":"step","type":"tuple"},{"components":[{"internalType":"address","name":"resolver","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct Permit[]","name":"permits","type":"tuple[]"},{"internalType":"uint256[]","name":"inAmounts","type":"uint256[]"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Call","name":"call","type":"tuple"},{"internalType":"bytes[]","name":"useArgs","type":"bytes[]"}],"internalType":"struct StealthSwapParams","name":"params_","type":"tuple"}],"name":"swapStealth","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"internalType":"struct Withdraw[]","name":"withdraws_","type":"tuple[]"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6101406040523480156200001257600080fd5b50604051620038f7380380620038f78339810160408190526200003591620000a0565b60808082015182516020840151604085015160608601516001600160a01b0393841690955290821660a090815290821660c05292811660e0529081166101005291015116610120526200015a565b80516001600160a01b03811681146200009b57600080fd5b919050565b600060c08284031215620000b357600080fd5b60405160c081016001600160401b0381118282101715620000e457634e487b7160e01b600052604160045260246000fd5b604052620000f28362000083565b8152620001026020840162000083565b6020820152620001156040840162000083565b6040820152620001286060840162000083565b60608201526200013b6080840162000083565b60808201526200014e60a0840162000083565b60a08201529392505050565b60805160a05160c05160e051610100516101205161372a620001cd60003960006104570152600061034901526000818161116201528181611ef701528181611f9e015261203d0152600061169d01526000611c760152600081816105630152818161062d01526108d9015261372a6000f3fe6080604052600436106100385760003560e01c8063160b723c146100445780636f1626af14610066578063d49959b61461007957600080fd5b3661003f57005b600080fd5b34801561005057600080fd5b5061006461005f366004612ab6565b61008c565b005b610064610074366004612b3d565b61016c565b610064610087366004612b3d565b610207565b610094610334565b60005b8181101561016757368383838181106100b2576100b2612b72565b6060029190910191506100e790506100cd6020830183612bad565b6100dd6060840160408501612bad565b836020013561040a565b7fcbcdbdf10631a43cc99c80acace8232649421c3f4f73919f16013d47c83a687a6101156020830183612bad565b602083013561012a6060850160408601612bad565b604080516001600160a01b039485168152602081019390935292168183015290519081900360600190a1508061015f81612be0565b915050610097565b505050565b610174610455565b6101a06101818280612bf9565b61018e6020840184612c19565b61019b6040860186612c67565b610524565b6102046101ad8280612bf9565b6101be906060810190604001612bad565b6101cb6040840184612c67565b6101d86060850185612c7d565b6101e56080870187612c7d565b6101f260a0890189612cc7565b6101ff60c08a018a612c7d565b6106ac565b50565b61020f610455565b6102198180612cc7565b610227906020810190612c7d565b90508160400135106102805760405162461bcd60e51b815260206004820152601f60248201527f53573a206e6f207374657020776974682070726f766964656420696e6465780060448201526064015b60405180910390fd5b3661028b8280612cc7565b610299906020810190612c7d565b83604001358181106102ad576102ad612b72565b90506020028101906102bf9190612c67565b90506102e06102ce8380612cc7565b6102db6020850185612c19565b61089a565b6103306102ed8380612cc7565b6102fb906020810190612bad565b826103096060860186612c7d565b6103166080880188612c7d565b61032360a08a018a612cc7565b6101ff60c08b018b612c7d565b5050565b604051638907e78760e01b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690638907e78790602401602060405180830381865afa158015610398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bc9190612cdd565b6104085760405162461bcd60e51b815260206004820152601e60248201527f57573a2077697468647261776572206e6f742077686974656c697374656400006044820152606401610277565b565b80801561044f5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0385161461044557610440848484610957565b61044f565b61044f8383610a00565b50505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d79190612cdd565b156104085760405162461bcd60e51b815260206004820152601360248201527f58533a207377617070696e6720706175736564000000000000000000000000006044820152606401610277565b61052e8383610b19565b156105e5576040517f0148b1950000000000000000000000000000000000000000000000000000000081526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630148b1959061059e9084908890889088906004016130d7565b602060405180830381865afa1580156105bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105df919061311c565b5061044f565b6105fd6105f86060860160408701612bad565b610b23565b6040517fdc68f5ed0000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063dc68f5ed906106649084908890600401613135565b602060405180830381865afa158015610681573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a5919061311c565b5050505050565b428860800135116106ff5760405162461bcd60e51b815260206004820152601560248201527f53573a20737761702073746570206578706972656400000000000000000000006044820152606401610277565b8735461461074f5760405162461bcd60e51b815260206004820152601960248201527f53573a2077726f6e672073776170207374657020636861696e000000000000006044820152606401610277565b3061076060408a0160208b01612bad565b6001600160a01b0316146107b65760405162461bcd60e51b815260206004820152601b60248201527f53573a2077726f6e6720737761702073746570207377617070657200000000006044820152606401610277565b836107c460a08a018a61315a565b9050146108135760405162461bcd60e51b815260206004820152601e60248201527f53573a20696e20616d6f756e7473206c656e677468206d69736d6174636800006044820152606401610277565b610821898960600135610b7b565b61082c898888610c1b565b60006108678a61084260608c0160408d01612bad565b61084f60a08d018d61315a565b8a8a8f8060c00190610861919061315a565b8c610c65565b905061088e61087960e08b018b612c7d565b858561088860c08f018f61315a565b87610c9e565b50505050505050505050565b6108a48282610b19565b15610947576040517fb749f3ed0000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b749f3ed90610912908690869086906004016131a3565b60006040518083038186803b15801561092a57600080fd5b505afa15801561093e573d6000803e3d6000fd5b50505050505050565b6101676105f86020850185612bad565b6040516001600160a01b0383166024820152604481018290526101679084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610e18565b80471015610a505760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610277565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610a9d576040519150601f19603f3d011682016040523d82523d6000602084013e610aa2565b606091505b50509050806101675760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610277565b8015155b92915050565b336001600160a01b038216146102045760405162461bcd60e51b815260206004820152601f60248201527f53573a2063616c6c6572206d7573742062652073776170206163636f756e74006044820152606401610277565b6001600160a01b03821660009081526020818152604080832084845290915290205460ff1615610bed5760405162461bcd60e51b815260206004820152601160248201527f53573a20696e76616c6964206e6f6e63650000000000000000000000000000006044820152606401610277565b6001600160a01b0390911660009081526020818152604080832093835292905220805460ff19166001179055565b60005b8181101561044f57610c5384848484818110610c3c57610c3c612b72565b9050602002810190610c4e9190613252565b610efd565b80610c5d81612be0565b915050610c1e565b6060610c7d6040518060200160405280600081525090565b610c8f8b8b8b8b8b8b8b8b8b8a610ff8565b9b9a5050505050505050505050565b6000805b87811015610dbe573660008a8a84818110610cbf57610cbf612b72565b9050602002810190610cd19190613268565b610cdf9060a0810190612c19565b91509150610ced828261162c565b15610d7857878410610d415760405162461bcd60e51b815260206004820152601f60248201527f53573a206e6f7420656e6f7567682064796e616d6963207573652061726773006044820152606401610277565b888885818110610d5357610d53612b72565b9050602002810190610d659190612c19565b915091508380610d7490612be0565b9450505b610da98b8b85818110610d8d57610d8d612b72565b9050602002810190610d9f9190613268565b83838a8a8a611693565b50508080610db690612be0565b915050610ca2565b50808514610e0e5760405162461bcd60e51b815260206004820152601d60248201527f53573a20746f6f206d616e792064796e616d69632075736520617267730000006044820152606401610277565b5050505050505050565b6000610e6d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c3b9092919063ffffffff16565b8051909150156101675780806020019051810190610e8b9190612cdd565b6101675760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610277565b610f12610f0d6020830183612bad565b611c54565b610f5e5760405162461bcd60e51b815260206004820152601d60248201527f53573a207065726d6974746572206e6f742077686974656c69737465640000006044820152606401610277565b610f6b6020820182612bad565b6001600160a01b0316639d5ca87a610f896040840160208501612bad565b8460408501356060860135610fa16080880188612c19565b6040518763ffffffff1660e01b8152600401610fc29695949392919061327e565b600060405180830381600087803b158015610fdc57600080fd5b505af1158015610ff0573d6000803e3d6000fd5b505050505050565b606081611003815190565b156110505760405162461bcd60e51b815260206004820152601a60248201527f4e523a20636c61696d657220616c726561647920696e207573650000000000006044820152606401610277565b60005b898110156110a6576110948b8b8381811061107057611070612b72565b9050606002018a8a8481811061108857611088612b72565b90506020020135611ce3565b8061109e81612be0565b915050611053565b5060006110b28a611d00565b905060005b8a811015611126576111138c8c838181106110d4576110d4612b72565b6110ea9260206060909202019081019150612bad565b8b8b848181106110fc576110fc612b72565b9050602002013584611db69092919063ffffffff16565b508061111e81612be0565b9150506110b7565b506040517fc3b4bd4e0000000000000000000000000000000000000000000000000000000081526001600160a01b038e811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063c3b4bd4e90602401602060405180830381865afa1580156111ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cf91906132c3565b90508d6001600160a01b03168d6001600160a01b031614806112025750806001600160a01b03168d6001600160a01b0316145b8061121157506112118d611c54565b61125d5760405162461bcd60e51b815260206004820152601760248201527f53573a2073706f6e736f72206e6f7420616c6c6f7765640000000000000000006044820152606401610277565b806001600160a01b03168d6001600160a01b031603611285576112808e83611dcc565b611290565b6112908d83876120a2565b600061129b88611d00565b905060005b8881101561132e5760008a8a838181106112bc576112bc612b72565b6112d29260206060909202019081019150612bad565b905060006112e1846040015190565b905060006112ef85846120e1565b90506112fc856040015190565b82146113185761131881611310858d6120ef565b8791906120fc565b505050808061132690612be0565b9150506112a0565b50600061133c826040015190565b905060006113568561135160208c018c612bad565b612124565b905060006113b361136a60208c018c612bad565b61137760208d018d612c19565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250879250612176915050565b90506113cb866113c660208d018d612bad565b61219c565b60005b838110156114245760006113ee6113e587846121d0565b8990600061221a565b905060001981146114115761140f826114078a84612349565b889190612371565b505b508061141c81612be0565b9150506113ce565b5060005b8381101561146d5761145b8161143e8782612349565b61145161144b89866121d0565b8e6120ef565b61131091906132e0565b8061146581612be0565b915050611428565b5080806020019051810190611482919061333a565b80519098508b146114d55760405162461bcd60e51b815260206004820152601f60248201527f53573a206f757420616d6f756e7473206c656e677468206d69736d61746368006044820152606401610277565b60005b8b8110156115ef57600061151c8e8e848181106114f7576114f7612b72565b9050606002018b848151811061150f5761150f612b72565b6020026020010151612395565b9050808a838151811061153157611531612b72565b60200260200101818152505060006115738f8f8581811061155457611554612b72565b61156a9260206060909202019081019150612bad565b8890600061221a565b9050816115808883612349565b10156115ce5760405162461bcd60e51b815260206004820152601b60248201527f53573a20696e73756666696369656e74206f757420616d6f756e7400000000006044820152606401610277565b6115d9878284612371565b50505080806115e790612be0565b9150506114d8565b5050505050505061161d73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee33611618846123b4565b61040a565b509a9950505050505050505050565b60006007821461163e57506000610b1d565b61164882846133d4565b7fffffffffffffff00000000000000000000000000000000000000000000000000167f44796e616d696300000000000000000000000000000000000000000000000000149392505050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016638907e7876116cf6020890189612bad565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561172b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174f9190612cdd565b61179b5760405162461bcd60e51b815260206004820181905260248201527f53573a207573652070726f746f636f6c206e6f742077686974656c69737465646044820152606401610277565b60006117aa6060880188612c7d565b905067ffffffffffffffff8111156117c4576117c46132f3565b60405190808252806020026020018201604052801561182257816020015b61180f604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b8152602001906001900390816117e25790505b50905060006118346060890189612c7d565b905067ffffffffffffffff81111561184e5761184e6132f3565b604051908082528060200260200182016040528015611877578160200160208202803683370190505b50905060005b61188a60608a018a612c7d565b90508110156119d55760006118a260608b018b612c7d565b838181106118b2576118b2612b72565b9050602002013590506000198582815181106118d0576118d0612b72565b6020026020010151036119255760405162461bcd60e51b815260206004820152601760248201527f53573a20696e70757420616c7265616479207370656e740000000000000000006044820152606401610277565b86868281811061193757611937612b72565b90506060020180360381019061194d919061341c565b84838151811061195f5761195f612b72565b602002602001018190525084818151811061197c5761197c612b72565b602002602001015183838151811061199657611996612b72565b6020026020010181815250506000198582815181106119b7576119b7612b72565b602090810291909101015250806119cd81612be0565b91505061187d565b5060006119ef6119e860608b018b612c7d565b9050611d00565b905060005b611a0160608b018b612c7d565b9050811015611a6857611a55848281518110611a1f57611a1f612b72565b602002602001015160000151848381518110611a3d57611a3d612b72565b602002602001015184611db69092919063ffffffff16565b5080611a6081612be0565b9150506119f4565b506000611a7c8261135160208d018d612bad565b9050611a8b60208b018b612bad565b6001600160a01b0316635d9c8b1a826040518061010001604052808e6020013581526020018e6040016020810190611ac39190612bad565b6001600160a01b031681526020018881526020018781526020018e8060800190611aed919061315a565b808060200260200160405190810160405280939291908181526020016000905b82821015611b3957611b2a6060830286013681900381019061341c565b81526020019060010190611b0d565b505050505081526020018d8d8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050336020808501919091526040805136601f810184900484028201840183528082529190950194939250908190840183828082843760009201919091525050509152506040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152611bf5919060040161354d565b6000604051808303818588803b158015611c0e57600080fd5b505af1158015611c22573d6000803e3d6000fd5b5061088e93508592506113c691505060208d018d612bad565b6060611c4a84846000856123c3565b90505b9392505050565b604051638907e78760e01b81526001600160a01b0382811660048301526000917f000000000000000000000000000000000000000000000000000000000000000090911690638907e78790602401602060405180830381865afa158015611cbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1d9190612cdd565b611cec826124b7565b611cf6828261250f565b6103308282612563565b611d2460405180606001604052806060815260200160608152602001600081525090565b8167ffffffffffffffff811115611d3d57611d3d6132f3565b604051908082528060200260200182016040528015611d66578160200160208202803683370190505b5081528167ffffffffffffffff811115611d8257611d826132f3565b604051908082528060200260200182016040528015611dab578160200160208202803683370190505b506020820152919050565b6000611c4a84611dc686866120e1565b846125b7565b6000611dd9826040015190565b67ffffffffffffffff811115611df157611df16132f3565b604051908082528060200260200182016040528015611e3c57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611e0f5790505b50905060005b6040830151811015611ebe57604080516060810190915280611e6485846121d0565b6001600160a01b03168152602001611e7c8584612349565b8152602001306001600160a01b0316815250828281518110611ea057611ea0612b72565b60200260200101819052508080611eb690612be0565b915050611e42565b506040517f160051360000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301527f00000000000000000000000000000000000000000000000000000000000000001690631600513690602401602060405180830381865afa158015611f3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f629190612cdd565b61200d576040517fd6b59bdb0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063d6b59bdb906024016020604051808303816000875af1158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b91906132c3565b505b6040517f7262e1980000000000000000000000000000000000000000000000000000000081526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690637262e198906120749086908590600401613622565b600060405180830381600087803b15801561208e57600080fd5b505af115801561093e573d6000803e3d6000fd5b60005b604083015181101561044f576120cf6120be84836121d0565b856120c98685612349565b856125ce565b806120d981612be0565b9150506120a5565b6000611c4d8383600161221a565b6000611c4d83308461266c565b808360200151838151811061211357612113612b72565b602002602001018181525050505050565b6000805b604084015181101561216f5761215161214185836121d0565b8461214c8785612349565b612724565b61215b9083613693565b91508061216781612be0565b915050612128565b5092915050565b6060611c4a8484846040518060600160405280602981526020016136cc602991396123c3565b60005b6040830151811015610167576121be6121b884836121d0565b8361276c565b806121c881612be0565b91505061219f565b60007facc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc08360000151838151811061220957612209612b72565b602002602001015118905092915050565b60006001600160a01b0383167facc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc018815b8551518110156122f05760008660000151828151811061226c5761226c612b72565b6020026020010151905082810361228757509150611c4d9050565b806000036122dd57846122a1576000199350505050611c4d565b82876000015183815181106122b8576122b8612b72565b60209081029190910101526122ce826001613693565b6040880152509150611c4d9050565b50806122e881612be0565b91505061224a565b508261230157600019915050611c4d565b60405162461bcd60e51b815260206004820152601560248201527f41433a20696e73756666696369656e742073697a6500000000000000000000006044820152606401610277565b60008260200151828151811061236157612361612b72565b6020026020010151905092915050565b60008161237e8585612349565b61238891906132e0565b9050611c4d8484836120fc565b60006123a0836124b7565b6123aa838361250f565b611c4d838361279c565b8051600090610b1d90346132e0565b60608247101561243b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610277565b600080866001600160a01b0316858760405161245791906136a6565b60006040518083038185875af1925050503d8060008114612494576040519150601f19603f3d011682016040523d82523d6000602084013e612499565b606091505b50915091506124aa878383876127b9565b925050505b949350505050565b8060400135816020013511156102045760405162461bcd60e51b815260206004820152601d60248201527f54433a20756e6f726465726564206d696e2f6d617820616d6f756e74730000006044820152606401610277565b81602001358110156103305760405162461bcd60e51b815260206004820152601d60248201527f54433a20696e73756666696369656e7420746f6b656e20616d6f756e740000006044820152606401610277565b81604001358111156103305760405162461bcd60e51b815260206004820152601a60248201527f54433a2065786365737369766520746f6b656e20616d6f756e740000000000006044820152606401610277565b6000816125c48585612349565b6123889190613693565b8180156106a55773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b03861603612660576001600160a01b03841633146126515760405162461bcd60e51b815260206004820152601d60248201527f54483a206e617469766520616c6c6f77732073656e646572206f6e6c790000006044820152606401610277565b61265b8284612832565b6106a5565b6106a5858530866128a3565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0385161461271a576040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528516906370a0823190602401602060405180830381865afa1580156126f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612715919061311c565b611c4a565b611c4a83836128f4565b60008180156127645773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0386160361275957829150612764565b61276485858561293e565b509392505050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b03831614610330576103308282600061293e565b6000826040013582106127b3578260400135611c4d565b50919050565b60608315612828578251600003612821576001600160a01b0385163b6128215760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610277565b50816124af565b6124af8383612a8c565b8061283c836123b4565b101561288a5760405162461bcd60e51b815260206004820152601a60248201527f4e433a20696e73756666696369656e74206d73672076616c75650000000000006044820152606401610277565b808260000181815161289c9190613693565b9052505050565b6040516001600160a01b038085166024830152831660448201526064810182905261044f9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161099c565b6000336001600160a01b038416036129165761290f826123b4565b9050610b1d565b506001600160a01b038216803190309003610b1d57612934826123b4565b611c4d90826132e0565b8015806129d157506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156129ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129cf919061311c565b155b612a435760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610277565b6040516001600160a01b0383166024820152604481018290526101679084907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161099c565b815115612a9c5781518083602001fd5b8060405162461bcd60e51b815260040161027791906136b8565b60008060208385031215612ac957600080fd5b823567ffffffffffffffff80821115612ae157600080fd5b818501915085601f830112612af557600080fd5b813581811115612b0457600080fd5b866020606083028501011115612b1957600080fd5b60209290920196919550909350505050565b600060e082840312156127b357600080fd5b600060208284031215612b4f57600080fd5b813567ffffffffffffffff811115612b6657600080fd5b6124af84828501612b2b565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461020457600080fd5b8035612ba881612b88565b919050565b600060208284031215612bbf57600080fd5b8135611c4d81612b88565b634e487b7160e01b600052601160045260246000fd5b600060018201612bf257612bf2612bca565b5060010190565b60008235607e19833603018112612c0f57600080fd5b9190910192915050565b6000808335601e19843603018112612c3057600080fd5b83018035915067ffffffffffffffff821115612c4b57600080fd5b602001915036819003821315612c6057600080fd5b9250929050565b6000823560fe19833603018112612c0f57600080fd5b6000808335601e19843603018112612c9457600080fd5b83018035915067ffffffffffffffff821115612caf57600080fd5b6020019150600581901b3603821315612c6057600080fd5b60008235603e19833603018112612c0f57600080fd5b600060208284031215612cef57600080fd5b81518015158114611c4d57600080fd5b6000808335601e19843603018112612d1657600080fd5b830160208101925035905067ffffffffffffffff811115612d3657600080fd5b606081023603821315612c6057600080fd5b8183526000602080850194508260005b85811015612d9a578135612d6b81612b88565b6001600160a01b0316875281830135838801526040808301359088015260609687019690910190600101612d58565b509495945050505050565b6000808335601e19843603018112612dbc57600080fd5b830160208101925035905067ffffffffffffffff811115612ddc57600080fd5b8060051b3603821315612c6057600080fd5b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612e2057600080fd5b8260051b80836020870137939093016020019392505050565b6000808335601e19843603018112612e5057600080fd5b830160208101925035905067ffffffffffffffff811115612e7057600080fd5b803603821315612c6057600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b81019150846000805b88811015612f9e578385038a52823560be19893603018112612ee3578283fd5b880160c08135612ef281612b88565b6001600160a01b039081168852828901358989015260409081840135612f1781612b88565b16908801526060612f2a83820184612da5565b83838b0152612f3c848b018284612dee565b93505050506080612f4f81840184612cff565b898403838b0152612f61848284612d48565b935050505060a0612f7481840184612e39565b9350888303828a0152612f88838583612e7f565b9d8a019d98505050938701935050600101612ec3565b509298975050505050505050565b6000610100823584526020830135612fc381612b88565b6001600160a01b03166020850152612fdd60408401612b9d565b6001600160a01b038116604086015250606083013560608501526080830135608085015261300e60a0840184612cff565b8260a08701526130218387018284612d48565b9250505061303260c0840184612cff565b85830360c0870152613045838284612d48565b9250505061305660e0840184612da5565b85830360e0870152613069838284612ea8565b9695505050505050565b803582526000602082013561308781612b88565b6001600160a01b0390811660208501526040830135906130a682612b88565b1660408401526130b96060830183612da5565b608060608601526130ce608086018284612dee565b95945050505050565b6060815260006130ea6060830187612fac565b82810360208401526130fc8187613073565b90508281036040840152613111818587612e7f565b979650505050505050565b60006020828403121561312e57600080fd5b5051919050565b6040815260006131486040830185612fac565b82810360208401526130ce8185613073565b6000808335601e1984360301811261317157600080fd5b83018035915067ffffffffffffffff82111561318c57600080fd5b6020019150606081023603821315612c6057600080fd5b6040815260006080820185356131b881612b88565b6001600160a01b0316604084015260206131d487820188612da5565b604060608701528381855260a08701905060a08260051b8801019450826000805b8481101561323957898803609f1901845282353687900360fe1901811261321a578283fd5b61322689888301612fac565b98505092860192918601916001016131f5565b5050505050508382038185015250613069818587612e7f565b60008235609e19833603018112612c0f57600080fd5b6000823560be19833603018112612c0f57600080fd5b60006001600160a01b03808916835280881660208401525085604083015284606083015260a060808301526132b760a083018486612e7f565b98975050505050505050565b6000602082840312156132d557600080fd5b8151611c4d81612b88565b81810381811115610b1d57610b1d612bca565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613332576133326132f3565b604052919050565b6000602080838503121561334d57600080fd5b825167ffffffffffffffff8082111561336557600080fd5b818501915085601f83011261337957600080fd5b81518181111561338b5761338b6132f3565b8060051b915061339c848301613309565b81815291830184019184810190888411156133b657600080fd5b938501935b838510156132b7578451825293850193908501906133bb565b7fffffffffffffff0000000000000000000000000000000000000000000000000081358181169160078510156134145780818660070360031b1b83161692505b505092915050565b60006060828403121561342e57600080fd5b6040516060810181811067ffffffffffffffff82111715613451576134516132f3565b604052823561345f81612b88565b8152602083810135908201526040928301359281019290925250919050565b600081518084526020808501945080840160005b83811015612d9a57815180516001600160a01b0316885283810151848901526040908101519088015260609096019590820190600101613492565b600081518084526020808501945080840160005b83811015612d9a578151875295820195908201906001016134e1565b60005b83811015613518578181015183820152602001613500565b50506000910152565b600081518084526135398160208601602086016134fd565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015161357460408401826001600160a01b03169052565b50604083015161010080606085015261359161012085018361347e565b91506060850151601f19808685030160808701526135af84836134cd565b935060808701519150808685030160a08701526135cc848361347e565b935060a08701519150808685030160c08701526135e98483613521565b935060c0870151915061360760e08701836001600160a01b03169052565b60e08701519150808685030183870152506130698382613521565b600060408083016001600160a01b0380871685526020838187015282875180855260609450848801915082890160005b8281101561368357815180518716855285810151868601528801518616888501529286019290840190600101613652565b50919a9950505050505050505050565b80820180821115610b1d57610b1d612bca565b60008251612c0f8184602087016134fd565b602081526000611c4d602083018461352156fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a264697066735822122014cb68f470a03686ce432b5b20443c0d00495f688c203afb37c9ee6523f56cf064736f6c6343000810003300000000000000000000000029efba36c0b750c5029a402d2c0f8a70823259680000000000000000000000004bb5bd82d6bb49d7a45c57db3bb6d2d726f6f92f00000000000000000000000007dba65c8d7d725638265e508e3fa432454d462700000000000000000000000063aaf1794b789aee4aae3d4eae5f7ea271bffe7b000000000000000000000000f965d76eaaba76091966761c3c5ce29a9b12470f00000000000000000000000081931d7e2c11af310dfef155eaa383b034525068
Deployed Bytecode
0x6080604052600436106100385760003560e01c8063160b723c146100445780636f1626af14610066578063d49959b61461007957600080fd5b3661003f57005b600080fd5b34801561005057600080fd5b5061006461005f366004612ab6565b61008c565b005b610064610074366004612b3d565b61016c565b610064610087366004612b3d565b610207565b610094610334565b60005b8181101561016757368383838181106100b2576100b2612b72565b6060029190910191506100e790506100cd6020830183612bad565b6100dd6060840160408501612bad565b836020013561040a565b7fcbcdbdf10631a43cc99c80acace8232649421c3f4f73919f16013d47c83a687a6101156020830183612bad565b602083013561012a6060850160408601612bad565b604080516001600160a01b039485168152602081019390935292168183015290519081900360600190a1508061015f81612be0565b915050610097565b505050565b610174610455565b6101a06101818280612bf9565b61018e6020840184612c19565b61019b6040860186612c67565b610524565b6102046101ad8280612bf9565b6101be906060810190604001612bad565b6101cb6040840184612c67565b6101d86060850185612c7d565b6101e56080870187612c7d565b6101f260a0890189612cc7565b6101ff60c08a018a612c7d565b6106ac565b50565b61020f610455565b6102198180612cc7565b610227906020810190612c7d565b90508160400135106102805760405162461bcd60e51b815260206004820152601f60248201527f53573a206e6f207374657020776974682070726f766964656420696e6465780060448201526064015b60405180910390fd5b3661028b8280612cc7565b610299906020810190612c7d565b83604001358181106102ad576102ad612b72565b90506020028101906102bf9190612c67565b90506102e06102ce8380612cc7565b6102db6020850185612c19565b61089a565b6103306102ed8380612cc7565b6102fb906020810190612bad565b826103096060860186612c7d565b6103166080880188612c7d565b61032360a08a018a612cc7565b6101ff60c08b018b612c7d565b5050565b604051638907e78760e01b81523360048201527f000000000000000000000000f965d76eaaba76091966761c3c5ce29a9b12470f6001600160a01b031690638907e78790602401602060405180830381865afa158015610398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bc9190612cdd565b6104085760405162461bcd60e51b815260206004820152601e60248201527f57573a2077697468647261776572206e6f742077686974656c697374656400006044820152606401610277565b565b80801561044f5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0385161461044557610440848484610957565b61044f565b61044f8383610a00565b50505050565b7f00000000000000000000000081931d7e2c11af310dfef155eaa383b0345250686001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d79190612cdd565b156104085760405162461bcd60e51b815260206004820152601360248201527f58533a207377617070696e6720706175736564000000000000000000000000006044820152606401610277565b61052e8383610b19565b156105e5576040517f0148b1950000000000000000000000000000000000000000000000000000000081526001600160a01b037f00000000000000000000000029efba36c0b750c5029a402d2c0f8a70823259681690630148b1959061059e9084908890889088906004016130d7565b602060405180830381865afa1580156105bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105df919061311c565b5061044f565b6105fd6105f86060860160408701612bad565b610b23565b6040517fdc68f5ed0000000000000000000000000000000000000000000000000000000081526001600160a01b037f00000000000000000000000029efba36c0b750c5029a402d2c0f8a7082325968169063dc68f5ed906106649084908890600401613135565b602060405180830381865afa158015610681573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a5919061311c565b5050505050565b428860800135116106ff5760405162461bcd60e51b815260206004820152601560248201527f53573a20737761702073746570206578706972656400000000000000000000006044820152606401610277565b8735461461074f5760405162461bcd60e51b815260206004820152601960248201527f53573a2077726f6e672073776170207374657020636861696e000000000000006044820152606401610277565b3061076060408a0160208b01612bad565b6001600160a01b0316146107b65760405162461bcd60e51b815260206004820152601b60248201527f53573a2077726f6e6720737761702073746570207377617070657200000000006044820152606401610277565b836107c460a08a018a61315a565b9050146108135760405162461bcd60e51b815260206004820152601e60248201527f53573a20696e20616d6f756e7473206c656e677468206d69736d6174636800006044820152606401610277565b610821898960600135610b7b565b61082c898888610c1b565b60006108678a61084260608c0160408d01612bad565b61084f60a08d018d61315a565b8a8a8f8060c00190610861919061315a565b8c610c65565b905061088e61087960e08b018b612c7d565b858561088860c08f018f61315a565b87610c9e565b50505050505050505050565b6108a48282610b19565b15610947576040517fb749f3ed0000000000000000000000000000000000000000000000000000000081526001600160a01b037f00000000000000000000000029efba36c0b750c5029a402d2c0f8a7082325968169063b749f3ed90610912908690869086906004016131a3565b60006040518083038186803b15801561092a57600080fd5b505afa15801561093e573d6000803e3d6000fd5b50505050505050565b6101676105f86020850185612bad565b6040516001600160a01b0383166024820152604481018290526101679084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610e18565b80471015610a505760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610277565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610a9d576040519150601f19603f3d011682016040523d82523d6000602084013e610aa2565b606091505b50509050806101675760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610277565b8015155b92915050565b336001600160a01b038216146102045760405162461bcd60e51b815260206004820152601f60248201527f53573a2063616c6c6572206d7573742062652073776170206163636f756e74006044820152606401610277565b6001600160a01b03821660009081526020818152604080832084845290915290205460ff1615610bed5760405162461bcd60e51b815260206004820152601160248201527f53573a20696e76616c6964206e6f6e63650000000000000000000000000000006044820152606401610277565b6001600160a01b0390911660009081526020818152604080832093835292905220805460ff19166001179055565b60005b8181101561044f57610c5384848484818110610c3c57610c3c612b72565b9050602002810190610c4e9190613252565b610efd565b80610c5d81612be0565b915050610c1e565b6060610c7d6040518060200160405280600081525090565b610c8f8b8b8b8b8b8b8b8b8b8a610ff8565b9b9a5050505050505050505050565b6000805b87811015610dbe573660008a8a84818110610cbf57610cbf612b72565b9050602002810190610cd19190613268565b610cdf9060a0810190612c19565b91509150610ced828261162c565b15610d7857878410610d415760405162461bcd60e51b815260206004820152601f60248201527f53573a206e6f7420656e6f7567682064796e616d6963207573652061726773006044820152606401610277565b888885818110610d5357610d53612b72565b9050602002810190610d659190612c19565b915091508380610d7490612be0565b9450505b610da98b8b85818110610d8d57610d8d612b72565b9050602002810190610d9f9190613268565b83838a8a8a611693565b50508080610db690612be0565b915050610ca2565b50808514610e0e5760405162461bcd60e51b815260206004820152601d60248201527f53573a20746f6f206d616e792064796e616d69632075736520617267730000006044820152606401610277565b5050505050505050565b6000610e6d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c3b9092919063ffffffff16565b8051909150156101675780806020019051810190610e8b9190612cdd565b6101675760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610277565b610f12610f0d6020830183612bad565b611c54565b610f5e5760405162461bcd60e51b815260206004820152601d60248201527f53573a207065726d6974746572206e6f742077686974656c69737465640000006044820152606401610277565b610f6b6020820182612bad565b6001600160a01b0316639d5ca87a610f896040840160208501612bad565b8460408501356060860135610fa16080880188612c19565b6040518763ffffffff1660e01b8152600401610fc29695949392919061327e565b600060405180830381600087803b158015610fdc57600080fd5b505af1158015610ff0573d6000803e3d6000fd5b505050505050565b606081611003815190565b156110505760405162461bcd60e51b815260206004820152601a60248201527f4e523a20636c61696d657220616c726561647920696e207573650000000000006044820152606401610277565b60005b898110156110a6576110948b8b8381811061107057611070612b72565b9050606002018a8a8481811061108857611088612b72565b90506020020135611ce3565b8061109e81612be0565b915050611053565b5060006110b28a611d00565b905060005b8a811015611126576111138c8c838181106110d4576110d4612b72565b6110ea9260206060909202019081019150612bad565b8b8b848181106110fc576110fc612b72565b9050602002013584611db69092919063ffffffff16565b508061111e81612be0565b9150506110b7565b506040517fc3b4bd4e0000000000000000000000000000000000000000000000000000000081526001600160a01b038e811660048301526000917f00000000000000000000000063aaf1794b789aee4aae3d4eae5f7ea271bffe7b9091169063c3b4bd4e90602401602060405180830381865afa1580156111ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cf91906132c3565b90508d6001600160a01b03168d6001600160a01b031614806112025750806001600160a01b03168d6001600160a01b0316145b8061121157506112118d611c54565b61125d5760405162461bcd60e51b815260206004820152601760248201527f53573a2073706f6e736f72206e6f7420616c6c6f7765640000000000000000006044820152606401610277565b806001600160a01b03168d6001600160a01b031603611285576112808e83611dcc565b611290565b6112908d83876120a2565b600061129b88611d00565b905060005b8881101561132e5760008a8a838181106112bc576112bc612b72565b6112d29260206060909202019081019150612bad565b905060006112e1846040015190565b905060006112ef85846120e1565b90506112fc856040015190565b82146113185761131881611310858d6120ef565b8791906120fc565b505050808061132690612be0565b9150506112a0565b50600061133c826040015190565b905060006113568561135160208c018c612bad565b612124565b905060006113b361136a60208c018c612bad565b61137760208d018d612c19565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250879250612176915050565b90506113cb866113c660208d018d612bad565b61219c565b60005b838110156114245760006113ee6113e587846121d0565b8990600061221a565b905060001981146114115761140f826114078a84612349565b889190612371565b505b508061141c81612be0565b9150506113ce565b5060005b8381101561146d5761145b8161143e8782612349565b61145161144b89866121d0565b8e6120ef565b61131091906132e0565b8061146581612be0565b915050611428565b5080806020019051810190611482919061333a565b80519098508b146114d55760405162461bcd60e51b815260206004820152601f60248201527f53573a206f757420616d6f756e7473206c656e677468206d69736d61746368006044820152606401610277565b60005b8b8110156115ef57600061151c8e8e848181106114f7576114f7612b72565b9050606002018b848151811061150f5761150f612b72565b6020026020010151612395565b9050808a838151811061153157611531612b72565b60200260200101818152505060006115738f8f8581811061155457611554612b72565b61156a9260206060909202019081019150612bad565b8890600061221a565b9050816115808883612349565b10156115ce5760405162461bcd60e51b815260206004820152601b60248201527f53573a20696e73756666696369656e74206f757420616d6f756e7400000000006044820152606401610277565b6115d9878284612371565b50505080806115e790612be0565b9150506114d8565b5050505050505061161d73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee33611618846123b4565b61040a565b509a9950505050505050505050565b60006007821461163e57506000610b1d565b61164882846133d4565b7fffffffffffffff00000000000000000000000000000000000000000000000000167f44796e616d696300000000000000000000000000000000000000000000000000149392505050565b6001600160a01b037f00000000000000000000000007dba65c8d7d725638265e508e3fa432454d462716638907e7876116cf6020890189612bad565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561172b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174f9190612cdd565b61179b5760405162461bcd60e51b815260206004820181905260248201527f53573a207573652070726f746f636f6c206e6f742077686974656c69737465646044820152606401610277565b60006117aa6060880188612c7d565b905067ffffffffffffffff8111156117c4576117c46132f3565b60405190808252806020026020018201604052801561182257816020015b61180f604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b8152602001906001900390816117e25790505b50905060006118346060890189612c7d565b905067ffffffffffffffff81111561184e5761184e6132f3565b604051908082528060200260200182016040528015611877578160200160208202803683370190505b50905060005b61188a60608a018a612c7d565b90508110156119d55760006118a260608b018b612c7d565b838181106118b2576118b2612b72565b9050602002013590506000198582815181106118d0576118d0612b72565b6020026020010151036119255760405162461bcd60e51b815260206004820152601760248201527f53573a20696e70757420616c7265616479207370656e740000000000000000006044820152606401610277565b86868281811061193757611937612b72565b90506060020180360381019061194d919061341c565b84838151811061195f5761195f612b72565b602002602001018190525084818151811061197c5761197c612b72565b602002602001015183838151811061199657611996612b72565b6020026020010181815250506000198582815181106119b7576119b7612b72565b602090810291909101015250806119cd81612be0565b91505061187d565b5060006119ef6119e860608b018b612c7d565b9050611d00565b905060005b611a0160608b018b612c7d565b9050811015611a6857611a55848281518110611a1f57611a1f612b72565b602002602001015160000151848381518110611a3d57611a3d612b72565b602002602001015184611db69092919063ffffffff16565b5080611a6081612be0565b9150506119f4565b506000611a7c8261135160208d018d612bad565b9050611a8b60208b018b612bad565b6001600160a01b0316635d9c8b1a826040518061010001604052808e6020013581526020018e6040016020810190611ac39190612bad565b6001600160a01b031681526020018881526020018781526020018e8060800190611aed919061315a565b808060200260200160405190810160405280939291908181526020016000905b82821015611b3957611b2a6060830286013681900381019061341c565b81526020019060010190611b0d565b505050505081526020018d8d8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050336020808501919091526040805136601f810184900484028201840183528082529190950194939250908190840183828082843760009201919091525050509152506040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152611bf5919060040161354d565b6000604051808303818588803b158015611c0e57600080fd5b505af1158015611c22573d6000803e3d6000fd5b5061088e93508592506113c691505060208d018d612bad565b6060611c4a84846000856123c3565b90505b9392505050565b604051638907e78760e01b81526001600160a01b0382811660048301526000917f0000000000000000000000004bb5bd82d6bb49d7a45c57db3bb6d2d726f6f92f90911690638907e78790602401602060405180830381865afa158015611cbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1d9190612cdd565b611cec826124b7565b611cf6828261250f565b6103308282612563565b611d2460405180606001604052806060815260200160608152602001600081525090565b8167ffffffffffffffff811115611d3d57611d3d6132f3565b604051908082528060200260200182016040528015611d66578160200160208202803683370190505b5081528167ffffffffffffffff811115611d8257611d826132f3565b604051908082528060200260200182016040528015611dab578160200160208202803683370190505b506020820152919050565b6000611c4a84611dc686866120e1565b846125b7565b6000611dd9826040015190565b67ffffffffffffffff811115611df157611df16132f3565b604051908082528060200260200182016040528015611e3c57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611e0f5790505b50905060005b6040830151811015611ebe57604080516060810190915280611e6485846121d0565b6001600160a01b03168152602001611e7c8584612349565b8152602001306001600160a01b0316815250828281518110611ea057611ea0612b72565b60200260200101819052508080611eb690612be0565b915050611e42565b506040517f160051360000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301527f00000000000000000000000063aaf1794b789aee4aae3d4eae5f7ea271bffe7b1690631600513690602401602060405180830381865afa158015611f3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f629190612cdd565b61200d576040517fd6b59bdb0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301527f00000000000000000000000063aaf1794b789aee4aae3d4eae5f7ea271bffe7b169063d6b59bdb906024016020604051808303816000875af1158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b91906132c3565b505b6040517f7262e1980000000000000000000000000000000000000000000000000000000081526001600160a01b037f00000000000000000000000063aaf1794b789aee4aae3d4eae5f7ea271bffe7b1690637262e198906120749086908590600401613622565b600060405180830381600087803b15801561208e57600080fd5b505af115801561093e573d6000803e3d6000fd5b60005b604083015181101561044f576120cf6120be84836121d0565b856120c98685612349565b856125ce565b806120d981612be0565b9150506120a5565b6000611c4d8383600161221a565b6000611c4d83308461266c565b808360200151838151811061211357612113612b72565b602002602001018181525050505050565b6000805b604084015181101561216f5761215161214185836121d0565b8461214c8785612349565b612724565b61215b9083613693565b91508061216781612be0565b915050612128565b5092915050565b6060611c4a8484846040518060600160405280602981526020016136cc602991396123c3565b60005b6040830151811015610167576121be6121b884836121d0565b8361276c565b806121c881612be0565b91505061219f565b60007facc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc08360000151838151811061220957612209612b72565b602002602001015118905092915050565b60006001600160a01b0383167facc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc0acc018815b8551518110156122f05760008660000151828151811061226c5761226c612b72565b6020026020010151905082810361228757509150611c4d9050565b806000036122dd57846122a1576000199350505050611c4d565b82876000015183815181106122b8576122b8612b72565b60209081029190910101526122ce826001613693565b6040880152509150611c4d9050565b50806122e881612be0565b91505061224a565b508261230157600019915050611c4d565b60405162461bcd60e51b815260206004820152601560248201527f41433a20696e73756666696369656e742073697a6500000000000000000000006044820152606401610277565b60008260200151828151811061236157612361612b72565b6020026020010151905092915050565b60008161237e8585612349565b61238891906132e0565b9050611c4d8484836120fc565b60006123a0836124b7565b6123aa838361250f565b611c4d838361279c565b8051600090610b1d90346132e0565b60608247101561243b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610277565b600080866001600160a01b0316858760405161245791906136a6565b60006040518083038185875af1925050503d8060008114612494576040519150601f19603f3d011682016040523d82523d6000602084013e612499565b606091505b50915091506124aa878383876127b9565b925050505b949350505050565b8060400135816020013511156102045760405162461bcd60e51b815260206004820152601d60248201527f54433a20756e6f726465726564206d696e2f6d617820616d6f756e74730000006044820152606401610277565b81602001358110156103305760405162461bcd60e51b815260206004820152601d60248201527f54433a20696e73756666696369656e7420746f6b656e20616d6f756e740000006044820152606401610277565b81604001358111156103305760405162461bcd60e51b815260206004820152601a60248201527f54433a2065786365737369766520746f6b656e20616d6f756e740000000000006044820152606401610277565b6000816125c48585612349565b6123889190613693565b8180156106a55773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b03861603612660576001600160a01b03841633146126515760405162461bcd60e51b815260206004820152601d60248201527f54483a206e617469766520616c6c6f77732073656e646572206f6e6c790000006044820152606401610277565b61265b8284612832565b6106a5565b6106a5858530866128a3565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0385161461271a576040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528516906370a0823190602401602060405180830381865afa1580156126f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612715919061311c565b611c4a565b611c4a83836128f4565b60008180156127645773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0386160361275957829150612764565b61276485858561293e565b509392505050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b03831614610330576103308282600061293e565b6000826040013582106127b3578260400135611c4d565b50919050565b60608315612828578251600003612821576001600160a01b0385163b6128215760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610277565b50816124af565b6124af8383612a8c565b8061283c836123b4565b101561288a5760405162461bcd60e51b815260206004820152601a60248201527f4e433a20696e73756666696369656e74206d73672076616c75650000000000006044820152606401610277565b808260000181815161289c9190613693565b9052505050565b6040516001600160a01b038085166024830152831660448201526064810182905261044f9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161099c565b6000336001600160a01b038416036129165761290f826123b4565b9050610b1d565b506001600160a01b038216803190309003610b1d57612934826123b4565b611c4d90826132e0565b8015806129d157506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156129ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129cf919061311c565b155b612a435760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610277565b6040516001600160a01b0383166024820152604481018290526101679084907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161099c565b815115612a9c5781518083602001fd5b8060405162461bcd60e51b815260040161027791906136b8565b60008060208385031215612ac957600080fd5b823567ffffffffffffffff80821115612ae157600080fd5b818501915085601f830112612af557600080fd5b813581811115612b0457600080fd5b866020606083028501011115612b1957600080fd5b60209290920196919550909350505050565b600060e082840312156127b357600080fd5b600060208284031215612b4f57600080fd5b813567ffffffffffffffff811115612b6657600080fd5b6124af84828501612b2b565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461020457600080fd5b8035612ba881612b88565b919050565b600060208284031215612bbf57600080fd5b8135611c4d81612b88565b634e487b7160e01b600052601160045260246000fd5b600060018201612bf257612bf2612bca565b5060010190565b60008235607e19833603018112612c0f57600080fd5b9190910192915050565b6000808335601e19843603018112612c3057600080fd5b83018035915067ffffffffffffffff821115612c4b57600080fd5b602001915036819003821315612c6057600080fd5b9250929050565b6000823560fe19833603018112612c0f57600080fd5b6000808335601e19843603018112612c9457600080fd5b83018035915067ffffffffffffffff821115612caf57600080fd5b6020019150600581901b3603821315612c6057600080fd5b60008235603e19833603018112612c0f57600080fd5b600060208284031215612cef57600080fd5b81518015158114611c4d57600080fd5b6000808335601e19843603018112612d1657600080fd5b830160208101925035905067ffffffffffffffff811115612d3657600080fd5b606081023603821315612c6057600080fd5b8183526000602080850194508260005b85811015612d9a578135612d6b81612b88565b6001600160a01b0316875281830135838801526040808301359088015260609687019690910190600101612d58565b509495945050505050565b6000808335601e19843603018112612dbc57600080fd5b830160208101925035905067ffffffffffffffff811115612ddc57600080fd5b8060051b3603821315612c6057600080fd5b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612e2057600080fd5b8260051b80836020870137939093016020019392505050565b6000808335601e19843603018112612e5057600080fd5b830160208101925035905067ffffffffffffffff811115612e7057600080fd5b803603821315612c6057600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b81019150846000805b88811015612f9e578385038a52823560be19893603018112612ee3578283fd5b880160c08135612ef281612b88565b6001600160a01b039081168852828901358989015260409081840135612f1781612b88565b16908801526060612f2a83820184612da5565b83838b0152612f3c848b018284612dee565b93505050506080612f4f81840184612cff565b898403838b0152612f61848284612d48565b935050505060a0612f7481840184612e39565b9350888303828a0152612f88838583612e7f565b9d8a019d98505050938701935050600101612ec3565b509298975050505050505050565b6000610100823584526020830135612fc381612b88565b6001600160a01b03166020850152612fdd60408401612b9d565b6001600160a01b038116604086015250606083013560608501526080830135608085015261300e60a0840184612cff565b8260a08701526130218387018284612d48565b9250505061303260c0840184612cff565b85830360c0870152613045838284612d48565b9250505061305660e0840184612da5565b85830360e0870152613069838284612ea8565b9695505050505050565b803582526000602082013561308781612b88565b6001600160a01b0390811660208501526040830135906130a682612b88565b1660408401526130b96060830183612da5565b608060608601526130ce608086018284612dee565b95945050505050565b6060815260006130ea6060830187612fac565b82810360208401526130fc8187613073565b90508281036040840152613111818587612e7f565b979650505050505050565b60006020828403121561312e57600080fd5b5051919050565b6040815260006131486040830185612fac565b82810360208401526130ce8185613073565b6000808335601e1984360301811261317157600080fd5b83018035915067ffffffffffffffff82111561318c57600080fd5b6020019150606081023603821315612c6057600080fd5b6040815260006080820185356131b881612b88565b6001600160a01b0316604084015260206131d487820188612da5565b604060608701528381855260a08701905060a08260051b8801019450826000805b8481101561323957898803609f1901845282353687900360fe1901811261321a578283fd5b61322689888301612fac565b98505092860192918601916001016131f5565b5050505050508382038185015250613069818587612e7f565b60008235609e19833603018112612c0f57600080fd5b6000823560be19833603018112612c0f57600080fd5b60006001600160a01b03808916835280881660208401525085604083015284606083015260a060808301526132b760a083018486612e7f565b98975050505050505050565b6000602082840312156132d557600080fd5b8151611c4d81612b88565b81810381811115610b1d57610b1d612bca565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613332576133326132f3565b604052919050565b6000602080838503121561334d57600080fd5b825167ffffffffffffffff8082111561336557600080fd5b818501915085601f83011261337957600080fd5b81518181111561338b5761338b6132f3565b8060051b915061339c848301613309565b81815291830184019184810190888411156133b657600080fd5b938501935b838510156132b7578451825293850193908501906133bb565b7fffffffffffffff0000000000000000000000000000000000000000000000000081358181169160078510156134145780818660070360031b1b83161692505b505092915050565b60006060828403121561342e57600080fd5b6040516060810181811067ffffffffffffffff82111715613451576134516132f3565b604052823561345f81612b88565b8152602083810135908201526040928301359281019290925250919050565b600081518084526020808501945080840160005b83811015612d9a57815180516001600160a01b0316885283810151848901526040908101519088015260609096019590820190600101613492565b600081518084526020808501945080840160005b83811015612d9a578151875295820195908201906001016134e1565b60005b83811015613518578181015183820152602001613500565b50506000910152565b600081518084526135398160208601602086016134fd565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015161357460408401826001600160a01b03169052565b50604083015161010080606085015261359161012085018361347e565b91506060850151601f19808685030160808701526135af84836134cd565b935060808701519150808685030160a08701526135cc848361347e565b935060a08701519150808685030160c08701526135e98483613521565b935060c0870151915061360760e08701836001600160a01b03169052565b60e08701519150808685030183870152506130698382613521565b600060408083016001600160a01b0380871685526020838187015282875180855260609450848801915082890160005b8281101561368357815180518716855285810151868601528801518616888501529286019290840190600101613652565b50919a9950505050505050505050565b80820180821115610b1d57610b1d612bca565b60008251612c0f8184602087016134fd565b602081526000611c4d602083018461352156fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a264697066735822122014cb68f470a03686ce432b5b20443c0d00495f688c203afb37c9ee6523f56cf064736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000029efba36c0b750c5029a402d2c0f8a70823259680000000000000000000000004bb5bd82d6bb49d7a45c57db3bb6d2d726f6f92f00000000000000000000000007dba65c8d7d725638265e508e3fa432454d462700000000000000000000000063aaf1794b789aee4aae3d4eae5f7ea271bffe7b000000000000000000000000f965d76eaaba76091966761c3c5ce29a9b12470f00000000000000000000000081931d7e2c11af310dfef155eaa383b034525068
-----Decoded View---------------
Arg [0] : params_ (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 00000000000000000000000029efba36c0b750c5029a402d2c0f8a7082325968
Arg [1] : 0000000000000000000000004bb5bd82d6bb49d7a45c57db3bb6d2d726f6f92f
Arg [2] : 00000000000000000000000007dba65c8d7d725638265e508e3fa432454d4627
Arg [3] : 00000000000000000000000063aaf1794b789aee4aae3d4eae5f7ea271bffe7b
Arg [4] : 000000000000000000000000f965d76eaaba76091966761c3c5ce29a9b12470f
Arg [5] : 00000000000000000000000081931d7e2c11af310dfef155eaa383b034525068
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 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.