More Info
Private Name Tags
ContractCreator
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
15779606 | 840 days ago | 196.94591854 ETH | ||||
15779606 | 840 days ago | 196.94591854 ETH | ||||
15779597 | 840 days ago | 1.05189261 ETH | ||||
15779597 | 840 days ago | 1.05189261 ETH | ||||
15776492 | 840 days ago | 5.73625488 ETH | ||||
15776492 | 840 days ago | 5.73625488 ETH | ||||
15773707 | 841 days ago | 1.26606642 ETH | ||||
15773707 | 841 days ago | 1.26606642 ETH | ||||
15771776 | 841 days ago | 2.12234016 ETH | ||||
15771776 | 841 days ago | 2.12234016 ETH | ||||
15735699 | 846 days ago | 1.50355544 ETH | ||||
15735699 | 846 days ago | 1.50355544 ETH | ||||
15735653 | 846 days ago | 0.99622207 ETH | ||||
15735653 | 846 days ago | 0.99622207 ETH | ||||
15734296 | 846 days ago | 0.0531711 ETH | ||||
15734296 | 846 days ago | 0.0531711 ETH | ||||
15734287 | 846 days ago | 1.99596277 ETH | ||||
15734287 | 846 days ago | 1.99596277 ETH | ||||
15730041 | 847 days ago | 0.34318204 ETH | ||||
15730041 | 847 days ago | 0.34318204 ETH | ||||
15725291 | 847 days ago | 0.17828872 ETH | ||||
15725291 | 847 days ago | 0.17828872 ETH | ||||
15686199 | 853 days ago | 16.03479251 ETH | ||||
15686199 | 853 days ago | 16.03479251 ETH | ||||
15686188 | 853 days ago | 4.32211561 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
CurvePortalOut
Compiler Version
v0.8.11+commit.d7f03943
Contract Source Code (Solidity Standard Json-Input format)
/// Copyright (C) 2022 Portals.fi /// @author Portals.fi /// @notice This contract removes liquidity from Curve pools into any ERC20 token or the network token. /// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.11; import "../base/PortalBaseV1_1.sol"; import "./interface/ICurveAddressProvider.sol"; import "./interface/ICurvePool.sol"; import "./interface/ICurveRegistry.sol"; /// Thrown when insufficient liquidity is received after withdrawal /// @param buyAmount The amount of tokens received /// @param minBuyAmount The minimum acceptable quantity of buyAmount error InsufficientBuy(uint256 buyAmount, uint256 minBuyAmount); contract CurvePortalOut is PortalBaseV1_1 { using SafeTransferLib for address; using SafeTransferLib for ERC20; /// @notice Emitted when a portal is exited /// @param sellToken The ERC20 token address to spend (address(0) if network token) /// @param sellAmount The quantity of sellToken to Portal out /// @param buyToken The ERC20 token address to buy (address(0) if network token) /// @param buyAmount The quantity of buyToken received /// @param fee The fee in BPS /// @param sender The msg.sender /// @param partner The front end operator address event PortalOut( address sellToken, uint256 sellAmount, address buyToken, uint256 buyAmount, uint256 fee, address indexed sender, address indexed partner ); constructor( bytes32 protocolId, PortalType portalType, IPortalRegistry registry, address exchange, address wrappedNetworkToken, uint256 fee ) PortalBaseV1_1( protocolId, portalType, registry, exchange, wrappedNetworkToken, fee ) {} /// @notice Removes liquidity from Curve pools into network tokens/ERC20 tokens /// @param sellToken The curve pool token address /// @param sellAmount The quantity of sellToken to Portal out /// @param buyToken The ERC20 token address to buy (address(0) if network token) /// @param minBuyAmount The minimum quantity of buyTokens to receive. Reverts otherwise /// @param target The excecution target for the intermediate swap /// @param data The encoded call for the intermediate swap /// @param partner The front end operator address /// @param poolData Encoded pool data including the following for the pool and metapool sequentially (if applicable): /// pool The address of the swap/deposit contract (address(0) for metapool set if not metapool) /// intermediateToken The address of the token at the index /// The index of the token being removed from the pool (i.e the index of intermediateToken) /// isInt128 A boolean value specifying whether the index is int128 or uint256 /// removeUnderlying A boolean value specifying whether to withdraw the unwrapped version of the token /// @return buyAmount The quantity of buyToken acquired function portalOut( address sellToken, uint256 sellAmount, address buyToken, uint256 minBuyAmount, address target, bytes calldata data, address partner, bytes calldata poolData ) external payable pausable returns (uint256 buyAmount) { sellAmount = _transferFromCaller(sellToken, sellAmount); address intermediateToken; (sellAmount, intermediateToken) = _remove( sellToken, sellAmount, poolData ); buyAmount = _execute( intermediateToken, sellAmount, buyToken, target, data ); buyAmount = _getFeeAmount(buyAmount, fee); if (buyAmount < minBuyAmount) revert InsufficientBuy(buyAmount, minBuyAmount); buyToken == address(0) ? msg.sender.safeTransferETH(buyAmount) : ERC20(buyToken).safeTransfer(msg.sender, buyAmount); emit PortalOut( sellToken, sellAmount, buyToken, buyAmount, fee, msg.sender, partner ); } /// @notice Handles removal of tokens and parsing of pooldata for pools and metapools /// @param sellToken The curve pool token address /// @param sellAmount The quantity of sellToken to Portal out /// @param poolData Encoded pool data including the following for the pool and metapool sequentially (if applicable): /// pool The address of the swap/deposit contract (address(0) for metapool set if not metapool) /// intermediateToken The address of the token at the index /// The index of the token being removed from the pool (i.e the index of intermediateToken) /// isInt128 A boolean value specifying whether the index is int128 or uint256 /// removeUnderlying A boolean value specifying whether to withdraw the unwrapped version of the token /// @return buyAmount The quantity buyToken acquired /// @return intermediateToken The address of the intermediate token to swap to buyToken function _remove( address sellToken, uint256 sellAmount, bytes calldata poolData ) internal returns (uint256 buyAmount, address intermediateToken) { address pool; uint256 coinIndex; bool isInt128; bool removeUnderlying; ( pool, intermediateToken, coinIndex, isInt128, removeUnderlying ) = _parsePoolData(poolData, false); buyAmount = _exitCurve( sellToken, sellAmount, pool, intermediateToken, coinIndex, isInt128, removeUnderlying ); if ( keccak256(abi.encodePacked(poolData[160:180])) != keccak256(abi.encodePacked(address(0))) ) { address poolToken = intermediateToken; ( pool, intermediateToken, coinIndex, isInt128, removeUnderlying ) = _parsePoolData(poolData, true); buyAmount = _exitCurve( poolToken, buyAmount, pool, intermediateToken, coinIndex, isInt128, removeUnderlying ); } } /// @notice Removes liquidity from the pool /// @param sellToken The curve pool token address /// @param sellAmount The quantity of sellToken to Portal out /// @param pool The address of the swap/deposit contract (address(0) for metapool set if not metapool) /// @param coinIndex The index of the token being removed from the pool (i.e the index of intermediateToken) /// @param isInt128 A boolean value specifying whether the index is int128 or uint256 /// @param removeUnderlying A boolean value specifying whether to withdraw the unwrapped version of the token /// @return buyAmount The quantity buyToken acquired function _exitCurve( address sellToken, uint256 sellAmount, address pool, address buyToken, uint256 coinIndex, bool isInt128, bool removeUnderlying ) internal returns (uint256) { _approve(sellToken, pool, sellAmount); uint256 balance = _getBalance(address(this), buyToken); ICurvePool _pool = ICurvePool(pool); if (isInt128) { if (removeUnderlying) { _pool.remove_liquidity_one_coin( sellAmount, int128(uint128(coinIndex)), 0, true ); } else { _pool.remove_liquidity_one_coin( sellAmount, int128(uint128(coinIndex)), 0 ); } } else { if (removeUnderlying) { _pool.remove_liquidity_one_coin(sellAmount, coinIndex, 0, true); } else { _pool.remove_liquidity_one_coin(sellAmount, coinIndex, 0); } } return _getBalance(address(this), buyToken) - balance; } function _parsePoolData(bytes calldata poolData, bool isMetapool) internal pure returns ( address pool, address intermediateToken, uint256 coinIndex, bool isInt128, bool removeUnderlying ) { if (isMetapool) { ( , , , , , pool, intermediateToken, coinIndex, isInt128, removeUnderlying ) = abi.decode( poolData, ( address, address, uint256, bool, bool, address, address, uint256, bool, bool ) ); } else { ( pool, intermediateToken, coinIndex, isInt128, removeUnderlying, , , , , ) = abi.decode( poolData, ( address, address, uint256, bool, bool, address, address, uint256, bool, bool ) ); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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; } }
/// Copyright (C) 2022 Portals.fi /// @author Portals.fi /// @notice Base contract inherited by Portals /// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.11; import "@openzeppelin/contracts/access/Ownable.sol"; import "../libraries/solmate/utils/SafeTransferLib.sol"; import "../interface/IWETH.sol"; import "../interface/IPortalFactory.sol"; import "../interface/IPortalRegistry.sol"; abstract contract PortalBaseV1_1 is Ownable { using SafeTransferLib for address; using SafeTransferLib for ERC20; // Active status of this contract. If false, contract is active (i.e un-paused) bool public paused; // Fee in basis points (bps) uint256 public fee; // Address of the Portal Registry IPortalRegistry public registry; // Address of the exchange used for swaps address public immutable exchange; // Address of the wrapped network token (e.g. WETH, wMATIC, wFTM, wAVAX, etc.) address public immutable wrappedNetworkToken; // Circuit breaker modifier pausable() { require(!paused, "Paused"); _; } constructor( bytes32 protocolId, PortalType portalType, IPortalRegistry _registry, address _exchange, address _wrappedNetworkToken, uint256 _fee ) { wrappedNetworkToken = _wrappedNetworkToken; setFee(_fee); exchange = _exchange; registry = _registry; registry.addPortal(address(this), portalType, protocolId); transferOwnership(registry.owner()); } /// @notice Transfers tokens or the network token from the caller to this contract /// @param token The address of the token to transfer (address(0) if network token) /// @param quantity The quantity of tokens to transfer from the caller /// @dev quantity must == msg.value when token == address(0) /// @dev msg.value must == 0 when token != address(0) /// @return The quantity of tokens or network tokens transferred from the caller to this contract function _transferFromCaller(address token, uint256 quantity) internal virtual returns (uint256) { if (token == address(0)) { require( msg.value > 0 && msg.value == quantity, "Invalid quantity or msg.value" ); return msg.value; } require( quantity > 0 && msg.value == 0, "Invalid quantity or msg.value" ); ERC20(token).safeTransferFrom(msg.sender, address(this), quantity); return quantity; } /// @notice Returns the quantity of tokens or network tokens after accounting for the fee /// @param quantity The quantity of tokens to subtract the fee from /// @param feeBps The fee in basis points (BPS) /// @return The quantity of tokens or network tokens to transact with less the fee function _getFeeAmount(uint256 quantity, uint256 feeBps) internal view returns (uint256) { return registry.isPortal(msg.sender) ? quantity : quantity - (quantity * feeBps) / 10000; } /// @notice Executes swap or portal data at the target address /// @param sellToken The sell token /// @param sellAmount The quantity of sellToken (in sellToken base units) to send /// @param buyToken The buy token /// @param target The execution target for the data /// @param data The swap or portal data /// @return amountBought Quantity of buyToken acquired function _execute( address sellToken, uint256 sellAmount, address buyToken, address target, bytes memory data ) internal virtual returns (uint256 amountBought) { if (sellToken == buyToken) { return sellAmount; } if (sellToken == address(0) && buyToken == wrappedNetworkToken) { IWETH(wrappedNetworkToken).deposit{ value: sellAmount }(); return sellAmount; } if (sellToken == wrappedNetworkToken && buyToken == address(0)) { IWETH(wrappedNetworkToken).withdraw(sellAmount); return sellAmount; } uint256 valueToSend; if (sellToken == address(0)) { valueToSend = sellAmount; } else { _approve(sellToken, target, sellAmount); } uint256 initialBalance = _getBalance(address(this), buyToken); require( target == exchange || registry.isPortal(target), "Unauthorized target" ); (bool success, bytes memory returnData) = target.call{ value: valueToSend }(data); require(success, string(returnData)); amountBought = _getBalance(address(this), buyToken) - initialBalance; require(amountBought > 0, "Invalid execution"); } /// @notice Get the token or network token balance of an account /// @param account The owner of the tokens or network tokens whose balance is being queried /// @param token The address of the token (address(0) if network token) /// @return The owner's token or network token balance function _getBalance(address account, address token) internal view returns (uint256) { if (token == address(0)) { return account.balance; } else { return ERC20(token).balanceOf(account); } } /// @notice Approve a token for spending with finite allowance /// @param token The ERC20 token to approve /// @param spender The spender of the token /// @param amount The allowance to grant to the spender function _approve( address token, address spender, uint256 amount ) internal { ERC20 _token = ERC20(token); _token.safeApprove(spender, 0); _token.safeApprove(spender, amount); } /// @notice Collects tokens or network tokens from this contract /// @param tokens An array of the tokens to withdraw (address(0) if network token) function collect(address[] calldata tokens) external { address collector = registry.collector(); for (uint256 i = 0; i < tokens.length; i++) { uint256 qty; if (tokens[i] == address(0)) { qty = address(this).balance; collector.safeTransferETH(qty); } else { qty = ERC20(tokens[i]).balanceOf(address(this)); ERC20(tokens[i]).safeTransfer(collector, qty); } } } /// @dev Pause or unpause the contract function pause() external onlyOwner { paused = !paused; } /// @notice Sets the fee /// @param _fee The new fee amount between 0.06-1% function setFee(uint256 _fee) public onlyOwner { require(_fee >= 6 && _fee <= 100, "Invalid Fee"); fee = _fee; } /// @notice Updates the registry /// @param _registry The address of the new registry function updateRegistry(IPortalRegistry _registry) external onlyOwner { registry = _registry; } /// @notice Reverts if networks tokens are sent directly to this contract receive() external payable { require(msg.sender != tx.origin); } }
/// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.11; interface ICurveAddressProvider { function get_registry() external view returns (address); function get_address(uint256 _id) external view returns (address); }
/// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.11; interface ICurvePool { function add_liquidity(uint256[2] memory _amounts, uint256 _min_mint_amount) external payable; function add_liquidity( uint256[2] memory _amounts, uint256 _min_mint_amount, bool _use_underlying ) external payable; function add_liquidity(uint256[3] memory _amounts, uint256 _min_mint_amount) external payable; function add_liquidity( uint256[3] memory _amounts, uint256 _min_mint_amount, bool _use_underlying ) external payable; function add_liquidity(uint256[4] memory _amounts, uint256 _min_mint_amount) external payable; function add_liquidity( uint256[4] memory _amounts, uint256 _min_mint_amount, bool _use_underlying ) external payable; function coins(uint256 i) external view returns (address); function remove_liquidity_one_coin( uint256 _token_amount, int128 i, uint256 min_amount ) external; function remove_liquidity_one_coin( uint256 token_amount, uint256 i, uint256 min_amount ) external; function remove_liquidity_one_coin( uint256 token_amount, uint256 i, uint256 min_amount, bool _use_underlying ) external; function remove_liquidity_one_coin( uint256 token_amount, int128 i, uint256 min_amount, bool _use_underlying ) external; }
/// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.11; interface ICurveRegistry { function get_coins(address _pool) external view returns (address[8] memory); function get_n_coins(address _pool) external view returns (uint256); }
/// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.11; import "./IPortalRegistry.sol"; interface IPortalFactory { function fee() external view returns (uint256 fee); function registry() external view returns (IPortalRegistry registry); }
/// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.11; enum PortalType { IN, OUT } interface IPortalRegistry { function addPortal( address portal, PortalType portalType, bytes32 protocolId ) external; function addPortalFactory( address portalFactory, PortalType portalType, bytes32 protocolId ) external; function removePortal(bytes32 protocolId, PortalType portalType) external; function owner() external view returns (address owner); function registrars(address origin) external view returns (bool isDeployer); function collector() external view returns (address collector); function isPortal(address portal) external view returns (bool isPortal); }
/// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.11; interface IWETH { function deposit() external payable; function withdraw(uint256 wad) external; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval( address indexed owner, address indexed spender, uint256 amount ); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require( recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER" ); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; import { ERC20 } from "../tokens/ERC20.sol"; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. /// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller. library SafeTransferLib { event Debug(bool one, bool two, uint256 retsize); /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } require(success, "ETH_TRANSFER_FAILED"); } /*////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore( freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000 ) mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument. mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or( and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize()) ), // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 100, 0, 32) ) } require(success, "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore( freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000 ) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or( and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize()) ), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore( freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000 ) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or( and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize()) ), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "APPROVE_FAILED"); } }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 1000 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"bytes32","name":"protocolId","type":"bytes32"},{"internalType":"enum PortalType","name":"portalType","type":"uint8"},{"internalType":"contract IPortalRegistry","name":"registry","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"wrappedNetworkToken","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"buyAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"}],"name":"InsufficientBuy","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":"sellToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"sellAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"buyToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"buyAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"partner","type":"address"}],"name":"PortalOut","type":"event"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"collect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exchange","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[{"internalType":"address","name":"sellToken","type":"address"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"address","name":"buyToken","type":"address"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"bytes","name":"poolData","type":"bytes"}],"name":"portalOut","outputs":[{"internalType":"uint256","name":"buyAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract IPortalRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPortalRegistry","name":"_registry","type":"address"}],"name":"updateRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrappedNetworkToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60c06040523480156200001157600080fd5b5060405162001ea238038062001ea283398101604081905262000034916200033b565b858585858585620000453362000172565b6001600160a01b03821660a0526200005d81620001c2565b6001600160a01b03838116608052600280546001600160a01b031916918616918217905560405163dc54e91360e01b815263dc54e91390620000a890309089908b90600401620003ba565b600060405180830381600087803b158015620000c357600080fd5b505af1158015620000d8573d6000803e3d6000fd5b5050505062000160600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000134573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200015a9190620003fa565b62000265565b50505050505050505050505062000421565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b03163314620002115760405162461bcd60e51b8152602060048201819052602482015260008051602062001e8283398151915260448201526064015b60405180910390fd5b6006811015801562000224575060648111155b620002605760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642046656560a81b604482015260640162000208565b600155565b6000546001600160a01b03163314620002b05760405162461bcd60e51b8152602060048201819052602482015260008051602062001e82833981519152604482015260640162000208565b6001600160a01b038116620003175760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000208565b620003228162000172565b50565b6001600160a01b03811681146200032257600080fd5b60008060008060008060c087890312156200035557600080fd5b865195506020870151600281106200036c57600080fd5b60408801519095506200037f8162000325565b6060880151909450620003928162000325565b6080880151909350620003a58162000325565b8092505060a087015190509295509295509295565b6001600160a01b03841681526060810160028410620003e957634e487b7160e01b600052602160045260246000fd5b602082019390935260400152919050565b6000602082840312156200040d57600080fd5b81516200041a8162000325565b9392505050565b60805160a051611a186200046a6000396000818161010101528181610cbf01528181610cfa01528181610d760152610df001526000818161026c0152610e8e0152611a186000f3fe6080604052600436106100d65760003560e01c80638456cb591161007f578063b1f734e311610059578063b1f734e314610239578063d2f7265a1461025a578063ddca3f431461028e578063f2fde38b146102a457600080fd5b80638456cb59146101e65780638da5cb5b146101fb578063a4520aee1461021957600080fd5b806369fe0e2d116100b057806369fe0e2d14610191578063715018a6146101b15780637b103999146101c657600080fd5b8063041bf7bc146100ef5780631a5da6c8146101405780635c975abb1461016057600080fd5b366100ea57333214156100e857600080fd5b005b600080fd5b3480156100fb57600080fd5b506101237f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014c57600080fd5b506100e861015b3660046115a8565b6102c4565b34801561016c57600080fd5b5060005461018190600160a01b900460ff1681565b6040519015158152602001610137565b34801561019d57600080fd5b506100e86101ac3660046115c5565b610352565b3480156101bd57600080fd5b506100e861040f565b3480156101d257600080fd5b50600254610123906001600160a01b031681565b3480156101f257600080fd5b506100e8610475565b34801561020757600080fd5b506000546001600160a01b0316610123565b34801561022557600080fd5b506100e86102343660046115de565b61050b565b61024c61024736600461169c565b6106da565b604051908152602001610137565b34801561026657600080fd5b506101237f000000000000000000000000000000000000000000000000000000000000000081565b34801561029a57600080fd5b5061024c60015481565b3480156102b057600080fd5b506100e86102bf3660046115a8565b610893565b6000546001600160a01b031633146103235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b031633146103ac5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b600681101580156103be575060648111155b61040a5760405162461bcd60e51b815260206004820152600b60248201527f496e76616c696420466565000000000000000000000000000000000000000000604482015260640161031a565b600155565b6000546001600160a01b031633146104695760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b6104736000610975565b565b6000546001600160a01b031633146104cf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff8116600160a01b9182900460ff1615909102179055565b600254604080517f913e77ad00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163913e77ad9160048083019260209291908290030181865afa15801561056e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610592919061176f565b905060005b828110156106d4576000808585848181106105b4576105b461178c565b90506020020160208101906105c991906115a8565b6001600160a01b031614156105f25750476105ed6001600160a01b038416826109d2565b6106c1565b8484838181106106045761060461178c565b905060200201602081019061061991906115a8565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa15801561065f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068391906117a2565b90506106c1838287878681811061069c5761069c61178c565b90506020020160208101906106b191906115a8565b6001600160a01b03169190610a32565b50806106cc816117d1565b915050610597565b50505050565b60008054600160a01b900460ff16156107355760405162461bcd60e51b815260206004820152600660248201527f5061757365640000000000000000000000000000000000000000000000000000604482015260640161031a565b61073f8b8b610ad1565b9950600061074f8c8c8686610bbb565b809250819c50505061079a818c8c8b8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610c8892505050565b91506107a88260015461107a565b9150888210156107ee576040517fc634b00600000000000000000000000000000000000000000000000000000000815260048101839052602481018a905260440161031a565b6001600160a01b038a1615610816576108116001600160a01b038b163384610a32565b610820565b61082033836109d2565b600154604080516001600160a01b038f81168252602082018f90528d81168284015260608201869052608082019390935290519187169133917fc47af4cbc46aeb20a42e91e06b2a5d5e5a07d8e7ccf66f6abb0faf468ee59c7b919081900360a00190a3509a9950505050505050505050565b6000546001600160a01b031633146108ed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b6001600160a01b0381166109695760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161031a565b61097281610975565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080600080600085875af1905080610a2d5760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c454400000000000000000000000000604482015260640161031a565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d11600160005114161716915050806106d45760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c45440000000000000000000000000000000000604482015260640161031a565b60006001600160a01b038316610b4357600034118015610af057508134145b610b3c5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207175616e74697479206f72206d73672e76616c7565000000604482015260640161031a565b5034610bb5565b600082118015610b51575034155b610b9d5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207175616e74697479206f72206d73672e76616c7565000000604482015260640161031a565b610bb26001600160a01b03841633308561111a565b50805b92915050565b600080600080600080610bd0888860006111c6565b92985092965094509092509050610bec8a8a8688878787611222565b6040516000602082015290965060340160408051601f198184030181529190528051602090910120610c2260b460a08a8c6117ec565b604051602001610c33929190611816565b6040516020818303038152906040528051906020012014610c7b5784610c5b898960016111c6565b92995092975095509093509150610c7781888789888888611222565b9650505b5050505094509492505050565b6000836001600160a01b0316866001600160a01b03161415610cab575083611071565b6001600160a01b038616158015610cf357507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316145b15610d74577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d5357600080fd5b505af1158015610d67573d6000803e3d6000fd5b5050505050849050611071565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b0316148015610dbc57506001600160a01b038416155b15610e5c576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018690527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610e3c57600080fd5b505af1158015610e50573d6000803e3d6000fd5b50505050849050611071565b60006001600160a01b038716610e73575084610e7e565b610e7e878588611438565b6000610e8a3087611462565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316856001600160a01b03161480610f3557506002546040516313eb467160e01b81526001600160a01b038781166004830152909116906313eb467190602401602060405180830381865afa158015610f11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f359190611834565b610f815760405162461bcd60e51b815260206004820152601360248201527f556e617574686f72697a65642074617267657400000000000000000000000000604482015260640161031a565b600080866001600160a01b03168487604051610f9d919061187d565b60006040518083038185875af1925050503d8060008114610fda576040519150601f19603f3d011682016040523d82523d6000602084013e610fdf565b606091505b50915091508181906110045760405162461bcd60e51b815260040161031a9190611899565b5082611010308a611462565b61101a91906118cc565b94506000851161106c5760405162461bcd60e51b815260206004820152601160248201527f496e76616c696420657865637574696f6e000000000000000000000000000000604482015260640161031a565b505050505b95945050505050565b6002546040516313eb467160e01b81523360048201526000916001600160a01b0316906313eb467190602401602060405180830381865afa1580156110c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e79190611834565b611111576127106110f883856118e3565b6111029190611902565b61110c90846118cc565b611113565b825b9392505050565b60006040517f23b872dd0000000000000000000000000000000000000000000000000000000081528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806111bf5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c4544000000000000000000000000604482015260640161031a565b5050505050565b600080600080600085156111f7576111e087890189611924565b939d50919b50995097509550611217945050505050565b61120387890189611924565b50979c50959a509398509196509450505050505b939792965093509350565b600061122f888789611438565b600061123b3087611462565b90508684156113325783156112db576040517f517a55a3000000000000000000000000000000000000000000000000000000008152600481018a9052600f87900b602482015260006044820152600160648201526001600160a01b0382169063517a55a3906084015b600060405180830381600087803b1580156112be57600080fd5b505af11580156112d2573d6000803e3d6000fd5b50505050611415565b6040517f1a4d01d2000000000000000000000000000000000000000000000000000000008152600481018a9052600f87900b6024820152600060448201526001600160a01b03821690631a4d01d2906064016112a4565b8315611393576040517f8f15b6b5000000000000000000000000000000000000000000000000000000008152600481018a90526024810187905260006044820152600160648201526001600160a01b03821690638f15b6b5906084016112a4565b6040517ff1dc3cc9000000000000000000000000000000000000000000000000000000008152600481018a905260248101879052600060448201526001600160a01b0382169063f1dc3cc990606401600060405180830381600087803b1580156113fc57600080fd5b505af1158015611410573d6000803e3d6000fd5b505050505b816114203089611462565b61142a91906118cc565b9a9950505050505050505050565b8261144e6001600160a01b0382168460006114f4565b6106d46001600160a01b03821684846114f4565b60006001600160a01b03821661148357506001600160a01b03821631610bb5565b6040516370a0823160e01b81526001600160a01b0384811660048301528316906370a0823190602401602060405180830381865afa1580156114c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ed91906117a2565b9050610bb5565b60006040517f095ea7b3000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d11600160005114161716915050806106d45760405162461bcd60e51b815260206004820152600e60248201527f415050524f56455f4641494c4544000000000000000000000000000000000000604482015260640161031a565b6001600160a01b038116811461097257600080fd5b6000602082840312156115ba57600080fd5b813561111381611593565b6000602082840312156115d757600080fd5b5035919050565b600080602083850312156115f157600080fd5b823567ffffffffffffffff8082111561160957600080fd5b818501915085601f83011261161d57600080fd5b81358181111561162c57600080fd5b8660208260051b850101111561164157600080fd5b60209290920196919550909350505050565b60008083601f84011261166557600080fd5b50813567ffffffffffffffff81111561167d57600080fd5b60208301915083602082850101111561169557600080fd5b9250929050565b6000806000806000806000806000806101008b8d0312156116bc57600080fd5b8a356116c781611593565b995060208b0135985060408b01356116de81611593565b975060608b0135965060808b01356116f581611593565b955060a08b013567ffffffffffffffff8082111561171257600080fd5b61171e8e838f01611653565b909750955060c08d0135915061173382611593565b90935060e08c0135908082111561174957600080fd5b506117568d828e01611653565b915080935050809150509295989b9194979a5092959850565b60006020828403121561178157600080fd5b815161111381611593565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156117b457600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156117e5576117e56117bb565b5060010190565b600080858511156117fc57600080fd5b8386111561180957600080fd5b5050820193919092039150565b8183823760009101908152919050565b801515811461097257600080fd5b60006020828403121561184657600080fd5b815161111381611826565b60005b8381101561186c578181015183820152602001611854565b838111156106d45750506000910152565b6000825161188f818460208701611851565b9190910192915050565b60208152600082518060208401526118b8816040850160208701611851565b601f01601f19169190910160400192915050565b6000828210156118de576118de6117bb565b500390565b60008160001904831182151516156118fd576118fd6117bb565b500290565b60008261191f57634e487b7160e01b600052601260045260246000fd5b500490565b6000806000806000806000806000806101408b8d03121561194457600080fd5b8a3561194f81611593565b995060208b013561195f81611593565b985060408b0135975060608b013561197681611826565b965060808b013561198681611826565b955060a08b013561199681611593565b945060c08b01356119a681611593565b935060e08b013592506101008b01356119be81611826565b91506101208b01356119cf81611826565b809150509295989b9194979a509295985056fea2646970667358221220b7428c61c2cd2eb91f7941d425dca837685cfea39f7b9775fe59a51362d4c4eb64736f6c634300080b00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657263757276650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000ea49d02c248b357b99670d9e9741f54f72df9cb3000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000001e
Deployed Bytecode
0x6080604052600436106100d65760003560e01c80638456cb591161007f578063b1f734e311610059578063b1f734e314610239578063d2f7265a1461025a578063ddca3f431461028e578063f2fde38b146102a457600080fd5b80638456cb59146101e65780638da5cb5b146101fb578063a4520aee1461021957600080fd5b806369fe0e2d116100b057806369fe0e2d14610191578063715018a6146101b15780637b103999146101c657600080fd5b8063041bf7bc146100ef5780631a5da6c8146101405780635c975abb1461016057600080fd5b366100ea57333214156100e857600080fd5b005b600080fd5b3480156100fb57600080fd5b506101237f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014c57600080fd5b506100e861015b3660046115a8565b6102c4565b34801561016c57600080fd5b5060005461018190600160a01b900460ff1681565b6040519015158152602001610137565b34801561019d57600080fd5b506100e86101ac3660046115c5565b610352565b3480156101bd57600080fd5b506100e861040f565b3480156101d257600080fd5b50600254610123906001600160a01b031681565b3480156101f257600080fd5b506100e8610475565b34801561020757600080fd5b506000546001600160a01b0316610123565b34801561022557600080fd5b506100e86102343660046115de565b61050b565b61024c61024736600461169c565b6106da565b604051908152602001610137565b34801561026657600080fd5b506101237f000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff81565b34801561029a57600080fd5b5061024c60015481565b3480156102b057600080fd5b506100e86102bf3660046115a8565b610893565b6000546001600160a01b031633146103235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b031633146103ac5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b600681101580156103be575060648111155b61040a5760405162461bcd60e51b815260206004820152600b60248201527f496e76616c696420466565000000000000000000000000000000000000000000604482015260640161031a565b600155565b6000546001600160a01b031633146104695760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b6104736000610975565b565b6000546001600160a01b031633146104cf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff8116600160a01b9182900460ff1615909102179055565b600254604080517f913e77ad00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163913e77ad9160048083019260209291908290030181865afa15801561056e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610592919061176f565b905060005b828110156106d4576000808585848181106105b4576105b461178c565b90506020020160208101906105c991906115a8565b6001600160a01b031614156105f25750476105ed6001600160a01b038416826109d2565b6106c1565b8484838181106106045761060461178c565b905060200201602081019061061991906115a8565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa15801561065f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068391906117a2565b90506106c1838287878681811061069c5761069c61178c565b90506020020160208101906106b191906115a8565b6001600160a01b03169190610a32565b50806106cc816117d1565b915050610597565b50505050565b60008054600160a01b900460ff16156107355760405162461bcd60e51b815260206004820152600660248201527f5061757365640000000000000000000000000000000000000000000000000000604482015260640161031a565b61073f8b8b610ad1565b9950600061074f8c8c8686610bbb565b809250819c50505061079a818c8c8b8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610c8892505050565b91506107a88260015461107a565b9150888210156107ee576040517fc634b00600000000000000000000000000000000000000000000000000000000815260048101839052602481018a905260440161031a565b6001600160a01b038a1615610816576108116001600160a01b038b163384610a32565b610820565b61082033836109d2565b600154604080516001600160a01b038f81168252602082018f90528d81168284015260608201869052608082019390935290519187169133917fc47af4cbc46aeb20a42e91e06b2a5d5e5a07d8e7ccf66f6abb0faf468ee59c7b919081900360a00190a3509a9950505050505050505050565b6000546001600160a01b031633146108ed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b6001600160a01b0381166109695760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161031a565b61097281610975565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080600080600085875af1905080610a2d5760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c454400000000000000000000000000604482015260640161031a565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d11600160005114161716915050806106d45760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c45440000000000000000000000000000000000604482015260640161031a565b60006001600160a01b038316610b4357600034118015610af057508134145b610b3c5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207175616e74697479206f72206d73672e76616c7565000000604482015260640161031a565b5034610bb5565b600082118015610b51575034155b610b9d5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207175616e74697479206f72206d73672e76616c7565000000604482015260640161031a565b610bb26001600160a01b03841633308561111a565b50805b92915050565b600080600080600080610bd0888860006111c6565b92985092965094509092509050610bec8a8a8688878787611222565b6040516000602082015290965060340160408051601f198184030181529190528051602090910120610c2260b460a08a8c6117ec565b604051602001610c33929190611816565b6040516020818303038152906040528051906020012014610c7b5784610c5b898960016111c6565b92995092975095509093509150610c7781888789888888611222565b9650505b5050505094509492505050565b6000836001600160a01b0316866001600160a01b03161415610cab575083611071565b6001600160a01b038616158015610cf357507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316846001600160a01b0316145b15610d74577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d5357600080fd5b505af1158015610d67573d6000803e3d6000fd5b5050505050849050611071565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316866001600160a01b0316148015610dbc57506001600160a01b038416155b15610e5c576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018690527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610e3c57600080fd5b505af1158015610e50573d6000803e3d6000fd5b50505050849050611071565b60006001600160a01b038716610e73575084610e7e565b610e7e878588611438565b6000610e8a3087611462565b90507f000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff6001600160a01b0316856001600160a01b03161480610f3557506002546040516313eb467160e01b81526001600160a01b038781166004830152909116906313eb467190602401602060405180830381865afa158015610f11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f359190611834565b610f815760405162461bcd60e51b815260206004820152601360248201527f556e617574686f72697a65642074617267657400000000000000000000000000604482015260640161031a565b600080866001600160a01b03168487604051610f9d919061187d565b60006040518083038185875af1925050503d8060008114610fda576040519150601f19603f3d011682016040523d82523d6000602084013e610fdf565b606091505b50915091508181906110045760405162461bcd60e51b815260040161031a9190611899565b5082611010308a611462565b61101a91906118cc565b94506000851161106c5760405162461bcd60e51b815260206004820152601160248201527f496e76616c696420657865637574696f6e000000000000000000000000000000604482015260640161031a565b505050505b95945050505050565b6002546040516313eb467160e01b81523360048201526000916001600160a01b0316906313eb467190602401602060405180830381865afa1580156110c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e79190611834565b611111576127106110f883856118e3565b6111029190611902565b61110c90846118cc565b611113565b825b9392505050565b60006040517f23b872dd0000000000000000000000000000000000000000000000000000000081528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806111bf5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c4544000000000000000000000000604482015260640161031a565b5050505050565b600080600080600085156111f7576111e087890189611924565b939d50919b50995097509550611217945050505050565b61120387890189611924565b50979c50959a509398509196509450505050505b939792965093509350565b600061122f888789611438565b600061123b3087611462565b90508684156113325783156112db576040517f517a55a3000000000000000000000000000000000000000000000000000000008152600481018a9052600f87900b602482015260006044820152600160648201526001600160a01b0382169063517a55a3906084015b600060405180830381600087803b1580156112be57600080fd5b505af11580156112d2573d6000803e3d6000fd5b50505050611415565b6040517f1a4d01d2000000000000000000000000000000000000000000000000000000008152600481018a9052600f87900b6024820152600060448201526001600160a01b03821690631a4d01d2906064016112a4565b8315611393576040517f8f15b6b5000000000000000000000000000000000000000000000000000000008152600481018a90526024810187905260006044820152600160648201526001600160a01b03821690638f15b6b5906084016112a4565b6040517ff1dc3cc9000000000000000000000000000000000000000000000000000000008152600481018a905260248101879052600060448201526001600160a01b0382169063f1dc3cc990606401600060405180830381600087803b1580156113fc57600080fd5b505af1158015611410573d6000803e3d6000fd5b505050505b816114203089611462565b61142a91906118cc565b9a9950505050505050505050565b8261144e6001600160a01b0382168460006114f4565b6106d46001600160a01b03821684846114f4565b60006001600160a01b03821661148357506001600160a01b03821631610bb5565b6040516370a0823160e01b81526001600160a01b0384811660048301528316906370a0823190602401602060405180830381865afa1580156114c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ed91906117a2565b9050610bb5565b60006040517f095ea7b3000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d11600160005114161716915050806106d45760405162461bcd60e51b815260206004820152600e60248201527f415050524f56455f4641494c4544000000000000000000000000000000000000604482015260640161031a565b6001600160a01b038116811461097257600080fd5b6000602082840312156115ba57600080fd5b813561111381611593565b6000602082840312156115d757600080fd5b5035919050565b600080602083850312156115f157600080fd5b823567ffffffffffffffff8082111561160957600080fd5b818501915085601f83011261161d57600080fd5b81358181111561162c57600080fd5b8660208260051b850101111561164157600080fd5b60209290920196919550909350505050565b60008083601f84011261166557600080fd5b50813567ffffffffffffffff81111561167d57600080fd5b60208301915083602082850101111561169557600080fd5b9250929050565b6000806000806000806000806000806101008b8d0312156116bc57600080fd5b8a356116c781611593565b995060208b0135985060408b01356116de81611593565b975060608b0135965060808b01356116f581611593565b955060a08b013567ffffffffffffffff8082111561171257600080fd5b61171e8e838f01611653565b909750955060c08d0135915061173382611593565b90935060e08c0135908082111561174957600080fd5b506117568d828e01611653565b915080935050809150509295989b9194979a5092959850565b60006020828403121561178157600080fd5b815161111381611593565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156117b457600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156117e5576117e56117bb565b5060010190565b600080858511156117fc57600080fd5b8386111561180957600080fd5b5050820193919092039150565b8183823760009101908152919050565b801515811461097257600080fd5b60006020828403121561184657600080fd5b815161111381611826565b60005b8381101561186c578181015183820152602001611854565b838111156106d45750506000910152565b6000825161188f818460208701611851565b9190910192915050565b60208152600082518060208401526118b8816040850160208701611851565b601f01601f19169190910160400192915050565b6000828210156118de576118de6117bb565b500390565b60008160001904831182151516156118fd576118fd6117bb565b500290565b60008261191f57634e487b7160e01b600052601260045260246000fd5b500490565b6000806000806000806000806000806101408b8d03121561194457600080fd5b8a3561194f81611593565b995060208b013561195f81611593565b985060408b0135975060608b013561197681611826565b965060808b013561198681611826565b955060a08b013561199681611593565b945060c08b01356119a681611593565b935060e08b013592506101008b01356119be81611826565b91506101208b01356119cf81611826565b809150509295989b9194979a509295985056fea2646970667358221220b7428c61c2cd2eb91f7941d425dca837685cfea39f7b9775fe59a51362d4c4eb64736f6c634300080b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
63757276650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000ea49d02c248b357b99670d9e9741f54f72df9cb3000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000001e
-----Decoded View---------------
Arg [0] : protocolId (bytes32): 0x6375727665000000000000000000000000000000000000000000000000000000
Arg [1] : portalType (uint8): 1
Arg [2] : registry (address): 0xEa49D02c248b357B99670d9E9741F54f72dF9Cb3
Arg [3] : exchange (address): 0xDef1C0ded9bec7F1a1670819833240f027b25EfF
Arg [4] : wrappedNetworkToken (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [5] : fee (uint256): 30
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 6375727665000000000000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [2] : 000000000000000000000000ea49d02c248b357b99670d9e9741f54f72df9cb3
Arg [3] : 000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff
Arg [4] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [5] : 000000000000000000000000000000000000000000000000000000000000001e
Loading...
Loading
Loading...
Loading
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.