Overview
ETH Balance
0 ETH
Eth Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 175 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Swap | 20161658 | 21 days ago | IN | 0 ETH | 0.00089966 | ||||
Swap | 20118068 | 27 days ago | IN | 0 ETH | 0.00075448 | ||||
Swap | 20095548 | 30 days ago | IN | 0 ETH | 0.00077467 | ||||
Swap | 20062685 | 35 days ago | IN | 0 ETH | 0.00242752 | ||||
Swap | 20016766 | 41 days ago | IN | 0 ETH | 0.00096408 | ||||
Swap | 20016757 | 41 days ago | IN | 0 ETH | 0.00087614 | ||||
Add Liquidity | 19937919 | 52 days ago | IN | 0 ETH | 0.00146435 | ||||
Swap | 19937611 | 52 days ago | IN | 0 ETH | 0.0009205 | ||||
Swap | 19937608 | 52 days ago | IN | 0 ETH | 0.00095723 | ||||
Add Liquidity | 19935804 | 53 days ago | IN | 0 ETH | 0.00210046 | ||||
Emergency Withdr... | 19935787 | 53 days ago | IN | 0 ETH | 0.00083928 | ||||
Swap | 19929810 | 53 days ago | IN | 0 ETH | 0.00092948 | ||||
Swap | 19929801 | 53 days ago | IN | 0 ETH | 0.00102696 | ||||
Swap | 19929773 | 53 days ago | IN | 0 ETH | 0.00109443 | ||||
Add Liquidity | 19928622 | 54 days ago | IN | 0 ETH | 0.00097717 | ||||
Swap | 19917355 | 55 days ago | IN | 0 ETH | 0.00117357 | ||||
Swap | 19917348 | 55 days ago | IN | 0 ETH | 0.00137241 | ||||
Add Liquidity | 19914050 | 56 days ago | IN | 0 ETH | 0.00497535 | ||||
Swap | 19872964 | 61 days ago | IN | 0 ETH | 0.00055916 | ||||
Swap | 19872928 | 61 days ago | IN | 0 ETH | 0.0005853 | ||||
Swap | 19863949 | 63 days ago | IN | 0 ETH | 0.0006799 | ||||
Swap | 19846004 | 65 days ago | IN | 0 ETH | 0.00097515 | ||||
Swap | 19838157 | 66 days ago | IN | 0 ETH | 0.00063821 | ||||
Add Liquidity | 19835264 | 67 days ago | IN | 0 ETH | 0.00075313 | ||||
Emergency Withdr... | 19664046 | 91 days ago | IN | 0 ETH | 0.00067237 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
16118771 | 588 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Name:
PoolChainlink
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.15; import "./BasePool.sol"; contract PoolChainlink is BasePool { SwapLib.FeedInfo public commodityFeedInfo; /// @param _commodityToken the commodity token /// @param _stableToken the stable token /// @param _dexSettings dexsettings /// @param _stableFeedInfo chainlink price feed address and heartbeats /// @param _commodityFeedInfo chainlink price feed address and heartbeats constructor( address _commodityToken, address _stableToken, SwapLib.DexSetting memory _dexSettings, SwapLib.FeedInfo memory _commodityFeedInfo, SwapLib.FeedInfo memory _stableFeedInfo ) BasePool(_commodityToken, _stableToken, _dexSettings) { //set price feeds _setFeedSetting(_commodityFeedInfo, _stableFeedInfo); } /// @notice Allows Swaps from commodity token to another token and vice versa, /// @param _amountIn Amount of tokens user want to give for swap (in decimals of _from token) /// @param _expectedAmountOut expected amount of output tokens at the time of quote /// @param _slippage slippage tolerance in percentage (2 decimals) /// @param _from token that user wants to spend /// @param _to token that user wants in result of swap function swap( uint256 _amountIn, uint256 _expectedAmountOut, uint256 _slippage, address _from, address _to ) external virtual whenNotPaused { //invalid amount check require(_amountIn > 0, "PC: wrong amount"); //tokens check require( (_from == dexData.commodityToken && _to == dexData.stableToken) || (_to == dexData.commodityToken && _from == dexData.stableToken), "PC: wrong pair" ); //calculating fee as percentage of amount passed uint256 amountFee = (_amountIn * dexSettings.tradeFee) / (10**10); // 8 decimals for fee, 100 for percentage //start sell case if (_from == dexData.commodityToken) { //commodity -> stable conversion //deducting fee uint256 commodityAmount = _amountIn - amountFee; //getting latest price for given amount //false indicates commodity being sold uint256 stableAmount = getAmountOut( commodityAmount, SwapLib.SELL_INDEX ); //cant go ahead if no liquidity require( dexData.reserveStable >= stableAmount, "PC: not enough liquidity" ); //verify slippage stableAmount > minimumAmountOut && stableAmount < maximumAmountOut verifySlippageTolerance( _expectedAmountOut, _slippage, stableAmount ); //increase commodity reserve dexData.reserveCommodity = dexData.reserveCommodity + commodityAmount; //decrease stable reserve dexData.reserveStable = dexData.reserveStable - stableAmount; //add fee dexData.totalFeeCommodity = dexData.totalFeeCommodity + amountFee; //emit swap event emit Swapped( msg.sender, _amountIn, stableAmount, SwapLib.SELL_INDEX ); // All state updates for swap should come before calling the // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern //transfer the commodity tokens to the contract TransferHelper.safeTransferFrom( dexData.commodityToken, msg.sender, address(this), _amountIn ); //transfer the stable amount to the user TransferHelper.safeTransfer( dexData.stableToken, msg.sender, stableAmount ); } else { //deduct calculated fee uint256 stableAmount = _amountIn - amountFee; //get number of commodity tokens to buy against stable amount passed uint256 commodityAmount = getAmountOut( stableAmount, SwapLib.BUY_INDEX ); //revert on low reserves require( dexData.reserveCommodity >= commodityAmount, "PC: not enough liquidity" ); //verify slippage commodityAmount > minimumAmountOut && stableAmount < maximumAmountOut verifySlippageTolerance( _expectedAmountOut, _slippage, commodityAmount ); //decrease commodity reserve dexData.reserveCommodity = dexData.reserveCommodity - commodityAmount; //increase stable reserve dexData.reserveStable = dexData.reserveStable + stableAmount; //add stable fee dexData.totalFeeStable = dexData.totalFeeStable + amountFee; //emit swap event emit Swapped( msg.sender, _amountIn, commodityAmount, SwapLib.BUY_INDEX ); // All state updates for swap should come before calling the // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern //transfer stale amountt from user to contract TransferHelper.safeTransferFrom( dexData.stableToken, msg.sender, address(this), _amountIn ); //transfer commodity amount from contract to user TransferHelper.safeTransfer( dexData.commodityToken, msg.sender, commodityAmount ); } } /// @notice Allows pool owner to add liquidity for both assets /// @param _commodityAmount amount of tokens for commodity asset /// @param _stableAmount amount of tokens for stable asset /// @param _slippage slippage tolerance in percentage (2 decimals) function addLiquidity( uint256 _commodityAmount, uint256 _stableAmount, uint256 _slippage ) external virtual onlyOwner { //calculating amount of stable against commodity amount uint256 amount = getAmountOut(_commodityAmount, SwapLib.SELL_INDEX); //deliberate use of false flag to get sell price //verify slippage amount > minimumAmountOut && amount < maximumAmountOut verifySlippageTolerance(_stableAmount, _slippage, amount); super._addLiquidity(_commodityAmount, amount); } /// @notice Allows pool owner to remove liquidity for both assets /// @param _commodityAmount amount of tokens for commodity asset /// @param _stableAmount amount of tokens for stable asset /// @param _slippage slippage tolerance in percentage (2 decimals) function removeLiquidity( uint256 _commodityAmount, uint256 _stableAmount, uint256 _slippage ) external virtual onlyOwner { //calculating amount of stable against commodity amount uint256 amount = getAmountOut(_commodityAmount, SwapLib.SELL_INDEX); //deliberate use of false flag to get sell price //verify slippage amount > minimumAmountOut && amount < maximumAmountOut && verifySlippageTolerance(_stableAmount, _slippage, amount); super._removeLiquidity(_commodityAmount, amount); } ///@dev returns the amonutOut for given amount in if true flag ///@param _amountIn the amount of tokens to exchange ///@param _index 0 = buy price returns amount commodity for stable _amountIn, /// 1 = for sell price function getAmountOut(uint256 _amountIn, uint256 _index) public view returns (uint256) { //calculating commodity amount against stable tokens passed //1 Commodity Token = ? Stable tokens uint256 commodityUnitPriceUsd = getCommodityPrice();//price returned as USD is converted into respective stable token amount uint256 commodityUnitPriceStable = _convertUSDToStable(commodityUnitPriceUsd); if (_index == SwapLib.BUY_INDEX) { //adding spot price difference to unit price in terms of percentage of the unit price itself //e.g. buySpotDifference = 110 = 1.1% and commodityUnitPrice = 50 StableTokens //result will be 50+(1.1% of 50) = 50.55 commodityUnitPriceStable = commodityUnitPriceStable + ((commodityUnitPriceStable * dexSettings.buySpotDifference) / 10000); // adding % from spot price // commodityAmount = amount of stable tokens / commodity unit price in stable uint256 commodityAmount = (_amountIn * (10**commodityFeedInfo.priceFeed.decimals())) / commodityUnitPriceStable; //convert to commodity decimals as amount is in stable decimals return SwapLib._normalizeAmount( commodityAmount, dexData.stableToken, dexData.commodityToken ); } else { // calculating stable amount against commodity tokens passed // getCommodityPrice returns 1 commodity in USD / its decimals // _convertUSDToStable converts dollar value to stable token amount // total stable amount = amount of commodity tokens * 1 commodity price in stable token uint256 stableAmount = (_amountIn * commodityUnitPriceStable) / 10**stableFeedInfo.priceFeed.decimals(); //subtracting sell spot difference //e.g. sellSpotDifference = 110 = 1.1% and commodityUnitPrice = 50 StableTokens //result will be 50-(1.1% of 50) = 49.45 stableAmount = stableAmount - ((stableAmount * dexSettings.sellSpotDifference) / (10000)); // deducting 1.04% out of spot price //convert to stable decimal as amount is in commodity decimals return SwapLib._normalizeAmount( stableAmount, dexData.commodityToken, dexData.stableToken ); } } /// @notice Allows to set Chainlink feed address /// @param _stableFeedInfo chainlink price feed addresses and heartbeats /// @param _commodityFeedInfo chainlink price feed addresses and heartbeats function setFeedSetting( SwapLib.FeedInfo memory _commodityFeedInfo, SwapLib.FeedInfo memory _stableFeedInfo ) external onlyComdexAdmin { _setFeedSetting(_commodityFeedInfo, _stableFeedInfo); } /// @dev internal function to set chainlink feed settings function _setFeedSetting( SwapLib.FeedInfo memory _commodityFeedInfo, SwapLib.FeedInfo memory _stableFeedInfo ) internal { require( _commodityFeedInfo.heartbeat > 10 && _commodityFeedInfo.heartbeat <= 86400, // 10 seconds to 24 hrs "PC: invalid heartbeat commodity" ); require( _stableFeedInfo.heartbeat > 10 && _stableFeedInfo.heartbeat <= 86400, // 10 seconds to 24 hrs "PC: invalid heartbeat stable" ); commodityFeedInfo = _commodityFeedInfo; //try to hit price to check if commodity feed is valid uint256 commodityUnitPrice = getCommodityPrice(); stableFeedInfo = _stableFeedInfo; //try to hit price FOR ARBITRARY VALUE to check if stable feed is valid _convertUSDToStable(commodityUnitPrice); emit FeedAddressesChanged( address(_commodityFeedInfo.priceFeed), address(_stableFeedInfo.priceFeed) ); } ///@dev returns the price of 1 unit of commodity from chainlink feed configured function getCommodityPrice() internal view returns (uint256) { ( , // uint80 roundID int256 price, // uint answer // startedAt , uint256 updatedAt, // updatedAt ) = commodityFeedInfo.priceFeed.latestRoundData(); require(price > 0, "BP: chainLink price error"); require( !_isCommodityFeedTimeout(updatedAt), "BP: commodity price expired" ); return (uint256(price) * dexSettings.unitMultiplier) / (10**18); // converting feed price unit into token commodity units e.g 1 gram = 1000mg } ///@dev returns true if the commodity feed updated price is over heartbeat value function _isCommodityFeedTimeout(uint256 _updatedAt) internal view returns (bool) { //under heartbeat is not a timeout if (block.timestamp - _updatedAt < commodityFeedInfo.heartbeat) return false; else return true; } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.15; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "../utils/TransferHelper.sol"; import "../interfaces/IPool.sol"; import "./../interfaces/IERC20.sol"; import {SwapLib} from "../lib/Lib.sol"; abstract contract BasePool is Ownable, IPool, Pausable { //state variable for dex data reserves, tokens etc check ../lib/Lib.sol SwapLib.DexData public dexData; //name, fee, timeout etc check ../lib/Lib.sol SwapLib.DexSetting public dexSettings; //to convert USD value to stable token amount SwapLib.FeedInfo public stableFeedInfo; modifier onlyComdexAdmin() { _onlyCommdexAdmin(); _; } function _onlyCommdexAdmin() internal view { require( msg.sender == dexSettings.dexAdmin, "BP: caller not pool admin" ); } constructor( address _commodityToken, address _stableToken, SwapLib.DexSetting memory _dexSettings ) { //note: no hard cap on upper limit because units can be any generic conversion require(_dexSettings.unitMultiplier > 0, "BP: Invalid _unitMultiplier"); SwapLib._checkNullAddress(_dexSettings.dexAdmin); SwapLib._checkFee(_dexSettings.tradeFee); SwapLib._checkNullAddress(_commodityToken); SwapLib._checkNullAddress(_stableToken); SwapLib._checkRateTimeout(_dexSettings.rateTimeOut); dexData.commodityToken = _commodityToken; dexData.stableToken = _stableToken; //maximum allowed value for difference is 10% could be as low as 0 (1000 = 10.00 %) require( _dexSettings.sellSpotDifference <= 1000 && _dexSettings.buySpotDifference <= 1000, "BP: invalid spot difference" ); dexSettings = _dexSettings; } /// @notice Adds liquidity for both assets /// @param commodityAmount amount of tokens for commodity asset /// @param stableAmount amount of tokens for stable asset function _addLiquidity(uint256 commodityAmount, uint256 stableAmount) internal { dexData.reserveCommodity = dexData.reserveCommodity + commodityAmount; dexData.reserveStable = dexData.reserveStable + stableAmount; emit LiquidityAdded(_msgSender(), commodityAmount, stableAmount); TransferHelper.safeTransferFrom( dexData.commodityToken, msg.sender, address(this), commodityAmount ); TransferHelper.safeTransferFrom( dexData.stableToken, msg.sender, address(this), stableAmount ); } /// @notice Removes liquidity for both assets /// @param commodityAmount amount of tokens for commodity asset /// @param stableAmount amount of tokens for stable asset function _removeLiquidity(uint256 commodityAmount, uint256 stableAmount) internal { dexData.reserveCommodity = dexData.reserveCommodity - commodityAmount; dexData.reserveStable = dexData.reserveStable - stableAmount; emit LiquidityRemoved(_msgSender(), commodityAmount, stableAmount); TransferHelper.safeTransfer( dexData.commodityToken, _msgSender(), commodityAmount ); TransferHelper.safeTransfer( dexData.stableToken, _msgSender(), stableAmount ); } /// @notice Allows to set trade fee for swap /// @param _newTradeFee updated trade fee should be <= 10 ** 8 function setTradeFee(uint256 _newTradeFee) external onlyComdexAdmin { SwapLib._checkFee(_newTradeFee); dexSettings.tradeFee = _newTradeFee; emit TradeFeeChanged(_newTradeFee); } /// @dev Allows comm-dex admin to withdraw fee function withdrawFee() external onlyComdexAdmin { //transfer fee to dexAdmin _withdrawFee(); //reset states _resetFees(); //emit event emit FeeWithdraw( msg.sender, dexData.totalFeeCommodity, dexData.totalFeeStable ); } /// @notice Allows comm-dex admin to set new comm-dex admin /// @param _updatedAdmin the new admin function setCommdexAdmin(address _updatedAdmin) external onlyComdexAdmin { require( _updatedAdmin != address(0) && _updatedAdmin != dexSettings.dexAdmin, "BP: invalid address" ); dexSettings.dexAdmin = _updatedAdmin; emit ComDexAdminChanged(_updatedAdmin); } /// @notice allows owner to withdraw reserves in case of emergency function emergencyWithdraw() external onlyOwner { //transfe the _withDrawReserve(); _resetReserves(); emit EmergencyWithdraw( msg.sender, dexData.reserveCommodity, dexData.reserveStable ); } /// @notice Allows comm-dex admin to self-destruct pool, sends reserves to pool owner and fee to comm-dex admin function withDrawAndDestory(address _to) external onlyComdexAdmin { SwapLib._checkNullAddress(_to); // send reserves to pool owner _withDrawReserve(); // send fee to admin fees _withdrawFee(); emit withDrawAndDestroyed( msg.sender, dexData.reserveCommodity, dexData.reserveStable, dexData.totalFeeCommodity, dexData.totalFeeStable ); selfdestruct(payable(_to)); } ///@dev pass a usd value to convert it to number of stable tokens against it function _convertUSDToStable(uint256 _amount) internal view returns (uint256) { ( , // uint80 roundID int256 price, // uint answer // startedAt , uint256 updatedAt, // updatedAt ) = stableFeedInfo.priceFeed.latestRoundData(); require(price > 0, "BP: stable price error"); //check if updated rate is expired require(!_isStableFeedTimeout(updatedAt), "BP: stable price expired"); // e.g. // price USD = 1 USDT // 1 USD = (1 USDT / price USD)USDT // (amount * priceFeed.decimals() / price USD) USDT = amount USDT return (_amount * 10**stableFeedInfo.priceFeed.decimals()) / uint256(price); } ///@dev returns true if the stable feed updated price is over its heartbeat function _isStableFeedTimeout(uint256 _updatedAt) internal view returns (bool) { if (block.timestamp - _updatedAt < stableFeedInfo.heartbeat) return false; //under 3 minutes is not a timeout else return true; } function _withdrawFee() internal { address dexAdmin = dexSettings.dexAdmin; TransferHelper.safeTransfer( dexData.commodityToken, dexAdmin, dexData.totalFeeCommodity ); TransferHelper.safeTransfer( dexData.stableToken, dexAdmin, dexData.totalFeeStable ); } function _withDrawReserve() internal { address dexOwner = owner(); TransferHelper.safeTransfer( dexData.commodityToken, dexOwner, dexData.reserveCommodity ); TransferHelper.safeTransfer( dexData.stableToken, dexOwner, dexData.reserveStable ); } function _resetReserves() internal { dexData.reserveCommodity = 0; dexData.reserveStable = 0; } function _resetFees() internal { dexData.totalFeeCommodity = 0; dexData.totalFeeStable = 0; } /// @notice Allows comm-dex-admin to pause the Swap function function unpause() external onlyComdexAdmin { _unpause(); } /// @notice Allows comm-dex-admin to un-pause the Swap function function pause() external onlyComdexAdmin { _pause(); } /// @notice Allows pool owner to update unitMultiplier /// @param _unitMultiplier new unitMultiplier function updateUnitMultiplier(uint256 _unitMultiplier) external onlyOwner { require(_unitMultiplier > 0, "BP: Invalid _unitMultiplier"); dexSettings.unitMultiplier = _unitMultiplier; emit UnitMultiplierUpdated(_unitMultiplier); } /// @notice Allows comm-dex-admin to update buySpotDifference /// @param _newDifference new buySpotDifference function updateBuySpotDifference(uint256 _newDifference) external onlyComdexAdmin { //maximum allowed value for difference is 10% could be as low as 0 (1000 = 10.00 %) require( _newDifference <= 1000, "BP: invalid spot difference" ); dexSettings.buySpotDifference = _newDifference; emit BuySpotDifferenceUpdated(_newDifference); } /// @notice Allows comm-dex-admin to update sellSpotDifference /// @param _newDifference new sellSpotDifference function updateSellSpotDifference(uint256 _newDifference) external onlyComdexAdmin { //maximum allowed value for difference is 10% could be as low as 0 (1000 = 10.00 %) require( _newDifference <= 1000, "BP: invalid spot difference" ); dexSettings.sellSpotDifference = _newDifference; emit SellSpotDifferenceUpdated(_newDifference); } /// @dev get maximum allowed amount out and minimum allowed amount out for given expected amount out and slippage values /// @param _expectedAmountOut expected amount of output tokens at the time of quote /// @param _slippage slippage tolerance in percentage 0.00 % - 5.00 % /// @param _amountOut calculated amountOut in this tx function verifySlippageTolerance( uint256 _expectedAmountOut, uint256 _slippage, uint256 _amountOut ) public pure { //slippage value max 5% = 0 -> 500 require(_slippage <= 500, "BP: invalid slippage"); require(_expectedAmountOut > 0, "BP: invalid expected amount"); //allowed minimum amount out for this tx uint256 minAmountOut = _expectedAmountOut - ((_expectedAmountOut * _slippage) / 10000); // 2 slippage decimals //allowed maximum amount out for this tx uint256 maxAmountOut = _expectedAmountOut + ((_expectedAmountOut * _slippage) / 10000); // 2 slippage decimals //verify slippage _amountOut > minimumAmountOut && _amountOut < maximumAmountOut && require( _amountOut >= minAmountOut && _amountOut <= maxAmountOut, "BP: slippage high" ); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.15; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call( abi.encodeWithSelector(0xa9059cbb, to, value) ); require( success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper::safeTransfer: transfer failed" ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // 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::safeTransferFrom: transferFrom failed" ); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.15; interface IPool { event Swapped( address indexed sender, uint256 amountIn, uint256 amountOut, uint256 isSale ); event LiquidityAdded( address indexed sender, uint256 commodityAmount, uint256 stableAmount ); event LiquidityRemoved( address indexed sender, uint256 commodityAmount, uint256 stableAmount ); event TradeFeeChanged(uint256 newTradeFee); event ComDexAdminChanged(address newAdmin); event EmergencyWithdraw( address indexed sender, uint256 commodityAmount, uint256 stableAmount ); event FeeWithdraw( address indexed sender, uint256 commodityAmount, uint256 stableAmount ); event FeedAddressesChanged(address newCommodityFeed, address newStableFeed); event withDrawAndDestroyed( address indexed sender, uint256 reserveCommodity, uint256 reserveStable, uint256 feeA, uint256 feeB ); event UnitMultiplierUpdated(uint256); event BuySpotDifferenceUpdated(uint256); event SellSpotDifferenceUpdated(uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.15; interface IERC20 { function decimals() external view returns (uint8); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.15; import "./../interfaces/IERC20.sol"; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; library ChainlinkLib { struct ApiInfo { string apiUrl; string[2] chainlinkRequestPath; //0 index contains buy and 1 contains sell } struct ChainlinkApiInfo { address chainlinkToken; address chainlinkOracle; bytes32 jobId; uint256 singleRequestFee; } } library SwapLib { uint256 constant BUY_INDEX = 0; //index used to indicate a BUY trx uint256 constant SELL_INDEX = 1; //index used to indicate a SELL trx uint256 constant SUPPORTED_DECIMALS = 8; //chainlink request and support contract decimals struct DexSetting { string comdexName; //name of the dex-pool uint256 tradeFee; //percentage fee deducted on each swap in 10**8 decimals address dexAdmin; //address responsible for certain admin functions e.g. addLiquidity uint256 rateTimeOut; //if expires swap will be paused uint256 unitMultiplier; //to convert feed price units to commodity token units uint256 buySpotDifference; // % difference in buy spot price e.g 112 means 1.12% uint256 sellSpotDifference; // % difference in sell spot price e.g 104 means 1.04% } struct DexData { uint256 reserveCommodity; //total commodity reserves uint256 reserveStable; //total stable reserves uint256 totalFeeCommodity; // storage that the fee of token A can be stored uint256 totalFeeStable; // storage that the fee of token B can be stored address commodityToken; address stableToken; } struct FeedInfo { //chainlink data feed reference AggregatorV3Interface priceFeed; uint256 heartbeat; } function _normalizeAmount( uint256 _amountIn, address _from, address _to ) internal view returns (uint256) { uint256 fromDecimals = IERC20(_from).decimals(); uint256 toDecimals = IERC20(_to).decimals(); if (fromDecimals == toDecimals) return _amountIn; return fromDecimals > toDecimals ? _amountIn / (10**(fromDecimals - toDecimals)) : _amountIn * (10**(toDecimals - fromDecimals)); } function _checkFee(uint256 _fee) internal pure { require(_fee <= 10**8, "Lib: wrong fee amount"); } function _checkRateTimeout(uint256 _newDuration) internal pure { require( _newDuration > 60 && _newDuration <= 300,//changed to minutes after delay implementation "Lib: invalid timeout" ); } function _checkNullAddress(address _address) internal pure { require(_address != address(0), "Lib: invalid address"); } } library PriceLib { struct PriceInfo { bytes32[] chainlinkRequestId; // = new bytes32[](2);//0 index contains buy and 1 contains sell uint256[] lastTimeStamp; // price time 0 index contains buy and 1 contains sell uint256[] lastPriceFeed; // price 0 index contains buy and 1 contains sell uint256[] lastRequestTime; // time of last request 0 index contains buy and 1 contains sell uint256[] cachedRequestTimeStamp; // request start time 0 index contains buy and 1 contains sell } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AggregatorV3Interface { 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 ); }
// 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; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_commodityToken","type":"address"},{"internalType":"address","name":"_stableToken","type":"address"},{"components":[{"internalType":"string","name":"comdexName","type":"string"},{"internalType":"uint256","name":"tradeFee","type":"uint256"},{"internalType":"address","name":"dexAdmin","type":"address"},{"internalType":"uint256","name":"rateTimeOut","type":"uint256"},{"internalType":"uint256","name":"unitMultiplier","type":"uint256"},{"internalType":"uint256","name":"buySpotDifference","type":"uint256"},{"internalType":"uint256","name":"sellSpotDifference","type":"uint256"}],"internalType":"struct SwapLib.DexSetting","name":"_dexSettings","type":"tuple"},{"components":[{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint256","name":"heartbeat","type":"uint256"}],"internalType":"struct SwapLib.FeedInfo","name":"_commodityFeedInfo","type":"tuple"},{"components":[{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint256","name":"heartbeat","type":"uint256"}],"internalType":"struct SwapLib.FeedInfo","name":"_stableFeedInfo","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"BuySpotDifferenceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"ComDexAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"commodityAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stableAmount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"commodityAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stableAmount","type":"uint256"}],"name":"FeeWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newCommodityFeed","type":"address"},{"indexed":false,"internalType":"address","name":"newStableFeed","type":"address"}],"name":"FeedAddressesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"commodityAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stableAmount","type":"uint256"}],"name":"LiquidityAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"commodityAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stableAmount","type":"uint256"}],"name":"LiquidityRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"SellSpotDifferenceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"isSale","type":"uint256"}],"name":"Swapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newTradeFee","type":"uint256"}],"name":"TradeFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"UnitMultiplierUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"reserveCommodity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reserveStable","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeA","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeB","type":"uint256"}],"name":"withDrawAndDestroyed","type":"event"},{"inputs":[{"internalType":"uint256","name":"_commodityAmount","type":"uint256"},{"internalType":"uint256","name":"_stableAmount","type":"uint256"},{"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"addLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"commodityFeedInfo","outputs":[{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint256","name":"heartbeat","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexData","outputs":[{"internalType":"uint256","name":"reserveCommodity","type":"uint256"},{"internalType":"uint256","name":"reserveStable","type":"uint256"},{"internalType":"uint256","name":"totalFeeCommodity","type":"uint256"},{"internalType":"uint256","name":"totalFeeStable","type":"uint256"},{"internalType":"address","name":"commodityToken","type":"address"},{"internalType":"address","name":"stableToken","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexSettings","outputs":[{"internalType":"string","name":"comdexName","type":"string"},{"internalType":"uint256","name":"tradeFee","type":"uint256"},{"internalType":"address","name":"dexAdmin","type":"address"},{"internalType":"uint256","name":"rateTimeOut","type":"uint256"},{"internalType":"uint256","name":"unitMultiplier","type":"uint256"},{"internalType":"uint256","name":"buySpotDifference","type":"uint256"},{"internalType":"uint256","name":"sellSpotDifference","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_commodityAmount","type":"uint256"},{"internalType":"uint256","name":"_stableAmount","type":"uint256"},{"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"removeLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_updatedAdmin","type":"address"}],"name":"setCommdexAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint256","name":"heartbeat","type":"uint256"}],"internalType":"struct SwapLib.FeedInfo","name":"_commodityFeedInfo","type":"tuple"},{"components":[{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint256","name":"heartbeat","type":"uint256"}],"internalType":"struct SwapLib.FeedInfo","name":"_stableFeedInfo","type":"tuple"}],"name":"setFeedSetting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newTradeFee","type":"uint256"}],"name":"setTradeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stableFeedInfo","outputs":[{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint256","name":"heartbeat","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_expectedAmountOut","type":"uint256"},{"internalType":"uint256","name":"_slippage","type":"uint256"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newDifference","type":"uint256"}],"name":"updateBuySpotDifference","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newDifference","type":"uint256"}],"name":"updateSellSpotDifference","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unitMultiplier","type":"uint256"}],"name":"updateUnitMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_expectedAmountOut","type":"uint256"},{"internalType":"uint256","name":"_slippage","type":"uint256"},{"internalType":"uint256","name":"_amountOut","type":"uint256"}],"name":"verifySlippageTolerance","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"withDrawAndDestory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620030b7380380620030b7833981016040819052620000349162000a36565b848484620000423362000247565b6000805460ff60a01b191690556080810151620000a65760405162461bcd60e51b815260206004820152601b60248201527f42503a20496e76616c6964205f756e69744d756c7469706c696572000000000060448201526064015b60405180910390fd5b620000c081604001516200029760201b62000ff71760201c565b620000da8160200151620002f260201b620010441760201c565b620000f0836200029760201b62000ff71760201c565b62000106826200029760201b62000ff71760201c565b6200012081606001516200034860201b620010901760201c565b600580546001600160a01b038086166001600160a01b031992831617909255600680549285169290911691909117905560c08101516103e8108015906200016d57506103e88160a0015111155b620001bb5760405162461bcd60e51b815260206004820152601b60248201527f42503a20696e76616c69642073706f7420646966666572656e6365000000000060448201526064016200009d565b805181906007908190620001d0908262000bd3565b506020820151600182015560408201516002820180546001600160a01b0319166001600160a01b03909216919091179055606082015160038201556080820151600482015560a0820151600582015560c090910151600690910155506200023c915083905082620003a9565b505050505062000eb1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116620002ef5760405162461bcd60e51b815260206004820152601460248201527f4c69623a20696e76616c6964206164647265737300000000000000000000000060448201526064016200009d565b50565b6305f5e100811115620002ef5760405162461bcd60e51b815260206004820152601560248201527f4c69623a2077726f6e672066656520616d6f756e74000000000000000000000060448201526064016200009d565b603c811180156200035b575061012c8111155b620002ef5760405162461bcd60e51b815260206004820152601460248201527f4c69623a20696e76616c69642074696d656f757400000000000000000000000060448201526064016200009d565b600a8260200151118015620003c5575062015180826020015111155b620004135760405162461bcd60e51b815260206004820152601f60248201527f50433a20696e76616c69642068656172746265617420636f6d6d6f646974790060448201526064016200009d565b600a81602001511180156200042f575062015180816020015111155b6200047d5760405162461bcd60e51b815260206004820152601c60248201527f50433a20696e76616c69642068656172746265617420737461626c650000000060448201526064016200009d565b8151601080546001600160a01b0319166001600160a01b0390921691909117905560208201516011556000620004b262000537565b8251600e80546001600160a01b0319166001600160a01b039092169190911790556020830151600f559050620004e88162000698565b5082518251604080516001600160a01b0393841681529290911660208301527f406db514094ada90a29eb37cb8ffb4a7c0a096ce011019439364ec1754621322910160405180910390a1505050565b6000806000601060000160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa15801562000593573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005b9919062000cb7565b5093505092505060008213620006125760405162461bcd60e51b815260206004820152601960248201527f42503a20636861696e4c696e6b207072696365206572726f720000000000000060448201526064016200009d565b6200061d816200086a565b156200066c5760405162461bcd60e51b815260206004820152601b60248201527f42503a20636f6d6d6f646974792070726963652065787069726564000000000060448201526064016200009d565b600b54670de0b6b3a76400009062000685908462000d16565b62000691919062000d38565b9250505090565b6000806000600e60000160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015620006f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200071a919062000cb7565b5093505092505060008213620007735760405162461bcd60e51b815260206004820152601660248201527f42503a20737461626c65207072696365206572726f720000000000000000000060448201526064016200009d565b6200077e8162000898565b15620007cd5760405162461bcd60e51b815260206004820152601860248201527f42503a20737461626c652070726963652065787069726564000000000000000060448201526064016200009d565b600e546040805163313ce56760e01b8152905184926001600160a01b03169163313ce5679160048083019260209291908290030181865afa15801562000817573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200083d919062000d5b565b6200084a90600a62000e86565b62000856908662000d16565b62000862919062000d38565b949350505050565b6011546000906200087c834262000e97565b10156200088b57506000919050565b506001919050565b919050565b600f546000906200087c834262000e97565b6001600160a01b0381168114620002ef57600080fd5b80516200089381620008aa565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715620009085762000908620008cd565b60405290565b604051601f8201601f191681016001600160401b0381118282101715620009395762000939620008cd565b604052919050565b600082601f8301126200095357600080fd5b81516001600160401b038111156200096f576200096f620008cd565b602062000985601f8301601f191682016200090e565b82815285828487010111156200099a57600080fd5b60005b83811015620009ba5785810183015182820184015282016200099d565b83811115620009cc5760008385840101525b5095945050505050565b600060408284031215620009e957600080fd5b604080519081016001600160401b038111828210171562000a0e5762000a0e620008cd565b8060405250809150825162000a2381620008aa565b8152602092830151920191909152919050565b600080600080600060e0868803121562000a4f57600080fd5b855162000a5c81620008aa565b602087015190955062000a6f81620008aa565b60408701519094506001600160401b038082111562000a8d57600080fd5b9087019060e0828a03121562000aa257600080fd5b62000aac620008e3565b82518281111562000abc57600080fd5b62000aca8b82860162000941565b8252506020830151602082015262000ae560408401620008c0565b6040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015280955050505062000b278760608801620009d6565b915062000b388760a08801620009d6565b90509295509295909350565b600181811c9082168062000b5957607f821691505b60208210810362000b7a57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000bce57600081815260208120601f850160051c8101602086101562000ba95750805b601f850160051c820191505b8181101562000bca5782815560010162000bb5565b5050505b505050565b81516001600160401b0381111562000bef5762000bef620008cd565b62000c078162000c00845462000b44565b8462000b80565b602080601f83116001811462000c3f576000841562000c265750858301515b600019600386901b1c1916600185901b17855562000bca565b600085815260208120601f198616915b8281101562000c705788860151825594840194600190910190840162000c4f565b508582101562000c8f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80516001600160501b03811681146200089357600080fd5b600080600080600060a0868803121562000cd057600080fd5b62000cdb8662000c9f565b945060208601519350604086015192506060860151915062000b386080870162000c9f565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161562000d335762000d3362000d00565b500290565b60008262000d5657634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121562000d6e57600080fd5b815160ff8116811462000d8057600080fd5b9392505050565b600181815b8085111562000dc857816000190482111562000dac5762000dac62000d00565b8085161562000dba57918102915b93841c939080029062000d8c565b509250929050565b60008262000de15750600162000e80565b8162000df05750600062000e80565b816001811462000e09576002811462000e145762000e34565b600191505062000e80565b60ff84111562000e285762000e2862000d00565b50506001821b62000e80565b5060208310610133831016604e8410600b841016171562000e59575081810a62000e80565b62000e65838362000d87565b806000190482111562000e7c5762000e7c62000d00565b0290505b92915050565b600062000d8060ff84168362000dd0565b60008282101562000eac5762000eac62000d00565b500390565b6121f68062000ec16000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c80638da5cb5b116100c3578063ec902c3c1161007c578063ec902c3c146102ce578063f166d722146102e1578063f2fde38b146102f4578063f31754a914610307578063fbcd9baf1461031e578063fcb505471461033157600080fd5b80638da5cb5b14610262578063904366cb1461027d578063c122689e14610298578063db2e21bc146102ab578063de3f4964146102b3578063e941fa78146102c657600080fd5b8063715018a611610115578063715018a6146101d557806372490905146101dd5780637817b8d9146101f05780637cabb7cf146102265780638456cb5914610247578063857620e11461024f57600080fd5b8063106030231461015d5780633f4ba83a14610172578063422f10431461017a578063428295561461018d5780635268dff4146101a05780635c975abb146101b3575b600080fd5b61017061016b366004611d1a565b610394565b005b6101706103e1565b610170610188366004611d33565b6103f3565b61017061019b366004611d74565b610425565b6101706101ae366004611d1a565b6104a5565b600054600160a01b900460ff1660405190151581526020015b60405180910390f35b610170610539565b6101706101eb366004611d1a565b61054b565b601054601154610207916001600160a01b03169082565b604080516001600160a01b0390931683526020830191909152016101cc565b610239610234366004611d91565b6105d8565b6040519081526020016101cc565b6101706107b5565b61017061025d366004611d33565b6107c5565b6000546040516001600160a01b0390911681526020016101cc565b6102856107f1565b6040516101cc9796959493929190611ddf565b6101706102a6366004611d1a565b6108b4565b610170610943565b6101706102c1366004611d74565b6109ab565b610170610a69565b6101706102dc366004611e44565b610ac7565b6101706102ef366004611f01565b610e2e565b610170610302366004611d74565b610e44565b600e54600f54610207916001600160a01b03169082565b61017061032c366004611d33565b610ebd565b60015460025460035460045460055460065461035b95949392916001600160a01b03908116911686565b6040805196875260208701959095529385019290925260608401526001600160a01b0390811660808401521660a082015260c0016101cc565b61039c6110e5565b6103a581611044565b60088190556040518181527ff0e2ab1868f9bae31bda39e0675a42ea0e3b42d3493c88758f0382bf0e9b0496906020015b60405180910390a150565b6103e96110e5565b6103f161113f565b565b6103fb611194565b60006104088460016105d8565b9050610415838383610ebd565b61041f84826111ee565b50505050565b61042d6110e5565b61043681610ff7565b61043e61127b565b6104466112b8565b60015460025460035460045460408051948552602085019390935291830152606082015233907f929c694885655c95a9c91b77c303c2b892059e3523bc0d4d35455aad19cf85149060800160405180910390a2806001600160a01b0316ff5b6104ad6110e5565b6103e88111156105045760405162461bcd60e51b815260206004820152601b60248201527f42503a20696e76616c69642073706f7420646966666572656e6365000000000060448201526064015b60405180910390fd5b600c8190556040518181527f19ef1190619d666d5f5d1e5026ad916038afc84ed8ec9b4dbf9212114205212c906020016103d6565b610541611194565b6103f160006112f5565b610553611194565b600081116105a35760405162461bcd60e51b815260206004820152601b60248201527f42503a20496e76616c6964205f756e69744d756c7469706c696572000000000060448201526064016104fb565b600b8190556040518181527f26e7a33f0396f0a08f5e65e9320ad31f118b5376bea3684eb0a5f299de8cd005906020016103d6565b6000806105e3611345565b905060006105f082611499565b9050836106d957600c54612710906106089083611f4c565b6106129190611f6b565b61061c9082611f8d565b6010546040805163313ce56760e01b8152905192935060009284926001600160a01b03169163313ce5679160048083019260209291908290030181865afa15801561066b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068f9190611fa5565b61069a90600a6120ac565b6106a49088611f4c565b6106ae9190611f6b565b6006546005549192506106cf9183916001600160a01b039081169116611652565b93505050506107af565b600e546040805163313ce56760e01b815290516000926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015610723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107479190611fa5565b61075290600a6120ac565b61075c8388611f4c565b6107669190611f6b565b600d549091506127109061077a9083611f4c565b6107849190611f6b565b61078e90826120bb565b6005546006549192506106cf9183916001600160a01b039081169116611652565b92915050565b6107bd6110e5565b6103f161178c565b6107cd611194565b60006107da8460016105d8565b90506107e7838383610ebd565b61041f84826117cf565b600780548190610800906120d2565b80601f016020809104026020016040519081016040528092919081815260200182805461082c906120d2565b80156108795780601f1061084e57610100808354040283529160200191610879565b820191906000526020600020905b81548152906001019060200180831161085c57829003601f168201915b50505060018401546002850154600386015460048701546005880154600690980154969793966001600160a01b039093169550909350919087565b6108bc6110e5565b6103e881111561090e5760405162461bcd60e51b815260206004820152601b60248201527f42503a20696e76616c69642073706f7420646966666572656e6365000000000060448201526064016104fb565b600d8190556040518181527f36e7e564e87c144db6a3a568095e0f8f19ac83cde53c2a9b1f7824bfbc4adaac906020016103d6565b61094b611194565b61095361127b565b61096260006001819055600255565b60015460025460405133927fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae0595926109a192918252602082015260400190565b60405180910390a2565b6109b36110e5565b6001600160a01b038116158015906109d957506009546001600160a01b03828116911614155b610a1b5760405162461bcd60e51b815260206004820152601360248201527242503a20696e76616c6964206164647265737360681b60448201526064016104fb565b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527fb3a69239de67e2813bd250b7b9c332d3989f9d5fa53575dcdeb25dde3e9bc1ea906020016103d6565b610a716110e5565b610a796112b8565b610a8860006003819055600455565b60035460045460405133927f5c170c563ea37bd3580cc3b1c6d0d9e35c29182d2e26ce550917bdb7ef34bbcd926109a192918252602082015260400190565b610acf61185a565b60008511610b125760405162461bcd60e51b815260206004820152601060248201526f1410ce881ddc9bdb99c8185b5bdd5b9d60821b60448201526064016104fb565b6005546001600160a01b038381169116148015610b3c57506006546001600160a01b038281169116145b80610b6c57506005546001600160a01b038281169116148015610b6c57506006546001600160a01b038381169116145b610ba95760405162461bcd60e51b815260206004820152600e60248201526d28219d103bb937b733903830b4b960911b60448201526064016104fb565b6008546000906402540be40090610bc09088611f4c565b610bca9190611f6b565b6005549091506001600160a01b0390811690841603610d06576000610bef82886120bb565b90506000610bfe8260016105d8565b90508060018001541015610c4f5760405162461bcd60e51b815260206004820152601860248201527750433a206e6f7420656e6f756768206c697175696469747960401b60448201526064016104fb565b610c5a878783610ebd565b600154610c68908390611f8d565b600155600254610c799082906120bb565b600255600354610c8a908490611f8d565b6003556040805189815260208101839052600181830152905133917f36a39cf3f9b8206db312650e7d954482535a2e33fb0b54e1030f149ed213823a919081900360600190a2600554610ce8906001600160a01b031633308b6118a7565b600654610cff906001600160a01b031633836119e1565b5050610e26565b6000610d1282886120bb565b90506000610d218260006105d8565b9050806001600001541015610d735760405162461bcd60e51b815260206004820152601860248201527750433a206e6f7420656e6f756768206c697175696469747960401b60448201526064016104fb565b610d7e878783610ebd565b600154610d8c9082906120bb565b600155600254610d9d908390611f8d565b600255600454610dae908490611f8d565b6004556040805189815260208101839052600081830152905133917f36a39cf3f9b8206db312650e7d954482535a2e33fb0b54e1030f149ed213823a919081900360600190a2600654610e0c906001600160a01b031633308b6118a7565b600554610e23906001600160a01b031633836119e1565b50505b505050505050565b610e366110e5565b610e408282611b0b565b5050565b610e4c611194565b6001600160a01b038116610eb15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104fb565b610eba816112f5565b50565b6101f4821115610f065760405162461bcd60e51b815260206004820152601460248201527342503a20696e76616c696420736c69707061676560601b60448201526064016104fb565b60008311610f565760405162461bcd60e51b815260206004820152601b60248201527f42503a20696e76616c696420657870656374656420616d6f756e74000000000060448201526064016104fb565b6000612710610f658486611f4c565b610f6f9190611f6b565b610f7990856120bb565b90506000612710610f8a8587611f4c565b610f949190611f6b565b610f9e9086611f8d565b9050818310158015610fb05750808311155b610ff05760405162461bcd60e51b8152602060048201526011602482015270084a07440e6d8d2e0e0c2ceca40d0d2ced607b1b60448201526064016104fb565b5050505050565b6001600160a01b038116610eba5760405162461bcd60e51b81526020600482015260146024820152734c69623a20696e76616c6964206164647265737360601b60448201526064016104fb565b6305f5e100811115610eba5760405162461bcd60e51b8152602060048201526015602482015274131a588e881ddc9bdb99c819995948185b5bdd5b9d605a1b60448201526064016104fb565b603c811180156110a2575061012c8111155b610eba5760405162461bcd60e51b8152602060048201526014602482015273131a588e881a5b9d985b1a59081d1a5b595bdd5d60621b60448201526064016104fb565b6009546001600160a01b031633146103f15760405162461bcd60e51b815260206004820152601960248201527f42503a2063616c6c6572206e6f7420706f6f6c2061646d696e0000000000000060448201526064016104fb565b611147611c8f565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000546001600160a01b031633146103f15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104fb565b6001546111fc908390611f8d565b60015560025461120d908290611f8d565b600255604080518381526020810183905233917fac1d76749e5447b7b16f5ab61447e1bd502f3bb4807af3b28e620d1700a6ee45910160405180910390a2600554611263906001600160a01b03163330856118a7565b600654610e40906001600160a01b03163330846118a7565b6000546005546001546001600160a01b039283169261129d92169083906119e1565b600654600254610eba916001600160a01b03169083906119e1565b6009546005546003546001600160a01b03928316926112da92169083906119e1565b600654600454610eba916001600160a01b03169083906119e1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000601060000160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156113a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c49190612126565b509350509250506000821361141b5760405162461bcd60e51b815260206004820152601960248201527f42503a20636861696e4c696e6b207072696365206572726f720000000000000060448201526064016104fb565b61142481611cdf565b156114715760405162461bcd60e51b815260206004820152601b60248201527f42503a20636f6d6d6f646974792070726963652065787069726564000000000060448201526064016104fb565b600b54670de0b6b3a7640000906114889084611f4c565b6114929190611f6b565b9250505090565b6000806000600e60000160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156114f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115189190612126565b50935050925050600082136115685760405162461bcd60e51b815260206004820152601660248201527521281d1039ba30b1363290383934b1b29032b93937b960511b60448201526064016104fb565b61157181611d0a565b156115be5760405162461bcd60e51b815260206004820152601860248201527f42503a20737461626c652070726963652065787069726564000000000000000060448201526064016104fb565b600e546040805163313ce56760e01b8152905184926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015611607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162b9190611fa5565b61163690600a6120ac565b6116409086611f4c565b61164a9190611f6b565b949350505050565b600080836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611693573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b79190611fa5565b60ff1690506000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117209190611fa5565b60ff169050808203611736578592505050611785565b8082116117615761174782826120bb565b61175290600a612176565b61175c9087611f4c565b611780565b61176b81836120bb565b61177690600a612176565b6117809087611f6b565b925050505b9392505050565b61179461185a565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586111773390565b6001546117dd9083906120bb565b6001556002546117ee9082906120bb565b600255604080518381526020810183905233917f96cd817c6329656790ef8fba7675405193677d39619571282f5e21f3a98cd059910160405180910390a2600554611843906001600160a01b031633846119e1565b600654610e40906001600160a01b031633836119e1565b600054600160a01b900460ff16156103f15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104fb565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161190b9190612182565b6000604051808303816000865af19150503d8060008114611948576040519150601f19603f3d011682016040523d82523d6000602084013e61194d565b606091505b5091509150818015611977575080511580611977575080806020019051810190611977919061219e565b610e265760405162461bcd60e51b815260206004820152603560248201527f5472616e7366657248656c7065723a3a736166655472616e7366657246726f6d6044820152740e881d1c985b9cd9995c919c9bdb4819985a5b1959605a1b60648201526084016104fb565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611a3d9190612182565b6000604051808303816000865af19150503d8060008114611a7a576040519150601f19603f3d011682016040523d82523d6000602084013e611a7f565b606091505b5091509150818015611aa9575080511580611aa9575080806020019051810190611aa9919061219e565b610ff05760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201526c185b9cd9995c8819985a5b1959609a1b60648201526084016104fb565b600a8260200151118015611b26575062015180826020015111155b611b725760405162461bcd60e51b815260206004820152601f60248201527f50433a20696e76616c69642068656172746265617420636f6d6d6f646974790060448201526064016104fb565b600a8160200151118015611b8d575062015180816020015111155b611bd95760405162461bcd60e51b815260206004820152601c60248201527f50433a20696e76616c69642068656172746265617420737461626c650000000060448201526064016104fb565b8151601080546001600160a01b0319166001600160a01b0390921691909117905560208201516011556000611c0c611345565b8251600e80546001600160a01b0319166001600160a01b039092169190911790556020830151600f559050611c4081611499565b5082518251604080516001600160a01b0393841681529290911660208301527f406db514094ada90a29eb37cb8ffb4a7c0a096ce011019439364ec1754621322910160405180910390a1505050565b600054600160a01b900460ff166103f15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104fb565b601154600090611cef83426120bb565b1015611cfd57506000919050565b506001919050565b919050565b600f54600090611cef83426120bb565b600060208284031215611d2c57600080fd5b5035919050565b600080600060608486031215611d4857600080fd5b505081359360208301359350604090920135919050565b6001600160a01b0381168114610eba57600080fd5b600060208284031215611d8657600080fd5b813561178581611d5f565b60008060408385031215611da457600080fd5b50508035926020909101359150565b60005b83811015611dce578181015183820152602001611db6565b8381111561041f5750506000910152565b60e08152600088518060e0840152610100611e008282860160208e01611db3565b60208401999099526001600160a01b03979097166040830152506060810194909452608084019290925260a083015260c0820152601f909101601f19160101919050565b600080600080600060a08688031215611e5c57600080fd5b8535945060208601359350604086013592506060860135611e7c81611d5f565b91506080860135611e8c81611d5f565b809150509295509295909350565b600060408284031215611eac57600080fd5b6040516040810181811067ffffffffffffffff82111715611edd57634e487b7160e01b600052604160045260246000fd5b6040529050808235611eee81611d5f565b8152602092830135920191909152919050565b60008060808385031215611f1457600080fd5b611f1e8484611e9a565b9150611f2d8460408501611e9a565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611f6657611f66611f36565b500290565b600082611f8857634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611fa057611fa0611f36565b500190565b600060208284031215611fb757600080fd5b815160ff8116811461178557600080fd5b600181815b80851115612003578160001904821115611fe957611fe9611f36565b80851615611ff657918102915b93841c9390800290611fcd565b509250929050565b60008261201a575060016107af565b81612027575060006107af565b816001811461203d576002811461204757612063565b60019150506107af565b60ff84111561205857612058611f36565b50506001821b6107af565b5060208310610133831016604e8410600b8410161715612086575081810a6107af565b6120908383611fc8565b80600019048211156120a4576120a4611f36565b029392505050565b600061178560ff84168361200b565b6000828210156120cd576120cd611f36565b500390565b600181811c908216806120e657607f821691505b60208210810361210657634e487b7160e01b600052602260045260246000fd5b50919050565b805169ffffffffffffffffffff81168114611d0557600080fd5b600080600080600060a0868803121561213e57600080fd5b6121478661210c565b945060208601519350604086015192506060860151915061216a6080870161210c565b90509295509295909350565b6000611785838361200b565b60008251612194818460208701611db3565b9190910192915050565b6000602082840312156121b057600080fd5b8151801515811461178557600080fdfea2646970667358221220006f4c874b0662b0c3391c23428d0a061c97abfd3dbb00c77686d6461b0da7e464736f6c634300080f0033000000000000000000000000171f9cfc136f2b2aaa148fcc6b660a2029bab048000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000214ed9da11d2fbe465a6fc601a91e62ebec1a0d600000000000000000000000000000000000000000000000000000000000151800000000000000000000000003e7d1eab13ad0104d2750b8863b489d65364e32d000000000000000000000000000000000000000000000000000000000001518000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000004c4b400000000000000000000000001b06089da471355f8f05c7a6d8de1d9dac39762900000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000723841318760000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000006800000000000000000000000000000000000000000000000000000000000000084155532f55534454000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80638da5cb5b116100c3578063ec902c3c1161007c578063ec902c3c146102ce578063f166d722146102e1578063f2fde38b146102f4578063f31754a914610307578063fbcd9baf1461031e578063fcb505471461033157600080fd5b80638da5cb5b14610262578063904366cb1461027d578063c122689e14610298578063db2e21bc146102ab578063de3f4964146102b3578063e941fa78146102c657600080fd5b8063715018a611610115578063715018a6146101d557806372490905146101dd5780637817b8d9146101f05780637cabb7cf146102265780638456cb5914610247578063857620e11461024f57600080fd5b8063106030231461015d5780633f4ba83a14610172578063422f10431461017a578063428295561461018d5780635268dff4146101a05780635c975abb146101b3575b600080fd5b61017061016b366004611d1a565b610394565b005b6101706103e1565b610170610188366004611d33565b6103f3565b61017061019b366004611d74565b610425565b6101706101ae366004611d1a565b6104a5565b600054600160a01b900460ff1660405190151581526020015b60405180910390f35b610170610539565b6101706101eb366004611d1a565b61054b565b601054601154610207916001600160a01b03169082565b604080516001600160a01b0390931683526020830191909152016101cc565b610239610234366004611d91565b6105d8565b6040519081526020016101cc565b6101706107b5565b61017061025d366004611d33565b6107c5565b6000546040516001600160a01b0390911681526020016101cc565b6102856107f1565b6040516101cc9796959493929190611ddf565b6101706102a6366004611d1a565b6108b4565b610170610943565b6101706102c1366004611d74565b6109ab565b610170610a69565b6101706102dc366004611e44565b610ac7565b6101706102ef366004611f01565b610e2e565b610170610302366004611d74565b610e44565b600e54600f54610207916001600160a01b03169082565b61017061032c366004611d33565b610ebd565b60015460025460035460045460055460065461035b95949392916001600160a01b03908116911686565b6040805196875260208701959095529385019290925260608401526001600160a01b0390811660808401521660a082015260c0016101cc565b61039c6110e5565b6103a581611044565b60088190556040518181527ff0e2ab1868f9bae31bda39e0675a42ea0e3b42d3493c88758f0382bf0e9b0496906020015b60405180910390a150565b6103e96110e5565b6103f161113f565b565b6103fb611194565b60006104088460016105d8565b9050610415838383610ebd565b61041f84826111ee565b50505050565b61042d6110e5565b61043681610ff7565b61043e61127b565b6104466112b8565b60015460025460035460045460408051948552602085019390935291830152606082015233907f929c694885655c95a9c91b77c303c2b892059e3523bc0d4d35455aad19cf85149060800160405180910390a2806001600160a01b0316ff5b6104ad6110e5565b6103e88111156105045760405162461bcd60e51b815260206004820152601b60248201527f42503a20696e76616c69642073706f7420646966666572656e6365000000000060448201526064015b60405180910390fd5b600c8190556040518181527f19ef1190619d666d5f5d1e5026ad916038afc84ed8ec9b4dbf9212114205212c906020016103d6565b610541611194565b6103f160006112f5565b610553611194565b600081116105a35760405162461bcd60e51b815260206004820152601b60248201527f42503a20496e76616c6964205f756e69744d756c7469706c696572000000000060448201526064016104fb565b600b8190556040518181527f26e7a33f0396f0a08f5e65e9320ad31f118b5376bea3684eb0a5f299de8cd005906020016103d6565b6000806105e3611345565b905060006105f082611499565b9050836106d957600c54612710906106089083611f4c565b6106129190611f6b565b61061c9082611f8d565b6010546040805163313ce56760e01b8152905192935060009284926001600160a01b03169163313ce5679160048083019260209291908290030181865afa15801561066b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068f9190611fa5565b61069a90600a6120ac565b6106a49088611f4c565b6106ae9190611f6b565b6006546005549192506106cf9183916001600160a01b039081169116611652565b93505050506107af565b600e546040805163313ce56760e01b815290516000926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015610723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107479190611fa5565b61075290600a6120ac565b61075c8388611f4c565b6107669190611f6b565b600d549091506127109061077a9083611f4c565b6107849190611f6b565b61078e90826120bb565b6005546006549192506106cf9183916001600160a01b039081169116611652565b92915050565b6107bd6110e5565b6103f161178c565b6107cd611194565b60006107da8460016105d8565b90506107e7838383610ebd565b61041f84826117cf565b600780548190610800906120d2565b80601f016020809104026020016040519081016040528092919081815260200182805461082c906120d2565b80156108795780601f1061084e57610100808354040283529160200191610879565b820191906000526020600020905b81548152906001019060200180831161085c57829003601f168201915b50505060018401546002850154600386015460048701546005880154600690980154969793966001600160a01b039093169550909350919087565b6108bc6110e5565b6103e881111561090e5760405162461bcd60e51b815260206004820152601b60248201527f42503a20696e76616c69642073706f7420646966666572656e6365000000000060448201526064016104fb565b600d8190556040518181527f36e7e564e87c144db6a3a568095e0f8f19ac83cde53c2a9b1f7824bfbc4adaac906020016103d6565b61094b611194565b61095361127b565b61096260006001819055600255565b60015460025460405133927fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae0595926109a192918252602082015260400190565b60405180910390a2565b6109b36110e5565b6001600160a01b038116158015906109d957506009546001600160a01b03828116911614155b610a1b5760405162461bcd60e51b815260206004820152601360248201527242503a20696e76616c6964206164647265737360681b60448201526064016104fb565b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527fb3a69239de67e2813bd250b7b9c332d3989f9d5fa53575dcdeb25dde3e9bc1ea906020016103d6565b610a716110e5565b610a796112b8565b610a8860006003819055600455565b60035460045460405133927f5c170c563ea37bd3580cc3b1c6d0d9e35c29182d2e26ce550917bdb7ef34bbcd926109a192918252602082015260400190565b610acf61185a565b60008511610b125760405162461bcd60e51b815260206004820152601060248201526f1410ce881ddc9bdb99c8185b5bdd5b9d60821b60448201526064016104fb565b6005546001600160a01b038381169116148015610b3c57506006546001600160a01b038281169116145b80610b6c57506005546001600160a01b038281169116148015610b6c57506006546001600160a01b038381169116145b610ba95760405162461bcd60e51b815260206004820152600e60248201526d28219d103bb937b733903830b4b960911b60448201526064016104fb565b6008546000906402540be40090610bc09088611f4c565b610bca9190611f6b565b6005549091506001600160a01b0390811690841603610d06576000610bef82886120bb565b90506000610bfe8260016105d8565b90508060018001541015610c4f5760405162461bcd60e51b815260206004820152601860248201527750433a206e6f7420656e6f756768206c697175696469747960401b60448201526064016104fb565b610c5a878783610ebd565b600154610c68908390611f8d565b600155600254610c799082906120bb565b600255600354610c8a908490611f8d565b6003556040805189815260208101839052600181830152905133917f36a39cf3f9b8206db312650e7d954482535a2e33fb0b54e1030f149ed213823a919081900360600190a2600554610ce8906001600160a01b031633308b6118a7565b600654610cff906001600160a01b031633836119e1565b5050610e26565b6000610d1282886120bb565b90506000610d218260006105d8565b9050806001600001541015610d735760405162461bcd60e51b815260206004820152601860248201527750433a206e6f7420656e6f756768206c697175696469747960401b60448201526064016104fb565b610d7e878783610ebd565b600154610d8c9082906120bb565b600155600254610d9d908390611f8d565b600255600454610dae908490611f8d565b6004556040805189815260208101839052600081830152905133917f36a39cf3f9b8206db312650e7d954482535a2e33fb0b54e1030f149ed213823a919081900360600190a2600654610e0c906001600160a01b031633308b6118a7565b600554610e23906001600160a01b031633836119e1565b50505b505050505050565b610e366110e5565b610e408282611b0b565b5050565b610e4c611194565b6001600160a01b038116610eb15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104fb565b610eba816112f5565b50565b6101f4821115610f065760405162461bcd60e51b815260206004820152601460248201527342503a20696e76616c696420736c69707061676560601b60448201526064016104fb565b60008311610f565760405162461bcd60e51b815260206004820152601b60248201527f42503a20696e76616c696420657870656374656420616d6f756e74000000000060448201526064016104fb565b6000612710610f658486611f4c565b610f6f9190611f6b565b610f7990856120bb565b90506000612710610f8a8587611f4c565b610f949190611f6b565b610f9e9086611f8d565b9050818310158015610fb05750808311155b610ff05760405162461bcd60e51b8152602060048201526011602482015270084a07440e6d8d2e0e0c2ceca40d0d2ced607b1b60448201526064016104fb565b5050505050565b6001600160a01b038116610eba5760405162461bcd60e51b81526020600482015260146024820152734c69623a20696e76616c6964206164647265737360601b60448201526064016104fb565b6305f5e100811115610eba5760405162461bcd60e51b8152602060048201526015602482015274131a588e881ddc9bdb99c819995948185b5bdd5b9d605a1b60448201526064016104fb565b603c811180156110a2575061012c8111155b610eba5760405162461bcd60e51b8152602060048201526014602482015273131a588e881a5b9d985b1a59081d1a5b595bdd5d60621b60448201526064016104fb565b6009546001600160a01b031633146103f15760405162461bcd60e51b815260206004820152601960248201527f42503a2063616c6c6572206e6f7420706f6f6c2061646d696e0000000000000060448201526064016104fb565b611147611c8f565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000546001600160a01b031633146103f15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104fb565b6001546111fc908390611f8d565b60015560025461120d908290611f8d565b600255604080518381526020810183905233917fac1d76749e5447b7b16f5ab61447e1bd502f3bb4807af3b28e620d1700a6ee45910160405180910390a2600554611263906001600160a01b03163330856118a7565b600654610e40906001600160a01b03163330846118a7565b6000546005546001546001600160a01b039283169261129d92169083906119e1565b600654600254610eba916001600160a01b03169083906119e1565b6009546005546003546001600160a01b03928316926112da92169083906119e1565b600654600454610eba916001600160a01b03169083906119e1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000601060000160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156113a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c49190612126565b509350509250506000821361141b5760405162461bcd60e51b815260206004820152601960248201527f42503a20636861696e4c696e6b207072696365206572726f720000000000000060448201526064016104fb565b61142481611cdf565b156114715760405162461bcd60e51b815260206004820152601b60248201527f42503a20636f6d6d6f646974792070726963652065787069726564000000000060448201526064016104fb565b600b54670de0b6b3a7640000906114889084611f4c565b6114929190611f6b565b9250505090565b6000806000600e60000160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156114f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115189190612126565b50935050925050600082136115685760405162461bcd60e51b815260206004820152601660248201527521281d1039ba30b1363290383934b1b29032b93937b960511b60448201526064016104fb565b61157181611d0a565b156115be5760405162461bcd60e51b815260206004820152601860248201527f42503a20737461626c652070726963652065787069726564000000000000000060448201526064016104fb565b600e546040805163313ce56760e01b8152905184926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015611607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162b9190611fa5565b61163690600a6120ac565b6116409086611f4c565b61164a9190611f6b565b949350505050565b600080836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611693573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b79190611fa5565b60ff1690506000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117209190611fa5565b60ff169050808203611736578592505050611785565b8082116117615761174782826120bb565b61175290600a612176565b61175c9087611f4c565b611780565b61176b81836120bb565b61177690600a612176565b6117809087611f6b565b925050505b9392505050565b61179461185a565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586111773390565b6001546117dd9083906120bb565b6001556002546117ee9082906120bb565b600255604080518381526020810183905233917f96cd817c6329656790ef8fba7675405193677d39619571282f5e21f3a98cd059910160405180910390a2600554611843906001600160a01b031633846119e1565b600654610e40906001600160a01b031633836119e1565b600054600160a01b900460ff16156103f15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104fb565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161190b9190612182565b6000604051808303816000865af19150503d8060008114611948576040519150601f19603f3d011682016040523d82523d6000602084013e61194d565b606091505b5091509150818015611977575080511580611977575080806020019051810190611977919061219e565b610e265760405162461bcd60e51b815260206004820152603560248201527f5472616e7366657248656c7065723a3a736166655472616e7366657246726f6d6044820152740e881d1c985b9cd9995c919c9bdb4819985a5b1959605a1b60648201526084016104fb565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611a3d9190612182565b6000604051808303816000865af19150503d8060008114611a7a576040519150601f19603f3d011682016040523d82523d6000602084013e611a7f565b606091505b5091509150818015611aa9575080511580611aa9575080806020019051810190611aa9919061219e565b610ff05760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201526c185b9cd9995c8819985a5b1959609a1b60648201526084016104fb565b600a8260200151118015611b26575062015180826020015111155b611b725760405162461bcd60e51b815260206004820152601f60248201527f50433a20696e76616c69642068656172746265617420636f6d6d6f646974790060448201526064016104fb565b600a8160200151118015611b8d575062015180816020015111155b611bd95760405162461bcd60e51b815260206004820152601c60248201527f50433a20696e76616c69642068656172746265617420737461626c650000000060448201526064016104fb565b8151601080546001600160a01b0319166001600160a01b0390921691909117905560208201516011556000611c0c611345565b8251600e80546001600160a01b0319166001600160a01b039092169190911790556020830151600f559050611c4081611499565b5082518251604080516001600160a01b0393841681529290911660208301527f406db514094ada90a29eb37cb8ffb4a7c0a096ce011019439364ec1754621322910160405180910390a1505050565b600054600160a01b900460ff166103f15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104fb565b601154600090611cef83426120bb565b1015611cfd57506000919050565b506001919050565b919050565b600f54600090611cef83426120bb565b600060208284031215611d2c57600080fd5b5035919050565b600080600060608486031215611d4857600080fd5b505081359360208301359350604090920135919050565b6001600160a01b0381168114610eba57600080fd5b600060208284031215611d8657600080fd5b813561178581611d5f565b60008060408385031215611da457600080fd5b50508035926020909101359150565b60005b83811015611dce578181015183820152602001611db6565b8381111561041f5750506000910152565b60e08152600088518060e0840152610100611e008282860160208e01611db3565b60208401999099526001600160a01b03979097166040830152506060810194909452608084019290925260a083015260c0820152601f909101601f19160101919050565b600080600080600060a08688031215611e5c57600080fd5b8535945060208601359350604086013592506060860135611e7c81611d5f565b91506080860135611e8c81611d5f565b809150509295509295909350565b600060408284031215611eac57600080fd5b6040516040810181811067ffffffffffffffff82111715611edd57634e487b7160e01b600052604160045260246000fd5b6040529050808235611eee81611d5f565b8152602092830135920191909152919050565b60008060808385031215611f1457600080fd5b611f1e8484611e9a565b9150611f2d8460408501611e9a565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611f6657611f66611f36565b500290565b600082611f8857634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611fa057611fa0611f36565b500190565b600060208284031215611fb757600080fd5b815160ff8116811461178557600080fd5b600181815b80851115612003578160001904821115611fe957611fe9611f36565b80851615611ff657918102915b93841c9390800290611fcd565b509250929050565b60008261201a575060016107af565b81612027575060006107af565b816001811461203d576002811461204757612063565b60019150506107af565b60ff84111561205857612058611f36565b50506001821b6107af565b5060208310610133831016604e8410600b8410161715612086575081810a6107af565b6120908383611fc8565b80600019048211156120a4576120a4611f36565b029392505050565b600061178560ff84168361200b565b6000828210156120cd576120cd611f36565b500390565b600181811c908216806120e657607f821691505b60208210810361210657634e487b7160e01b600052602260045260246000fd5b50919050565b805169ffffffffffffffffffff81168114611d0557600080fd5b600080600080600060a0868803121561213e57600080fd5b6121478661210c565b945060208601519350604086015192506060860151915061216a6080870161210c565b90509295509295909350565b6000611785838361200b565b60008251612194818460208701611db3565b9190910192915050565b6000602082840312156121b057600080fd5b8151801515811461178557600080fdfea2646970667358221220006f4c874b0662b0c3391c23428d0a061c97abfd3dbb00c77686d6461b0da7e464736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000171f9cfc136f2b2aaa148fcc6b660a2029bab048000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000214ed9da11d2fbe465a6fc601a91e62ebec1a0d600000000000000000000000000000000000000000000000000000000000151800000000000000000000000003e7d1eab13ad0104d2750b8863b489d65364e32d000000000000000000000000000000000000000000000000000000000001518000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000004c4b400000000000000000000000001b06089da471355f8f05c7a6d8de1d9dac39762900000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000723841318760000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000006800000000000000000000000000000000000000000000000000000000000000084155532f55534454000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _commodityToken (address): 0x171f9cFc136f2B2aaA148fcC6b660a2029baB048
Arg [1] : _stableToken (address): 0xdAC17F958D2ee523a2206206994597C13D831ec7
Arg [2] : _dexSettings (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
Arg [3] : _commodityFeedInfo (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
Arg [4] : _stableFeedInfo (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
-----Encoded View---------------
16 Constructor Arguments found :
Arg [0] : 000000000000000000000000171f9cfc136f2b2aaa148fcc6b660a2029bab048
Arg [1] : 000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [3] : 000000000000000000000000214ed9da11d2fbe465a6fc601a91e62ebec1a0d6
Arg [4] : 0000000000000000000000000000000000000000000000000000000000015180
Arg [5] : 0000000000000000000000003e7d1eab13ad0104d2750b8863b489d65364e32d
Arg [6] : 0000000000000000000000000000000000000000000000000000000000015180
Arg [7] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [8] : 00000000000000000000000000000000000000000000000000000000004c4b40
Arg [9] : 0000000000000000000000001b06089da471355f8f05c7a6d8de1d9dac397629
Arg [10] : 00000000000000000000000000000000000000000000000000000000000000b4
Arg [11] : 0000000000000000000000000000000000000000000000000072384131876000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000070
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000068
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [15] : 4155532f55534454000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $1 | 2,418.4903 | $2,420.91 |
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.