Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 15916615 | 666 days ago | IN | 0 ETH | 0.0557815 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
SmartWalletImplementation
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 780 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@kyber.network/utils-sc/contracts/IERC20Ext.sol"; import "./interfaces/ISmartWalletImplementation.sol"; import "./SmartWalletStorage.sol"; import "./swap/ISwap.sol"; import "./lending/ILending.sol"; contract SmartWalletImplementation is SmartWalletStorageV2, ISmartWalletImplementation { using SafeERC20 for IERC20Ext; using SafeMath for uint256; using EnumerableSet for EnumerableSet.AddressSet; event ApprovedAllowances(IERC20Ext[] tokens, address[] spenders, bool isReset); event ClaimedPlatformFees(address[] wallets, IERC20Ext[] tokens, address claimer); constructor(address _admin) SmartWalletStorage(_admin) {} receive() external payable {} /// Claim fee, must be done by platform address itself to avoid confusion function claimPlatformFee(IERC20Ext[] calldata tokens) external override nonReentrant { address platformWallet = msg.sender; for (uint256 j = 0; j < tokens.length; j++) { uint256 fee = platformWalletFees[platformWallet][tokens[j]]; if (fee > 1) { // fee set to 1 to avoid the SSTORE initial gas cost platformWalletFees[platformWallet][tokens[j]] = 1; transferToken(payable(platformWallet), tokens[j], fee - 1); } } address[] memory arr = new address[](1); arr[0] = platformWallet; emit ClaimedPlatformFees(arr, tokens, msg.sender); } /// Claim fee using admin right function adminClaimPlatformFees(address[] calldata platformWallets, IERC20Ext[] calldata tokens) external override nonReentrant onlyAdmin { require(adminFeeCollector != address(0), "require admin fee collector"); for (uint256 i = 0; i < platformWallets.length; i++) { for (uint256 j = 0; j < tokens.length; j++) { uint256 fee = platformWalletFees[platformWallets[i]][tokens[j]]; if (fee > 1) { // fee set to 1 to avoid the SSTORE initial gas cost platformWalletFees[platformWallets[i]][tokens[j]] = 1; transferToken(payable(adminFeeCollector), tokens[j], fee - 1); } } } emit ClaimedPlatformFees(platformWallets, tokens, msg.sender); } /// [Urgent] Claim fee using admin right, claim everything and set the fee to 0 function adminClaimPlatformFeesUrgent(address[] calldata platformWallets, IERC20Ext[] calldata tokens) external override nonReentrant onlyAdmin { require(adminFeeCollector != address(0), "require admin fee collector"); for (uint256 j = 0; j < tokens.length; j++) { uint256 bal = getBalance(IERC20Ext(tokens[j]), address(this)); if (bal > 0) { transferToken(payable(adminFeeCollector), tokens[j], bal); for (uint256 i = 0; i < platformWallets.length; i++) { platformWalletFees[platformWallets[i]][tokens[j]] = 0; } } } emit ClaimedPlatformFees(platformWallets, tokens, msg.sender); } function setAdminFeeCollector(address feeCollector) external override onlyAdmin { adminFeeCollector = feeCollector; } /// @dev approve/unapprove LPs usage on the particular tokens function approveAllowances( IERC20Ext[] calldata tokens, address[] calldata spenders, bool isReset ) external onlyAdmin { uint256 allowance = isReset ? 0 : MAX_ALLOWANCE; for (uint256 i = 0; i < tokens.length; i++) { for (uint256 j = 0; j < spenders.length; j++) { tokens[i].safeApprove(spenders[j], allowance); } getSetDecimals(tokens[i]); } emit ApprovedAllowances(tokens, spenders, isReset); } /// @dev get expected return including the fee /// @return destAmount expected dest amount /// @return expectedRate expected swap rate function getExpectedReturn(ISmartWalletImplementation.GetExpectedReturnParams calldata params) external view override returns (uint256 destAmount, uint256 expectedRate) { (destAmount, expectedRate,) = getExpectedReturnInternal(params, false); } function getExpectedReturnWithImpact( ISmartWalletImplementation.GetExpectedReturnParams calldata params ) external view override returns ( uint256 destAmount, uint256 expectedRate, uint256 priceImpact ) { return getExpectedReturnInternal(params, true); } function getExpectedReturnInternal( ISmartWalletImplementation.GetExpectedReturnParams memory params, bool withImpact ) private view returns (uint256 destAmount, uint256 expectedRate, uint256 priceImpact) { if (params.feeBps >= BPS) return (0, 0, 0); // platform fee is too high uint256 actualSrc = (params.feeMode == FeeMode.FROM_SOURCE) ? (params.srcAmount * (BPS - params.feeBps)) / BPS : params.srcAmount; if (withImpact) { (destAmount, priceImpact) = ISwap(params.swapContract).getExpectedReturnWithImpact( ISwap.GetExpectedReturnParams({ srcAmount: actualSrc, tradePath: params.tradePath, feeBps: params.feeMode == FeeMode.BY_PROTOCOL ? params.feeBps : 0, extraArgs: params.extraArgs }) ); } else { destAmount = ISwap(params.swapContract).getExpectedReturn( ISwap.GetExpectedReturnParams({ srcAmount: actualSrc, tradePath: params.tradePath, feeBps: params.feeMode == FeeMode.BY_PROTOCOL ? params.feeBps : 0, extraArgs: params.extraArgs }) ); } if (params.feeMode == FeeMode.FROM_DEST) { destAmount = (destAmount * (BPS - params.feeBps)) / BPS; } expectedRate = calcRateFromQty( params.srcAmount, destAmount, getDecimals(IERC20Ext(params.tradePath[0])), getDecimals(IERC20Ext(params.tradePath[params.tradePath.length - 1])) ); } /// @dev get expected in amount including the fee /// @return srcAmount expected aource amount /// @return expectedRate expected swap rate function getExpectedIn(ISmartWalletImplementation.GetExpectedInParams calldata params) external view override returns (uint256 srcAmount, uint256 expectedRate) { (srcAmount, expectedRate, ) = getExpectedInInternal(params, false); } function getExpectedInWithImpact(ISmartWalletImplementation.GetExpectedInParams calldata params) external view override returns (uint256 srcAmount, uint256 expectedRate, uint256 priceImpact) { return getExpectedInInternal(params, true); } /// @dev get expected in amount including the fee /// @return srcAmount expected aource amount /// @return expectedRate expected swap rate function getExpectedInInternal(ISmartWalletImplementation.GetExpectedInParams memory params, bool withImpact) private view returns (uint256 srcAmount, uint256 expectedRate, uint256 priceImpact) { if (params.feeBps >= BPS) return (0, 0, 0); // platform fee is too high uint256 actualDest = (params.feeMode == FeeMode.FROM_DEST) ? (params.destAmount * (BPS + params.feeBps)) / BPS : params.destAmount; if (withImpact) { try ISwap(params.swapContract).getExpectedInWithImpact( ISwap.GetExpectedInParams({ destAmount: actualDest, tradePath: params.tradePath, feeBps: params.feeMode == FeeMode.BY_PROTOCOL ? params.feeBps : 0, extraArgs: params.extraArgs }) ) returns (uint256 newSrcAmount, uint256 newPriceImpact) { srcAmount = newSrcAmount; priceImpact = newPriceImpact; } catch Error(string memory reason) { require(compareStrings(reason, "getExpectedIn_notSupported"), reason); (srcAmount, priceImpact) = defaultGetExpectedIn( params.swapContract, ISwap.GetExpectedInParams({ destAmount: actualDest, tradePath: params.tradePath, feeBps: params.feeMode == FeeMode.BY_PROTOCOL ? params.feeBps : 0, extraArgs: params.extraArgs }), withImpact ); } } else { try ISwap(params.swapContract).getExpectedIn( ISwap.GetExpectedInParams({ destAmount: actualDest, tradePath: params.tradePath, feeBps: params.feeMode == FeeMode.BY_PROTOCOL ? params.feeBps : 0, extraArgs: params.extraArgs }) ) returns (uint256 newSrcAmount) { srcAmount = newSrcAmount; } catch Error(string memory reason) { require(compareStrings(reason, "getExpectedReturnWithImpact_notSupported"), reason); (srcAmount, priceImpact) = defaultGetExpectedIn( params.swapContract, ISwap.GetExpectedInParams({ destAmount: actualDest, tradePath: params.tradePath, feeBps: params.feeMode == FeeMode.BY_PROTOCOL ? params.feeBps : 0, extraArgs: params.extraArgs }), withImpact ); } } if (params.feeMode == FeeMode.FROM_SOURCE) { srcAmount = (srcAmount * (BPS + params.feeBps)) / BPS; } expectedRate = calcRateFromQty( srcAmount, params.destAmount, getDecimals(IERC20Ext(params.tradePath[0])), getDecimals(IERC20Ext(params.tradePath[params.tradePath.length - 1])) ); } function defaultGetExpectedIn(address swapContract, ISwap.GetExpectedInParams memory params, bool withImpact) private view returns (uint256 srcAmount, uint256 priceImpact) { uint8 srcDecimal = 18; if (params.tradePath[0] != address(ETH_TOKEN_ADDRESS)) { srcDecimal = IERC20Ext(params.tradePath[0]).decimals(); } if (srcDecimal > 3) { srcDecimal = srcDecimal - 3; } srcAmount = 1 * (10**srcDecimal); // Use a 0.001 as base uint256 lastGoodSrcAmount = 0; for (uint256 i = 0; i < 10; i++) { try ISwap(swapContract).getExpectedReturn( ISwap.GetExpectedReturnParams({ srcAmount: srcAmount, tradePath: params.tradePath, feeBps: params.feeBps, extraArgs: params.extraArgs }) ) returns (uint256 newDestAmount) { if (newDestAmount != 0) { (lastGoodSrcAmount, srcAmount) = ( srcAmount, (srcAmount * params.destAmount) / newDestAmount ); continue; } } catch {} // If there's an error or newDestAmount == 0, try something closer to lastGoodSrcAmount srcAmount = (srcAmount + lastGoodSrcAmount) / 2; } // Precision check uint256 destAmount; if (withImpact) { (destAmount, priceImpact) = ISwap(swapContract).getExpectedReturnWithImpact( ISwap.GetExpectedReturnParams({ srcAmount: srcAmount, tradePath: params.tradePath, feeBps: params.feeBps, extraArgs: params.extraArgs }) ); } else { destAmount = ISwap(swapContract).getExpectedReturn( ISwap.GetExpectedReturnParams({ srcAmount: srcAmount, tradePath: params.tradePath, feeBps: params.feeBps, extraArgs: params.extraArgs }) ); } uint256 diff; if (destAmount > params.destAmount) { diff = destAmount - params.destAmount; } else { diff = params.destAmount - destAmount; } } /// @dev swap using particular swap contract /// @return destAmount actual dest amount function swap(ISmartWalletImplementation.SwapParams calldata params) external payable override nonReentrant returns (uint256 destAmount) { destAmount = swapInternal( params.swapContract, params.srcAmount, params.minDestAmount, params.tradePath, msg.sender, params.feeMode, params.feeBps, params.platformWallet, params.extraArgs ); emit Swap( msg.sender, params.swapContract, params.tradePath, params.srcAmount, destAmount, params.feeMode, params.feeBps, params.platformWallet ); } /// @dev swap then deposit to platform /// if tradePath has only 1 token, don't need to do swap /// @return destAmount actual dest amount function swapAndDeposit(ISmartWalletImplementation.SwapAndDepositParams calldata params) external payable override nonReentrant returns (uint256 destAmount) { require(params.tradePath.length >= 1, "invalid tradePath"); require(supportedLendings.contains(params.lendingContract), "unsupported lending"); if (params.tradePath.length == 1) { // just collect src token, no need to swap validateSourceAmount(params.tradePath[0], params.srcAmount); destAmount = safeTransferWithFee( msg.sender, params.lendingContract, params.tradePath[0], params.srcAmount, // Not taking lending fee 0, params.platformWallet ); } else { destAmount = swapInternal( params.swapContract, params.srcAmount, params.minDestAmount, params.tradePath, params.lendingContract, params.feeMode, params.feeBps, params.platformWallet, params.extraArgs ); } // eth or token already transferred to the address ILending(params.lendingContract).depositTo( msg.sender, IERC20Ext(params.tradePath[params.tradePath.length - 1]), destAmount ); emit SwapAndDeposit( msg.sender, params.swapContract, params.lendingContract, params.tradePath, params.srcAmount, destAmount, params.feeMode, params.feeBps, params.platformWallet ); } /// @dev withdraw token from Lending platforms (AAVE, COMPOUND) /// @return returnedAmount returns the amount withdrawn to the user function withdrawFromLendingPlatform( ISmartWalletImplementation.WithdrawFromLendingPlatformParams calldata params ) external override nonReentrant returns (uint256 returnedAmount) { require(supportedLendings.contains(params.lendingContract), "unsupported lending"); IERC20Ext lendingToken = IERC20Ext( ILending(params.lendingContract).getLendingToken(params.token) ); require(lendingToken != IERC20Ext(0), "unsupported token"); // AAVE aToken's transfer logic could have rounding errors uint256 tokenBalanceBefore = lendingToken.balanceOf(params.lendingContract); lendingToken.safeTransferFrom(msg.sender, params.lendingContract, params.amount); uint256 tokenBalanceAfter = lendingToken.balanceOf(params.lendingContract); returnedAmount = ILending(params.lendingContract).withdrawFrom( msg.sender, params.token, tokenBalanceAfter.sub(tokenBalanceBefore), params.minReturn ); require(returnedAmount >= params.minReturn, "low returned amount"); emit WithdrawFromLending( msg.sender, params.lendingContract, params.token, params.amount, params.minReturn, returnedAmount ); } /// @dev swap and repay borrow for sender function swapAndRepay(ISmartWalletImplementation.SwapAndRepayParams calldata params) external payable override nonReentrant returns (uint256 destAmount) { require(params.tradePath.length >= 1, "invalid tradePath"); require(supportedLendings.contains(params.lendingContract), "unsupported lending"); // use user debt value if debt is <= payAmount // user can pay all debt by putting really high payAmount as param uint256 debt = ILending(params.lendingContract).getUserDebtCurrent( params.tradePath[params.tradePath.length - 1], msg.sender ); uint256 actualPayAmount = debt >= params.payAmount ? params.payAmount : debt; if (params.tradePath.length == 1) { // just collect src token, no need to swap validateSourceAmount(params.tradePath[0], params.srcAmount); destAmount = safeTransferWithFee( msg.sender, params.lendingContract, params.tradePath[0], params.srcAmount, // Not taking repay fee 0, params.platformWallet ); } else { destAmount = swapInternal( params.swapContract, params.srcAmount, actualPayAmount, params.tradePath, params.lendingContract, params.feeMode, params.feeBps, params.platformWallet, params.extraArgs ); } ILending(params.lendingContract).repayBorrowTo( msg.sender, IERC20Ext(params.tradePath[params.tradePath.length - 1]), destAmount, actualPayAmount, abi.encodePacked(params.rateMode) ); uint256 actualDebtPaid = debt.sub( ILending(params.lendingContract).getUserDebtCurrent( params.tradePath[params.tradePath.length - 1], msg.sender ) ); require(actualDebtPaid >= actualPayAmount, "low paid amount"); emit SwapAndRepay( msg.sender, params.swapContract, params.lendingContract, params.tradePath, params.srcAmount, destAmount, actualPayAmount, params.feeMode, params.feeBps, params.platformWallet ); } function swapInternal( address payable swapContract, uint256 srcAmount, uint256 minDestAmount, address[] calldata tradePath, address payable recipient, FeeMode feeMode, uint256 platformFee, address payable platformWallet, bytes calldata extraArgs ) internal returns (uint256 destAmount) { require(supportedSwaps.contains(swapContract), "unsupported swap"); require(tradePath.length >= 2, "invalid tradePath"); require(platformFee < BPS, "high platform fee"); validateSourceAmount(tradePath[0], srcAmount); uint256 actualSrcAmount = safeTransferWithFee( msg.sender, swapContract, tradePath[0], srcAmount, feeMode == FeeMode.FROM_SOURCE ? platformFee : 0, platformWallet ); { // to avoid stack too deep // who will receive the swapped token // address _recipient = feeMode == FeeMode.FROM_DEST ? address(this) : recipient; uint256 delta = getBalance(IERC20Ext(tradePath[tradePath.length - 1]), feeMode == FeeMode.FROM_DEST ? address(this) : recipient); destAmount = ISwap(swapContract).swap( ISwap.SwapParams({ srcAmount: actualSrcAmount, minDestAmount: minDestAmount, tradePath: tradePath, recipient: feeMode == FeeMode.FROM_DEST ? address(this) : recipient, feeBps: feeMode == FeeMode.BY_PROTOCOL ? platformFee : 0, feeReceiver: platformWallet, extraArgs: extraArgs }) ); delta = getBalance(IERC20Ext(tradePath[tradePath.length - 1]), feeMode == FeeMode.FROM_DEST ? address(this) : recipient) - delta; require(delta >= destAmount, "return amount not enough"); } if (feeMode == FeeMode.FROM_DEST) { destAmount = safeTransferWithFee( address(this), recipient, tradePath[tradePath.length - 1], destAmount, platformFee, platformWallet ); } require(destAmount >= minDestAmount, "low return"); } function validateSourceAmount(address srcToken, uint256 srcAmount) internal { if (srcToken == address(ETH_TOKEN_ADDRESS)) { require(msg.value == srcAmount, "wrong msg value"); } else { require(msg.value == 0, "bad msg value"); } } function transferToken( address payable to, IERC20Ext token, uint256 amount ) internal { if (amount == 0) return; if (token == ETH_TOKEN_ADDRESS) { (bool success, ) = to.call{value: amount}(""); require(success, "transfer failed"); } else { token.safeTransfer(to, amount); } } function safeTransferWithFee( address payable from, address payable to, address token, uint256 amount, uint256 platformFeeBps, address payable platformWallet ) internal returns (uint256 amountTransferred) { uint256 fee = amount.mul(platformFeeBps).div(BPS); uint256 amountAfterFee = amount.sub(fee); IERC20Ext tokenErc = IERC20Ext(token); if (tokenErc == ETH_TOKEN_ADDRESS) { (bool success, ) = to.call{value: amountAfterFee}(""); require(success, "transfer failed"); amountTransferred = amountAfterFee; } else { uint256 balanceBefore = tokenErc.balanceOf(to); if (from != address(this)) { // case transfer from another address, need to transfer fee to this proxy contract tokenErc.safeTransferFrom(from, to, amountAfterFee); if (fee > 0) { tokenErc.safeTransferFrom(from, address(this), fee); } } else { tokenErc.safeTransfer(to, amountAfterFee); } amountTransferred = tokenErc.balanceOf(to).sub(balanceBefore); } addFeeToPlatform(platformWallet, tokenErc, fee); } function addFeeToPlatform( address payable platformWallet, IERC20Ext token, uint256 amount ) internal { if (amount > 0) { require(supportedPlatformWallets.contains(platformWallet), "unsupported platform"); platformWalletFees[platformWallet][token] = platformWalletFees[platformWallet][token] .add(amount); } } function compareStrings(string memory a, string memory b) private pure returns (bool) { return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b)))); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.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 SafeMath for uint256; 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' // solhint-disable-next-line max-line-length 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).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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. */ 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; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. 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] = toDeleteIndex + 1; // All indexes are 1-based // 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) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // 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); } // 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)))); } // 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 on 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)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @dev Interface extending ERC20 standard to include decimals() as * it is optional in the OpenZeppelin IERC20 interface. */ interface IERC20Ext is IERC20 { /** * @dev This function is required as Kyber requires to interact * with token.decimals() with many of its operations. */ function decimals() external view returns (uint8 digits); }
pragma solidity 0.7.6; pragma abicoder v2; import "@kyber.network/utils-sc/contracts/IERC20Ext.sol"; interface ISmartWalletImplementation { enum FeeMode { FROM_SOURCE, FROM_DEST, BY_PROTOCOL } event Swap( address indexed trader, address indexed swapContract, address[] tradePath, uint256 srcAmount, uint256 destAmount, FeeMode feeMode, uint256 feeBps, address platformWallet ); event SwapAndDeposit( address indexed trader, address indexed swapContract, address indexed lendingContract, address[] tradePath, uint256 srcAmount, uint256 destAmount, FeeMode feeMode, uint256 feeBps, address platformWallet ); event WithdrawFromLending( address indexed trader, address indexed lendingContract, IERC20Ext token, uint256 amount, uint256 minReturn, uint256 actualReturnAmount ); event SwapAndRepay( address indexed trader, address indexed swapContract, address indexed lendingContract, address[] tradePath, uint256 srcAmount, uint256 destAmount, uint256 payAmount, FeeMode feeMode, uint256 feeBps, address platformWallet ); /// @param swapContract swap contract /// @param srcAmount amount of src token /// @param tradePath path of the trade on Uniswap /// @param platformFee fee if swapping feeMode = platformFee / BPS, feeBps = platformFee % BPS /// @param extraArgs extra data needed for swap on particular platforms struct GetExpectedReturnParams { address payable swapContract; uint256 srcAmount; address[] tradePath; FeeMode feeMode; uint256 feeBps; bytes extraArgs; } function getExpectedReturn(GetExpectedReturnParams calldata params) external view returns (uint256 destAmount, uint256 expectedRate); function getExpectedReturnWithImpact(GetExpectedReturnParams calldata params) external view returns ( uint256 destAmount, uint256 expectedRate, uint256 priceImpact ); // in BPS struct GetExpectedInParams { address payable swapContract; uint256 destAmount; address[] tradePath; FeeMode feeMode; uint256 feeBps; bytes extraArgs; } function getExpectedIn(GetExpectedInParams calldata params) external view returns (uint256 srcAmount, uint256 expectedRate); function getExpectedInWithImpact(GetExpectedInParams calldata params) external view returns ( uint256 srcAmount, uint256 expectedRate, uint256 priceImpact ); /// @param swapContract swap contract /// @param srcAmount amount of src token /// @param minDestAmount minimal accepted dest amount /// @param tradePath path of the trade on Uniswap /// @param feeMode fee mode /// @param feeBps fee bps /// @param platformWallet wallet to receive fee /// @param extraArgs extra data needed for swap on particular platforms struct SwapParams { address payable swapContract; uint256 srcAmount; uint256 minDestAmount; address[] tradePath; FeeMode feeMode; uint256 feeBps; address payable platformWallet; bytes extraArgs; } function swap(SwapParams calldata params) external payable returns (uint256 destAmount); /// @param swapContract swap contract /// @param lendingContract lending contract /// @param srcAmount amount of src token /// @param minDestAmount minimal accepted dest amount /// @param tradePath path of the trade on Uniswap /// @param feeMode fee mode /// @param feeBps fee bps /// @param platformWallet wallet to receive fee /// @param extraArgs extra data needed for swap on particular platforms struct SwapAndDepositParams { address payable swapContract; address payable lendingContract; uint256 srcAmount; uint256 minDestAmount; address[] tradePath; FeeMode feeMode; uint256 feeBps; address payable platformWallet; bytes extraArgs; } function swapAndDeposit(SwapAndDepositParams calldata params) external payable returns (uint256 destAmount); /// @param lendingContract lending contract to withdraw token /// @param token underlying token to withdraw, e.g ETH, USDT, DAI /// @param amount amount of cToken (COMPOUND) or aToken (AAVE) to withdraw /// @param minReturn minimum amount of underlying tokens to return struct WithdrawFromLendingPlatformParams { address payable lendingContract; IERC20Ext token; uint256 amount; uint256 minReturn; } function withdrawFromLendingPlatform(WithdrawFromLendingPlatformParams calldata params) external returns (uint256 returnedAmount); /// @param swapContract swap contract /// @param lendingContract lending contract /// @param srcAmount amount of src token /// @param payAmount: amount that user wants to pay, if the dest amount (after swap) is higher, /// the remain amount will be sent back to user's wallet /// @param tradePath path of the trade on Uniswap /// @param rateMode rate mode for aave v2 /// @param feeMode fee mode /// @param feeBps fee bps /// @param platformWallet wallet to receive fee /// @param extraArgs extra data needed for swap on particular platforms struct SwapAndRepayParams { address payable swapContract; address payable lendingContract; uint256 srcAmount; uint256 payAmount; address[] tradePath; uint256 rateMode; // for aave v2 FeeMode feeMode; uint256 feeBps; address payable platformWallet; bytes extraArgs; } function swapAndRepay(SwapAndRepayParams calldata params) external payable returns (uint256 destAmount); function claimPlatformFee(IERC20Ext[] calldata tokens) external; function adminClaimPlatformFees( address[] calldata platformWallets, IERC20Ext[] calldata tokens ) external; function adminClaimPlatformFeesUrgent( address[] calldata platformWallets, IERC20Ext[] calldata tokens ) external; function setAdminFeeCollector(address feeCollector) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; import "@kyber.network/utils-sc/contracts/IERC20Ext.sol"; import "@kyber.network/utils-sc/contracts/Utils.sol"; import "@kyber.network/utils-sc/contracts/Withdrawable.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; contract SmartWalletStorage is Utils, Withdrawable, ReentrancyGuard { uint256 internal constant MAX_AMOUNT = type(uint256).max; mapping(address => mapping(IERC20Ext => uint256)) public platformWalletFees; EnumerableSet.AddressSet internal supportedPlatformWallets; EnumerableSet.AddressSet internal supportedSwaps; EnumerableSet.AddressSet internal supportedLendings; // [EIP-1967] bytes32(uint256(keccak256("SmartWalletImplementation")) - 1) bytes32 internal constant IMPLEMENTATION = 0x7cf58d76330f82325c2a503c72b55abca3eb533fadde43d95e3c0cceb1583e99; constructor(address _admin) Withdrawable(_admin) {} } abstract contract SmartWalletStorageV2 is SmartWalletStorage { address public adminFeeCollector; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; interface ISwap { struct GetExpectedReturnParams { uint256 srcAmount; address[] tradePath; uint256 feeBps; bytes extraArgs; } function getExpectedReturn(GetExpectedReturnParams calldata params) external view returns (uint256 destAmount); function getExpectedReturnWithImpact(GetExpectedReturnParams calldata params) external view returns (uint256 destAmount, uint256 priceImpact); struct GetExpectedInParams { uint256 destAmount; address[] tradePath; uint256 feeBps; bytes extraArgs; } function getExpectedIn(GetExpectedInParams calldata params) external view returns (uint256 srcAmount); function getExpectedInWithImpact(GetExpectedInParams calldata params) external view returns (uint256 srcAmount, uint256 priceImpact); struct SwapParams { uint256 srcAmount; uint256 minDestAmount; address[] tradePath; address recipient; uint256 feeBps; address payable feeReceiver; bytes extraArgs; } function swap(SwapParams calldata params) external payable returns (uint256 destAmount); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "@kyber.network/utils-sc/contracts/IERC20Ext.sol"; interface ILending { function depositTo( address payable onBehalfOf, IERC20Ext token, uint256 amount ) external; function withdrawFrom( address payable onBehalfOf, IERC20Ext token, uint256 amount, uint256 minReturn ) external returns (uint256 returnedAmount); function repayBorrowTo( address payable onBehalfOf, IERC20Ext token, uint256 amount, uint256 payAmount, bytes calldata extraArgs // for extra data .i.e aave rateMode ) external; function getUserDebtCurrent(address _reserve, address _user) external returns (uint256 debt); function getLendingToken(IERC20Ext token) external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "./IERC20Ext.sol"; /** * @title Kyber utility file * mostly shared constants and rate calculation helpers * inherited by most of kyber contracts. * previous utils implementations are for previous solidity versions. */ abstract contract Utils { // Declared constants below to be used in tandem with // getDecimalsConstant(), for gas optimization purposes // which return decimals from a constant list of popular // tokens. IERC20Ext internal constant ETH_TOKEN_ADDRESS = IERC20Ext( 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE ); IERC20Ext internal constant USDT_TOKEN_ADDRESS = IERC20Ext( 0xdAC17F958D2ee523a2206206994597C13D831ec7 ); IERC20Ext internal constant DAI_TOKEN_ADDRESS = IERC20Ext( 0x6B175474E89094C44Da98b954EedeAC495271d0F ); IERC20Ext internal constant USDC_TOKEN_ADDRESS = IERC20Ext( 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 ); IERC20Ext internal constant WBTC_TOKEN_ADDRESS = IERC20Ext( 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599 ); IERC20Ext internal constant KNC_TOKEN_ADDRESS = IERC20Ext( 0xdd974D5C2e2928deA5F71b9825b8b646686BD200 ); uint256 public constant BPS = 10000; // Basic Price Steps. 1 step = 0.01% uint256 internal constant PRECISION = (10**18); uint256 internal constant MAX_QTY = (10**28); // 10B tokens uint256 internal constant MAX_RATE = (PRECISION * 10**7); // up to 10M tokens per eth uint256 internal constant MAX_DECIMALS = 18; uint256 internal constant ETH_DECIMALS = 18; uint256 internal constant MAX_ALLOWANCE = uint256(-1); // token.approve inifinite mapping(IERC20Ext => uint256) internal decimals; /// @dev Sets the decimals of a token to storage if not already set, and returns /// the decimals value of the token. Prefer using this function over /// getDecimals(), to avoid forgetting to set decimals in local storage. /// @param token The token type /// @return tokenDecimals The decimals of the token function getSetDecimals(IERC20Ext token) internal returns (uint256 tokenDecimals) { tokenDecimals = getDecimalsConstant(token); if (tokenDecimals > 0) return tokenDecimals; tokenDecimals = decimals[token]; if (tokenDecimals == 0) { tokenDecimals = token.decimals(); decimals[token] = tokenDecimals; } } /// @dev Get the balance of a user /// @param token The token type /// @param user The user's address /// @return The balance function getBalance(IERC20Ext token, address user) internal view returns (uint256) { if (token == ETH_TOKEN_ADDRESS) { return user.balance; } else { return token.balanceOf(user); } } /// @dev Get the decimals of a token, read from the constant list, storage, /// or from token.decimals(). Prefer using getSetDecimals when possible. /// @param token The token type /// @return tokenDecimals The decimals of the token function getDecimals(IERC20Ext token) internal view returns (uint256 tokenDecimals) { // return token decimals if has constant value tokenDecimals = getDecimalsConstant(token); if (tokenDecimals > 0) return tokenDecimals; // handle case where token decimals is not a declared decimal constant tokenDecimals = decimals[token]; // moreover, very possible that old tokens have decimals 0 // these tokens will just have higher gas fees. return (tokenDecimals > 0) ? tokenDecimals : token.decimals(); } function calcDestAmount( IERC20Ext src, IERC20Ext dest, uint256 srcAmount, uint256 rate ) internal view returns (uint256) { return calcDstQty(srcAmount, getDecimals(src), getDecimals(dest), rate); } function calcSrcAmount( IERC20Ext src, IERC20Ext dest, uint256 destAmount, uint256 rate ) internal view returns (uint256) { return calcSrcQty(destAmount, getDecimals(src), getDecimals(dest), rate); } function calcDstQty( uint256 srcQty, uint256 srcDecimals, uint256 dstDecimals, uint256 rate ) internal pure returns (uint256) { require(srcQty <= MAX_QTY, "srcQty > MAX_QTY"); require(rate <= MAX_RATE, "rate > MAX_RATE"); if (dstDecimals >= srcDecimals) { require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS"); return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION; } else { require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS"); return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals))); } } function calcSrcQty( uint256 dstQty, uint256 srcDecimals, uint256 dstDecimals, uint256 rate ) internal pure returns (uint256) { require(dstQty <= MAX_QTY, "dstQty > MAX_QTY"); require(rate <= MAX_RATE, "rate > MAX_RATE"); //source quantity is rounded up. to avoid dest quantity being too low. uint256 numerator; uint256 denominator; if (srcDecimals >= dstDecimals) { require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS"); numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals))); denominator = rate; } else { require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS"); numerator = (PRECISION * dstQty); denominator = (rate * (10**(dstDecimals - srcDecimals))); } return (numerator + denominator - 1) / denominator; //avoid rounding down errors } function calcRateFromQty( uint256 srcAmount, uint256 destAmount, uint256 srcDecimals, uint256 dstDecimals ) internal pure returns (uint256) { require(srcAmount <= MAX_QTY, "srcAmount > MAX_QTY"); require(destAmount <= MAX_QTY, "destAmount > MAX_QTY"); if (dstDecimals >= srcDecimals) { require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS"); return ((destAmount * PRECISION) / ((10**(dstDecimals - srcDecimals)) * srcAmount)); } else { require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS"); return ((destAmount * PRECISION * (10**(srcDecimals - dstDecimals))) / srcAmount); } } /// @dev save storage access by declaring token decimal constants /// @param token The token type /// @return token decimals function getDecimalsConstant(IERC20Ext token) internal pure returns (uint256) { if (token == ETH_TOKEN_ADDRESS) { return ETH_DECIMALS; } else if (token == USDT_TOKEN_ADDRESS) { return 6; } else if (token == DAI_TOKEN_ADDRESS) { return 18; } else if (token == USDC_TOKEN_ADDRESS) { return 6; } else if (token == WBTC_TOKEN_ADDRESS) { return 8; } else if (token == KNC_TOKEN_ADDRESS) { return 18; } else { return 0; } } function minOf(uint256 x, uint256 y) internal pure returns (uint256) { return x > y ? y : x; } }
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./IERC20Ext.sol"; import "./PermissionAdmin.sol"; abstract contract Withdrawable is PermissionAdmin { using SafeERC20 for IERC20Ext; event TokenWithdraw(IERC20Ext token, uint256 amount, address sendTo); event EtherWithdraw(uint256 amount, address sendTo); constructor(address _admin) PermissionAdmin(_admin) {} /** * @dev Withdraw all IERC20Ext compatible tokens * @param token IERC20Ext The address of the token contract */ function withdrawToken( IERC20Ext token, uint256 amount, address sendTo ) external onlyAdmin { token.safeTransfer(sendTo, amount); emit TokenWithdraw(token, amount, sendTo); } /** * @dev Withdraw Ethers */ function withdrawEther(uint256 amount, address payable sendTo) external onlyAdmin { (bool success, ) = sendTo.call{value: amount}(""); require(success, "withdraw failed"); emit EtherWithdraw(amount, sendTo); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; abstract contract PermissionAdmin { address public admin; address public pendingAdmin; event AdminClaimed(address newAdmin, address previousAdmin); event TransferAdminPending(address pendingAdmin); constructor(address _admin) { require(_admin != address(0), "admin 0"); admin = _admin; } modifier onlyAdmin() { require(msg.sender == admin, "only admin"); _; } /** * @dev Allows the current admin to set the pendingAdmin address. * @param newAdmin The address to transfer ownership to. */ function transferAdmin(address newAdmin) public onlyAdmin { require(newAdmin != address(0), "new admin 0"); emit TransferAdminPending(newAdmin); pendingAdmin = newAdmin; } /** * @dev Allows the current admin to set the admin in one tx. Useful initial deployment. * @param newAdmin The address to transfer ownership to. */ function transferAdminQuickly(address newAdmin) public onlyAdmin { require(newAdmin != address(0), "admin 0"); emit TransferAdminPending(newAdmin); emit AdminClaimed(newAdmin, admin); admin = newAdmin; } /** * @dev Allows the pendingAdmin address to finalize the change admin process. */ function claimAdmin() public { require(pendingAdmin == msg.sender, "not pending"); emit AdminClaimed(pendingAdmin, admin); admin = pendingAdmin; pendingAdmin = address(0); } }
{ "optimizer": { "enabled": true, "runs": 780 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"}],"name":"AdminClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20Ext[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"spenders","type":"address[]"},{"indexed":false,"internalType":"bool","name":"isReset","type":"bool"}],"name":"ApprovedAllowances","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"wallets","type":"address[]"},{"indexed":false,"internalType":"contract IERC20Ext[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"address","name":"claimer","type":"address"}],"name":"ClaimedPlatformFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"sendTo","type":"address"}],"name":"EtherWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":true,"internalType":"address","name":"swapContract","type":"address"},{"indexed":false,"internalType":"address[]","name":"tradePath","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"enum ISmartWalletImplementation.FeeMode","name":"feeMode","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"feeBps","type":"uint256"},{"indexed":false,"internalType":"address","name":"platformWallet","type":"address"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":true,"internalType":"address","name":"swapContract","type":"address"},{"indexed":true,"internalType":"address","name":"lendingContract","type":"address"},{"indexed":false,"internalType":"address[]","name":"tradePath","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"enum ISmartWalletImplementation.FeeMode","name":"feeMode","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"feeBps","type":"uint256"},{"indexed":false,"internalType":"address","name":"platformWallet","type":"address"}],"name":"SwapAndDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":true,"internalType":"address","name":"swapContract","type":"address"},{"indexed":true,"internalType":"address","name":"lendingContract","type":"address"},{"indexed":false,"internalType":"address[]","name":"tradePath","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"payAmount","type":"uint256"},{"indexed":false,"internalType":"enum ISmartWalletImplementation.FeeMode","name":"feeMode","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"feeBps","type":"uint256"},{"indexed":false,"internalType":"address","name":"platformWallet","type":"address"}],"name":"SwapAndRepay","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20Ext","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"sendTo","type":"address"}],"name":"TokenWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pendingAdmin","type":"address"}],"name":"TransferAdminPending","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":true,"internalType":"address","name":"lendingContract","type":"address"},{"indexed":false,"internalType":"contract IERC20Ext","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minReturn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"actualReturnAmount","type":"uint256"}],"name":"WithdrawFromLending","type":"event"},{"inputs":[],"name":"BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"platformWallets","type":"address[]"},{"internalType":"contract IERC20Ext[]","name":"tokens","type":"address[]"}],"name":"adminClaimPlatformFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"platformWallets","type":"address[]"},{"internalType":"contract IERC20Ext[]","name":"tokens","type":"address[]"}],"name":"adminClaimPlatformFeesUrgent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminFeeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Ext[]","name":"tokens","type":"address[]"},{"internalType":"address[]","name":"spenders","type":"address[]"},{"internalType":"bool","name":"isReset","type":"bool"}],"name":"approveAllowances","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Ext[]","name":"tokens","type":"address[]"}],"name":"claimPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"swapContract","type":"address"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"address[]","name":"tradePath","type":"address[]"},{"internalType":"enum ISmartWalletImplementation.FeeMode","name":"feeMode","type":"uint8"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"bytes","name":"extraArgs","type":"bytes"}],"internalType":"struct ISmartWalletImplementation.GetExpectedInParams","name":"params","type":"tuple"}],"name":"getExpectedIn","outputs":[{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"expectedRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"swapContract","type":"address"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"address[]","name":"tradePath","type":"address[]"},{"internalType":"enum ISmartWalletImplementation.FeeMode","name":"feeMode","type":"uint8"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"bytes","name":"extraArgs","type":"bytes"}],"internalType":"struct ISmartWalletImplementation.GetExpectedInParams","name":"params","type":"tuple"}],"name":"getExpectedInWithImpact","outputs":[{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"expectedRate","type":"uint256"},{"internalType":"uint256","name":"priceImpact","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"swapContract","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"address[]","name":"tradePath","type":"address[]"},{"internalType":"enum ISmartWalletImplementation.FeeMode","name":"feeMode","type":"uint8"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"bytes","name":"extraArgs","type":"bytes"}],"internalType":"struct ISmartWalletImplementation.GetExpectedReturnParams","name":"params","type":"tuple"}],"name":"getExpectedReturn","outputs":[{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"expectedRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"swapContract","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"address[]","name":"tradePath","type":"address[]"},{"internalType":"enum ISmartWalletImplementation.FeeMode","name":"feeMode","type":"uint8"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"bytes","name":"extraArgs","type":"bytes"}],"internalType":"struct ISmartWalletImplementation.GetExpectedReturnParams","name":"params","type":"tuple"}],"name":"getExpectedReturnWithImpact","outputs":[{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"expectedRate","type":"uint256"},{"internalType":"uint256","name":"priceImpact","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"contract IERC20Ext","name":"","type":"address"}],"name":"platformWalletFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"feeCollector","type":"address"}],"name":"setAdminFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"swapContract","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"minDestAmount","type":"uint256"},{"internalType":"address[]","name":"tradePath","type":"address[]"},{"internalType":"enum ISmartWalletImplementation.FeeMode","name":"feeMode","type":"uint8"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"address payable","name":"platformWallet","type":"address"},{"internalType":"bytes","name":"extraArgs","type":"bytes"}],"internalType":"struct ISmartWalletImplementation.SwapParams","name":"params","type":"tuple"}],"name":"swap","outputs":[{"internalType":"uint256","name":"destAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"swapContract","type":"address"},{"internalType":"address payable","name":"lendingContract","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"minDestAmount","type":"uint256"},{"internalType":"address[]","name":"tradePath","type":"address[]"},{"internalType":"enum ISmartWalletImplementation.FeeMode","name":"feeMode","type":"uint8"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"address payable","name":"platformWallet","type":"address"},{"internalType":"bytes","name":"extraArgs","type":"bytes"}],"internalType":"struct ISmartWalletImplementation.SwapAndDepositParams","name":"params","type":"tuple"}],"name":"swapAndDeposit","outputs":[{"internalType":"uint256","name":"destAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"swapContract","type":"address"},{"internalType":"address payable","name":"lendingContract","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"payAmount","type":"uint256"},{"internalType":"address[]","name":"tradePath","type":"address[]"},{"internalType":"uint256","name":"rateMode","type":"uint256"},{"internalType":"enum ISmartWalletImplementation.FeeMode","name":"feeMode","type":"uint8"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"address payable","name":"platformWallet","type":"address"},{"internalType":"bytes","name":"extraArgs","type":"bytes"}],"internalType":"struct ISmartWalletImplementation.SwapAndRepayParams","name":"params","type":"tuple"}],"name":"swapAndRepay","outputs":[{"internalType":"uint256","name":"destAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"transferAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"transferAdminQuickly","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address payable","name":"sendTo","type":"address"}],"name":"withdrawEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"lendingContract","type":"address"},{"internalType":"contract IERC20Ext","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"}],"internalType":"struct ISmartWalletImplementation.WithdrawFromLendingPlatformParams","name":"params","type":"tuple"}],"name":"withdrawFromLendingPlatform","outputs":[{"internalType":"uint256","name":"returnedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Ext","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"sendTo","type":"address"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162004cc138038062004cc18339810160408190526200003491620000aa565b8080806001600160a01b0381166200007d576040805162461bcd60e51b8152602060048201526007602482015266061646d696e20360cc1b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b039290921691909117815560035550620000da915050565b600060208284031215620000bc578081fd5b81516001600160a01b0381168114620000d3578182fd5b9392505050565b614bd780620000ea6000396000f3fe6080604052600436106101845760003560e01c80638be509a6116100d6578063d19358a41161007f578063e941027e11610059578063e941027e1461040c578063f851a4401461042c578063fcd1f148146104415761018b565b8063d19358a41461039e578063d282662f146103be578063e28c4135146103ec5761018b565b8063bc655543116100b0578063bc6555431461033e578063bf3e3f061461035e578063ce56c4541461037e5761018b565b80638be509a6146102eb578063a03f2a0b1461030b578063a7c477971461031e5761018b565b80633ccdbb281161013857806377f50f971161011257806377f50f971461029657806378e58e0f146102ab5780637acc8678146102cb5761018b565b80633ccdbb281461022557806364b2b1b21461024757806375829def146102765761018b565b8063249d39e911610169578063249d39e9146101e857806326782247146101fd5780632db897d0146102125761018b565b806313bc10491461019057806323fcd0c9146101bb5761018b565b3661018b57005b600080fd5b34801561019c57600080fd5b506101a5610454565b6040516101b29190614349565b60405180910390f35b3480156101c757600080fd5b506101db6101d636600461418b565b610463565b6040516101b29190614340565b3480156101f457600080fd5b506101db610849565b34801561020957600080fd5b506101a561084f565b6101db610220366004614152565b61085e565b34801561023157600080fd5b50610245610240366004614052565b6109b3565b005b34801561025357600080fd5b506102676102623660046140ad565b610a62565b6040516101b29392919061493a565b34801561028257600080fd5b50610245610291366004613eb4565b610a86565b3480156102a257600080fd5b50610245610b8b565b3480156102b757600080fd5b506102456102c6366004613f24565b610c5d565b3480156102d757600080fd5b506102456102e6366004613eb4565b610ef2565b3480156102f757600080fd5b50610245610306366004613f8d565b61103f565b6101db6103193660046140e0565b611203565b34801561032a57600080fd5b506101db610339366004613eec565b611541565b34801561034a57600080fd5b50610245610359366004613fcd565b61155e565b34801561036a57600080fd5b506102676103793660046140ad565b6116ad565b34801561038a57600080fd5b506102456103993660046141b4565b6116c4565b3480156103aa57600080fd5b506102456103b9366004613f24565b6117fe565b3480156103ca57600080fd5b506103de6103d93660046140ad565b6119e7565b6040516101b292919061492c565b3480156103f857600080fd5b506103de6104073660046140ad565b611a08565b34801561041857600080fd5b50610245610427366004613eb4565b611a1e565b34801561043857600080fd5b506101a5611a8c565b6101db61044f366004614119565b611a9b565b600b546001600160a01b031681565b6000600260035414156104bd576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556104da6104d26020840184613eb4565b600990611fea565b6104ff5760405162461bcd60e51b81526004016104f69061459c565b60405180910390fd5b600061050e6020840184613eb4565b6001600160a01b03166310c7607761052c6040860160208701613eb4565b6040518263ffffffff1660e01b81526004016105489190614349565b60206040518083038186803b15801561056057600080fd5b505afa158015610574573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105989190613ed0565b90506001600160a01b0381166105c05760405162461bcd60e51b81526004016104f690614641565b60006001600160a01b0382166370a082316105de6020870187613eb4565b6040518263ffffffff1660e01b81526004016105fa9190614349565b60206040518083038186803b15801561061257600080fd5b505afa158015610626573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064a919061419c565b90506106733361065d6020870187613eb4565b6001600160a01b03851691906040880135612008565b60006001600160a01b0383166370a082316106916020880188613eb4565b6040518263ffffffff1660e01b81526004016106ad9190614349565b60206040518083038186803b1580156106c557600080fd5b505afa1580156106d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fd919061419c565b905061070c6020860186613eb4565b6001600160a01b031663d4fdc3093361072b6040890160208a01613eb4565b6107358587612068565b89606001356040518563ffffffff1660e01b81526004016107599493929190614381565b602060405180830381600087803b15801561077357600080fd5b505af1158015610787573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ab919061419c565b935084606001358410156107d15760405162461bcd60e51b81526004016104f6906147f9565b6107de6020860186613eb4565b6001600160a01b0316337f8535f320ef164ed88035c05c538ac8c71ab5fba9c64bc06794378060332042fc6108196040890160208a01613eb4565b88604001358960600135896040516108349493929190614563565b60405180910390a35050600160035550919050565b61271081565b6002546001600160a01b031681565b6000600260035414156108b8576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260035561091c6108cd6020840184613eb4565b602084013560408501356108e46060870187614950565b336108f560a08a0160808b01614093565b60a08a013561090a60e08c0160c08d01613eb4565b61091760e08d018d614997565b6120c5565b905061092b6020830183613eb4565b6001600160a01b0316337ff23fb97e8642200d71532c9c5ae884a9236ca6b8eb58fed071a7cc3f2ac4161d6109636060860186614950565b60208701358661097960a08a0160808b01614093565b60a08a013561098e60e08c0160c08d01613eb4565b6040516109a1979695949392919061443f565b60405180910390a36001600355919050565b6001546001600160a01b031633146109ff576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b610a136001600160a01b038416828461244b565b604080516001600160a01b0380861682526020820185905283168183015290517f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e69181900360600190a1505050565b60008080610a79610a7285614a00565b60016124a2565b9250925092509193909250565b6001546001600160a01b03163314610ad2576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116610b2d576040805162461bcd60e51b815260206004820152600b60248201527f6e65772061646d696e2030000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a1600280546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b03163314610bea576040805162461bcd60e51b815260206004820152600b60248201527f6e6f742070656e64696e67000000000000000000000000000000000000000000604482015290519081900360640190fd5b600254600154604080516001600160a01b03938416815292909116602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a160028054600180546001600160a01b03199081166001600160a01b03841617909155169055565b60026003541415610cb5576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556001546001600160a01b03163314610d06576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b600b546001600160a01b0316610d2e5760405162461bcd60e51b81526004016104f6906147c2565b60005b83811015610ea75760005b82811015610e9e57600060046000888886818110610d5657fe5b9050602002016020810190610d6b9190613eb4565b6001600160a01b03166001600160a01b031681526020019081526020016000206000868685818110610d9957fe5b9050602002016020810190610dae9190613eb4565b6001600160a01b03166001600160a01b031681526020019081526020016000205490506001811115610e9557600160046000898987818110610dec57fe5b9050602002016020810190610e019190613eb4565b6001600160a01b03166001600160a01b031681526020019081526020016000206000878786818110610e2f57fe5b9050602002016020810190610e449190613eb4565b6001600160a01b039081168252602082019290925260400160002091909155600b54610e959116868685818110610e7757fe5b9050602002016020810190610e8c9190613eb4565b6001840361288f565b50600101610d3c565b50600101610d31565b507fcbef5ab8ab58a3dba86704ce124241889d80c3a5fe3caaf4286b7e8c709a6c2d8484848433604051610edf9594939291906143fc565b60405180910390a1505060016003555050565b6001546001600160a01b03163314610f3e576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116610f99576040805162461bcd60e51b815260206004820152600760248201527f61646d696e203000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a1600154604080516001600160a01b038085168252909216602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b60026003541415611097576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003553360005b8281101561117d576001600160a01b0382166000908152600460205260408120818686858181106110cd57fe5b90506020020160208101906110e29190613eb4565b6001600160a01b03166001600160a01b031681526020019081526020016000205490506001811115611174576001600160a01b038316600090815260046020526040812060019187878681811061113557fe5b905060200201602081019061114a9190613eb4565b6001600160a01b0316815260208101919091526040016000205561117483868685818110610e7757fe5b506001016110a0565b506040805160018082528183019092526000916020808301908036833701905050905081816000815181106111ae57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507fcbef5ab8ab58a3dba86704ce124241889d80c3a5fe3caaf4286b7e8c709a6c2d81858533604051610edf94939291906144e6565b60006002600354141561125d576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260035560016112716080840184614950565b905010156112915760405162461bcd60e51b81526004016104f690614830565b6112a46104d26040840160208501613eb4565b6112c05760405162461bcd60e51b81526004016104f69061459c565b6112cd6080830183614950565b905060011415611376576113116112e76080840184614950565b60008181106112f257fe5b90506020020160208101906113079190613eb4565b8360400135612954565b61136f336113256040850160208601613eb4565b6113326080860186614950565b600081811061133d57fe5b90506020020160208101906113529190613eb4565b6040860135600061136a610100890160e08a01613eb4565b6129bf565b90506113e4565b6113e16113866020840184613eb4565b6040840135606085013561139d6080870187614950565b6113ad6040890160208a01613eb4565b6113bd60c08a0160a08b01614093565b60c08a01356113d36101008c0160e08d01613eb4565b6109176101008d018d614997565b90505b6113f46040830160208401613eb4565b6001600160a01b031663f213159c336114106080860186614950565b600161141f6080890189614950565b90500381811061142b57fe5b90506020020160208101906114409190613eb4565b846040518463ffffffff1660e01b815260040161145f9392919061435d565b600060405180830381600087803b15801561147957600080fd5b505af115801561148d573d6000803e3d6000fd5b506114a2925050506040830160208401613eb4565b6001600160a01b03166114b86020840184613eb4565b6001600160a01b0316337f2edafe685397c056fa62be1804788786cdeac9ce01277e8216c4a371801157236114f06080870187614950565b60408801358761150660c08b0160a08c01614093565b60c08b013561151c6101008d0160e08e01613eb4565b60405161152f979695949392919061443f565b60405180910390a46001600355919050565b600460209081526000928352604080842090915290825290205481565b6001546001600160a01b031633146115aa576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6000816115b9576000196115bc565b60005b905060005b858110156116655760005b848110156116325761162a8686838181106115e357fe5b90506020020160208101906115f89190613eb4565b848a8a8681811061160557fe5b905060200201602081019061161a9190613eb4565b6001600160a01b03169190612c0f565b6001016115cc565b5061165c87878381811061164257fe5b90506020020160208101906116579190613eb4565b612d22565b506001016115c1565b507ff34c5ed704407ea33d210cd1c76959be869adc80531ee3b3c93229fb606ac16e868686868660405161169d959493929190614527565b60405180910390a1505050505050565b60008080610a796116bd85614a00565b6001612de7565b6001546001600160a01b03163314611710576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6040516000906001600160a01b0383169084908381818185875af1925050503d806000811461175b576040519150601f19603f3d011682016040523d82523d6000602084013e611760565b606091505b50509050806117b6576040805162461bcd60e51b815260206004820152600f60248201527f7769746864726177206661696c65640000000000000000000000000000000000604482015290519081900360640190fd5b604080518481526001600160a01b038416602082015281517fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de929181900390910190a1505050565b60026003541415611856576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556001546001600160a01b031633146118a7576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b600b546001600160a01b03166118cf5760405162461bcd60e51b81526004016104f6906147c2565b60005b81811015610ea75760006119068484848181106118eb57fe5b90506020020160208101906119009190613eb4565b30613038565b905080156119de57600b54611945906001600160a01b031685858581811061192a57fe5b905060200201602081019061193f9190613eb4565b8361288f565b60005b858110156119dc5760006004600089898581811061196257fe5b90506020020160208101906119779190613eb4565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008787878181106119a557fe5b90506020020160208101906119ba9190613eb4565b6001600160a01b03168152602081019190915260400160002055600101611948565b505b506001016118d2565b6000806119fd6119f684614a00565b60006124a2565b509094909350915050565b6000806119fd611a1784614a00565b6000612de7565b6001546001600160a01b03163314611a6a576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031681565b600060026003541415611af5576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556001611b096080840184614950565b90501015611b295760405162461bcd60e51b81526004016104f690614830565b611b3c6104d26040840160208501613eb4565b611b585760405162461bcd60e51b81526004016104f69061459c565b6000611b6a6040840160208501613eb4565b6001600160a01b031663e5c641b6611b856080860186614950565b6001611b946080890189614950565b905003818110611ba057fe5b9050602002016020810190611bb59190613eb4565b336040518363ffffffff1660e01b8152600401611bd39291906143e2565b602060405180830381600087803b158015611bed57600080fd5b505af1158015611c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c25919061419c565b905060008360600135821015611c3b5781611c41565b83606001355b9050611c506080850185614950565b905060011415611cf557611c94611c6a6080860186614950565b6000818110611c7557fe5b9050602002016020810190611c8a9190613eb4565b8560400135612954565b611cee33611ca86040870160208801613eb4565b611cb56080880188614950565b6000818110611cc057fe5b9050602002016020810190611cd59190613eb4565b6040880135600061136a6101208b016101008c01613eb4565b9250611d60565b611d5d611d056020860186613eb4565b604086013583611d186080890189614950565b611d2860408b0160208c01613eb4565b611d3860e08c0160c08d01614093565b60e08c0135611d4f6101208e016101008f01613eb4565b6109176101208f018f614997565b92505b611d706040850160208601613eb4565b6001600160a01b03166339c3158a33611d8c6080880188614950565b6001611d9b60808b018b614950565b905003818110611da757fe5b9050602002016020810190611dbc9190613eb4565b86858960a00135604051602001611dd39190614340565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401611e029594939291906143aa565b600060405180830381600087803b158015611e1c57600080fd5b505af1158015611e30573d6000803e3d6000fd5b505050506000611f0e856020016020810190611e4c9190613eb4565b6001600160a01b031663e5c641b6611e676080890189614950565b6001611e7660808c018c614950565b905003818110611e8257fe5b9050602002016020810190611e979190613eb4565b336040518363ffffffff1660e01b8152600401611eb59291906143e2565b602060405180830381600087803b158015611ecf57600080fd5b505af1158015611ee3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f07919061419c565b8490612068565b905081811015611f305760405162461bcd60e51b81526004016104f6906146af565b611f406040860160208701613eb4565b6001600160a01b0316611f566020870187613eb4565b6001600160a01b0316337f3b623be279df32a44c2edd16708b64a952bd614abdd2a3bc2572786eaefd5ab3611f8e60808a018a614950565b8a604001358a898d60c0016020810190611fa89190614093565b8e60e001358f610100016020810190611fc19190613eb4565b604051611fd598979695949392919061448f565b60405180910390a45050600160035550919050565b6000611fff836001600160a01b0384166130f0565b90505b92915050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612062908590613108565b50505050565b6000828211156120bf576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006120d260078d611fea565b6120ee5760405162461bcd60e51b81526004016104f69061460a565b600288101561210f5760405162461bcd60e51b81526004016104f690614830565b61271085106121305760405162461bcd60e51b81526004016104f69061471d565b61215b8989600081811061214057fe5b90506020020160208101906121559190613eb4565b8c612954565b60006121a7338e8c8c600081811061216f57fe5b90506020020160208101906121849190613eb4565b8f60008c600281111561219357fe5b1461219f5760006121a1565b8a5b8a6129bf565b905060006121ed8b8b60001981018181106121be57fe5b90506020020160208101906121d39190613eb4565b60018a60028111156121e157fe5b14611900578a5b613038565b90508d6001600160a01b03166368aa6dd96040518060e001604052808581526020018f81526020018e8e8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060200160018c600281111561225c57fe5b14612267578c612269565b305b6001600160a01b0316815260200160028c600281111561228557fe5b14612291576000612293565b8a5b8152602001896001600160a01b0316815260200188888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815261231891906004016148b1565b602060405180830381600087803b15801561233257600080fd5b505af1158015612346573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236a919061419c565b9250806123ae8c8c600019810181811061238057fe5b90506020020160208101906123959190613eb4565b60018b60028111156123a357fe5b14611900578b6121e8565b039050828110156123d15760405162461bcd60e51b81526004016104f6906146e6565b5060018760028111156123e057fe5b141561241b5761241830898c8c60001981018181106123fb57fe5b90506020020160208101906124109190613eb4565b858a8a6129bf565b91505b8a82101561243b5760405162461bcd60e51b81526004016104f690614754565b509b9a5050505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261249d908490613108565b505050565b60008060006127108560800151106124c257506000915081905080612888565b60006001866060015160028111156124d657fe5b146124e5578560200151612500565b612710866080015161271001876020015102816124fe57fe5b045b905084156126bb578551604080516080810182528381528189015160208201526001600160a01b03909216916305a7270991810160028a60600151600281111561254657fe5b14612552576000612558565b89608001515b81526020018960a001518152506040518263ffffffff1660e01b8152600401612581919061489e565b604080518083038186803b15801561259857600080fd5b505afa9250505080156125c8575060408051601f3d908101601f191682019092526125c5918101906141d8565b60015b6126b0576125d4614a3e565b806125df57506126a1565b61261e816040518060400160405280601a81526020017f6765744578706563746564496e5f6e6f74537570706f727465640000000000008152506131b9565b819061263d5760405162461bcd60e51b81526004016104f69190614589565b50865160408051608081018252848152818a015160208201526126959291810160025b8b60600151600281111561267057fe5b1461267c576000612682565b8a608001515b81526020018a60a0015181525088613212565b90955092506126ab9050565b3d6000803e3d6000fd5b6126b6565b90945091505b61280a565b8551604080516080810182528381528189015160208201526001600160a01b0390921691634db1d03d91810160028a6060015160028111156126f957fe5b1461270557600061270b565b89608001515b81526020018960a001518152506040518263ffffffff1660e01b8152600401612734919061489e565b60206040518083038186803b15801561274c57600080fd5b505afa92505050801561277c575060408051601f3d908101601f191682019092526127799181019061419c565b60015b61280757612788614a3e565b8061279357506126a1565b6127b581604051806060016040528060288152602001614afc602891396131b9565b81906127d45760405162461bcd60e51b81526004016104f69190614589565b50865160408051608081018252848152818a015160208201526127fb929181016002612660565b90955092506126b69050565b93505b60008660600151600281111561281c57fe5b141561283b5761271086608001516127100185028161283757fe5b0493505b612884848760200151612865896040015160008151811061285857fe5b602002602001015161356f565b60408a0151805161287f9190600019810190811061285857fe5b613613565b9250505b9250925092565b806128995761249d565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612940576000836001600160a01b0316826040516128d79061433d565b60006040518083038185875af1925050503d8060008114612914576040519150601f19603f3d011682016040523d82523d6000602084013e612919565b606091505b505090508061293a5760405162461bcd60e51b81526004016104f690614867565b5061249d565b61249d6001600160a01b038316848361244b565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561299d578034146129985760405162461bcd60e51b81526004016104f6906145d3565b6129bb565b34156129bb5760405162461bcd60e51b81526004016104f69061478b565b5050565b6000806129d86127106129d287876137d2565b9061382b565b905060006129e68683612068565b9050866001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612a93576000896001600160a01b031683604051612a279061433d565b60006040518083038185875af1925050503d8060008114612a64576040519150601f19603f3d011682016040523d82523d6000602084013e612a69565b606091505b5050905080612a8a5760405162461bcd60e51b81526004016104f690614867565b82945050612bf7565b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190612ac2908d90600401614349565b60206040518083038186803b158015612ada57600080fd5b505afa158015612aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b12919061419c565b90506001600160a01b038b163014612b5957612b396001600160a01b0383168c8c86612008565b8315612b5457612b546001600160a01b0383168c3087612008565b612b6d565b612b6d6001600160a01b0383168b8561244b565b612bf381836001600160a01b03166370a082318d6040518263ffffffff1660e01b8152600401612b9d9190614349565b60206040518083038186803b158015612bb557600080fd5b505afa158015612bc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bed919061419c565b90612068565b9450505b612c02858285613892565b5050509695505050505050565b801580612c95575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612c6757600080fd5b505afa158015612c7b573d6000803e3d6000fd5b505050506040513d6020811015612c9157600080fd5b5051155b612cd05760405162461bcd60e51b8152600401808060200182810382526036815260200180614b956036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261249d908490613108565b6000612d2d8261391a565b90508015612d3a57612de2565b506001600160a01b03811660009081526020819052604090205480612de257816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015612d9257600080fd5b505afa158015612da6573d6000803e3d6000fd5b505050506040513d6020811015612dbc57600080fd5b50516001600160a01b038316600090815260208190526040902060ff9091169081905590505b919050565b6000806000612710856080015110612e0757506000915081905080612888565b60008086606001516002811115612e1a57fe5b14612e29578560200151612e44565b61271086608001516127100387602001510281612e4257fe5b045b90508415612f1e578551604080516080810182528381528189015160208201526001600160a01b039092169163e19b609d91810160028a606001516002811115612e8a57fe5b14612e96576000612e9c565b89608001515b81526020018960a001518152506040518263ffffffff1660e01b8152600401612ec5919061489e565b604080518083038186803b158015612edc57600080fd5b505afa158015612ef0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f1491906141d8565b9094509150612fea565b8551604080516080810182528381528189015160208201526001600160a01b03909216916343bea4b391810160028a606001516002811115612f5c57fe5b14612f68576000612f6e565b89608001515b81526020018960a001518152506040518263ffffffff1660e01b8152600401612f97919061489e565b60206040518083038186803b158015612faf57600080fd5b505afa158015612fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe7919061419c565b93505b600186606001516002811115612ffc57fe5b141561301b5761271086608001516127100385028161301757fe5b0493505b612884866020015185612865896040015160008151811061285857fe5b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561307057506001600160a01b03811631612002565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156130bd57600080fd5b505afa1580156130d1573d6000803e3d6000fd5b505050506040513d60208110156130e757600080fd5b50519050612002565b60009081526001919091016020526040902054151590565b600061315d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a329092919063ffffffff16565b80519091501561249d5780806020019051602081101561317c57600080fd5b505161249d5760405162461bcd60e51b815260040180806020018281038252602a815260200180614b6b602a913960400191505060405180910390fd5b6000816040516020016131cc9190614321565b60405160208183030381529060405280519060200120836040516020016131f39190614321565b6040516020818303038152906040528051906020012014905092915050565b60008060006012905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316856020015160008151811061324a57fe5b60200260200101516001600160a01b0316146132ec57846020015160008151811061327157fe5b60200260200101516001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156132b157600080fd5b505afa1580156132c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132e991906141fb565b90505b60038160ff1611156132fd57600219015b60ff8116600a0a92506000805b600a8110156133ec57604080516080810182528681526020898101519082015288820151818301526060808a01519082015290516343bea4b360e01b81526001600160a01b038a16916343bea4b391613366919060040161489e565b60206040518083038186803b15801561337e57600080fd5b505afa9250505080156133ae575060408051601f3d908101601f191682019092526133ab9181019061419c565b60015b6133b7576133db565b80156133d957858189600001518802816133cd57fe5b04965092506133e49050565b505b60028583010494505b60010161330a565b50600085156134a057604080516080810182528681526020898101519082015288820151818301526060808a015190820152905163e19b609d60e01b81526001600160a01b038a169163e19b609d91613448919060040161489e565b604080518083038186803b15801561345f57600080fd5b505afa158015613473573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061349791906141d8565b94509050613546565b604080516080810182528681526020898101519082015288820151818301526060808a01519082015290516343bea4b360e01b81526001600160a01b038a16916343bea4b3916134f3919060040161489e565b60206040518083038186803b15801561350b57600080fd5b505afa15801561351f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613543919061419c565b90505b865160009082111561355c575086518103613563565b5086518190035b50505050935093915050565b600061357a8261391a565b9050801561358757612de2565b506001600160a01b03811660009081526020819052604090205480612de257816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156135df57600080fd5b505afa1580156135f3573d6000803e3d6000fd5b505050506040513d602081101561360957600080fd5b505160ff16612002565b60006b204fce5e3e25026110000000851115613676576040805162461bcd60e51b815260206004820152601360248201527f737263416d6f756e74203e204d41585f51545900000000000000000000000000604482015290519081900360640190fd5b6b204fce5e3e250261100000008411156136d7576040805162461bcd60e51b815260206004820152601460248201527f64657374416d6f756e74203e204d41585f515459000000000000000000000000604482015290519081900360640190fd5b8282106137585760128383031115613736576040805162461bcd60e51b815260206004820152601860248201527f647374202d20737263203e204d41585f444543494d414c530000000000000000604482015290519081900360640190fd5b84838303600a0a02670de0b6b3a764000085028161375057fe5b0490506137ca565b601282840311156137b0576040805162461bcd60e51b815260206004820152601860248201527f737263202d20647374203e204d41585f444543494d414c530000000000000000604482015290519081900360640190fd5b84828403600a0a670de0b6b3a76400008602028161375057fe5b949350505050565b6000826137e157506000612002565b828202828482816137ee57fe5b0414611fff5760405162461bcd60e51b8152600401808060200182810382526021815260200180614b4a6021913960400191505060405180910390fd5b6000808211613881576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161388a57fe5b049392505050565b801561249d576138a3600584611fea565b6138bf5760405162461bcd60e51b81526004016104f690614678565b6001600160a01b038084166000908152600460209081526040808320938616835292905220546138ef9082613a4b565b6001600160a01b03808516600090815260046020908152604080832093871683529290522055505050565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561394957506012612de2565b6001600160a01b03821673dac17f958d2ee523a2206206994597c13d831ec7141561397657506006612de2565b6001600160a01b038216736b175474e89094c44da98b954eedeac495271d0f14156139a357506012612de2565b6001600160a01b03821673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4814156139d057506006612de2565b6001600160a01b038216732260fac5e5542a773aa44fbcfedf7c193bc2c59914156139fd57506008612de2565b6001600160a01b03821673dd974d5c2e2928dea5f71b9825b8b646686bd2001415613a2a57506012612de2565b506000612de2565b6060613a418484600085613aa5565b90505b9392505050565b600082820183811015611fff576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b606082471015613ae65760405162461bcd60e51b8152600401808060200182810382526026815260200180614b246026913960400191505060405180910390fd5b613aef85613c00565b613b40576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310613b7e5780518252601f199092019160209182019101613b5f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613be0576040519150601f19603f3d011682016040523d82523d6000602084013e613be5565b606091505b5091509150613bf5828286613c06565b979650505050505050565b3b151590565b60608315613c15575081613a44565b825115613c255782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613c6f578181015183820152602001613c57565b50505050905090810190601f168015613c9c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b8035612de281614ae3565b60008083601f840112613cc6578182fd5b50813567ffffffffffffffff811115613cdd578182fd5b6020830191508360208083028501011115613cf757600080fd5b9250929050565b600082601f830112613d0e578081fd5b8135602067ffffffffffffffff821115613d2457fe5b808202613d328282016149dc565b838152828101908684018388018501891015613d4c578687fd5b8693505b85841015613d77578035613d6381614ae3565b835260019390930192918401918401613d50565b50979650505050505050565b600082601f830112613d93578081fd5b813567ffffffffffffffff811115613da757fe5b613dba601f8201601f19166020016149dc565b818152846020838601011115613dce578283fd5b816020850160208301379081016020019190915292915050565b803560038110612de257600080fd5b600060c08284031215613e08578081fd5b50919050565b600060c08284031215613e1f578081fd5b613e2960c06149dc565b9050613e3482613caa565b815260208201356020820152604082013567ffffffffffffffff80821115613e5b57600080fd5b613e6785838601613cfe565b6040840152613e7860608501613de8565b60608401526080840135608084015260a0840135915080821115613e9b57600080fd5b50613ea884828501613d83565b60a08301525092915050565b600060208284031215613ec5578081fd5b8135611fff81614ae3565b600060208284031215613ee1578081fd5b8151611fff81614ae3565b60008060408385031215613efe578081fd5b8235613f0981614ae3565b91506020830135613f1981614ae3565b809150509250929050565b60008060008060408587031215613f39578182fd5b843567ffffffffffffffff80821115613f50578384fd5b613f5c88838901613cb5565b90965094506020870135915080821115613f74578384fd5b50613f8187828801613cb5565b95989497509550505050565b60008060208385031215613f9f578182fd5b823567ffffffffffffffff811115613fb5578283fd5b613fc185828601613cb5565b90969095509350505050565b600080600080600060608688031215613fe4578283fd5b853567ffffffffffffffff80821115613ffb578485fd5b61400789838a01613cb5565b9097509550602088013591508082111561401f578485fd5b5061402c88828901613cb5565b90945092505060408601358015158114614044578182fd5b809150509295509295909350565b600080600060608486031215614066578081fd5b833561407181614ae3565b925060208401359150604084013561408881614ae3565b809150509250925092565b6000602082840312156140a4578081fd5b611fff82613de8565b6000602082840312156140be578081fd5b813567ffffffffffffffff8111156140d4578182fd5b6137ca84828501613df7565b6000602082840312156140f1578081fd5b813567ffffffffffffffff811115614107578182fd5b82016101208185031215611fff578182fd5b60006020828403121561412a578081fd5b813567ffffffffffffffff811115614140578182fd5b82016101408185031215611fff578182fd5b600060208284031215614163578081fd5b813567ffffffffffffffff811115614179578182fd5b82016101008185031215611fff578182fd5b600060808284031215613e08578081fd5b6000602082840312156141ad578081fd5b5051919050565b600080604083850312156141c6578182fd5b823591506020830135613f1981614ae3565b600080604083850312156141ea578182fd5b505080516020909101519092909150565b60006020828403121561420c578081fd5b815160ff81168114611fff578182fd5b60008284526020808501945082825b8581101561425957813561423e81614ae3565b6001600160a01b03168752958201959082019060010161422b565b509495945050505050565b6000815180845260208085019450808401835b838110156142595781516001600160a01b031687529582019590820190600101614277565b600081518084526142b4816020860160208601614a0c565b601f01601f19169290920160200192915050565b600381106142d257fe5b9052565b6000815183526020820151608060208501526142f56080850182614264565b90506040830151604085015260608301518482036060860152614318828261429c565b95945050505050565b60008251614333818460208701614a0c565b9190910192915050565b90565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152613bf560a083018461429c565b6001600160a01b0392831681529116602082015260400190565b60006060825261441060608301878961421c565b828103602084015261442381868861421c565b9150506001600160a01b03831660408301529695505050505050565b600060c0825261445360c08301898b61421c565b905086602083015285604083015261446e60608301866142c8565b8360808301526001600160a01b03831660a083015298975050505050505050565b600060e082526144a360e083018a8c61421c565b90508760208301528660408301528560608301526144c460808301866142c8565b8360a08301526001600160a01b03831660c08301529998505050505050505050565b6000606082526144f96060830187614264565b828103602084015261450c81868861421c565b9150506001600160a01b038316604083015295945050505050565b60006060825261453b60608301878961421c565b828103602084015261454e81868861421c565b91505082151560408301529695505050505050565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b600060208252611fff602083018461429c565b60208082526013908201527f756e737570706f72746564206c656e64696e6700000000000000000000000000604082015260600190565b6020808252600f908201527f77726f6e67206d73672076616c75650000000000000000000000000000000000604082015260600190565b60208082526010908201527f756e737570706f72746564207377617000000000000000000000000000000000604082015260600190565b60208082526011908201527f756e737570706f7274656420746f6b656e000000000000000000000000000000604082015260600190565b60208082526014908201527f756e737570706f7274656420706c6174666f726d000000000000000000000000604082015260600190565b6020808252600f908201527f6c6f77207061696420616d6f756e740000000000000000000000000000000000604082015260600190565b60208082526018908201527f72657475726e20616d6f756e74206e6f7420656e6f7567680000000000000000604082015260600190565b60208082526011908201527f6869676820706c6174666f726d20666565000000000000000000000000000000604082015260600190565b6020808252600a908201527f6c6f772072657475726e00000000000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f626164206d73672076616c756500000000000000000000000000000000000000604082015260600190565b6020808252601b908201527f726571756972652061646d696e2066656520636f6c6c6563746f720000000000604082015260600190565b60208082526013908201527f6c6f772072657475726e656420616d6f756e7400000000000000000000000000604082015260600190565b60208082526011908201527f696e76616c696420747261646550617468000000000000000000000000000000604082015260600190565b6020808252600f908201527f7472616e73666572206661696c65640000000000000000000000000000000000604082015260600190565b600060208252611fff60208301846142d6565b6000602082528251602083015260208301516040830152604083015160e060608401526148e2610100840182614264565b905060608401516001600160a01b038082166080860152608086015160a08601528060a08701511660c0860152505060c0840151601f198483030160e0850152614318828261429c565b918252602082015260400190565b9283526020830191909152604082015260600190565b6000808335601e19843603018112614966578283fd5b83018035915067ffffffffffffffff821115614980578283fd5b6020908101925081023603821315613cf757600080fd5b6000808335601e198436030181126149ad578283fd5b83018035915067ffffffffffffffff8211156149c7578283fd5b602001915036819003821315613cf757600080fd5b60405181810167ffffffffffffffff811182821017156149f857fe5b604052919050565b60006120023683613e0e565b60005b83811015614a27578181015183820152602001614a0f565b838111156120625750506000910152565b60e01c90565b600060443d1015614a4e5761433d565b600481823e6308c379a0614a628251614a38565b14614a6c5761433d565b6040513d600319016004823e80513d67ffffffffffffffff8160248401118184111715614a9c575050505061433d565b82840192508251915080821115614ab6575050505061433d565b503d83016020828401011115614ace5750505061433d565b601f01601f1916810160200160405291505090565b6001600160a01b0381168114614af857600080fd5b5056fe676574457870656374656452657475726e57697468496d706163745f6e6f74537570706f72746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a164736f6c6343000706000a000000000000000000000000320849ec0adffcd6fb0212b59a2ec936cdef5fca
Deployed Bytecode
0x6080604052600436106101845760003560e01c80638be509a6116100d6578063d19358a41161007f578063e941027e11610059578063e941027e1461040c578063f851a4401461042c578063fcd1f148146104415761018b565b8063d19358a41461039e578063d282662f146103be578063e28c4135146103ec5761018b565b8063bc655543116100b0578063bc6555431461033e578063bf3e3f061461035e578063ce56c4541461037e5761018b565b80638be509a6146102eb578063a03f2a0b1461030b578063a7c477971461031e5761018b565b80633ccdbb281161013857806377f50f971161011257806377f50f971461029657806378e58e0f146102ab5780637acc8678146102cb5761018b565b80633ccdbb281461022557806364b2b1b21461024757806375829def146102765761018b565b8063249d39e911610169578063249d39e9146101e857806326782247146101fd5780632db897d0146102125761018b565b806313bc10491461019057806323fcd0c9146101bb5761018b565b3661018b57005b600080fd5b34801561019c57600080fd5b506101a5610454565b6040516101b29190614349565b60405180910390f35b3480156101c757600080fd5b506101db6101d636600461418b565b610463565b6040516101b29190614340565b3480156101f457600080fd5b506101db610849565b34801561020957600080fd5b506101a561084f565b6101db610220366004614152565b61085e565b34801561023157600080fd5b50610245610240366004614052565b6109b3565b005b34801561025357600080fd5b506102676102623660046140ad565b610a62565b6040516101b29392919061493a565b34801561028257600080fd5b50610245610291366004613eb4565b610a86565b3480156102a257600080fd5b50610245610b8b565b3480156102b757600080fd5b506102456102c6366004613f24565b610c5d565b3480156102d757600080fd5b506102456102e6366004613eb4565b610ef2565b3480156102f757600080fd5b50610245610306366004613f8d565b61103f565b6101db6103193660046140e0565b611203565b34801561032a57600080fd5b506101db610339366004613eec565b611541565b34801561034a57600080fd5b50610245610359366004613fcd565b61155e565b34801561036a57600080fd5b506102676103793660046140ad565b6116ad565b34801561038a57600080fd5b506102456103993660046141b4565b6116c4565b3480156103aa57600080fd5b506102456103b9366004613f24565b6117fe565b3480156103ca57600080fd5b506103de6103d93660046140ad565b6119e7565b6040516101b292919061492c565b3480156103f857600080fd5b506103de6104073660046140ad565b611a08565b34801561041857600080fd5b50610245610427366004613eb4565b611a1e565b34801561043857600080fd5b506101a5611a8c565b6101db61044f366004614119565b611a9b565b600b546001600160a01b031681565b6000600260035414156104bd576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556104da6104d26020840184613eb4565b600990611fea565b6104ff5760405162461bcd60e51b81526004016104f69061459c565b60405180910390fd5b600061050e6020840184613eb4565b6001600160a01b03166310c7607761052c6040860160208701613eb4565b6040518263ffffffff1660e01b81526004016105489190614349565b60206040518083038186803b15801561056057600080fd5b505afa158015610574573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105989190613ed0565b90506001600160a01b0381166105c05760405162461bcd60e51b81526004016104f690614641565b60006001600160a01b0382166370a082316105de6020870187613eb4565b6040518263ffffffff1660e01b81526004016105fa9190614349565b60206040518083038186803b15801561061257600080fd5b505afa158015610626573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064a919061419c565b90506106733361065d6020870187613eb4565b6001600160a01b03851691906040880135612008565b60006001600160a01b0383166370a082316106916020880188613eb4565b6040518263ffffffff1660e01b81526004016106ad9190614349565b60206040518083038186803b1580156106c557600080fd5b505afa1580156106d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fd919061419c565b905061070c6020860186613eb4565b6001600160a01b031663d4fdc3093361072b6040890160208a01613eb4565b6107358587612068565b89606001356040518563ffffffff1660e01b81526004016107599493929190614381565b602060405180830381600087803b15801561077357600080fd5b505af1158015610787573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ab919061419c565b935084606001358410156107d15760405162461bcd60e51b81526004016104f6906147f9565b6107de6020860186613eb4565b6001600160a01b0316337f8535f320ef164ed88035c05c538ac8c71ab5fba9c64bc06794378060332042fc6108196040890160208a01613eb4565b88604001358960600135896040516108349493929190614563565b60405180910390a35050600160035550919050565b61271081565b6002546001600160a01b031681565b6000600260035414156108b8576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260035561091c6108cd6020840184613eb4565b602084013560408501356108e46060870187614950565b336108f560a08a0160808b01614093565b60a08a013561090a60e08c0160c08d01613eb4565b61091760e08d018d614997565b6120c5565b905061092b6020830183613eb4565b6001600160a01b0316337ff23fb97e8642200d71532c9c5ae884a9236ca6b8eb58fed071a7cc3f2ac4161d6109636060860186614950565b60208701358661097960a08a0160808b01614093565b60a08a013561098e60e08c0160c08d01613eb4565b6040516109a1979695949392919061443f565b60405180910390a36001600355919050565b6001546001600160a01b031633146109ff576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b610a136001600160a01b038416828461244b565b604080516001600160a01b0380861682526020820185905283168183015290517f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e69181900360600190a1505050565b60008080610a79610a7285614a00565b60016124a2565b9250925092509193909250565b6001546001600160a01b03163314610ad2576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116610b2d576040805162461bcd60e51b815260206004820152600b60248201527f6e65772061646d696e2030000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a1600280546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b03163314610bea576040805162461bcd60e51b815260206004820152600b60248201527f6e6f742070656e64696e67000000000000000000000000000000000000000000604482015290519081900360640190fd5b600254600154604080516001600160a01b03938416815292909116602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a160028054600180546001600160a01b03199081166001600160a01b03841617909155169055565b60026003541415610cb5576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556001546001600160a01b03163314610d06576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b600b546001600160a01b0316610d2e5760405162461bcd60e51b81526004016104f6906147c2565b60005b83811015610ea75760005b82811015610e9e57600060046000888886818110610d5657fe5b9050602002016020810190610d6b9190613eb4565b6001600160a01b03166001600160a01b031681526020019081526020016000206000868685818110610d9957fe5b9050602002016020810190610dae9190613eb4565b6001600160a01b03166001600160a01b031681526020019081526020016000205490506001811115610e9557600160046000898987818110610dec57fe5b9050602002016020810190610e019190613eb4565b6001600160a01b03166001600160a01b031681526020019081526020016000206000878786818110610e2f57fe5b9050602002016020810190610e449190613eb4565b6001600160a01b039081168252602082019290925260400160002091909155600b54610e959116868685818110610e7757fe5b9050602002016020810190610e8c9190613eb4565b6001840361288f565b50600101610d3c565b50600101610d31565b507fcbef5ab8ab58a3dba86704ce124241889d80c3a5fe3caaf4286b7e8c709a6c2d8484848433604051610edf9594939291906143fc565b60405180910390a1505060016003555050565b6001546001600160a01b03163314610f3e576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116610f99576040805162461bcd60e51b815260206004820152600760248201527f61646d696e203000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a1600154604080516001600160a01b038085168252909216602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b60026003541415611097576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003553360005b8281101561117d576001600160a01b0382166000908152600460205260408120818686858181106110cd57fe5b90506020020160208101906110e29190613eb4565b6001600160a01b03166001600160a01b031681526020019081526020016000205490506001811115611174576001600160a01b038316600090815260046020526040812060019187878681811061113557fe5b905060200201602081019061114a9190613eb4565b6001600160a01b0316815260208101919091526040016000205561117483868685818110610e7757fe5b506001016110a0565b506040805160018082528183019092526000916020808301908036833701905050905081816000815181106111ae57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507fcbef5ab8ab58a3dba86704ce124241889d80c3a5fe3caaf4286b7e8c709a6c2d81858533604051610edf94939291906144e6565b60006002600354141561125d576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260035560016112716080840184614950565b905010156112915760405162461bcd60e51b81526004016104f690614830565b6112a46104d26040840160208501613eb4565b6112c05760405162461bcd60e51b81526004016104f69061459c565b6112cd6080830183614950565b905060011415611376576113116112e76080840184614950565b60008181106112f257fe5b90506020020160208101906113079190613eb4565b8360400135612954565b61136f336113256040850160208601613eb4565b6113326080860186614950565b600081811061133d57fe5b90506020020160208101906113529190613eb4565b6040860135600061136a610100890160e08a01613eb4565b6129bf565b90506113e4565b6113e16113866020840184613eb4565b6040840135606085013561139d6080870187614950565b6113ad6040890160208a01613eb4565b6113bd60c08a0160a08b01614093565b60c08a01356113d36101008c0160e08d01613eb4565b6109176101008d018d614997565b90505b6113f46040830160208401613eb4565b6001600160a01b031663f213159c336114106080860186614950565b600161141f6080890189614950565b90500381811061142b57fe5b90506020020160208101906114409190613eb4565b846040518463ffffffff1660e01b815260040161145f9392919061435d565b600060405180830381600087803b15801561147957600080fd5b505af115801561148d573d6000803e3d6000fd5b506114a2925050506040830160208401613eb4565b6001600160a01b03166114b86020840184613eb4565b6001600160a01b0316337f2edafe685397c056fa62be1804788786cdeac9ce01277e8216c4a371801157236114f06080870187614950565b60408801358761150660c08b0160a08c01614093565b60c08b013561151c6101008d0160e08e01613eb4565b60405161152f979695949392919061443f565b60405180910390a46001600355919050565b600460209081526000928352604080842090915290825290205481565b6001546001600160a01b031633146115aa576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6000816115b9576000196115bc565b60005b905060005b858110156116655760005b848110156116325761162a8686838181106115e357fe5b90506020020160208101906115f89190613eb4565b848a8a8681811061160557fe5b905060200201602081019061161a9190613eb4565b6001600160a01b03169190612c0f565b6001016115cc565b5061165c87878381811061164257fe5b90506020020160208101906116579190613eb4565b612d22565b506001016115c1565b507ff34c5ed704407ea33d210cd1c76959be869adc80531ee3b3c93229fb606ac16e868686868660405161169d959493929190614527565b60405180910390a1505050505050565b60008080610a796116bd85614a00565b6001612de7565b6001546001600160a01b03163314611710576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6040516000906001600160a01b0383169084908381818185875af1925050503d806000811461175b576040519150601f19603f3d011682016040523d82523d6000602084013e611760565b606091505b50509050806117b6576040805162461bcd60e51b815260206004820152600f60248201527f7769746864726177206661696c65640000000000000000000000000000000000604482015290519081900360640190fd5b604080518481526001600160a01b038416602082015281517fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de929181900390910190a1505050565b60026003541415611856576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556001546001600160a01b031633146118a7576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b600b546001600160a01b03166118cf5760405162461bcd60e51b81526004016104f6906147c2565b60005b81811015610ea75760006119068484848181106118eb57fe5b90506020020160208101906119009190613eb4565b30613038565b905080156119de57600b54611945906001600160a01b031685858581811061192a57fe5b905060200201602081019061193f9190613eb4565b8361288f565b60005b858110156119dc5760006004600089898581811061196257fe5b90506020020160208101906119779190613eb4565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008787878181106119a557fe5b90506020020160208101906119ba9190613eb4565b6001600160a01b03168152602081019190915260400160002055600101611948565b505b506001016118d2565b6000806119fd6119f684614a00565b60006124a2565b509094909350915050565b6000806119fd611a1784614a00565b6000612de7565b6001546001600160a01b03163314611a6a576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031681565b600060026003541415611af5576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556001611b096080840184614950565b90501015611b295760405162461bcd60e51b81526004016104f690614830565b611b3c6104d26040840160208501613eb4565b611b585760405162461bcd60e51b81526004016104f69061459c565b6000611b6a6040840160208501613eb4565b6001600160a01b031663e5c641b6611b856080860186614950565b6001611b946080890189614950565b905003818110611ba057fe5b9050602002016020810190611bb59190613eb4565b336040518363ffffffff1660e01b8152600401611bd39291906143e2565b602060405180830381600087803b158015611bed57600080fd5b505af1158015611c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c25919061419c565b905060008360600135821015611c3b5781611c41565b83606001355b9050611c506080850185614950565b905060011415611cf557611c94611c6a6080860186614950565b6000818110611c7557fe5b9050602002016020810190611c8a9190613eb4565b8560400135612954565b611cee33611ca86040870160208801613eb4565b611cb56080880188614950565b6000818110611cc057fe5b9050602002016020810190611cd59190613eb4565b6040880135600061136a6101208b016101008c01613eb4565b9250611d60565b611d5d611d056020860186613eb4565b604086013583611d186080890189614950565b611d2860408b0160208c01613eb4565b611d3860e08c0160c08d01614093565b60e08c0135611d4f6101208e016101008f01613eb4565b6109176101208f018f614997565b92505b611d706040850160208601613eb4565b6001600160a01b03166339c3158a33611d8c6080880188614950565b6001611d9b60808b018b614950565b905003818110611da757fe5b9050602002016020810190611dbc9190613eb4565b86858960a00135604051602001611dd39190614340565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401611e029594939291906143aa565b600060405180830381600087803b158015611e1c57600080fd5b505af1158015611e30573d6000803e3d6000fd5b505050506000611f0e856020016020810190611e4c9190613eb4565b6001600160a01b031663e5c641b6611e676080890189614950565b6001611e7660808c018c614950565b905003818110611e8257fe5b9050602002016020810190611e979190613eb4565b336040518363ffffffff1660e01b8152600401611eb59291906143e2565b602060405180830381600087803b158015611ecf57600080fd5b505af1158015611ee3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f07919061419c565b8490612068565b905081811015611f305760405162461bcd60e51b81526004016104f6906146af565b611f406040860160208701613eb4565b6001600160a01b0316611f566020870187613eb4565b6001600160a01b0316337f3b623be279df32a44c2edd16708b64a952bd614abdd2a3bc2572786eaefd5ab3611f8e60808a018a614950565b8a604001358a898d60c0016020810190611fa89190614093565b8e60e001358f610100016020810190611fc19190613eb4565b604051611fd598979695949392919061448f565b60405180910390a45050600160035550919050565b6000611fff836001600160a01b0384166130f0565b90505b92915050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612062908590613108565b50505050565b6000828211156120bf576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006120d260078d611fea565b6120ee5760405162461bcd60e51b81526004016104f69061460a565b600288101561210f5760405162461bcd60e51b81526004016104f690614830565b61271085106121305760405162461bcd60e51b81526004016104f69061471d565b61215b8989600081811061214057fe5b90506020020160208101906121559190613eb4565b8c612954565b60006121a7338e8c8c600081811061216f57fe5b90506020020160208101906121849190613eb4565b8f60008c600281111561219357fe5b1461219f5760006121a1565b8a5b8a6129bf565b905060006121ed8b8b60001981018181106121be57fe5b90506020020160208101906121d39190613eb4565b60018a60028111156121e157fe5b14611900578a5b613038565b90508d6001600160a01b03166368aa6dd96040518060e001604052808581526020018f81526020018e8e8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060200160018c600281111561225c57fe5b14612267578c612269565b305b6001600160a01b0316815260200160028c600281111561228557fe5b14612291576000612293565b8a5b8152602001896001600160a01b0316815260200188888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815261231891906004016148b1565b602060405180830381600087803b15801561233257600080fd5b505af1158015612346573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236a919061419c565b9250806123ae8c8c600019810181811061238057fe5b90506020020160208101906123959190613eb4565b60018b60028111156123a357fe5b14611900578b6121e8565b039050828110156123d15760405162461bcd60e51b81526004016104f6906146e6565b5060018760028111156123e057fe5b141561241b5761241830898c8c60001981018181106123fb57fe5b90506020020160208101906124109190613eb4565b858a8a6129bf565b91505b8a82101561243b5760405162461bcd60e51b81526004016104f690614754565b509b9a5050505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261249d908490613108565b505050565b60008060006127108560800151106124c257506000915081905080612888565b60006001866060015160028111156124d657fe5b146124e5578560200151612500565b612710866080015161271001876020015102816124fe57fe5b045b905084156126bb578551604080516080810182528381528189015160208201526001600160a01b03909216916305a7270991810160028a60600151600281111561254657fe5b14612552576000612558565b89608001515b81526020018960a001518152506040518263ffffffff1660e01b8152600401612581919061489e565b604080518083038186803b15801561259857600080fd5b505afa9250505080156125c8575060408051601f3d908101601f191682019092526125c5918101906141d8565b60015b6126b0576125d4614a3e565b806125df57506126a1565b61261e816040518060400160405280601a81526020017f6765744578706563746564496e5f6e6f74537570706f727465640000000000008152506131b9565b819061263d5760405162461bcd60e51b81526004016104f69190614589565b50865160408051608081018252848152818a015160208201526126959291810160025b8b60600151600281111561267057fe5b1461267c576000612682565b8a608001515b81526020018a60a0015181525088613212565b90955092506126ab9050565b3d6000803e3d6000fd5b6126b6565b90945091505b61280a565b8551604080516080810182528381528189015160208201526001600160a01b0390921691634db1d03d91810160028a6060015160028111156126f957fe5b1461270557600061270b565b89608001515b81526020018960a001518152506040518263ffffffff1660e01b8152600401612734919061489e565b60206040518083038186803b15801561274c57600080fd5b505afa92505050801561277c575060408051601f3d908101601f191682019092526127799181019061419c565b60015b61280757612788614a3e565b8061279357506126a1565b6127b581604051806060016040528060288152602001614afc602891396131b9565b81906127d45760405162461bcd60e51b81526004016104f69190614589565b50865160408051608081018252848152818a015160208201526127fb929181016002612660565b90955092506126b69050565b93505b60008660600151600281111561281c57fe5b141561283b5761271086608001516127100185028161283757fe5b0493505b612884848760200151612865896040015160008151811061285857fe5b602002602001015161356f565b60408a0151805161287f9190600019810190811061285857fe5b613613565b9250505b9250925092565b806128995761249d565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612940576000836001600160a01b0316826040516128d79061433d565b60006040518083038185875af1925050503d8060008114612914576040519150601f19603f3d011682016040523d82523d6000602084013e612919565b606091505b505090508061293a5760405162461bcd60e51b81526004016104f690614867565b5061249d565b61249d6001600160a01b038316848361244b565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561299d578034146129985760405162461bcd60e51b81526004016104f6906145d3565b6129bb565b34156129bb5760405162461bcd60e51b81526004016104f69061478b565b5050565b6000806129d86127106129d287876137d2565b9061382b565b905060006129e68683612068565b9050866001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612a93576000896001600160a01b031683604051612a279061433d565b60006040518083038185875af1925050503d8060008114612a64576040519150601f19603f3d011682016040523d82523d6000602084013e612a69565b606091505b5050905080612a8a5760405162461bcd60e51b81526004016104f690614867565b82945050612bf7565b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190612ac2908d90600401614349565b60206040518083038186803b158015612ada57600080fd5b505afa158015612aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b12919061419c565b90506001600160a01b038b163014612b5957612b396001600160a01b0383168c8c86612008565b8315612b5457612b546001600160a01b0383168c3087612008565b612b6d565b612b6d6001600160a01b0383168b8561244b565b612bf381836001600160a01b03166370a082318d6040518263ffffffff1660e01b8152600401612b9d9190614349565b60206040518083038186803b158015612bb557600080fd5b505afa158015612bc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bed919061419c565b90612068565b9450505b612c02858285613892565b5050509695505050505050565b801580612c95575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612c6757600080fd5b505afa158015612c7b573d6000803e3d6000fd5b505050506040513d6020811015612c9157600080fd5b5051155b612cd05760405162461bcd60e51b8152600401808060200182810382526036815260200180614b956036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261249d908490613108565b6000612d2d8261391a565b90508015612d3a57612de2565b506001600160a01b03811660009081526020819052604090205480612de257816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015612d9257600080fd5b505afa158015612da6573d6000803e3d6000fd5b505050506040513d6020811015612dbc57600080fd5b50516001600160a01b038316600090815260208190526040902060ff9091169081905590505b919050565b6000806000612710856080015110612e0757506000915081905080612888565b60008086606001516002811115612e1a57fe5b14612e29578560200151612e44565b61271086608001516127100387602001510281612e4257fe5b045b90508415612f1e578551604080516080810182528381528189015160208201526001600160a01b039092169163e19b609d91810160028a606001516002811115612e8a57fe5b14612e96576000612e9c565b89608001515b81526020018960a001518152506040518263ffffffff1660e01b8152600401612ec5919061489e565b604080518083038186803b158015612edc57600080fd5b505afa158015612ef0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f1491906141d8565b9094509150612fea565b8551604080516080810182528381528189015160208201526001600160a01b03909216916343bea4b391810160028a606001516002811115612f5c57fe5b14612f68576000612f6e565b89608001515b81526020018960a001518152506040518263ffffffff1660e01b8152600401612f97919061489e565b60206040518083038186803b158015612faf57600080fd5b505afa158015612fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe7919061419c565b93505b600186606001516002811115612ffc57fe5b141561301b5761271086608001516127100385028161301757fe5b0493505b612884866020015185612865896040015160008151811061285857fe5b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561307057506001600160a01b03811631612002565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156130bd57600080fd5b505afa1580156130d1573d6000803e3d6000fd5b505050506040513d60208110156130e757600080fd5b50519050612002565b60009081526001919091016020526040902054151590565b600061315d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a329092919063ffffffff16565b80519091501561249d5780806020019051602081101561317c57600080fd5b505161249d5760405162461bcd60e51b815260040180806020018281038252602a815260200180614b6b602a913960400191505060405180910390fd5b6000816040516020016131cc9190614321565b60405160208183030381529060405280519060200120836040516020016131f39190614321565b6040516020818303038152906040528051906020012014905092915050565b60008060006012905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316856020015160008151811061324a57fe5b60200260200101516001600160a01b0316146132ec57846020015160008151811061327157fe5b60200260200101516001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156132b157600080fd5b505afa1580156132c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132e991906141fb565b90505b60038160ff1611156132fd57600219015b60ff8116600a0a92506000805b600a8110156133ec57604080516080810182528681526020898101519082015288820151818301526060808a01519082015290516343bea4b360e01b81526001600160a01b038a16916343bea4b391613366919060040161489e565b60206040518083038186803b15801561337e57600080fd5b505afa9250505080156133ae575060408051601f3d908101601f191682019092526133ab9181019061419c565b60015b6133b7576133db565b80156133d957858189600001518802816133cd57fe5b04965092506133e49050565b505b60028583010494505b60010161330a565b50600085156134a057604080516080810182528681526020898101519082015288820151818301526060808a015190820152905163e19b609d60e01b81526001600160a01b038a169163e19b609d91613448919060040161489e565b604080518083038186803b15801561345f57600080fd5b505afa158015613473573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061349791906141d8565b94509050613546565b604080516080810182528681526020898101519082015288820151818301526060808a01519082015290516343bea4b360e01b81526001600160a01b038a16916343bea4b3916134f3919060040161489e565b60206040518083038186803b15801561350b57600080fd5b505afa15801561351f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613543919061419c565b90505b865160009082111561355c575086518103613563565b5086518190035b50505050935093915050565b600061357a8261391a565b9050801561358757612de2565b506001600160a01b03811660009081526020819052604090205480612de257816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156135df57600080fd5b505afa1580156135f3573d6000803e3d6000fd5b505050506040513d602081101561360957600080fd5b505160ff16612002565b60006b204fce5e3e25026110000000851115613676576040805162461bcd60e51b815260206004820152601360248201527f737263416d6f756e74203e204d41585f51545900000000000000000000000000604482015290519081900360640190fd5b6b204fce5e3e250261100000008411156136d7576040805162461bcd60e51b815260206004820152601460248201527f64657374416d6f756e74203e204d41585f515459000000000000000000000000604482015290519081900360640190fd5b8282106137585760128383031115613736576040805162461bcd60e51b815260206004820152601860248201527f647374202d20737263203e204d41585f444543494d414c530000000000000000604482015290519081900360640190fd5b84838303600a0a02670de0b6b3a764000085028161375057fe5b0490506137ca565b601282840311156137b0576040805162461bcd60e51b815260206004820152601860248201527f737263202d20647374203e204d41585f444543494d414c530000000000000000604482015290519081900360640190fd5b84828403600a0a670de0b6b3a76400008602028161375057fe5b949350505050565b6000826137e157506000612002565b828202828482816137ee57fe5b0414611fff5760405162461bcd60e51b8152600401808060200182810382526021815260200180614b4a6021913960400191505060405180910390fd5b6000808211613881576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161388a57fe5b049392505050565b801561249d576138a3600584611fea565b6138bf5760405162461bcd60e51b81526004016104f690614678565b6001600160a01b038084166000908152600460209081526040808320938616835292905220546138ef9082613a4b565b6001600160a01b03808516600090815260046020908152604080832093871683529290522055505050565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561394957506012612de2565b6001600160a01b03821673dac17f958d2ee523a2206206994597c13d831ec7141561397657506006612de2565b6001600160a01b038216736b175474e89094c44da98b954eedeac495271d0f14156139a357506012612de2565b6001600160a01b03821673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4814156139d057506006612de2565b6001600160a01b038216732260fac5e5542a773aa44fbcfedf7c193bc2c59914156139fd57506008612de2565b6001600160a01b03821673dd974d5c2e2928dea5f71b9825b8b646686bd2001415613a2a57506012612de2565b506000612de2565b6060613a418484600085613aa5565b90505b9392505050565b600082820183811015611fff576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b606082471015613ae65760405162461bcd60e51b8152600401808060200182810382526026815260200180614b246026913960400191505060405180910390fd5b613aef85613c00565b613b40576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310613b7e5780518252601f199092019160209182019101613b5f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613be0576040519150601f19603f3d011682016040523d82523d6000602084013e613be5565b606091505b5091509150613bf5828286613c06565b979650505050505050565b3b151590565b60608315613c15575081613a44565b825115613c255782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613c6f578181015183820152602001613c57565b50505050905090810190601f168015613c9c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b8035612de281614ae3565b60008083601f840112613cc6578182fd5b50813567ffffffffffffffff811115613cdd578182fd5b6020830191508360208083028501011115613cf757600080fd5b9250929050565b600082601f830112613d0e578081fd5b8135602067ffffffffffffffff821115613d2457fe5b808202613d328282016149dc565b838152828101908684018388018501891015613d4c578687fd5b8693505b85841015613d77578035613d6381614ae3565b835260019390930192918401918401613d50565b50979650505050505050565b600082601f830112613d93578081fd5b813567ffffffffffffffff811115613da757fe5b613dba601f8201601f19166020016149dc565b818152846020838601011115613dce578283fd5b816020850160208301379081016020019190915292915050565b803560038110612de257600080fd5b600060c08284031215613e08578081fd5b50919050565b600060c08284031215613e1f578081fd5b613e2960c06149dc565b9050613e3482613caa565b815260208201356020820152604082013567ffffffffffffffff80821115613e5b57600080fd5b613e6785838601613cfe565b6040840152613e7860608501613de8565b60608401526080840135608084015260a0840135915080821115613e9b57600080fd5b50613ea884828501613d83565b60a08301525092915050565b600060208284031215613ec5578081fd5b8135611fff81614ae3565b600060208284031215613ee1578081fd5b8151611fff81614ae3565b60008060408385031215613efe578081fd5b8235613f0981614ae3565b91506020830135613f1981614ae3565b809150509250929050565b60008060008060408587031215613f39578182fd5b843567ffffffffffffffff80821115613f50578384fd5b613f5c88838901613cb5565b90965094506020870135915080821115613f74578384fd5b50613f8187828801613cb5565b95989497509550505050565b60008060208385031215613f9f578182fd5b823567ffffffffffffffff811115613fb5578283fd5b613fc185828601613cb5565b90969095509350505050565b600080600080600060608688031215613fe4578283fd5b853567ffffffffffffffff80821115613ffb578485fd5b61400789838a01613cb5565b9097509550602088013591508082111561401f578485fd5b5061402c88828901613cb5565b90945092505060408601358015158114614044578182fd5b809150509295509295909350565b600080600060608486031215614066578081fd5b833561407181614ae3565b925060208401359150604084013561408881614ae3565b809150509250925092565b6000602082840312156140a4578081fd5b611fff82613de8565b6000602082840312156140be578081fd5b813567ffffffffffffffff8111156140d4578182fd5b6137ca84828501613df7565b6000602082840312156140f1578081fd5b813567ffffffffffffffff811115614107578182fd5b82016101208185031215611fff578182fd5b60006020828403121561412a578081fd5b813567ffffffffffffffff811115614140578182fd5b82016101408185031215611fff578182fd5b600060208284031215614163578081fd5b813567ffffffffffffffff811115614179578182fd5b82016101008185031215611fff578182fd5b600060808284031215613e08578081fd5b6000602082840312156141ad578081fd5b5051919050565b600080604083850312156141c6578182fd5b823591506020830135613f1981614ae3565b600080604083850312156141ea578182fd5b505080516020909101519092909150565b60006020828403121561420c578081fd5b815160ff81168114611fff578182fd5b60008284526020808501945082825b8581101561425957813561423e81614ae3565b6001600160a01b03168752958201959082019060010161422b565b509495945050505050565b6000815180845260208085019450808401835b838110156142595781516001600160a01b031687529582019590820190600101614277565b600081518084526142b4816020860160208601614a0c565b601f01601f19169290920160200192915050565b600381106142d257fe5b9052565b6000815183526020820151608060208501526142f56080850182614264565b90506040830151604085015260608301518482036060860152614318828261429c565b95945050505050565b60008251614333818460208701614a0c565b9190910192915050565b90565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152613bf560a083018461429c565b6001600160a01b0392831681529116602082015260400190565b60006060825261441060608301878961421c565b828103602084015261442381868861421c565b9150506001600160a01b03831660408301529695505050505050565b600060c0825261445360c08301898b61421c565b905086602083015285604083015261446e60608301866142c8565b8360808301526001600160a01b03831660a083015298975050505050505050565b600060e082526144a360e083018a8c61421c565b90508760208301528660408301528560608301526144c460808301866142c8565b8360a08301526001600160a01b03831660c08301529998505050505050505050565b6000606082526144f96060830187614264565b828103602084015261450c81868861421c565b9150506001600160a01b038316604083015295945050505050565b60006060825261453b60608301878961421c565b828103602084015261454e81868861421c565b91505082151560408301529695505050505050565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b600060208252611fff602083018461429c565b60208082526013908201527f756e737570706f72746564206c656e64696e6700000000000000000000000000604082015260600190565b6020808252600f908201527f77726f6e67206d73672076616c75650000000000000000000000000000000000604082015260600190565b60208082526010908201527f756e737570706f72746564207377617000000000000000000000000000000000604082015260600190565b60208082526011908201527f756e737570706f7274656420746f6b656e000000000000000000000000000000604082015260600190565b60208082526014908201527f756e737570706f7274656420706c6174666f726d000000000000000000000000604082015260600190565b6020808252600f908201527f6c6f77207061696420616d6f756e740000000000000000000000000000000000604082015260600190565b60208082526018908201527f72657475726e20616d6f756e74206e6f7420656e6f7567680000000000000000604082015260600190565b60208082526011908201527f6869676820706c6174666f726d20666565000000000000000000000000000000604082015260600190565b6020808252600a908201527f6c6f772072657475726e00000000000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f626164206d73672076616c756500000000000000000000000000000000000000604082015260600190565b6020808252601b908201527f726571756972652061646d696e2066656520636f6c6c6563746f720000000000604082015260600190565b60208082526013908201527f6c6f772072657475726e656420616d6f756e7400000000000000000000000000604082015260600190565b60208082526011908201527f696e76616c696420747261646550617468000000000000000000000000000000604082015260600190565b6020808252600f908201527f7472616e73666572206661696c65640000000000000000000000000000000000604082015260600190565b600060208252611fff60208301846142d6565b6000602082528251602083015260208301516040830152604083015160e060608401526148e2610100840182614264565b905060608401516001600160a01b038082166080860152608086015160a08601528060a08701511660c0860152505060c0840151601f198483030160e0850152614318828261429c565b918252602082015260400190565b9283526020830191909152604082015260600190565b6000808335601e19843603018112614966578283fd5b83018035915067ffffffffffffffff821115614980578283fd5b6020908101925081023603821315613cf757600080fd5b6000808335601e198436030181126149ad578283fd5b83018035915067ffffffffffffffff8211156149c7578283fd5b602001915036819003821315613cf757600080fd5b60405181810167ffffffffffffffff811182821017156149f857fe5b604052919050565b60006120023683613e0e565b60005b83811015614a27578181015183820152602001614a0f565b838111156120625750506000910152565b60e01c90565b600060443d1015614a4e5761433d565b600481823e6308c379a0614a628251614a38565b14614a6c5761433d565b6040513d600319016004823e80513d67ffffffffffffffff8160248401118184111715614a9c575050505061433d565b82840192508251915080821115614ab6575050505061433d565b503d83016020828401011115614ace5750505061433d565b601f01601f1916810160200160405291505090565b6001600160a01b0381168114614af857600080fd5b5056fe676574457870656374656452657475726e57697468496d706163745f6e6f74537570706f72746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a164736f6c6343000706000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000320849ec0adffcd6fb0212b59a2ec936cdef5fca
-----Decoded View---------------
Arg [0] : _admin (address): 0x320849EC0aDffCd6fb0212B59a2EC936cdEF5fCa
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000320849ec0adffcd6fb0212b59a2ec936cdef5fca
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.