Contract Overview
Balance:
0 MATIC
My Name Tag:
Not Available
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x8cca5eefa2384f26db78f2ce60289e969b132a4e1a015029180d373e12c3bd1b | Set Tele BTC Ins... | 31475077 | 128 days 23 hrs ago | 0x1de72a1935df9b4e02315bda3c3cdbdf2a640583 | IN | 0x66d6699b858833ccf8395d611b19da718ed28721 | 0 MATIC | 0.000857052 | |
0x6bb780fb677a6c3505515dfa55c1a40a4f81ce3df28a5459d5b697b653362689 | 0x60806040 | 31470473 | 129 days 2 hrs ago | 0x1de72a1935df9b4e02315bda3c3cdbdf2a640583 | IN | Create: InstantRouter | 0 MATIC | 0.011149763645 |
[ Download CSV Export ]
Contract Name:
InstantRouter
Compiler Version
v0.8.2+commit.661d1103
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; import "./interfaces/IInstantRouter.sol"; import "../connectors/interfaces/IExchangeConnector.sol"; import "../pools/interfaces/IInstantPool.sol"; import "../pools/interfaces/ICollateralPool.sol"; import "../pools/interfaces/ICollateralPoolFactory.sol"; import "../erc20/interfaces/ITeleBTC.sol"; import "../oracle/interfaces/IPriceOracle.sol"; import "../relay/interfaces/IBitcoinRelay.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; contract InstantRouter is IInstantRouter, Ownable, ReentrancyGuard, Pausable { using SafeERC20 for IERC20; using SafeCast for uint; modifier nonZeroAddress(address _address) { require(_address != address(0), "InstantRouter: zero address"); _; } // Constants uint constant MAX_SLASHER_PERCENTAGE_REWARD = 10000; uint constant ONE_HUNDRED_PERCENT = 10000; uint constant MAX_INSTANT_LOAN_NUMBER = 10; // Public variables mapping(address => instantRequest[]) public instantRequests; // Mapping from user address to user's unpaid instant requests mapping(address => uint256) public instantRequestCounter; uint public override slasherPercentageReward; uint public override paybackDeadline; uint public override maxPriceDifferencePercent; address public override treasuaryAddress; address public override teleBTC; address public override teleBTCInstantPool; address public override relay; address public override priceOracle; address public override collateralPoolFactory; address public override defaultExchangeConnector; /// @notice This contract handles instant transfer and instant exchange requests /// @dev It manages instant pool contract to give loan to users /// @param _teleBTC Address of teleBTC contract /// @param _relay Address of relay contract /// @param _priceOracle Address of price oracle contract /// @param _collateralPoolFactory Address of collateral pool factory contract /// @param _slasherPercentageReward Percentage of total collateral that goes to slasher /// @param _paybackDeadline Deadline of paying back the borrowed tokens /// @param _defaultExchangeConnector Exchange connector that is used for exchanging user's collateral to teleBTC (in the case of slashing) /// @param _maxPriceDifferencePercent Maximum acceptable price different between chainlink price oracle and dex price /// @param _treasuaryAddress Treasury address to which the extra TeleBTCs will go constructor( address _teleBTC, address _relay, address _priceOracle, address _collateralPoolFactory, uint _slasherPercentageReward, uint _paybackDeadline, address _defaultExchangeConnector, uint _maxPriceDifferencePercent, address _treasuaryAddress ) { _setTeleBTC(_teleBTC); _setRelay(_relay); _setPriceOracle(_priceOracle); _setCollateralPoolFactory(_collateralPoolFactory); _setSlasherPercentageReward(_slasherPercentageReward); _setPaybackDeadline(_paybackDeadline); _setDefaultExchangeConnector(_defaultExchangeConnector); _setMaxPriceDifferencePercent(_maxPriceDifferencePercent); _setTreasuaryAddress(_treasuaryAddress); } receive() external payable {} function renounceOwnership() public virtual override onlyOwner {} /// @notice Pause the contract function pause() external override onlyOwner { _pause(); } /// @notice Unpause the contract function unpause() external override onlyOwner { _unpause(); } /// @notice Gives the locked collateral pool token corresponding to a request /// @param _user Address of the user /// @param _index Index of the request in user's request list /// @return Amount of locked collateral pool token (not collateral token) function getLockedCollateralPoolTokenAmount( address _user, uint _index ) external view override returns (uint) { require(_index < instantRequests[_user].length, "InstantRouter: wrong index"); return instantRequests[_user][_index].lockedCollateralPoolTokenAmount; } /// @notice Gives the total number of user's unpaid loans /// @param _user Address of the user /// @return The total number of user's requests function getUserRequestsLength(address _user) external view override returns (uint) { return instantRequests[_user].length; } /// @notice Gives deadline of a specefic request /// @param _user Address of the user /// @param _index Index of the request in user's request list /// @return Deadline of that request function getUserRequestDeadline(address _user, uint _index) external view override returns (uint) { require(_index < instantRequests[_user].length, "InstantRouter: wrong index"); return instantRequests[_user][_index].deadline; } /// @notice Setter for payback deadline /// @dev Only owner can call this. It should be greater than relay finalization parameter so user has enough time to payback loan /// @param _paybackDeadline The new payback deadline function setPaybackDeadline(uint _paybackDeadline) external override onlyOwner { _setPaybackDeadline(_paybackDeadline); } /// @notice Fixing payback deadline after changing finalization parameter function fixPaybackDeadline() external { uint _finalizationParameter = IBitcoinRelay(relay).finalizationParameter(); require(_finalizationParameter <= paybackDeadline, "InstantRouter: finalization parameter is not greater than payback deadline"); uint _paybackDeadline = 2 * _finalizationParameter + 1; _setPaybackDeadline(_paybackDeadline); } /// @notice Setter for slasher percentage reward /// @dev Only owner can call this /// @param _slasherPercentageReward The new slasher reward function setSlasherPercentageReward(uint _slasherPercentageReward) external override onlyOwner { _setSlasherPercentageReward(_slasherPercentageReward); } /// @notice Setter for teleBTC /// @dev Only owner can call this /// @param _teleBTC The new teleBTC address function setTeleBTC( address _teleBTC ) external override onlyOwner { _setTeleBTC(_teleBTC); } /// @notice Setter for relay /// @dev Only owner can call this /// @param _relay The new relay address function setRelay( address _relay ) external override onlyOwner { _setRelay(_relay); } /// @notice Setter for collateral pool factory /// @dev Only owner can call this /// @param _collateralPoolFactory The new collateral pool factory address function setCollateralPoolFactory( address _collateralPoolFactory ) external override onlyOwner { _setCollateralPoolFactory(_collateralPoolFactory); } /// @notice Setter for price oracle /// @dev Only owner can call this /// @param _priceOracle The new price oracle address function setPriceOracle( address _priceOracle ) external override onlyOwner { _setPriceOracle(_priceOracle); } /// @notice Setter for teleBTC instant pool /// @dev Only owner can call this /// @param _teleBTCInstantPool The new teleBTC instant pool address function setTeleBTCInstantPool( address _teleBTCInstantPool ) external override onlyOwner { _setTeleBTCInstantPool(_teleBTCInstantPool); } /// @notice Setter for default exchange connector /// @dev Only owner can call this /// @param _defaultExchangeConnector The new defaultExchangeConnector address function setDefaultExchangeConnector( address _defaultExchangeConnector ) external override onlyOwner { _setDefaultExchangeConnector(_defaultExchangeConnector); } /// @notice Setter for treasury address /// @dev Only owner can call this /// @param _treasuaryAddress The new treasury address function setTreasuaryAddress( address _treasuaryAddress ) external override onlyOwner { _setTreasuaryAddress(_treasuaryAddress); } /// @notice Setter for max price differnce in percent /// @dev Only owner can call this /// @param _maxPriceDifferencePercent The new maxPriceDifferencePercent function setMaxPriceDifferencePercent( uint _maxPriceDifferencePercent ) external override onlyOwner { _setMaxPriceDifferencePercent(_maxPriceDifferencePercent); } /// @notice Internal setter for payback deadline /// @dev Only owner can call this. It should be greater than relay finalization parameter so user has enough time to payback loan /// @param _paybackDeadline The new payback deadline function _setPaybackDeadline(uint _paybackDeadline) private { uint _finalizationParameter = IBitcoinRelay(relay).finalizationParameter(); // Gives users enough time to pay back loans require(_paybackDeadline > _finalizationParameter, "InstantRouter: wrong payback deadline"); emit NewPaybackDeadline(paybackDeadline, _paybackDeadline); paybackDeadline = _paybackDeadline; } /// @notice Internal setter for slasher percentage reward /// @dev Only owner can call this /// @param _slasherPercentageReward The new slasher reward function _setSlasherPercentageReward(uint _slasherPercentageReward) private { require( _slasherPercentageReward <= MAX_SLASHER_PERCENTAGE_REWARD, "InstantRouter: wrong slasher percentage reward" ); emit NewSlasherPercentageReward(slasherPercentageReward, _slasherPercentageReward); slasherPercentageReward = _slasherPercentageReward; } /// @notice Internal setter for teleBTC instant /// @param _teleBTC The new teleBTC instant address function _setTeleBTC( address _teleBTC ) private nonZeroAddress(_teleBTC) { emit NewTeleBTC(teleBTC, _teleBTC); teleBTC = _teleBTC; } /// @notice Internal setter for relay /// @param _relay The new relay address function _setRelay( address _relay ) private nonZeroAddress(_relay) { emit NewRelay(relay, _relay); relay = _relay; } /// @notice Internal setter for collateral pool factory /// @param _collateralPoolFactory The new collateral pool factory address function _setCollateralPoolFactory( address _collateralPoolFactory ) private nonZeroAddress(_collateralPoolFactory) { emit NewCollateralPoolFactory(collateralPoolFactory, _collateralPoolFactory); collateralPoolFactory = _collateralPoolFactory; } /// @notice Internal setter for price oracle /// @param _priceOracle The new price oracle address function _setPriceOracle( address _priceOracle ) private nonZeroAddress(_priceOracle) { emit NewPriceOracle(priceOracle, _priceOracle); priceOracle = _priceOracle; } /// @notice Internal setter for teleBTC instant pool /// @param _teleBTCInstantPool The new teleBTC instant pool address function _setTeleBTCInstantPool( address _teleBTCInstantPool ) private nonZeroAddress(_teleBTCInstantPool) { emit NewTeleBTCInstantPool(teleBTCInstantPool, _teleBTCInstantPool); teleBTCInstantPool = _teleBTCInstantPool; } /// @notice Internal setter for default exchange connector /// @param _defaultExchangeConnector The new defaultExchangeConnector address function _setDefaultExchangeConnector( address _defaultExchangeConnector ) private nonZeroAddress(_defaultExchangeConnector) { emit NewDefaultExchangeConnector(defaultExchangeConnector, _defaultExchangeConnector); defaultExchangeConnector = _defaultExchangeConnector; } /// @notice Internal setter for treasury address /// @param _treasuaryAddress The new treasuaryAddress function _setTreasuaryAddress( address _treasuaryAddress ) private nonZeroAddress(_treasuaryAddress) { emit NewTreasuaryAddress(treasuaryAddress, _treasuaryAddress); treasuaryAddress = _treasuaryAddress; } /// @notice Internal setter for max price differnce in percent /// @param _maxPriceDifferencePercent The new maxPriceDifferencePercent function _setMaxPriceDifferencePercent( uint _maxPriceDifferencePercent ) private { emit NewMaxPriceDifferencePercent(maxPriceDifferencePercent, _maxPriceDifferencePercent); maxPriceDifferencePercent = _maxPriceDifferencePercent; } /// @notice Transfers the loan amount (in teleBTC) to the user /// @dev Transfers required collateral pool token of user to itself. Only works when contract is not paused. /// @param _receiver Address of the loan receiver /// @param _loanAmount Amount of the loan /// @param _deadline Deadline for getting the loan /// @param _collateralToken Address of the collateral token /// @return True if getting loan was successful function instantCCTransfer( address _receiver, uint _loanAmount, uint _deadline, address _collateralToken ) external nonReentrant nonZeroAddress(_receiver) nonZeroAddress(_collateralToken) whenNotPaused override returns (bool) { // Checks that deadline for getting loan has not passed require(_deadline >= block.timestamp, "InstantRouter: deadline has passed"); // Gets the instant fee uint instantFee = IInstantPool(teleBTCInstantPool).getFee(_loanAmount); // Locks the required amount of user's collateral _lockCollateral(_msgSender(), _loanAmount + instantFee, _collateralToken); // Gets loan from instant pool for receiver IInstantPool(teleBTCInstantPool).getLoan(_receiver, _loanAmount); emit InstantTransfer( _msgSender(), _receiver, _loanAmount, instantFee, instantRequests[_msgSender()][instantRequests[_msgSender()].length - 1].deadline, _collateralToken, instantRequests[_msgSender()][instantRequests[_msgSender()].length - 1].lockedCollateralPoolTokenAmount, instantRequests[_msgSender()][instantRequests[_msgSender()].length - 1].requestCounterOfUser ); return true; } /// @notice Exchanges the loan amount (in teleBTC) for the user /// @dev Locks the required collateral amount of the user. Only works when contract is not paused. /// @param _exchangeConnector Address of exchange connector that user wants to exchange the borrowed teleBTC in it /// @param _receiver Address of the loan receiver /// @param _loanAmount Amount of the loan /// @param _amountOut Amount of the output token /// @param _path Path of exchanging tokens /// @param _deadline Deadline for getting the loan /// @param _collateralToken Address of collateral token /// @param _isFixedToken Shows whether input or output is fixed in exchange /// @return _amounts Amounts of tokens involved in the exchange function instantCCExchange( address _exchangeConnector, address _receiver, uint _loanAmount, uint _amountOut, address[] memory _path, uint _deadline, address _collateralToken, bool _isFixedToken ) external nonReentrant nonZeroAddress(_exchangeConnector) whenNotPaused override returns(uint[] memory _amounts) { // Checks that deadline for exchanging has not passed require(_deadline >= block.timestamp, "InstantRouter: deadline has passed"); // Checks that the first token of path is teleBTC and its length is greater than one require(_path[0] == teleBTC && _path.length > 1, "InstantRouter: path is invalid"); // Calculates the instant fee uint instantFee = IInstantPool(teleBTCInstantPool).getFee(_loanAmount); // Locks the required amount of user's collateral _lockCollateral(_msgSender(), _loanAmount + instantFee, _collateralToken); // Gets loan from instant pool IInstantPool(teleBTCInstantPool).getLoan(address(this), _loanAmount); // Gives allowance to exchange connector ITeleBTC(teleBTC).approve(_exchangeConnector, _loanAmount); // Exchanges teleBTC for output token bool result; (result, _amounts) = IExchangeConnector(_exchangeConnector).swap( _loanAmount, _amountOut, _path, _receiver, _deadline, _isFixedToken ); /* Reverts if exchanging was not successful since user doesn't want to lock collateral without exchanging */ require(result == true, "InstantRouter: exchange was not successful"); emit InstantExchange( _msgSender(), _receiver, _loanAmount, instantFee, _amountOut, _path, _isFixedToken, instantRequests[_msgSender()][instantRequests[_msgSender()].length - 1].deadline, // payback deadline _collateralToken, instantRequests[_msgSender()][instantRequests[_msgSender()].length - 1].lockedCollateralPoolTokenAmount, instantRequests[_msgSender()][instantRequests[_msgSender()].length - 1].requestCounterOfUser ); } /// @notice Settles loans of the user /// @dev Caller should give allowance for teleBTC to instant router /// @param _user Address of user who wants to pay back loans /// @param _teleBTCAmount Amount of available teleBTC to pay back loans /// @return True if paying back is successful function payBackLoan( address _user, uint _teleBTCAmount ) external nonReentrant nonZeroAddress(_user) override returns (bool) { uint remainedAmount = _teleBTCAmount; uint lastSubmittedHeight = IBitcoinRelay(relay).lastSubmittedHeight(); uint amountToTransfer = 0; for (uint i = 1; i <= instantRequests[_user].length; i++) { // Checks that remained teleBTC is enough to pay back the loan and payback deadline has not passed if ( remainedAmount >= instantRequests[_user][i-1].paybackAmount && instantRequests[_user][i-1].deadline >= lastSubmittedHeight ) { remainedAmount = remainedAmount - instantRequests[_user][i-1].paybackAmount; // Pays back the loan to instant pool amountToTransfer += instantRequests[_user][i-1].paybackAmount; // Unlocks the locked collateral pool token after paying the loan IERC20(instantRequests[_user][i-1].collateralPool).safeTransfer( _user, instantRequests[_user][i-1].lockedCollateralPoolTokenAmount ); emit PaybackLoan( _user, instantRequests[_user][i-1].paybackAmount, instantRequests[_user][i-1].collateralToken, instantRequests[_user][i-1].lockedCollateralPoolTokenAmount, instantRequests[_user][i-1].requestCounterOfUser ); // Deletes the request after paying it _removeElement(_user, i-1); i--; } if (remainedAmount == 0) { break; } } ITeleBTC(teleBTC).transferFrom( _msgSender(), teleBTCInstantPool, amountToTransfer ); // Transfers remained teleBTC to user if (remainedAmount > 0) { ITeleBTC(teleBTC).transferFrom(_msgSender(), _user, remainedAmount); } return true; } /// @notice Slashes collateral of user who did not pay back loan before its deadline /// @dev Buys teleBTC using the collateral and sends it to instant pool /// @param _user Address of the slashed user /// @param _requestIndex Index of the request that have not been paid back before deadline /// @return True if slashing is successful function slashUser( address _user, uint _requestIndex ) override nonReentrant nonZeroAddress(_user) external returns (bool) { require(instantRequests[_user].length > _requestIndex, "InstantRouter: request index does not exist"); // Gets last submitted height on relay uint lastSubmittedHeight = IBitcoinRelay(relay).lastSubmittedHeight(); // Checks that deadline has passed require( instantRequests[_user][_requestIndex].deadline < lastSubmittedHeight, "InstantRouter: deadline has not passed yet" ); // Gets loan information instantRequest memory theRequest = instantRequests[_user][_requestIndex]; // modifiedPayBackAmount is the maximum payback amount that can be get from the user // it's used to calculate maximum equivalent collateral amount uint modifiedPayBackAmount = theRequest.paybackAmount * (ONE_HUNDRED_PERCENT + maxPriceDifferencePercent) / ONE_HUNDRED_PERCENT; // Finds needed collateral token to pay back loan (bool result, uint requiredCollateralToken) = IExchangeConnector(defaultExchangeConnector).getInputAmount( modifiedPayBackAmount, // Output amount // theRequest.paybackAmount, // Output amount theRequest.collateralToken, // Input token teleBTC // Output token ); require(result == true, "InstantRouter: liquidity pool doesn't exist or liquidity is not sufficient"); // Gets the equivalent amount of collateral token uint requiredCollateralTokenFromOracle = IPriceOracle(priceOracle).equivalentOutputAmount( modifiedPayBackAmount, // input amount // theRequest.paybackAmount, // input amount IERC20Metadata(teleBTC).decimals(), IERC20Metadata(theRequest.collateralToken).decimals(), teleBTC, // input token theRequest.collateralToken // output token ); // check the price diferences between two sources and compare with the maximum acceptable price difference uint absPriceDiff = _abs(requiredCollateralTokenFromOracle.toInt256() - requiredCollateralToken.toInt256()); require( absPriceDiff <= (requiredCollateralToken * maxPriceDifferencePercent)/ONE_HUNDRED_PERCENT, "InstantRouter: big gap between oracle and AMM price" ); // update the modifiedPayBackAmount again if (requiredCollateralToken >= requiredCollateralTokenFromOracle) { modifiedPayBackAmount = theRequest.paybackAmount; } else { modifiedPayBackAmount = theRequest.paybackAmount * requiredCollateralTokenFromOracle / requiredCollateralToken; } uint totalCollateralToken = ICollateralPool(theRequest.collateralPool).equivalentCollateralToken( theRequest.lockedCollateralPoolTokenAmount ); // Path of exchanging address[] memory path = new address[](2); path[0] = theRequest.collateralToken; path[1] = teleBTC; // Gets collateral token from collateral pool ICollateralPool(theRequest.collateralPool).removeCollateral(theRequest.lockedCollateralPoolTokenAmount); // Checks that locked collateral is enough to pay back loan if (totalCollateralToken >= requiredCollateralToken) { // Approves exchange connector to use collateral token IERC20(theRequest.collateralToken).approve(defaultExchangeConnector, requiredCollateralToken); // Exchanges collateral token for teleBTC IExchangeConnector(defaultExchangeConnector).swap( requiredCollateralToken, modifiedPayBackAmount, // Output amount path, address(this), block.timestamp + 1, false // Output amount is fixed ); // send the laon amount to the instant pool and the excess amount to the treasury IERC20(teleBTC).safeTransfer(teleBTCInstantPool, theRequest.paybackAmount); IERC20(teleBTC).safeTransfer(treasuaryAddress, modifiedPayBackAmount - theRequest.paybackAmount); // Sends reward to slasher uint slasherReward = (totalCollateralToken - requiredCollateralToken) *slasherPercentageReward/MAX_SLASHER_PERCENTAGE_REWARD; IERC20(theRequest.collateralToken).safeTransfer(_msgSender(), slasherReward); IERC20(theRequest.collateralToken).approve(theRequest.collateralPool, totalCollateralToken - requiredCollateralToken - slasherReward); // Deposits rest of the tokens to collateral pool on behalf of the user ICollateralPool(theRequest.collateralPool).addCollateral( _user, totalCollateralToken - requiredCollateralToken - slasherReward ); emit SlashUser( _user, theRequest.collateralToken, requiredCollateralToken, modifiedPayBackAmount, _msgSender(), slasherReward, theRequest.requestCounterOfUser ); } else { // Handles situations where locked collateral is not enough to pay back the loan uint[] memory resultAmounts = new uint[](2); // Approves exchange connector to use collateral token IERC20(theRequest.collateralToken).approve(defaultExchangeConnector, totalCollateralToken); // Buys teleBTC as much as possible and sends it to instant pool (, resultAmounts) = IExchangeConnector(defaultExchangeConnector).swap( totalCollateralToken, 0, path, address(this), block.timestamp + 1, true // Input amount is fixed ); if (resultAmounts[1] > theRequest.paybackAmount) { // send the laon amount to the instant pool and the excess amount to the treasury IERC20(teleBTC).safeTransfer(teleBTCInstantPool, theRequest.paybackAmount); IERC20(teleBTC).safeTransfer(treasuaryAddress, resultAmounts[1] - theRequest.paybackAmount); } else { IERC20(teleBTC).safeTransfer(teleBTCInstantPool, resultAmounts[1]); } emit SlashUser( _user, theRequest.collateralToken, totalCollateralToken, resultAmounts[1], _msgSender(), 0, // Slasher reward is zero, theRequest.requestCounterOfUser ); } // Deletes the request after slashing user _removeElement(_user, _requestIndex); return true; } /// @notice Removes an element of array of user's instant requests /// @dev Deletes and shifts the array /// @param _user Address of the user whose instant requests array is considered /// @param _index Index of the element that will be deleted function _removeElement(address _user, uint _index) private { require(_index < instantRequests[_user].length, "InstantRouter: index is out of bound"); for (uint i = _index; i < instantRequests[_user].length - 1; i++) { instantRequests[_user][i] = instantRequests[_user][i+1]; } instantRequests[_user].pop(); } /// @notice Locks the required amount of user's collateral /// @dev Records the instant request to be used in future /// @param _user Address of the loan receiver /// @param _paybackAmount Amount of the (loan + fee) that should be paid back by user /// @param _collateralToken Address of the collateral token function _lockCollateral( address _user, uint _paybackAmount, address _collateralToken ) private nonZeroAddress(_collateralToken) { // Checks that collateral token is acceptable require( ICollateralPoolFactory(collateralPoolFactory).isCollateral(_collateralToken), "InstantRouter: collateral token is not acceptable" ); require( instantRequests[_user].length < MAX_INSTANT_LOAN_NUMBER, "InstantRouter: reached max loan number" ); // Gets the collateral pool address address collateralPool = ICollateralPoolFactory(collateralPoolFactory).getCollateralPoolByToken( _collateralToken ); // Gets collateralization ratio uint collateralizationRatio = ICollateralPool(collateralPool).collateralizationRatio(); // Gets the equivalent amount of collateral token uint equivalentCollateralToken = IPriceOracle(priceOracle).equivalentOutputAmount( _paybackAmount, // input amount IERC20Metadata(teleBTC).decimals(), IERC20Metadata(_collateralToken).decimals(), teleBTC, // input token _collateralToken // output token ); // Finds needed collateral token for getting loan uint requiredCollateralToken = equivalentCollateralToken*collateralizationRatio/ONE_HUNDRED_PERCENT; // Finds needed collateral pool token for getting loan uint requiredCollateralPoolToken = ICollateralPool(collateralPool).equivalentCollateralPoolToken( requiredCollateralToken ); // Transfers collateral pool token from user to itself IERC20(collateralPool).safeTransferFrom(_user, address(this), requiredCollateralPoolToken); // Records the instant request for user instantRequest memory request; request.user = _user; request.paybackAmount = _paybackAmount; request.lockedCollateralPoolTokenAmount = requiredCollateralPoolToken; request.collateralPool = collateralPool; request.collateralToken = _collateralToken; request.deadline = IBitcoinRelay(relay).lastSubmittedHeight() + paybackDeadline; request.requestCounterOfUser = instantRequestCounter[_user]; instantRequestCounter[_user] = instantRequestCounter[_user] + 1; instantRequests[_user].push(request); } /// @notice Returns absolute value function _abs(int _value) private pure returns (uint) { return _value >= 0 ? uint(_value) : uint(-_value); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; interface IInstantRouter { // Structures /// @notice Structure for recording instant requests /// @param user Address of user who recieves loan /// @param collateralPool Address of collateral pool /// @param collateralToken Address of underlying collateral token /// @param paybackAmount Amount of (loan + instant fee) /// @param lockedCollateralPoolTokenAmount Amount of locked collateral pool token for getting loan /// @param deadline Deadline for paying back the loan /// @param requestCounterOfUser The index of the request for a specific user struct instantRequest { address user; address collateralPool; address collateralToken; uint paybackAmount; uint lockedCollateralPoolTokenAmount; uint deadline; uint requestCounterOfUser; } // Events /// @notice Emits when a user gets loan for transfer /// @param user Address of the user who made the request /// @param receiver Address of the loan receiver /// @param loanAmount Amount of the loan /// @param instantFee Amount of the instant loan fee /// @param deadline Deadline of paying back the loan /// @param collateralToken Address of the collateral token /// @param lockedCollateralPoolToken Amount of collateral pool token that got locked event InstantTransfer( address indexed user, address receiver, uint loanAmount, uint instantFee, uint indexed deadline, address indexed collateralToken, uint lockedCollateralPoolToken, uint requestCounterOfUser ); /// @notice Emits when a user gets loan for exchange /// @param user Address of the user who made the request /// @param receiver Address of the loan receiver /// @param loanAmount Amount of the loan /// @param instantFee Amount of the instant loan fee /// @param amountOut Amount of the output token /// @param path Path of exchanging tokens /// @param isFixed Shows whether input or output is fixed in exchange /// @param deadline Deadline of getting the loan /// @param collateralToken Address of the collateral token /// @param lockedCollateralPoolToken Amount of collateral pool token that got locked event InstantExchange( address indexed user, address receiver, uint loanAmount, uint instantFee, uint amountOut, address[] path, bool isFixed, uint indexed deadline, address indexed collateralToken, uint lockedCollateralPoolToken, uint requestCounterOfUser ); /// @notice Emits when a loan gets paid back /// @param user Address of user who recieves loan /// @param paybackAmount Amount of (loan + fee) that should be paid back /// @param collateralToken Address of underlying collateral token /// @param lockedCollateralPoolToken Amount of locked collateral pool token for getting loan event PaybackLoan( address indexed user, uint paybackAmount, address indexed collateralToken, uint lockedCollateralPoolToken, uint requestCounterOfUser ); /// @notice Emits when a user gets slashed /// @param user Address of user who recieves loan /// @param collateralToken Address of collateral underlying token /// @param slashedAmount How much user got slashed /// @param paybackAmount Address of collateral underlying token /// @param slasher Address of slasher /// @param slasherReward Slasher reward (in collateral token) event SlashUser( address indexed user, address indexed collateralToken, uint slashedAmount, uint paybackAmount, address indexed slasher, uint slasherReward, uint requestCounterOfUser ); /// @notice Emits when changes made to payback deadline event NewPaybackDeadline( uint oldPaybackDeadline, uint newPaybackDeadline ); /// @notice Emits when changes made to slasher percentage reward event NewSlasherPercentageReward( uint oldSlasherPercentageReward, uint newSlasherPercentageReward ); /// @notice Emits when changes made to treasuray overhead percnet event NewTreasuaryAddress( address oldTreasuaryAddress, address newTreasuaryAddress ); /// @notice Emits when changes made to max price difference percent event NewMaxPriceDifferencePercent( uint oldMaxPriceDifferencePercent, uint newMaxPriceDifferencePercent ); /// @notice Emits when changes made to TeleBTC address event NewTeleBTC( address oldTeleBTC, address newTeleBTC ); /// @notice Emits when changes made to relay address event NewRelay( address oldRelay, address newRelay ); /// @notice Emits when changes made to collateral pool factory address event NewCollateralPoolFactory( address oldCollateralPoolFactory, address newCollateralPoolFactory ); /// @notice Emits when changes made to price oracle address event NewPriceOracle( address oldPriceOracle, address newPriceOracle ); /// @notice Emits when changes made to TeleBTC instant pool address event NewTeleBTCInstantPool( address oldTeleBTCInstantPool, address newTeleBTCInstantPool ); /// @notice Emits when changes made to default exchange connector address event NewDefaultExchangeConnector( address oldDefaultExchangeConnector, address newDefaultExchangeConnector ); // Read-only functions function pause() external; function unpause() external; function teleBTCInstantPool() external view returns (address); function teleBTC() external view returns (address); function relay() external view returns (address); function collateralPoolFactory() external view returns (address); function priceOracle() external view returns (address); function slasherPercentageReward() external view returns (uint); function paybackDeadline() external view returns (uint); function defaultExchangeConnector() external view returns (address); function getLockedCollateralPoolTokenAmount(address _user, uint _index) external view returns (uint); function getUserRequestsLength(address _user) external view returns (uint); function getUserRequestDeadline(address _user, uint _index) external view returns (uint); function maxPriceDifferencePercent() external view returns (uint); function treasuaryAddress() external view returns (address); // State-changing functions function setPaybackDeadline(uint _paybackDeadline) external; function setSlasherPercentageReward(uint _slasherPercentageReward) external; function setPriceOracle(address _priceOracle) external; function setCollateralPoolFactory(address _collateralPoolFactory) external; function setRelay(address _relay) external; function setTeleBTC(address _teleBTC) external; function setTeleBTCInstantPool(address _teleBTCInstantPool) external; function setDefaultExchangeConnector(address _defaultExchangeConnector) external; function setTreasuaryAddress(address _treasuaryAddres) external; function setMaxPriceDifferencePercent(uint _maxPriceDifferencePercent) external; function instantCCTransfer( address _receiver, uint _loanAmount, uint _deadline, address _collateralPool ) external returns (bool); function instantCCExchange( address _exchangeConnector, address _receiver, uint _loanAmount, uint _amountOut, address[] memory _path, uint _deadline, address _collateralToken, bool _isFixedToken ) external returns (uint[] memory); function payBackLoan(address _user, uint _teleBTCAmount) external returns (bool); function slashUser( address _user, uint _requestIndex ) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; interface IExchangeConnector { // Events event Swap(address[] path, uint[] amounts, address receiver); // Read-only functions function name() external view returns (string memory); function exchangeRouter() external view returns (address); function liquidityPoolFactory() external view returns (address); function wrappedNativeToken() external view returns (address); function getInputAmount( uint _outputAmount, address _inputToken, address _outputToken ) external view returns (bool, uint); function getOutputAmount( uint _inputAmount, address _inputToken, address _outputToken ) external view returns (bool, uint); // State-changing functions function setExchangeRouter(address _exchangeRouter) external; function setLiquidityPoolFactory() external; function setWrappedNativeToken() external; function swap( uint256 _inputAmount, uint256 _outputAmount, address[] memory _path, address _to, uint256 _deadline, bool _isFixedToken ) external returns (bool, uint[] memory); function isPathValid(address[] memory _path) external view returns(bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IInstantPool is IERC20 { // Events /// @notice emits when an instant pool is created /// @param instantToken The instant token of this instant pool event CreatedInstantPool(address indexed instantToken); /// @notice emits when some liquidity gets added to the pool /// @param user User who added the liquidity /// @param teleBTCAmount Amount of teleBTC added to the pool /// @param instantPoolTokenAmount User's share from the pool event AddLiquidity(address indexed user, uint teleBTCAmount, uint instantPoolTokenAmount); /// @notice Emits when some liquidity gets removed from the pool /// @param user User who removed the liquidity /// @param teleBTCAmount Amount of teleBTC removed from the pool /// @param instantPoolTokenAmount User's share from the pool event RemoveLiquidity(address indexed user, uint teleBTCAmount, uint instantPoolTokenAmount); /// @notice Gets an instant loan from the contract /// @param user User who wants to get the loan /// @param requestedAmount Amount of loan requested and sent to the user /// @param instantFee Amount of fee that the user should pay back later with the loan event InstantLoan(address indexed user, uint256 requestedAmount, uint instantFee); /// @notice Emits when changes made to instant router address event NewInstantRouter(address oldInstantRouter, address newInstaneRouter); /// @notice Emits when changes made to instant percentage fee event NewInstantPercentageFee(uint oldInstantPercentageFee, uint newInstantPercentageFee); /// @notice Emits when changes made to TeleBTC address event NewTeleBTC(address oldTeleBTC, address newTeleBTC); // Read-only functions function teleBTC() external view returns (address); function instantRouter() external view returns (address); function totalAddedTeleBTC() external view returns (uint); function availableTeleBTC() external view returns (uint); function totalUnpaidLoan() external view returns (uint); function instantPercentageFee() external view returns (uint); function getFee(uint _loanAmount) external view returns (uint); // State-changing functions function setInstantRouter(address _instantRouter) external; function setInstantPercentageFee(uint _instantPercentageFee) external; function setTeleBTC(address _teleBTC) external; function addLiquidity(address _user, uint _amount) external returns (uint); function addLiquidityWithoutMint(uint _amount) external returns (bool); function removeLiquidity(address _user, uint _instantPoolTokenAmount) external returns (uint); function getLoan(address _user, uint _amount) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface ICollateralPool is IERC20 { // Events event AddCollateral(address indexed doer, address indexed user, uint amount, uint collateralPoolTokenAmount); event RemoveCollateral(address indexed doer, address indexed user, uint amount, uint collateralPoolTokenAmount); event NewCollateralizationRatio(uint oldCollateralizationRatio, uint newCollateralizationRatio); // Read-only functions function collateralToken() external view returns (address); function collateralizationRatio() external view returns(uint); function totalAddedCollateral() external view returns (uint); function equivalentCollateralToken(uint _collateralPoolTokenAmount) external view returns (uint); function equivalentCollateralPoolToken(uint _collateralTokenAmount) external view returns (uint); // State-changing functions function setCollateralizationRatio(uint _collateralizationRatio) external; function addCollateral(address _user, uint _amount) external returns (bool); function removeCollateral(uint _collateralPoolTokenAmount) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; interface ICollateralPoolFactory { // Events /// @notice Emits when a collateral pool is created /// @param name Name of the collateral token /// @param collateralToken Collateral token address /// @param collateralizationRatio At most (collateral value)/(collateralization ratio) can be moved instantly by the user /// @param collateralPool Collateral pool contract address event CreateCollateralPool( string name, address indexed collateralToken, uint collateralizationRatio, address indexed collateralPool ); /// @notice Emits when a collateral pool is removed /// @param collateralToken Collateral token address /// @param collateralPool Collateral pool contract address event RemoveCollateralPool( address indexed collateralToken, address indexed collateralPool ); // Read-only functions function getCollateralPoolByToken(address _collateralToken) external view returns (address); function allCollateralPools(uint _index) external view returns (address); function allCollateralPoolsLength() external view returns (uint); function isCollateral(address _collateralToken) external view returns (bool); // State-changing functions function createCollateralPool(address _collateralToken, uint _collateralizationRatio) external returns (address); function removeCollateralPool(address _collateralToken, uint _index) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface ITeleBTC is IERC20 { // Events event Mint(address indexed doer, address indexed receiver, uint value); event Burn(address indexed doer, address indexed burner, uint value); event MinterAdded(address indexed newMinter); event MinterRemoved(address indexed minter); event BurnerAdded(address indexed newBurner); event BurnerRemoved(address indexed burner); event NewMintLimit(uint oldMintLimit, uint newMintLimit); event NewEpochLength(uint oldEpochLength, uint newEpochLength); // read functions function decimals() external view returns (uint8); // state-changing functions function addMinter(address account) external; function removeMinter(address account) external; function addBurner(address account) external; function removeBurner(address account) external; function mint(address receiver, uint amount) external returns(bool); function burn(uint256 amount) external returns(bool); function setMaxMintLimit(uint _mintLimit) external; function setEpochLength(uint _length) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; interface IPriceOracle { /// @notice Emits when new exchange router is added /// @param exchangeRouter Address of new exchange router /// @param exchangeConnector Address of exchange connector event ExchangeConnectorAdded(address indexed exchangeRouter, address indexed exchangeConnector); /// @notice Emits when an exchange router is removed /// @param exchangeRouter Address of removed exchange router event ExchangeConnectorRemoved(address indexed exchangeRouter); /// @notice Emits when a price proxy is set /// @param _token Address of the token /// @param _priceProxyAddress Address of price proxy contract event SetPriceProxy(address indexed _token, address indexed _priceProxyAddress); /// @notice Emits when changes made to acceptable delay event NewAcceptableDelay(uint oldAcceptableDelay, uint newAcceptableDelay); /// @notice Emits when changes made to oracle native token event NewOracleNativeToken(address indexed oldOracleNativeToken, address indexed newOracleNativeToken); // Read-only functions /// @notice Gives USD price proxy address for a token /// @param _token Address of the token /// @return Address of price proxy contract function ChainlinkPriceProxy(address _token) external view returns (address); /// @notice Gives exchange connector address for an exchange router /// @param _exchangeRouter Address of exchange router /// @return Address of exchange connector function exchangeConnector(address _exchangeRouter) external view returns (address); /// @notice Gives address of an exchange router from exchange routers list /// @param _index Index of exchange router /// @return Address of exchange router function exchangeRoutersList(uint _index) external view returns (address); function getExchangeRoutersListLength() external view returns (uint); function acceptableDelay() external view returns (uint); function oracleNativeToken() external view returns (address); function equivalentOutputAmountByAverage( uint _inputAmount, uint _inputDecimals, uint _outputDecimals, address _inputToken, address _outputToken ) external view returns (uint); function equivalentOutputAmount( uint _inputAmount, uint _inputDecimals, uint _outputDecimals, address _inputToken, address _outputToken ) external view returns (uint); function equivalentOutputAmountFromOracle( uint _inputAmount, uint _inputDecimals, uint _outputDecimals, address _inputToken, address _outputToken ) external view returns (uint); function equivalentOutputAmountFromExchange( address _exchangeRouter, uint _inputAmount, address _inputToken, address _outputToken ) external view returns (uint); // State-changing functions function addExchangeConnector(address _exchangeRouter, address _exchangeConnector) external; function removeExchangeConnector(uint _exchangeRouterIndex) external; function setPriceProxy(address _token, address _priceProxyAddress) external; function setAcceptableDelay(uint _acceptableDelay) external; function setOracleNativeToken(address _oracleNativeToken) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.8.4; interface IBitcoinRelay { // Structures /// @notice Structure for recording block header /// @param selfHash Hash of block header /// @param parentHash Hash of parent block header /// @param merkleRoot Merkle root of transactions in the block /// @param relayer Address of relayer who submitted the block header /// @param gasPrice Gas price of tx that relayer submitted the block header struct blockHeader { bytes32 selfHash; bytes32 parentHash; bytes32 merkleRoot; address relayer; uint gasPrice; } // Events /// @notice Emits when a block header is added /// @param height Height of submitted header /// @param selfHash Hash of submitted header /// @param parentHash Parent hash of submitted header /// @param relayer Address of relayer who submitted the block header event BlockAdded( uint indexed height, bytes32 selfHash, bytes32 indexed parentHash, address indexed relayer ); /// @notice Emits when a block header gets finalized /// @param height Height of the header /// @param selfHash Hash of the header /// @param parentHash Parent hash of the header /// @param relayer Address of relayer who submitted the block header /// @param rewardAmountTNT Amount of reward that the relayer receives in target native token /// @param rewardAmountTDT Amount of reward that the relayer receives in TDT event BlockFinalized( uint indexed height, bytes32 selfHash, bytes32 parentHash, address indexed relayer, uint rewardAmountTNT, uint rewardAmountTDT ); /// @notice Emits when changes made to reward amount in TDT event NewRewardAmountInTDT ( uint oldRewardAmountInTDT, uint newRewardAmountInTDT ); /// @notice Emits when changes made to finalization parameter event NewFinalizationParameter ( uint oldFinalizationParameter, uint newFinalizationParameter ); /// @notice Emits when changes made to relayer percentage fee event NewRelayerPercentageFee ( uint oldRelayerPercentageFee, uint newRelayerPercentageFee ); /// @notice Emits when changes made to teleportDAO token event NewTeleportDAOToken ( address oldTeleportDAOToken, address newTeleportDAOToken ); /// @notice Emits when changes made to epoch length event NewEpochLength( uint oldEpochLength, uint newEpochLength ); /// @notice Emits when changes made to base queries event NewBaseQueries( uint oldBaseQueries, uint newBaseQueries ); /// @notice Emits when changes made to submission gas used event NewSubmissionGasUsed( uint oldSubmissionGasUsed, uint newSubmissionGasUsed ); // Read-only functions function relayGenesisHash() external view returns (bytes32); function initialHeight() external view returns(uint); function lastSubmittedHeight() external view returns(uint); function finalizationParameter() external view returns(uint); function TeleportDAOToken() external view returns(address); function relayerPercentageFee() external view returns(uint); function epochLength() external view returns(uint); function lastEpochQueries() external view returns(uint); function currentEpochQueries() external view returns(uint); function baseQueries() external view returns(uint); function submissionGasUsed() external view returns(uint); function getBlockHeaderHash(uint height, uint index) external view returns(bytes32); function getBlockHeaderFee(uint _height, uint _index) external view returns(uint); function getNumberOfSubmittedHeaders(uint height) external view returns (uint); function availableTDT() external view returns(uint); function availableTNT() external view returns(uint); function findHeight(bytes32 _hash) external view returns (uint256); function findAncestor(bytes32 _hash, uint256 _offset) external view returns (bytes32); function isAncestor(bytes32 _ancestor, bytes32 _descendant, uint256 _limit) external view returns (bool); function rewardAmountInTDT() external view returns (uint); // State-changing functions function pauseRelay() external; function unpauseRelay() external; function setRewardAmountInTDT(uint _rewardAmountInTDT) external; function setFinalizationParameter(uint _finalizationParameter) external; function setRelayerPercentageFee(uint _relayerPercentageFee) external; function setTeleportDAOToken(address _TeleportDAOToken) external; function setEpochLength(uint _epochLength) external; function setBaseQueries(uint _baseQueries) external; function setSubmissionGasUsed(uint _submissionGasUsed) external; function checkTxProof( bytes32 txid, uint blockHeight, bytes calldata intermediateNodes, uint index ) external payable returns (bool); function addHeaders(bytes calldata _anchor, bytes calldata _headers) external returns (bool); function addHeadersWithRetarget( bytes calldata _oldPeriodStartHeader, bytes calldata _oldPeriodEndHeader, bytes calldata _headers ) external returns (bool); function ownerAddHeaders(bytes calldata _anchor, bytes calldata _headers) external returns (bool); function ownerAddHeadersWithRetarget( bytes calldata _oldPeriodStartHeader, bytes calldata _oldPeriodEndHeader, bytes calldata _headers ) external returns (bool); }
// SPDX-License-Identifier: MIT 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() { _setOwner(_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 { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT 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 Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { 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; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount ) external returns (bool); /** * @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); }
// SPDX-License-Identifier: MIT 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; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_teleBTC","type":"address"},{"internalType":"address","name":"_relay","type":"address"},{"internalType":"address","name":"_priceOracle","type":"address"},{"internalType":"address","name":"_collateralPoolFactory","type":"address"},{"internalType":"uint256","name":"_slasherPercentageReward","type":"uint256"},{"internalType":"uint256","name":"_paybackDeadline","type":"uint256"},{"internalType":"address","name":"_defaultExchangeConnector","type":"address"},{"internalType":"uint256","name":"_maxPriceDifferencePercent","type":"uint256"},{"internalType":"address","name":"_treasuaryAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"loanAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"instantFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"path","type":"address[]"},{"indexed":false,"internalType":"bool","name":"isFixed","type":"bool"},{"indexed":true,"internalType":"uint256","name":"deadline","type":"uint256"},{"indexed":true,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"lockedCollateralPoolToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requestCounterOfUser","type":"uint256"}],"name":"InstantExchange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"loanAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"instantFee","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"deadline","type":"uint256"},{"indexed":true,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"lockedCollateralPoolToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requestCounterOfUser","type":"uint256"}],"name":"InstantTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldCollateralPoolFactory","type":"address"},{"indexed":false,"internalType":"address","name":"newCollateralPoolFactory","type":"address"}],"name":"NewCollateralPoolFactory","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldDefaultExchangeConnector","type":"address"},{"indexed":false,"internalType":"address","name":"newDefaultExchangeConnector","type":"address"}],"name":"NewDefaultExchangeConnector","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxPriceDifferencePercent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxPriceDifferencePercent","type":"uint256"}],"name":"NewMaxPriceDifferencePercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldPaybackDeadline","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPaybackDeadline","type":"uint256"}],"name":"NewPaybackDeadline","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPriceOracle","type":"address"},{"indexed":false,"internalType":"address","name":"newPriceOracle","type":"address"}],"name":"NewPriceOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldRelay","type":"address"},{"indexed":false,"internalType":"address","name":"newRelay","type":"address"}],"name":"NewRelay","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldSlasherPercentageReward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newSlasherPercentageReward","type":"uint256"}],"name":"NewSlasherPercentageReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldTeleBTC","type":"address"},{"indexed":false,"internalType":"address","name":"newTeleBTC","type":"address"}],"name":"NewTeleBTC","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldTeleBTCInstantPool","type":"address"},{"indexed":false,"internalType":"address","name":"newTeleBTCInstantPool","type":"address"}],"name":"NewTeleBTCInstantPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldTreasuaryAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newTreasuaryAddress","type":"address"}],"name":"NewTreasuaryAddress","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":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"paybackAmount","type":"uint256"},{"indexed":true,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"lockedCollateralPoolToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requestCounterOfUser","type":"uint256"}],"name":"PaybackLoan","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"slashedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paybackAmount","type":"uint256"},{"indexed":true,"internalType":"address","name":"slasher","type":"address"},{"indexed":false,"internalType":"uint256","name":"slasherReward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requestCounterOfUser","type":"uint256"}],"name":"SlashUser","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"collateralPoolFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultExchangeConnector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fixPaybackDeadline","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getLockedCollateralPoolTokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getUserRequestDeadline","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserRequestsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_exchangeConnector","type":"address"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_loanAmount","type":"uint256"},{"internalType":"uint256","name":"_amountOut","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"address","name":"_collateralToken","type":"address"},{"internalType":"bool","name":"_isFixedToken","type":"bool"}],"name":"instantCCExchange","outputs":[{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_loanAmount","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"address","name":"_collateralToken","type":"address"}],"name":"instantCCTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"instantRequestCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"instantRequests","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"collateralPool","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"uint256","name":"paybackAmount","type":"uint256"},{"internalType":"uint256","name":"lockedCollateralPoolTokenAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"requestCounterOfUser","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPriceDifferencePercent","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":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_teleBTCAmount","type":"uint256"}],"name":"payBackLoan","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paybackDeadline","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"relay","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collateralPoolFactory","type":"address"}],"name":"setCollateralPoolFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_defaultExchangeConnector","type":"address"}],"name":"setDefaultExchangeConnector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPriceDifferencePercent","type":"uint256"}],"name":"setMaxPriceDifferencePercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_paybackDeadline","type":"uint256"}],"name":"setPaybackDeadline","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_priceOracle","type":"address"}],"name":"setPriceOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_relay","type":"address"}],"name":"setRelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_slasherPercentageReward","type":"uint256"}],"name":"setSlasherPercentageReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_teleBTC","type":"address"}],"name":"setTeleBTC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_teleBTCInstantPool","type":"address"}],"name":"setTeleBTCInstantPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasuaryAddress","type":"address"}],"name":"setTreasuaryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_requestIndex","type":"uint256"}],"name":"slashUser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slasherPercentageReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teleBTC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teleBTCInstantPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuaryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162004fdb38038062004fdb83398101604081905262000034916200076d565b6200003f33620000bf565b600180556002805460ff1916905562000058896200010f565b6200006388620001c5565b6200006e8762000277565b620000798662000329565b6200008485620003db565b6200008f8462000487565b6200009a83620005ab565b620000a5826200065d565b620000b0816200069e565b50505050505050505062000825565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b806001600160a01b0381166200015b5760405162461bcd60e51b815260206004820152601b602482015260008051602062004fbb83398151915260448201526064015b60405180910390fd5b600954604080516001600160a01b03928316815291841660208301527f36a4c08a38b736dcecb6c328dba61238529620e83ccb23db2cc43cd34ec26096910160405180910390a150600980546001600160a01b0319166001600160a01b0392909216919091179055565b806001600160a01b0381166200020d5760405162461bcd60e51b815260206004820152601b602482015260008051602062004fbb833981519152604482015260640162000152565b600b54604080516001600160a01b03928316815291841660208301527f4c28a3f61a715259c4dc930c23e7423b8fa52e13232c061a6e488729c66184f4910160405180910390a150600b80546001600160a01b0319166001600160a01b0392909216919091179055565b806001600160a01b038116620002bf5760405162461bcd60e51b815260206004820152601b602482015260008051602062004fbb833981519152604482015260640162000152565b600c54604080516001600160a01b03928316815291841660208301527fd52b2b9b7e9ee655fcb95d2e5b9e0c9f69e7ef2b8e9d2d0ea78402d576d22e22910160405180910390a150600c80546001600160a01b0319166001600160a01b0392909216919091179055565b806001600160a01b038116620003715760405162461bcd60e51b815260206004820152601b602482015260008051602062004fbb833981519152604482015260640162000152565b600d54604080516001600160a01b03928316815291841660208301527fd51c31ccb4333b99667a51924b3f89f75c155d6187aff592fa8ef986a20ad09d910160405180910390a150600d80546001600160a01b0319166001600160a01b0392909216919091179055565b612710811115620004465760405162461bcd60e51b815260206004820152602e60248201527f496e7374616e74526f757465723a2077726f6e6720736c61736865722070657260448201526d18d95b9d1859d9481c995dd85c9960921b606482015260840162000152565b60055460408051918252602082018390527fbafa1687bdcc9d362e353e72d948d31c10ccb6cc807954aeb60b22c3d9c1f7fc910160405180910390a1600555565b600b5460408051630a072bc560e41b815290516000926001600160a01b03169163a072bc50916004808301926020929190829003018186803b158015620004cd57600080fd5b505afa158015620004e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200050891906200080c565b9050808211620005695760405162461bcd60e51b815260206004820152602560248201527f496e7374616e74526f757465723a2077726f6e67207061796261636b20646561604482015264646c696e6560d81b606482015260840162000152565b60065460408051918252602082018490527f8961dc7f3b9bf9cae4b1bb7adf97b539964e3b1ce06bb594e07eb749abccd154910160405180910390a150600655565b806001600160a01b038116620005f35760405162461bcd60e51b815260206004820152601b602482015260008051602062004fbb833981519152604482015260640162000152565b600e54604080516001600160a01b03928316815291841660208301527f6f7d06859da91e8b95419b65f1ad86a2bdf0bab9da3901262f9589238fb6bef9910160405180910390a150600e80546001600160a01b0319166001600160a01b0392909216919091179055565b60075460408051918252602082018390527fa9502d1c6a80fff555ed4c36e06560904db6a20f46584016871880899b90d81e910160405180910390a1600755565b806001600160a01b038116620006e65760405162461bcd60e51b815260206004820152601b602482015260008051602062004fbb833981519152604482015260640162000152565b600854604080516001600160a01b03928316815291841660208301527fe8208543ecfdd06a600179d039c5c8f0d8ae4823b4e5343162f091ad22672aed910160405180910390a150600880546001600160a01b0319166001600160a01b0392909216919091179055565b80516001600160a01b03811681146200076857600080fd5b919050565b60008060008060008060008060006101208a8c0312156200078c578485fd5b620007978a62000750565b9850620007a760208b0162000750565b9750620007b760408b0162000750565b9650620007c760608b0162000750565b955060808a0151945060a08a01519350620007e560c08b0162000750565b925060e08a01519150620007fd6101008b0162000750565b90509295985092959850929598565b6000602082840312156200081e578081fd5b5051919050565b61478680620008356000396000f3fe6080604052600436106102135760003560e01c8063763360db11610118578063a36be9a1116100a0578063c805f68b1161006f578063c805f68b14610644578063d7aa5e7a14610664578063db1cb55814610684578063f2fde38b146106a4578063fbe2a7d9146106c45761021a565b8063a36be9a1146105d9578063a8463b5f146105ef578063b2dd6ba314610604578063b59589d1146106245761021a565b80638d3d78cd116100e75780638d3d78cd146104ff5780638da5cb5b1461051f5780639441f9ec1461053d57806397091b89146105535780639dec3525146105b95761021a565b8063763360db1461048a57806378b58675146104aa5780637f0f1817146104ca5780638456cb59146104ea5761021a565b80634d61878e1161019b578063697380b21161016a578063697380b2146103db5780636b7b3719146103fb5780636dd3d589146104285780636f6ef7c914610448578063715018a6146104755761021a565b80634d61878e14610357578063530e784f146103775780635c975abb1461039757806369539c70146103bb5761021a565b80633f4ba83a116101e25780633f4ba83a146102cc578063419cba7f146102e157806346e897fd146102f75780634782bc36146103175780634cf46825146103375761021a565b8063059d02381461021f5780631c9d583c146102415780632630c12f14610261578063387bb22d1461029e5761021a565b3661021a57005b600080fd5b34801561022b57600080fd5b5061023f61023a366004614013565b6106e4565b005b34801561024d57600080fd5b5061023f61025c366004614013565b610723565b34801561026d57600080fd5b50600c54610281906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102aa57600080fd5b506102be6102b9366004614013565b610756565b604051908152602001610295565b3480156102d857600080fd5b5061023f610775565b3480156102ed57600080fd5b506102be60055481565b34801561030357600080fd5b50600a54610281906001600160a01b031681565b34801561032357600080fd5b5061023f6103323660046142b4565b6107a9565b34801561034357600080fd5b5061023f6103523660046142b4565b6107dc565b34801561036357600080fd5b506102be610372366004614150565b61080f565b34801561038357600080fd5b5061023f610392366004614013565b6108c8565b3480156103a357600080fd5b5060025460ff165b6040519015158152602001610295565b3480156103c757600080fd5b506102be6103d6366004614150565b6108fb565b3480156103e757600080fd5b506103ab6103f636600461417b565b6109b4565b34801561040757600080fd5b506102be610416366004614013565b60046020526000908152604090205481565b34801561043457600080fd5b5061023f610443366004614013565b610d6f565b34801561045457600080fd5b5061046861046336600461404b565b610da2565b60405161029591906143b9565b34801561048157600080fd5b5061023f611332565b34801561049657600080fd5b50600d54610281906001600160a01b031681565b3480156104b657600080fd5b506103ab6104c5366004614150565b61135c565b3480156104d657600080fd5b5061023f6104e5366004614013565b612232565b3480156104f657600080fd5b5061023f612265565b34801561050b57600080fd5b50600954610281906001600160a01b031681565b34801561052b57600080fd5b506000546001600160a01b0316610281565b34801561054957600080fd5b506102be60075481565b34801561055f57600080fd5b5061057361056e366004614150565b612297565b604080516001600160a01b039889168152968816602088015294909616938501939093526060840191909152608083015260a082015260c081019190915260e001610295565b3480156105c557600080fd5b5061023f6105d43660046142b4565b612300565b3480156105e557600080fd5b506102be60065481565b3480156105fb57600080fd5b5061023f612333565b34801561061057600080fd5b50600854610281906001600160a01b031681565b34801561063057600080fd5b50600b54610281906001600160a01b031681565b34801561065057600080fd5b5061023f61065f366004614013565b612464565b34801561067057600080fd5b50600e54610281906001600160a01b031681565b34801561069057600080fd5b506103ab61069f366004614150565b612497565b3480156106b057600080fd5b5061023f6106bf366004614013565b612af2565b3480156106d057600080fd5b5061023f6106df366004614013565b612b8a565b6000546001600160a01b031633146107175760405162461bcd60e51b815260040161070e906144d3565b60405180910390fd5b61072081612bbd565b50565b6000546001600160a01b0316331461074d5760405162461bcd60e51b815260040161070e906144d3565b61072081612c4e565b6001600160a01b0381166000908152600360205260409020545b919050565b6000546001600160a01b0316331461079f5760405162461bcd60e51b815260040161070e906144d3565b6107a7612cdf565b565b6000546001600160a01b031633146107d35760405162461bcd60e51b815260040161070e906144d3565b61072081612d72565b6000546001600160a01b031633146108065760405162461bcd60e51b815260040161070e906144d3565b61072081612e1c565b6001600160a01b03821660009081526003602052604081205482106108765760405162461bcd60e51b815260206004820152601a60248201527f496e7374616e74526f757465723a2077726f6e6720696e646578000000000000604482015260640161070e565b6001600160a01b03831660009081526003602052604090208054839081106108ae57634e487b7160e01b600052603260045260246000fd5b906000526020600020906007020160050154905092915050565b6000546001600160a01b031633146108f25760405162461bcd60e51b815260040161070e906144d3565b61072081612f3a565b6001600160a01b03821660009081526003602052604081205482106109625760405162461bcd60e51b815260206004820152601a60248201527f496e7374616e74526f757465723a2077726f6e6720696e646578000000000000604482015260640161070e565b6001600160a01b038316600090815260036020526040902080548390811061099a57634e487b7160e01b600052603260045260246000fd5b906000526020600020906007020160040154905092915050565b6000600260015414156109d95760405162461bcd60e51b815260040161070e90614508565b6002600155846001600160a01b038116610a055760405162461bcd60e51b815260040161070e90614430565b826001600160a01b038116610a2c5760405162461bcd60e51b815260040161070e90614430565b60025460ff1615610a4f5760405162461bcd60e51b815260040161070e90614467565b42851015610a6f5760405162461bcd60e51b815260040161070e90614491565b600a54604051633f3b917d60e21b8152600481018890526000916001600160a01b03169063fcee45f49060240160206040518083038186803b158015610ab457600080fd5b505afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec91906142cc565b9050610b0233610afc838a6145dc565b87612fcb565b600a546040516350e28ac360e11b81526001600160a01b038a81166004830152602482018a90529091169063a1c5158690604401602060405180830381600087803b158015610b5057600080fd5b505af1158015610b64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8891906141c4565b5033600090815260036020526040902080546001600160a01b0387169190610bb290600190614672565b81548110610bd057634e487b7160e01b600052603260045260246000fd5b906000526020600020906007020160050154610be93390565b6001600160a01b03167f78f6eb344326b271069e0b49a8b066463a9801e7056092522e83ef7b947f0c968b8b8660036000336001600160a01b03166001600160a01b03168152602001908152602001600020600160036000610c483390565b6001600160a01b03168152602081019190915260400160002054610c6c9190614672565b81548110610c8a57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600702016004015460036000610ca73390565b6001600160a01b03166001600160a01b03168152602001908152602001600020600160036000610cd43390565b6001600160a01b03168152602081019190915260400160002054610cf89190614672565b81548110610d1657634e487b7160e01b600052603260045260246000fd5b600091825260209182902060066007909202010154604080516001600160a01b039097168752918601949094528401919091526060830152608082015260a00160405180910390a4505060018080559695505050505050565b6000546001600160a01b03163314610d995760405162461bcd60e51b815260040161070e906144d3565b61072081613701565b606060026001541415610dc75760405162461bcd60e51b815260040161070e90614508565b6002600155886001600160a01b038116610df35760405162461bcd60e51b815260040161070e90614430565b60025460ff1615610e165760405162461bcd60e51b815260040161070e90614467565b42851015610e365760405162461bcd60e51b815260040161070e90614491565b60095486516001600160a01b03909116908790600090610e6657634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316148015610e85575060018651115b610ed15760405162461bcd60e51b815260206004820152601e60248201527f496e7374616e74526f757465723a207061746820697320696e76616c69640000604482015260640161070e565b600a54604051633f3b917d60e21b8152600481018a90526000916001600160a01b03169063fcee45f49060240160206040518083038186803b158015610f1657600080fd5b505afa158015610f2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4e91906142cc565b9050610f5e33610afc838c6145dc565b600a546040516350e28ac360e11b8152306004820152602481018b90526001600160a01b039091169063a1c5158690604401602060405180830381600087803b158015610faa57600080fd5b505af1158015610fbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe291906141c4565b5060095460405163095ea7b360e01b81526001600160a01b038d81166004830152602482018c90529091169063095ea7b390604401602060405180830381600087803b15801561103157600080fd5b505af1158015611045573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106991906141c4565b5060008b6001600160a01b031663b0bbcd888b8b8b8f8c8b6040518763ffffffff1660e01b81526004016110a29695949392919061453f565b600060405180830381600087803b1580156110bc57600080fd5b505af11580156110d0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110f891908101906141e0565b945090506001811515146111615760405162461bcd60e51b815260206004820152602a60248201527f496e7374616e74526f757465723a2065786368616e676520776173206e6f74206044820152691cdd58d8d95cdcd99d5b60b21b606482015260840161070e565b33600090815260036020526040902080546001600160a01b038816919061118a90600190614672565b815481106111a857634e487b7160e01b600052603260045260246000fd5b9060005260206000209060070201600501546111c13390565b6001600160a01b03167f420fb2c476199fbcc4a0ce247fea400eef537161a974799739298de5e80e33a98e8e878f8f8d60036000336001600160a01b03166001600160a01b031681526020019081526020016000206001600360006112233390565b6001600160a01b031681526020810191909152604001600020546112479190614672565b8154811061126557634e487b7160e01b600052603260045260246000fd5b906000526020600020906007020160040154600360006112823390565b6001600160a01b03166001600160a01b031681526020019081526020016000206001600360006112af3390565b6001600160a01b031681526020810191909152604001600020546112d39190614672565b815481106112f157634e487b7160e01b600052603260045260246000fd5b906000526020600020906007020160060154604051611317989796959493929190614364565b60405180910390a45050600180555098975050505050505050565b6000546001600160a01b031633146107a75760405162461bcd60e51b815260040161070e906144d3565b6000600260015414156113815760405162461bcd60e51b815260040161070e90614508565b6002600155826001600160a01b0381166113ad5760405162461bcd60e51b815260040161070e90614430565b6001600160a01b03841660009081526003602052604090205483106114285760405162461bcd60e51b815260206004820152602b60248201527f496e7374616e74526f757465723a207265717565737420696e64657820646f6560448201526a1cc81b9bdd08195e1a5cdd60aa1b606482015260840161070e565b600b54604080516302f796d960e41b815290516000926001600160a01b031691632f796d90916004808301926020929190829003018186803b15801561146d57600080fd5b505afa158015611481573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a591906142cc565b6001600160a01b038616600090815260036020526040902080549192508291869081106114e257634e487b7160e01b600052603260045260246000fd5b906000526020600020906007020160050154106115545760405162461bcd60e51b815260206004820152602a60248201527f496e7374616e74526f757465723a20646561646c696e6520686173206e6f74206044820152691c185cdcd959081e595d60b21b606482015260840161070e565b6001600160a01b038516600090815260036020526040812080548690811061158c57634e487b7160e01b600052603260045260246000fd5b600091825260208083206040805160e081018252600794850290920180546001600160a01b03908116845260018201548116948401949094526002810154909316908201526003820154606082015260048201546080820152600582015460a082015260069091015460c082015290549092506127109061160d90826145dc565b836060015161161c9190614614565b61162691906145f4565b600e5460408481015160095491516322620c1d60e21b8152600481018590526001600160a01b039182166024820152918116604483015292935060009283921690638988307490606401604080518083038186803b15801561168757600080fd5b505afa15801561169b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116bf9190614287565b909250905060018215151461174f5760405162461bcd60e51b815260206004820152604a60248201527f496e7374616e74526f757465723a206c697175696469747920706f6f6c20646f60448201527f65736e2774206578697374206f72206c6971756964697479206973206e6f74206064820152691cdd59999a58da595b9d60b21b608482015260a40161070e565b600c546009546040805163313ce56760e01b815290516000936001600160a01b03908116936316fac92a938993919092169163313ce567916004808301926020929190829003018186803b1580156117a657600080fd5b505afa1580156117ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117de91906142e4565b88604001516001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561181b57600080fd5b505afa15801561182f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061185391906142e4565b60095460408b810151905160e087901b6001600160e01b0319168152600481019590955260ff93841660248601529290911660448401526001600160a01b03908116606484015216608482015260a40160206040518083038186803b1580156118bb57600080fd5b505afa1580156118cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f391906142cc565b9050600061191b61190384613792565b61190c84613792565b6119169190614633565b613800565b90506127106007548461192e9190614614565b61193891906145f4565b8111156119a35760405162461bcd60e51b815260206004820152603360248201527f496e7374616e74526f757465723a2062696720676170206265747765656e206f6044820152727261636c6520616e6420414d4d20707269636560681b606482015260840161070e565b8183106119b657856060015194506119d4565b828287606001516119c79190614614565b6119d191906145f4565b94505b6020860151608087015160405163392f2ddd60e01b815260048101919091526000916001600160a01b03169063392f2ddd9060240160206040518083038186803b158015611a2157600080fd5b505afa158015611a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5991906142cc565b6040805160028082526060820183529293506000929091602083019080368337019050509050876040015181600081518110611aa557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600954825191169082906001908110611ae457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505087602001516001600160a01b0316633237c15889608001516040518263ffffffff1660e01b8152600401611b3a91815260200190565b602060405180830381600087803b158015611b5457600080fd5b505af1158015611b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8c91906141c4565b50848210611f2857604088810151600e54915163095ea7b360e01b81526001600160a01b0392831660048201526024810188905291169063095ea7b390604401602060405180830381600087803b158015611be657600080fd5b505af1158015611bfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1e91906141c4565b50600e546001600160a01b031663b0bbcd8886898430611c3f4260016145dc565b60006040518763ffffffff1660e01b8152600401611c629695949392919061453f565b600060405180830381600087803b158015611c7c57600080fd5b505af1158015611c90573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cb891908101906141e0565b5050600a546060890151600954611cdd926001600160a01b0391821692911690613819565b6008546060890151611d10916001600160a01b031690611cfd908a614672565b6009546001600160a01b03169190613819565b60006127106005548785611d249190614672565b611d2e9190614614565b611d3891906145f4565b9050611d533360408b01516001600160a01b03169083613819565b88604001516001600160a01b031663095ea7b38a60200151838987611d789190614672565b611d829190614672565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015611dc857600080fd5b505af1158015611ddc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0091906141c4565b5060208901516001600160a01b0316636d75b9ee8f83611e208a88614672565b611e2a9190614672565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015611e7057600080fd5b505af1158015611e84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea891906141c4565b50336001600160a01b031689604001516001600160a01b03168f6001600160a01b03167fc2baf6a73c7688a95aaa152e46e1683e51426f3e2dd2badc3d0c8d7b52e297b8898c868f60c00151604051611f1a949392919093845260208401929092526040830152606082015260800190565b60405180910390a450612212565b6040805160028082526060820183526000926020830190803683370190505060408a810151600e54915163095ea7b360e01b81526001600160a01b03928316600482015260248101879052929350169063095ea7b390604401602060405180830381600087803b158015611f9b57600080fd5b505af1158015611faf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fd391906141c4565b50600e546001600160a01b031663b0bbcd888460008530611ff54260016145dc565b60016040518763ffffffff1660e01b81526004016120189695949392919061453f565b600060405180830381600087803b15801561203257600080fd5b505af1158015612046573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261206e91908101906141e0565b90508091505088606001518160018151811061209a57634e487b7160e01b600052603260045260246000fd5b6020026020010151111561211c57600a5460608a01516009546120cb926001600160a01b0391821692911690613819565b60085460608a01518251612117926001600160a01b031691908490600190811061210557634e487b7160e01b600052603260045260246000fd5b6020026020010151611cfd9190614672565b61216e565b600a54815161216e916001600160a01b0316908390600190811061215057634e487b7160e01b600052603260045260246000fd5b60209081029190910101516009546001600160a01b03169190613819565b336001600160a01b031689604001516001600160a01b03168f6001600160a01b03167fc2baf6a73c7688a95aaa152e46e1683e51426f3e2dd2badc3d0c8d7b52e297b886856001815181106121d357634e487b7160e01b600052603260045260246000fd5b602002602001015160008f60c00151604051612208949392919093845260208401929092526040830152606082015260800190565b60405180910390a4505b61221c8d8d613881565b505060018080559b9a5050505050505050505050565b6000546001600160a01b0316331461225c5760405162461bcd60e51b815260040161070e906144d3565b61072081613ad7565b6000546001600160a01b0316331461228f5760405162461bcd60e51b815260040161070e906144d3565b6107a7613b68565b600360205281600052604060002081815481106122b357600080fd5b600091825260209091206007909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b03958616985093851696509190931693909187565b6000546001600160a01b0316331461232a5760405162461bcd60e51b815260040161070e906144d3565b61072081613bc0565b600b5460408051630a072bc560e41b815290516000926001600160a01b03169163a072bc50916004808301926020929190829003018186803b15801561237857600080fd5b505afa15801561238c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b091906142cc565b905060065481111561243d5760405162461bcd60e51b815260206004820152604a60248201527f496e7374616e74526f757465723a2066696e616c697a6174696f6e207061726160448201527f6d65746572206973206e6f742067726561746572207468616e207061796261636064820152696b20646561646c696e6560b01b608482015260a40161070e565b600061244a826002614614565b6124559060016145dc565b905061246081612e1c565b5050565b6000546001600160a01b0316331461248e5760405162461bcd60e51b815260040161070e906144d3565b61072081613c01565b6000600260015414156124bc5760405162461bcd60e51b815260040161070e90614508565b6002600155826001600160a01b0381166124e85760405162461bcd60e51b815260040161070e90614430565b600b54604080516302f796d960e41b8152905185926000926001600160a01b0390911691632f796d9091600480820192602092909190829003018186803b15801561253257600080fd5b505afa158015612546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256a91906142cc565b9050600060015b6001600160a01b03881660009081526003602052604090205481116129a2576001600160a01b03881660009081526003602052604090206125b3600183614672565b815481106125d157634e487b7160e01b600052603260045260246000fd5b906000526020600020906007020160030154841015801561264557506001600160a01b03881660009081526003602052604090208390612612600184614672565b8154811061263057634e487b7160e01b600052603260045260246000fd5b90600052602060002090600702016005015410155b15612986576001600160a01b038816600090815260036020526040902061266d600183614672565b8154811061268b57634e487b7160e01b600052603260045260246000fd5b906000526020600020906007020160030154846126a89190614672565b6001600160a01b03891660009081526003602052604090209094506126ce600183614672565b815481106126ec57634e487b7160e01b600052603260045260246000fd5b9060005260206000209060070201600301548261270991906145dc565b6001600160a01b03891660009081526003602052604090209092506127cd908990612735600185614672565b8154811061275357634e487b7160e01b600052603260045260246000fd5b60009182526020808320600460079093020191909101546001600160a01b038d1683526003909152604090912061278b600186614672565b815481106127a957634e487b7160e01b600052603260045260246000fd5b60009182526020909120600160079092020101546001600160a01b03169190613819565b6001600160a01b03881660009081526003602052604090206127f0600183614672565b8154811061280e57634e487b7160e01b600052603260045260246000fd5b60009182526020808320600260079093020191909101546001600160a01b038b8116808552600390935260409093209216917f10230d50e08046aa8fd499b9535a95c9b8d13f9a644a03087f010c0bc3e0deb49061286d600186614672565b8154811061288b57634e487b7160e01b600052603260045260246000fd5b6000918252602080832060036007909302018201546001600160a01b038f16845291905260409091206128bf600187614672565b815481106128dd57634e487b7160e01b600052603260045260246000fd5b60009182526020808320600460079093020191909101546001600160a01b038f16835260039091526040909120612915600188614672565b8154811061293357634e487b7160e01b600052603260045260246000fd5b600091825260209182902060066007909202010154604080519485529184019290925282015260600160405180910390a361297888612973600184614672565b613881565b80612982816146b5565b9150505b83612990576129a2565b8061299a816146cc565b915050612571565b506009546001600160a01b03166323b872dd33600a5460405160e084901b6001600160e01b03191681526001600160a01b0392831660048201529116602482015260448101849052606401602060405180830381600087803b158015612a0757600080fd5b505af1158015612a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3f91906141c4565b508215612ae2576009546001600160a01b03166323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908a16602482015260448101869052606401602060405180830381600087803b158015612aa857600080fd5b505af1158015612abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae091906141c4565b505b5050600180805595945050505050565b6000546001600160a01b03163314612b1c5760405162461bcd60e51b815260040161070e906144d3565b6001600160a01b038116612b815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161070e565b61072081613c92565b6000546001600160a01b03163314612bb45760405162461bcd60e51b815260040161070e906144d3565b61072081613ce2565b806001600160a01b038116612be45760405162461bcd60e51b815260040161070e90614430565b600a54604080516001600160a01b03928316815291841660208301527f4501c7a19a4c866a4da8d06cf169cf17b87b88dc6c051dbab96d998dbbb133ef910160405180910390a150600a80546001600160a01b0319166001600160a01b0392909216919091179055565b806001600160a01b038116612c755760405162461bcd60e51b815260040161070e90614430565b600e54604080516001600160a01b03928316815291841660208301527f6f7d06859da91e8b95419b65f1ad86a2bdf0bab9da3901262f9589238fb6bef9910160405180910390a150600e80546001600160a01b0319166001600160a01b0392909216919091179055565b60025460ff16612d285760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161070e565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b612710811115612ddb5760405162461bcd60e51b815260206004820152602e60248201527f496e7374616e74526f757465723a2077726f6e6720736c61736865722070657260448201526d18d95b9d1859d9481c995dd85c9960921b606482015260840161070e565b60055460408051918252602082018390527fbafa1687bdcc9d362e353e72d948d31c10ccb6cc807954aeb60b22c3d9c1f7fc910160405180910390a1600555565b600b5460408051630a072bc560e41b815290516000926001600160a01b03169163a072bc50916004808301926020929190829003018186803b158015612e6157600080fd5b505afa158015612e75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9991906142cc565b9050808211612ef85760405162461bcd60e51b815260206004820152602560248201527f496e7374616e74526f757465723a2077726f6e67207061796261636b20646561604482015264646c696e6560d81b606482015260840161070e565b60065460408051918252602082018490527f8961dc7f3b9bf9cae4b1bb7adf97b539964e3b1ce06bb594e07eb749abccd154910160405180910390a150600655565b806001600160a01b038116612f615760405162461bcd60e51b815260040161070e90614430565b600c54604080516001600160a01b03928316815291841660208301527fd52b2b9b7e9ee655fcb95d2e5b9e0c9f69e7ef2b8e9d2d0ea78402d576d22e22910160405180910390a150600c80546001600160a01b0319166001600160a01b0392909216919091179055565b806001600160a01b038116612ff25760405162461bcd60e51b815260040161070e90614430565b600d546040516303b8879560e21b81526001600160a01b03848116600483015290911690630ee21e549060240160206040518083038186803b15801561303757600080fd5b505afa15801561304b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061306f91906141c4565b6130d55760405162461bcd60e51b815260206004820152603160248201527f496e7374616e74526f757465723a20636f6c6c61746572616c20746f6b656e206044820152706973206e6f742061636365707461626c6560781b606482015260840161070e565b6001600160a01b038416600090815260036020526040902054600a1161314c5760405162461bcd60e51b815260206004820152602660248201527f496e7374616e74526f757465723a2072656163686564206d6178206c6f616e20604482015265373ab6b132b960d11b606482015260840161070e565b600d54604051636e2f809f60e11b81526001600160a01b038481166004830152600092169063dc5f013e9060240160206040518083038186803b15801561319257600080fd5b505afa1580156131a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131ca919061402f565b90506000816001600160a01b031663dcaf9c446040518163ffffffff1660e01b815260040160206040518083038186803b15801561320757600080fd5b505afa15801561321b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061323f91906142cc565b600c546009546040805163313ce56760e01b815290519394506000936001600160a01b03938416936316fac92a938b9391169163313ce56791600480820192602092909190829003018186803b15801561329857600080fd5b505afa1580156132ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132d091906142e4565b886001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561330957600080fd5b505afa15801561331d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061334191906142e4565b60095460405160e086901b6001600160e01b0319168152600481019490945260ff9283166024850152911660448301526001600160a01b0390811660648301528816608482015260a40160206040518083038186803b1580156133a357600080fd5b505afa1580156133b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133db91906142cc565b905060006127106133ec8484614614565b6133f691906145f4565b6040516309fad23760e11b8152600481018290529091506000906001600160a01b038616906313f5a46e9060240160206040518083038186803b15801561343c57600080fd5b505afa158015613450573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061347491906142cc565b905061348b6001600160a01b0386168a3084613d73565b6134e66040518060e0016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b03808b168252606082018a905260808201839052868116602080840191909152898216604080850191909152600654600b5482516302f796d960e41b8152925191941692632f796d909260048082019391829003018186803b15801561355257600080fd5b505afa158015613566573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061358a91906142cc565b61359491906145dc565b60a08201526001600160a01b038a16600081815260046020818152604083205460c086018190529390925290526135cc9060016145dc565b600460008c6001600160a01b03166001600160a01b0316815260200190815260200160002081905550600360008b6001600160a01b03166001600160a01b0316815260200190815260200160002081908060018154018082558091505060019003906000526020600020906007020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600301556080820151816004015560a0820151816005015560c08201518160060155505050505050505050505050565b806001600160a01b0381166137285760405162461bcd60e51b815260040161070e90614430565b600d54604080516001600160a01b03928316815291841660208301527fd51c31ccb4333b99667a51924b3f89f75c155d6187aff592fa8ef986a20ad09d910160405180910390a150600d80546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160ff1b038211156137fc5760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b606482015260840161070e565b5090565b6000808212156137fc57613813826146e7565b92915050565b6040516001600160a01b03831660248201526044810182905261387c90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613db1565b505050565b6001600160a01b03821660009081526003602052604090205481106138f45760405162461bcd60e51b8152602060048201526024808201527f496e7374616e74526f757465723a20696e646578206973206f7574206f6620626044820152631bdd5b9960e21b606482015260840161070e565b805b6001600160a01b03831660009081526003602052604090205461391b90600190614672565b811015613a48576001600160a01b03831660009081526003602052604090206139458260016145dc565b8154811061396357634e487b7160e01b600052603260045260246000fd5b906000526020600020906007020160036000856001600160a01b03166001600160a01b0316815260200190815260200160002082815481106139b557634e487b7160e01b600052603260045260246000fd5b60009182526020909120825460079092020180546001600160a01b039283166001600160a01b0319918216178255600180850154908301805491851691831691909117905560028085015490830180549190941691161790915560038083015490820155600480830154908201556005808301549082015560069182015491015580613a40816146cc565b9150506138f6565b506001600160a01b0382166000908152600360205260409020805480613a7e57634e487b7160e01b600052603160045260246000fd5b60008281526020812060076000199093019283020180546001600160a01b031990811682556001820180548216905560028201805490911690556003810182905560048101829055600581018290556006015590555050565b806001600160a01b038116613afe5760405162461bcd60e51b815260040161070e90614430565b600954604080516001600160a01b03928316815291841660208301527f36a4c08a38b736dcecb6c328dba61238529620e83ccb23db2cc43cd34ec26096910160405180910390a150600980546001600160a01b0319166001600160a01b0392909216919091179055565b60025460ff1615613b8b5760405162461bcd60e51b815260040161070e90614467565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612d553390565b60075460408051918252602082018390527fa9502d1c6a80fff555ed4c36e06560904db6a20f46584016871880899b90d81e910160405180910390a1600755565b806001600160a01b038116613c285760405162461bcd60e51b815260040161070e90614430565b600b54604080516001600160a01b03928316815291841660208301527f4c28a3f61a715259c4dc930c23e7423b8fa52e13232c061a6e488729c66184f4910160405180910390a150600b80546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b806001600160a01b038116613d095760405162461bcd60e51b815260040161070e90614430565b600854604080516001600160a01b03928316815291841660208301527fe8208543ecfdd06a600179d039c5c8f0d8ae4823b4e5343162f091ad22672aed910160405180910390a150600880546001600160a01b0319166001600160a01b0392909216919091179055565b6040516001600160a01b0380851660248301528316604482015260648101829052613dab9085906323b872dd60e01b90608401613845565b50505050565b6000613e06826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613e839092919063ffffffff16565b80519091501561387c5780806020019051810190613e2491906141c4565b61387c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161070e565b6060613e928484600085613e9c565b90505b9392505050565b606082471015613efd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161070e565b843b613f4b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161070e565b600080866001600160a01b03168587604051613f679190614348565b60006040518083038185875af1925050503d8060008114613fa4576040519150601f19603f3d011682016040523d82523d6000602084013e613fa9565b606091505b5091509150613fb9828286613fc4565b979650505050505050565b60608315613fd3575081613e95565b825115613fe35782518084602001fd5b8160405162461bcd60e51b815260040161070e91906143fd565b80356107708161472d565b803561077081614742565b600060208284031215614024578081fd5b8135613e958161472d565b600060208284031215614040578081fd5b8151613e958161472d565b600080600080600080600080610100898b031215614067578384fd5b88356140728161472d565b97506020898101356140838161472d565b975060408a0135965060608a0135955060808a013567ffffffffffffffff8111156140ac578586fd5b8a01601f81018c136140bc578586fd5b80356140cf6140ca826145b8565b614587565b8082825284820191508484018f8687860287010111156140ed57898afd5b8994505b838510156141185780356141048161472d565b8352600194909401939185019185016140f1565b50975050505060a08a01359350614133905060c08a01613ffd565b915061414160e08a01614008565b90509295985092959890939650565b60008060408385031215614162578182fd5b823561416d8161472d565b946020939093013593505050565b60008060008060808587031215614190578384fd5b843561419b8161472d565b9350602085013592506040850135915060608501356141b98161472d565b939692955090935050565b6000602082840312156141d5578081fd5b8151613e9581614742565b600080604083850312156141f2578182fd5b82516141fd81614742565b8092505060208084015167ffffffffffffffff81111561421b578283fd5b8401601f8101861361422b578283fd5b80516142396140ca826145b8565b81815283810190838501858402850186018a1015614255578687fd5b8694505b83851015614277578051835260019490940193918501918501614259565b5080955050505050509250929050565b60008060408385031215614299578182fd5b82516142a481614742565b6020939093015192949293505050565b6000602082840312156142c5578081fd5b5035919050565b6000602082840312156142dd578081fd5b5051919050565b6000602082840312156142f5578081fd5b815160ff81168114613e95578182fd5b6000815180845260208085019450808401835b8381101561433d5781516001600160a01b031687529582019590820190600101614318565b509495945050505050565b6000825161435a818460208701614689565b9190910192915050565b600061010060018060a01b038b16835289602084015288604084015287606084015280608084015261439881840188614305565b95151560a0840152505060c081019290925260e09091015295945050505050565b6020808252825182820181905260009190848201906040850190845b818110156143f1578351835292840192918401916001016143d5565b50909695505050505050565b600060208252825180602084015261441c816040850160208701614689565b601f01601f19169190910160400192915050565b6020808252601b908201527f496e7374616e74526f757465723a207a65726f20616464726573730000000000604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526022908201527f496e7374616e74526f757465723a20646561646c696e65206861732070617373604082015261195960f21b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600087825286602083015260c0604083015261455e60c0830187614305565b6001600160a01b03959095166060830152506080810192909252151560a0909101529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156145b0576145b0614717565b604052919050565b600067ffffffffffffffff8211156145d2576145d2614717565b5060209081020190565b600082198211156145ef576145ef614701565b500190565b60008261460f57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561462e5761462e614701565b500290565b60008083128015600160ff1b85018412161561465157614651614701565b6001600160ff1b038401831381161561466c5761466c614701565b50500390565b60008282101561468457614684614701565b500390565b60005b838110156146a457818101518382015260200161468c565b83811115613dab5750506000910152565b6000816146c4576146c4614701565b506000190190565b60006000198214156146e0576146e0614701565b5060010190565b6000600160ff1b8214156146fd576146fd614701565b0390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461072057600080fd5b801515811461072057600080fdfea2646970667358221220b3d10cc1e58055bc955a03f609b8a676087daf237976031f508c53d659314fc364736f6c63430008020033496e7374616e74526f757465723a207a65726f206164647265737300000000000000000000000000000000007deff5fd633141f923621d935609865f9d770942000000000000000000000000e5bfaa073ea002605fe2d76b85f56c76fca4fa54000000000000000000000000598221b864f773010f9f20bc2018a92430ed397f0000000000000000000000004386cca11d47546fdf3904a4184cd47dc83e85ae00000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000d69740bf9f181f78b35728f5ea78ce709767c0a800000000000000000000000000000000000000000000000000000000000009c40000000000000000000000005364e3557572bd5d5903c0e9c21be359f2eac1da
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007deff5fd633141f923621d935609865f9d770942000000000000000000000000e5bfaa073ea002605fe2d76b85f56c76fca4fa54000000000000000000000000598221b864f773010f9f20bc2018a92430ed397f0000000000000000000000004386cca11d47546fdf3904a4184cd47dc83e85ae00000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000d69740bf9f181f78b35728f5ea78ce709767c0a800000000000000000000000000000000000000000000000000000000000009c40000000000000000000000005364e3557572bd5d5903c0e9c21be359f2eac1da
-----Decoded View---------------
Arg [0] : _teleBTC (address): 0x7deff5fd633141f923621d935609865f9d770942
Arg [1] : _relay (address): 0xe5bfaa073ea002605fe2d76b85f56c76fca4fa54
Arg [2] : _priceOracle (address): 0x598221b864f773010f9f20bc2018a92430ed397f
Arg [3] : _collateralPoolFactory (address): 0x4386cca11d47546fdf3904a4184cd47dc83e85ae
Arg [4] : _slasherPercentageReward (uint256): 500
Arg [5] : _paybackDeadline (uint256): 12
Arg [6] : _defaultExchangeConnector (address): 0xd69740bf9f181f78b35728f5ea78ce709767c0a8
Arg [7] : _maxPriceDifferencePercent (uint256): 2500
Arg [8] : _treasuaryAddress (address): 0x5364e3557572bd5d5903c0e9c21be359f2eac1da
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000007deff5fd633141f923621d935609865f9d770942
Arg [1] : 000000000000000000000000e5bfaa073ea002605fe2d76b85f56c76fca4fa54
Arg [2] : 000000000000000000000000598221b864f773010f9f20bc2018a92430ed397f
Arg [3] : 0000000000000000000000004386cca11d47546fdf3904a4184cd47dc83e85ae
Arg [4] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [5] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [6] : 000000000000000000000000d69740bf9f181f78b35728f5ea78ce709767c0a8
Arg [7] : 00000000000000000000000000000000000000000000000000000000000009c4
Arg [8] : 0000000000000000000000005364e3557572bd5d5903c0e9c21be359f2eac1da
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|