false
false

Contract Address Details

0x7DCc096Adf6b80F106AcCF9133A095FA277d6714

Contract Name
SwapPathRegistry
Creator
0x9ab7a2–138be3 at 0x071f76–9ffa02
Balance
0 KCS
Tokens
Fetching tokens...
Transactions
182 Transactions
Transfers
0 Transfers
Gas Used
6,030,139
Last Balance Update
44853215
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
SwapPathRegistry




Optimization enabled
true
Compiler version
v0.6.12+commit.27d51765




Optimization runs
200
EVM Version
default




Verified at
2022-04-05T20:32:32.784460Z

Constructor Arguments

0x608060405234801561001057600080fd5b50600061001b61006a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006e565b3390565b6108b88061007d6000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063481b920c14610067578063715018a6146100ef5780638da5cb5b146100f9578063975107c41461011d578063c3787e6014610159578063f2fde38b146101ea575b600080fd5b61009f6004803603606081101561007d57600080fd5b506001600160a01b038135811691602081013582169160409091013516610210565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156100db5781810151838201526020016100c3565b505050509050019250505060405180910390f35b6100f761029e565b005b610101610352565b604080516001600160a01b039092168252519081900360200190f35b6101016004803603608081101561013357600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135610361565b6100f76004803603608081101561016f57600080fd5b6001600160a01b03823581169260208101358216926040820135909216918101906080810160608201356401000000008111156101ab57600080fd5b8201836020820111156101bd57600080fd5b803590602001918460208302840111640100000000831117156101df57600080fd5b5090925090506103b0565b6100f76004803603602081101561020057600080fd5b50356001600160a01b03166106a7565b6001600160a01b0380841660009081526001602090815260408083208685168452825280832093851683529281529082902080548351818402810184019094528084526060939283018282801561029057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610272575b505050505090509392505050565b6102a66107b1565b6000546001600160a01b03908116911614610308576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6001602052836000526040600020602052826000526040600020602052816000526040600020818154811061039257fe5b6000918252602090912001546001600160a01b031693508492505050565b6103b86107b1565b6000546001600160a01b0390811691161461041a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03841661046c576040805162461bcd60e51b815260206004820152601460248201527314dc98c81d1bdad95b881a5cc81a5b9d985b1a5960621b604482015290519081900360640190fd5b6001600160a01b0383166104be576040805162461bcd60e51b8152602060048201526014602482015273111cdd081d1bdad95b881a5cc81a5b9d985b1a5960621b604482015290519081900360640190fd5b826001600160a01b0316846001600160a01b0316141561050f5760405162461bcd60e51b81526004018080602001828103825260258152602001806108386025913960400191505060405180910390fd5b6001600160a01b03851661055e576040805162461bcd60e51b8152602060048201526011602482015270149bdd5d195c881a5cc81a5b9d985b1a59607a1b604482015290519081900360640190fd5b836001600160a01b03168282600081811061057557fe5b905060200201356001600160a01b03166001600160a01b0316146105e0576040805162461bcd60e51b815260206004820152601f60248201527f526f757465206d75737420737461727420776974682073726320746f6b656e00604482015290519081900360640190fd5b6001600160a01b038316828260001981018181106105fa57fe5b905060200201356001600160a01b03166001600160a01b031614610665576040805162461bcd60e51b815260206004820152601d60248201527f526f757465206d75737420656e6420776974682064737420746f6b656e000000604482015290519081900360640190fd5b6001600160a01b0380861660009081526001602090815260408083208885168452825280832093871683529290522061069f9083836107b5565b505050505050565b6106af6107b1565b6000546001600160a01b03908116911614610711576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107565760405162461bcd60e51b815260040180806020018281038252602681526020018061085d6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b828054828255906000526020600020908101928215610808579160200282015b828111156108085781546001600160a01b0319166001600160a01b038435161782556020909201916001909101906107d5565b50610814929150610818565b5090565b5b808211156108145780546001600160a01b031916815560010161081956fe53726320746f6b656e206d75737420626520646966662066726f6d2044737420746f6b656e4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220c9a660e437ff1811eeaa633ed277d4e993991be37c87a8544270f94dc937520264736f6c634300060c0033
              

Contract source code

// Sources flattened with hardhat v2.4.3 https://hardhat.org

// File @openzeppelin/contracts/GSN/[email protected]

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}


// File @openzeppelin/contracts/access/[email protected]



pragma solidity ^0.6.0;

/**
 * @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.
 */
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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}


// File contracts/SwapPathRegistry.sol

pragma solidity >=0.6.0;
contract SwapPathRegistry is Ownable {
    // router -> from -> to
    mapping(address => mapping(address => mapping(address => address[]))) public routes;

    function addRoute(
        address _router,
        address _from,
        address _to,
        address[] calldata path
    ) external onlyOwner {
        require(_from != address(0), "Src token is invalid");
        require(_to != address(0), "Dst token is invalid");
        require(_from != _to, "Src token must be diff from Dst token");
        require(_router != address(0), "Router is invalid");
        require(path[0] == _from, "Route must start with src token");
        require(path[path.length - 1] == _to, "Route must end with dst token");
        routes[_router][_from][_to] = path;
    }

    function getSwapRoute(address _router, address _fromToken, address _toToken)
        external
        view
        returns (address[] memory _path)
    {
        _path = routes[_router][_fromToken][_toToken];
    }
}
        

Contract ABI

[{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addRoute","inputs":[{"type":"address","name":"_router","internalType":"address"},{"type":"address","name":"_from","internalType":"address"},{"type":"address","name":"_to","internalType":"address"},{"type":"address[]","name":"path","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"_path","internalType":"address[]"}],"name":"getSwapRoute","inputs":[{"type":"address","name":"_router","internalType":"address"},{"type":"address","name":"_fromToken","internalType":"address"},{"type":"address","name":"_toToken","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"routes","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50600061001b61006a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006e565b3390565b6108b88061007d6000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063481b920c14610067578063715018a6146100ef5780638da5cb5b146100f9578063975107c41461011d578063c3787e6014610159578063f2fde38b146101ea575b600080fd5b61009f6004803603606081101561007d57600080fd5b506001600160a01b038135811691602081013582169160409091013516610210565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156100db5781810151838201526020016100c3565b505050509050019250505060405180910390f35b6100f761029e565b005b610101610352565b604080516001600160a01b039092168252519081900360200190f35b6101016004803603608081101561013357600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135610361565b6100f76004803603608081101561016f57600080fd5b6001600160a01b03823581169260208101358216926040820135909216918101906080810160608201356401000000008111156101ab57600080fd5b8201836020820111156101bd57600080fd5b803590602001918460208302840111640100000000831117156101df57600080fd5b5090925090506103b0565b6100f76004803603602081101561020057600080fd5b50356001600160a01b03166106a7565b6001600160a01b0380841660009081526001602090815260408083208685168452825280832093851683529281529082902080548351818402810184019094528084526060939283018282801561029057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610272575b505050505090509392505050565b6102a66107b1565b6000546001600160a01b03908116911614610308576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6001602052836000526040600020602052826000526040600020602052816000526040600020818154811061039257fe5b6000918252602090912001546001600160a01b031693508492505050565b6103b86107b1565b6000546001600160a01b0390811691161461041a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03841661046c576040805162461bcd60e51b815260206004820152601460248201527314dc98c81d1bdad95b881a5cc81a5b9d985b1a5960621b604482015290519081900360640190fd5b6001600160a01b0383166104be576040805162461bcd60e51b8152602060048201526014602482015273111cdd081d1bdad95b881a5cc81a5b9d985b1a5960621b604482015290519081900360640190fd5b826001600160a01b0316846001600160a01b0316141561050f5760405162461bcd60e51b81526004018080602001828103825260258152602001806108386025913960400191505060405180910390fd5b6001600160a01b03851661055e576040805162461bcd60e51b8152602060048201526011602482015270149bdd5d195c881a5cc81a5b9d985b1a59607a1b604482015290519081900360640190fd5b836001600160a01b03168282600081811061057557fe5b905060200201356001600160a01b03166001600160a01b0316146105e0576040805162461bcd60e51b815260206004820152601f60248201527f526f757465206d75737420737461727420776974682073726320746f6b656e00604482015290519081900360640190fd5b6001600160a01b038316828260001981018181106105fa57fe5b905060200201356001600160a01b03166001600160a01b031614610665576040805162461bcd60e51b815260206004820152601d60248201527f526f757465206d75737420656e6420776974682064737420746f6b656e000000604482015290519081900360640190fd5b6001600160a01b0380861660009081526001602090815260408083208885168452825280832093871683529290522061069f9083836107b5565b505050505050565b6106af6107b1565b6000546001600160a01b03908116911614610711576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107565760405162461bcd60e51b815260040180806020018281038252602681526020018061085d6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b828054828255906000526020600020908101928215610808579160200282015b828111156108085781546001600160a01b0319166001600160a01b038435161782556020909201916001909101906107d5565b50610814929150610818565b5090565b5b808211156108145780546001600160a01b031916815560010161081956fe53726320746f6b656e206d75737420626520646966662066726f6d2044737420746f6b656e4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220c9a660e437ff1811eeaa633ed277d4e993991be37c87a8544270f94dc937520264736f6c634300060c0033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063481b920c14610067578063715018a6146100ef5780638da5cb5b146100f9578063975107c41461011d578063c3787e6014610159578063f2fde38b146101ea575b600080fd5b61009f6004803603606081101561007d57600080fd5b506001600160a01b038135811691602081013582169160409091013516610210565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156100db5781810151838201526020016100c3565b505050509050019250505060405180910390f35b6100f761029e565b005b610101610352565b604080516001600160a01b039092168252519081900360200190f35b6101016004803603608081101561013357600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135610361565b6100f76004803603608081101561016f57600080fd5b6001600160a01b03823581169260208101358216926040820135909216918101906080810160608201356401000000008111156101ab57600080fd5b8201836020820111156101bd57600080fd5b803590602001918460208302840111640100000000831117156101df57600080fd5b5090925090506103b0565b6100f76004803603602081101561020057600080fd5b50356001600160a01b03166106a7565b6001600160a01b0380841660009081526001602090815260408083208685168452825280832093851683529281529082902080548351818402810184019094528084526060939283018282801561029057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610272575b505050505090509392505050565b6102a66107b1565b6000546001600160a01b03908116911614610308576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6001602052836000526040600020602052826000526040600020602052816000526040600020818154811061039257fe5b6000918252602090912001546001600160a01b031693508492505050565b6103b86107b1565b6000546001600160a01b0390811691161461041a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03841661046c576040805162461bcd60e51b815260206004820152601460248201527314dc98c81d1bdad95b881a5cc81a5b9d985b1a5960621b604482015290519081900360640190fd5b6001600160a01b0383166104be576040805162461bcd60e51b8152602060048201526014602482015273111cdd081d1bdad95b881a5cc81a5b9d985b1a5960621b604482015290519081900360640190fd5b826001600160a01b0316846001600160a01b0316141561050f5760405162461bcd60e51b81526004018080602001828103825260258152602001806108386025913960400191505060405180910390fd5b6001600160a01b03851661055e576040805162461bcd60e51b8152602060048201526011602482015270149bdd5d195c881a5cc81a5b9d985b1a59607a1b604482015290519081900360640190fd5b836001600160a01b03168282600081811061057557fe5b905060200201356001600160a01b03166001600160a01b0316146105e0576040805162461bcd60e51b815260206004820152601f60248201527f526f757465206d75737420737461727420776974682073726320746f6b656e00604482015290519081900360640190fd5b6001600160a01b038316828260001981018181106105fa57fe5b905060200201356001600160a01b03166001600160a01b031614610665576040805162461bcd60e51b815260206004820152601d60248201527f526f757465206d75737420656e6420776974682064737420746f6b656e000000604482015290519081900360640190fd5b6001600160a01b0380861660009081526001602090815260408083208885168452825280832093871683529290522061069f9083836107b5565b505050505050565b6106af6107b1565b6000546001600160a01b03908116911614610711576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107565760405162461bcd60e51b815260040180806020018281038252602681526020018061085d6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b828054828255906000526020600020908101928215610808579160200282015b828111156108085781546001600160a01b0319166001600160a01b038435161782556020909201916001909101906107d5565b50610814929150610818565b5090565b5b808211156108145780546001600160a01b031916815560010161081956fe53726320746f6b656e206d75737420626520646966662066726f6d2044737420746f6b656e4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220c9a660e437ff1811eeaa633ed277d4e993991be37c87a8544270f94dc937520264736f6c634300060c0033