Source Code
Overview
MNT Balance
MNT Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xbE73FFE3...f2C99FA90 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
GlpManager
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 10 runs
Other Settings:
istanbul EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
import "../libraries/math/SafeMath.sol";
import "../libraries/token/IERC20.sol";
import "../libraries/token/SafeERC20.sol";
import "../libraries/utils/ReentrancyGuard.sol";
import "../libraries/pyth/IPyth.sol";
import "./interfaces/IVault.sol";
import "./interfaces/IGlpManager.sol";
import "./interfaces/IShortsTracker.sol";
import "../tokens/interfaces/IUSDG.sol";
import "../tokens/interfaces/IMintable.sol";
import "../access/Governable.sol";
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
contract GlpManager is ReentrancyGuard, Governable, IGlpManager {
using SafeMath for uint256;
using SafeERC20 for IERC20;
uint256 public constant PRICE_PRECISION = 10 ** 30;
uint256 public constant USDG_DECIMALS = 18;
uint256 public constant GLP_PRECISION = 10 ** 18;
uint256 public constant MAX_COOLDOWN_DURATION = 48 hours;
uint256 public constant BASIS_POINTS_DIVISOR = 10000;
IVault public override vault;
IShortsTracker public shortsTracker;
address public override usdg;
address public override glp;
uint256 public override cooldownDuration;
mapping (address => uint256) public override lastAddedAt;
uint256 public aumAddition;
uint256 public aumDeduction;
bool public inPrivateMode;
uint256 public shortsTrackerAveragePriceWeight;
mapping (address => bool) public isHandler;
event AddLiquidity(
address account,
address token,
uint256 amount,
uint256 aumInUsdg,
uint256 glpSupply,
uint256 usdgAmount,
uint256 mintAmount
);
event RemoveLiquidity(
address account,
address token,
uint256 glpAmount,
uint256 aumInUsdg,
uint256 glpSupply,
uint256 usdgAmount,
uint256 amountOut
);
constructor(address _vault, address _usdg, address _glp, address _shortsTracker, uint256 _cooldownDuration) public {
gov = msg.sender;
vault = IVault(_vault);
usdg = _usdg;
glp = _glp;
shortsTracker = IShortsTracker(_shortsTracker);
cooldownDuration = _cooldownDuration;
}
function setInPrivateMode(bool _inPrivateMode) external onlyGov {
inPrivateMode = _inPrivateMode;
}
function setShortsTracker(IShortsTracker _shortsTracker) external onlyGov {
shortsTracker = _shortsTracker;
}
function setShortsTrackerAveragePriceWeight(uint256 _shortsTrackerAveragePriceWeight) external override onlyGov {
require(shortsTrackerAveragePriceWeight <= BASIS_POINTS_DIVISOR, "GlpManager: invalid weight");
shortsTrackerAveragePriceWeight = _shortsTrackerAveragePriceWeight;
}
function setHandler(address _handler, bool _isActive) external onlyGov {
isHandler[_handler] = _isActive;
}
function setCooldownDuration(uint256 _cooldownDuration) external override onlyGov {
require(_cooldownDuration <= MAX_COOLDOWN_DURATION, "GlpManager: invalid _cooldownDuration");
cooldownDuration = _cooldownDuration;
}
function setAumAdjustment(uint256 _aumAddition, uint256 _aumDeduction) external onlyGov {
aumAddition = _aumAddition;
aumDeduction = _aumDeduction;
}
function addLiquidity(address _token, uint256 _amount, uint256 _minUsdg, uint256 _minGlp, bytes[] calldata _pythUpdateData) external payable override nonReentrant returns (uint256) {
if (inPrivateMode) { revert("GlpManager: action not enabled"); }
_updatePythPrices(_pythUpdateData);
return _addLiquidity(msg.sender, msg.sender, _token, _amount, _minUsdg, _minGlp);
}
function addLiquidityForAccount(address _fundingAccount, address _account, address _token, uint256 _amount, uint256 _minUsdg, uint256 _minGlp) external override nonReentrant returns (uint256) {
_validateHandler();
return _addLiquidity(_fundingAccount, _account, _token, _amount, _minUsdg, _minGlp);
}
function removeLiquidity(address _tokenOut, uint256 _glpAmount, uint256 _minOut, address _receiver, bytes[] calldata _pythUpdateData) external payable override nonReentrant returns (uint256) {
if (inPrivateMode) { revert("GlpManager: action not enabled"); }
_updatePythPrices(_pythUpdateData);
return _removeLiquidity(msg.sender, _tokenOut, _glpAmount, _minOut, _receiver);
}
function removeLiquidityForAccount(address _account, address _tokenOut, uint256 _glpAmount, uint256 _minOut, address _receiver) external override nonReentrant returns (uint256) {
_validateHandler();
return _removeLiquidity(_account, _tokenOut, _glpAmount, _minOut, _receiver);
}
function getPrice(bool _maximise) external view returns (uint256) {
uint256 aum = getAum(_maximise);
uint256 supply = IERC20(glp).totalSupply();
return aum.mul(GLP_PRECISION).div(supply);
}
function getAums() public view returns (uint256[] memory) {
uint256[] memory amounts = new uint256[](2);
amounts[0] = getAum(true);
amounts[1] = getAum(false);
return amounts;
}
function getAumInUsdg(bool maximise) public override view returns (uint256) {
uint256 aum = getAum(maximise);
return aum.mul(10 ** USDG_DECIMALS).div(PRICE_PRECISION);
}
function getAum(bool maximise) public view returns (uint256) {
uint256 length = vault.allWhitelistedTokensLength();
uint256 aum = aumAddition;
uint256 shortProfits = 0;
IVault _vault = vault;
for (uint256 i = 0; i < length; i++) {
address token = vault.allWhitelistedTokens(i);
bool isWhitelisted = vault.whitelistedTokens(token);
if (!isWhitelisted) {
continue;
}
uint256 price = maximise ? _vault.getMaxPrice(token) : _vault.getMinPrice(token);
uint256 poolAmount = _vault.poolAmounts(token);
uint256 decimals = _vault.tokenDecimals(token);
if (_vault.stableTokens(token)) {
aum = aum.add(poolAmount.mul(price).div(10 ** decimals));
} else {
// add global short profit / loss
uint256 size = _vault.globalShortSizes(token);
if (size > 0) {
(uint256 delta, bool hasProfit) = getGlobalShortDelta(token, price, size);
if (!hasProfit) {
// add losses from shorts
aum = aum.add(delta);
} else {
shortProfits = shortProfits.add(delta);
}
}
aum = aum.add(_vault.guaranteedUsd(token));
uint256 reservedAmount = _vault.reservedAmounts(token);
aum = aum.add(poolAmount.sub(reservedAmount).mul(price).div(10 ** decimals));
}
}
aum = shortProfits > aum ? 0 : aum.sub(shortProfits);
return aumDeduction > aum ? 0 : aum.sub(aumDeduction);
}
function getGlobalShortDelta(address _token, uint256 _price, uint256 _size) public view returns (uint256, bool) {
uint256 averagePrice = getGlobalShortAveragePrice(_token);
uint256 priceDelta = averagePrice > _price ? averagePrice.sub(_price) : _price.sub(averagePrice);
uint256 delta = _size.mul(priceDelta).div(averagePrice);
return (delta, averagePrice > _price);
}
function getGlobalShortAveragePrice(address _token) public view override returns (uint256) {
IShortsTracker _shortsTracker = shortsTracker;
if (address(_shortsTracker) == address(0) || !_shortsTracker.isGlobalShortDataReady()) {
return vault.globalShortAveragePrices(_token);
}
uint256 _shortsTrackerAveragePriceWeight = shortsTrackerAveragePriceWeight;
if (_shortsTrackerAveragePriceWeight == 0) {
return vault.globalShortAveragePrices(_token);
} else if (_shortsTrackerAveragePriceWeight == BASIS_POINTS_DIVISOR) {
return _shortsTracker.globalShortAveragePrices(_token);
}
uint256 vaultAveragePrice = vault.globalShortAveragePrices(_token);
uint256 shortsTrackerAveragePrice = _shortsTracker.globalShortAveragePrices(_token);
return vaultAveragePrice.mul(BASIS_POINTS_DIVISOR.sub(_shortsTrackerAveragePriceWeight))
.add(shortsTrackerAveragePrice.mul(_shortsTrackerAveragePriceWeight))
.div(BASIS_POINTS_DIVISOR);
}
function _updatePythPrices(bytes[] calldata _pythUpdateData) internal {
IPyth pyth = IVault(vault).getPyth();
uint updateFee = pyth.getUpdateFee(_pythUpdateData);
require(msg.value >= updateFee, "insufficient msg.value to update pyth prices");
pyth.updatePriceFeeds{value: updateFee}(_pythUpdateData);
}
function _addLiquidity(address _fundingAccount, address _account, address _token, uint256 _amount, uint256 _minUsdg, uint256 _minGlp) private returns (uint256) {
require(_amount > 0, "GlpManager: invalid _amount");
// calculate aum before buyUSDG
uint256 aumInUsdg = getAumInUsdg(true);
uint256 glpSupply = IERC20(glp).totalSupply();
IERC20(_token).safeTransferFrom(_fundingAccount, address(vault), _amount);
uint256 usdgAmount = vault.buyUSDG(_token, address(this));
require(usdgAmount >= _minUsdg, "GlpManager: insufficient USDG output");
uint256 mintAmount = aumInUsdg == 0 ? usdgAmount : usdgAmount.mul(glpSupply).div(aumInUsdg);
require(mintAmount >= _minGlp, "GlpManager: insufficient GLP output");
IMintable(glp).mint(_account, mintAmount);
lastAddedAt[_account] = block.timestamp;
emit AddLiquidity(_account, _token, _amount, aumInUsdg, glpSupply, usdgAmount, mintAmount);
return mintAmount;
}
function _removeLiquidity(address _account, address _tokenOut, uint256 _glpAmount, uint256 _minOut, address _receiver) private returns (uint256) {
require(_glpAmount > 0, "GlpManager: invalid _glpAmount");
require(lastAddedAt[_account].add(cooldownDuration) <= block.timestamp, "GlpManager: cooldown duration not yet passed");
// calculate aum before sellUSDG
uint256 aumInUsdg = getAumInUsdg(false);
uint256 glpSupply = IERC20(glp).totalSupply();
uint256 usdgAmount = _glpAmount.mul(aumInUsdg).div(glpSupply);
uint256 usdgBalance = IERC20(usdg).balanceOf(address(this));
if (usdgAmount > usdgBalance) {
IUSDG(usdg).mint(address(this), usdgAmount.sub(usdgBalance));
}
IMintable(glp).burn(_account, _glpAmount);
IERC20(usdg).transfer(address(vault), usdgAmount);
uint256 amountOut = vault.sellUSDG(_tokenOut, _receiver);
require(amountOut >= _minOut, "GlpManager: insufficient output");
emit RemoveLiquidity(_account, _tokenOut, _glpAmount, aumInUsdg, glpSupply, usdgAmount, amountOut);
return amountOut;
}
function _validateHandler() private view {
require(isHandler[msg.sender], "GlpManager: forbidden");
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IShortsTracker {
function isGlobalShortDataReady() external view returns (bool);
function globalShortAveragePrices(address _token) external view returns (uint256);
function getNextGlobalShortData(
address _account,
address _collateralToken,
address _indexToken,
uint256 _nextPrice,
uint256 _sizeDelta,
bool _isIncrease
) external view returns (uint256, uint256);
function updateGlobalShortData(
address _account,
address _collateralToken,
address _indexToken,
bool _isLong,
uint256 _sizeDelta,
uint256 _markPrice,
bool _isIncrease
) external;
function setIsGlobalShortDataReady(bool value) external;
function setInitData(address[] calldata _tokens, uint256[] calldata _averagePrices) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
contract Governable {
address public gov;
constructor() public {
gov = msg.sender;
}
modifier onlyGov() {
require(msg.sender == gov, "Governable: forbidden");
_;
}
function setGov(address _gov) external onlyGov {
gov = _gov;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./IVault.sol";
interface IGlpManager {
function glp() external view returns (address);
function usdg() external view returns (address);
function vault() external view returns (IVault);
function cooldownDuration() external returns (uint256);
function getAumInUsdg(bool maximise) external view returns (uint256);
function lastAddedAt(address _account) external returns (uint256);
function addLiquidity(address _token, uint256 _amount, uint256 _minUsdg, uint256 _minGlp, bytes[] calldata _pythUpdateData) external payable returns (uint256);
function addLiquidityForAccount(address _fundingAccount, address _account, address _token, uint256 _amount, uint256 _minUsdg, uint256 _minGlp) external returns (uint256);
function removeLiquidity(address _tokenOut, uint256 _glpAmount, uint256 _minOut, address _receiver, bytes[] calldata _pythUpdateData) external payable returns (uint256);
function removeLiquidityForAccount(address _account, address _tokenOut, uint256 _glpAmount, uint256 _minOut, address _receiver) external returns (uint256);
function setShortsTrackerAveragePriceWeight(uint256 _shortsTrackerAveragePriceWeight) external;
function setCooldownDuration(uint256 _cooldownDuration) external;
function getGlobalShortAveragePrice(address _token) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "../../libraries/pyth/IPyth.sol";
import "./IVaultUtils.sol";
interface IVault {
function isSwapEnabled() external view returns (bool);
function isLeverageEnabled() external view returns (bool);
function setVaultUtils(IVaultUtils _vaultUtils) external;
function setError(uint256 _errorCode, string calldata _error) external;
function router() external view returns (address);
function usdg() external view returns (address);
function gov() external view returns (address);
function whitelistedTokenCount() external view returns (uint256);
function maxLeverage() external view returns (uint256);
function minProfitTime() external view returns (uint256);
function hasDynamicFees() external view returns (bool);
function fundingInterval() external view returns (uint256);
function totalTokenWeights() external view returns (uint256);
function getTargetUsdgAmount(address _token) external view returns (uint256);
function inManagerMode() external view returns (bool);
function inPrivateLiquidationMode() external view returns (bool);
function maxGasPrice() external view returns (uint256);
function approvedRouters(address _account, address _router) external view returns (bool);
function isLiquidator(address _account) external view returns (bool);
function isManager(address _account) external view returns (bool);
function minProfitBasisPoints(address _token) external view returns (uint256);
function tokenBalances(address _token) external view returns (uint256);
function lastFundingTimes(address _token) external view returns (uint256);
function setMaxLeverage(uint256 _maxLeverage) external;
function setInManagerMode(bool _inManagerMode) external;
function setManager(address _manager, bool _isManager) external;
function setIsSwapEnabled(bool _isSwapEnabled) external;
function setIsLeverageEnabled(bool _isLeverageEnabled) external;
function setMaxGasPrice(uint256 _maxGasPrice) external;
function setUsdgAmount(address _token, uint256 _amount) external;
function setBufferAmount(address _token, uint256 _amount) external;
function setMaxGlobalShortSize(address _token, uint256 _amount) external;
function setInPrivateLiquidationMode(bool _inPrivateLiquidationMode) external;
function setLiquidator(address _liquidator, bool _isActive) external;
function setFundingRate(uint256 _fundingInterval, uint256 _fundingRateFactor, uint256 _stableFundingRateFactor) external;
function setFees(
uint256 _taxBasisPoints,
uint256 _stableTaxBasisPoints,
uint256 _mintBurnFeeBasisPoints,
uint256 _swapFeeBasisPoints,
uint256 _stableSwapFeeBasisPoints,
uint256 _marginFeeBasisPoints,
uint256 _liquidationFeeUsd,
uint256 _minProfitTime,
bool _hasDynamicFees
) external;
function setTokenConfig(
address _token,
uint256 _tokenDecimals,
uint256 _redemptionBps,
uint256 _minProfitBps,
uint256 _maxUsdgAmount,
bool _isStable,
bool _isShortable
) external;
function setPriceFeed(address _priceFeed) external;
function withdrawFees(address _token, address _receiver) external returns (uint256);
function directPoolDeposit(address _token) external;
function buyUSDG(address _token, address _receiver) external returns (uint256);
function sellUSDG(address _token, address _receiver) external returns (uint256);
function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256);
function increasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external;
function decreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external returns (uint256);
function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256);
function liquidatePosition(address _account, address _collateralToken, address _indexToken, bool _isLong, address _feeReceiver) external;
function tokenToUsdMin(address _token, uint256 _tokenAmount) external view returns (uint256);
function priceFeed() external view returns (address);
function fundingRateFactor() external view returns (uint256);
function stableFundingRateFactor() external view returns (uint256);
function cumulativeFundingRates(address _token) external view returns (uint256);
function getNextFundingRate(address _token) external view returns (uint256);
function getFeeBasisPoints(address _token, uint256 _usdgDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256);
function liquidationFeeUsd() external view returns (uint256);
function taxBasisPoints() external view returns (uint256);
function stableTaxBasisPoints() external view returns (uint256);
function mintBurnFeeBasisPoints() external view returns (uint256);
function swapFeeBasisPoints() external view returns (uint256);
function stableSwapFeeBasisPoints() external view returns (uint256);
function marginFeeBasisPoints() external view returns (uint256);
function allWhitelistedTokensLength() external view returns (uint256);
function allWhitelistedTokens(uint256) external view returns (address);
function whitelistedTokens(address _token) external view returns (bool);
function stableTokens(address _token) external view returns (bool);
function shortableTokens(address _token) external view returns (bool);
function feeReserves(address _token) external view returns (uint256);
function globalShortSizes(address _token) external view returns (uint256);
function globalShortAveragePrices(address _token) external view returns (uint256);
function maxGlobalShortSizes(address _token) external view returns (uint256);
function tokenDecimals(address _token) external view returns (uint256);
function tokenWeights(address _token) external view returns (uint256);
function guaranteedUsd(address _token) external view returns (uint256);
function poolAmounts(address _token) external view returns (uint256);
function bufferAmounts(address _token) external view returns (uint256);
function reservedAmounts(address _token) external view returns (uint256);
function usdgAmounts(address _token) external view returns (uint256);
function maxUsdgAmounts(address _token) external view returns (uint256);
function getRedemptionAmount(address _token, uint256 _usdgAmount) external view returns (uint256);
function getPyth() external view returns (IPyth);
function getMaxPrice(address _token) external view returns (uint256);
function getMinPrice(address _token) external view returns (uint256);
function getDelta(address _indexToken, uint256 _size, uint256 _averagePrice, bool _isLong, uint256 _lastIncreasedTime) external view returns (bool, uint256);
function getPosition(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, bool, uint256);
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IVaultUtils {
function updateCumulativeFundingRate(address _collateralToken, address _indexToken) external returns (bool);
function validateIncreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external view;
function validateDecreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external view;
function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256);
function getEntryFundingRate(address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256);
function getPositionFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _sizeDelta) external view returns (uint256);
function getFundingFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _size, uint256 _entryFundingRate) external view returns (uint256);
function getBuyUsdgFeeBasisPoints(address _token, uint256 _usdgAmount) external view returns (uint256);
function getSellUsdgFeeBasisPoints(address _token, uint256 _usdgAmount) external view returns (uint256);
function getSwapFeeBasisPoints(address _tokenIn, address _tokenOut, uint256 _usdgAmount) external view returns (uint256);
function getFeeBasisPoints(address _token, uint256 _usdgDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256);
function getDelta(address _indexToken, uint256 _size, uint256 _averagePrice, bool _isLong, uint256 _lastIncreasedTime) external view returns (bool, uint256);
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when 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.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./PythStructs.sol";
import "./IPythEvents.sol";
/// @title Consume prices from the Pyth Network (https://pyth.network/).
/// @dev Please refer to the guidance at https://docs.pyth.network/consumers/best-practices for how to consume prices safely.
/// @author Pyth Data Association
interface IPyth is IPythEvents {
/// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time
function getValidTimePeriod() external view returns (uint validTimePeriod);
/// @notice Returns the price and confidence interval.
/// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds.
/// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval.
/// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
function getPrice(
bytes32 id
) external view returns (PythStructs.Price memory price);
/// @notice Returns the exponentially-weighted moving average price and confidence interval.
/// @dev Reverts if the EMA price is not available.
/// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval.
/// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
function getEmaPrice(
bytes32 id
) external view returns (PythStructs.Price memory price);
/// @notice Returns the price of a price feed without any sanity checks.
/// @dev This function returns the most recent price update in this contract without any recency checks.
/// This function is unsafe as the returned price update may be arbitrarily far in the past.
///
/// Users of this function should check the `publishTime` in the price to ensure that the returned price is
/// sufficiently recent for their application. If you are considering using this function, it may be
/// safer / easier to use either `getPrice` or `getPriceNoOlderThan`.
/// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
function getPriceUnsafe(
bytes32 id
) external view returns (PythStructs.Price memory price);
/// @notice Returns the price that is no older than `age` seconds of the current time.
/// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in
/// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently
/// recently.
/// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
function getPriceNoOlderThan(
bytes32 id,
uint age
) external view returns (PythStructs.Price memory price);
/// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks.
/// @dev This function returns the same price as `getEmaPrice` in the case where the price is available.
/// However, if the price is not recent this function returns the latest available price.
///
/// The returned price can be from arbitrarily far in the past; this function makes no guarantees that
/// the returned price is recent or useful for any particular application.
///
/// Users of this function should check the `publishTime` in the price to ensure that the returned price is
/// sufficiently recent for their application. If you are considering using this function, it may be
/// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`.
/// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
function getEmaPriceUnsafe(
bytes32 id
) external view returns (PythStructs.Price memory price);
/// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds
/// of the current time.
/// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in
/// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently
/// recently.
/// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
function getEmaPriceNoOlderThan(
bytes32 id,
uint age
) external view returns (PythStructs.Price memory price);
/// @notice Update price feeds with given update messages.
/// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
/// `getUpdateFee` with the length of the `updateData` array.
/// Prices will be updated if they are more recent than the current stored prices.
/// The call will succeed even if the update is not the most recent.
/// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid.
/// @param updateData Array of price update data.
function updatePriceFeeds(bytes[] calldata updateData) external payable;
/// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is
/// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the
/// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`.
///
/// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
/// `getUpdateFee` with the length of the `updateData` array.
///
/// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime
/// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have
/// a newer or equal publish time than the given publish time, it will reject the transaction to save gas.
/// Otherwise, it calls updatePriceFeeds method to update the prices.
///
/// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid.
/// @param updateData Array of price update data.
/// @param priceIds Array of price ids.
/// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]`
function updatePriceFeedsIfNecessary(
bytes[] calldata updateData,
bytes32[] calldata priceIds,
uint64[] calldata publishTimes
) external payable;
/// @notice Returns the required fee to update an array of price updates.
/// @param updateData Array of price update data.
/// @return feeAmount The required fee in Wei.
function getUpdateFee(
bytes[] calldata updateData
) external view returns (uint feeAmount);
/// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published
/// within `minPublishTime` and `maxPublishTime`.
///
/// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price;
/// otherwise, please consider using `updatePriceFeeds`. This method does not store the price updates on-chain.
///
/// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
/// `getUpdateFee` with the length of the `updateData` array.
///
///
/// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is
/// no update for any of the given `priceIds` within the given time range.
/// @param updateData Array of price update data.
/// @param priceIds Array of price ids.
/// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.
/// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.
/// @return feeds Array of the price feeds corresponding to the given `priceIds` (with the same order).
function parsePriceFeedUpdates(
bytes[] calldata updateData,
bytes32[] calldata priceIds,
uint64 minPublishTime,
uint64 maxPublishTime
) external payable returns (PythStructs.PriceFeed[] memory feeds);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.6.12;
/// @title IPythEvents contains the events that Pyth contract emits.
/// @dev This interface can be used for listening to the updates for off-chain and testing purposes.
interface IPythEvents {
/// @dev Emitted when the price feed with `id` has received a fresh update.
/// @param id The Pyth Price Feed ID.
/// @param publishTime Publish time of the given price update.
/// @param price Price of the given price update.
/// @param conf Confidence interval of the given price update.
event PriceFeedUpdate(
bytes32 indexed id,
uint64 publishTime,
int64 price,
uint64 conf
);
/// @dev Emitted when a batch price update is processed successfully.
/// @param chainId ID of the source chain that the batch price update comes from.
/// @param sequenceNumber Sequence number of the batch price update.
event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.6.12;
contract PythStructs {
// A price with a degree of uncertainty, represented as a price +- a confidence interval.
//
// The confidence interval roughly corresponds to the standard error of a normal distribution.
// Both the price and confidence are stored in a fixed-point numeric representation,
// `x * (10^expo)`, where `expo` is the exponent.
//
// Please refer to the documentation at https://docs.pyth.network/consumers/best-practices for how
// to how this price safely.
struct Price {
// Price
int64 price;
// Confidence interval around the price
uint64 conf;
// Price exponent
int32 expo;
// Unix timestamp describing when the price was published
uint publishTime;
}
// PriceFeed represents a current aggregate price from pyth publisher feeds.
struct PriceFeed {
// The price ID.
bytes32 id;
// Latest available price
Price price;
// Latest available exponentially-weighted moving average price
Price emaPrice;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @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.6.12;
import "./IERC20.sol";
import "../math/SafeMath.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 SafeMath for uint256;
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'
// solhint-disable-next-line max-line-length
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).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_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
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @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;
// solhint-disable-next-line no-inline-assembly
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");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(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.3._
*/
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.3._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @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].
*/
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 () internal {
_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.6.12;
interface IMintable {
function isMinter(address _account) external returns (bool);
function setMinter(address _minter, bool _isActive) external;
function mint(address _account, uint256 _amount) external;
function burn(address _account, uint256 _amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IUSDG {
function addVault(address _vault) external;
function removeVault(address _vault) external;
function mint(address _account, uint256 _amount) external;
function burn(address _account, uint256 _amount) external;
}{
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"enabled": true,
"runs": 10
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": [
"@ensdomains/=node_modules/@ensdomains/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@uniswap/=node_modules/@uniswap/",
"base64-sol/=node_modules/base64-sol/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"hardhat-deploy/=node_modules/hardhat-deploy/",
"hardhat/=node_modules/hardhat/"
]
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_usdg","type":"address"},{"internalType":"address","name":"_glp","type":"address"},{"internalType":"address","name":"_shortsTracker","type":"address"},{"internalType":"uint256","name":"_cooldownDuration","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"aumInUsdg","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"glpSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usdgAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"AddLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"glpAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"aumInUsdg","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"glpSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usdgAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"RemoveLiquidity","type":"event"},{"inputs":[],"name":"BASIS_POINTS_DIVISOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GLP_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_COOLDOWN_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDG_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minUsdg","type":"uint256"},{"internalType":"uint256","name":"_minGlp","type":"uint256"},{"internalType":"bytes[]","name":"_pythUpdateData","type":"bytes[]"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_fundingAccount","type":"address"},{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minUsdg","type":"uint256"},{"internalType":"uint256","name":"_minGlp","type":"uint256"}],"name":"addLiquidityForAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"aumAddition","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aumDeduction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cooldownDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"maximise","type":"bool"}],"name":"getAum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"maximise","type":"bool"}],"name":"getAumInUsdg","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAums","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getGlobalShortAveragePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"getGlobalShortDelta","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_maximise","type":"bool"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"glp","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inPrivateMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isHandler","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastAddedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenOut","type":"address"},{"internalType":"uint256","name":"_glpAmount","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"bytes[]","name":"_pythUpdateData","type":"bytes[]"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"},{"internalType":"uint256","name":"_glpAmount","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"removeLiquidityForAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_aumAddition","type":"uint256"},{"internalType":"uint256","name":"_aumDeduction","type":"uint256"}],"name":"setAumAdjustment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cooldownDuration","type":"uint256"}],"name":"setCooldownDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gov","type":"address"}],"name":"setGov","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_handler","type":"address"},{"internalType":"bool","name":"_isActive","type":"bool"}],"name":"setHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_inPrivateMode","type":"bool"}],"name":"setInPrivateMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IShortsTracker","name":"_shortsTracker","type":"address"}],"name":"setShortsTracker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shortsTrackerAveragePriceWeight","type":"uint256"}],"name":"setShortsTrackerAveragePriceWeight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shortsTracker","outputs":[{"internalType":"contract IShortsTracker","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"shortsTrackerAveragePriceWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdg","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
0x60806040523480156200001157600080fd5b5060405162002b2538038062002b2583398101604081905262000034916200009e565b600160008190558054336001600160a01b031991821681178216179091556002805482166001600160a01b0397881617905560048054821695871695909517909455600580548516938616939093179092556003805490931693169290921790556006556200012a565b600080600080600060a08688031215620000b6578081fd5b8551620000c38162000111565b6020870151909550620000d68162000111565b6040870151909450620000e98162000111565b6060870151909350620000fc8162000111565b80925050608086015190509295509295909350565b6001600160a01b03811681146200012757600080fd5b50565b6129eb806200013a6000396000f3fe6080604052600436106101895760003560e01c8063033914761461018e578063070eacee146101c4578063126082cf146101e657806312d43a51146101fb57806317eb2a151461021d578063196b68cb1461023d5780631e9049cf146102525780633526931514610267578063440d828a1461027c57806346ea87af1461029c5780634f5f6b5e146102bc57806364e6617f146102de578063657bc5d0146102f3578063662f1c681461030857806368a0a3e01461031d5780636a86da191461033d57806371d597ad1461035d57806378a207ee1461037d578063870d917c146103925780638b770e11146103a75780639116c4ae146103c757806395082d25146103e7578063966be075146103fc5780639cb7de4b1461041c578063a1acd3d51461043c578063a9f1e0201461046a578063b172bb0c1461047d578063cd00927514610492578063cfad57a2146104a5578063d34ee093146104c5578063e245b5af146104e5578063ed0d1c0414610505578063f5b91b7b14610527578063fbfa77cf1461053c575b600080fd5b34801561019a57600080fd5b506101ae6101a93660046122bd565b610551565b6040516101bb919061294a565b60405180910390f35b3480156101d057600080fd5b506101d9610c08565b6040516101bb919061250e565b3480156101f257600080fd5b506101ae610c11565b34801561020757600080fd5b50610210610c17565b6040516101bb919061238c565b34801561022957600080fd5b506101ae6102383660046120c4565b610c26565b34801561024957600080fd5b506101ae610c7f565b34801561025e57600080fd5b506101ae610c85565b34801561027357600080fd5b506101ae610c8c565b34801561028857600080fd5b506101ae61029736600461208c565b610c92565b3480156102a857600080fd5b506101d96102b736600461208c565b610fa2565b3480156102c857600080fd5b506102dc6102d73660046122f5565b610fb7565b005b3480156102ea57600080fd5b506101ae61100a565b3480156102ff57600080fd5b50610210611010565b34801561031457600080fd5b506101ae61101f565b34801561032957600080fd5b506101ae6103383660046122bd565b61102b565b34801561034957600080fd5b506102dc6103583660046122bd565b611062565b34801561036957600080fd5b506101ae610378366004612128565b61109f565b34801561038957600080fd5b506102106110ed565b34801561039e57600080fd5b506101ae6110fc565b3480156103b357600080fd5b506101ae6103c236600461208c565b611101565b3480156103d357600080fd5b506102dc6103e2366004612325565b611113565b3480156103f357600080fd5b506101ae611148565b34801561040857600080fd5b506102dc6104173660046122f5565b611158565b34801561042857600080fd5b506102dc610437366004612186565b6111aa565b34801561044857600080fd5b5061045c6104573660046121be565b6111ff565b6040516101bb929190612953565b6101ae61047836600461226b565b611253565b34801561048957600080fd5b506101ae6112b8565b6101ae6104a03660046121f2565b6112be565b3480156104b157600080fd5b506102dc6104c036600461208c565b611322565b3480156104d157600080fd5b506102dc6104e036600461208c565b61136e565b3480156104f157600080fd5b506101ae6105003660046122bd565b6113ba565b34801561051157600080fd5b5061051a611470565b6040516101bb91906124ca565b34801561053357600080fd5b506102106114de565b34801561054857600080fd5b506102106114ed565b600080600260009054906101000a90046001600160a01b03166001600160a01b0316630842b0766040518163ffffffff1660e01b815260040160206040518083038186803b1580156105a257600080fd5b505afa1580156105b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105da919061230d565b600854600254919250906000906001600160a01b0316815b84811015610bc157600254604051630e468baf60e41b81526000916001600160a01b03169063e468baf09061062b90859060040161294a565b60206040518083038186803b15801561064357600080fd5b505afa158015610657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067b91906120a8565b600254604051630daf9c2160e41b81529192506000916001600160a01b039091169063daf9c210906106b190859060040161238c565b60206040518083038186803b1580156106c957600080fd5b505afa1580156106dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070191906122d9565b90508061070f575050610bb9565b600089610797576040516340d3096b60e11b81526001600160a01b038616906381a612d69061074290869060040161238c565b60206040518083038186803b15801561075a57600080fd5b505afa15801561076e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610792919061230d565b610813565b604051637092736960e11b81526001600160a01b0386169063e124e6d2906107c390869060040161238c565b60206040518083038186803b1580156107db57600080fd5b505afa1580156107ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610813919061230d565b90506000856001600160a01b03166352f55eed856040518263ffffffff1660e01b8152600401610843919061238c565b60206040518083038186803b15801561085b57600080fd5b505afa15801561086f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610893919061230d565b90506000866001600160a01b0316638ee573ac866040518263ffffffff1660e01b81526004016108c3919061238c565b60206040518083038186803b1580156108db57600080fd5b505afa1580156108ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610913919061230d565b6040516342b60b0360e01b81529091506001600160a01b038816906342b60b039061094290889060040161238c565b60206040518083038186803b15801561095a57600080fd5b505afa15801561096e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099291906122d9565b156109c0576109b96109b2600a83900a6109ac85876114fc565b9061153f565b8a9061157e565b9850610bb3565b60405163114f1b5560e31b81526000906001600160a01b03891690638a78daa8906109ef90899060040161238c565b60206040518083038186803b158015610a0757600080fd5b505afa158015610a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3f919061230d565b90508015610a7f57600080610a558887856111ff565b9150915080610a6f57610a688c8361157e565b9b50610a7c565b610a798b8361157e565b9a505b50505b60405163783a2b6760e11b8152610b06906001600160a01b038a169063f07456ce90610aaf908a9060040161238c565b60206040518083038186803b158015610ac757600080fd5b505afa158015610adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aff919061230d565b8b9061157e565b99506000886001600160a01b031663c3c7b9e9886040518263ffffffff1660e01b8152600401610b36919061238c565b60206040518083038186803b158015610b4e57600080fd5b505afa158015610b62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b86919061230d565b9050610bae610ba7600a85900a6109ac88610ba189876115a3565b906114fc565b8c9061157e565b9a5050505b50505050505b6001016105f2565b50828211610bd857610bd383836115a3565b610bdb565b60005b92508260095411610bf957600954610bf49084906115a3565b610bfc565b60005b9450505050505b919050565b600a5460ff1681565b61271081565b6001546001600160a01b031681565b600060026000541415610c545760405162461bcd60e51b8152600401610c4b906128dc565b60405180910390fd5b6002600055610c616115e5565b610c6f878787878787611616565b6001600055979650505050505050565b60085481565b6202a30081565b60065481565b6003546000906001600160a01b0316801580610d1c5750806001600160a01b0316639a11178f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ce257600080fd5b505afa158015610cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1a91906122d9565b155b15610da957600254604051636274980360e01b81526001600160a01b0390911690636274980390610d5190869060040161238c565b60206040518083038186803b158015610d6957600080fd5b505afa158015610d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da1919061230d565b915050610c03565b600b5480610e3a57600254604051636274980360e01b81526001600160a01b0390911690636274980390610de190879060040161238c565b60206040518083038186803b158015610df957600080fd5b505afa158015610e0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e31919061230d565b92505050610c03565b612710811415610e7057604051636274980360e01b81526001600160a01b03831690636274980390610de190879060040161238c565b600254604051636274980360e01b81526000916001600160a01b031690636274980390610ea190889060040161238c565b60206040518083038186803b158015610eb957600080fd5b505afa158015610ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef1919061230d565b90506000836001600160a01b03166362749803876040518263ffffffff1660e01b8152600401610f21919061238c565b60206040518083038186803b158015610f3957600080fd5b505afa158015610f4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f71919061230d565b9050610bfc6127106109ac610f8684876114fc565b610f9c610f95612710896115a3565b87906114fc565b9061157e565b600c6020526000908152604090205460ff1681565b6001546001600160a01b03163314610fe15760405162461bcd60e51b8152600401610c4b90612641565b612710600b5411156110055760405162461bcd60e51b8152600401610c4b906127e5565b600b55565b600b5481565b6003546001600160a01b031681565b670de0b6b3a764000081565b60008061103783610551565b905061105b68327cb2734119d3b7a9601e1b6109ac83670de0b6b3a76400006114fc565b9392505050565b6001546001600160a01b0316331461108c5760405162461bcd60e51b8152600401610c4b90612641565b600a805460ff1916911515919091179055565b6000600260005414156110c45760405162461bcd60e51b8152600401610c4b906128dc565b60026000556110d16115e5565b6110de86868686866118a3565b60016000559695505050505050565b6005546001600160a01b031681565b601281565b60076020526000908152604090205481565b6001546001600160a01b0316331461113d5760405162461bcd60e51b8152600401610c4b90612641565b600891909155600955565b68327cb2734119d3b7a9601e1b81565b6001546001600160a01b031633146111825760405162461bcd60e51b8152600401610c4b90612641565b6202a3008111156111a55760405162461bcd60e51b8152600401610c4b9061254c565b600655565b6001546001600160a01b031633146111d45760405162461bcd60e51b8152600401610c4b90612641565b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b600080600061120d86610c92565b905060008582116112275761122286836115a3565b611231565b61123182876115a3565b90506000611243836109ac88856114fc565b9450505084109050935093915050565b6000600260005414156112785760405162461bcd60e51b8152600401610c4b906128dc565b6002600055600a5460ff16156112a05760405162461bcd60e51b8152600401610c4b906126e8565b6112aa8383611c7d565b610c6f333389898989611616565b60095481565b6000600260005414156112e35760405162461bcd60e51b8152600401610c4b906128dc565b6002600055600a5460ff161561130b5760405162461bcd60e51b8152600401610c4b906126e8565b6113158383611c7d565b610c6f33888888886118a3565b6001546001600160a01b0316331461134c5760405162461bcd60e51b8152600401610c4b90612641565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146113985760405162461bcd60e51b8152600401610c4b90612641565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000806113c683610551565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561141857600080fd5b505afa15801561142c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611450919061230d565b9050611468816109ac84670de0b6b3a76400006114fc565b949350505050565b60408051600280825260608083018452928392919060208301908036833701905050905061149e6001610551565b816000815181106114ab57fe5b6020026020010181815250506114c16000610551565b816001815181106114ce57fe5b6020908102919091010152905090565b6004546001600160a01b031681565b6002546001600160a01b031681565b60008261150b57506000611539565b8282028284828161151857fe5b04146115365760405162461bcd60e51b8152600401610c4b90612670565b90505b92915050565b600061153683836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250611e06565b6000828201838110156115365760405162461bcd60e51b8152600401610c4b90612591565b600061153683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e3d565b336000908152600c602052604090205460ff166116145760405162461bcd60e51b8152600401610c4b906125c6565b565b60008084116116375760405162461bcd60e51b8152600401610c4b90612819565b6000611643600161102b565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561169557600080fd5b505afa1580156116a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116cd919061230d565b6002549091506116ec906001600160a01b03898116918c911689611e69565b60025460405163817bb85760e01b81526000916001600160a01b03169063817bb8579061171f908b9030906004016123a0565b602060405180830381600087803b15801561173957600080fd5b505af115801561174d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611771919061230d565b9050858110156117935760405162461bcd60e51b8152600401610c4b9061284e565b600083156117ae576117a9846109ac84866114fc565b6117b0565b815b9050858110156117d25760405162461bcd60e51b8152600401610c4b9061271f565b6005546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990611804908d90859060040161241c565b600060405180830381600087803b15801561181e57600080fd5b505af1158015611832573d6000803e3d6000fd5b5050506001600160a01b038b1660009081526007602052604090819020429055517f38dc38b96482be64113daffd8d464ebda93e856b70ccfc605e69ccf892ab981e915061188d908c908c908c9089908990899089906123de565b60405180910390a19a9950505050505050505050565b60008084116118c45760405162461bcd60e51b8152600401610c4b90612913565b6006546001600160a01b03871660009081526007602052604090205442916118ec919061157e565b111561190a5760405162461bcd60e51b8152600401610c4b906125f5565b6000611916600061102b565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561196857600080fd5b505afa15801561197c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a0919061230d565b905060006119b2826109ac89866114fc565b600480546040516370a0823160e01b81529293506000926001600160a01b03909116916370a08231916119e79130910161238c565b60206040518083038186803b1580156119ff57600080fd5b505afa158015611a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a37919061230d565b905080821115611aad576004546001600160a01b03166340c10f1930611a5d85856115a3565b6040518363ffffffff1660e01b8152600401611a7a92919061241c565b600060405180830381600087803b158015611a9457600080fd5b505af1158015611aa8573d6000803e3d6000fd5b505050505b600554604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90611adf908d908c9060040161241c565b600060405180830381600087803b158015611af957600080fd5b505af1158015611b0d573d6000803e3d6000fd5b50506004805460025460405163a9059cbb60e01b81526001600160a01b03928316955063a9059cbb9450611b4893919092169187910161241c565b602060405180830381600087803b158015611b6257600080fd5b505af1158015611b76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9a91906122d9565b50600254604051630711e61960e41b81526000916001600160a01b03169063711e619090611bce908d908b906004016123a0565b602060405180830381600087803b158015611be857600080fd5b505af1158015611bfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c20919061230d565b905087811015611c425760405162461bcd60e51b8152600401610c4b906126b1565b7f87b9679bb9a4944bafa98c267e7cd4a00ab29fed48afdefae25f0fca5da279408b8b8b8888888760405161188d97969594939291906123de565b600254604080516378399b0b60e01b815290516000926001600160a01b0316916378399b0b916004808301926020929190829003018186803b158015611cc257600080fd5b505afa158015611cd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfa91906120a8565b90506000816001600160a01b031663d47eed4585856040518363ffffffff1660e01b8152600401611d2c929190612435565b60206040518083038186803b158015611d4457600080fd5b505afa158015611d58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7c919061230d565b905080341015611d9e5760405162461bcd60e51b8152600401610c4b90612762565b604051631df3cbc560e31b81526001600160a01b0383169063ef9e5e28908390611dce9088908890600401612435565b6000604051808303818588803b158015611de757600080fd5b505af1158015611dfb573d6000803e3d6000fd5b505050505050505050565b60008183611e275760405162461bcd60e51b8152600401610c4b9190612519565b506000838581611e3357fe5b0495945050505050565b60008184841115611e615760405162461bcd60e51b8152600401610c4b9190612519565b505050900390565b611ec1846323b872dd60e01b858585604051602401611e8a939291906123ba565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611ec7565b50505050565b6060611f1c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611f5b9092919063ffffffff16565b805190915015611f565780806020019051810190611f3a91906122d9565b611f565760405162461bcd60e51b8152600401610c4b90612892565b505050565b6060611468848460008585611f6f85612005565b611f8b5760405162461bcd60e51b8152600401610c4b906127ae565b60006060866001600160a01b03168587604051611fa89190612370565b60006040518083038185875af1925050503d8060008114611fe5576040519150601f19603f3d011682016040523d82523d6000602084013e611fea565b606091505b5091509150611ffa82828661200b565b979650505050505050565b3b151590565b6060831561201a57508161105b565b82511561202a5782518084602001fd5b8160405162461bcd60e51b8152600401610c4b9190612519565b60008083601f840112612055578182fd5b5081356001600160401b0381111561206b578182fd5b602083019150836020808302850101111561208557600080fd5b9250929050565b60006020828403121561209d578081fd5b81356115368161298f565b6000602082840312156120b9578081fd5b81516115368161298f565b60008060008060008060c087890312156120dc578182fd5b86356120e78161298f565b955060208701356120f78161298f565b945060408701356121078161298f565b959894975094956060810135955060808101359460a0909101359350915050565b600080600080600060a0868803121561213f578081fd5b853561214a8161298f565b9450602086013561215a8161298f565b9350604086013592506060860135915060808601356121788161298f565b809150509295509295909350565b60008060408385031215612198578182fd5b82356121a38161298f565b915060208301356121b3816129a7565b809150509250929050565b6000806000606084860312156121d2578283fd5b83356121dd8161298f565b95602085013595506040909401359392505050565b60008060008060008060a0878903121561220a578182fd5b86356122158161298f565b9550602087013594506040870135935060608701356122338161298f565b925060808701356001600160401b0381111561224d578283fd5b61225989828a01612044565b979a9699509497509295939492505050565b60008060008060008060a08789031215612283578182fd5b863561228e8161298f565b955060208701359450604087013593506060870135925060808701356001600160401b0381111561224d578283fd5b6000602082840312156122ce578081fd5b8135611536816129a7565b6000602082840312156122ea578081fd5b8151611536816129a7565b600060208284031215612306578081fd5b5035919050565b60006020828403121561231e578081fd5b5051919050565b60008060408385031215612337578182fd5b50508035926020909101359150565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008251612382818460208701612963565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03978816815295909616602086015260408501939093526060840191909152608083015260a082015260c081019190915260e00190565b6001600160a01b03929092168252602082015260400190565b602080825281810183905260009060408482028401810190840186845b878110156124bd57868403603f190183528135368a9003601e19018112612477578687fd5b890180356001600160401b0381111561248e578788fd5b8036038b131561249c578788fd5b6124a98682898501612346565b955050509184019190840190600101612452565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612502578351835292840192918401916001016124e6565b50909695505050505050565b901515815260200190565b6000602082528251806020840152612538816040850160208701612963565b601f01601f19169190910160400192915050565b60208082526025908201527f476c704d616e616765723a20696e76616c6964205f636f6f6c646f776e44757260408201526430ba34b7b760d91b606082015260800190565b6020808252601b908201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604082015260600190565b60208082526015908201527423b63826b0b730b3b2b91d103337b93134b23232b760591b604082015260600190565b6020808252602c908201527f476c704d616e616765723a20636f6f6c646f776e206475726174696f6e206e6f60408201526b1d081e595d081c185cdcd95960a21b606082015260800190565b60208082526015908201527423b7bb32b93730b136329d103337b93134b23232b760591b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252601f908201527f476c704d616e616765723a20696e73756666696369656e74206f757470757400604082015260600190565b6020808252601e908201527f476c704d616e616765723a20616374696f6e206e6f7420656e61626c65640000604082015260600190565b60208082526023908201527f476c704d616e616765723a20696e73756666696369656e7420474c50206f75746040820152621c1d5d60ea1b606082015260800190565b6020808252602c908201527f696e73756666696369656e74206d73672e76616c756520746f2075706461746560408201526b20707974682070726963657360a01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601a908201527911db1c13585b9859d95c8e881a5b9d985b1a59081dd95a59da1d60321b604082015260600190565b6020808252601b908201527a11db1c13585b9859d95c8e881a5b9d985b1a590817d85b5bdd5b9d602a1b604082015260600190565b60208082526024908201527f476c704d616e616765723a20696e73756666696369656e742055534447206f756040820152631d1c1d5d60e21b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601e908201527f476c704d616e616765723a20696e76616c6964205f676c70416d6f756e740000604082015260600190565b90815260200190565b9182521515602082015260400190565b60005b8381101561297e578181015183820152602001612966565b83811115611ec15750506000910152565b6001600160a01b03811681146129a457600080fd5b50565b80151581146129a457600080fdfea26469706673582212202c08f2723326f393c6d8d998d697f455d140a65a81be802100bc726c9771925864736f6c634300060c003300000000000000000000000073a540bec4350cd2bb3b9e09ebb6976a3c562c5500000000000000000000000078c28aed0294e0400db4df442af65b627cc34db2000000000000000000000000142d30b637356f4cbfe9bca18888cb99dccdd0480000000000000000000000001f98dff9907eb5c7bc94f9f67c31bd39f0eaf7320000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106101895760003560e01c8063033914761461018e578063070eacee146101c4578063126082cf146101e657806312d43a51146101fb57806317eb2a151461021d578063196b68cb1461023d5780631e9049cf146102525780633526931514610267578063440d828a1461027c57806346ea87af1461029c5780634f5f6b5e146102bc57806364e6617f146102de578063657bc5d0146102f3578063662f1c681461030857806368a0a3e01461031d5780636a86da191461033d57806371d597ad1461035d57806378a207ee1461037d578063870d917c146103925780638b770e11146103a75780639116c4ae146103c757806395082d25146103e7578063966be075146103fc5780639cb7de4b1461041c578063a1acd3d51461043c578063a9f1e0201461046a578063b172bb0c1461047d578063cd00927514610492578063cfad57a2146104a5578063d34ee093146104c5578063e245b5af146104e5578063ed0d1c0414610505578063f5b91b7b14610527578063fbfa77cf1461053c575b600080fd5b34801561019a57600080fd5b506101ae6101a93660046122bd565b610551565b6040516101bb919061294a565b60405180910390f35b3480156101d057600080fd5b506101d9610c08565b6040516101bb919061250e565b3480156101f257600080fd5b506101ae610c11565b34801561020757600080fd5b50610210610c17565b6040516101bb919061238c565b34801561022957600080fd5b506101ae6102383660046120c4565b610c26565b34801561024957600080fd5b506101ae610c7f565b34801561025e57600080fd5b506101ae610c85565b34801561027357600080fd5b506101ae610c8c565b34801561028857600080fd5b506101ae61029736600461208c565b610c92565b3480156102a857600080fd5b506101d96102b736600461208c565b610fa2565b3480156102c857600080fd5b506102dc6102d73660046122f5565b610fb7565b005b3480156102ea57600080fd5b506101ae61100a565b3480156102ff57600080fd5b50610210611010565b34801561031457600080fd5b506101ae61101f565b34801561032957600080fd5b506101ae6103383660046122bd565b61102b565b34801561034957600080fd5b506102dc6103583660046122bd565b611062565b34801561036957600080fd5b506101ae610378366004612128565b61109f565b34801561038957600080fd5b506102106110ed565b34801561039e57600080fd5b506101ae6110fc565b3480156103b357600080fd5b506101ae6103c236600461208c565b611101565b3480156103d357600080fd5b506102dc6103e2366004612325565b611113565b3480156103f357600080fd5b506101ae611148565b34801561040857600080fd5b506102dc6104173660046122f5565b611158565b34801561042857600080fd5b506102dc610437366004612186565b6111aa565b34801561044857600080fd5b5061045c6104573660046121be565b6111ff565b6040516101bb929190612953565b6101ae61047836600461226b565b611253565b34801561048957600080fd5b506101ae6112b8565b6101ae6104a03660046121f2565b6112be565b3480156104b157600080fd5b506102dc6104c036600461208c565b611322565b3480156104d157600080fd5b506102dc6104e036600461208c565b61136e565b3480156104f157600080fd5b506101ae6105003660046122bd565b6113ba565b34801561051157600080fd5b5061051a611470565b6040516101bb91906124ca565b34801561053357600080fd5b506102106114de565b34801561054857600080fd5b506102106114ed565b600080600260009054906101000a90046001600160a01b03166001600160a01b0316630842b0766040518163ffffffff1660e01b815260040160206040518083038186803b1580156105a257600080fd5b505afa1580156105b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105da919061230d565b600854600254919250906000906001600160a01b0316815b84811015610bc157600254604051630e468baf60e41b81526000916001600160a01b03169063e468baf09061062b90859060040161294a565b60206040518083038186803b15801561064357600080fd5b505afa158015610657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067b91906120a8565b600254604051630daf9c2160e41b81529192506000916001600160a01b039091169063daf9c210906106b190859060040161238c565b60206040518083038186803b1580156106c957600080fd5b505afa1580156106dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070191906122d9565b90508061070f575050610bb9565b600089610797576040516340d3096b60e11b81526001600160a01b038616906381a612d69061074290869060040161238c565b60206040518083038186803b15801561075a57600080fd5b505afa15801561076e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610792919061230d565b610813565b604051637092736960e11b81526001600160a01b0386169063e124e6d2906107c390869060040161238c565b60206040518083038186803b1580156107db57600080fd5b505afa1580156107ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610813919061230d565b90506000856001600160a01b03166352f55eed856040518263ffffffff1660e01b8152600401610843919061238c565b60206040518083038186803b15801561085b57600080fd5b505afa15801561086f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610893919061230d565b90506000866001600160a01b0316638ee573ac866040518263ffffffff1660e01b81526004016108c3919061238c565b60206040518083038186803b1580156108db57600080fd5b505afa1580156108ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610913919061230d565b6040516342b60b0360e01b81529091506001600160a01b038816906342b60b039061094290889060040161238c565b60206040518083038186803b15801561095a57600080fd5b505afa15801561096e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099291906122d9565b156109c0576109b96109b2600a83900a6109ac85876114fc565b9061153f565b8a9061157e565b9850610bb3565b60405163114f1b5560e31b81526000906001600160a01b03891690638a78daa8906109ef90899060040161238c565b60206040518083038186803b158015610a0757600080fd5b505afa158015610a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3f919061230d565b90508015610a7f57600080610a558887856111ff565b9150915080610a6f57610a688c8361157e565b9b50610a7c565b610a798b8361157e565b9a505b50505b60405163783a2b6760e11b8152610b06906001600160a01b038a169063f07456ce90610aaf908a9060040161238c565b60206040518083038186803b158015610ac757600080fd5b505afa158015610adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aff919061230d565b8b9061157e565b99506000886001600160a01b031663c3c7b9e9886040518263ffffffff1660e01b8152600401610b36919061238c565b60206040518083038186803b158015610b4e57600080fd5b505afa158015610b62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b86919061230d565b9050610bae610ba7600a85900a6109ac88610ba189876115a3565b906114fc565b8c9061157e565b9a5050505b50505050505b6001016105f2565b50828211610bd857610bd383836115a3565b610bdb565b60005b92508260095411610bf957600954610bf49084906115a3565b610bfc565b60005b9450505050505b919050565b600a5460ff1681565b61271081565b6001546001600160a01b031681565b600060026000541415610c545760405162461bcd60e51b8152600401610c4b906128dc565b60405180910390fd5b6002600055610c616115e5565b610c6f878787878787611616565b6001600055979650505050505050565b60085481565b6202a30081565b60065481565b6003546000906001600160a01b0316801580610d1c5750806001600160a01b0316639a11178f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ce257600080fd5b505afa158015610cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1a91906122d9565b155b15610da957600254604051636274980360e01b81526001600160a01b0390911690636274980390610d5190869060040161238c565b60206040518083038186803b158015610d6957600080fd5b505afa158015610d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da1919061230d565b915050610c03565b600b5480610e3a57600254604051636274980360e01b81526001600160a01b0390911690636274980390610de190879060040161238c565b60206040518083038186803b158015610df957600080fd5b505afa158015610e0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e31919061230d565b92505050610c03565b612710811415610e7057604051636274980360e01b81526001600160a01b03831690636274980390610de190879060040161238c565b600254604051636274980360e01b81526000916001600160a01b031690636274980390610ea190889060040161238c565b60206040518083038186803b158015610eb957600080fd5b505afa158015610ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef1919061230d565b90506000836001600160a01b03166362749803876040518263ffffffff1660e01b8152600401610f21919061238c565b60206040518083038186803b158015610f3957600080fd5b505afa158015610f4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f71919061230d565b9050610bfc6127106109ac610f8684876114fc565b610f9c610f95612710896115a3565b87906114fc565b9061157e565b600c6020526000908152604090205460ff1681565b6001546001600160a01b03163314610fe15760405162461bcd60e51b8152600401610c4b90612641565b612710600b5411156110055760405162461bcd60e51b8152600401610c4b906127e5565b600b55565b600b5481565b6003546001600160a01b031681565b670de0b6b3a764000081565b60008061103783610551565b905061105b68327cb2734119d3b7a9601e1b6109ac83670de0b6b3a76400006114fc565b9392505050565b6001546001600160a01b0316331461108c5760405162461bcd60e51b8152600401610c4b90612641565b600a805460ff1916911515919091179055565b6000600260005414156110c45760405162461bcd60e51b8152600401610c4b906128dc565b60026000556110d16115e5565b6110de86868686866118a3565b60016000559695505050505050565b6005546001600160a01b031681565b601281565b60076020526000908152604090205481565b6001546001600160a01b0316331461113d5760405162461bcd60e51b8152600401610c4b90612641565b600891909155600955565b68327cb2734119d3b7a9601e1b81565b6001546001600160a01b031633146111825760405162461bcd60e51b8152600401610c4b90612641565b6202a3008111156111a55760405162461bcd60e51b8152600401610c4b9061254c565b600655565b6001546001600160a01b031633146111d45760405162461bcd60e51b8152600401610c4b90612641565b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b600080600061120d86610c92565b905060008582116112275761122286836115a3565b611231565b61123182876115a3565b90506000611243836109ac88856114fc565b9450505084109050935093915050565b6000600260005414156112785760405162461bcd60e51b8152600401610c4b906128dc565b6002600055600a5460ff16156112a05760405162461bcd60e51b8152600401610c4b906126e8565b6112aa8383611c7d565b610c6f333389898989611616565b60095481565b6000600260005414156112e35760405162461bcd60e51b8152600401610c4b906128dc565b6002600055600a5460ff161561130b5760405162461bcd60e51b8152600401610c4b906126e8565b6113158383611c7d565b610c6f33888888886118a3565b6001546001600160a01b0316331461134c5760405162461bcd60e51b8152600401610c4b90612641565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146113985760405162461bcd60e51b8152600401610c4b90612641565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000806113c683610551565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561141857600080fd5b505afa15801561142c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611450919061230d565b9050611468816109ac84670de0b6b3a76400006114fc565b949350505050565b60408051600280825260608083018452928392919060208301908036833701905050905061149e6001610551565b816000815181106114ab57fe5b6020026020010181815250506114c16000610551565b816001815181106114ce57fe5b6020908102919091010152905090565b6004546001600160a01b031681565b6002546001600160a01b031681565b60008261150b57506000611539565b8282028284828161151857fe5b04146115365760405162461bcd60e51b8152600401610c4b90612670565b90505b92915050565b600061153683836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250611e06565b6000828201838110156115365760405162461bcd60e51b8152600401610c4b90612591565b600061153683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e3d565b336000908152600c602052604090205460ff166116145760405162461bcd60e51b8152600401610c4b906125c6565b565b60008084116116375760405162461bcd60e51b8152600401610c4b90612819565b6000611643600161102b565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561169557600080fd5b505afa1580156116a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116cd919061230d565b6002549091506116ec906001600160a01b03898116918c911689611e69565b60025460405163817bb85760e01b81526000916001600160a01b03169063817bb8579061171f908b9030906004016123a0565b602060405180830381600087803b15801561173957600080fd5b505af115801561174d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611771919061230d565b9050858110156117935760405162461bcd60e51b8152600401610c4b9061284e565b600083156117ae576117a9846109ac84866114fc565b6117b0565b815b9050858110156117d25760405162461bcd60e51b8152600401610c4b9061271f565b6005546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990611804908d90859060040161241c565b600060405180830381600087803b15801561181e57600080fd5b505af1158015611832573d6000803e3d6000fd5b5050506001600160a01b038b1660009081526007602052604090819020429055517f38dc38b96482be64113daffd8d464ebda93e856b70ccfc605e69ccf892ab981e915061188d908c908c908c9089908990899089906123de565b60405180910390a19a9950505050505050505050565b60008084116118c45760405162461bcd60e51b8152600401610c4b90612913565b6006546001600160a01b03871660009081526007602052604090205442916118ec919061157e565b111561190a5760405162461bcd60e51b8152600401610c4b906125f5565b6000611916600061102b565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561196857600080fd5b505afa15801561197c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a0919061230d565b905060006119b2826109ac89866114fc565b600480546040516370a0823160e01b81529293506000926001600160a01b03909116916370a08231916119e79130910161238c565b60206040518083038186803b1580156119ff57600080fd5b505afa158015611a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a37919061230d565b905080821115611aad576004546001600160a01b03166340c10f1930611a5d85856115a3565b6040518363ffffffff1660e01b8152600401611a7a92919061241c565b600060405180830381600087803b158015611a9457600080fd5b505af1158015611aa8573d6000803e3d6000fd5b505050505b600554604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90611adf908d908c9060040161241c565b600060405180830381600087803b158015611af957600080fd5b505af1158015611b0d573d6000803e3d6000fd5b50506004805460025460405163a9059cbb60e01b81526001600160a01b03928316955063a9059cbb9450611b4893919092169187910161241c565b602060405180830381600087803b158015611b6257600080fd5b505af1158015611b76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9a91906122d9565b50600254604051630711e61960e41b81526000916001600160a01b03169063711e619090611bce908d908b906004016123a0565b602060405180830381600087803b158015611be857600080fd5b505af1158015611bfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c20919061230d565b905087811015611c425760405162461bcd60e51b8152600401610c4b906126b1565b7f87b9679bb9a4944bafa98c267e7cd4a00ab29fed48afdefae25f0fca5da279408b8b8b8888888760405161188d97969594939291906123de565b600254604080516378399b0b60e01b815290516000926001600160a01b0316916378399b0b916004808301926020929190829003018186803b158015611cc257600080fd5b505afa158015611cd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfa91906120a8565b90506000816001600160a01b031663d47eed4585856040518363ffffffff1660e01b8152600401611d2c929190612435565b60206040518083038186803b158015611d4457600080fd5b505afa158015611d58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7c919061230d565b905080341015611d9e5760405162461bcd60e51b8152600401610c4b90612762565b604051631df3cbc560e31b81526001600160a01b0383169063ef9e5e28908390611dce9088908890600401612435565b6000604051808303818588803b158015611de757600080fd5b505af1158015611dfb573d6000803e3d6000fd5b505050505050505050565b60008183611e275760405162461bcd60e51b8152600401610c4b9190612519565b506000838581611e3357fe5b0495945050505050565b60008184841115611e615760405162461bcd60e51b8152600401610c4b9190612519565b505050900390565b611ec1846323b872dd60e01b858585604051602401611e8a939291906123ba565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611ec7565b50505050565b6060611f1c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611f5b9092919063ffffffff16565b805190915015611f565780806020019051810190611f3a91906122d9565b611f565760405162461bcd60e51b8152600401610c4b90612892565b505050565b6060611468848460008585611f6f85612005565b611f8b5760405162461bcd60e51b8152600401610c4b906127ae565b60006060866001600160a01b03168587604051611fa89190612370565b60006040518083038185875af1925050503d8060008114611fe5576040519150601f19603f3d011682016040523d82523d6000602084013e611fea565b606091505b5091509150611ffa82828661200b565b979650505050505050565b3b151590565b6060831561201a57508161105b565b82511561202a5782518084602001fd5b8160405162461bcd60e51b8152600401610c4b9190612519565b60008083601f840112612055578182fd5b5081356001600160401b0381111561206b578182fd5b602083019150836020808302850101111561208557600080fd5b9250929050565b60006020828403121561209d578081fd5b81356115368161298f565b6000602082840312156120b9578081fd5b81516115368161298f565b60008060008060008060c087890312156120dc578182fd5b86356120e78161298f565b955060208701356120f78161298f565b945060408701356121078161298f565b959894975094956060810135955060808101359460a0909101359350915050565b600080600080600060a0868803121561213f578081fd5b853561214a8161298f565b9450602086013561215a8161298f565b9350604086013592506060860135915060808601356121788161298f565b809150509295509295909350565b60008060408385031215612198578182fd5b82356121a38161298f565b915060208301356121b3816129a7565b809150509250929050565b6000806000606084860312156121d2578283fd5b83356121dd8161298f565b95602085013595506040909401359392505050565b60008060008060008060a0878903121561220a578182fd5b86356122158161298f565b9550602087013594506040870135935060608701356122338161298f565b925060808701356001600160401b0381111561224d578283fd5b61225989828a01612044565b979a9699509497509295939492505050565b60008060008060008060a08789031215612283578182fd5b863561228e8161298f565b955060208701359450604087013593506060870135925060808701356001600160401b0381111561224d578283fd5b6000602082840312156122ce578081fd5b8135611536816129a7565b6000602082840312156122ea578081fd5b8151611536816129a7565b600060208284031215612306578081fd5b5035919050565b60006020828403121561231e578081fd5b5051919050565b60008060408385031215612337578182fd5b50508035926020909101359150565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008251612382818460208701612963565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03978816815295909616602086015260408501939093526060840191909152608083015260a082015260c081019190915260e00190565b6001600160a01b03929092168252602082015260400190565b602080825281810183905260009060408482028401810190840186845b878110156124bd57868403603f190183528135368a9003601e19018112612477578687fd5b890180356001600160401b0381111561248e578788fd5b8036038b131561249c578788fd5b6124a98682898501612346565b955050509184019190840190600101612452565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612502578351835292840192918401916001016124e6565b50909695505050505050565b901515815260200190565b6000602082528251806020840152612538816040850160208701612963565b601f01601f19169190910160400192915050565b60208082526025908201527f476c704d616e616765723a20696e76616c6964205f636f6f6c646f776e44757260408201526430ba34b7b760d91b606082015260800190565b6020808252601b908201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604082015260600190565b60208082526015908201527423b63826b0b730b3b2b91d103337b93134b23232b760591b604082015260600190565b6020808252602c908201527f476c704d616e616765723a20636f6f6c646f776e206475726174696f6e206e6f60408201526b1d081e595d081c185cdcd95960a21b606082015260800190565b60208082526015908201527423b7bb32b93730b136329d103337b93134b23232b760591b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252601f908201527f476c704d616e616765723a20696e73756666696369656e74206f757470757400604082015260600190565b6020808252601e908201527f476c704d616e616765723a20616374696f6e206e6f7420656e61626c65640000604082015260600190565b60208082526023908201527f476c704d616e616765723a20696e73756666696369656e7420474c50206f75746040820152621c1d5d60ea1b606082015260800190565b6020808252602c908201527f696e73756666696369656e74206d73672e76616c756520746f2075706461746560408201526b20707974682070726963657360a01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601a908201527911db1c13585b9859d95c8e881a5b9d985b1a59081dd95a59da1d60321b604082015260600190565b6020808252601b908201527a11db1c13585b9859d95c8e881a5b9d985b1a590817d85b5bdd5b9d602a1b604082015260600190565b60208082526024908201527f476c704d616e616765723a20696e73756666696369656e742055534447206f756040820152631d1c1d5d60e21b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601e908201527f476c704d616e616765723a20696e76616c6964205f676c70416d6f756e740000604082015260600190565b90815260200190565b9182521515602082015260400190565b60005b8381101561297e578181015183820152602001612966565b83811115611ec15750506000910152565b6001600160a01b03811681146129a457600080fd5b50565b80151581146129a457600080fdfea26469706673582212202c08f2723326f393c6d8d998d697f455d140a65a81be802100bc726c9771925864736f6c634300060c0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in MNT
Multichain Portfolio | 32 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.