ETH Price: $2,234.65 (-1.77%)
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ConnectV2AaveV3ImportOptimism

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
/**
 * @title Aave v3 import connector .
 * @dev  Import EOA's aave V3 position to DSA's aave v3 position
 */
import { TokenInterface, AccountInterface } from "../../../common/interfaces.sol";
import { AaveInterface, ATokenInterface } from "./interface.sol";
import "./helpers.sol";
import "./events.sol";

contract AaveV3ImportResolver is AaveHelpers {
	function _importAave(address userAccount, ImportInputData memory inputData)
		internal
		returns (string memory _eventName, bytes memory _eventParam)
	{
		require(
			AccountInterface(address(this)).isAuth(userAccount),
			"user-account-not-auth"
		);

		require(inputData.supplyTokens.length > 0, "0-length-not-allowed");

		ImportData memory data;

		AaveInterface aave = AaveInterface(aaveProvider.getPool());

		data = getBorrowAmounts(userAccount, aave, inputData, data);
		data = getSupplyAmounts(userAccount, inputData, data);

		//  payback borrowed amount;
		_PaybackStable(
			data._borrowTokens.length,
			aave,
			data._borrowTokens,
			data.stableBorrowAmts,
			userAccount
		);
		_PaybackVariable(
			data._borrowTokens.length,
			aave,
			data._borrowTokens,
			data.variableBorrowAmts,
			userAccount
		);

		//  transfer atokens to this address;
		_TransferAtokens(
			data._supplyTokens.length,
			aave,
			data.aTokens,
			data.supplyAmts,
			data._supplyTokens,
			userAccount
		);

		// borrow assets after migrating position
		if (data.convertStable) {
			_BorrowVariable(
				data._borrowTokens.length,
				aave,
				data._borrowTokens,
				data.totalBorrowAmtsWithFee
			);
		} else {
			_BorrowStable(
				data._borrowTokens.length,
				aave,
				data._borrowTokens,
				data.stableBorrowAmtsWithFee
			);
			_BorrowVariable(
				data._borrowTokens.length,
				aave,
				data._borrowTokens,
				data.variableBorrowAmtsWithFee
			);
		}

		_eventName = "LogAaveV3Import(address,bool,address[],address[],uint256[],uint256[],uint256[],uint256[])";
		_eventParam = abi.encode(
			userAccount,
			inputData.convertStable,
			inputData.supplyTokens,
			inputData.borrowTokens,
			inputData.flashLoanFees,
			data.supplyAmts,
			data.stableBorrowAmts,
			data.variableBorrowAmts
		);
	}

	function _importAaveWithCollateral(address userAccount, ImportInputData memory inputData, bool[] memory enableCollateral)
		internal
		returns (string memory _eventName, bytes memory _eventParam)
	{
		require(
			AccountInterface(address(this)).isAuth(userAccount),
			"user-account-not-auth"
		);

		require(inputData.supplyTokens.length > 0, "0-length-not-allowed");
		require(enableCollateral.length == inputData.supplyTokens.length, "lengths-not-same");
		
		ImportData memory data;

		AaveInterface aave = AaveInterface(aaveProvider.getPool());

		data = getBorrowAmounts(userAccount, aave, inputData, data);
		data = getSupplyAmounts(userAccount, inputData, data);

		//  payback borrowed amount;
		_PaybackStable(
			data._borrowTokens.length,
			aave,
			data._borrowTokens,
			data.stableBorrowAmts,
			userAccount
		);
		_PaybackVariable(
			data._borrowTokens.length,
			aave,
			data._borrowTokens,
			data.variableBorrowAmts,
			userAccount
		);

		//  transfer atokens to this address;
		_TransferAtokensWithCollateral(
			data._supplyTokens.length,
			aave,
			data.aTokens,
			data.supplyAmts,
			data._supplyTokens,
			enableCollateral,
			userAccount
		);

		// borrow assets after migrating position
		if (data.convertStable) {
			_BorrowVariable(
				data._borrowTokens.length,
				aave,
				data._borrowTokens,
				data.totalBorrowAmtsWithFee
			);
		} else {
			_BorrowStable(
				data._borrowTokens.length,
				aave,
				data._borrowTokens,
				data.stableBorrowAmtsWithFee
			);
			_BorrowVariable(
				data._borrowTokens.length,
				aave,
				data._borrowTokens,
				data.variableBorrowAmtsWithFee
			);
		}

		_eventName = "LogAaveV3ImportWithCollateral(address,bool,address[],address[],uint256[],uint256[],uint256[],uint256[],bool[])";
		_eventParam = abi.encode(
			userAccount,
			inputData.convertStable,
			inputData.supplyTokens,
			inputData.borrowTokens,
			inputData.flashLoanFees,
			data.supplyAmts,
			data.stableBorrowAmts,
			data.variableBorrowAmts,
			enableCollateral
		);
	}

	/**
	 * @dev Import aave V3 position .
	 * @notice Import EOA's aave V3 position to DSA's aave v3 position
	 * @param userAccount The address of the EOA from which aave position will be imported
	 * @param inputData The struct containing all the neccessary input data
	 */
	function importAave(address userAccount, ImportInputData memory inputData)
		external
		payable
		returns (string memory _eventName, bytes memory _eventParam)
	{
		(_eventName, _eventParam) = _importAave(userAccount, inputData);
	}

	/**
	 * @dev Import aave V3 position (with collateral).
	 * @notice Import EOA's aave V3 position to DSA's aave v3 position
	 * @param userAccount The address of the EOA from which aave position will be imported
	 * @param inputData The struct containing all the neccessary input data
	 * @param enableCollateral The boolean array to enable selected collaterals in the imported position
	 */
	function importAaveWithCollateral(address userAccount, ImportInputData memory inputData, bool[] memory enableCollateral)
		external
		payable
		returns (string memory _eventName, bytes memory _eventParam)
	{
		(_eventName, _eventParam) = _importAaveWithCollateral(userAccount, inputData, enableCollateral);
	}
}

contract ConnectV2AaveV3ImportOptimism is AaveV3ImportResolver {
	string public constant name = "Aave-v3-import-v1.1";
}

//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

interface TokenInterface {
    function approve(address, uint256) external;
    function transfer(address, uint) external;
    function transferFrom(address, address, uint) external;
    function deposit() external payable;
    function withdraw(uint) external;
    function balanceOf(address) external view returns (uint);
    function decimals() external view returns (uint);
    function totalSupply() external view returns (uint);
}

interface MemoryInterface {
    function getUint(uint id) external returns (uint num);
    function setUint(uint id, uint val) external;
}


interface AccountInterface {
    function enable(address) external;
    function disable(address) external;
    function isAuth(address) external view returns (bool);
}

//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

interface AaveInterface {
	function supply(
		address asset,
		uint256 amount,
		address onBehalfOf,
		uint16 referralCode
	) external;

	function withdraw(
		address _asset,
		uint256 _amount,
		address _to
	) external;

	function borrow(
		address _asset,
		uint256 _amount,
		uint256 _interestRateMode,
		uint16 _referralCode,
		address _onBehalfOf
	) external;

	function repay(
		address _asset,
		uint256 _amount,
		uint256 _rateMode,
		address _onBehalfOf
	) external;

	function setUserUseReserveAsCollateral(
		address _asset,
		bool _useAsCollateral
	) external;

	function swapBorrowRateMode(address _asset, uint256 _rateMode) external;
}

interface ATokenInterface {
	function scaledBalanceOf(address _user) external view returns (uint256);

	function isTransferAllowed(address _user, uint256 _amount)
		external
		view
		returns (bool);

	function balanceOf(address _user) external view returns (uint256);

	function transferFrom(
		address,
		address,
		uint256
	) external returns (bool);

	function allowance(address, address) external returns (uint256);
}

interface AavePoolProviderInterface {
	function getPool() external view returns (address);
}

interface AaveDataProviderInterface {
	function getReserveTokensAddresses(address _asset)
		external
		view
		returns (
			address aTokenAddress,
			address stableDebtTokenAddress,
			address variableDebtTokenAddress
		);

	function getUserReserveData(address _asset, address _user)
		external
		view
		returns (
			uint256 currentATokenBalance,
			uint256 currentStableDebt,
			uint256 currentVariableDebt,
			uint256 principalStableDebt,
			uint256 scaledVariableDebt,
			uint256 stableBorrowRate,
			uint256 liquidityRate,
			uint40 stableRateLastUpdated,
			bool usageAsCollateralEnabled
		);
}

interface AaveAddressProviderRegistryInterface {
	function getAddressesProvidersList()
		external
		view
		returns (address[] memory);
}

//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

import { DSMath } from "../../../common/math.sol";
import { Basic } from "../../../common/basic.sol";
import { TokenInterface, AccountInterface } from "../../../common/interfaces.sol";
import { AaveInterface, AavePoolProviderInterface, AaveDataProviderInterface } from "./interface.sol";
import "./events.sol";
import "./interface.sol";

abstract contract Helper is DSMath, Basic {
	/**
	 * @dev Aave referal code
	 */
	uint16 internal constant referalCode = 3228;

	/**
	 * @dev Aave Lending Pool Provider
	 */
	AavePoolProviderInterface internal constant aaveProvider =
		AavePoolProviderInterface(0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb);

	/**
	 * @dev Aave Protocol Data Provider
	 */
	AaveDataProviderInterface internal constant aaveData =
		AaveDataProviderInterface(0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654);

	function getIsColl(address token, address user)
		internal
		view
		returns (bool isCol)
	{
		(, , , , , , , , isCol) = aaveData.getUserReserveData(token, user);
	}

	struct ImportData {
		address[] _supplyTokens;
		address[] _borrowTokens;
		ATokenInterface[] aTokens;
		uint256[] supplyAmts;
		uint256[] variableBorrowAmts;
		uint256[] variableBorrowAmtsWithFee;
		uint256[] stableBorrowAmts;
		uint256[] stableBorrowAmtsWithFee;
		uint256[] totalBorrowAmts;
		uint256[] totalBorrowAmtsWithFee;
		bool convertStable;
	}

	struct ImportInputData {
		address[] supplyTokens;
		address[] borrowTokens;
		bool convertStable;
		uint256[] flashLoanFees;
	}
}

contract AaveHelpers is Helper {
	function getBorrowAmount(address _token, address userAccount)
		internal
		view
		returns (uint256 stableBorrow, uint256 variableBorrow)
	{
		(
			,
			address stableDebtTokenAddress,
			address variableDebtTokenAddress
		) = aaveData.getReserveTokensAddresses(_token);

		stableBorrow = ATokenInterface(stableDebtTokenAddress).balanceOf(
			userAccount
		);
		variableBorrow = ATokenInterface(variableDebtTokenAddress).balanceOf(
			userAccount
		);
	}

	function getBorrowAmounts(
		address userAccount,
		AaveInterface aave,
		ImportInputData memory inputData,
		ImportData memory data
	) internal returns (ImportData memory) {
		if (inputData.borrowTokens.length > 0) {
			data._borrowTokens = new address[](inputData.borrowTokens.length);
			data.variableBorrowAmts = new uint256[](
				inputData.borrowTokens.length
			);
			data.variableBorrowAmtsWithFee = new uint256[](
				inputData.borrowTokens.length
			);
			data.stableBorrowAmts = new uint256[](
				inputData.borrowTokens.length
			);
			data.stableBorrowAmtsWithFee = new uint256[](
				inputData.borrowTokens.length
			);
			data.totalBorrowAmts = new uint256[](inputData.borrowTokens.length);
			data.totalBorrowAmtsWithFee = new uint256[](
				inputData.borrowTokens.length
			);
			for (uint256 i = 0; i < inputData.borrowTokens.length; i++) {
				for (uint256 j = i; j < inputData.borrowTokens.length; j++) {
					if (j != i) {
						require(
							inputData.borrowTokens[i] !=
								inputData.borrowTokens[j],
							"token-repeated"
						);
					}
				}
			}
			for (uint256 i = 0; i < inputData.borrowTokens.length; i++) {
				address _token = inputData.borrowTokens[i] == ethAddr
					? wethAddr
					: inputData.borrowTokens[i];
				data._borrowTokens[i] = _token;

				(
					data.stableBorrowAmts[i],
					data.variableBorrowAmts[i]
				) = getBorrowAmount(_token, userAccount);

				if (data.variableBorrowAmts[i] != 0) {
					data.variableBorrowAmtsWithFee[i] = add(
						data.variableBorrowAmts[i],
						inputData.flashLoanFees[i]
					);
					data.stableBorrowAmtsWithFee[i] = data.stableBorrowAmts[i];
				} else {
					data.stableBorrowAmtsWithFee[i] = add(
						data.stableBorrowAmts[i],
						inputData.flashLoanFees[i]
					);
				}

				data.totalBorrowAmts[i] = add(
					data.stableBorrowAmts[i],
					data.variableBorrowAmts[i]
				);
				data.totalBorrowAmtsWithFee[i] = add(
					data.stableBorrowAmtsWithFee[i],
					data.variableBorrowAmtsWithFee[i]
				);

				if (data.totalBorrowAmts[i] > 0) {
					uint256 _amt = data.totalBorrowAmts[i];
					TokenInterface(_token).approve(address(aave), _amt);
				}
			}
		}
		return data;
	}

	function getSupplyAmounts(
		address userAccount,
		ImportInputData memory inputData,
		ImportData memory data
	) internal view returns (ImportData memory) {
		data.supplyAmts = new uint256[](inputData.supplyTokens.length);
		data._supplyTokens = new address[](inputData.supplyTokens.length);
		data.aTokens = new ATokenInterface[](inputData.supplyTokens.length);

		for (uint256 i = 0; i < inputData.supplyTokens.length; i++) {
			for (uint256 j = i; j < inputData.supplyTokens.length; j++) {
				if (j != i) {
					require(
						inputData.supplyTokens[i] != inputData.supplyTokens[j],
						"token-repeated"
					);
				}
			}
		}
		for (uint256 i = 0; i < inputData.supplyTokens.length; i++) {
			address _token = inputData.supplyTokens[i] == ethAddr
				? wethAddr
				: inputData.supplyTokens[i];
			(address _aToken, , ) = aaveData.getReserveTokensAddresses(_token);
			data._supplyTokens[i] = _token;
			data.aTokens[i] = ATokenInterface(_aToken);
			data.supplyAmts[i] = data.aTokens[i].balanceOf(userAccount);
		}

		return data;
	}

	function _paybackBehalfOne(
		AaveInterface aave,
		address token,
		uint256 amt,
		uint256 rateMode,
		address user
	) private {
		aave.repay(token, amt, rateMode, user);
	}

	function _PaybackStable(
		uint256 _length,
		AaveInterface aave,
		address[] memory tokens,
		uint256[] memory amts,
		address user
	) internal {
		for (uint256 i = 0; i < _length; i++) {
			if (amts[i] > 0) {
				_paybackBehalfOne(aave, tokens[i], amts[i], 1, user);
			}
		}
	}

	function _PaybackVariable(
		uint256 _length,
		AaveInterface aave,
		address[] memory tokens,
		uint256[] memory amts,
		address user
	) internal {
		for (uint256 i = 0; i < _length; i++) {
			if (amts[i] > 0) {
				_paybackBehalfOne(aave, tokens[i], amts[i], 2, user);
			}
		}
	}

	function _TransferAtokens(
		uint256 _length,
		AaveInterface aave,
		ATokenInterface[] memory atokenContracts,
		uint256[] memory amts,
		address[] memory tokens,
		address userAccount
	) internal {
		for (uint256 i = 0; i < _length; i++) {
			if (amts[i] > 0) {
				uint256 _amt = amts[i];
				require(
					atokenContracts[i].transferFrom(
						userAccount,
						address(this),
						_amt
					),
					"allowance?"
				);

				if (!getIsColl(tokens[i], address(this))) {
					aave.setUserUseReserveAsCollateral(tokens[i], true);
				}
			}
		}
	}

	function _TransferAtokensWithCollateral(
		uint256 _length,
		AaveInterface aave,
		ATokenInterface[] memory atokenContracts,
		uint256[] memory amts,
		address[] memory tokens,
		bool[] memory colEnable,
		address userAccount
	) internal {
		for (uint256 i = 0; i < _length; i++) {
			if (amts[i] > 0) {
				uint256 _amt = amts[i];
				require(
					atokenContracts[i].transferFrom(
						userAccount,
						address(this),
						_amt
					),
					"allowance?"
				);

				if (!getIsColl(tokens[i], address(this))) {
					aave.setUserUseReserveAsCollateral(tokens[i], colEnable[i]);
				}
			}
		}
	}

	function _BorrowVariable(
		uint256 _length,
		AaveInterface aave,
		address[] memory tokens,
		uint256[] memory amts
	) internal {
		for (uint256 i = 0; i < _length; i++) {
			if (amts[i] > 0) {
				_borrowOne(aave, tokens[i], amts[i], 2);
			}
		}
	}

	function _BorrowStable(
		uint256 _length,
		AaveInterface aave,
		address[] memory tokens,
		uint256[] memory amts
	) internal {
		for (uint256 i = 0; i < _length; i++) {
			if (amts[i] > 0) {
				_borrowOne(aave, tokens[i], amts[i], 1);
			}
		}
	}

	function _borrowOne(
		AaveInterface aave,
		address token,
		uint256 amt,
		uint256 rateMode
	) private {
		aave.borrow(token, amt, rateMode, referalCode, address(this));
	}
}

File 5 of 9 : events.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;

contract Events {
	event LogAaveV3Import(
		address indexed user,
		address[] ctokens,
		string[] supplyIds,
		string[] borrowIds,
		uint256[] flashLoanFees,
		uint256[] supplyAmts,
		uint256[] borrowAmts
	);
	event LogAaveV3ImportWithCollateral(
		address indexed user,
		address[] ctokens,
		string[] supplyIds,
		string[] borrowIds,
		uint256[] flashLoanFees,
		uint256[] supplyAmts,
		uint256[] borrowAmts,
		bool[] enableCollateral
	);
}

//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";

contract DSMath {
  uint constant WAD = 10 ** 18;
  uint constant RAY = 10 ** 27;

  function add(uint x, uint y) internal pure returns (uint z) {
    z = SafeMath.add(x, y);
  }

  function sub(uint x, uint y) internal virtual pure returns (uint z) {
    z = SafeMath.sub(x, y);
  }

  function mul(uint x, uint y) internal pure returns (uint z) {
    z = SafeMath.mul(x, y);
  }

  function div(uint x, uint y) internal pure returns (uint z) {
    z = SafeMath.div(x, y);
  }

  function wmul(uint x, uint y) internal pure returns (uint z) {
    z = SafeMath.add(SafeMath.mul(x, y), WAD / 2) / WAD;
  }

  function wdiv(uint x, uint y) internal pure returns (uint z) {
    z = SafeMath.add(SafeMath.mul(x, WAD), y / 2) / y;
  }

  function rdiv(uint x, uint y) internal pure returns (uint z) {
    z = SafeMath.add(SafeMath.mul(x, RAY), y / 2) / y;
  }

  function rmul(uint x, uint y) internal pure returns (uint z) {
    z = SafeMath.add(SafeMath.mul(x, y), RAY / 2) / RAY;
  }

  function toInt(uint x) internal pure returns (int y) {
    y = int(x);
    require(y >= 0, "int-overflow");
  }

  function toRad(uint wad) internal pure returns (uint rad) {
    rad = mul(wad, 10 ** 27);
  }
}

//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

import { TokenInterface } from "./interfaces.sol";
import { Stores } from "./stores.sol";
import { DSMath } from "./math.sol";

abstract contract Basic is DSMath, Stores {

    function convert18ToDec(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
        amt = (_amt / 10 ** (18 - _dec));
    }

    function convertTo18(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
        amt = mul(_amt, 10 ** (18 - _dec));
    }

    function getTokenBal(TokenInterface token) internal view returns(uint _amt) {
        _amt = address(token) == ethAddr ? address(this).balance : token.balanceOf(address(this));
    }

    function getTokensDec(TokenInterface buyAddr, TokenInterface sellAddr) internal view returns(uint buyDec, uint sellDec) {
        buyDec = address(buyAddr) == ethAddr ?  18 : buyAddr.decimals();
        sellDec = address(sellAddr) == ethAddr ?  18 : sellAddr.decimals();
    }

    function encodeEvent(string memory eventName, bytes memory eventParam) internal pure returns (bytes memory) {
        return abi.encode(eventName, eventParam);
    }

    function approve(TokenInterface token, address spender, uint256 amount) internal {
        try token.approve(spender, amount) {

        } catch {
            token.approve(spender, 0);
            token.approve(spender, amount);
        }
    }

    function changeEthAddress(address buy, address sell) internal pure returns(TokenInterface _buy, TokenInterface _sell){
        _buy = buy == ethAddr ? TokenInterface(wethAddr) : TokenInterface(buy);
        _sell = sell == ethAddr ? TokenInterface(wethAddr) : TokenInterface(sell);
    }

    function changeEthAddrToWethAddr(address token) internal pure returns(address tokenAddr){
        tokenAddr = token == ethAddr ? wethAddr : token;
    }

    function convertEthToWeth(bool isEth, TokenInterface token, uint amount) internal {
        if(isEth) token.deposit{value: amount}();
    }

    function convertWethToEth(bool isEth, TokenInterface token, uint amount) internal {
       if(isEth) {
            approve(token, address(token), amount);
            token.withdraw(amount);
        }
    }
}

// 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.7.0;

import { MemoryInterface } from "./interfaces.sol";

abstract contract Stores {

  /**
   * @dev Return ethereum address
   */
  address constant internal ethAddr = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

  /**
   * @dev Return Wrapped ETH address
   */
  address constant internal wethAddr = 0x4200000000000000000000000000000000000006;

  /**
   * @dev Return memory variable address
   */
  MemoryInterface constant internal instaMemory = MemoryInterface(0x3254Ce8f5b1c82431B8f21Df01918342215825C2);

  /**
   * @dev Get Uint value from InstaMemory Contract.
   */
  function getUint(uint getId, uint val) internal returns (uint returnVal) {
    returnVal = getId == 0 ? val : instaMemory.getUint(getId);
  }

  /**
  * @dev Set Uint value in InstaMemory Contract.
  */
  function setUint(uint setId, uint val) virtual internal {
    if (setId != 0) instaMemory.setUint(setId, val);
  }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"userAccount","type":"address"},{"components":[{"internalType":"address[]","name":"supplyTokens","type":"address[]"},{"internalType":"address[]","name":"borrowTokens","type":"address[]"},{"internalType":"bool","name":"convertStable","type":"bool"},{"internalType":"uint256[]","name":"flashLoanFees","type":"uint256[]"}],"internalType":"struct Helper.ImportInputData","name":"inputData","type":"tuple"}],"name":"importAave","outputs":[{"internalType":"string","name":"_eventName","type":"string"},{"internalType":"bytes","name":"_eventParam","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"userAccount","type":"address"},{"components":[{"internalType":"address[]","name":"supplyTokens","type":"address[]"},{"internalType":"address[]","name":"borrowTokens","type":"address[]"},{"internalType":"bool","name":"convertStable","type":"bool"},{"internalType":"uint256[]","name":"flashLoanFees","type":"uint256[]"}],"internalType":"struct Helper.ImportInputData","name":"inputData","type":"tuple"},{"internalType":"bool[]","name":"enableCollateral","type":"bool[]"}],"name":"importAaveWithCollateral","outputs":[{"internalType":"string","name":"_eventName","type":"string"},{"internalType":"bytes","name":"_eventParam","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5061206d806100206000396000f3fe6080604052600436106100345760003560e01c806306fdde0314610039578063ad9435e814610064578063e69193f514610085575b600080fd5b34801561004557600080fd5b5061004e610098565b60405161005b9190611e42565b60405180910390f35b610077610072366004611b09565b6100c7565b60405161005b929190611e55565b610077610093366004611abc565b6100e1565b60405180604001604052806013815260200172416176652d76332d696d706f72742d76312e3160681b81525081565b6060806100d58585856100f9565b90969095509350505050565b6060806100ee848461039b565b909590945092505050565b604051632520e7ff60e01b815260609081903090632520e7ff90610121908890600401611cb4565b60206040518083038186803b15801561013957600080fd5b505afa15801561014d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101719190611bdb565b6101965760405162461bcd60e51b815260040161018d90611eb1565b60405180910390fd5b8351516101b55760405162461bcd60e51b815260040161018d90611e83565b8351518351146101d75760405162461bcd60e51b815260040161018d90611ee0565b6101df6118c0565b600073a97684ead0e402dc232d5a977953df7ecbab3cdb6001600160a01b031663026b1d5f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561022e57600080fd5b505afa158015610242573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102669190611aa0565b90506102748782888561060e565b9150610281878784610c10565b915061029d8260200151518284602001518560c001518b610fc5565b6020820151805160808401516102b59284918b611030565b81518051604084015160608501516102d293859291908a8d611093565b816101400151156102fa57602082015180516101208401516102f5928491611284565b610328565b6020820151805160e08401516103119284916112ed565b6020820151805160a0840151610328928491611284565b6040518060a00160405280606e8152602001611fca606e9139935086866040015187600001518860200151896060015186606001518760c0015188608001518c60405160200161038099989796959493929190611d68565b60405160208183030381529060405292505050935093915050565b604051632520e7ff60e01b815260609081903090632520e7ff906103c3908790600401611cb4565b60206040518083038186803b1580156103db57600080fd5b505afa1580156103ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104139190611bdb565b61042f5760405162461bcd60e51b815260040161018d90611eb1565b82515161044e5760405162461bcd60e51b815260040161018d90611e83565b6104566118c0565b600073a97684ead0e402dc232d5a977953df7ecbab3cdb6001600160a01b031663026b1d5f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104a557600080fd5b505afa1580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd9190611aa0565b90506104eb8682878561060e565b91506104f8868684610c10565b91506105148260200151518284602001518560c001518a610fc5565b60208201518051608084015161052c9284918a611030565b815180516040840151606085015161054893859291908b61134f565b81610140015115610570576020820151805161012084015161056b928491611284565b61059e565b6020820151805160e08401516105879284916112ed565b6020820151805160a084015161059e928491611284565b604051806080016040528060598152602001611f7160599139935085856040015186600001518760200151886060015186606001518760c0015188608001516040516020016105f4989796959493929190611cc8565b604051602081830303815290604052925050509250929050565b6106166118c0565b60208301515115610c08578260200151516001600160401b038111801561063c57600080fd5b50604051908082528060200260200182016040528015610666578160200160208202803683370190505b5082602001819052508260200151516001600160401b038111801561068a57600080fd5b506040519080825280602002602001820160405280156106b4578160200160208202803683370190505b5060808301526020830151516001600160401b03811180156106d557600080fd5b506040519080825280602002602001820160405280156106ff578160200160208202803683370190505b5060a08301526020830151516001600160401b038111801561072057600080fd5b5060405190808252806020026020018201604052801561074a578160200160208202803683370190505b5060c08301526020830151516001600160401b038111801561076b57600080fd5b50604051908082528060200260200182016040528015610795578160200160208202803683370190505b5060e08301526020830151516001600160401b03811180156107b657600080fd5b506040519080825280602002602001820160405280156107e0578160200160208202803683370190505b506101008301526020830151516001600160401b038111801561080257600080fd5b5060405190808252806020026020018201604052801561082c578160200160208202803683370190505b5061012083015260005b8360200151518110156108f057805b8460200151518110156108e7578181146108df578460200151818151811061086957fe5b60200260200101516001600160a01b03168560200151838151811061088a57fe5b60200260200101516001600160a01b031614156108df576040805162461bcd60e51b815260206004820152600e60248201526d1d1bdad95b8b5c995c19585d195960921b604482015290519081900360640190fd5b600101610845565b50600101610836565b5060005b836020015151811015610c0657600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b03168560200151838151811061093157fe5b60200260200101516001600160a01b031614610964578460200151828151811061095757fe5b602002602001015161096d565b6006602160991b015b9050808460200151838151811061098057fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506109aa818861151f565b8560c0015184815181106109ba57fe5b60200260200101866080015185815181106109d157fe5b6020026020010182815250828152505050836080015182815181106109f257fe5b6020026020010151600014610a8e57610a3984608001518381518110610a1457fe5b602002602001015186606001518481518110610a2c57fe5b60200260200101516116b9565b8460a001518381518110610a4957fe5b6020026020010181815250508360c001518281518110610a6557fe5b60200260200101518460e001518381518110610a7d57fe5b602002602001018181525050610abe565b610aa18460c001518381518110610a1457fe5b8460e001518381518110610ab157fe5b6020026020010181815250505b610ae98460c001518381518110610ad157fe5b602002602001015185608001518481518110610a2c57fe5b8461010001518381518110610afa57fe5b602002602001018181525050610b318460e001518381518110610b1957fe5b60200260200101518560a001518481518110610a2c57fe5b8461012001518381518110610b4257fe5b60200260200101818152505060008461010001518381518110610b6157fe5b60200260200101511115610bfd5760008461010001518381518110610b8257fe5b60200260200101519050816001600160a01b031663095ea7b388836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610be357600080fd5b505af1158015610bf7573d6000803e3d6000fd5b50505050505b506001016108f4565b505b509392505050565b610c186118c0565b8251516001600160401b0381118015610c3057600080fd5b50604051908082528060200260200182016040528015610c5a578160200160208202803683370190505b5060608301528251516001600160401b0381118015610c7857600080fd5b50604051908082528060200260200182016040528015610ca2578160200160208202803683370190505b5082528251516001600160401b0381118015610cbd57600080fd5b50604051908082528060200260200182016040528015610ce7578160200160208202803683370190505b50604083015260005b835151811015610da257805b845151811015610d9957818114610d91578451805182908110610d1b57fe5b60200260200101516001600160a01b031685600001518381518110610d3c57fe5b60200260200101516001600160a01b03161415610d91576040805162461bcd60e51b815260206004820152600e60248201526d1d1bdad95b8b5c995c19585d195960921b604482015290519081900360640190fd5b600101610cfc565b50600101610cf0565b5060005b835151811015610fbc578351805160009173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee9184908110610dd757fe5b60200260200101516001600160a01b031614610e08578451805183908110610dfb57fe5b6020026020010151610e11565b6006602160991b015b905060007369fa688f1dc47d4b5d8029d5a35fb7a5483106546001600160a01b031663d2493b6c836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060606040518083038186803b158015610e7657600080fd5b505afa158015610e8a573d6000803e3d6000fd5b505050506040513d6060811015610ea057600080fd5b505185518051919250839185908110610eb557fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508085604001518481518110610ee657fe5b60200260200101906001600160a01b031690816001600160a01b03168152505084604001518381518110610f1657fe5b60200260200101516001600160a01b03166370a08231886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610f6a57600080fd5b505afa158015610f7e573d6000803e3d6000fd5b505050506040513d6020811015610f9457600080fd5b50516060860151805185908110610fa757fe5b60209081029190910101525050600101610da6565b50909392505050565b60005b85811015611028576000838281518110610fde57fe5b602002602001015111156110205761102085858381518110610ffc57fe5b602002602001015185848151811061101057fe5b60200260200101516001866116cc565b600101610fc8565b505050505050565b60005b8581101561102857600083828151811061104957fe5b6020026020010151111561108b5761108b8585838151811061106757fe5b602002602001015185848151811061107b57fe5b60200260200101516002866116cc565b600101611033565b60005b8781101561127a5760008582815181106110ac57fe5b602002602001015111156112725760008582815181106110c857fe5b602002602001015190508682815181106110de57fe5b60200260200101516001600160a01b03166323b872dd8430846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050602060405180830381600087803b15801561114d57600080fd5b505af1158015611161573d6000803e3d6000fd5b505050506040513d602081101561117757600080fd5b50516111b7576040805162461bcd60e51b815260206004820152600a602482015269616c6c6f77616e63653f60b01b604482015290519081900360640190fd5b6111d48583815181106111c657fe5b60200260200101513061174c565b61127057876001600160a01b0316635a3b74b98684815181106111f357fe5b602002602001015186858151811061120757fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03168152602001821515815260200192505050600060405180830381600087803b15801561125757600080fd5b505af115801561126b573d6000803e3d6000fd5b505050505b505b600101611096565b5050505050505050565b60005b848110156112e657600082828151811061129d57fe5b602002602001015111156112de576112de848483815181106112bb57fe5b60200260200101518484815181106112cf57fe5b602002602001015160026117eb565b600101611287565b5050505050565b60005b848110156112e657600082828151811061130657fe5b60200260200101511115611347576113478484838151811061132457fe5b602002602001015184848151811061133857fe5b602002602001015160016117eb565b6001016112f0565b60005b8681101561151657600084828151811061136857fe5b6020026020010151111561150e57600084828151811061138457fe5b6020026020010151905085828151811061139a57fe5b60200260200101516001600160a01b03166323b872dd8430846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050602060405180830381600087803b15801561140957600080fd5b505af115801561141d573d6000803e3d6000fd5b505050506040513d602081101561143357600080fd5b5051611473576040805162461bcd60e51b815260206004820152600a602482015269616c6c6f77616e63653f60b01b604482015290519081900360640190fd5b6114828483815181106111c657fe5b61150c57866001600160a01b0316635a3b74b98584815181106114a157fe5b602002602001015160016040518363ffffffff1660e01b815260040180836001600160a01b03168152602001821515815260200192505050600060405180830381600087803b1580156114f357600080fd5b505af1158015611507573d6000803e3d6000fd5b505050505b505b600101611352565b50505050505050565b6000806000807369fa688f1dc47d4b5d8029d5a35fb7a5483106546001600160a01b031663d2493b6c876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060606040518083038186803b15801561158657600080fd5b505afa15801561159a573d6000803e3d6000fd5b505050506040513d60608110156115b057600080fd5b5060208082015160409283015183516370a0823160e01b81526001600160a01b038a811660048301529451929650909450928516926370a08231926024808301939192829003018186803b15801561160757600080fd5b505afa15801561161b573d6000803e3d6000fd5b505050506040513d602081101561163157600080fd5b5051604080516370a0823160e01b81526001600160a01b0388811660048301529151929650908316916370a0823191602480820192602092909190829003018186803b15801561168057600080fd5b505afa158015611694573d6000803e3d6000fd5b505050506040513d60208110156116aa57600080fd5b50519396939550929350505050565b60006116c58383611866565b9392505050565b6040805163573ade8160e01b81526001600160a01b0386811660048301526024820186905260448201859052838116606483015291519187169163573ade819160848082019260009290919082900301818387803b15801561172d57600080fd5b505af1158015611741573d6000803e3d6000fd5b505050505050505050565b604080516328dd2d0160e01b81526001600160a01b0384811660048301528316602482015290516000917369fa688f1dc47d4b5d8029d5a35fb7a548310654916328dd2d019160448082019261012092909190829003018186803b1580156117b357600080fd5b505afa1580156117c7573d6000803e3d6000fd5b505050506040513d6101208110156117de57600080fd5b5061010001519392505050565b6040805163a415bcad60e01b81526001600160a01b0385811660048301526024820185905260448201849052610c9c606483015230608483015291519186169163a415bcad9160a48082019260009290919082900301818387803b15801561185257600080fd5b505af115801561127a573d6000803e3d6000fd5b6000828201838110156116c5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604051806101600160405280606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020016000151581525090565b600082601f83011261192c578081fd5b8135602061194161193c83611f2d565b611f0a565b828152818101908583018385028701840188101561195d578586fd5b855b8581101561198457813561197281611f4a565b8452928401929084019060010161195f565b5090979650505050505050565b600082601f8301126119a1578081fd5b813560206119b161193c83611f2d565b82815281810190858301838502870184018810156119cd578586fd5b855b85811015611984578135845292840192908401906001016119cf565b80356119f681611f62565b919050565b600060808284031215611a0c578081fd5b611a166080611f0a565b905081356001600160401b0380821115611a2f57600080fd5b611a3b8583860161191c565b83526020840135915080821115611a5157600080fd5b611a5d8583860161191c565b6020840152611a6e604085016119eb565b60408401526060840135915080821115611a8757600080fd5b50611a9484828501611991565b60608301525092915050565b600060208284031215611ab1578081fd5b81516116c581611f4a565b60008060408385031215611ace578081fd5b8235611ad981611f4a565b915060208301356001600160401b03811115611af3578182fd5b611aff858286016119fb565b9150509250929050565b600080600060608486031215611b1d578081fd5b8335611b2881611f4a565b92506020848101356001600160401b0380821115611b44578384fd5b611b50888389016119fb565b94506040870135915080821115611b65578384fd5b508501601f81018713611b76578283fd5b8035611b8461193c82611f2d565b81815283810190838501858402850186018b1015611ba0578687fd5b8694505b83851015611bcb578035611bb781611f62565b835260019490940193918501918501611ba4565b5080955050505050509250925092565b600060208284031215611bec578081fd5b81516116c581611f62565b6000815180845260208085019450808401835b83811015611c2f5781516001600160a01b031687529582019590820190600101611c0a565b509495945050505050565b6000815180845260208085019450808401835b83811015611c2f57815187529582019590820190600101611c4d565b60008151808452815b81811015611c8e57602081850181015186830182015201611c72565b81811115611c9f5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0389168152871515602082015261010060408201819052600090611cf58382018a611bf7565b90508281036060840152611d098189611bf7565b90508281036080840152611d1d8188611c3a565b905082810360a0840152611d318187611c3a565b905082810360c0840152611d458186611c3a565b905082810360e0840152611d598185611c3a565b9b9a5050505050505050505050565b600061012060018060a01b038c16835260208b151581850152816040850152611d938285018c611bf7565b91508382036060850152611da7828b611bf7565b91508382036080850152611dbb828a611c3a565b915083820360a0850152611dcf8289611c3a565b915083820360c0850152611de38288611c3a565b915083820360e0850152611df78287611c3a565b8481036101008601528551808252828701935090820190845b81811015611e2e578451151583529383019391830191600101611e10565b50909e9d5050505050505050505050505050565b6000602082526116c56020830184611c69565b600060408252611e686040830185611c69565b8281036020840152611e7a8185611c69565b95945050505050565b6020808252601490820152730c0b5b195b99dd1a0b5b9bdd0b585b1b1bddd95960621b604082015260600190565b6020808252601590820152740eae6cae45ac2c6c6deeadce85adcdee85ac2eae8d605b1b604082015260600190565b60208082526010908201526f6c656e677468732d6e6f742d73616d6560801b604082015260600190565b6040518181016001600160401b0381118282101715611f2557fe5b604052919050565b60006001600160401b03821115611f4057fe5b5060209081020190565b6001600160a01b0381168114611f5f57600080fd5b50565b8015158114611f5f57600080fdfe4c6f67416176655633496d706f727428616464726573732c626f6f6c2c616464726573735b5d2c616464726573735b5d2c75696e743235365b5d2c75696e743235365b5d2c75696e743235365b5d2c75696e743235365b5d294c6f67416176655633496d706f727457697468436f6c6c61746572616c28616464726573732c626f6f6c2c616464726573735b5d2c616464726573735b5d2c75696e743235365b5d2c75696e743235365b5d2c75696e743235365b5d2c75696e743235365b5d2c626f6f6c5b5d29a2646970667358221220682f14aa519c8ffb709463a4baf34289f9dbbe445af30b6fac05815aeb83206e64736f6c63430007060033

Deployed Bytecode

0x6080604052600436106100345760003560e01c806306fdde0314610039578063ad9435e814610064578063e69193f514610085575b600080fd5b34801561004557600080fd5b5061004e610098565b60405161005b9190611e42565b60405180910390f35b610077610072366004611b09565b6100c7565b60405161005b929190611e55565b610077610093366004611abc565b6100e1565b60405180604001604052806013815260200172416176652d76332d696d706f72742d76312e3160681b81525081565b6060806100d58585856100f9565b90969095509350505050565b6060806100ee848461039b565b909590945092505050565b604051632520e7ff60e01b815260609081903090632520e7ff90610121908890600401611cb4565b60206040518083038186803b15801561013957600080fd5b505afa15801561014d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101719190611bdb565b6101965760405162461bcd60e51b815260040161018d90611eb1565b60405180910390fd5b8351516101b55760405162461bcd60e51b815260040161018d90611e83565b8351518351146101d75760405162461bcd60e51b815260040161018d90611ee0565b6101df6118c0565b600073a97684ead0e402dc232d5a977953df7ecbab3cdb6001600160a01b031663026b1d5f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561022e57600080fd5b505afa158015610242573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102669190611aa0565b90506102748782888561060e565b9150610281878784610c10565b915061029d8260200151518284602001518560c001518b610fc5565b6020820151805160808401516102b59284918b611030565b81518051604084015160608501516102d293859291908a8d611093565b816101400151156102fa57602082015180516101208401516102f5928491611284565b610328565b6020820151805160e08401516103119284916112ed565b6020820151805160a0840151610328928491611284565b6040518060a00160405280606e8152602001611fca606e9139935086866040015187600001518860200151896060015186606001518760c0015188608001518c60405160200161038099989796959493929190611d68565b60405160208183030381529060405292505050935093915050565b604051632520e7ff60e01b815260609081903090632520e7ff906103c3908790600401611cb4565b60206040518083038186803b1580156103db57600080fd5b505afa1580156103ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104139190611bdb565b61042f5760405162461bcd60e51b815260040161018d90611eb1565b82515161044e5760405162461bcd60e51b815260040161018d90611e83565b6104566118c0565b600073a97684ead0e402dc232d5a977953df7ecbab3cdb6001600160a01b031663026b1d5f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104a557600080fd5b505afa1580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd9190611aa0565b90506104eb8682878561060e565b91506104f8868684610c10565b91506105148260200151518284602001518560c001518a610fc5565b60208201518051608084015161052c9284918a611030565b815180516040840151606085015161054893859291908b61134f565b81610140015115610570576020820151805161012084015161056b928491611284565b61059e565b6020820151805160e08401516105879284916112ed565b6020820151805160a084015161059e928491611284565b604051806080016040528060598152602001611f7160599139935085856040015186600001518760200151886060015186606001518760c0015188608001516040516020016105f4989796959493929190611cc8565b604051602081830303815290604052925050509250929050565b6106166118c0565b60208301515115610c08578260200151516001600160401b038111801561063c57600080fd5b50604051908082528060200260200182016040528015610666578160200160208202803683370190505b5082602001819052508260200151516001600160401b038111801561068a57600080fd5b506040519080825280602002602001820160405280156106b4578160200160208202803683370190505b5060808301526020830151516001600160401b03811180156106d557600080fd5b506040519080825280602002602001820160405280156106ff578160200160208202803683370190505b5060a08301526020830151516001600160401b038111801561072057600080fd5b5060405190808252806020026020018201604052801561074a578160200160208202803683370190505b5060c08301526020830151516001600160401b038111801561076b57600080fd5b50604051908082528060200260200182016040528015610795578160200160208202803683370190505b5060e08301526020830151516001600160401b03811180156107b657600080fd5b506040519080825280602002602001820160405280156107e0578160200160208202803683370190505b506101008301526020830151516001600160401b038111801561080257600080fd5b5060405190808252806020026020018201604052801561082c578160200160208202803683370190505b5061012083015260005b8360200151518110156108f057805b8460200151518110156108e7578181146108df578460200151818151811061086957fe5b60200260200101516001600160a01b03168560200151838151811061088a57fe5b60200260200101516001600160a01b031614156108df576040805162461bcd60e51b815260206004820152600e60248201526d1d1bdad95b8b5c995c19585d195960921b604482015290519081900360640190fd5b600101610845565b50600101610836565b5060005b836020015151811015610c0657600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b03168560200151838151811061093157fe5b60200260200101516001600160a01b031614610964578460200151828151811061095757fe5b602002602001015161096d565b6006602160991b015b9050808460200151838151811061098057fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506109aa818861151f565b8560c0015184815181106109ba57fe5b60200260200101866080015185815181106109d157fe5b6020026020010182815250828152505050836080015182815181106109f257fe5b6020026020010151600014610a8e57610a3984608001518381518110610a1457fe5b602002602001015186606001518481518110610a2c57fe5b60200260200101516116b9565b8460a001518381518110610a4957fe5b6020026020010181815250508360c001518281518110610a6557fe5b60200260200101518460e001518381518110610a7d57fe5b602002602001018181525050610abe565b610aa18460c001518381518110610a1457fe5b8460e001518381518110610ab157fe5b6020026020010181815250505b610ae98460c001518381518110610ad157fe5b602002602001015185608001518481518110610a2c57fe5b8461010001518381518110610afa57fe5b602002602001018181525050610b318460e001518381518110610b1957fe5b60200260200101518560a001518481518110610a2c57fe5b8461012001518381518110610b4257fe5b60200260200101818152505060008461010001518381518110610b6157fe5b60200260200101511115610bfd5760008461010001518381518110610b8257fe5b60200260200101519050816001600160a01b031663095ea7b388836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610be357600080fd5b505af1158015610bf7573d6000803e3d6000fd5b50505050505b506001016108f4565b505b509392505050565b610c186118c0565b8251516001600160401b0381118015610c3057600080fd5b50604051908082528060200260200182016040528015610c5a578160200160208202803683370190505b5060608301528251516001600160401b0381118015610c7857600080fd5b50604051908082528060200260200182016040528015610ca2578160200160208202803683370190505b5082528251516001600160401b0381118015610cbd57600080fd5b50604051908082528060200260200182016040528015610ce7578160200160208202803683370190505b50604083015260005b835151811015610da257805b845151811015610d9957818114610d91578451805182908110610d1b57fe5b60200260200101516001600160a01b031685600001518381518110610d3c57fe5b60200260200101516001600160a01b03161415610d91576040805162461bcd60e51b815260206004820152600e60248201526d1d1bdad95b8b5c995c19585d195960921b604482015290519081900360640190fd5b600101610cfc565b50600101610cf0565b5060005b835151811015610fbc578351805160009173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee9184908110610dd757fe5b60200260200101516001600160a01b031614610e08578451805183908110610dfb57fe5b6020026020010151610e11565b6006602160991b015b905060007369fa688f1dc47d4b5d8029d5a35fb7a5483106546001600160a01b031663d2493b6c836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060606040518083038186803b158015610e7657600080fd5b505afa158015610e8a573d6000803e3d6000fd5b505050506040513d6060811015610ea057600080fd5b505185518051919250839185908110610eb557fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508085604001518481518110610ee657fe5b60200260200101906001600160a01b031690816001600160a01b03168152505084604001518381518110610f1657fe5b60200260200101516001600160a01b03166370a08231886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610f6a57600080fd5b505afa158015610f7e573d6000803e3d6000fd5b505050506040513d6020811015610f9457600080fd5b50516060860151805185908110610fa757fe5b60209081029190910101525050600101610da6565b50909392505050565b60005b85811015611028576000838281518110610fde57fe5b602002602001015111156110205761102085858381518110610ffc57fe5b602002602001015185848151811061101057fe5b60200260200101516001866116cc565b600101610fc8565b505050505050565b60005b8581101561102857600083828151811061104957fe5b6020026020010151111561108b5761108b8585838151811061106757fe5b602002602001015185848151811061107b57fe5b60200260200101516002866116cc565b600101611033565b60005b8781101561127a5760008582815181106110ac57fe5b602002602001015111156112725760008582815181106110c857fe5b602002602001015190508682815181106110de57fe5b60200260200101516001600160a01b03166323b872dd8430846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050602060405180830381600087803b15801561114d57600080fd5b505af1158015611161573d6000803e3d6000fd5b505050506040513d602081101561117757600080fd5b50516111b7576040805162461bcd60e51b815260206004820152600a602482015269616c6c6f77616e63653f60b01b604482015290519081900360640190fd5b6111d48583815181106111c657fe5b60200260200101513061174c565b61127057876001600160a01b0316635a3b74b98684815181106111f357fe5b602002602001015186858151811061120757fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03168152602001821515815260200192505050600060405180830381600087803b15801561125757600080fd5b505af115801561126b573d6000803e3d6000fd5b505050505b505b600101611096565b5050505050505050565b60005b848110156112e657600082828151811061129d57fe5b602002602001015111156112de576112de848483815181106112bb57fe5b60200260200101518484815181106112cf57fe5b602002602001015160026117eb565b600101611287565b5050505050565b60005b848110156112e657600082828151811061130657fe5b60200260200101511115611347576113478484838151811061132457fe5b602002602001015184848151811061133857fe5b602002602001015160016117eb565b6001016112f0565b60005b8681101561151657600084828151811061136857fe5b6020026020010151111561150e57600084828151811061138457fe5b6020026020010151905085828151811061139a57fe5b60200260200101516001600160a01b03166323b872dd8430846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050602060405180830381600087803b15801561140957600080fd5b505af115801561141d573d6000803e3d6000fd5b505050506040513d602081101561143357600080fd5b5051611473576040805162461bcd60e51b815260206004820152600a602482015269616c6c6f77616e63653f60b01b604482015290519081900360640190fd5b6114828483815181106111c657fe5b61150c57866001600160a01b0316635a3b74b98584815181106114a157fe5b602002602001015160016040518363ffffffff1660e01b815260040180836001600160a01b03168152602001821515815260200192505050600060405180830381600087803b1580156114f357600080fd5b505af1158015611507573d6000803e3d6000fd5b505050505b505b600101611352565b50505050505050565b6000806000807369fa688f1dc47d4b5d8029d5a35fb7a5483106546001600160a01b031663d2493b6c876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060606040518083038186803b15801561158657600080fd5b505afa15801561159a573d6000803e3d6000fd5b505050506040513d60608110156115b057600080fd5b5060208082015160409283015183516370a0823160e01b81526001600160a01b038a811660048301529451929650909450928516926370a08231926024808301939192829003018186803b15801561160757600080fd5b505afa15801561161b573d6000803e3d6000fd5b505050506040513d602081101561163157600080fd5b5051604080516370a0823160e01b81526001600160a01b0388811660048301529151929650908316916370a0823191602480820192602092909190829003018186803b15801561168057600080fd5b505afa158015611694573d6000803e3d6000fd5b505050506040513d60208110156116aa57600080fd5b50519396939550929350505050565b60006116c58383611866565b9392505050565b6040805163573ade8160e01b81526001600160a01b0386811660048301526024820186905260448201859052838116606483015291519187169163573ade819160848082019260009290919082900301818387803b15801561172d57600080fd5b505af1158015611741573d6000803e3d6000fd5b505050505050505050565b604080516328dd2d0160e01b81526001600160a01b0384811660048301528316602482015290516000917369fa688f1dc47d4b5d8029d5a35fb7a548310654916328dd2d019160448082019261012092909190829003018186803b1580156117b357600080fd5b505afa1580156117c7573d6000803e3d6000fd5b505050506040513d6101208110156117de57600080fd5b5061010001519392505050565b6040805163a415bcad60e01b81526001600160a01b0385811660048301526024820185905260448201849052610c9c606483015230608483015291519186169163a415bcad9160a48082019260009290919082900301818387803b15801561185257600080fd5b505af115801561127a573d6000803e3d6000fd5b6000828201838110156116c5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604051806101600160405280606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020016000151581525090565b600082601f83011261192c578081fd5b8135602061194161193c83611f2d565b611f0a565b828152818101908583018385028701840188101561195d578586fd5b855b8581101561198457813561197281611f4a565b8452928401929084019060010161195f565b5090979650505050505050565b600082601f8301126119a1578081fd5b813560206119b161193c83611f2d565b82815281810190858301838502870184018810156119cd578586fd5b855b85811015611984578135845292840192908401906001016119cf565b80356119f681611f62565b919050565b600060808284031215611a0c578081fd5b611a166080611f0a565b905081356001600160401b0380821115611a2f57600080fd5b611a3b8583860161191c565b83526020840135915080821115611a5157600080fd5b611a5d8583860161191c565b6020840152611a6e604085016119eb565b60408401526060840135915080821115611a8757600080fd5b50611a9484828501611991565b60608301525092915050565b600060208284031215611ab1578081fd5b81516116c581611f4a565b60008060408385031215611ace578081fd5b8235611ad981611f4a565b915060208301356001600160401b03811115611af3578182fd5b611aff858286016119fb565b9150509250929050565b600080600060608486031215611b1d578081fd5b8335611b2881611f4a565b92506020848101356001600160401b0380821115611b44578384fd5b611b50888389016119fb565b94506040870135915080821115611b65578384fd5b508501601f81018713611b76578283fd5b8035611b8461193c82611f2d565b81815283810190838501858402850186018b1015611ba0578687fd5b8694505b83851015611bcb578035611bb781611f62565b835260019490940193918501918501611ba4565b5080955050505050509250925092565b600060208284031215611bec578081fd5b81516116c581611f62565b6000815180845260208085019450808401835b83811015611c2f5781516001600160a01b031687529582019590820190600101611c0a565b509495945050505050565b6000815180845260208085019450808401835b83811015611c2f57815187529582019590820190600101611c4d565b60008151808452815b81811015611c8e57602081850181015186830182015201611c72565b81811115611c9f5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0389168152871515602082015261010060408201819052600090611cf58382018a611bf7565b90508281036060840152611d098189611bf7565b90508281036080840152611d1d8188611c3a565b905082810360a0840152611d318187611c3a565b905082810360c0840152611d458186611c3a565b905082810360e0840152611d598185611c3a565b9b9a5050505050505050505050565b600061012060018060a01b038c16835260208b151581850152816040850152611d938285018c611bf7565b91508382036060850152611da7828b611bf7565b91508382036080850152611dbb828a611c3a565b915083820360a0850152611dcf8289611c3a565b915083820360c0850152611de38288611c3a565b915083820360e0850152611df78287611c3a565b8481036101008601528551808252828701935090820190845b81811015611e2e578451151583529383019391830191600101611e10565b50909e9d5050505050505050505050505050565b6000602082526116c56020830184611c69565b600060408252611e686040830185611c69565b8281036020840152611e7a8185611c69565b95945050505050565b6020808252601490820152730c0b5b195b99dd1a0b5b9bdd0b585b1b1bddd95960621b604082015260600190565b6020808252601590820152740eae6cae45ac2c6c6deeadce85adcdee85ac2eae8d605b1b604082015260600190565b60208082526010908201526f6c656e677468732d6e6f742d73616d6560801b604082015260600190565b6040518181016001600160401b0381118282101715611f2557fe5b604052919050565b60006001600160401b03821115611f4057fe5b5060209081020190565b6001600160a01b0381168114611f5f57600080fd5b50565b8015158114611f5f57600080fdfe4c6f67416176655633496d706f727428616464726573732c626f6f6c2c616464726573735b5d2c616464726573735b5d2c75696e743235365b5d2c75696e743235365b5d2c75696e743235365b5d2c75696e743235365b5d294c6f67416176655633496d706f727457697468436f6c6c61746572616c28616464726573732c626f6f6c2c616464726573735b5d2c616464726573735b5d2c75696e743235365b5d2c75696e743235365b5d2c75696e743235365b5d2c75696e743235365b5d2c626f6f6c5b5d29a2646970667358221220682f14aa519c8ffb709463a4baf34289f9dbbe445af30b6fac05815aeb83206e64736f6c63430007060033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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.