Source Code
Latest 25 from a total of 30 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Set Integrator I... | 1657051 | 1266 days ago | IN | 0 GLMR | 0.00485153 | ||||
| Set Integrator I... | 1657011 | 1266 days ago | IN | 0 GLMR | 0.00485153 | ||||
| Set Fixed Crypto... | 1621931 | 1272 days ago | IN | 0 GLMR | 0.00262943 | ||||
| Set Fixed Crypto... | 1540834 | 1283 days ago | IN | 0 GLMR | 0.00262701 | ||||
| Set Integrator I... | 1527446 | 1285 days ago | IN | 0 GLMR | 0.00350937 | ||||
| Set Integrator I... | 1527434 | 1285 days ago | IN | 0 GLMR | 0.00350937 | ||||
| Set Integrator I... | 1527420 | 1285 days ago | IN | 0 GLMR | 0.00350937 | ||||
| Set Integrator I... | 1527396 | 1285 days ago | IN | 0 GLMR | 0.00350787 | ||||
| Set Integrator I... | 1527354 | 1285 days ago | IN | 0 GLMR | 0.00350937 | ||||
| Set Integrator I... | 1527328 | 1285 days ago | IN | 0 GLMR | 0.00350937 | ||||
| Set Integrator I... | 1527316 | 1285 days ago | IN | 0 GLMR | 0.00350937 | ||||
| Set Integrator I... | 1527301 | 1285 days ago | IN | 0 GLMR | 0.00350937 | ||||
| Set Integrator I... | 1527283 | 1285 days ago | IN | 0 GLMR | 0.00350937 | ||||
| Set Integrator I... | 1527266 | 1285 days ago | IN | 0 GLMR | 0.00350937 | ||||
| Set Integrator I... | 1525921 | 1285 days ago | IN | 0 GLMR | 0.00599087 | ||||
| Set Integrator I... | 1525909 | 1285 days ago | IN | 0 GLMR | 0.00599087 | ||||
| Set Integrator I... | 1525887 | 1286 days ago | IN | 0 GLMR | 0.00599087 | ||||
| Set Integrator I... | 1525870 | 1286 days ago | IN | 0 GLMR | 0.00598937 | ||||
| Set Integrator I... | 1525848 | 1286 days ago | IN | 0 GLMR | 0.00599087 | ||||
| Set Integrator I... | 1525831 | 1286 days ago | IN | 0 GLMR | 0.00599087 | ||||
| Set Integrator I... | 1525818 | 1286 days ago | IN | 0 GLMR | 0.00599087 | ||||
| Set Integrator I... | 1525792 | 1286 days ago | IN | 0 GLMR | 0.00599087 | ||||
| Set Integrator I... | 1525771 | 1286 days ago | IN | 0 GLMR | 0.00599087 | ||||
| Set Integrator I... | 1525715 | 1286 days ago | IN | 0 GLMR | 0.00599087 | ||||
| Set Fixed Crypto... | 1519454 | 1286 days ago | IN | 0 GLMR | 0.00463691 |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
RubicProxy
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 100000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
/**
██████╗ ██╗ ██╗██████╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗██╗ ██╗
██╔══██╗██║ ██║██╔══██╗██║██╔════╝ ██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝╚██╗ ██╔╝
██████╔╝██║ ██║██████╔╝██║██║ ██████╔╝██████╔╝██║ ██║ ╚███╔╝ ╚████╔╝
██╔══██╗██║ ██║██╔══██╗██║██║ ██╔═══╝ ██╔══██╗██║ ██║ ██╔██╗ ╚██╔╝
██║ ██║╚██████╔╝██████╔╝██║╚██████╗ ██║ ██║ ██║╚██████╔╝██╔╝ ██╗ ██║
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
*/
import 'rubic-bridge-base/contracts/architecture/OnlySourceFunctionality.sol';
import 'rubic-bridge-base/contracts/libraries/SmartApprove.sol';
error DifferentAmountSpent();
error RouterNotAvailable();
/**
@title RubicProxy
@author Vladislav Yaroshuk t.me/grgred
@author George Eliseev
@notice Universal proxy contract to Symbiosis, LiFi, deBridge and other cross-chain solutions
*/
contract RubicProxy is OnlySourceFunctionality {
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
using SafeERC20Upgradeable for IERC20Upgradeable;
constructor(
uint256 _fixedCryptoFee,
uint256 _RubicPlatformFee,
address[] memory _routers,
address[] memory _tokens,
uint256[] memory _minTokenAmounts,
uint256[] memory _maxTokenAmounts
) {
initialize(_fixedCryptoFee, _RubicPlatformFee, _routers, _tokens, _minTokenAmounts, _maxTokenAmounts);
}
function initialize(
uint256 _fixedCryptoFee,
uint256 _RubicPlatformFee,
address[] memory _routers,
address[] memory _tokens,
uint256[] memory _minTokenAmounts,
uint256[] memory _maxTokenAmounts
) private initializer {
__OnlySourceFunctionalityInit(
_fixedCryptoFee,
_RubicPlatformFee,
_routers,
_tokens,
_minTokenAmounts,
_maxTokenAmounts
);
}
function routerCall(
BaseCrossChainParams calldata _params,
address _gateway,
bytes calldata _data
) external payable nonReentrant whenNotPaused eventEmitter(_params) {
if (!(availableRouters.contains(_params.router) && availableRouters.contains(_gateway))) {
revert RouterNotAvailable();
}
IERC20Upgradeable(_params.srcInputToken).safeTransferFrom(msg.sender, address(this), _params.srcInputAmount);
IntegratorFeeInfo memory _info = integratorToFeeInfo[_params.integrator];
uint256 _amountIn = accrueTokenFees(
_params.integrator,
_info,
_params.srcInputAmount,
0,
_params.srcInputToken
);
SmartApprove.smartApprove(_params.srcInputToken, _amountIn, _gateway);
uint256 balanceBefore = IERC20Upgradeable(_params.srcInputToken).balanceOf(address(this));
AddressUpgradeable.functionCallWithValue(
_params.router,
_data,
accrueFixedCryptoFee(_params.integrator, _info)
);
if (balanceBefore - IERC20Upgradeable(_params.srcInputToken).balanceOf(address(this)) != _amountIn) {
revert DifferentAmountSpent();
}
}
function routerCallNative(BaseCrossChainParams calldata _params, bytes calldata _data)
external
payable
nonReentrant
whenNotPaused
eventEmitter(_params)
{
if (!availableRouters.contains(_params.router)) {
revert RouterNotAvailable();
}
IntegratorFeeInfo memory _info = integratorToFeeInfo[_params.integrator];
uint256 _amountIn = accrueTokenFees(
_params.integrator,
_info,
accrueFixedCryptoFee(_params.integrator, _info),
0,
address(0)
);
AddressUpgradeable.functionCallWithValue(_params.router, _data, _amountIn);
}
function sweepTokens(address _token, uint256 _amount) external onlyAdmin {
sendToken(_token, _amount, msg.sender);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import '../BridgeBase.sol';
contract OnlySourceFunctionality is BridgeBase {
event RequestSent(BaseCrossChainParams parameters);
modifier eventEmitter(BaseCrossChainParams calldata _params) {
_;
emit RequestSent(_params);
}
function __OnlySourceFunctionalityInit(
uint256 _fixedCryptoFee,
uint256 _RubicPlatformFee,
address[] memory _routers,
address[] memory _tokens,
uint256[] memory _minTokenAmounts,
uint256[] memory _maxTokenAmounts
) internal onlyInitializing {
__BridgeBaseInit(_fixedCryptoFee, _RubicPlatformFee, _routers, _tokens, _minTokenAmounts, _maxTokenAmounts);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import '@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol';
import '../errors/Errors.sol';
library SmartApprove {
using SafeERC20Upgradeable for IERC20Upgradeable;
function smartApprove(
address _tokenIn,
uint256 _amount,
address _to
) internal {
IERC20Upgradeable tokenIn = IERC20Upgradeable(_tokenIn);
uint256 _allowance = tokenIn.allowance(address(this), _to);
if (_allowance < _amount) {
if (_allowance == 0) {
tokenIn.safeApprove(_to, type(uint256).max);
} else {
try tokenIn.approve(_to, type(uint256).max) returns (bool res) {
if (!res) {
revert ApproveFailed();
}
} catch {
tokenIn.safeApprove(_to, 0);
tokenIn.safeApprove(_to, type(uint256).max);
}
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol';
import '@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol';
import './libraries/FullMath.sol';
import './errors/Errors.sol';
contract BridgeBase is AccessControlUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable {
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
using SafeERC20Upgradeable for IERC20Upgradeable;
// Denominator for setting fees
uint256 internal constant DENOMINATOR = 1e6;
bytes32 public constant MANAGER_ROLE = keccak256('MANAGER_ROLE');
// Struct with all info about integrator fees
mapping(address => IntegratorFeeInfo) public integratorToFeeInfo;
// Amount of collected fees in native token integrator -> native fees
mapping(address => uint256) public availableIntegratorCryptoFee;
// token -> minAmount for swap
mapping(address => uint256) public minTokenAmount;
// token -> maxAmount for swap
mapping(address => uint256) public maxTokenAmount;
// token -> rubic collected fees
mapping(address => uint256) public availableRubicTokenFee;
// token -> integrator collected fees
mapping(address => mapping(address => uint256)) public availableIntegratorTokenFee;
// Rubic token fee
uint256 public RubicPlatformFee;
// Rubic fixed fee for swap
uint256 public fixedCryptoFee;
// Collected rubic fees in native token
uint256 public availableRubicCryptoFee;
// AddressSet of whitelisted addresses
EnumerableSetUpgradeable.AddressSet internal availableRouters;
event FixedCryptoFee(uint256 RubicPart, uint256 integratorPart, address indexed integrator);
event FixedCryptoFeeCollected(uint256 amount, address collector);
event TokenFee(uint256 RubicPart, uint256 integratorPart, address indexed integrator, address token);
event IntegratorTokenFeeCollected(uint256 amount, address indexed integrator, address token);
event RubicTokenFeeCollected(uint256 amount, address token);
struct IntegratorFeeInfo {
bool isIntegrator; // flag for setting 0 fees for integrator - 1 byte
uint32 tokenFee; // total fee percent gathered from user - 4 bytes
uint32 RubicTokenShare; // token share of platform commission - 4 bytes
uint32 RubicFixedCryptoShare; // native share of fixed commission - 4 bytes
uint128 fixedFeeAmount; // custom fixed fee amount - 16 bytes
} // total - 29 bytes <= 32 bytes
struct BaseCrossChainParams {
address srcInputToken;
uint256 srcInputAmount;
uint256 dstChainID;
address dstOutputToken;
uint256 dstMinOutputAmount;
address recipient;
address integrator;
address router;
}
// reference to https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3347/
modifier onlyAdmin() {
checkIsAdmin();
_;
}
modifier onlyManagerOrAdmin() {
checkIsManagerOrAdmin();
_;
}
modifier onlyEOA() {
if (msg.sender != tx.origin) {
revert OnlyEOA();
}
_;
}
function __BridgeBaseInit(
uint256 _fixedCryptoFee,
uint256 _RubicPlatformFee,
address[] memory _routers,
address[] memory _tokens,
uint256[] memory _minTokenAmounts,
uint256[] memory _maxTokenAmounts
) internal onlyInitializing {
__Pausable_init_unchained();
fixedCryptoFee = _fixedCryptoFee;
if (_RubicPlatformFee > DENOMINATOR) {
revert FeeTooHigh();
}
RubicPlatformFee = _RubicPlatformFee;
uint256 routerLength = _routers.length;
for (uint256 i; i < routerLength; ) {
availableRouters.add(_routers[i]);
unchecked {
++i;
}
}
uint256 tokensLength = _tokens.length;
for (uint256 i; i < tokensLength; ) {
if (_minTokenAmounts[i] > _maxTokenAmounts[i]) {
revert MinMustBeLowerThanMax();
}
minTokenAmount[_tokens[i]] = _minTokenAmounts[i];
maxTokenAmount[_tokens[i]] = _maxTokenAmounts[i];
unchecked {
++i;
}
}
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
/**
* @dev Calculates and accrues fixed crypto fee
* @param _integrator Integrator's address if there is one
* @param _info A struct with integrator fee info
* @return The msg.value without fixedCryptoFee
*/
function accrueFixedCryptoFee(address _integrator, IntegratorFeeInfo memory _info) internal returns (uint256) {
uint256 _fixedCryptoFee;
uint256 _RubicPart;
if (_info.fixedFeeAmount > 0 && _info.isIntegrator) {
_fixedCryptoFee = uint256(_info.fixedFeeAmount);
_RubicPart = (_fixedCryptoFee * _info.RubicFixedCryptoShare) / DENOMINATOR;
availableIntegratorCryptoFee[_integrator] += _fixedCryptoFee - _RubicPart;
emit FixedCryptoFee(_RubicPart, _fixedCryptoFee - _RubicPart, _integrator);
} else {
_fixedCryptoFee = fixedCryptoFee;
emit FixedCryptoFee(_fixedCryptoFee, 0, address(0));
}
availableRubicCryptoFee += _RubicPart;
// Underflow is prevented by sol 0.8
return (msg.value - _fixedCryptoFee);
}
/**
* @dev Calculates token fees and accrues them
* @param _integrator Integrator's address if there is one
* @param _info A struct with fee info about integrator
* @param _amountWithFee Total amount passed by the user
* @param _token The token in which the fees are collected
* @param _initBlockchainNum Used if the _calculateFee is overriden by
* WithDestinationFunctionality, otherwise is ignored
* @return Amount of tokens without fee
*/
function accrueTokenFees(
address _integrator,
IntegratorFeeInfo memory _info,
uint256 _amountWithFee,
uint256 _initBlockchainNum,
address _token
) internal returns (uint256) {
(uint256 _totalFees, uint256 _RubicFee) = _calculateFee(_info, _amountWithFee, _initBlockchainNum);
if (_integrator != address(0)) {
availableIntegratorTokenFee[_token][_integrator] += _totalFees - _RubicFee;
}
availableRubicTokenFee[_token] += _RubicFee;
emit TokenFee(_RubicFee, _totalFees - _RubicFee, _integrator, _token);
return _amountWithFee - _totalFees;
}
/**
* @dev Calculates fee amount for integrator and rubic, used in architecture
* @param _amountWithFee the users initial amount
* @param _info the struct with data about integrator
* @return _totalFee the amount of Rubic + integrator fee
* @return _RubicFee the amount of Rubic fee only
*/
function _calculateFeeWithIntegrator(uint256 _amountWithFee, IntegratorFeeInfo memory _info)
internal
pure
returns (uint256 _totalFee, uint256 _RubicFee)
{
if (_info.tokenFee > 0) {
_totalFee = FullMath.mulDiv(_amountWithFee, _info.tokenFee, DENOMINATOR);
_RubicFee = FullMath.mulDiv(_totalFee, _info.RubicTokenShare, DENOMINATOR);
}
}
function _calculateFee(
IntegratorFeeInfo memory _info,
uint256 _amountWithFee,
uint256
) internal view returns (uint256 _totalFee, uint256 _RubicFee) {
if (_info.isIntegrator) {
(_totalFee, _RubicFee) = _calculateFeeWithIntegrator(_amountWithFee, _info);
} else {
_totalFee = FullMath.mulDiv(_amountWithFee, RubicPlatformFee, DENOMINATOR);
_RubicFee = _totalFee;
}
}
/// COLLECT FUNCTIONS ///
function _collectIntegrator(address _integrator, address _token) private {
uint256 _amount;
if (_token == address(0)) {
_amount = availableIntegratorCryptoFee[_integrator];
availableIntegratorCryptoFee[_integrator] = 0;
emit FixedCryptoFeeCollected(_amount, _integrator);
}
_amount += availableIntegratorTokenFee[_token][_integrator];
if (_amount == 0) {
revert ZeroAmount();
}
availableIntegratorTokenFee[_token][_integrator] = 0;
sendToken(_token, _amount, _integrator);
emit IntegratorTokenFeeCollected(_amount, _integrator, _token);
}
/**
* @dev Integrator can collect fees calling this function
* @param _token The token to collect fees in
*/
function collectIntegratorFee(address _token) external nonReentrant {
_collectIntegrator(msg.sender, _token);
}
/**
* @dev Managers can collect integrator's fees calling this function
* Fees go to the integrator
* @param _integrator Address of the integrator
* @param _token The token to collect fees in
*/
function collectIntegratorFee(address _integrator, address _token) external onlyManagerOrAdmin {
_collectIntegrator(_integrator, _token);
}
/**
* @dev Calling this function managers can collect Rubic's token fee
* @param _token The token to collect fees in
*/
function collectRubicFee(address _token) external onlyManagerOrAdmin {
uint256 _amount = availableRubicTokenFee[_token];
if (_amount == 0) {
revert ZeroAmount();
}
availableRubicTokenFee[_token] = 0;
sendToken(_token, _amount, msg.sender);
emit RubicTokenFeeCollected(_amount, _token);
}
/**
* @dev Calling this function managers can collect Rubic's fixed crypto fee
*/
function collectRubicCryptoFee() external onlyManagerOrAdmin {
uint256 _cryptoFee = availableRubicCryptoFee;
availableRubicCryptoFee = 0;
sendToken(address(0), _cryptoFee, msg.sender);
emit FixedCryptoFeeCollected(_cryptoFee, msg.sender);
}
/// CONTROL FUNCTIONS ///
function pauseExecution() external onlyManagerOrAdmin {
_pause();
}
function unpauseExecution() external onlyManagerOrAdmin {
_unpause();
}
/**
* @dev Sets fee info associated with an integrator
* @param _integrator Address of the integrator
* @param _info Struct with fee info
*/
function setIntegratorInfo(address _integrator, IntegratorFeeInfo memory _info) external onlyManagerOrAdmin {
if (_info.tokenFee > DENOMINATOR) {
revert FeeTooHigh();
}
if (_info.RubicTokenShare > DENOMINATOR || _info.RubicFixedCryptoShare > DENOMINATOR) {
revert ShareTooHigh();
}
integratorToFeeInfo[_integrator] = _info;
}
/**
* @dev Sets fixed crypto fee
* @param _fixedCryptoFee Fixed crypto fee
*/
function setFixedCryptoFee(uint256 _fixedCryptoFee) external onlyManagerOrAdmin {
fixedCryptoFee = _fixedCryptoFee;
}
function setRubicPlatformFee(uint256 _platformFee) external onlyManagerOrAdmin {
if (_platformFee > DENOMINATOR) {
revert FeeTooHigh();
}
RubicPlatformFee = _platformFee;
}
/**
* @dev Changes requirement for minimal token amount on transfers
* @param _token The token address to setup
* @param _minTokenAmount Amount of tokens
*/
function setMinTokenAmount(address _token, uint256 _minTokenAmount) external onlyManagerOrAdmin {
if (_minTokenAmount > maxTokenAmount[_token]) {
// can be equal in case we want them to be zero
revert MinMustBeLowerThanMax();
}
minTokenAmount[_token] = _minTokenAmount;
}
/**
* @dev Changes requirement for maximum token amount on transfers
* @param _token The token address to setup
* @param _maxTokenAmount Amount of tokens
*/
function setMaxTokenAmount(address _token, uint256 _maxTokenAmount) external onlyManagerOrAdmin {
if (_maxTokenAmount < minTokenAmount[_token]) {
// can be equal in case we want them to be zero
revert MaxMustBeBiggerThanMin();
}
maxTokenAmount[_token] = _maxTokenAmount;
}
/**
* @dev Appends new available router
* @param _router Router's address to add
*/
function addAvailableRouter(address _router) external onlyManagerOrAdmin {
if (_router == address(0)) {
revert ZeroAddress();
}
// Check that router exists is performed inside the library
availableRouters.add(_router);
}
/**
* @dev Removes existing available router
* @param _router Router's address to remove
*/
function removeAvailableRouter(address _router) external onlyManagerOrAdmin {
// Check that router exists is performed inside the library
availableRouters.remove(_router);
}
/**
* @dev Transfers admin role
* @param _newAdmin New admin's address
*/
function transferAdmin(address _newAdmin) external onlyAdmin {
_revokeRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(DEFAULT_ADMIN_ROLE, _newAdmin);
}
/// VIEW FUNCTIONS ///
/**
* @return Available routers
*/
function getAvailableRouters() external view returns (address[] memory) {
return availableRouters.values();
}
/**
* @notice Used in modifiers
* @dev Function to check if address is belongs to manager or admin role
*/
function checkIsManagerOrAdmin() internal view {
if (!(hasRole(MANAGER_ROLE, msg.sender) || hasRole(DEFAULT_ADMIN_ROLE, msg.sender))) {
revert NotAManager();
}
}
/**
* @notice Used in modifiers
* @dev Function to check if address is belongs to default admin role
*/
function checkIsAdmin() internal view {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) {
revert NotAnAdmin();
}
}
function sendToken(
address _token,
uint256 _amount,
address _receiver
) internal virtual {
if (_token == address(0)) {
AddressUpgradeable.sendValue(payable(_receiver), _amount);
} else {
IERC20Upgradeable(_token).safeTransfer(_receiver, _amount);
}
}
/**
* @dev Plain fallback function to receive native
*/
receive() external payable {}
/**
* @dev Plain fallback function
*/
fallback() external {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(uint160(account), 20),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
import "../extensions/draft-IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
using AddressUpgradeable for address;
function safeTransfer(
IERC20Upgradeable token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20Upgradeable 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(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20PermitUpgradeable token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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(IERC20Upgradeable token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
* ====
*/
library EnumerableSetUpgradeable {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
return _values(set._inner);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// 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;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_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 making 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;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
/// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
/// @param a The multiplicand
/// @param b The multiplier
/// @param denominator The divisor
/// @return result The 256-bit result
/// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
function mulDiv(
uint256 a,
uint256 b,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = a * b
// Compute the product mod 2**256 and mod 2**256 - 1
// then use the Chinese Remainder Theorem to reconstruct
// the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2**256 + prod0
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(a, b, not(0))
prod0 := mul(a, b)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division
if (prod1 == 0) {
require(denominator > 0);
assembly {
result := div(prod0, denominator)
}
return result;
}
// Make sure the result is less than 2**256.
// Also prevents denominator == 0
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0]
// Compute remainder using mulmod
uint256 remainder;
assembly {
remainder := mulmod(a, b, denominator)
}
// Subtract 256 bit number from 512 bit number
assembly {
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator
// Compute largest power of two divisor of denominator.
// Always >= 1.
uint256 twos = (0 - denominator) & denominator;
// Divide denominator by power of two
assembly {
denominator := div(denominator, twos)
}
// Divide [prod1 prod0] by the factors of two
assembly {
prod0 := div(prod0, twos)
}
// Shift in bits from prod1 into prod0. For this we need
// to flip `twos` such that it is 2**256 / twos.
// If twos is zero, then it becomes one
assembly {
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
// Invert denominator mod 2**256
// Now that denominator is an odd number, it has an inverse
// modulo 2**256 such that denominator * inv = 1 mod 2**256.
// Compute the inverse by starting with a seed that is correct
// correct for four bits. That is, denominator * inv = 1 mod 2**4
uint256 inv = (3 * denominator) ^ 2;
// Now use Newton-Raphson iteration to improve the precision.
// Thanks to Hensel's lifting lemma, this also works in modular
// arithmetic, doubling the correct bits in each step.
inv *= 2 - denominator * inv; // inverse mod 2**8
inv *= 2 - denominator * inv; // inverse mod 2**16
inv *= 2 - denominator * inv; // inverse mod 2**32
inv *= 2 - denominator * inv; // inverse mod 2**64
inv *= 2 - denominator * inv; // inverse mod 2**128
inv *= 2 - denominator * inv; // inverse mod 2**256
// Because the division is now exact we can divide by multiplying
// with the modular inverse of denominator. This will give us the
// correct result modulo 2**256. Since the precoditions guarantee
// that the outcome is less than 2**256, this is the final result.
// We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inv;
return result;
}
}
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; error NotAnAdmin(); error NotAManager(); error NotARelayer(); error OnlyEOA(); error FeeTooHigh(); error ShareTooHigh(); error ZeroAddress(); error ZeroAmount(); error InefficientFixedFee(); error ApproveFailed(); error MinMustBeLowerThanMax(); error MaxMustBeBiggerThanMin(); error CantSetToNull(); error Unchangeable(); error LengthMismatch();
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
* initialization step. This is essential to configure modules that are added through upgrades and that require
* initialization.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20PermitUpgradeable {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}{
"optimizer": {
"enabled": true,
"runs": 100000
},
"metadata": {
"bytecodeHash": "none"
},
"evmVersion": "istanbul",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"_fixedCryptoFee","type":"uint256"},{"internalType":"uint256","name":"_RubicPlatformFee","type":"uint256"},{"internalType":"address[]","name":"_routers","type":"address[]"},{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_minTokenAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"_maxTokenAmounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApproveFailed","type":"error"},{"inputs":[],"name":"DifferentAmountSpent","type":"error"},{"inputs":[],"name":"FeeTooHigh","type":"error"},{"inputs":[],"name":"MaxMustBeBiggerThanMin","type":"error"},{"inputs":[],"name":"MinMustBeLowerThanMax","type":"error"},{"inputs":[],"name":"NotAManager","type":"error"},{"inputs":[],"name":"NotAnAdmin","type":"error"},{"inputs":[],"name":"RouterNotAvailable","type":"error"},{"inputs":[],"name":"ShareTooHigh","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"RubicPart","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"integratorPart","type":"uint256"},{"indexed":true,"internalType":"address","name":"integrator","type":"address"}],"name":"FixedCryptoFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"collector","type":"address"}],"name":"FixedCryptoFeeCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"integrator","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"IntegratorTokenFeeCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"srcInputToken","type":"address"},{"internalType":"uint256","name":"srcInputAmount","type":"uint256"},{"internalType":"uint256","name":"dstChainID","type":"uint256"},{"internalType":"address","name":"dstOutputToken","type":"address"},{"internalType":"uint256","name":"dstMinOutputAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"address","name":"router","type":"address"}],"indexed":false,"internalType":"struct BridgeBase.BaseCrossChainParams","name":"parameters","type":"tuple"}],"name":"RequestSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"RubicTokenFeeCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"RubicPart","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"integratorPart","type":"uint256"},{"indexed":true,"internalType":"address","name":"integrator","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"TokenFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RubicPlatformFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"addAvailableRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"availableIntegratorCryptoFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"availableIntegratorTokenFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"availableRubicCryptoFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"availableRubicTokenFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"collectIntegratorFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_integrator","type":"address"},{"internalType":"address","name":"_token","type":"address"}],"name":"collectIntegratorFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectRubicCryptoFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"collectRubicFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fixedCryptoFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAvailableRouters","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"integratorToFeeInfo","outputs":[{"internalType":"bool","name":"isIntegrator","type":"bool"},{"internalType":"uint32","name":"tokenFee","type":"uint32"},{"internalType":"uint32","name":"RubicTokenShare","type":"uint32"},{"internalType":"uint32","name":"RubicFixedCryptoShare","type":"uint32"},{"internalType":"uint128","name":"fixedFeeAmount","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxTokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minTokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseExecution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"removeAvailableRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"srcInputToken","type":"address"},{"internalType":"uint256","name":"srcInputAmount","type":"uint256"},{"internalType":"uint256","name":"dstChainID","type":"uint256"},{"internalType":"address","name":"dstOutputToken","type":"address"},{"internalType":"uint256","name":"dstMinOutputAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"address","name":"router","type":"address"}],"internalType":"struct BridgeBase.BaseCrossChainParams","name":"_params","type":"tuple"},{"internalType":"address","name":"_gateway","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"routerCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"srcInputToken","type":"address"},{"internalType":"uint256","name":"srcInputAmount","type":"uint256"},{"internalType":"uint256","name":"dstChainID","type":"uint256"},{"internalType":"address","name":"dstOutputToken","type":"address"},{"internalType":"uint256","name":"dstMinOutputAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"address","name":"router","type":"address"}],"internalType":"struct BridgeBase.BaseCrossChainParams","name":"_params","type":"tuple"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"routerCallNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fixedCryptoFee","type":"uint256"}],"name":"setFixedCryptoFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_integrator","type":"address"},{"components":[{"internalType":"bool","name":"isIntegrator","type":"bool"},{"internalType":"uint32","name":"tokenFee","type":"uint32"},{"internalType":"uint32","name":"RubicTokenShare","type":"uint32"},{"internalType":"uint32","name":"RubicFixedCryptoShare","type":"uint32"},{"internalType":"uint128","name":"fixedFeeAmount","type":"uint128"}],"internalType":"struct BridgeBase.IntegratorFeeInfo","name":"_info","type":"tuple"}],"name":"setIntegratorInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_maxTokenAmount","type":"uint256"}],"name":"setMaxTokenAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_minTokenAmount","type":"uint256"}],"name":"setMinTokenAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_platformFee","type":"uint256"}],"name":"setRubicPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"sweepTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAdmin","type":"address"}],"name":"transferAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseExecution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60806040523480156200001157600080fd5b5060405162003f9338038062003f93833981016040819052620000349162000727565b6200004486868686868662000050565b50505050505062000809565b600054610100900460ff1615808015620000715750600054600160ff909116105b80620000a157506200008e306200018e60201b620016501760201c565b158015620000a1575060005460ff166001145b6200010a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156200012e576000805461ff0019166101001790555b6200013e8787878787876200019d565b801562000185576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b6001600160a01b03163b151590565b600054610100900460ff16620001f95760405162461bcd60e51b815260206004820152602b602482015260008051602062003f7383398151915260448201526a6e697469616c697a696e6760a81b606482015260840162000101565b6200020986868686868662000211565b505050505050565b600054610100900460ff166200026d5760405162461bcd60e51b815260206004820152602b602482015260008051602062003f7383398151915260448201526a6e697469616c697a696e6760a81b606482015260840162000101565b620002776200043e565b610102869055620f4240851115620002a25760405163cd4e616760e01b815260040160405180910390fd5b610101859055835160005b81811015620002f857620002ee868281518110620002cf57620002cf620007f3565b6020026020010151610104620004a660201b6200166c1790919060201c565b50600101620002ad565b50835160005b8181101562000426578381815181106200031c576200031c620007f3565b6020026020010151858281518110620003395762000339620007f3565b60200260200101511115620003615760405163129c63a160e31b815260040160405180910390fd5b848181518110620003765762000376620007f3565b602002602001015160fd6000888481518110620003975762000397620007f3565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550838181518110620003d857620003d8620007f3565b602002602001015160fe6000888481518110620003f957620003f9620007f3565b6020908102919091018101516001600160a01b0316825281019190915260400160002055600101620002fe565b5062000434600033620004c6565b5050505050505050565b600054610100900460ff166200049a5760405162461bcd60e51b815260206004820152602b602482015260008051602062003f7383398151915260448201526a6e697469616c697a696e6760a81b606482015260840162000101565b6097805460ff19169055565b6000620004bd836001600160a01b038416620004d6565b90505b92915050565b620004d2828262000528565b5050565b60008181526001830160205260408120546200051f57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620004c0565b506000620004c0565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16620004d25760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620005883390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200060d576200060d620005cc565b604052919050565b60006001600160401b03821115620006315762000631620005cc565b5060051b60200190565b600082601f8301126200064d57600080fd5b8151602062000666620006608362000615565b620005e2565b82815260059290921b840181019181810190868411156200068657600080fd5b8286015b84811015620006ba5780516001600160a01b0381168114620006ac5760008081fd5b83529183019183016200068a565b509695505050505050565b600082601f830112620006d757600080fd5b81516020620006ea620006608362000615565b82815260059290921b840181019181810190868411156200070a57600080fd5b8286015b84811015620006ba57805183529183019183016200070e565b60008060008060008060c087890312156200074157600080fd5b86516020880151604089015191975095506001600160401b03808211156200076857600080fd5b620007768a838b016200063b565b955060608901519150808211156200078d57600080fd5b6200079b8a838b016200063b565b94506080890151915080821115620007b257600080fd5b620007c08a838b01620006c5565b935060a0890151915080821115620007d757600080fd5b50620007e689828a01620006c5565b9150509295509295509295565b634e487b7160e01b600052603260045260246000fd5b61375a80620008196000396000f3fe6080604052600436106102535760003560e01c806375829def116101385780639e369235116100b0578063c75b3d411161007f578063dec6603611610064578063dec6603614610786578063e515ae40146107a6578063ec87621c146107b95761025a565b8063c75b3d411461074f578063d547741f146107665761025a565b80639e369235146106d6578063a217fddf146106ed578063beea8df814610702578063c4707686146107225761025a565b80637e903aa611610107578063859806cc116100ec578063859806cc1461064e57806391d148541461066357806395c54f5a146106b65761025a565b80637e903aa614610619578063825dc4151461062e5761025a565b806375829def146104e7578063772f8c2d1461050757806379e65062146105345780637cd5083f146105545761025a565b8063248a9ca3116101cb5780633f979a9a1161019a5780635c975abb1161017f5780635c975abb1461047657806369fe30e81461048e578063706bc66b146104c75761025a565b80633f979a9a1461043f57806348d8b9a41461045f5761025a565b8063248a9ca3146103ad5780632f2ff15d146103dd57806336568abe146103fd5780633a68ff831461041d5761025a565b806313a1667c116102225780631bceb8d4116102075780631bceb8d41461034b5780631e2c0314146103785780631f041ec6146103985761025a565b806313a1667c1461030b578063162dfb0d1461032b5761025a565b806301ffc9a71461026857806307598f621461029d5780630b6b2d42146102bd5780630f4fb373146102d05761025a565b3661025a57005b34801561026657600080fd5b005b34801561027457600080fd5b50610288610283366004612fd7565b6107ed565b60405190151581526020015b60405180910390f35b3480156102a957600080fd5b506102666102b8366004613042565b610886565b6102666102cb3660046130b8565b61090e565b3480156102dc57600080fd5b506102fd6102eb366004613042565b60fe6020526000908152604090205481565b604051908152602001610294565b34801561031757600080fd5b50610266610326366004613042565b610b62565b34801561033757600080fd5b5061026661034636600461310e565b610b7a565b34801561035757600080fd5b506102fd610366366004613042565b60fd6020526000908152604090205481565b34801561038457600080fd5b50610266610393366004613138565b610b8c565b3480156103a457600080fd5b50610266610b9a565b3480156103b957600080fd5b506102fd6103c8366004613138565b60009081526065602052604090206001015490565b3480156103e957600080fd5b506102666103f8366004613151565b610bac565b34801561040957600080fd5b50610266610418366004613151565b610bd6565b34801561042957600080fd5b50610432610c85565b6040516102949190613174565b34801561044b57600080fd5b5061026661045a3660046131ce565b610c97565b34801561046b57600080fd5b506102fd6101025481565b34801561048257600080fd5b5060975460ff16610288565b34801561049a57600080fd5b506102fd6104a936600461310e565b61010060209081526000928352604080842090915290825290205481565b3480156104d357600080fd5b506102666104e2366004613042565b610d27565b3480156104f357600080fd5b50610266610502366004613042565b610d88565b34801561051357600080fd5b506102fd610522366004613042565b60fc6020526000908152604090205481565b34801561054057600080fd5b5061026661054f3660046131ce565b610da9565b34801561056057600080fd5b506105d261056f366004613042565b60fb6020526000908152604090205460ff81169063ffffffff61010082048116916501000000000081048216916901000000000000000000820416906fffffffffffffffffffffffffffffffff6d01000000000000000000000000009091041685565b60408051951515865263ffffffff94851660208701529284169285019290925290911660608301526fffffffffffffffffffffffffffffffff16608082015260a001610294565b34801561062557600080fd5b50610266610e39565b34801561063a57600080fd5b50610266610649366004613274565b610e93565b34801561065a57600080fd5b50610266611097565b34801561066f57600080fd5b5061028861067e366004613151565b600091825260656020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156106c257600080fd5b506102666106d1366004613138565b6110a7565b3480156106e257600080fd5b506102fd6101035481565b3480156106f957600080fd5b506102fd600081565b34801561070e57600080fd5b5061026661071d366004613042565b6110f2565b34801561072e57600080fd5b506102fd61073d366004613042565b60ff6020526000908152604090205481565b34801561075b57600080fd5b506102fd6101015481565b34801561077257600080fd5b50610266610781366004613151565b6111dd565b34801561079257600080fd5b506102666107a13660046131ce565b611202565b6102666107b436600461336e565b611215565b3480156107c557600080fd5b506102fd7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061088057507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600260c954036108f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260c9556109063382611695565b50600160c955565b600260c9540361097a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108ee565b600260c95561098761182c565b826109a561099c610100830160e08401613042565b61010490611899565b6109db576040517f91127ab800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060fb816109f060e0880160c08901613042565b73ffffffffffffffffffffffffffffffffffffffff16815260208082019290925260409081016000908120825160a081018452905460ff811615158252610100810463ffffffff908116958301959095526501000000000081048516938201939093526901000000000000000000830490931660608401526d01000000000000000000000000009091046fffffffffffffffffffffffffffffffff166080830152909150610ac9610aa760e0880160c08901613042565b83610ac1610abb60e08b0160c08c01613042565b866118c8565b600080611a47565b9050610b1d610adf610100880160e08901613042565b86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250611b95915050565b5050507f8374070d1462c8a234009e6e373359e53125a166122074cb0fa8fb984c4b0bfa81604051610b4f91906133d3565b60405180910390a15050600160c9555050565b610b6a611bc3565b610b7661010482611c64565b5050565b610b82611bc3565b610b768282611695565b610b94611bc3565b61010255565b610ba2611bc3565b610baa611c86565b565b600082815260656020526040902060010154610bc781611d0b565b610bd18383611d15565b505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610c7b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016108ee565b610b768282611e09565b6060610c92610104611ec4565b905090565b610c9f611bc3565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260fd6020526040902054811015610cfe576040517fb213476a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff909116600090815260fe6020526040902055565b610d2f611bc3565b73ffffffffffffffffffffffffffffffffffffffff8116610d7c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b766101048261166c565b610d90611ed1565b610d9b600033611e09565b610da6600082611d15565b50565b610db1611bc3565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260fe6020526040902054811115610e10576040517f94e31d0800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff909116600090815260fd6020526040902055565b610e41611bc3565b610103805460009182905590610e58908233611f39565b604080518281523360208201527f445ea353dd3cfa91aaa8ea899f31ffb4d03e783c45f0ef3717b46c32ea17969d910160405180910390a150565b610e9b611bc3565b620f4240816020015163ffffffff161115610ee2576040517fcd4e616700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b620f4240816040015163ffffffff161180610f095750620f4240816060015163ffffffff16115b15610f40576040517f2a07fc4c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff909116600090815260fb602090815260409182902083518154928501519385015160608601516080909601516fffffffffffffffffffffffffffffffff166d0100000000000000000000000000027fffffff00000000000000000000000000000000ffffffffffffffffffffffffff63ffffffff9788166901000000000000000000027fffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffff9389166501000000000002939093167fffffffffffffffffffffffffffffffffffffff0000000000000000ffffffffff98909716610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ff941515949094167fffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000909616959095179290921795909516939093179390931716179055565b61109f611bc3565b610baa611f7f565b6110af611bc3565b620f42408111156110ec576040517fcd4e616700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61010155565b6110fa611bc3565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260ff60205260408120549081900361115a576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260ff602052604081205561118b828233611f39565b6040805182815273ffffffffffffffffffffffffffffffffffffffff841660208201527f9216fa2f918153a5852ce98e7929c12cd94e0adeda8117f80e761c216157b27c910160405180910390a15050565b6000828152606560205260409020600101546111f881611d0b565b610bd18383611e09565b61120a611ed1565b610b76828233611f39565b600260c95403611281576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108ee565b600260c95561128e61182c565b836112a361099c610100830160e08401613042565b80156112b657506112b661010485611899565b6112ec576040517f91127ab800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611320333060208801803590611302908a613042565b73ffffffffffffffffffffffffffffffffffffffff16929190611fd6565b600060fb8161133560e0890160c08a01613042565b73ffffffffffffffffffffffffffffffffffffffff16815260208082019290925260409081016000908120825160a081018452905460ff811615158252610100810463ffffffff908116958301959095526501000000000081048516938201939093526901000000000000000000830490931660608401526d01000000000000000000000000009091046fffffffffffffffffffffffffffffffff1660808301529091506114066113ec60e0890160c08a01613042565b8360208a01803590600090611401908d613042565b611a47565b905061141f6114186020890189613042565b82886120b8565b600061142e6020890189613042565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa15801561149a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114be919061346b565b905061152a6114d46101008a0160e08b01613042565b87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611525925061151f91505060e08d0160c08e01613042565b876118c8565b611b95565b508161153960208a018a613042565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa1580156115a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c9919061346b565b6115d390836134b3565b1461160a576040517f119e050500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050507f8374070d1462c8a234009e6e373359e53125a166122074cb0fa8fb984c4b0bfa8160405161163c91906133d3565b60405180910390a15050600160c955505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b600061168e8373ffffffffffffffffffffffffffffffffffffffff8416612320565b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff821661171a575073ffffffffffffffffffffffffffffffffffffffff8216600081815260fc60209081526040808320805493905580518381529182019390935290917f445ea353dd3cfa91aaa8ea899f31ffb4d03e783c45f0ef3717b46c32ea17969d910160405180910390a15b73ffffffffffffffffffffffffffffffffffffffff8083166000908152610100602090815260408083209387168352929052205461175890826134ca565b905080600003611794576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8083166000908152610100602090815260408083209387168352929052908120556117d5828285611f39565b6040805182815273ffffffffffffffffffffffffffffffffffffffff84811660208301528516917f6f83ca8ce48e63b2a223b9f9e7ef1ea7bf3a8385c7a9bd63baae22963b2b26e0910160405180910390a2505050565b60975460ff1615610baa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016108ee565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600183016020526040812054151561168e565b60008060008084608001516fffffffffffffffffffffffffffffffff161180156118f0575083515b156119d85783608001516fffffffffffffffffffffffffffffffff169150620f4240846060015163ffffffff168361192891906134e2565b611932919061351f565b905061193e81836134b3565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260fc6020526040812080549091906119739084906134ca565b909155505073ffffffffffffffffffffffffffffffffffffffff85167f3a84e53f89d2f7779a9c9a54779858ae0eb0b7760d607b445b6fd175c30a04d4826119bb81866134b3565b6040805192835260208301919091520160405180910390a2611a1b565b61010254604080518281526000602082018190529294507f3a84e53f89d2f7779a9c9a54779858ae0eb0b7760d607b445b6fd175c30a04d4910160405180910390a25b806101036000828254611a2e91906134ca565b90915550611a3e905082346134b3565b95945050505050565b6000806000611a5787878761236f565b909250905073ffffffffffffffffffffffffffffffffffffffff881615611acd57611a8281836134b3565b73ffffffffffffffffffffffffffffffffffffffff808616600090815261010060209081526040808320938d1683529290529081208054909190611ac79084906134ca565b90915550505b73ffffffffffffffffffffffffffffffffffffffff8416600090815260ff602052604081208054839290611b029084906134ca565b909155505073ffffffffffffffffffffffffffffffffffffffff88167f25471ec9f39b4ceb20d58f63c37f9c738011f0babcc4b6af69bdd82984ca5f8e82611b4a81866134b3565b60408051928352602083019190915273ffffffffffffffffffffffffffffffffffffffff88169082015260600160405180910390a2611b8982876134b3565b98975050505050505050565b6060611bbb848484604051806060016040528060298152602001613725602991396123af565b949350505050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff1680611c2e57503360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff165b610baa576040517fe92bcd1400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061168e8373ffffffffffffffffffffffffffffffffffffffff8416612545565b611c8e61182c565b609780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611ce13390565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b610da68133612638565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610b7657600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055611dab3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1615610b7657600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6060600061168e8361270a565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff16610baa576040517f55098f2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316611f5e57610bd18183612766565b610bd173ffffffffffffffffffffffffffffffffffffffff841682846128c0565b611f87612916565b609780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611ce1565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526120b29085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612982565b50505050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8281166024830152849160009183169063dd62ed3e90604401602060405180830381865afa15801561212f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612153919061346b565b90508381101561231957806000036121ab576121a673ffffffffffffffffffffffffffffffffffffffff8316847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff612a8e565b612319565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602483015283169063095ea7b3906044016020604051808303816000875af1925050508015612279575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526122769181019061355a565b60015b6122e05761229f73ffffffffffffffffffffffffffffffffffffffff8316846000612a8e565b6121a673ffffffffffffffffffffffffffffffffffffffff8316847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff612a8e565b80612317576040517f3e3f8f7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b5050505050565b600081815260018301602052604081205461236757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610880565b506000610880565b600080846000015115612390576123868486612c10565b90925090506123a7565b6123a18461010154620f4240612c62565b91508190505b935093915050565b606082471015612441576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016108ee565b73ffffffffffffffffffffffffffffffffffffffff85163b6124bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108ee565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516124e891906135a3565b60006040518083038185875af1925050503d8060008114612525576040519150601f19603f3d011682016040523d82523d6000602084013e61252a565b606091505b509150915061253a828286612d32565b979650505050505050565b6000818152600183016020526040812054801561262e5760006125696001836134b3565b855490915060009061257d906001906134b3565b90508181146125e257600086600001828154811061259d5761259d6135bf565b90600052602060002001549050808760000184815481106125c0576125c06135bf565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806125f3576125f36135ee565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610880565b6000915050610880565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610b76576126908173ffffffffffffffffffffffffffffffffffffffff166014612d85565b61269b836020612d85565b6040516020016126ac92919061361d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526108ee9160040161369e565b60608160000180548060200260200160405190810160405280929190818152602001828054801561275a57602002820191906000526020600020905b815481526020019060010190808311612746575b50505050509050919050565b804710156127d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108ee565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461282a576040519150601f19603f3d011682016040523d82523d6000602084013e61282f565b606091505b5050905080610bd1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108ee565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610bd19084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612030565b60975460ff16610baa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016108ee565b60006129e4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612fc89092919063ffffffff16565b805190915015610bd15780806020019051810190612a02919061355a565b610bd1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016108ee565b801580612b2e57506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612b08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b2c919061346b565b155b612bba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016108ee565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610bd19084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401612030565b6000806000836020015163ffffffff161115612c5b57612c3e84846020015163ffffffff16620f4240612c62565b9150612c5882846040015163ffffffff16620f4240612c62565b90505b9250929050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85870985870292508281108382030391505080600003612cb95760008411612cae57600080fd5b50829004905061168e565b808411612cc557600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60608315612d4157508161168e565b825115612d515782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ee919061369e565b60606000612d948360026134e2565b612d9f9060026134ca565b67ffffffffffffffff811115612db757612db76131f8565b6040519080825280601f01601f191660200182016040528015612de1576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612e1857612e186135bf565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612e7b57612e7b6135bf565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000612eb78460026134e2565b612ec29060016134ca565b90505b6001811115612f5f577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612f0357612f036135bf565b1a60f81b828281518110612f1957612f196135bf565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93612f58816136ef565b9050612ec5565b50831561168e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108ee565b6060611bbb84846000856123af565b600060208284031215612fe957600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461168e57600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461303d57600080fd5b919050565b60006020828403121561305457600080fd5b61168e82613019565b6000610100828403121561307057600080fd5b50919050565b60008083601f84011261308857600080fd5b50813567ffffffffffffffff8111156130a057600080fd5b602083019150836020828501011115612c5b57600080fd5b600080600061012084860312156130ce57600080fd5b6130d8858561305d565b925061010084013567ffffffffffffffff8111156130f557600080fd5b61310186828701613076565b9497909650939450505050565b6000806040838503121561312157600080fd5b61312a83613019565b9150612c5860208401613019565b60006020828403121561314a57600080fd5b5035919050565b6000806040838503121561316457600080fd5b82359150612c5860208401613019565b6020808252825182820181905260009190848201906040850190845b818110156131c257835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101613190565b50909695505050505050565b600080604083850312156131e157600080fd5b6131ea83613019565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610da657600080fd5b803561303d81613227565b803563ffffffff8116811461303d57600080fd5b80356fffffffffffffffffffffffffffffffff8116811461303d57600080fd5b60008082840360c081121561328857600080fd5b61329184613019565b925060a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0820112156132c357600080fd5b5060405160a0810181811067ffffffffffffffff8211171561330e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405261331d60208501613235565b815261332b60408501613240565b602082015261333c60608501613240565b604082015261334d60808501613240565b606082015261335e60a08501613254565b6080820152809150509250929050565b600080600080610140858703121561338557600080fd5b61338f868661305d565b935061339e6101008601613019565b925061012085013567ffffffffffffffff8111156133bb57600080fd5b6133c787828801613076565b95989497509550505050565b610100810173ffffffffffffffffffffffffffffffffffffffff806133f785613019565b16835260208401356020840152604084013560408401528061341b60608601613019565b166060840152608084013560808401528061343860a08601613019565b1660a08401528061344b60c08601613019565b1660c08401528061345e60e08601613019565b1660e08401525092915050565b60006020828403121561347d57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000828210156134c5576134c5613484565b500390565b600082198211156134dd576134dd613484565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561351a5761351a613484565b500290565b600082613555577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006020828403121561356c57600080fd5b815161168e81613227565b60005b8381101561359257818101518382015260200161357a565b838111156120b25750506000910152565b600082516135b5818460208701613577565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613655816017850160208801613577565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613692816028840160208801613577565b01602801949350505050565b60208152600082518060208401526136bd816040850160208701613577565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000816136fe576136fe613484565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a164736f6c634300080f000a496e697469616c697a61626c653a20636f6e7472616374206973206e6f742069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005dc00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000663dc15d3c1ac63ff12e45ab68fea3f0a883c251000000000000000000000000362fa9d0bca5d19f743db50738345ce2b40ec99f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102535760003560e01c806375829def116101385780639e369235116100b0578063c75b3d411161007f578063dec6603611610064578063dec6603614610786578063e515ae40146107a6578063ec87621c146107b95761025a565b8063c75b3d411461074f578063d547741f146107665761025a565b80639e369235146106d6578063a217fddf146106ed578063beea8df814610702578063c4707686146107225761025a565b80637e903aa611610107578063859806cc116100ec578063859806cc1461064e57806391d148541461066357806395c54f5a146106b65761025a565b80637e903aa614610619578063825dc4151461062e5761025a565b806375829def146104e7578063772f8c2d1461050757806379e65062146105345780637cd5083f146105545761025a565b8063248a9ca3116101cb5780633f979a9a1161019a5780635c975abb1161017f5780635c975abb1461047657806369fe30e81461048e578063706bc66b146104c75761025a565b80633f979a9a1461043f57806348d8b9a41461045f5761025a565b8063248a9ca3146103ad5780632f2ff15d146103dd57806336568abe146103fd5780633a68ff831461041d5761025a565b806313a1667c116102225780631bceb8d4116102075780631bceb8d41461034b5780631e2c0314146103785780631f041ec6146103985761025a565b806313a1667c1461030b578063162dfb0d1461032b5761025a565b806301ffc9a71461026857806307598f621461029d5780630b6b2d42146102bd5780630f4fb373146102d05761025a565b3661025a57005b34801561026657600080fd5b005b34801561027457600080fd5b50610288610283366004612fd7565b6107ed565b60405190151581526020015b60405180910390f35b3480156102a957600080fd5b506102666102b8366004613042565b610886565b6102666102cb3660046130b8565b61090e565b3480156102dc57600080fd5b506102fd6102eb366004613042565b60fe6020526000908152604090205481565b604051908152602001610294565b34801561031757600080fd5b50610266610326366004613042565b610b62565b34801561033757600080fd5b5061026661034636600461310e565b610b7a565b34801561035757600080fd5b506102fd610366366004613042565b60fd6020526000908152604090205481565b34801561038457600080fd5b50610266610393366004613138565b610b8c565b3480156103a457600080fd5b50610266610b9a565b3480156103b957600080fd5b506102fd6103c8366004613138565b60009081526065602052604090206001015490565b3480156103e957600080fd5b506102666103f8366004613151565b610bac565b34801561040957600080fd5b50610266610418366004613151565b610bd6565b34801561042957600080fd5b50610432610c85565b6040516102949190613174565b34801561044b57600080fd5b5061026661045a3660046131ce565b610c97565b34801561046b57600080fd5b506102fd6101025481565b34801561048257600080fd5b5060975460ff16610288565b34801561049a57600080fd5b506102fd6104a936600461310e565b61010060209081526000928352604080842090915290825290205481565b3480156104d357600080fd5b506102666104e2366004613042565b610d27565b3480156104f357600080fd5b50610266610502366004613042565b610d88565b34801561051357600080fd5b506102fd610522366004613042565b60fc6020526000908152604090205481565b34801561054057600080fd5b5061026661054f3660046131ce565b610da9565b34801561056057600080fd5b506105d261056f366004613042565b60fb6020526000908152604090205460ff81169063ffffffff61010082048116916501000000000081048216916901000000000000000000820416906fffffffffffffffffffffffffffffffff6d01000000000000000000000000009091041685565b60408051951515865263ffffffff94851660208701529284169285019290925290911660608301526fffffffffffffffffffffffffffffffff16608082015260a001610294565b34801561062557600080fd5b50610266610e39565b34801561063a57600080fd5b50610266610649366004613274565b610e93565b34801561065a57600080fd5b50610266611097565b34801561066f57600080fd5b5061028861067e366004613151565b600091825260656020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156106c257600080fd5b506102666106d1366004613138565b6110a7565b3480156106e257600080fd5b506102fd6101035481565b3480156106f957600080fd5b506102fd600081565b34801561070e57600080fd5b5061026661071d366004613042565b6110f2565b34801561072e57600080fd5b506102fd61073d366004613042565b60ff6020526000908152604090205481565b34801561075b57600080fd5b506102fd6101015481565b34801561077257600080fd5b50610266610781366004613151565b6111dd565b34801561079257600080fd5b506102666107a13660046131ce565b611202565b6102666107b436600461336e565b611215565b3480156107c557600080fd5b506102fd7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061088057507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600260c954036108f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260c9556109063382611695565b50600160c955565b600260c9540361097a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108ee565b600260c95561098761182c565b826109a561099c610100830160e08401613042565b61010490611899565b6109db576040517f91127ab800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060fb816109f060e0880160c08901613042565b73ffffffffffffffffffffffffffffffffffffffff16815260208082019290925260409081016000908120825160a081018452905460ff811615158252610100810463ffffffff908116958301959095526501000000000081048516938201939093526901000000000000000000830490931660608401526d01000000000000000000000000009091046fffffffffffffffffffffffffffffffff166080830152909150610ac9610aa760e0880160c08901613042565b83610ac1610abb60e08b0160c08c01613042565b866118c8565b600080611a47565b9050610b1d610adf610100880160e08901613042565b86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250611b95915050565b5050507f8374070d1462c8a234009e6e373359e53125a166122074cb0fa8fb984c4b0bfa81604051610b4f91906133d3565b60405180910390a15050600160c9555050565b610b6a611bc3565b610b7661010482611c64565b5050565b610b82611bc3565b610b768282611695565b610b94611bc3565b61010255565b610ba2611bc3565b610baa611c86565b565b600082815260656020526040902060010154610bc781611d0b565b610bd18383611d15565b505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610c7b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016108ee565b610b768282611e09565b6060610c92610104611ec4565b905090565b610c9f611bc3565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260fd6020526040902054811015610cfe576040517fb213476a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff909116600090815260fe6020526040902055565b610d2f611bc3565b73ffffffffffffffffffffffffffffffffffffffff8116610d7c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b766101048261166c565b610d90611ed1565b610d9b600033611e09565b610da6600082611d15565b50565b610db1611bc3565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260fe6020526040902054811115610e10576040517f94e31d0800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff909116600090815260fd6020526040902055565b610e41611bc3565b610103805460009182905590610e58908233611f39565b604080518281523360208201527f445ea353dd3cfa91aaa8ea899f31ffb4d03e783c45f0ef3717b46c32ea17969d910160405180910390a150565b610e9b611bc3565b620f4240816020015163ffffffff161115610ee2576040517fcd4e616700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b620f4240816040015163ffffffff161180610f095750620f4240816060015163ffffffff16115b15610f40576040517f2a07fc4c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff909116600090815260fb602090815260409182902083518154928501519385015160608601516080909601516fffffffffffffffffffffffffffffffff166d0100000000000000000000000000027fffffff00000000000000000000000000000000ffffffffffffffffffffffffff63ffffffff9788166901000000000000000000027fffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffff9389166501000000000002939093167fffffffffffffffffffffffffffffffffffffff0000000000000000ffffffffff98909716610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ff941515949094167fffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000909616959095179290921795909516939093179390931716179055565b61109f611bc3565b610baa611f7f565b6110af611bc3565b620f42408111156110ec576040517fcd4e616700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61010155565b6110fa611bc3565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260ff60205260408120549081900361115a576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260ff602052604081205561118b828233611f39565b6040805182815273ffffffffffffffffffffffffffffffffffffffff841660208201527f9216fa2f918153a5852ce98e7929c12cd94e0adeda8117f80e761c216157b27c910160405180910390a15050565b6000828152606560205260409020600101546111f881611d0b565b610bd18383611e09565b61120a611ed1565b610b76828233611f39565b600260c95403611281576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108ee565b600260c95561128e61182c565b836112a361099c610100830160e08401613042565b80156112b657506112b661010485611899565b6112ec576040517f91127ab800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611320333060208801803590611302908a613042565b73ffffffffffffffffffffffffffffffffffffffff16929190611fd6565b600060fb8161133560e0890160c08a01613042565b73ffffffffffffffffffffffffffffffffffffffff16815260208082019290925260409081016000908120825160a081018452905460ff811615158252610100810463ffffffff908116958301959095526501000000000081048516938201939093526901000000000000000000830490931660608401526d01000000000000000000000000009091046fffffffffffffffffffffffffffffffff1660808301529091506114066113ec60e0890160c08a01613042565b8360208a01803590600090611401908d613042565b611a47565b905061141f6114186020890189613042565b82886120b8565b600061142e6020890189613042565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa15801561149a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114be919061346b565b905061152a6114d46101008a0160e08b01613042565b87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611525925061151f91505060e08d0160c08e01613042565b876118c8565b611b95565b508161153960208a018a613042565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa1580156115a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c9919061346b565b6115d390836134b3565b1461160a576040517f119e050500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050507f8374070d1462c8a234009e6e373359e53125a166122074cb0fa8fb984c4b0bfa8160405161163c91906133d3565b60405180910390a15050600160c955505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b600061168e8373ffffffffffffffffffffffffffffffffffffffff8416612320565b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff821661171a575073ffffffffffffffffffffffffffffffffffffffff8216600081815260fc60209081526040808320805493905580518381529182019390935290917f445ea353dd3cfa91aaa8ea899f31ffb4d03e783c45f0ef3717b46c32ea17969d910160405180910390a15b73ffffffffffffffffffffffffffffffffffffffff8083166000908152610100602090815260408083209387168352929052205461175890826134ca565b905080600003611794576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8083166000908152610100602090815260408083209387168352929052908120556117d5828285611f39565b6040805182815273ffffffffffffffffffffffffffffffffffffffff84811660208301528516917f6f83ca8ce48e63b2a223b9f9e7ef1ea7bf3a8385c7a9bd63baae22963b2b26e0910160405180910390a2505050565b60975460ff1615610baa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016108ee565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600183016020526040812054151561168e565b60008060008084608001516fffffffffffffffffffffffffffffffff161180156118f0575083515b156119d85783608001516fffffffffffffffffffffffffffffffff169150620f4240846060015163ffffffff168361192891906134e2565b611932919061351f565b905061193e81836134b3565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260fc6020526040812080549091906119739084906134ca565b909155505073ffffffffffffffffffffffffffffffffffffffff85167f3a84e53f89d2f7779a9c9a54779858ae0eb0b7760d607b445b6fd175c30a04d4826119bb81866134b3565b6040805192835260208301919091520160405180910390a2611a1b565b61010254604080518281526000602082018190529294507f3a84e53f89d2f7779a9c9a54779858ae0eb0b7760d607b445b6fd175c30a04d4910160405180910390a25b806101036000828254611a2e91906134ca565b90915550611a3e905082346134b3565b95945050505050565b6000806000611a5787878761236f565b909250905073ffffffffffffffffffffffffffffffffffffffff881615611acd57611a8281836134b3565b73ffffffffffffffffffffffffffffffffffffffff808616600090815261010060209081526040808320938d1683529290529081208054909190611ac79084906134ca565b90915550505b73ffffffffffffffffffffffffffffffffffffffff8416600090815260ff602052604081208054839290611b029084906134ca565b909155505073ffffffffffffffffffffffffffffffffffffffff88167f25471ec9f39b4ceb20d58f63c37f9c738011f0babcc4b6af69bdd82984ca5f8e82611b4a81866134b3565b60408051928352602083019190915273ffffffffffffffffffffffffffffffffffffffff88169082015260600160405180910390a2611b8982876134b3565b98975050505050505050565b6060611bbb848484604051806060016040528060298152602001613725602991396123af565b949350505050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff1680611c2e57503360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff165b610baa576040517fe92bcd1400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061168e8373ffffffffffffffffffffffffffffffffffffffff8416612545565b611c8e61182c565b609780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611ce13390565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b610da68133612638565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610b7657600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055611dab3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1615610b7657600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6060600061168e8361270a565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff16610baa576040517f55098f2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316611f5e57610bd18183612766565b610bd173ffffffffffffffffffffffffffffffffffffffff841682846128c0565b611f87612916565b609780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611ce1565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526120b29085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612982565b50505050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8281166024830152849160009183169063dd62ed3e90604401602060405180830381865afa15801561212f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612153919061346b565b90508381101561231957806000036121ab576121a673ffffffffffffffffffffffffffffffffffffffff8316847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff612a8e565b612319565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602483015283169063095ea7b3906044016020604051808303816000875af1925050508015612279575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526122769181019061355a565b60015b6122e05761229f73ffffffffffffffffffffffffffffffffffffffff8316846000612a8e565b6121a673ffffffffffffffffffffffffffffffffffffffff8316847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff612a8e565b80612317576040517f3e3f8f7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b5050505050565b600081815260018301602052604081205461236757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610880565b506000610880565b600080846000015115612390576123868486612c10565b90925090506123a7565b6123a18461010154620f4240612c62565b91508190505b935093915050565b606082471015612441576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016108ee565b73ffffffffffffffffffffffffffffffffffffffff85163b6124bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108ee565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516124e891906135a3565b60006040518083038185875af1925050503d8060008114612525576040519150601f19603f3d011682016040523d82523d6000602084013e61252a565b606091505b509150915061253a828286612d32565b979650505050505050565b6000818152600183016020526040812054801561262e5760006125696001836134b3565b855490915060009061257d906001906134b3565b90508181146125e257600086600001828154811061259d5761259d6135bf565b90600052602060002001549050808760000184815481106125c0576125c06135bf565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806125f3576125f36135ee565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610880565b6000915050610880565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610b76576126908173ffffffffffffffffffffffffffffffffffffffff166014612d85565b61269b836020612d85565b6040516020016126ac92919061361d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526108ee9160040161369e565b60608160000180548060200260200160405190810160405280929190818152602001828054801561275a57602002820191906000526020600020905b815481526020019060010190808311612746575b50505050509050919050565b804710156127d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108ee565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461282a576040519150601f19603f3d011682016040523d82523d6000602084013e61282f565b606091505b5050905080610bd1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108ee565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610bd19084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612030565b60975460ff16610baa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016108ee565b60006129e4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612fc89092919063ffffffff16565b805190915015610bd15780806020019051810190612a02919061355a565b610bd1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016108ee565b801580612b2e57506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612b08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b2c919061346b565b155b612bba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016108ee565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610bd19084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401612030565b6000806000836020015163ffffffff161115612c5b57612c3e84846020015163ffffffff16620f4240612c62565b9150612c5882846040015163ffffffff16620f4240612c62565b90505b9250929050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85870985870292508281108382030391505080600003612cb95760008411612cae57600080fd5b50829004905061168e565b808411612cc557600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60608315612d4157508161168e565b825115612d515782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ee919061369e565b60606000612d948360026134e2565b612d9f9060026134ca565b67ffffffffffffffff811115612db757612db76131f8565b6040519080825280601f01601f191660200182016040528015612de1576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612e1857612e186135bf565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612e7b57612e7b6135bf565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000612eb78460026134e2565b612ec29060016134ca565b90505b6001811115612f5f577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612f0357612f036135bf565b1a60f81b828281518110612f1957612f196135bf565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93612f58816136ef565b9050612ec5565b50831561168e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108ee565b6060611bbb84846000856123af565b600060208284031215612fe957600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461168e57600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461303d57600080fd5b919050565b60006020828403121561305457600080fd5b61168e82613019565b6000610100828403121561307057600080fd5b50919050565b60008083601f84011261308857600080fd5b50813567ffffffffffffffff8111156130a057600080fd5b602083019150836020828501011115612c5b57600080fd5b600080600061012084860312156130ce57600080fd5b6130d8858561305d565b925061010084013567ffffffffffffffff8111156130f557600080fd5b61310186828701613076565b9497909650939450505050565b6000806040838503121561312157600080fd5b61312a83613019565b9150612c5860208401613019565b60006020828403121561314a57600080fd5b5035919050565b6000806040838503121561316457600080fd5b82359150612c5860208401613019565b6020808252825182820181905260009190848201906040850190845b818110156131c257835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101613190565b50909695505050505050565b600080604083850312156131e157600080fd5b6131ea83613019565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610da657600080fd5b803561303d81613227565b803563ffffffff8116811461303d57600080fd5b80356fffffffffffffffffffffffffffffffff8116811461303d57600080fd5b60008082840360c081121561328857600080fd5b61329184613019565b925060a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0820112156132c357600080fd5b5060405160a0810181811067ffffffffffffffff8211171561330e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405261331d60208501613235565b815261332b60408501613240565b602082015261333c60608501613240565b604082015261334d60808501613240565b606082015261335e60a08501613254565b6080820152809150509250929050565b600080600080610140858703121561338557600080fd5b61338f868661305d565b935061339e6101008601613019565b925061012085013567ffffffffffffffff8111156133bb57600080fd5b6133c787828801613076565b95989497509550505050565b610100810173ffffffffffffffffffffffffffffffffffffffff806133f785613019565b16835260208401356020840152604084013560408401528061341b60608601613019565b166060840152608084013560808401528061343860a08601613019565b1660a08401528061344b60c08601613019565b1660c08401528061345e60e08601613019565b1660e08401525092915050565b60006020828403121561347d57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000828210156134c5576134c5613484565b500390565b600082198211156134dd576134dd613484565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561351a5761351a613484565b500290565b600082613555577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006020828403121561356c57600080fd5b815161168e81613227565b60005b8381101561359257818101518382015260200161357a565b838111156120b25750506000910152565b600082516135b5818460208701613577565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613655816017850160208801613577565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613692816028840160208801613577565b01602801949350505050565b60208152600082518060208401526136bd816040850160208701613577565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000816136fe576136fe613484565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a164736f6c634300080f000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005dc00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000663dc15d3c1ac63ff12e45ab68fea3f0a883c251000000000000000000000000362fa9d0bca5d19f743db50738345ce2b40ec99f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _fixedCryptoFee (uint256): 0
Arg [1] : _RubicPlatformFee (uint256): 1500
Arg [2] : _routers (address[]): 0x663DC15D3C1aC63ff12E45Ab68FeA3F0a883C251,0x362fA9D0bCa5D19f743Db50738345ce2b40eC99f,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000
Arg [3] : _tokens (address[]):
Arg [4] : _minTokenAmounts (uint256[]):
Arg [5] : _maxTokenAmounts (uint256[]):
-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 00000000000000000000000000000000000000000000000000000000000005dc
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [5] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [7] : 000000000000000000000000663dc15d3c1ac63ff12e45ab68fea3f0a883c251
Arg [8] : 000000000000000000000000362fa9d0bca5d19f743db50738345ce2b40ec99f
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$16.08
Net Worth in GLMR
Token Allocations
USDC.E
46.18%
XDAI
18.65%
ETH
8.20%
Others
26.98%
Multichain Portfolio | 35 Chains
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.