ETH Price: $3,493.47 (+3.63%)
Gas: 4 Gwei

Contract

0xf5110f6211a9202c257602CdFb055B161163a99d
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Set Price Ratio187671652023-12-12 2:35:47201 days ago1702348547IN
0xf5110f62...61163a99d
0 ETH0.0021720931.18631247
Transfer Ownersh...187671632023-12-12 2:35:23201 days ago1702348523IN
0xf5110f62...61163a99d
0 ETH0.0009148431.95524346
Set Price Ratio176263742023-07-05 8:03:47361 days ago1688544227IN
0xf5110f62...61163a99d
0 ETH0.0038978655.96446504
Set Price Config174634092023-06-12 10:32:59384 days ago1686565979IN
0xf5110f62...61163a99d
0 ETH0.0019314116.06890895
Set Price Config168232962023-03-14 2:43:23474 days ago1678761803IN
0xf5110f62...61163a99d
0 ETH0.0029306124.38443095
Set Price Config168232952023-03-14 2:43:11474 days ago1678761791IN
0xf5110f62...61163a99d
0 ETH0.0030062625.0138551
Set Price Config168232942023-03-14 2:42:59474 days ago1678761779IN
0xf5110f62...61163a99d
0 ETH0.0031065325.84557972
Set Price Config168232932023-03-14 2:42:47474 days ago1678761767IN
0xf5110f62...61163a99d
0 ETH0.0031455126.16986618
Set Price Config168232922023-03-14 2:42:35474 days ago1678761755IN
0xf5110f62...61163a99d
0 ETH0.0032663927.17828128
0x60806040168232902023-03-14 2:42:11474 days ago1678761731IN
 Create: LibSoFeeCelerV1
0 ETH0.028925826.30661066

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LibSoFeeCelerV1

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license
File 1 of 9 : LibSoFeeCelerV1.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.13;

import "Ownable.sol";
import "SafeMath.sol";
import "IERC20.sol";
import {ILibSoFee} from "ILibSoFee.sol";
import {ILibPriceV2} from "ILibPriceV2.sol";
import {IAggregatorV3Interface} from "IAggregatorV3Interface.sol";
import {ReentrancyGuard} from "ReentrancyGuard.sol";

// Celer
contract LibSoFeeCelerV1 is ILibSoFee, ILibPriceV2, Ownable, ReentrancyGuard {
    using SafeMath for uint256;

    //---------------------------------------------------------------------------
    // VARIABLES

    struct ChainlinkConfig {
        address router;
        // Countdown flag
        bool flag;
    }

    struct PriceConfig {
        ChainlinkConfig[] chainlink;
        // Update time interval
        uint256 interval;
    }

    struct PriceData {
        // The currnet price ratio of native coins
        uint256 currentPriceRatio;
        // Last update timestamp
        uint256 lastUpdateTimestamp;
    }

    uint256 public constant RAY = 1e27;

    uint256 public soFee;

    // Destination celer chain id => Oracle config
    mapping(uint64 => PriceConfig) public priceConfig;
    mapping(uint64 => PriceData) public priceData;

    //---------------------------------------------------------------------------
    // EVENT
    event UpdatePriceConfig(
        uint64 chainId,
        ChainlinkConfig[] chainlink,
        uint256 interval
    );
    event UpdatePriceInterval(uint64 chainId, uint256 interval);
    event UpdatePriceRatio(address sender, uint256 currentRatio);

    constructor(uint256 _soFee) {
        soFee = _soFee;
    }

    function setFee(uint256 _soFee) external onlyOwner {
        soFee = _soFee;
    }

    function setPriceConfig(
        uint64 _chainId,
        ChainlinkConfig[] memory _chainlink,
        uint256 _interval
    ) external onlyOwner {
        delete priceConfig[_chainId].chainlink;
        for (uint256 i = 0; i < _chainlink.length; i++) {
            priceConfig[_chainId].chainlink.push(
                ChainlinkConfig(_chainlink[i].router, _chainlink[i].flag)
            );
        }
        priceConfig[_chainId].interval = _interval;
        emit UpdatePriceConfig(_chainId, _chainlink, _interval);
    }

    function setPriceInterval(
        uint64 _chainId,
        uint256 _interval
    ) external onlyOwner {
        priceConfig[_chainId].interval = _interval;
        emit UpdatePriceInterval(_chainId, _interval);
    }

    function getPriceRatioByChainlink(
        uint64 _chainId,
        PriceConfig memory _config
    ) external view returns (uint256) {
        uint256 _ratio = RAY;
        for (uint256 i = 0; i < _config.chainlink.length; i++) {
            IAggregatorV3Interface _aggregator = IAggregatorV3Interface(
                _config.chainlink[i].router
            );
            (, int256 _price, , , ) = _aggregator.latestRoundData();
            uint8 _decimals = _aggregator.decimals();
            if (_price <= 0) {
                return priceData[_chainId].currentPriceRatio;
            }
            if (_config.chainlink[i].flag) {
                _ratio = _ratio.mul(10**_decimals).div(uint256(_price));
            } else {
                _ratio = _ratio.mul(uint256(_price)).div(10**_decimals);
            }
        }
        return _ratio;
    }

    function getPriceRatio(uint64 _chainId) public view returns (uint256, bool) {
        PriceConfig memory _config = priceConfig[_chainId];

        if (_config.chainlink.length == 0) {
            return (priceData[_chainId].currentPriceRatio, false);
        }
        if (
            priceData[_chainId].lastUpdateTimestamp.add(_config.interval) >=
            block.timestamp
        ) {
            return (priceData[_chainId].currentPriceRatio, false);
        }

        try this.getPriceRatioByChainlink(_chainId, _config) returns (
            uint256 _result
        ) {
            return (_result, true);
        } catch {
            return (priceData[_chainId].currentPriceRatio, false);
        }
    }

    function updatePriceRatio(uint64 _chainId) external returns (uint256) {
        (uint256 _ratio, bool _flag) = getPriceRatio(_chainId);
        if (_flag) {
            priceData[_chainId].currentPriceRatio = _ratio;
            priceData[_chainId].lastUpdateTimestamp = block.timestamp;
            emit UpdatePriceRatio(msg.sender, _ratio);
        }
        return _ratio;
    }

    function setPriceRatio(uint64 _chainId, uint256 _ratio) external onlyOwner {
        priceData[_chainId].currentPriceRatio = _ratio;
        priceData[_chainId].lastUpdateTimestamp = block.timestamp;
        emit UpdatePriceRatio(msg.sender, _ratio);
    }

    function getRestoredAmount(uint256 _amountIn)
        external
        view
        override
        returns (uint256 r)
    {
        // calculate the amount to be restored
        r = _amountIn.mul(RAY).div((RAY - soFee));
        return r;
    }

    function getFees(uint256 _amountIn)
        external
        view
        override
        returns (uint256 s)
    {
        // calculate the so fee
        s = _amountIn.mul(soFee).div(RAY);
        return s;
    }

    function getTransferForGas() external view override returns (uint256) {
        return 0;
    }

    function getVersion() external pure override returns (string memory) {
        return "CelerV1";
    }
}

File 2 of 9 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "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);
    }
}

File 3 of 9 : Context.sol
// 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;
    }
}

File 4 of 9 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 5 of 9 : IERC20.sol
// 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);
}

File 6 of 9 : ILibSoFee.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.13;

interface ILibSoFee {
    function getFees(uint256 _amount) external view returns (uint256 s);

    function getRestoredAmount(uint256 _amount)
        external
        view
        returns (uint256 r);

    function getTransferForGas() external view returns (uint256);

    function getVersion() external view returns (string memory);
}

File 7 of 9 : ILibPriceV2.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.13;

// Celer chain id is u64, stargate and wormhole are u16
// ILibPriceV2 for Celer bridge
interface ILibPriceV2 {
    function getPriceRatio(uint64 _chainId) external view returns (uint256, bool);

    function updatePriceRatio(uint64 _chainId) external returns (uint256);

    function RAY() external view returns (uint256);
}

File 8 of 9 : IAggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IAggregatorV3Interface {
    function decimals() external view returns (uint8);

    function description() external view returns (string memory);

    function version() external view returns (uint256);

    function getRoundData(uint80 _roundId)
        external
        view
        returns (
            uint80 roundId,
            int256 answer,
            uint256 startedAt,
            uint256 updatedAt,
            uint80 answeredInRound
        );

    function latestRoundData()
        external
        view
        returns (
            uint80 roundId,
            int256 answer,
            uint256 startedAt,
            uint256 updatedAt,
            uint80 answeredInRound
        );
}

File 9 of 9 : ReentrancyGuard.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.13;

/// @title Reentrancy Guard
/// @author LI.FI (https://li.fi)
/// @notice Abstract contract to provide protection against reentrancy
abstract contract ReentrancyGuard {
    /// Storage ///

    bytes32 private constant NAMESPACE =
        hex"a65bb2f450488ab0858c00edc14abc5297769bf42adb48cfb77752890e8b697b";

    /// Types ///

    struct ReentrancyStorage {
        uint256 status;
    }

    /// Errors ///

    error ReentrancyError();

    /// Constants ///

    uint256 private constant _NOT_ENTERED = 0;
    uint256 private constant _ENTERED = 1;

    /// Modifiers ///

    modifier nonReentrant() {
        ReentrancyStorage storage s = reentrancyStorage();
        if (s.status == _ENTERED) revert ReentrancyError();
        s.status = _ENTERED;
        _;
        s.status = _NOT_ENTERED;
    }

    /// Private Methods ///

    /// @dev fetch local storage
    function reentrancyStorage()
        private
        pure
        returns (ReentrancyStorage storage data)
    {
        bytes32 position = NAMESPACE;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            data.slot := position
        }
    }
}

Settings
{
  "evmVersion": "istanbul",
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "libraries": {
    "LibSoFeeCelerV1.sol": {}
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_soFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ReentrancyError","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":"uint64","name":"chainId","type":"uint64"},{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bool","name":"flag","type":"bool"}],"indexed":false,"internalType":"struct LibSoFeeCelerV1.ChainlinkConfig[]","name":"chainlink","type":"tuple[]"},{"indexed":false,"internalType":"uint256","name":"interval","type":"uint256"}],"name":"UpdatePriceConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"chainId","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"interval","type":"uint256"}],"name":"UpdatePriceInterval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"currentRatio","type":"uint256"}],"name":"UpdatePriceRatio","type":"event"},{"inputs":[],"name":"RAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"getFees","outputs":[{"internalType":"uint256","name":"s","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainId","type":"uint64"}],"name":"getPriceRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainId","type":"uint64"},{"components":[{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bool","name":"flag","type":"bool"}],"internalType":"struct LibSoFeeCelerV1.ChainlinkConfig[]","name":"chainlink","type":"tuple[]"},{"internalType":"uint256","name":"interval","type":"uint256"}],"internalType":"struct LibSoFeeCelerV1.PriceConfig","name":"_config","type":"tuple"}],"name":"getPriceRatioByChainlink","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"getRestoredAmount","outputs":[{"internalType":"uint256","name":"r","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransferForGas","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"}],"name":"priceConfig","outputs":[{"internalType":"uint256","name":"interval","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"}],"name":"priceData","outputs":[{"internalType":"uint256","name":"currentPriceRatio","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_soFee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainId","type":"uint64"},{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bool","name":"flag","type":"bool"}],"internalType":"struct LibSoFeeCelerV1.ChainlinkConfig[]","name":"_chainlink","type":"tuple[]"},{"internalType":"uint256","name":"_interval","type":"uint256"}],"name":"setPriceConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainId","type":"uint64"},{"internalType":"uint256","name":"_interval","type":"uint256"}],"name":"setPriceInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainId","type":"uint64"},{"internalType":"uint256","name":"_ratio","type":"uint256"}],"name":"setPriceRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"soFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainId","type":"uint64"}],"name":"updatePriceRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506040516112c63803806112c683398101604081905261002f91610090565b61003833610040565b6001556100a9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100a257600080fd5b5051919050565b61120e806100b86000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063b0e8cdf911610071578063b0e8cdf91461027c578063d5a06d4c14610285578063e3e4239a14610298578063f2fde38b146102ab578063f7229ead146102be57600080fd5b80638da5cb5b146102035780639896d95d1461021e578063a9f27a7d14610246578063afd283391461025957600080fd5b80634f0ba55f116100e95780634f0ba55f146101b9578063539e6538146101c0578063552033c4146101d557806369fe0e2d146101e8578063715018a6146101fb57600080fd5b806307c0c1df1461011b57806308b7e595146101415780630d8e6e2c146101545780632aaf9ec11461017d575b600080fd5b61012e610129366004610b74565b6102d1565b6040519081526020015b60405180910390f35b61012e61014f366004610ce7565b610312565b604080518082018252600781526643656c6572563160c81b602082015290516101389190610d86565b6101a461018b366004610ddb565b6003602052600090815260409020805460019091015482565b60408051928352602083019190915201610138565b600061012e565b6101d36101ce366004610df6565b6104cf565b005b61012e6b033b2e3c9fd0803ce800000081565b6101d36101f6366004610b74565b61055e565b6101d361058d565b6000546040516001600160a01b039091168152602001610138565b61023161022c366004610ddb565b6105c3565b60408051928352901515602083015201610138565b61012e610254366004610ddb565b61076c565b61012e610267366004610ddb565b60026020526000908152604090206001015481565b61012e60015481565b61012e610293366004610b74565b6107e8565b6101d36102a6366004610df6565b61080f565b6101d36102b9366004610e20565b610892565b6101d36102cc366004610e3b565b61092d565b600061030c6001546b033b2e3c9fd0803ce80000006102f09190610ea7565b610306846b033b2e3c9fd0803ce8000000610abd565b90610ad0565b92915050565b60006b033b2e3c9fd0803ce8000000815b8351518110156104c75760008460000151828151811061034557610345610ebe565b60200260200101516000015190506000816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b79190610eee565b5050509150506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104219190610f3e565b905060008213610451575050506001600160401b038516600090815260036020526040902054925061030c915050565b865180518590811061046557610465610ebe565b602002602001015160200151156104965761048f8261030661048884600a611045565b8890610abd565b94506104b1565b6104ae6104a482600a611045565b6103068785610abd565b94505b50505080806104bf90611054565b915050610323565b509392505050565b6000546001600160a01b031633146105025760405162461bcd60e51b81526004016104f99061106d565b60405180910390fd5b6001600160401b038216600081815260026020908152604091829020600101849055815192835282018390527fd9ce322bfcec9f4e075d95f5a69e29ec30a7cbbcdd6d2dbd4d465845e594569191015b60405180910390a15050565b6000546001600160a01b031633146105885760405162461bcd60e51b81526004016104f99061106d565b600155565b6000546001600160a01b031633146105b75760405162461bcd60e51b81526004016104f99061106d565b6105c16000610adc565b565b6001600160401b038116600090815260026020908152604080832081518154606094810282018501845292810183815285948594929392849291849190879085015b8282101561065057600084815260209081902060408051808201909152908401546001600160a01b0381168252600160a01b900460ff16151581830152825260019092019101610605565b505050508152602001600182015481525050905080600001515160000361068f575050506001600160401b031660009081526003602052604081205491565b6020808201516001600160401b0386166000908152600390925260409091206001015442916106be9190610b2c565b106106e1575050506001600160401b031660009081526003602052604081205491565b6040516308b7e59560e01b815230906308b7e5959061070690879085906004016110f3565b602060405180830381865afa92505050801561073f575060408051601f3d908101601f1916820190925261073c91810190611134565b60015b610761575050506001600160401b031660009081526003602052604081205491565b946001945092505050565b600080600061077a846105c3565b9150915080156107e1576001600160401b0384166000908152600360209081526040918290208481554260019091015581513381529081018490527fa718d44799032ca9af8e2ebb2e678fee2ecc0e34f391c7f54a5f2324ed71170a910160405180910390a15b5092915050565b600061030c6b033b2e3c9fd0803ce800000061030660015485610abd90919063ffffffff16565b6000546001600160a01b031633146108395760405162461bcd60e51b81526004016104f99061106d565b6001600160401b0382166000908152600360209081526040918290208381554260019091015581513381529081018390527fa718d44799032ca9af8e2ebb2e678fee2ecc0e34f391c7f54a5f2324ed71170a9101610552565b6000546001600160a01b031633146108bc5760405162461bcd60e51b81526004016104f99061106d565b6001600160a01b0381166109215760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104f9565b61092a81610adc565b50565b6000546001600160a01b031633146109575760405162461bcd60e51b81526004016104f99061106d565b6001600160401b038316600090815260026020526040812061097891610b38565b60005b8251811015610a5d5760026000856001600160401b03166001600160401b0316815260200190815260200160002060000160405180604001604052808584815181106109c9576109c9610ebe565b6020026020010151600001516001600160a01b031681526020018584815181106109f5576109f5610ebe565b6020908102919091018101518101511515909152825460018101845560009384529281902082519301805492909101511515600160a01b026001600160a81b03199092166001600160a01b039093169290921717905580610a5581611054565b91505061097b565b506001600160401b03831660009081526002602052604090819020600101829055517fa89473885e407722a58eca9074f9e882803b1db1fafe4e5f1baefcf044703f0a90610ab09085908590859061114d565b60405180910390a1505050565b6000610ac9828461117f565b9392505050565b6000610ac9828461119e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610ac982846111c0565b508054600082559060005260206000209081019061092a91905b80821115610b705780546001600160a81b0319168155600101610b52565b5090565b600060208284031215610b8657600080fd5b5035919050565b80356001600160401b0381168114610ba457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715610be157610be1610ba9565b60405290565b604051601f8201601f191681016001600160401b0381118282101715610c0f57610c0f610ba9565b604052919050565b80356001600160a01b0381168114610ba457600080fd5b600082601f830112610c3f57600080fd5b813560206001600160401b03821115610c5a57610c5a610ba9565b610c68818360051b01610be7565b82815260069290921b84018101918181019086841115610c8757600080fd5b8286015b84811015610cdc5760408189031215610ca45760008081fd5b610cac610bbf565b610cb582610c17565b8152848201358015158114610cca5760008081fd5b81860152835291830191604001610c8b565b509695505050505050565b60008060408385031215610cfa57600080fd5b610d0383610b8d565b915060208301356001600160401b0380821115610d1f57600080fd5b9084019060408287031215610d3357600080fd5b604051604081018181108382111715610d4e57610d4e610ba9565b604052823582811115610d6057600080fd5b610d6c88828601610c2e565b825250602083013560208201528093505050509250929050565b600060208083528351808285015260005b81811015610db357858101830151858201604001528201610d97565b81811115610dc5576000604083870101525b50601f01601f1916929092016040019392505050565b600060208284031215610ded57600080fd5b610ac982610b8d565b60008060408385031215610e0957600080fd5b610e1283610b8d565b946020939093013593505050565b600060208284031215610e3257600080fd5b610ac982610c17565b600080600060608486031215610e5057600080fd5b610e5984610b8d565b925060208401356001600160401b03811115610e7457600080fd5b610e8086828701610c2e565b925050604084013590509250925092565b634e487b7160e01b600052601160045260246000fd5b600082821015610eb957610eb9610e91565b500390565b634e487b7160e01b600052603260045260246000fd5b805169ffffffffffffffffffff81168114610ba457600080fd5b600080600080600060a08688031215610f0657600080fd5b610f0f86610ed4565b9450602086015193506040860151925060608601519150610f3260808701610ed4565b90509295509295909350565b600060208284031215610f5057600080fd5b815160ff81168114610ac957600080fd5b600181815b80851115610f9c578160001904821115610f8257610f82610e91565b80851615610f8f57918102915b93841c9390800290610f66565b509250929050565b600082610fb35750600161030c565b81610fc05750600061030c565b8160018114610fd65760028114610fe057610ffc565b600191505061030c565b60ff841115610ff157610ff1610e91565b50506001821b61030c565b5060208310610133831016604e8410600b841016171561101f575081810a61030c565b6110298383610f61565b806000190482111561103d5761103d610e91565b029392505050565b6000610ac960ff841683610fa4565b60006001820161106657611066610e91565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600081518084526020808501945080840160005b838110156110e857815180516001600160a01b03168852830151151583880152604090960195908201906001016110b6565b509495945050505050565b6001600160401b0383168152604060208201526000825160408084015261111d60808401826110a2565b905060208401516060840152809150509392505050565b60006020828403121561114657600080fd5b5051919050565b6001600160401b038416815260606020820152600061116f60608301856110a2565b9050826040830152949350505050565b600081600019048311821515161561119957611199610e91565b500290565b6000826111bb57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156111d3576111d3610e91565b50019056fea26469706673582212203f0044fee42f8e4cf749e016343751831a905fd21f86562c28387b8e1442f34464736f6c634300080d003300000000000000000000000000000000000000000000d3c21bcecceda0000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063b0e8cdf911610071578063b0e8cdf91461027c578063d5a06d4c14610285578063e3e4239a14610298578063f2fde38b146102ab578063f7229ead146102be57600080fd5b80638da5cb5b146102035780639896d95d1461021e578063a9f27a7d14610246578063afd283391461025957600080fd5b80634f0ba55f116100e95780634f0ba55f146101b9578063539e6538146101c0578063552033c4146101d557806369fe0e2d146101e8578063715018a6146101fb57600080fd5b806307c0c1df1461011b57806308b7e595146101415780630d8e6e2c146101545780632aaf9ec11461017d575b600080fd5b61012e610129366004610b74565b6102d1565b6040519081526020015b60405180910390f35b61012e61014f366004610ce7565b610312565b604080518082018252600781526643656c6572563160c81b602082015290516101389190610d86565b6101a461018b366004610ddb565b6003602052600090815260409020805460019091015482565b60408051928352602083019190915201610138565b600061012e565b6101d36101ce366004610df6565b6104cf565b005b61012e6b033b2e3c9fd0803ce800000081565b6101d36101f6366004610b74565b61055e565b6101d361058d565b6000546040516001600160a01b039091168152602001610138565b61023161022c366004610ddb565b6105c3565b60408051928352901515602083015201610138565b61012e610254366004610ddb565b61076c565b61012e610267366004610ddb565b60026020526000908152604090206001015481565b61012e60015481565b61012e610293366004610b74565b6107e8565b6101d36102a6366004610df6565b61080f565b6101d36102b9366004610e20565b610892565b6101d36102cc366004610e3b565b61092d565b600061030c6001546b033b2e3c9fd0803ce80000006102f09190610ea7565b610306846b033b2e3c9fd0803ce8000000610abd565b90610ad0565b92915050565b60006b033b2e3c9fd0803ce8000000815b8351518110156104c75760008460000151828151811061034557610345610ebe565b60200260200101516000015190506000816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b79190610eee565b5050509150506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104219190610f3e565b905060008213610451575050506001600160401b038516600090815260036020526040902054925061030c915050565b865180518590811061046557610465610ebe565b602002602001015160200151156104965761048f8261030661048884600a611045565b8890610abd565b94506104b1565b6104ae6104a482600a611045565b6103068785610abd565b94505b50505080806104bf90611054565b915050610323565b509392505050565b6000546001600160a01b031633146105025760405162461bcd60e51b81526004016104f99061106d565b60405180910390fd5b6001600160401b038216600081815260026020908152604091829020600101849055815192835282018390527fd9ce322bfcec9f4e075d95f5a69e29ec30a7cbbcdd6d2dbd4d465845e594569191015b60405180910390a15050565b6000546001600160a01b031633146105885760405162461bcd60e51b81526004016104f99061106d565b600155565b6000546001600160a01b031633146105b75760405162461bcd60e51b81526004016104f99061106d565b6105c16000610adc565b565b6001600160401b038116600090815260026020908152604080832081518154606094810282018501845292810183815285948594929392849291849190879085015b8282101561065057600084815260209081902060408051808201909152908401546001600160a01b0381168252600160a01b900460ff16151581830152825260019092019101610605565b505050508152602001600182015481525050905080600001515160000361068f575050506001600160401b031660009081526003602052604081205491565b6020808201516001600160401b0386166000908152600390925260409091206001015442916106be9190610b2c565b106106e1575050506001600160401b031660009081526003602052604081205491565b6040516308b7e59560e01b815230906308b7e5959061070690879085906004016110f3565b602060405180830381865afa92505050801561073f575060408051601f3d908101601f1916820190925261073c91810190611134565b60015b610761575050506001600160401b031660009081526003602052604081205491565b946001945092505050565b600080600061077a846105c3565b9150915080156107e1576001600160401b0384166000908152600360209081526040918290208481554260019091015581513381529081018490527fa718d44799032ca9af8e2ebb2e678fee2ecc0e34f391c7f54a5f2324ed71170a910160405180910390a15b5092915050565b600061030c6b033b2e3c9fd0803ce800000061030660015485610abd90919063ffffffff16565b6000546001600160a01b031633146108395760405162461bcd60e51b81526004016104f99061106d565b6001600160401b0382166000908152600360209081526040918290208381554260019091015581513381529081018390527fa718d44799032ca9af8e2ebb2e678fee2ecc0e34f391c7f54a5f2324ed71170a9101610552565b6000546001600160a01b031633146108bc5760405162461bcd60e51b81526004016104f99061106d565b6001600160a01b0381166109215760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104f9565b61092a81610adc565b50565b6000546001600160a01b031633146109575760405162461bcd60e51b81526004016104f99061106d565b6001600160401b038316600090815260026020526040812061097891610b38565b60005b8251811015610a5d5760026000856001600160401b03166001600160401b0316815260200190815260200160002060000160405180604001604052808584815181106109c9576109c9610ebe565b6020026020010151600001516001600160a01b031681526020018584815181106109f5576109f5610ebe565b6020908102919091018101518101511515909152825460018101845560009384529281902082519301805492909101511515600160a01b026001600160a81b03199092166001600160a01b039093169290921717905580610a5581611054565b91505061097b565b506001600160401b03831660009081526002602052604090819020600101829055517fa89473885e407722a58eca9074f9e882803b1db1fafe4e5f1baefcf044703f0a90610ab09085908590859061114d565b60405180910390a1505050565b6000610ac9828461117f565b9392505050565b6000610ac9828461119e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610ac982846111c0565b508054600082559060005260206000209081019061092a91905b80821115610b705780546001600160a81b0319168155600101610b52565b5090565b600060208284031215610b8657600080fd5b5035919050565b80356001600160401b0381168114610ba457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715610be157610be1610ba9565b60405290565b604051601f8201601f191681016001600160401b0381118282101715610c0f57610c0f610ba9565b604052919050565b80356001600160a01b0381168114610ba457600080fd5b600082601f830112610c3f57600080fd5b813560206001600160401b03821115610c5a57610c5a610ba9565b610c68818360051b01610be7565b82815260069290921b84018101918181019086841115610c8757600080fd5b8286015b84811015610cdc5760408189031215610ca45760008081fd5b610cac610bbf565b610cb582610c17565b8152848201358015158114610cca5760008081fd5b81860152835291830191604001610c8b565b509695505050505050565b60008060408385031215610cfa57600080fd5b610d0383610b8d565b915060208301356001600160401b0380821115610d1f57600080fd5b9084019060408287031215610d3357600080fd5b604051604081018181108382111715610d4e57610d4e610ba9565b604052823582811115610d6057600080fd5b610d6c88828601610c2e565b825250602083013560208201528093505050509250929050565b600060208083528351808285015260005b81811015610db357858101830151858201604001528201610d97565b81811115610dc5576000604083870101525b50601f01601f1916929092016040019392505050565b600060208284031215610ded57600080fd5b610ac982610b8d565b60008060408385031215610e0957600080fd5b610e1283610b8d565b946020939093013593505050565b600060208284031215610e3257600080fd5b610ac982610c17565b600080600060608486031215610e5057600080fd5b610e5984610b8d565b925060208401356001600160401b03811115610e7457600080fd5b610e8086828701610c2e565b925050604084013590509250925092565b634e487b7160e01b600052601160045260246000fd5b600082821015610eb957610eb9610e91565b500390565b634e487b7160e01b600052603260045260246000fd5b805169ffffffffffffffffffff81168114610ba457600080fd5b600080600080600060a08688031215610f0657600080fd5b610f0f86610ed4565b9450602086015193506040860151925060608601519150610f3260808701610ed4565b90509295509295909350565b600060208284031215610f5057600080fd5b815160ff81168114610ac957600080fd5b600181815b80851115610f9c578160001904821115610f8257610f82610e91565b80851615610f8f57918102915b93841c9390800290610f66565b509250929050565b600082610fb35750600161030c565b81610fc05750600061030c565b8160018114610fd65760028114610fe057610ffc565b600191505061030c565b60ff841115610ff157610ff1610e91565b50506001821b61030c565b5060208310610133831016604e8410600b841016171561101f575081810a61030c565b6110298383610f61565b806000190482111561103d5761103d610e91565b029392505050565b6000610ac960ff841683610fa4565b60006001820161106657611066610e91565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600081518084526020808501945080840160005b838110156110e857815180516001600160a01b03168852830151151583880152604090960195908201906001016110b6565b509495945050505050565b6001600160401b0383168152604060208201526000825160408084015261111d60808401826110a2565b905060208401516060840152809150509392505050565b60006020828403121561114657600080fd5b5051919050565b6001600160401b038416815260606020820152600061116f60608301856110a2565b9050826040830152949350505050565b600081600019048311821515161561119957611199610e91565b500290565b6000826111bb57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156111d3576111d3610e91565b50019056fea26469706673582212203f0044fee42f8e4cf749e016343751831a905fd21f86562c28387b8e1442f34464736f6c634300080d0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000000000000000000000000d3c21bcecceda0000000

-----Decoded View---------------
Arg [0] : _soFee (uint256): 999999999999999983222784

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000d3c21bcecceda0000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.