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 8 internal transactions
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
19513655 | 262 days ago | 0.08754284 ETH | ||||
19513655 | 262 days ago | 0.08754284 ETH | ||||
19477889 | 267 days ago | 0.25327852 ETH | ||||
19477889 | 267 days ago | 0.25327852 ETH | ||||
19391021 | 279 days ago | 1.3487302 ETH | ||||
19391021 | 279 days ago | 1.3487302 ETH | ||||
19313347 | 290 days ago | 0.43447711 ETH | ||||
19313347 | 290 days ago | 0.43447711 ETH |
Loading...
Loading
Contract Name:
TransmutationBlue
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol"; import {ISwapRouter} from "./interfaces/ISwapRouter.sol"; import {IBalancerVault} from "./interfaces/IBalancerVault.sol"; import {IOToken} from "./interfaces/IOToken.sol"; import {IWrappedNative} from "./interfaces/IWrappedNative.sol"; import {IQuoter} from "./interfaces/IQuoter.sol"; import {TransmutationEvents} from "./TransmutationEvents.sol"; import {TransmutationErrors} from "./TransmutationErrors.sol"; import {Path} from "./Path.sol"; // Flashloan sells oToken for a specified approved want. contract TransmutationBlue is Ownable, Pausable, TransmutationEvents, TransmutationErrors { using SafeERC20 for IERC20; using Path for bytes; // Essential Addresses IERC20 public underlying; IOToken public oToken; IERC20 public paymentToken; IBalancerVault public flashPool; address public native; address public router; IQuoter public quoter; address public treasury; address public partner; address[] private tokens; bytes public oTokenToUnderlyingPath; bytes public underlyingToPaymentTokenPath; // protocol fee uint256 public protocolFee; uint256 public partnerFee; uint256 public constant MAX_FEE = 5e16; // Max fee is 5%. uint256 private constant DIVISOR = 1e18; // Mapping Want token to their swap path; mapping(address => bytes) public paymentTokenToWantPath; mapping(address => bool) public approvedWant; // Is this want an approved want? Validation check. bool private flashOn; // Protect against reentrancy during flash. bool public swapOn; constructor ( IERC20 _underlying, IOToken _oToken, IERC20 _paymentToken, IBalancerVault _flashPool, address _native, address _router, IQuoter _quoter, address _treasury, bytes[] memory _paths ){ underlying = _underlying; oToken = _oToken; paymentToken = _paymentToken; flashPool = _flashPool; native = _native; router = _router; quoter = _quoter; treasury = _treasury; oTokenToUnderlyingPath = _paths[0]; underlyingToPaymentTokenPath = _paths[1]; tokens.push(address(native)); swapOn = false; } /** @notice Main Function used to swap oToken via a flash loan to specified approved want. * @param _want The token the user wants to swap to. * @param _amount Amount of oToken we are swapping. * @param _minAmountOut Minimum amount of want we are requesting, used for slippage protection. */ function transmute(address _want, uint256 _amount, uint256 _minAmountOut) external whenNotPaused returns (uint256 wantAmount) { if (!approvedWant[_want]) revert NotApprovedWant(); // Transfer to oToken. IERC20(address(oToken)).safeTransferFrom(msg.sender, address(this), _amount); // Should we swap or flash exercise? (bool swapTheOption,) = _shouldWeSwap(_amount); if (!swapTheOption) { // Get payment token amount needed to exercise oTokens. uint256 weightedAmount = _amount * oToken.getVeBalance() / oToken.totalSupply(); uint256 amountNeeded = oToken.getDiscountedPrice(weightedAmount); // Enter flash loan. flashOn = true; // Set up a fixed array for flash loan input. uint256[] memory amounts = new uint256[](1); amounts[0] = amountNeeded; flashPool.flashLoan(address(this), tokens, amounts, ""); } else _swapTheOption(_amount); // Swap what we have left to payment token. Fees memory fees; (wantAmount, fees) = _swapPaymentTokenToWant(msg.sender, _want, _minAmountOut); emit Transmute(msg.sender, _want, _amount, wantAmount, fees); } // Call back function, called by the pair during our flashloan. function receiveFlashLoan(address[] memory, uint256[] memory amounts, uint256[] memory feeAmounts, bytes calldata) external { if (msg.sender != address(flashPool)) revert NotPair(); if (!flashOn) revert PairReentered(); // Exercise the oToken uint256 paymentTokenAmount = paymentToken.balanceOf(address(this)); uint256 oTokenAmt = IERC20(address(oToken)).balanceOf(address(this)); _approveTokenIfNeeded(address(paymentToken), address(oToken)); oToken.exercise(oTokenAmt, paymentTokenAmount, address(this)); // Swap underlying to payment token _approveTokenIfNeeded(address(underlying), router); swap(router, underlyingToPaymentTokenPath, underlying.balanceOf(address(this))); // Pay off our loan uint256 pairDebt = amounts[0] + feeAmounts[0]; paymentToken.safeTransfer(address(flashPool), pairDebt); flashOn = false; } function _swapTheOption(uint256 _amount) private { _approveTokenIfNeeded(address(oToken), router); swap(router, oTokenToUnderlyingPath, _amount); uint256 bal = underlying.balanceOf(address(this)); _approveTokenIfNeeded(address(underlying), router); swap(router, underlyingToPaymentTokenPath, bal); } function _swapPaymentTokenToWant(address _user, address _want, uint256 _minAmountOut) private returns (uint256 amount, Fees memory fees) { // Swap payment token to want if we need to. uint256 bal = paymentToken.balanceOf(address(this)); if (_want != address(paymentToken)) { _approveTokenIfNeeded(address(paymentToken), router); swap(router, paymentTokenToWantPath[_want], bal); } // Check slippage. amount = IERC20(_want).balanceOf(address(this)); if (amount < _minAmountOut) revert TooMuchSlippage(); // Take protocol fee. fees.protocolAmt = amount * protocolFee / DIVISOR; fees.partnerAmt = amount * partnerFee / DIVISOR; uint256 feeAmt = fees.partnerAmt + fees.protocolAmt; if (fees.protocolAmt > 0) IERC20(_want).safeTransfer(treasury, fees.protocolAmt); if (fees.partnerAmt > 0) IERC20(_want).safeTransfer(partner, fees.partnerAmt); amount = amount - feeAmt; // Tranfer want back to user. if (_want == native) { IWrappedNative(_want).withdraw(amount); (bool success,) = msg.sender.call{value: amount}(""); if (!success) revert NativeTransferFailed(); } else IERC20(_want).safeTransfer(_user, amount); } function _shouldWeSwap(uint256 _amount) private returns (bool, uint256) { // If swap off we just return false. if (!swapOn) return (false, 0); // Whats the amount of underlying we get for flashSwapping. uint256 discount = oToken.discount(); uint256 flashAmount = _amount * (100 - discount) / 100; // How much we get for just swapping through LP. uint256 swapAmount = quoter.quoteExactInput(oTokenToUnderlyingPath, _amount); if (swapAmount > flashAmount) return (true, swapAmount); else return (false, 0); } // Should be close to an estimate on how much you receive to transmute. function getAmountOut(address _want, uint256 _amount) external returns (uint256 amountOut) { uint256 discount = oToken.discount(); uint256 amount = _amount * (100 - discount) / 100; (bool swapTheOption, uint256 swapAmount) = _shouldWeSwap(_amount); if (swapTheOption) amount = swapAmount; uint256 paymentTokenAmount = quoter.quoteExactInput(underlyingToPaymentTokenPath, amount); if (_want == address(paymentToken)) { amountOut = paymentTokenAmount; } else amountOut = quoter.quoteExactInput(paymentTokenToWantPath[_want], paymentTokenAmount); } function setTreasury(address _treasury) external onlyOwner { emit SetTreasury(treasury, _treasury); treasury = _treasury; } function setPartner(address _partner) external onlyOwner { emit SetPartner(partner, _partner); partner = _partner; } function setProtocolFee(uint256 _protocolFee, uint256 _partnerFee) external onlyOwner { if (_protocolFee + _partnerFee > MAX_FEE) revert TooMuchFee(); emit SetFee(protocolFee, _protocolFee, partnerFee, _partnerFee); // Set Fee protocolFee = _protocolFee; partnerFee = _partnerFee; } function addWantToken(address _wantToken, bytes calldata _path) external onlyOwner { address[] memory _tokens = _pathToRoute(_path); if (_tokens[0] != address(paymentToken)) revert WrongToken(); if (_tokens[_tokens.length - 1] != _wantToken) revert WrongToken(); // Add to our mappings. paymentTokenToWantPath[_wantToken] = _path; approvedWant[_wantToken] = true; emit SetWant(_wantToken, _tokens); } function toggleWantApproval(address _want, bool _approved) external onlyOwner { approvedWant[_want] = _approved; } function toggleSwapOn(bool _on) external onlyOwner { swapOn = _on; } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function swap( address _router, bytes memory _path, uint256 _amountIn ) private returns (uint256 amountOut) { ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({ path: _path, recipient: address(this), deadline: block.timestamp, amountIn: _amountIn, amountOutMinimum: 0 }); return ISwapRouter(_router).exactInput(params); } // Convert encoded path to token route function _pathToRoute(bytes memory _path) private pure returns (address[] memory) { uint256 numPools = _path.numPools(); address[] memory route = new address[](numPools + 1); for (uint256 i; i < numPools; i++) { (address tokenA, address tokenB,) = _path.decodeFirstPool(); route[i] = tokenA; route[i + 1] = tokenB; _path = _path.skipToken(); } return route; } function paymentTokenToWantRoute(address _wantToken) external view returns (address[] memory route) { return _pathToRoute(paymentTokenToWantPath[_wantToken]); } function _approveTokenIfNeeded(address token, address spender) private { if (IERC20(token).allowance(address(this), spender) == 0) { IERC20(token).safeApprove(spender, type(uint256).max); } } receive() external payable { assert(msg.sender == native); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: BUSL-1.1 /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.5.0 <0.9.0; library BytesLib { function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, 'slice_overflow'); require(_start + _length >= _start, 'slice_overflow'); require(_bytes.length >= _start + _length, 'slice_outOfBounds'); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_start + 20 >= _start, 'toAddress_overflow'); require(_bytes.length >= _start + 20, 'toAddress_outOfBounds'); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) { require(_start + 3 >= _start, 'toUint24_overflow'); require(_bytes.length >= _start + 3, 'toUint24_outOfBounds'); uint24 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x3), _start)) } return tempUint; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface IBalancerVault { function flashLoan(address receipient, address[] memory tokens, uint256[] memory amounts, bytes memory userData) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface IOToken { function exercise( uint256 _amount, uint256 _maxPaymentAmount, address _recipient ) external returns (uint256); function mint( address _to, uint256 _amount ) external; function getDiscountedPrice(uint256 _amount) external view returns (uint256 amount); function discount() external view returns (uint256); function getVeBalance() external view returns (uint256); function totalSupply() external view returns (uint256); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface IQuoter { function quoteExactInput(bytes memory path, uint amountIn) external returns (uint amountOut); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.7.5; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface ISwapRouter { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface IWrappedNative { function deposit() external payable; function withdraw(uint wad) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.6.0; import './BytesLib.sol'; /// @title Functions for manipulating path data for multihop swaps library Path { using BytesLib for bytes; /// @dev The length of the bytes encoded address uint256 private constant ADDR_SIZE = 20; /// @dev The length of the bytes encoded fee uint256 private constant FEE_SIZE = 3; /// @dev The offset of a single token address and pool fee uint256 private constant NEXT_OFFSET = ADDR_SIZE + FEE_SIZE; /// @dev The offset of an encoded pool key uint256 private constant POP_OFFSET = NEXT_OFFSET + ADDR_SIZE; /// @dev The minimum length of an encoding that contains 2 or more pools uint256 private constant MULTIPLE_POOLS_MIN_LENGTH = POP_OFFSET + NEXT_OFFSET; /// @notice Returns true iff the path contains two or more pools /// @param path The encoded swap path /// @return True if path contains two or more pools, otherwise false function hasMultiplePools(bytes memory path) internal pure returns (bool) { return path.length >= MULTIPLE_POOLS_MIN_LENGTH; } /// @notice Returns the number of pools in the path /// @param path The encoded swap path /// @return The number of pools in the path function numPools(bytes memory path) internal pure returns (uint256) { // Ignore the first token address. From then on every fee and token offset indicates a pool. return ((path.length - ADDR_SIZE) / NEXT_OFFSET); } /// @notice Decodes the first pool in path /// @param path The bytes encoded swap path /// @return tokenA The first token of the given pool /// @return tokenB The second token of the given pool /// @return fee The fee level of the pool function decodeFirstPool(bytes memory path) internal pure returns ( address tokenA, address tokenB, uint24 fee ) { tokenA = path.toAddress(0); fee = path.toUint24(ADDR_SIZE); tokenB = path.toAddress(NEXT_OFFSET); } /// @notice Gets the segment corresponding to the first pool in the path /// @param path The bytes encoded swap path /// @return The segment containing all data necessary to target the first pool in the path function getFirstPool(bytes memory path) internal pure returns (bytes memory) { return path.slice(0, POP_OFFSET); } /// @notice Skips a token + fee element from the buffer and returns the remainder /// @param path The swap path /// @return The remaining token + fee elements in the path function skipToken(bytes memory path) internal pure returns (bytes memory) { return path.slice(NEXT_OFFSET, path.length - NEXT_OFFSET); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; contract TransmutationErrors { error NotPair(); error WrongToken(); error TooMuchFee(); error NotApprovedWant(); error TooMuchSlippage(); error PairReentered(); error NativeTransferFailed(); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; contract TransmutationEvents { struct Fees { uint256 protocolAmt; uint256 partnerAmt; } event Transmute(address indexed user, address indexed want, uint256 otokenAmt, uint256 wantAmount, Fees fees); event SetFee(uint256 oldProtocolFee, uint256 newProtocolFee, uint256 oldPartnerFee, uint256 newPartnerFee); event SetWant(address indexed want, address[] tokens); event SetTreasury(address oldTreasury, address newTreasury); event SetPartner(address oldPartner, address newPartner); event SetProvider(address oldProvider, address newProvider); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IERC20","name":"_underlying","type":"address"},{"internalType":"contract IOToken","name":"_oToken","type":"address"},{"internalType":"contract IERC20","name":"_paymentToken","type":"address"},{"internalType":"contract IBalancerVault","name":"_flashPool","type":"address"},{"internalType":"address","name":"_native","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"contract IQuoter","name":"_quoter","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"bytes[]","name":"_paths","type":"bytes[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"NativeTransferFailed","type":"error"},{"inputs":[],"name":"NotApprovedWant","type":"error"},{"inputs":[],"name":"NotPair","type":"error"},{"inputs":[],"name":"PairReentered","type":"error"},{"inputs":[],"name":"TooMuchFee","type":"error"},{"inputs":[],"name":"TooMuchSlippage","type":"error"},{"inputs":[],"name":"WrongToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldProtocolFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newProtocolFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldPartnerFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPartnerFee","type":"uint256"}],"name":"SetFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPartner","type":"address"},{"indexed":false,"internalType":"address","name":"newPartner","type":"address"}],"name":"SetPartner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldProvider","type":"address"},{"indexed":false,"internalType":"address","name":"newProvider","type":"address"}],"name":"SetProvider","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldTreasury","type":"address"},{"indexed":false,"internalType":"address","name":"newTreasury","type":"address"}],"name":"SetTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"want","type":"address"},{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"SetWant","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"want","type":"address"},{"indexed":false,"internalType":"uint256","name":"otokenAmt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"wantAmount","type":"uint256"},{"components":[{"internalType":"uint256","name":"protocolAmt","type":"uint256"},{"internalType":"uint256","name":"partnerAmt","type":"uint256"}],"indexed":false,"internalType":"struct TransmutationEvents.Fees","name":"fees","type":"tuple"}],"name":"Transmute","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wantToken","type":"address"},{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"addWantToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approvedWant","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flashPool","outputs":[{"internalType":"contract IBalancerVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_want","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"native","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oToken","outputs":[{"internalType":"contract IOToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oTokenToUnderlyingPath","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"partner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"partnerFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"paymentTokenToWantPath","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wantToken","type":"address"}],"name":"paymentTokenToWantRoute","outputs":[{"internalType":"address[]","name":"route","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quoter","outputs":[{"internalType":"contract IQuoter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"feeAmounts","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"receiveFlashLoan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_partner","type":"address"}],"name":"setPartner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_protocolFee","type":"uint256"},{"internalType":"uint256","name":"_partnerFee","type":"uint256"}],"name":"setProtocolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapOn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_on","type":"bool"}],"name":"toggleSwapOn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_want","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"toggleWantApproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_want","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"}],"name":"transmute","outputs":[{"internalType":"uint256","name":"wantAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingToPaymentTokenPath","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620033da380380620033da833981016040819052620000349162000371565b6200003f336200018f565b6000805460ff60a01b19168155600180546001600160a01b03199081166001600160a01b038d8116919091179092556002805482168c84161790556003805482168b84161790556004805482168a8416179055600580548216898416179055600680548216888416179055600780548216878416179055600880549091169185169190911790558151829190620000da57620000da6200045c565b6020026020010151600b9081620000f2919062000501565b50806001815181106200010957620001096200045c565b6020026020010151600c908162000121919062000501565b5050600554600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0319166001600160a01b0390921691909117905550506011805461ff001916905550620005cd945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620001f557600080fd5b50565b80516200020581620001df565b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200024b576200024b6200020a565b604052919050565b6000601f83818401126200026657600080fd5b825160206001600160401b03808311156200028557620002856200020a565b8260051b6200029683820162000220565b9384528681018301938381019089861115620002b157600080fd5b84890192505b858310156200036457825184811115620002d15760008081fd5b8901603f81018b13620002e45760008081fd5b8581015185811115620002fb57620002fb6200020a565b6200030e818a01601f1916880162000220565b81815260408d81848601011115620003265760008081fd5b60005b8381101562000346578481018201518382018b0152890162000329565b505060009181018801919091528352509184019190840190620002b7565b9998505050505050505050565b60008060008060008060008060006101208a8c0312156200039157600080fd5b89516200039e81620001df565b60208b0151909950620003b181620001df565b60408b0151909850620003c481620001df565b60608b0151909750620003d781620001df565b60808b0151909650620003ea81620001df565b60a08b0151909550620003fd81620001df565b60c08b01519094506200041081620001df565b92506200042060e08b01620001f8565b6101008b01519092506001600160401b038111156200043e57600080fd5b6200044c8c828d0162000253565b9150509295985092959850929598565b634e487b7160e01b600052603260045260246000fd5b600181811c908216806200048757607f821691505b602082108103620004a857634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620004fc57600081815260208120601f850160051c81016020861015620004d75750805b601f850160051c820191505b81811015620004f857828155600101620004e3565b5050505b505050565b81516001600160401b038111156200051d576200051d6200020a565b62000535816200052e845462000472565b84620004ae565b602080601f8311600181146200056d5760008415620005545750858301515b600019600386901b1c1916600185901b178555620004f8565b600085815260208120601f198616915b828110156200059e578886015182559484019460019091019084016200057d565b5085821015620005bd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b612dfd80620005dd6000396000f3fe6080604052600436106101f25760003560e01c80638da5cb5b1161010d578063ca706bcf116100a0578063f0f442601161006f578063f0f442601461058c578063f2fde38b146105ac578063f887ea40146105cc578063fa2621df146105ec578063fe9d4bfd1461061c57600080fd5b8063ca706bcf1461050c578063dd2282cd1461052c578063e7fd16c31461054c578063f04f27071461056c57600080fd5b8063b0e21e8a116100dc578063b0e21e8a1461049b578063bc063e1a146104b1578063be10862b146104cc578063c6bbd5a7146104ec57600080fd5b80638da5cb5b1461041d578063a16d59601461043b578063a3a3a4741461045b578063aa7f0ceb1461047b57600080fd5b80635c975abb11610185578063715018a611610154578063715018a6146103b45780637e2d431c146103c95780638456cb59146103e95780638d21c814146103fe57600080fd5b80635c975abb146103295780635ed5227b1461035457806361d027b3146103745780636f307dc31461039457600080fd5b80633013ce29116101c15780633013ce29146102bb5780633f4ba83a146102db5780635109e95e146102f05780635b99176c1461030557600080fd5b80630d2f84c61461021857806311b0b42d146102435780631a32aad61461027b578063240de2771461029b57600080fd5b36610213576005546001600160a01b031633146102115761021161258e565b005b600080fd5b34801561022457600080fd5b5061022d610649565b60405161023a91906125f4565b60405180910390f35b34801561024f57600080fd5b50600554610263906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b34801561028757600080fd5b50600254610263906001600160a01b031681565b3480156102a757600080fd5b506102116102b636600461260e565b6106d7565b3480156102c757600080fd5b50600354610263906001600160a01b031681565b3480156102e757600080fd5b50610211610766565b3480156102fc57600080fd5b5061022d610778565b34801561031157600080fd5b5061031b600e5481565b60405190815260200161023a565b34801561033557600080fd5b50600054600160a01b900460ff165b604051901515815260200161023a565b34801561036057600080fd5b5061021161036f366004612695565b610785565b34801561038057600080fd5b50600854610263906001600160a01b031681565b3480156103a057600080fd5b50600154610263906001600160a01b031681565b3480156103c057600080fd5b506102116108fd565b3480156103d557600080fd5b506102116103e43660046126f6565b61090f565b3480156103f557600080fd5b50610211610931565b34801561040a57600080fd5b5060115461034490610100900460ff1681565b34801561042957600080fd5b506000546001600160a01b0316610263565b34801561044757600080fd5b50610211610456366004612713565b610941565b34801561046757600080fd5b5061031b61047636600461272e565b6109b2565b34801561048757600080fd5b50600454610263906001600160a01b031681565b3480156104a757600080fd5b5061031b600d5481565b3480156104bd57600080fd5b5061031b66b1a2bc2ec5000081565b3480156104d857600080fd5b50600954610263906001600160a01b031681565b3480156104f857600080fd5b50600754610263906001600160a01b031681565b34801561051857600080fd5b5061031b610527366004612761565b610cdb565b34801561053857600080fd5b5061022d610547366004612713565b610ec2565b34801561055857600080fd5b5061021161056736600461278b565b610edb565b34801561057857600080fd5b50610211610587366004612898565b610f0e565b34801561059857600080fd5b506102116105a7366004612713565b611279565b3480156105b857600080fd5b506102116105c7366004612713565b6112ea565b3480156105d857600080fd5b50600654610263906001600160a01b031681565b3480156105f857600080fd5b50610344610607366004612713565b60106020526000908152604090205460ff1681565b34801561062857600080fd5b5061063c610637366004612713565b611368565b60405161023a91906129a8565b600c8054610656906129f5565b80601f0160208091040260200160405190810160405280929190818152602001828054610682906129f5565b80156106cf5780601f106106a4576101008083540402835291602001916106cf565b820191906000526020600020905b8154815290600101906020018083116106b257829003601f168201915b505050505081565b6106df61141b565b66b1a2bc2ec500006106f18284612a45565b111561071057604051639a33400560e01b815260040160405180910390fd5b600d54600e546040805192835260208301859052820152606081018290527f2c40e30353ae48a032fd20f1fece20031c1b80a2bc8512a2c172ff4de2e595199060800160405180910390a1600d91909155600e55565b61076e61141b565b610776611475565b565b600b8054610656906129f5565b61078d61141b565b60006107ce83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506114ca92505050565b60035481519192506001600160a01b03169082906000906107f1576107f1612a58565b60200260200101516001600160a01b03161461082057604051635079ff7560e11b815260040160405180910390fd5b836001600160a01b031681600183516108399190612a6e565b8151811061084957610849612a58565b60200260200101516001600160a01b03161461087857604051635079ff7560e11b815260040160405180910390fd5b6001600160a01b0384166000908152600f6020526040902061089b838583612acf565b506001600160a01b03841660008181526010602052604090819020805460ff19166001179055517f4bdb5e3c13921a0d76472ecf6e7495db32365ceb83630add19b86e1b85bc3940906108ef9084906129a8565b60405180910390a250505050565b61090561141b565b61077660006115d6565b61091761141b565b601180549115156101000261ff0019909216919091179055565b61093961141b565b610776611626565b61094961141b565b600954604080516001600160a01b03928316815291831660208301527f4b74c6905f914d7a5f408442bc16a267312648abfc3909c994cc6c2643ae5c96910160405180910390a1600980546001600160a01b0319166001600160a01b0392909216919091179055565b60006109bc611669565b6001600160a01b03841660009081526010602052604090205460ff166109f557604051632ef5093360e11b815260040160405180910390fd5b600254610a0d906001600160a01b03163330866116b6565b6000610a1884611727565b50905080610c4d57600254604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015610a6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8e9190612b90565b600260009054906101000a90046001600160a01b03166001600160a01b031663739fae8c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190612b90565b610b0f9087612ba9565b610b199190612bc0565b6002546040516319ce656f60e11b8152600481018390529192506000916001600160a01b039091169063339ccade90602401602060405180830381865afa158015610b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8c9190612b90565b6011805460ff191660019081179091556040805182815280820190915291925060009190602080830190803683370190505090508181600081518110610bd457610bd4612a58565b602090810291909101015260048054604051632e1c224f60e11b81526001600160a01b0390911691635c38449e91610c13913091600a91879101612be2565b600060405180830381600087803b158015610c2d57600080fd5b505af1158015610c41573d6000803e3d6000fd5b50505050505050610c56565b610c5684611879565b6040805180820190915260008082526020820152610c753387866119e9565b604080518881526020808201859052835182840152830151606082015290519295509092506001600160a01b0388169133917f7fc5e9552d3d65c741e06ea68e160af8fa4f85a3fe5c75db689c2028383bdd93919081900360800190a350509392505050565b600080600260009054906101000a90046001600160a01b03166001600160a01b0316636b6f4a9d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d559190612b90565b905060006064610d658382612a6e565b610d6f9086612ba9565b610d799190612bc0565b9050600080610d8786611727565b915091508115610d95578092505b60075460405163cdca175360e01b81526000916001600160a01b03169063cdca175390610dc990600c908890600401612c89565b6020604051808303816000875af1158015610de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0c9190612b90565b6003549091506001600160a01b0390811690891603610e2d57809550610eb7565b6007546001600160a01b038981166000908152600f602052604090819020905163cdca175360e01b8152919092169163cdca175391610e7191908590600401612c89565b6020604051808303816000875af1158015610e90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb49190612b90565b95505b505050505092915050565b600f6020526000908152604090208054610656906129f5565b610ee361141b565b6001600160a01b03919091166000908152601060205260409020805460ff1916911515919091179055565b6004546001600160a01b03163314610f3957604051636109bfab60e01b815260040160405180910390fd5b60115460ff16610f5c5760405163171dcfcb60e31b815260040160405180910390fd5b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610fa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc99190612b90565b6002546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015611017573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103b9190612b90565b60035460025491925061105a916001600160a01b039182169116611d1b565b600254604051636b1bcdb960e11b815260048101839052602481018490523060448201526001600160a01b039091169063d6379b72906064016020604051808303816000875af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d69190612b90565b506001546006546110f3916001600160a01b039081169116611d1b565b600654600c8054611202926001600160a01b03169190611112906129f5565b80601f016020809104026020016040519081016040528092919081815260200182805461113e906129f5565b801561118b5780601f106111605761010080835404028352916020019161118b565b820191906000526020600020905b81548152906001019060200180831161116e57829003601f168201915b50506001546040516370a0823160e01b81523060048201526001600160a01b0390911693506370a0823192506024019050602060405180830381865afa1580156111d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111fd9190612b90565b611dac565b5060008560008151811061121857611218612a58565b60200260200101518760008151811061123357611233612a58565b60200260200101516112459190612a45565b600454600354919250611265916001600160a01b03908116911683611e4b565b50506011805460ff19169055505050505050565b61128161141b565b600854604080516001600160a01b03928316815291831660208301527f190c262dc6f09322c68a13bf67c9659e58367755ba6190fa7ce5ca8aa45a877d910160405180910390a1600880546001600160a01b0319166001600160a01b0392909216919091179055565b6112f261141b565b6001600160a01b03811661135c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b611365816115d6565b50565b6001600160a01b0381166000908152600f60205260409020805460609161141591611392906129f5565b80601f01602080910402602001604051908101604052809291908181526020018280546113be906129f5565b801561140b5780601f106113e05761010080835404028352916020019161140b565b820191906000526020600020905b8154815290600101906020018083116113ee57829003601f168201915b50505050506114ca565b92915050565b6000546001600160a01b031633146107765760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611353565b61147d611e7b565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b606060006114d783611ecb565b905060006114e6826001612a45565b67ffffffffffffffff8111156114fe576114fe6127c2565b604051908082528060200260200182016040528015611527578160200160208202803683370190505b50905060005b828110156115ce5760008061154187611ef1565b50915091508184848151811061155957611559612a58565b6001600160a01b0390921660209283029190910190910152808461157e856001612a45565b8151811061158e5761158e612a58565b60200260200101906001600160a01b031690816001600160a01b0316815250506115b787611f2d565b9650505080806115c690612d1d565b91505061152d565b509392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61162e611669565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586114ad3390565b600054600160a01b900460ff16156107765760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611353565b6040516001600160a01b03808516602483015283166044820152606481018290526117219085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611f5e565b50505050565b6011546000908190610100900460ff1661174657506000928392509050565b60025460408051636b6f4a9d60e01b815290516000926001600160a01b031691636b6f4a9d9160048083019260209291908290030181865afa158015611790573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b49190612b90565b9050600060646117c48382612a6e565b6117ce9087612ba9565b6117d89190612bc0565b60075460405163cdca175360e01b81529192506000916001600160a01b039091169063cdca17539061181190600b908a90600401612c89565b6020604051808303816000875af1158015611830573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118549190612b90565b90508181111561186b576001969095509350505050565b506000958695509350505050565b600254600654611895916001600160a01b039081169116611d1b565b600654600b8054611938926001600160a01b031691906118b4906129f5565b80601f01602080910402602001604051908101604052809291908181526020018280546118e0906129f5565b801561192d5780601f106119025761010080835404028352916020019161192d565b820191906000526020600020905b81548152906001019060200180831161191057829003601f168201915b505050505083611dac565b506001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a69190612b90565b6001546006549192506119c5916001600160a01b039182169116611d1b565b600654600c80546119e4926001600160a01b031691906118b4906129f5565b505050565b6000611a08604051806040016040528060008152602001600081525090565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a759190612b90565b6003549091506001600160a01b03868116911614611adb57600354600654611aa9916001600160a01b039081169116611d1b565b6006546001600160a01b038681166000908152600f602052604090208054611ad99392909216916118b4906129f5565b505b6040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa158015611b1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b439190612b90565b925083831015611b665760405163fa6ad35560e01b815260040160405180910390fd5b670de0b6b3a7640000600d5484611b7d9190612ba9565b611b879190612bc0565b8252600e54670de0b6b3a764000090611ba09085612ba9565b611baa9190612bc0565b602083018190528251600091611bc09190612a45565b835190915015611be7576008548351611be7916001600160a01b0389811692911690611e4b565b602083015115611c11576009546020840151611c11916001600160a01b0389811692911690611e4b565b611c1b8185612a6e565b6005549094506001600160a01b0390811690871603611cfd57604051632e1a7d4d60e01b8152600481018590526001600160a01b03871690632e1a7d4d90602401600060405180830381600087803b158015611c7657600080fd5b505af1158015611c8a573d6000803e3d6000fd5b50506040516000925033915086908381818185875af1925050503d8060008114611cd0576040519150601f19603f3d011682016040523d82523d6000602084013e611cd5565b606091505b5050905080611cf757604051633d2cec6f60e21b815260040160405180910390fd5b50611d11565b611d116001600160a01b0387168886611e4b565b5050935093915050565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa158015611d67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8b9190612b90565b600003611da857611da86001600160a01b03831682600019612033565b5050565b6040805160a081018252838152306020820152428183015260608101839052600060808201819052915163c04b8d5960e01b81526001600160a01b0386169063c04b8d5990611dff908490600401612d36565b6020604051808303816000875af1158015611e1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e429190612b90565b95945050505050565b6040516001600160a01b0383166024820152604481018290526119e490849063a9059cbb60e01b906064016116ea565b600054600160a01b900460ff166107765760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611353565b6000611ed960036014612a45565b60148351611ee79190612a6e565b6114159190612bc0565b60008080611eff8482612148565b9250611f0c8460146121fc565b9050611f24611f1d60036014612a45565b8590612148565b91509193909250565b6060611415611f3e60036014612a45565b611f4a60036014612a45565b8451611f569190612a6e565b8491906122a7565b6000611fb3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123fe9092919063ffffffff16565b9050805160001480611fd4575080806020019051810190611fd49190612d8e565b6119e45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611353565b8015806120ad5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ab9190612b90565b155b6121185760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401611353565b6040516001600160a01b0383166024820152604481018290526119e490849063095ea7b360e01b906064016116ea565b600081612156816014612a45565b10156121995760405162461bcd60e51b8152602060048201526012602482015271746f416464726573735f6f766572666c6f7760701b6044820152606401611353565b6121a4826014612a45565b835110156121ec5760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401611353565b500160200151600160601b900490565b60008161220a816003612a45565b101561224c5760405162461bcd60e51b8152602060048201526011602482015270746f55696e7432345f6f766572666c6f7760781b6044820152606401611353565b612257826003612a45565b8351101561229e5760405162461bcd60e51b8152602060048201526014602482015273746f55696e7432345f6f75744f66426f756e647360601b6044820152606401611353565b50016003015190565b6060816122b581601f612a45565b10156122f45760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401611353565b826122ff8382612a45565b101561233e5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401611353565b6123488284612a45565b8451101561238c5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401611353565b6060821580156123ab57604051915060008252602082016040526123f5565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156123e45780518352602092830192016123cc565b5050858452601f01601f1916604052505b50949350505050565b606061240d8484600085612415565b949350505050565b6060824710156124765760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611353565b600080866001600160a01b031685876040516124929190612dab565b60006040518083038185875af1925050503d80600081146124cf576040519150601f19603f3d011682016040523d82523d6000602084013e6124d4565b606091505b50915091506124e5878383876124f0565b979650505050505050565b6060831561255f578251600003612558576001600160a01b0385163b6125585760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611353565b508161240d565b61240d83838151156125745781518083602001fd5b8060405162461bcd60e51b815260040161135391906125f4565b634e487b7160e01b600052600160045260246000fd5b60005b838110156125bf5781810151838201526020016125a7565b50506000910152565b600081518084526125e08160208601602086016125a4565b601f01601f19169290920160200192915050565b60208152600061260760208301846125c8565b9392505050565b6000806040838503121561262157600080fd5b50508035926020909101359150565b80356001600160a01b038116811461264757600080fd5b919050565b60008083601f84011261265e57600080fd5b50813567ffffffffffffffff81111561267657600080fd5b60208301915083602082850101111561268e57600080fd5b9250929050565b6000806000604084860312156126aa57600080fd5b6126b384612630565b9250602084013567ffffffffffffffff8111156126cf57600080fd5b6126db8682870161264c565b9497909650939450505050565b801515811461136557600080fd5b60006020828403121561270857600080fd5b8135612607816126e8565b60006020828403121561272557600080fd5b61260782612630565b60008060006060848603121561274357600080fd5b61274c84612630565b95602085013595506040909401359392505050565b6000806040838503121561277457600080fd5b61277d83612630565b946020939093013593505050565b6000806040838503121561279e57600080fd5b6127a783612630565b915060208301356127b7816126e8565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612801576128016127c2565b604052919050565b600067ffffffffffffffff821115612823576128236127c2565b5060051b60200190565b600082601f83011261283e57600080fd5b8135602061285361284e83612809565b6127d8565b82815260059290921b8401810191818101908684111561287257600080fd5b8286015b8481101561288d5780358352918301918301612876565b509695505050505050565b6000806000806000608086880312156128b057600080fd5b853567ffffffffffffffff808211156128c857600080fd5b818801915088601f8301126128dc57600080fd5b813560206128ec61284e83612809565b82815260059290921b8401810191818101908c84111561290b57600080fd5b948201945b838610156129305761292186612630565b82529482019490820190612910565b9950508901359250508082111561294657600080fd5b61295289838a0161282d565b9550604088013591508082111561296857600080fd5b61297489838a0161282d565b9450606088013591508082111561298a57600080fd5b506129978882890161264c565b969995985093965092949392505050565b6020808252825182820181905260009190848201906040850190845b818110156129e95783516001600160a01b0316835292840192918401916001016129c4565b50909695505050505050565b600181811c90821680612a0957607f821691505b602082108103612a2957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561141557611415612a2f565b634e487b7160e01b600052603260045260246000fd5b8181038181111561141557611415612a2f565b601f8211156119e457600081815260208120601f850160051c81016020861015612aa85750805b601f850160051c820191505b81811015612ac757828155600101612ab4565b505050505050565b67ffffffffffffffff831115612ae757612ae76127c2565b612afb83612af583546129f5565b83612a81565b6000601f841160018114612b2f5760008515612b175750838201355b600019600387901b1c1916600186901b178355612b89565b600083815260209020601f19861690835b82811015612b605786850135825560209485019460019092019101612b40565b5086821015612b7d5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b600060208284031215612ba257600080fd5b5051919050565b808202811582820484141761141557611415612a2f565b600082612bdd57634e487b7160e01b600052601260045260246000fd5b500490565b60006080820160018060a01b038087168452602060808186015282875480855260a0870191508860005282600020945060005b81811015612c33578554851683526001958601959284019201612c15565b5050858103604087015286518082529082019350915080860160005b83811015612c6b57815185529382019390820190600101612c4f565b50505050828103606084015260008152602081019695505050505050565b604081526000808454612c9b816129f5565b8060408601526060600180841660008114612cbd5760018114612cd757612d08565b60ff1985168884015283151560051b880183019550612d08565b8960005260208060002060005b86811015612cff5781548b8201870152908401908201612ce4565b8a018501975050505b50505050506020929092019290925292915050565b600060018201612d2f57612d2f612a2f565b5060010190565b602081526000825160a06020840152612d5260c08401826125c8565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b600060208284031215612da057600080fd5b8151612607816126e8565b60008251612dbd8184602087016125a4565b919091019291505056fea2646970667358221220a5dce498542b0217b18b44165d3ad37b2b904264ee08c11705c35367707f843464736f6c6343000813003300000000000000000000000095d8bf2f57cf973251972b496dc6b1d9c6b5bce3000000000000000000000000edb73d4ed90be7a49d06d0d940055e6d181d22fa000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000269ae88aa04e7b9b81f2d89263fbcd2cef1c58fc0000000000000000000000004c78d1ad9895125cd6a693a5b3aeae3c9478af0d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002bedb73d4ed90be7a49d06d0d940055e6d181d22fa00271095d8bf2f57cf973251972b496dc6b1d9c6b5bce3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b95d8bf2f57cf973251972b496dc6b1d9c6b5bce3002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106101f25760003560e01c80638da5cb5b1161010d578063ca706bcf116100a0578063f0f442601161006f578063f0f442601461058c578063f2fde38b146105ac578063f887ea40146105cc578063fa2621df146105ec578063fe9d4bfd1461061c57600080fd5b8063ca706bcf1461050c578063dd2282cd1461052c578063e7fd16c31461054c578063f04f27071461056c57600080fd5b8063b0e21e8a116100dc578063b0e21e8a1461049b578063bc063e1a146104b1578063be10862b146104cc578063c6bbd5a7146104ec57600080fd5b80638da5cb5b1461041d578063a16d59601461043b578063a3a3a4741461045b578063aa7f0ceb1461047b57600080fd5b80635c975abb11610185578063715018a611610154578063715018a6146103b45780637e2d431c146103c95780638456cb59146103e95780638d21c814146103fe57600080fd5b80635c975abb146103295780635ed5227b1461035457806361d027b3146103745780636f307dc31461039457600080fd5b80633013ce29116101c15780633013ce29146102bb5780633f4ba83a146102db5780635109e95e146102f05780635b99176c1461030557600080fd5b80630d2f84c61461021857806311b0b42d146102435780631a32aad61461027b578063240de2771461029b57600080fd5b36610213576005546001600160a01b031633146102115761021161258e565b005b600080fd5b34801561022457600080fd5b5061022d610649565b60405161023a91906125f4565b60405180910390f35b34801561024f57600080fd5b50600554610263906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b34801561028757600080fd5b50600254610263906001600160a01b031681565b3480156102a757600080fd5b506102116102b636600461260e565b6106d7565b3480156102c757600080fd5b50600354610263906001600160a01b031681565b3480156102e757600080fd5b50610211610766565b3480156102fc57600080fd5b5061022d610778565b34801561031157600080fd5b5061031b600e5481565b60405190815260200161023a565b34801561033557600080fd5b50600054600160a01b900460ff165b604051901515815260200161023a565b34801561036057600080fd5b5061021161036f366004612695565b610785565b34801561038057600080fd5b50600854610263906001600160a01b031681565b3480156103a057600080fd5b50600154610263906001600160a01b031681565b3480156103c057600080fd5b506102116108fd565b3480156103d557600080fd5b506102116103e43660046126f6565b61090f565b3480156103f557600080fd5b50610211610931565b34801561040a57600080fd5b5060115461034490610100900460ff1681565b34801561042957600080fd5b506000546001600160a01b0316610263565b34801561044757600080fd5b50610211610456366004612713565b610941565b34801561046757600080fd5b5061031b61047636600461272e565b6109b2565b34801561048757600080fd5b50600454610263906001600160a01b031681565b3480156104a757600080fd5b5061031b600d5481565b3480156104bd57600080fd5b5061031b66b1a2bc2ec5000081565b3480156104d857600080fd5b50600954610263906001600160a01b031681565b3480156104f857600080fd5b50600754610263906001600160a01b031681565b34801561051857600080fd5b5061031b610527366004612761565b610cdb565b34801561053857600080fd5b5061022d610547366004612713565b610ec2565b34801561055857600080fd5b5061021161056736600461278b565b610edb565b34801561057857600080fd5b50610211610587366004612898565b610f0e565b34801561059857600080fd5b506102116105a7366004612713565b611279565b3480156105b857600080fd5b506102116105c7366004612713565b6112ea565b3480156105d857600080fd5b50600654610263906001600160a01b031681565b3480156105f857600080fd5b50610344610607366004612713565b60106020526000908152604090205460ff1681565b34801561062857600080fd5b5061063c610637366004612713565b611368565b60405161023a91906129a8565b600c8054610656906129f5565b80601f0160208091040260200160405190810160405280929190818152602001828054610682906129f5565b80156106cf5780601f106106a4576101008083540402835291602001916106cf565b820191906000526020600020905b8154815290600101906020018083116106b257829003601f168201915b505050505081565b6106df61141b565b66b1a2bc2ec500006106f18284612a45565b111561071057604051639a33400560e01b815260040160405180910390fd5b600d54600e546040805192835260208301859052820152606081018290527f2c40e30353ae48a032fd20f1fece20031c1b80a2bc8512a2c172ff4de2e595199060800160405180910390a1600d91909155600e55565b61076e61141b565b610776611475565b565b600b8054610656906129f5565b61078d61141b565b60006107ce83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506114ca92505050565b60035481519192506001600160a01b03169082906000906107f1576107f1612a58565b60200260200101516001600160a01b03161461082057604051635079ff7560e11b815260040160405180910390fd5b836001600160a01b031681600183516108399190612a6e565b8151811061084957610849612a58565b60200260200101516001600160a01b03161461087857604051635079ff7560e11b815260040160405180910390fd5b6001600160a01b0384166000908152600f6020526040902061089b838583612acf565b506001600160a01b03841660008181526010602052604090819020805460ff19166001179055517f4bdb5e3c13921a0d76472ecf6e7495db32365ceb83630add19b86e1b85bc3940906108ef9084906129a8565b60405180910390a250505050565b61090561141b565b61077660006115d6565b61091761141b565b601180549115156101000261ff0019909216919091179055565b61093961141b565b610776611626565b61094961141b565b600954604080516001600160a01b03928316815291831660208301527f4b74c6905f914d7a5f408442bc16a267312648abfc3909c994cc6c2643ae5c96910160405180910390a1600980546001600160a01b0319166001600160a01b0392909216919091179055565b60006109bc611669565b6001600160a01b03841660009081526010602052604090205460ff166109f557604051632ef5093360e11b815260040160405180910390fd5b600254610a0d906001600160a01b03163330866116b6565b6000610a1884611727565b50905080610c4d57600254604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015610a6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8e9190612b90565b600260009054906101000a90046001600160a01b03166001600160a01b031663739fae8c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190612b90565b610b0f9087612ba9565b610b199190612bc0565b6002546040516319ce656f60e11b8152600481018390529192506000916001600160a01b039091169063339ccade90602401602060405180830381865afa158015610b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8c9190612b90565b6011805460ff191660019081179091556040805182815280820190915291925060009190602080830190803683370190505090508181600081518110610bd457610bd4612a58565b602090810291909101015260048054604051632e1c224f60e11b81526001600160a01b0390911691635c38449e91610c13913091600a91879101612be2565b600060405180830381600087803b158015610c2d57600080fd5b505af1158015610c41573d6000803e3d6000fd5b50505050505050610c56565b610c5684611879565b6040805180820190915260008082526020820152610c753387866119e9565b604080518881526020808201859052835182840152830151606082015290519295509092506001600160a01b0388169133917f7fc5e9552d3d65c741e06ea68e160af8fa4f85a3fe5c75db689c2028383bdd93919081900360800190a350509392505050565b600080600260009054906101000a90046001600160a01b03166001600160a01b0316636b6f4a9d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d559190612b90565b905060006064610d658382612a6e565b610d6f9086612ba9565b610d799190612bc0565b9050600080610d8786611727565b915091508115610d95578092505b60075460405163cdca175360e01b81526000916001600160a01b03169063cdca175390610dc990600c908890600401612c89565b6020604051808303816000875af1158015610de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0c9190612b90565b6003549091506001600160a01b0390811690891603610e2d57809550610eb7565b6007546001600160a01b038981166000908152600f602052604090819020905163cdca175360e01b8152919092169163cdca175391610e7191908590600401612c89565b6020604051808303816000875af1158015610e90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb49190612b90565b95505b505050505092915050565b600f6020526000908152604090208054610656906129f5565b610ee361141b565b6001600160a01b03919091166000908152601060205260409020805460ff1916911515919091179055565b6004546001600160a01b03163314610f3957604051636109bfab60e01b815260040160405180910390fd5b60115460ff16610f5c5760405163171dcfcb60e31b815260040160405180910390fd5b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610fa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc99190612b90565b6002546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015611017573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103b9190612b90565b60035460025491925061105a916001600160a01b039182169116611d1b565b600254604051636b1bcdb960e11b815260048101839052602481018490523060448201526001600160a01b039091169063d6379b72906064016020604051808303816000875af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d69190612b90565b506001546006546110f3916001600160a01b039081169116611d1b565b600654600c8054611202926001600160a01b03169190611112906129f5565b80601f016020809104026020016040519081016040528092919081815260200182805461113e906129f5565b801561118b5780601f106111605761010080835404028352916020019161118b565b820191906000526020600020905b81548152906001019060200180831161116e57829003601f168201915b50506001546040516370a0823160e01b81523060048201526001600160a01b0390911693506370a0823192506024019050602060405180830381865afa1580156111d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111fd9190612b90565b611dac565b5060008560008151811061121857611218612a58565b60200260200101518760008151811061123357611233612a58565b60200260200101516112459190612a45565b600454600354919250611265916001600160a01b03908116911683611e4b565b50506011805460ff19169055505050505050565b61128161141b565b600854604080516001600160a01b03928316815291831660208301527f190c262dc6f09322c68a13bf67c9659e58367755ba6190fa7ce5ca8aa45a877d910160405180910390a1600880546001600160a01b0319166001600160a01b0392909216919091179055565b6112f261141b565b6001600160a01b03811661135c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b611365816115d6565b50565b6001600160a01b0381166000908152600f60205260409020805460609161141591611392906129f5565b80601f01602080910402602001604051908101604052809291908181526020018280546113be906129f5565b801561140b5780601f106113e05761010080835404028352916020019161140b565b820191906000526020600020905b8154815290600101906020018083116113ee57829003601f168201915b50505050506114ca565b92915050565b6000546001600160a01b031633146107765760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611353565b61147d611e7b565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b606060006114d783611ecb565b905060006114e6826001612a45565b67ffffffffffffffff8111156114fe576114fe6127c2565b604051908082528060200260200182016040528015611527578160200160208202803683370190505b50905060005b828110156115ce5760008061154187611ef1565b50915091508184848151811061155957611559612a58565b6001600160a01b0390921660209283029190910190910152808461157e856001612a45565b8151811061158e5761158e612a58565b60200260200101906001600160a01b031690816001600160a01b0316815250506115b787611f2d565b9650505080806115c690612d1d565b91505061152d565b509392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61162e611669565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586114ad3390565b600054600160a01b900460ff16156107765760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611353565b6040516001600160a01b03808516602483015283166044820152606481018290526117219085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611f5e565b50505050565b6011546000908190610100900460ff1661174657506000928392509050565b60025460408051636b6f4a9d60e01b815290516000926001600160a01b031691636b6f4a9d9160048083019260209291908290030181865afa158015611790573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b49190612b90565b9050600060646117c48382612a6e565b6117ce9087612ba9565b6117d89190612bc0565b60075460405163cdca175360e01b81529192506000916001600160a01b039091169063cdca17539061181190600b908a90600401612c89565b6020604051808303816000875af1158015611830573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118549190612b90565b90508181111561186b576001969095509350505050565b506000958695509350505050565b600254600654611895916001600160a01b039081169116611d1b565b600654600b8054611938926001600160a01b031691906118b4906129f5565b80601f01602080910402602001604051908101604052809291908181526020018280546118e0906129f5565b801561192d5780601f106119025761010080835404028352916020019161192d565b820191906000526020600020905b81548152906001019060200180831161191057829003601f168201915b505050505083611dac565b506001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a69190612b90565b6001546006549192506119c5916001600160a01b039182169116611d1b565b600654600c80546119e4926001600160a01b031691906118b4906129f5565b505050565b6000611a08604051806040016040528060008152602001600081525090565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a759190612b90565b6003549091506001600160a01b03868116911614611adb57600354600654611aa9916001600160a01b039081169116611d1b565b6006546001600160a01b038681166000908152600f602052604090208054611ad99392909216916118b4906129f5565b505b6040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa158015611b1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b439190612b90565b925083831015611b665760405163fa6ad35560e01b815260040160405180910390fd5b670de0b6b3a7640000600d5484611b7d9190612ba9565b611b879190612bc0565b8252600e54670de0b6b3a764000090611ba09085612ba9565b611baa9190612bc0565b602083018190528251600091611bc09190612a45565b835190915015611be7576008548351611be7916001600160a01b0389811692911690611e4b565b602083015115611c11576009546020840151611c11916001600160a01b0389811692911690611e4b565b611c1b8185612a6e565b6005549094506001600160a01b0390811690871603611cfd57604051632e1a7d4d60e01b8152600481018590526001600160a01b03871690632e1a7d4d90602401600060405180830381600087803b158015611c7657600080fd5b505af1158015611c8a573d6000803e3d6000fd5b50506040516000925033915086908381818185875af1925050503d8060008114611cd0576040519150601f19603f3d011682016040523d82523d6000602084013e611cd5565b606091505b5050905080611cf757604051633d2cec6f60e21b815260040160405180910390fd5b50611d11565b611d116001600160a01b0387168886611e4b565b5050935093915050565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa158015611d67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8b9190612b90565b600003611da857611da86001600160a01b03831682600019612033565b5050565b6040805160a081018252838152306020820152428183015260608101839052600060808201819052915163c04b8d5960e01b81526001600160a01b0386169063c04b8d5990611dff908490600401612d36565b6020604051808303816000875af1158015611e1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e429190612b90565b95945050505050565b6040516001600160a01b0383166024820152604481018290526119e490849063a9059cbb60e01b906064016116ea565b600054600160a01b900460ff166107765760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611353565b6000611ed960036014612a45565b60148351611ee79190612a6e565b6114159190612bc0565b60008080611eff8482612148565b9250611f0c8460146121fc565b9050611f24611f1d60036014612a45565b8590612148565b91509193909250565b6060611415611f3e60036014612a45565b611f4a60036014612a45565b8451611f569190612a6e565b8491906122a7565b6000611fb3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123fe9092919063ffffffff16565b9050805160001480611fd4575080806020019051810190611fd49190612d8e565b6119e45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611353565b8015806120ad5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ab9190612b90565b155b6121185760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401611353565b6040516001600160a01b0383166024820152604481018290526119e490849063095ea7b360e01b906064016116ea565b600081612156816014612a45565b10156121995760405162461bcd60e51b8152602060048201526012602482015271746f416464726573735f6f766572666c6f7760701b6044820152606401611353565b6121a4826014612a45565b835110156121ec5760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401611353565b500160200151600160601b900490565b60008161220a816003612a45565b101561224c5760405162461bcd60e51b8152602060048201526011602482015270746f55696e7432345f6f766572666c6f7760781b6044820152606401611353565b612257826003612a45565b8351101561229e5760405162461bcd60e51b8152602060048201526014602482015273746f55696e7432345f6f75744f66426f756e647360601b6044820152606401611353565b50016003015190565b6060816122b581601f612a45565b10156122f45760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401611353565b826122ff8382612a45565b101561233e5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401611353565b6123488284612a45565b8451101561238c5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401611353565b6060821580156123ab57604051915060008252602082016040526123f5565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156123e45780518352602092830192016123cc565b5050858452601f01601f1916604052505b50949350505050565b606061240d8484600085612415565b949350505050565b6060824710156124765760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611353565b600080866001600160a01b031685876040516124929190612dab565b60006040518083038185875af1925050503d80600081146124cf576040519150601f19603f3d011682016040523d82523d6000602084013e6124d4565b606091505b50915091506124e5878383876124f0565b979650505050505050565b6060831561255f578251600003612558576001600160a01b0385163b6125585760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611353565b508161240d565b61240d83838151156125745781518083602001fd5b8060405162461bcd60e51b815260040161135391906125f4565b634e487b7160e01b600052600160045260246000fd5b60005b838110156125bf5781810151838201526020016125a7565b50506000910152565b600081518084526125e08160208601602086016125a4565b601f01601f19169290920160200192915050565b60208152600061260760208301846125c8565b9392505050565b6000806040838503121561262157600080fd5b50508035926020909101359150565b80356001600160a01b038116811461264757600080fd5b919050565b60008083601f84011261265e57600080fd5b50813567ffffffffffffffff81111561267657600080fd5b60208301915083602082850101111561268e57600080fd5b9250929050565b6000806000604084860312156126aa57600080fd5b6126b384612630565b9250602084013567ffffffffffffffff8111156126cf57600080fd5b6126db8682870161264c565b9497909650939450505050565b801515811461136557600080fd5b60006020828403121561270857600080fd5b8135612607816126e8565b60006020828403121561272557600080fd5b61260782612630565b60008060006060848603121561274357600080fd5b61274c84612630565b95602085013595506040909401359392505050565b6000806040838503121561277457600080fd5b61277d83612630565b946020939093013593505050565b6000806040838503121561279e57600080fd5b6127a783612630565b915060208301356127b7816126e8565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612801576128016127c2565b604052919050565b600067ffffffffffffffff821115612823576128236127c2565b5060051b60200190565b600082601f83011261283e57600080fd5b8135602061285361284e83612809565b6127d8565b82815260059290921b8401810191818101908684111561287257600080fd5b8286015b8481101561288d5780358352918301918301612876565b509695505050505050565b6000806000806000608086880312156128b057600080fd5b853567ffffffffffffffff808211156128c857600080fd5b818801915088601f8301126128dc57600080fd5b813560206128ec61284e83612809565b82815260059290921b8401810191818101908c84111561290b57600080fd5b948201945b838610156129305761292186612630565b82529482019490820190612910565b9950508901359250508082111561294657600080fd5b61295289838a0161282d565b9550604088013591508082111561296857600080fd5b61297489838a0161282d565b9450606088013591508082111561298a57600080fd5b506129978882890161264c565b969995985093965092949392505050565b6020808252825182820181905260009190848201906040850190845b818110156129e95783516001600160a01b0316835292840192918401916001016129c4565b50909695505050505050565b600181811c90821680612a0957607f821691505b602082108103612a2957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561141557611415612a2f565b634e487b7160e01b600052603260045260246000fd5b8181038181111561141557611415612a2f565b601f8211156119e457600081815260208120601f850160051c81016020861015612aa85750805b601f850160051c820191505b81811015612ac757828155600101612ab4565b505050505050565b67ffffffffffffffff831115612ae757612ae76127c2565b612afb83612af583546129f5565b83612a81565b6000601f841160018114612b2f5760008515612b175750838201355b600019600387901b1c1916600186901b178355612b89565b600083815260209020601f19861690835b82811015612b605786850135825560209485019460019092019101612b40565b5086821015612b7d5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b600060208284031215612ba257600080fd5b5051919050565b808202811582820484141761141557611415612a2f565b600082612bdd57634e487b7160e01b600052601260045260246000fd5b500490565b60006080820160018060a01b038087168452602060808186015282875480855260a0870191508860005282600020945060005b81811015612c33578554851683526001958601959284019201612c15565b5050858103604087015286518082529082019350915080860160005b83811015612c6b57815185529382019390820190600101612c4f565b50505050828103606084015260008152602081019695505050505050565b604081526000808454612c9b816129f5565b8060408601526060600180841660008114612cbd5760018114612cd757612d08565b60ff1985168884015283151560051b880183019550612d08565b8960005260208060002060005b86811015612cff5781548b8201870152908401908201612ce4565b8a018501975050505b50505050506020929092019290925292915050565b600060018201612d2f57612d2f612a2f565b5060010190565b602081526000825160a06020840152612d5260c08401826125c8565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b600060208284031215612da057600080fd5b8151612607816126e8565b60008251612dbd8184602087016125a4565b919091019291505056fea2646970667358221220a5dce498542b0217b18b44165d3ad37b2b904264ee08c11705c35367707f843464736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000095d8bf2f57cf973251972b496dc6b1d9c6b5bce3000000000000000000000000edb73d4ed90be7a49d06d0d940055e6d181d22fa000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000269ae88aa04e7b9b81f2d89263fbcd2cef1c58fc0000000000000000000000004c78d1ad9895125cd6a693a5b3aeae3c9478af0d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002bedb73d4ed90be7a49d06d0d940055e6d181d22fa00271095d8bf2f57cf973251972b496dc6b1d9c6b5bce3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b95d8bf2f57cf973251972b496dc6b1d9c6b5bce3002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _underlying (address): 0x95D8Bf2F57cf973251972b496dC6B1d9C6b5bCe3
Arg [1] : _oToken (address): 0xEdb73D4ED90bE7A49D06d0D940055e6d181d22fa
Arg [2] : _paymentToken (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [3] : _flashPool (address): 0xBA12222222228d8Ba445958a75a0704d566BF2C8
Arg [4] : _native (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [5] : _router (address): 0x269aE88Aa04E7b9b81f2d89263FbCD2CeF1c58fc
Arg [6] : _quoter (address): 0x4C78D1Ad9895125Cd6A693a5b3AeAe3C9478af0d
Arg [7] : _treasury (address): 0x0000000000000000000000000000000000000000
Arg [8] : _paths (bytes[]): System.Byte[],System.Byte[]
-----Encoded View---------------
18 Constructor Arguments found :
Arg [0] : 00000000000000000000000095d8bf2f57cf973251972b496dc6b1d9c6b5bce3
Arg [1] : 000000000000000000000000edb73d4ed90be7a49d06d0d940055e6d181d22fa
Arg [2] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [3] : 000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8
Arg [4] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [5] : 000000000000000000000000269ae88aa04e7b9b81f2d89263fbcd2cef1c58fc
Arg [6] : 0000000000000000000000004c78d1ad9895125cd6a693a5b3aeae3c9478af0d
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [11] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [12] : 000000000000000000000000000000000000000000000000000000000000002b
Arg [13] : edb73d4ed90be7a49d06d0d940055e6d181d22fa00271095d8bf2f57cf973251
Arg [14] : 972b496dc6b1d9c6b5bce3000000000000000000000000000000000000000000
Arg [15] : 000000000000000000000000000000000000000000000000000000000000002b
Arg [16] : 95d8bf2f57cf973251972b496dc6b1d9c6b5bce3002710c02aaa39b223fe8d0a
Arg [17] : 0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.