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
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
NomiswapStableSwapOnlyRouter
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity =0.8.15; import '@nominex/stable-swap/contracts/interfaces/INomiswapFactory.sol'; import '@nominex/stable-swap/contracts/interfaces/INomiswapStablePair.sol'; contract NomiswapStableSwapOnlyRouter { address public immutable stableSwapFactory; constructor(address _stableSwapFactory) { stableSwapFactory = _stableSwapFactory; } modifier ensure(uint deadline) { require(deadline >= block.timestamp, 'NomiswapRouter: EXPIRED'); _; } receive() external payable { require(msg.sender == 0x0000000000000000000000000000000000000000, 'NomiswapRouter: no payments'); // accept no ETH via fallback } function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external ensure(deadline) returns (uint[] memory) { (address[] memory pairs, uint[] memory amounts) = getAmountsOut(amountIn, path, to); require(amounts[amounts.length - 1] >= amountOutMin, 'NomiswapRouter: INSUFFICIENT_OUTPUT_AMOUNT'); safeTransferFrom(path[0], msg.sender, pairs[0], amountIn); _swap(pairs, amounts, path[0] < path[1]); return amounts; } // requires the initial amount to have already been sent to the first pair function _swap(address[] memory pairs, uint[] memory amounts, bool swapToken0) private { bytes memory data = new bytes(0); for (uint i; i < pairs.length - 1; i++) { INomiswapPair(pairs[i]).swap(swapToken0 ? 0 : amounts[i + 1], swapToken0 ? amounts[i + 1] : 0, pairs[i + 1], data); } } function getAmountsOut(uint amountIn, address[] memory path, address to) private view returns (address[] memory pairs, uint[] memory amounts) { require(path.length >= 2, 'NomiswapLibrary: INVALID_PATH'); pairs = new address[](path.length); amounts = new uint[](path.length); amounts[0] = amountIn; for (uint i; i < path.length - 1; i++) { pairs[i] = INomiswapFactory(stableSwapFactory).getPair(path[i], path[i + 1]); amounts[i + 1] = INomiswapStablePair(pairs[i]).getAmountOut(path[i], amounts[i]); } pairs[path.length - 1] = to; } function safeTransferFrom( address token, address from, address to, uint256 value ) private { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } }
// 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.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "./INomiswapPair.sol"; pragma experimental ABIEncoderV2; interface INomiswapStablePair is INomiswapPair { event RampA(uint256 oldA, uint256 newA, uint256 initialTime, uint256 futureTime); event StopRampA(uint256 A, uint256 t); function devFee() external view returns (uint128); // function burnSingle(address tokenOut, address recipient) external returns (uint256 amountOut); function getA() external view returns (uint256); function setSwapFee(uint32) external; function setDevFee(uint128) external; function rampA(uint32 _futureA, uint40 _futureTime) external; function stopRampA() external; function getAmountIn(address tokenIn, uint256 amountOut) external view returns (uint256); function getAmountOut(address tokenIn, uint256 amountIn) external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "./INomiswapERC20.sol"; interface INomiswapPair is INomiswapERC20 { event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function swapFee() external view returns (uint32); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.5.0; interface INomiswapFactory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function INIT_CODE_HASH() external view returns (bytes32); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; function setSwapFee(address pair, uint32 swapFee) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface INomiswapERC20 is IERC20Metadata { function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 1000 }, "evmVersion": "istanbul", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_stableSwapFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"stableSwapFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a060405234801561001057600080fd5b50604051610cb8380380610cb883398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610c276100916000396000818160d401526104250152610c276000f3fe60806040526004361061002d5760003560e01c806338ed17391461008c57806357c79961146100c257600080fd5b366100875733156100855760405162461bcd60e51b815260206004820152601b60248201527f4e6f6d6973776170526f757465723a206e6f207061796d656e7473000000000060448201526064015b60405180910390fd5b005b600080fd5b34801561009857600080fd5b506100ac6100a7366004610968565b61010e565b6040516100b99190610a0a565b60405180910390f35b3480156100ce57600080fd5b506100f67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100b9565b606081428110156101615760405162461bcd60e51b815260206004820152601760248201527f4e6f6d6973776170526f757465723a2045585049524544000000000000000000604482015260640161007c565b6000806101a38a8989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b925061030a915050565b915091508881600183516101b79190610a64565b815181106101c7576101c7610a7b565b602002602001015110156102435760405162461bcd60e51b815260206004820152602a60248201527f4e6f6d6973776170526f757465723a20494e53554646494349454e545f4f555460448201527f5055545f414d4f554e5400000000000000000000000000000000000000000000606482015260840161007c565b6102908888600081811061025957610259610a7b565b905060200201602081019061026e9190610a91565b338460008151811061028257610282610a7b565b60200260200101518d610687565b6102fd82828a8a60018181106102a8576102a8610a7b565b90506020020160208101906102bd9190610a91565b6001600160a01b03168b8b60008181106102d9576102d9610a7b565b90506020020160208101906102ee9190610a91565b6001600160a01b0316106107ff565b9998505050505050505050565b60608060028451101561035f5760405162461bcd60e51b815260206004820152601d60248201527f4e6f6d69737761704c6962726172793a20494e56414c49445f50415448000000604482015260640161007c565b835167ffffffffffffffff81111561037957610379610ab5565b6040519080825280602002602001820160405280156103a2578160200160208202803683370190505b509150835167ffffffffffffffff8111156103bf576103bf610ab5565b6040519080825280602002602001820160405280156103e8578160200160208202803683370190505b50905084816000815181106103ff576103ff610a7b565b60200260200101818152505060005b6001855161041c9190610a64565b81101561063e577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e6a4390586838151811061046457610464610a7b565b60200260200101518784600161047a9190610acb565b8151811061048a5761048a610a7b565b60200260200101516040518363ffffffff1660e01b81526004016104c49291906001600160a01b0392831681529116602082015260400190565b602060405180830381865afa1580156104e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105059190610ae3565b83828151811061051757610517610a7b565b60200260200101906001600160a01b031690816001600160a01b03168152505082818151811061054957610549610a7b565b60200260200101516001600160a01b031663ca706bcf86838151811061057157610571610a7b565b602002602001015184848151811061058b5761058b610a7b565b60200260200101516040518363ffffffff1660e01b81526004016105c49291906001600160a01b03929092168252602082015260400190565b602060405180830381865afa1580156105e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106059190610b00565b82610611836001610acb565b8151811061062157610621610a7b565b60209081029190910101528061063681610b19565b91505061040e565b5082826001865161064f9190610a64565b8151811061065f5761065f610a7b565b60200260200101906001600160a01b031690816001600160a01b031681525050935093915050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916107199190610b62565b6000604051808303816000865af19150503d8060008114610756576040519150601f19603f3d011682016040523d82523d6000602084013e61075b565b606091505b50915091508180156107855750805115806107855750808060200190518101906107859190610b7e565b6107f75760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c6564000000000000000000000000000000606482015260840161007c565b505050505050565b60408051600080825260208201909252905b6001855161081f9190610a64565b8110156109395784818151811061083857610838610a7b565b60200260200101516001600160a01b031663022c0d9f8461087c578561085f846001610acb565b8151811061086f5761086f610a7b565b602002602001015161087f565b60005b8561088b5760006108b0565b86610897856001610acb565b815181106108a7576108a7610a7b565b60200260200101515b886108bc866001610acb565b815181106108cc576108cc610a7b565b6020026020010151866040518563ffffffff1660e01b81526004016108f49493929190610ba0565b600060405180830381600087803b15801561090e57600080fd5b505af1158015610922573d6000803e3d6000fd5b50505050808061093190610b19565b915050610811565b5050505050565b6001600160a01b038116811461095557600080fd5b50565b803561096381610940565b919050565b60008060008060008060a0878903121561098157600080fd5b8635955060208701359450604087013567ffffffffffffffff808211156109a757600080fd5b818901915089601f8301126109bb57600080fd5b8135818111156109ca57600080fd5b8a60208260051b85010111156109df57600080fd5b6020830196508095505050506109f760608801610958565b9150608087013590509295509295509295565b6020808252825182820181905260009190848201906040850190845b81811015610a4257835183529284019291840191600101610a26565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600082821015610a7657610a76610a4e565b500390565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610aa357600080fd5b8135610aae81610940565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60008219821115610ade57610ade610a4e565b500190565b600060208284031215610af557600080fd5b8151610aae81610940565b600060208284031215610b1257600080fd5b5051919050565b600060018201610b2b57610b2b610a4e565b5060010190565b60005b83811015610b4d578181015183820152602001610b35565b83811115610b5c576000848401525b50505050565b60008251610b74818460208701610b32565b9190910192915050565b600060208284031215610b9057600080fd5b81518015158114610aae57600080fd5b8481528360208201526001600160a01b03831660408201526080606082015260008251806080840152610bda8160a0850160208701610b32565b601f01601f19169190910160a0019594505050505056fea2646970667358221220c0e7034c79dec4236c6ea895d27e217016e7456af94e4c901a9efc6b32afe98064736f6c634300080f0033000000000000000000000000818339b4e536e707f14980219037c5046b049dd4
Deployed Bytecode
0x60806040526004361061002d5760003560e01c806338ed17391461008c57806357c79961146100c257600080fd5b366100875733156100855760405162461bcd60e51b815260206004820152601b60248201527f4e6f6d6973776170526f757465723a206e6f207061796d656e7473000000000060448201526064015b60405180910390fd5b005b600080fd5b34801561009857600080fd5b506100ac6100a7366004610968565b61010e565b6040516100b99190610a0a565b60405180910390f35b3480156100ce57600080fd5b506100f67f000000000000000000000000818339b4e536e707f14980219037c5046b049dd481565b6040516001600160a01b0390911681526020016100b9565b606081428110156101615760405162461bcd60e51b815260206004820152601760248201527f4e6f6d6973776170526f757465723a2045585049524544000000000000000000604482015260640161007c565b6000806101a38a8989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b925061030a915050565b915091508881600183516101b79190610a64565b815181106101c7576101c7610a7b565b602002602001015110156102435760405162461bcd60e51b815260206004820152602a60248201527f4e6f6d6973776170526f757465723a20494e53554646494349454e545f4f555460448201527f5055545f414d4f554e5400000000000000000000000000000000000000000000606482015260840161007c565b6102908888600081811061025957610259610a7b565b905060200201602081019061026e9190610a91565b338460008151811061028257610282610a7b565b60200260200101518d610687565b6102fd82828a8a60018181106102a8576102a8610a7b565b90506020020160208101906102bd9190610a91565b6001600160a01b03168b8b60008181106102d9576102d9610a7b565b90506020020160208101906102ee9190610a91565b6001600160a01b0316106107ff565b9998505050505050505050565b60608060028451101561035f5760405162461bcd60e51b815260206004820152601d60248201527f4e6f6d69737761704c6962726172793a20494e56414c49445f50415448000000604482015260640161007c565b835167ffffffffffffffff81111561037957610379610ab5565b6040519080825280602002602001820160405280156103a2578160200160208202803683370190505b509150835167ffffffffffffffff8111156103bf576103bf610ab5565b6040519080825280602002602001820160405280156103e8578160200160208202803683370190505b50905084816000815181106103ff576103ff610a7b565b60200260200101818152505060005b6001855161041c9190610a64565b81101561063e577f000000000000000000000000818339b4e536e707f14980219037c5046b049dd46001600160a01b031663e6a4390586838151811061046457610464610a7b565b60200260200101518784600161047a9190610acb565b8151811061048a5761048a610a7b565b60200260200101516040518363ffffffff1660e01b81526004016104c49291906001600160a01b0392831681529116602082015260400190565b602060405180830381865afa1580156104e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105059190610ae3565b83828151811061051757610517610a7b565b60200260200101906001600160a01b031690816001600160a01b03168152505082818151811061054957610549610a7b565b60200260200101516001600160a01b031663ca706bcf86838151811061057157610571610a7b565b602002602001015184848151811061058b5761058b610a7b565b60200260200101516040518363ffffffff1660e01b81526004016105c49291906001600160a01b03929092168252602082015260400190565b602060405180830381865afa1580156105e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106059190610b00565b82610611836001610acb565b8151811061062157610621610a7b565b60209081029190910101528061063681610b19565b91505061040e565b5082826001865161064f9190610a64565b8151811061065f5761065f610a7b565b60200260200101906001600160a01b031690816001600160a01b031681525050935093915050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916107199190610b62565b6000604051808303816000865af19150503d8060008114610756576040519150601f19603f3d011682016040523d82523d6000602084013e61075b565b606091505b50915091508180156107855750805115806107855750808060200190518101906107859190610b7e565b6107f75760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c6564000000000000000000000000000000606482015260840161007c565b505050505050565b60408051600080825260208201909252905b6001855161081f9190610a64565b8110156109395784818151811061083857610838610a7b565b60200260200101516001600160a01b031663022c0d9f8461087c578561085f846001610acb565b8151811061086f5761086f610a7b565b602002602001015161087f565b60005b8561088b5760006108b0565b86610897856001610acb565b815181106108a7576108a7610a7b565b60200260200101515b886108bc866001610acb565b815181106108cc576108cc610a7b565b6020026020010151866040518563ffffffff1660e01b81526004016108f49493929190610ba0565b600060405180830381600087803b15801561090e57600080fd5b505af1158015610922573d6000803e3d6000fd5b50505050808061093190610b19565b915050610811565b5050505050565b6001600160a01b038116811461095557600080fd5b50565b803561096381610940565b919050565b60008060008060008060a0878903121561098157600080fd5b8635955060208701359450604087013567ffffffffffffffff808211156109a757600080fd5b818901915089601f8301126109bb57600080fd5b8135818111156109ca57600080fd5b8a60208260051b85010111156109df57600080fd5b6020830196508095505050506109f760608801610958565b9150608087013590509295509295509295565b6020808252825182820181905260009190848201906040850190845b81811015610a4257835183529284019291840191600101610a26565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600082821015610a7657610a76610a4e565b500390565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610aa357600080fd5b8135610aae81610940565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60008219821115610ade57610ade610a4e565b500190565b600060208284031215610af557600080fd5b8151610aae81610940565b600060208284031215610b1257600080fd5b5051919050565b600060018201610b2b57610b2b610a4e565b5060010190565b60005b83811015610b4d578181015183820152602001610b35565b83811115610b5c576000848401525b50505050565b60008251610b74818460208701610b32565b9190910192915050565b600060208284031215610b9057600080fd5b81518015158114610aae57600080fd5b8481528360208201526001600160a01b03831660408201526080606082015260008251806080840152610bda8160a0850160208701610b32565b601f01601f19169190910160a0019594505050505056fea2646970667358221220c0e7034c79dec4236c6ea895d27e217016e7456af94e4c901a9efc6b32afe98064736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000818339b4e536e707f14980219037c5046b049dd4
-----Decoded View---------------
Arg [0] : _stableSwapFactory (address): 0x818339b4E536E707f14980219037c5046b049dD4
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000818339b4e536e707f14980219037c5046b049dd4
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.