Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- SwapPairsGetter
- Optimization enabled
- true
- Compiler version
- v0.8.20+commit.a1b79de6
- Optimization runs
- 200
- EVM Version
- paris
- Verified at
- 2024-05-20T14:45:53.520863Z
SwapPairsGetter.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IUniswapV2Factory { function allPairs(uint) external view returns (address pair); } interface IUniswapV2Pair { function token0() external view returns (address); function token1() external view returns (address); } contract SwapPairsGetter { struct Pair { address tokenA; address tokenB; } function getAllPairs( IUniswapV2Factory factoryAddress, uint256 startIndex, uint256 endIndex ) external view returns (Pair[] memory) { address pair; Pair[] memory pairs = new Pair[](endIndex - startIndex + 1); uint256 index = 0; for (uint256 i = startIndex; i <= endIndex; i++) { Pair memory p; pair = factoryAddress.allPairs(i); p.tokenA = IUniswapV2Pair(pair).token0(); p.tokenB = IUniswapV2Pair(pair).token1(); pairs[index] = p; index++; } return pairs; } }
Compiler Settings
{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{"SwapPairsGetter.sol":{}},"evmVersion":"paris"}
Contract ABI
[{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"","internalType":"struct SwapPairsGetter.Pair[]","components":[{"type":"address","name":"tokenA","internalType":"address"},{"type":"address","name":"tokenB","internalType":"address"}]}],"name":"getAllPairs","inputs":[{"type":"address","name":"factoryAddress","internalType":"contract IUniswapV2Factory"},{"type":"uint256","name":"startIndex","internalType":"uint256"},{"type":"uint256","name":"endIndex","internalType":"uint256"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50610416806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063cfe79f8514610030575b600080fd5b61004361003e3660046102a4565b610059565b60405161005091906102d9565b60405180910390f35b6060600080610068858561034b565b610073906001610364565b67ffffffffffffffff81111561008b5761008b610377565b6040519080825280602002602001820160405280156100d057816020015b60408051808201909152600080825260208201528152602001906001900390816100a95790505b5090506000855b858111610280576040805180820190915260008082526020820152604051631e3dd18b60e01b8152600481018390526001600160a01b038a1690631e3dd18b90602401602060405180830381865afa158015610137573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015b919061038d565b9450846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561019b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101bf919061038d565b6001600160a01b0390811682526040805163d21220a760e01b815290519187169163d21220a7916004808201926020929091908290030181865afa15801561020b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022f919061038d565b6001600160a01b0316602082015283518190859085908110610253576102536103b1565b60200260200101819052508280610269906103c7565b935050508080610278906103c7565b9150506100d7565b50909695505050505050565b6001600160a01b03811681146102a157600080fd5b50565b6000806000606084860312156102b957600080fd5b83356102c48161028c565b95602085013595506040909401359392505050565b602080825282518282018190526000919060409081850190868401855b8281101561032857815180516001600160a01b03908116865290870151168685015292840192908501906001016102f6565b5091979650505050505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561035e5761035e610335565b92915050565b8082018082111561035e5761035e610335565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561039f57600080fd5b81516103aa8161028c565b9392505050565b634e487b7160e01b600052603260045260246000fd5b6000600182016103d9576103d9610335565b506001019056fea2646970667358221220d50ec416d116c14654f5b5a78984ff7d09ac211b43b7d8162551f1c4318c428064736f6c63430008140033
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063cfe79f8514610030575b600080fd5b61004361003e3660046102a4565b610059565b60405161005091906102d9565b60405180910390f35b6060600080610068858561034b565b610073906001610364565b67ffffffffffffffff81111561008b5761008b610377565b6040519080825280602002602001820160405280156100d057816020015b60408051808201909152600080825260208201528152602001906001900390816100a95790505b5090506000855b858111610280576040805180820190915260008082526020820152604051631e3dd18b60e01b8152600481018390526001600160a01b038a1690631e3dd18b90602401602060405180830381865afa158015610137573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015b919061038d565b9450846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561019b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101bf919061038d565b6001600160a01b0390811682526040805163d21220a760e01b815290519187169163d21220a7916004808201926020929091908290030181865afa15801561020b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022f919061038d565b6001600160a01b0316602082015283518190859085908110610253576102536103b1565b60200260200101819052508280610269906103c7565b935050508080610278906103c7565b9150506100d7565b50909695505050505050565b6001600160a01b03811681146102a157600080fd5b50565b6000806000606084860312156102b957600080fd5b83356102c48161028c565b95602085013595506040909401359392505050565b602080825282518282018190526000919060409081850190868401855b8281101561032857815180516001600160a01b03908116865290870151168685015292840192908501906001016102f6565b5091979650505050505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561035e5761035e610335565b92915050565b8082018082111561035e5761035e610335565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561039f57600080fd5b81516103aa8161028c565b9392505050565b634e487b7160e01b600052603260045260246000fd5b6000600182016103d9576103d9610335565b506001019056fea2646970667358221220d50ec416d116c14654f5b5a78984ff7d09ac211b43b7d8162551f1c4318c428064736f6c63430008140033