Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
| Transaction Hash |
Method
|
Block
|
From
|
To
|
Amount
|
||||
|---|---|---|---|---|---|---|---|---|---|
Loading...
Loading
Contract Name:
ProtocolShareReserve
Compiler Version
v0.8.25+commit.b61c2a91
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;
import { SafeERC20Upgradeable, IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { MaxLoopsLimitHelper } from "@venusprotocol/solidity-utilities/contracts/MaxLoopsLimitHelper.sol";
import { ensureNonzeroAddress } from "@venusprotocol/solidity-utilities/contracts/validators.sol";
import { IProtocolShareReserve } from "../Interfaces/IProtocolShareReserve.sol";
import { IComptroller } from "../Interfaces/IComptroller.sol";
import { IPoolRegistry } from "../Interfaces/IPoolRegistry.sol";
import { IVToken } from "../Interfaces/IVToken.sol";
import { IIncomeDestination } from "../Interfaces/IIncomeDestination.sol";
error InvalidAddress();
error UnsupportedAsset();
error InvalidTotalPercentage();
error InvalidMaxLoopsLimit();
contract ProtocolShareReserve is
AccessControlledV8,
ReentrancyGuardUpgradeable,
MaxLoopsLimitHelper,
IProtocolShareReserve
{
using SafeERC20Upgradeable for IERC20Upgradeable;
/// @notice protocol income is categorized into two schemas.
/// The first schema is for spread income
/// The second schema is for liquidation income
enum Schema {
PROTOCOL_RESERVES,
ADDITIONAL_REVENUE
}
struct DistributionConfig {
Schema schema;
/// @dev percenatge is represented without any scale
uint16 percentage;
address destination;
}
/// @notice address of core pool comptroller contract
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
address public immutable CORE_POOL_COMPTROLLER;
/// @notice address of WBNB contract
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
address public immutable WBNB;
/// @notice address of vBNB contract
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
address public immutable vBNB;
/// @notice address of pool registry contract
address public poolRegistry;
uint16 public constant MAX_PERCENT = 1e4;
/// @notice comptroller => asset => schema => balance
mapping(address => mapping(address => mapping(Schema => uint256))) public assetsReserves;
/// @notice asset => balance
mapping(address => uint256) public totalAssetReserve;
/// @notice configuration for different income distribution targets
DistributionConfig[] public distributionTargets;
/// @notice Emitted when pool registry address is updated
event PoolRegistryUpdated(address indexed oldPoolRegistry, address indexed newPoolRegistry);
/// @notice Event emitted after updating of the assets reserves.
event AssetsReservesUpdated(
address indexed comptroller,
address indexed asset,
uint256 amount,
IncomeType incomeType,
Schema schema
);
/// @notice Event emitted when an asset is released to a target
event AssetReleased(
address indexed destination,
address indexed asset,
Schema schema,
uint256 percent,
uint256 amount
);
/// @notice Event emitted when asset reserves state is updated
event ReservesUpdated(
address indexed comptroller,
address indexed asset,
Schema schema,
uint256 oldBalance,
uint256 newBalance
);
/// @notice Event emitted when distribution configuration is updated
event DistributionConfigUpdated(
address indexed destination,
uint16 oldPercentage,
uint16 newPercentage,
Schema schema
);
/// @notice Event emitted when distribution configuration is added
event DistributionConfigAdded(address indexed destination, uint16 percentage, Schema schema);
/// @notice Event emitted when distribution configuration is removed
event DistributionConfigRemoved(address indexed destination, uint16 percentage, Schema schema);
/**
* @dev Constructor to initialize the immutable variables
* @param _corePoolComptroller The address of core pool comptroller
* @param _wbnb The address of WBNB
* @param _vbnb The address of vBNB
*/
/// @custom:oz-upgrades-unsafe-allow constructor
constructor(
address _corePoolComptroller,
address _wbnb,
address _vbnb
) {
ensureNonzeroAddress(_corePoolComptroller);
ensureNonzeroAddress(_wbnb);
ensureNonzeroAddress(_vbnb);
CORE_POOL_COMPTROLLER = _corePoolComptroller;
WBNB = _wbnb;
vBNB = _vbnb;
// Note that the contract is upgradeable. Use initialize() or reinitializers
// to set the state variables.
_disableInitializers();
}
/**
* @dev Initializes the deployer to owner.
* @param _accessControlManager The address of ACM contract
* @param _loopsLimit Limit for the loops in the contract to avoid DOS
*/
function initialize(address _accessControlManager, uint256 _loopsLimit) external initializer {
__AccessControlled_init(_accessControlManager);
__ReentrancyGuard_init();
_setMaxLoopsLimit(_loopsLimit);
}
/**
* @dev Pool registry setter.
* @param _poolRegistry Address of the pool registry
* @custom:error ZeroAddressNotAllowed is thrown when pool registry address is zero
*/
function setPoolRegistry(address _poolRegistry) external onlyOwner {
ensureNonzeroAddress(_poolRegistry);
emit PoolRegistryUpdated(poolRegistry, _poolRegistry);
poolRegistry = _poolRegistry;
}
/**
* @dev Add or update destination targets based on destination address
* @param configs configurations of the destinations.
*/
function addOrUpdateDistributionConfigs(DistributionConfig[] calldata configs) external nonReentrant {
_checkAccessAllowed("addOrUpdateDistributionConfigs(DistributionConfig[])");
for (uint256 i = 0; i < configs.length; ) {
DistributionConfig memory _config = configs[i];
ensureNonzeroAddress(_config.destination);
bool updated = false;
uint256 distributionTargetsLength = distributionTargets.length;
for (uint256 j = 0; j < distributionTargetsLength; ) {
DistributionConfig storage config = distributionTargets[j];
if (_config.schema == config.schema && config.destination == _config.destination) {
emit DistributionConfigUpdated(
_config.destination,
config.percentage,
_config.percentage,
_config.schema
);
config.percentage = _config.percentage;
updated = true;
break;
}
unchecked {
++j;
}
}
if (!updated) {
distributionTargets.push(_config);
emit DistributionConfigAdded(_config.destination, _config.percentage, _config.schema);
}
unchecked {
++i;
}
}
_ensurePercentages();
_ensureMaxLoops(distributionTargets.length);
}
/**
* @dev Remove destionation target if percentage is 0
* @param schema schema of the configuration
* @param destination destination address of the configuration
*/
function removeDistributionConfig(Schema schema, address destination) external {
_checkAccessAllowed("removeDistributionConfig(Schema,address)");
uint256 distributionIndex;
bool found = false;
for (uint256 i = 0; i < distributionTargets.length; ) {
DistributionConfig storage config = distributionTargets[i];
if (schema == config.schema && destination == config.destination && config.percentage == 0) {
found = true;
distributionIndex = i;
break;
}
unchecked {
++i;
}
}
if (found) {
emit DistributionConfigRemoved(
distributionTargets[distributionIndex].destination,
distributionTargets[distributionIndex].percentage,
distributionTargets[distributionIndex].schema
);
distributionTargets[distributionIndex] = distributionTargets[distributionTargets.length - 1];
distributionTargets.pop();
}
_ensurePercentages();
}
/**
* @dev Release funds
* @param comptroller the comptroller address of the pool
* @param assets assets to be released to distribution targets
*/
function releaseFunds(address comptroller, address[] calldata assets) external nonReentrant {
for (uint256 i = 0; i < assets.length; ) {
_releaseFund(comptroller, assets[i]);
unchecked {
++i;
}
}
}
/**
* @dev Used to find out the amount of funds that's going to be released when release funds is called.
* @param comptroller the comptroller address of the pool
* @param schema the schema of the distribution target
* @param destination the destination address of the distribution target
* @param asset the asset address which will be released
*/
function getUnreleasedFunds(
address comptroller,
Schema schema,
address destination,
address asset
) external view returns (uint256) {
uint256 distributionTargetsLength = distributionTargets.length;
for (uint256 i = 0; i < distributionTargetsLength; ) {
DistributionConfig storage _config = distributionTargets[i];
if (_config.schema == schema && _config.destination == destination) {
uint256 total = assetsReserves[comptroller][asset][schema];
return (total * _config.percentage) / MAX_PERCENT;
}
unchecked {
++i;
}
}
}
/**
* @dev Returns the total number of distribution targets
*/
function totalDistributions() external view returns (uint256) {
return distributionTargets.length;
}
/**
* @dev Used to find out the percentage distribution for a particular destination based on schema
* @param destination the destination address of the distribution target
* @param schema the schema of the distribution target
* @return percentage percentage distribution
*/
function getPercentageDistribution(address destination, Schema schema) external view returns (uint256) {
uint256 distributionTargetsLength = distributionTargets.length;
for (uint256 i = 0; i < distributionTargetsLength; ) {
DistributionConfig memory config = distributionTargets[i];
if (config.destination == destination && config.schema == schema) {
return config.percentage;
}
unchecked {
++i;
}
}
}
/**
* @dev Update the reserve of the asset for the specific pool after transferring to the protocol share reserve.
* @param comptroller Comptroller address (pool)
* @param asset Asset address.
* @param incomeType type of income
*/
function updateAssetsState(
address comptroller,
address asset,
IncomeType incomeType
) public override(IProtocolShareReserve) nonReentrant {
if (!IComptroller(comptroller).isComptroller()) revert InvalidAddress();
ensureNonzeroAddress(asset);
if (
comptroller != CORE_POOL_COMPTROLLER &&
IPoolRegistry(poolRegistry).getVTokenForAsset(comptroller, asset) == address(0)
) revert InvalidAddress();
Schema schema = _getSchema(incomeType);
uint256 currentBalance = IERC20Upgradeable(asset).balanceOf(address(this));
uint256 assetReserve = totalAssetReserve[asset];
if (currentBalance > assetReserve) {
uint256 balanceDifference;
unchecked {
balanceDifference = currentBalance - assetReserve;
}
assetsReserves[comptroller][asset][schema] += balanceDifference;
totalAssetReserve[asset] += balanceDifference;
emit AssetsReservesUpdated(comptroller, asset, balanceDifference, incomeType, schema);
}
}
/**
* @dev asset from a particular pool to be release to distribution targets
* @param comptroller Comptroller address(pool)
* @param asset Asset address.
*/
function _releaseFund(address comptroller, address asset) internal {
uint256 totalSchemas = uint256(type(Schema).max) + 1;
uint256[] memory schemaBalances = new uint256[](totalSchemas);
uint256 totalBalance;
for (uint256 schemaValue; schemaValue < totalSchemas; ) {
schemaBalances[schemaValue] = assetsReserves[comptroller][asset][Schema(schemaValue)];
totalBalance += schemaBalances[schemaValue];
unchecked {
++schemaValue;
}
}
if (totalBalance == 0) {
return;
}
uint256[] memory totalTransferAmounts = new uint256[](totalSchemas);
for (uint256 i = 0; i < distributionTargets.length; ) {
DistributionConfig memory _config = distributionTargets[i];
uint256 transferAmount = (schemaBalances[uint256(_config.schema)] * _config.percentage) / MAX_PERCENT;
totalTransferAmounts[uint256(_config.schema)] += transferAmount;
if (transferAmount != 0) {
IERC20Upgradeable(asset).safeTransfer(_config.destination, transferAmount);
IIncomeDestination(_config.destination).updateAssetsState(comptroller, asset);
emit AssetReleased(_config.destination, asset, _config.schema, _config.percentage, transferAmount);
}
unchecked {
++i;
}
}
uint256[] memory newSchemaBalances = new uint256[](totalSchemas);
for (uint256 schemaValue = 0; schemaValue < totalSchemas; ) {
newSchemaBalances[schemaValue] = schemaBalances[schemaValue] - totalTransferAmounts[schemaValue];
assetsReserves[comptroller][asset][Schema(schemaValue)] = newSchemaBalances[schemaValue];
totalAssetReserve[asset] = totalAssetReserve[asset] - totalTransferAmounts[schemaValue];
emit ReservesUpdated(
comptroller,
asset,
Schema(schemaValue),
schemaBalances[schemaValue],
newSchemaBalances[schemaValue]
);
unchecked {
++schemaValue;
}
}
}
/**
* @dev Returns the schema based on income type
* @param incomeType type of income
* @return schema schema for distribution
*/
function _getSchema(IncomeType incomeType) internal view returns (Schema schema) {
schema = Schema.ADDITIONAL_REVENUE;
if (incomeType == IncomeType.SPREAD) {
schema = Schema.PROTOCOL_RESERVES;
}
}
/**
* @dev This ensures that the total percentage of all the distribution targets is 100% or 0%
*/
function _ensurePercentages() internal view {
uint256 totalSchemas = uint256(type(Schema).max) + 1;
uint16[] memory totalPercentages = new uint16[](totalSchemas);
uint256 distributionTargetsLength = distributionTargets.length;
for (uint256 i = 0; i < distributionTargetsLength; ) {
DistributionConfig memory config = distributionTargets[i];
totalPercentages[uint256(config.schema)] += config.percentage;
unchecked {
++i;
}
}
for (uint256 schemaValue = 0; schemaValue < totalSchemas; ) {
if (totalPercentages[schemaValue] != MAX_PERCENT && totalPercentages[schemaValue] != 0)
revert InvalidTotalPercentage();
unchecked {
++schemaValue;
}
}
}
/**
* @dev Returns the underlying asset address for the vToken
* @param vToken vToken address
* @return asset address of asset
*/
function _getUnderlying(address vToken) internal view returns (address) {
if (vToken == vBNB) {
return WBNB;
} else {
return IVToken(vToken).underlying();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.0;
import "./OwnableUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
function __Ownable2Step_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable2Step_init_unchained() internal onlyInitializing {
}
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
/**
* @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.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @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.9.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]
* ```solidity
* 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.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
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.
*
* 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.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* 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.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
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.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _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
// OpenZeppelin Contracts (last updated v4.9.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.9.0) (token/ERC20/extensions/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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
import "../extensions/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;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
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));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
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");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
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");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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/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 v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @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: BSD-3-Clause
pragma solidity 0.8.25;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import "./IAccessControlManagerV8.sol";
/**
* @title AccessControlledV8
* @author Venus
* @notice This contract is helper between access control manager and actual contract. This contract further inherited by other contract (using solidity 0.8.13)
* to integrate access controlled mechanism. It provides initialise methods and verifying access methods.
*/
abstract contract AccessControlledV8 is Initializable, Ownable2StepUpgradeable {
/// @notice Access control manager contract
IAccessControlManagerV8 private _accessControlManager;
/**
* @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;
/// @notice Emitted when access control manager contract address is changed
event NewAccessControlManager(address oldAccessControlManager, address newAccessControlManager);
/// @notice Thrown when the action is prohibited by AccessControlManager
error Unauthorized(address sender, address calledContract, string methodSignature);
function __AccessControlled_init(address accessControlManager_) internal onlyInitializing {
__Ownable2Step_init();
__AccessControlled_init_unchained(accessControlManager_);
}
function __AccessControlled_init_unchained(address accessControlManager_) internal onlyInitializing {
_setAccessControlManager(accessControlManager_);
}
/**
* @notice Sets the address of AccessControlManager
* @dev Admin function to set address of AccessControlManager
* @param accessControlManager_ The new address of the AccessControlManager
* @custom:event Emits NewAccessControlManager event
* @custom:access Only Governance
*/
function setAccessControlManager(address accessControlManager_) external onlyOwner {
_setAccessControlManager(accessControlManager_);
}
/**
* @notice Returns the address of the access control manager contract
*/
function accessControlManager() external view returns (IAccessControlManagerV8) {
return _accessControlManager;
}
/**
* @dev Internal function to set address of AccessControlManager
* @param accessControlManager_ The new address of the AccessControlManager
*/
function _setAccessControlManager(address accessControlManager_) internal {
require(address(accessControlManager_) != address(0), "invalid acess control manager address");
address oldAccessControlManager = address(_accessControlManager);
_accessControlManager = IAccessControlManagerV8(accessControlManager_);
emit NewAccessControlManager(oldAccessControlManager, accessControlManager_);
}
/**
* @notice Reverts if the call is not allowed by AccessControlManager
* @param signature Method signature
*/
function _checkAccessAllowed(string memory signature) internal view {
bool isAllowedToCall = _accessControlManager.isAllowedToCall(msg.sender, signature);
if (!isAllowedToCall) {
revert Unauthorized(msg.sender, address(this), signature);
}
}
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;
import "@openzeppelin/contracts/access/IAccessControl.sol";
/**
* @title IAccessControlManagerV8
* @author Venus
* @notice Interface implemented by the `AccessControlManagerV8` contract.
*/
interface IAccessControlManagerV8 is IAccessControl {
function giveCallPermission(address contractAddress, string calldata functionSig, address accountToPermit) external;
function revokeCallPermission(
address contractAddress,
string calldata functionSig,
address accountToRevoke
) external;
function isAllowedToCall(address account, string calldata functionSig) external view returns (bool);
function hasPermission(
address account,
address contractAddress,
string calldata functionSig
) external view returns (bool);
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;
/**
* @title MaxLoopsLimitHelper
* @author Venus
* @notice Abstract contract used to avoid collection with too many items that would generate gas errors and DoS.
*/
abstract contract MaxLoopsLimitHelper {
// Limit for the loops to avoid the DOS
uint256 public maxLoopsLimit;
/**
* @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;
/// @notice Emitted when max loops limit is set
event MaxLoopsLimitUpdated(uint256 oldMaxLoopsLimit, uint256 newmaxLoopsLimit);
/// @notice Thrown an error on maxLoopsLimit exceeds for any loop
error MaxLoopsLimitExceeded(uint256 loopsLimit, uint256 requiredLoops);
/**
* @notice Set the limit for the loops can iterate to avoid the DOS
* @param limit Limit for the max loops can execute at a time
*/
function _setMaxLoopsLimit(uint256 limit) internal {
require(limit > maxLoopsLimit, "Comptroller: Invalid maxLoopsLimit");
uint256 oldMaxLoopsLimit = maxLoopsLimit;
maxLoopsLimit = limit;
emit MaxLoopsLimitUpdated(oldMaxLoopsLimit, limit);
}
/**
* @notice Compare the maxLoopsLimit with number of the times loop iterate
* @param len Length of the loops iterate
* @custom:error MaxLoopsLimitExceeded error is thrown when loops length exceeds maxLoopsLimit
*/
function _ensureMaxLoops(uint256 len) internal view {
if (len > maxLoopsLimit) {
revert MaxLoopsLimitExceeded(maxLoopsLimit, len);
}
}
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;
/// @notice Thrown if the supplied address is a zero address where it is not allowed
error ZeroAddressNotAllowed();
/// @notice Thrown if the supplied value is 0 where it is not allowed
error ZeroValueNotAllowed();
/// @notice Checks if the provided address is nonzero, reverts otherwise
/// @param address_ Address to check
/// @custom:error ZeroAddressNotAllowed is thrown if the provided address is a zero address
function ensureNonzeroAddress(address address_) pure {
if (address_ == address(0)) {
revert ZeroAddressNotAllowed();
}
}
/// @notice Checks if the provided value is nonzero, reverts otherwise
/// @param value_ Value to check
/// @custom:error ZeroValueNotAllowed is thrown if the provided value is 0
function ensureNonzeroValue(uint256 value_) pure {
if (value_ == 0) {
revert ZeroValueNotAllowed();
}
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;
interface IComptroller {
function isComptroller() external view returns (bool);
function markets(address) external view returns (bool);
function getAllMarkets() external view returns (address[] memory);
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;
interface IIncomeDestination {
function updateAssetsState(address comptroller, address asset) external;
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;
interface IPoolRegistry {
/// @notice Get VToken in the Pool for an Asset
function getVTokenForAsset(address comptroller, address asset) external view returns (address);
/// @notice Get the addresss of the Pools supported that include a market for the provided asset
function getPoolsSupportedByAsset(address asset) external view returns (address[] memory);
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;
interface IProtocolShareReserve {
/// @notice it represents the type of vToken income
enum IncomeType {
SPREAD,
LIQUIDATION
}
function updateAssetsState(
address comptroller,
address asset,
IncomeType incomeType
) external;
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;
interface IVToken {
function underlying() external view returns (address);
}{
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 10000
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract ABI
API[{"inputs":[{"internalType":"address","name":"_corePoolComptroller","type":"address"},{"internalType":"address","name":"_wbnb","type":"address"},{"internalType":"address","name":"_vbnb","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidTotalPercentage","type":"error"},{"inputs":[{"internalType":"uint256","name":"loopsLimit","type":"uint256"},{"internalType":"uint256","name":"requiredLoops","type":"uint256"}],"name":"MaxLoopsLimitExceeded","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"calledContract","type":"address"},{"internalType":"string","name":"methodSignature","type":"string"}],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"ZeroAddressNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"percent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AssetReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"comptroller","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"enum IProtocolShareReserve.IncomeType","name":"incomeType","type":"uint8"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"AssetsReservesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint16","name":"percentage","type":"uint16"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"DistributionConfigAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint16","name":"percentage","type":"uint16"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"DistributionConfigRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint16","name":"oldPercentage","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"newPercentage","type":"uint16"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"DistributionConfigUpdated","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":"oldMaxLoopsLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newmaxLoopsLimit","type":"uint256"}],"name":"MaxLoopsLimitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAccessControlManager","type":"address"},{"indexed":false,"internalType":"address","name":"newAccessControlManager","type":"address"}],"name":"NewAccessControlManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldPoolRegistry","type":"address"},{"indexed":true,"internalType":"address","name":"newPoolRegistry","type":"address"}],"name":"PoolRegistryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"comptroller","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"oldBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"ReservesUpdated","type":"event"},{"inputs":[],"name":"CORE_POOL_COMPTROLLER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PERCENT","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WBNB","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"accessControlManager","outputs":[{"internalType":"contract IAccessControlManagerV8","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"uint16","name":"percentage","type":"uint16"},{"internalType":"address","name":"destination","type":"address"}],"internalType":"struct ProtocolShareReserve.DistributionConfig[]","name":"configs","type":"tuple[]"}],"name":"addOrUpdateDistributionConfigs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"enum ProtocolShareReserve.Schema","name":"","type":"uint8"}],"name":"assetsReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"distributionTargets","outputs":[{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"uint16","name":"percentage","type":"uint16"},{"internalType":"address","name":"destination","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"destination","type":"address"},{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"getPercentageDistribution","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"comptroller","type":"address"},{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"address","name":"destination","type":"address"},{"internalType":"address","name":"asset","type":"address"}],"name":"getUnreleasedFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_accessControlManager","type":"address"},{"internalType":"uint256","name":"_loopsLimit","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxLoopsLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"comptroller","type":"address"},{"internalType":"address[]","name":"assets","type":"address[]"}],"name":"releaseFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"address","name":"destination","type":"address"}],"name":"removeDistributionConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"accessControlManager_","type":"address"}],"name":"setAccessControlManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poolRegistry","type":"address"}],"name":"setPoolRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalAssetReserve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDistributions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"comptroller","type":"address"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"enum IProtocolShareReserve.IncomeType","name":"incomeType","type":"uint8"}],"name":"updateAssetsState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vBNB","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60e060405234801561001057600080fd5b50604051612f32380380612f3283398101604081905261002f91610178565b61003883610073565b61004182610073565b61004a81610073565b6001600160a01b0380841660805282811660a052811660c05261006b61009d565b5050506101bb565b6001600160a01b03811661009a576040516342bcdf7f60e11b815260040160405180910390fd5b50565b600054610100900460ff16156101095760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161461015a576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b80516001600160a01b038116811461017357600080fd5b919050565b60008060006060848603121561018d57600080fd5b6101968461015c565b92506101a46020850161015c565b91506101b26040850161015c565b90509250925092565b60805160a05160c051612d416101f16000396000610209015260006103090152600081816103c901526104bc0152612d416000f3fe608060405234801561001057600080fd5b50600436106101a35760003560e01c8063893ffe98116100ee578063b4a0bdf311610097578063e30c397811610071578063e30c3978146103a0578063f2fde38b146103b1578063fa7b81a0146103c4578063fc31116a146103eb57600080fd5b8063b4a0bdf314610373578063be26317e14610384578063cd6dc6871461038d57600080fd5b8063966961f0116100c8578063966961f01461032b578063aea211211461033e578063afcff50f1461035f57600080fd5b8063893ffe98146102e05780638da5cb5b146102f35780638dd950021461030457600080fd5b80634f429f3611610150578063715018a61161012a578063715018a6146102bd57806379ba5097146102c55780637b77cd6a146102cd57600080fd5b80634f429f36146102655780635db6da12146102785780635f3d6133146102aa57600080fd5b806316faecec1161018157806316faecec146101f157806333e1567f14610204578063392ee7121461024357600080fd5b80630e32cb86146101a85780631036bbe2146101bd578063163db71b146101de575b600080fd5b6101bb6101b63660046125a8565b6103fe565b005b6101c661271081565b60405161ffff90911681526020015b60405180910390f35b610130545b6040519081526020016101d5565b6101bb6101ff3660046125d9565b610412565b61022b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101d5565b610256610251366004612624565b610788565b6040516101d5939291906126a3565b6101bb6102733660046126d1565b6107c8565b6101e36102863660046125d9565b61012e60209081526000938452604080852082529284528284209052825290205481565b6101bb6102b836600461270a565b610b0a565b6101bb610e19565b6101bb610e2d565b6101bb6102db3660046125a8565b610ebd565b6101e36102ee36600461277f565b610f44565b6033546001600160a01b031661022b565b61022b7f000000000000000000000000000000000000000000000000000000000000000081565b6101e36103393660046127db565b611066565b6101e361034c3660046125a8565b61012f6020526000908152604090205481565b61012d5461022b906001600160a01b031681565b6097546001600160a01b031661022b565b6101e360fb5481565b6101bb61039b366004612809565b61115b565b6065546001600160a01b031661022b565b6101bb6103bf3660046125a8565b6112e6565b61022b7f000000000000000000000000000000000000000000000000000000000000000081565b6101bb6103f9366004612835565b61136f565b6104066113c5565b61040f8161141f565b50565b61041a611515565b826001600160a01b0316627e3dd26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610457573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047b91906128bd565b6104b1576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6104ba8261156e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614158015610593575061012d546040517f266e0a7f0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528481166024830152600092169063266e0a7f90604401602060405180830381865afa158015610564573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058891906128df565b6001600160a01b0316145b156105ca576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006105d5826115ae565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529091506000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610638573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065c91906128fc565b6001600160a01b038516600090815261012f602052604090205490915080821115610776576001600160a01b03808716600090815261012e602090815260408083209389168352929052908120828403918291908660018111156106c2576106c261263d565b60018111156106d3576106d361263d565b815260200190815260200160002060008282546106f09190612944565b90915550506001600160a01b038616600090815261012f60205260408120805483929061071e908490612944565b92505081905550856001600160a01b0316876001600160a01b03167fa46b2431e663cf7b50c9d5129aff85d2394ecfd447b7ccba83986510a9d945ea83888860405161076c93929190612957565b60405180910390a3505b505050610783600160c955565b505050565b610130818154811061079957600080fd5b60009182526020909120015460ff81169150610100810461ffff1690630100000090046001600160a01b031683565b6107e9604051806060016040528060288152602001612cb0602891396115d9565b600080805b61013054811015610894576000610130828154811061080f5761080f612984565b6000918252602090912001805490915060ff1660018111156108335761083361263d565b8660018111156108455761084561263d565b148015610865575080546001600160a01b03868116630100000090920416145b801561087957508054610100900461ffff16155b1561088b576001925081935050610894565b506001016107ee565b508015610afc5761013082815481106108af576108af612984565b9060005260206000200160000160039054906101000a90046001600160a01b03166001600160a01b03167f70e7a210881df49522a5bf05d477e00d59e52a41c96c1eedeaeb356b9e6c81cc610130848154811061090e5761090e612984565b9060005260206000200160000160019054906101000a900461ffff16610130858154811061093e5761093e612984565b60009182526020909120015460405161095b929160ff16906129b3565b60405180910390a26101308054610974906001906129d4565b8154811061098457610984612984565b9060005260206000200161013083815481106109a2576109a2612984565b60009182526020909120825491018054909160ff169082907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183818111156109ef576109ef61263d565b02179055508154815461ffff61010092839004169091027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ff82168117835592546001600160a01b0363010000009182900416027fffffffffffffffffff0000000000000000000000000000000000000000ffffff9093167fffffffffffffffffff00000000000000000000000000000000000000000000ff90911617919091179055610130805480610aa357610aa36129e7565b60008281526020902081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffff00000000000000000000000000000000000000000000001690550190555b610b046116a5565b50505050565b610b12611515565b610b33604051806060016040528060348152602001612cd8603491396115d9565b60005b81811015610df5576000838383818110610b5257610b52612984565b905060600201803603810190610b689190612a45565b9050610b77816040015161156e565b61013054600090815b81811015610ca55760006101308281548110610b9e57610b9e612984565b6000918252602090912001805490915060ff166001811115610bc257610bc261263d565b85516001811115610bd557610bd561263d565b148015610bfa575060408501518154630100000090046001600160a01b039081169116145b15610c9c5760408581015182546020880151885193516001600160a01b03909316937fa682db621f4ae1c92cd6c492151d32fe657fc6db6e87bd65eb8bda05311f6ef293610c5393610100900461ffff16929190612ae5565b60405180910390a26020850151815461ffff909116610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ff90911617905560019250610ca5565b50600101610b80565b5081610de75761013080546001818101835560009290925284517f2f605e086faac1d93117bbfbc18835d434e9405fadc1ca66faf4b864746daf349091018054869391929183917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016908381811115610d2057610d2061263d565b021790555060208281015182546040948501517fffffffffffffffffff00000000000000000000000000000000000000000000ff90911661010061ffff909316929092027fffffffffffffffffff0000000000000000000000000000000000000000ffffff169190911763010000006001600160a01b03928316021790925585830151908601518651935191909216927f8c96910d818618d8b1de4e1b5672a192443e87aa553f0ebe4c47f9d8c928b28292610dde929091906129b3565b60405180910390a25b836001019350505050610b36565b50610dfe6116a5565b61013054610e0b9061187d565b610e15600160c955565b5050565b610e216113c5565b610e2b60006118c7565b565b60655433906001600160a01b03168114610eb45760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61040f816118c7565b610ec56113c5565b610ece8161156e565b61012d546040516001600160a01b038084169216907fa87b964d321035d2165e484ff4b722dd6eae30606c0b98887d2ed1a34e594bfe90600090a361012d80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b61013054600090815b8181101561105b5760006101308281548110610f6b57610f6b612984565b906000526020600020019050866001811115610f8957610f8961263d565b815460ff166001811115610f9f57610f9f61263d565b148015610fbf575080546001600160a01b03878116630100000090920416145b15611052576001600160a01b03808916600090815261012e60209081526040808320938916835292905290812081896001811115610fff57610fff61263d565b60018111156110105761101061263d565b815260208101919091526040016000205482549091506127109061103d90610100900461ffff1683612b01565b6110479190612b18565b94505050505061105e565b50600101610f4d565b50505b949350505050565b61013054600090815b81811015611152576000610130828154811061108d5761108d612984565b60009182526020909120604080516060810190915291018054829060ff1660018111156110bc576110bc61263d565b60018111156110cd576110cd61263d565b81529054610100810461ffff166020830152630100000090046001600160a01b03908116604092830152908201519192508781169116148015611132575084600181111561111d5761111d61263d565b815160018111156111305761113061263d565b145b15611149576020015161ffff169250611155915050565b5060010161106f565b50505b92915050565b600054610100900460ff161580801561117b5750600054600160ff909116105b806111955750303b158015611195575060005460ff166001145b6112075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610eab565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561126557600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b61126e836118f8565b611276611986565b61127f82611a0b565b801561078357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6112ee6113c5565b606580546001600160a01b0383167fffffffffffffffffffffffff000000000000000000000000000000000000000090911681179091556113376033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b611377611515565b60005b818110156113ba576113b28484848481811061139857611398612984565b90506020020160208101906113ad91906125a8565b611ac0565b60010161137a565b50610783600160c955565b6033546001600160a01b03163314610e2b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610eab565b6001600160a01b03811661149b5760405162461bcd60e51b815260206004820152602560248201527f696e76616c696420616365737320636f6e74726f6c206d616e6167657220616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610eab565b609780546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f66fd58e82f7b31a2a5c30e0888f3093efe4e111b00cd2b0c31fe014601293aa091015b60405180910390a15050565b600260c954036115675760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610eab565b600260c955565b6001600160a01b03811661040f576040517f8579befe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008260018111156115c4576115c461263d565b036115cd575060005b919050565b600160c955565b6097546040517f18c5e8ab0000000000000000000000000000000000000000000000000000000081526000916001600160a01b0316906318c5e8ab906116259033908690600401612bc1565b602060405180830381865afa158015611642573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166691906128bd565b905080610e15573330836040517f4a3fa293000000000000000000000000000000000000000000000000000000008152600401610eab93929190612be3565b60006116b2600180612944565b905060008167ffffffffffffffff8111156116cf576116cf612a16565b6040519080825280602002602001820160405280156116f8578160200160208202803683370190505b506101305490915060005b818110156117e1576000610130828154811061172157611721612984565b60009182526020909120604080516060810190915291018054829060ff1660018111156117505761175061263d565b60018111156117615761176161263d565b81529054610100810461ffff1660208084019190915263010000009091046001600160a01b0316604090920191909152810151815191925090859060018111156117ad576117ad61263d565b815181106117bd576117bd612984565b602002602001018181516117d19190612c18565b61ffff1690525050600101611703565b5060005b83811015610b045761271061ffff1683828151811061180657611806612984565b602002602001015161ffff161415801561183e575082818151811061182d5761182d612984565b602002602001015161ffff16600014155b15611875576040517f0b8ad7f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001016117e5565b60fb5481111561040f5760fb546040517ff257f636000000000000000000000000000000000000000000000000000000008152600481019190915260248101829052604401610eab565b606580547fffffffffffffffffffffffff000000000000000000000000000000000000000016905561040f81612099565b600054610100900460ff166119755760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b61197d612103565b61040f81612188565b600054610100900460ff16611a035760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b610e2b612205565b60fb548111611a825760405162461bcd60e51b815260206004820152602260248201527f436f6d7074726f6c6c65723a20496e76616c6964206d61784c6f6f70734c696d60448201527f69740000000000000000000000000000000000000000000000000000000000006064820152608401610eab565b60fb80549082905560408051828152602081018490527fc2d09fef144f7c8a86f71ea459f8fc17f675768eb1ae369cbd77fb31d467aafa9101611509565b6000611acd600180612944565b905060008167ffffffffffffffff811115611aea57611aea612a16565b604051908082528060200260200182016040528015611b13578160200160208202803683370190505b5090506000805b83811015611bdb576001600160a01b03808716600090815261012e60209081526040808320938916835292905290812090826001811115611b5d57611b5d61263d565b6001811115611b6e57611b6e61263d565b6001811115611b7f57611b7f61263d565b815260200190815260200160002054838281518110611ba057611ba0612984565b602002602001018181525050828181518110611bbe57611bbe612984565b602002602001015182611bd19190612944565b9150600101611b1a565b5080600003611beb575050505050565b60008367ffffffffffffffff811115611c0657611c06612a16565b604051908082528060200260200182016040528015611c2f578160200160208202803683370190505b50905060005b61013054811015611e645760006101308281548110611c5657611c56612984565b60009182526020909120604080516060810190915291018054829060ff166001811115611c8557611c8561263d565b6001811115611c9657611c9661263d565b81529054610100810461ffff90811660208085019190915263010000009092046001600160a01b0316604090930192909252820151825192935060009261271092919091169088906001811115611cef57611cef61263d565b81518110611cff57611cff612984565b6020026020010151611d119190612b01565b611d1b9190612b18565b9050808483600001516001811115611d3557611d3561263d565b81518110611d4557611d45612984565b60200260200101818151611d599190612944565b9052508015611e5a576040820151611d7c906001600160a01b038a169083612282565b60408083015190517faac59a750000000000000000000000000000000000000000000000000000000081526001600160a01b038b811660048301528a811660248301529091169063aac59a7590604401600060405180830381600087803b158015611de657600080fd5b505af1158015611dfa573d6000803e3d6000fd5b50505050876001600160a01b031682604001516001600160a01b03167f09f71e7b22d78540ee9a42f09917a9d62f46735cb0dfa70d6bab27866d9cb5008460000151856020015185604051611e5193929190612c3a565b60405180910390a35b5050600101611c35565b5060008467ffffffffffffffff811115611e8057611e80612a16565b604051908082528060200260200182016040528015611ea9578160200160208202803683370190505b50905060005b8581101561208f57828181518110611ec957611ec9612984565b6020026020010151858281518110611ee357611ee3612984565b6020026020010151611ef591906129d4565b828281518110611f0757611f07612984565b602002602001018181525050818181518110611f2557611f25612984565b6020908102919091018101516001600160a01b03808b16600090815261012e84526040808220928c1682529190935282209091836001811115611f6a57611f6a61263d565b6001811115611f7b57611f7b61263d565b6001811115611f8c57611f8c61263d565b815260200190815260200160002081905550828181518110611fb057611fb0612984565b602002602001015161012f6000896001600160a01b03166001600160a01b0316815260200190815260200160002054611fe991906129d4565b6001600160a01b03808916600081815261012f602052604090209290925589167f7d881f3d6246a6a2b97b121b8ba093c17497912c68e8b2bca6108528e91df3ca83600181111561203c5761203c61263d565b88858151811061204e5761204e612984565b602002602001015186868151811061206857612068612984565b602002602001015160405161207f93929190612c5f565b60405180910390a3600101611eaf565b5050505050505050565b603380546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166121805760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b610e2b612302565b600054610100900460ff166104065760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b600054610100900460ff166115d25760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610783908490612388565b600054610100900460ff1661237f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b610e2b336118c7565b60006123dd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124709092919063ffffffff16565b90508051600014806123fe5750808060200190518101906123fe91906128bd565b6107835760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610eab565b606061105e848460008585600080866001600160a01b031685876040516124979190612c80565b60006040518083038185875af1925050503d80600081146124d4576040519150601f19603f3d011682016040523d82523d6000602084013e6124d9565b606091505b50915091506124ea878383876124f5565b979650505050505050565b6060831561256457825160000361255d576001600160a01b0385163b61255d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610eab565b508161105e565b61105e83838151156125795781518083602001fd5b8060405162461bcd60e51b8152600401610eab9190612c9c565b6001600160a01b038116811461040f57600080fd5b6000602082840312156125ba57600080fd5b81356125c581612593565b9392505050565b6002811061040f57600080fd5b6000806000606084860312156125ee57600080fd5b83356125f981612593565b9250602084013561260981612593565b91506040840135612619816125cc565b809150509250925092565b60006020828403121561263657600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6002811061040f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b606081016126b08561266c565b93815261ffff9290921660208301526001600160a01b031660409091015290565b600080604083850312156126e457600080fd5b82356126ef816125cc565b915060208301356126ff81612593565b809150509250929050565b6000806020838503121561271d57600080fd5b823567ffffffffffffffff8082111561273557600080fd5b818501915085601f83011261274957600080fd5b81358181111561275857600080fd5b86602060608302850101111561276d57600080fd5b60209290920196919550909350505050565b6000806000806080858703121561279557600080fd5b84356127a081612593565b935060208501356127b0816125cc565b925060408501356127c081612593565b915060608501356127d081612593565b939692955090935050565b600080604083850312156127ee57600080fd5b82356127f981612593565b915060208301356126ff816125cc565b6000806040838503121561281c57600080fd5b823561282781612593565b946020939093013593505050565b60008060006040848603121561284a57600080fd5b833561285581612593565b9250602084013567ffffffffffffffff8082111561287257600080fd5b818601915086601f83011261288657600080fd5b81358181111561289557600080fd5b8760208260051b85010111156128aa57600080fd5b6020830194508093505050509250925092565b6000602082840312156128cf57600080fd5b815180151581146125c557600080fd5b6000602082840312156128f157600080fd5b81516125c581612593565b60006020828403121561290e57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561115557611155612915565b838152606081016129678461266c565b8360208301526129768361266c565b826040830152949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b61ffff83168152604081016129c78361266c565b8260208301529392505050565b8181038181111561115557611155612915565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060608284031215612a5757600080fd5b6040516060810181811067ffffffffffffffff82111715612aa1577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040528235612aaf816125cc565b8152602083013561ffff81168114612ac657600080fd5b60208201526040830135612ad981612593565b60408201529392505050565b61ffff848116825283166020820152606081016129768361266c565b808202811582820484141761115557611155612915565b600082612b4e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60005b83811015612b6e578181015183820152602001612b56565b50506000910152565b60008151808452612b8f816020860160208601612b53565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6001600160a01b038316815260406020820152600061105e6040830184612b77565b60006001600160a01b03808616835280851660208401525060606040830152612c0f6060830184612b77565b95945050505050565b61ffff818116838216019080821115612c3357612c33612915565b5092915050565b60608101612c478561266c565b93815261ffff92909216602083015260409091015290565b60608101612c6c8561266c565b938152602081019290925260409091015290565b60008251612c92818460208701612b53565b9190910192915050565b6020815260006125c56020830184612b7756fe72656d6f7665446973747269627574696f6e436f6e66696728536368656d612c61646472657373296164644f72557064617465446973747269627574696f6e436f6e6669677328446973747269627574696f6e436f6e6669675b5d29a2646970667358221220b1db932da49f621b9742b1c134a47550b0625658dff025f09b897fba34f4d82c64736f6c63430008190033000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101a35760003560e01c8063893ffe98116100ee578063b4a0bdf311610097578063e30c397811610071578063e30c3978146103a0578063f2fde38b146103b1578063fa7b81a0146103c4578063fc31116a146103eb57600080fd5b8063b4a0bdf314610373578063be26317e14610384578063cd6dc6871461038d57600080fd5b8063966961f0116100c8578063966961f01461032b578063aea211211461033e578063afcff50f1461035f57600080fd5b8063893ffe98146102e05780638da5cb5b146102f35780638dd950021461030457600080fd5b80634f429f3611610150578063715018a61161012a578063715018a6146102bd57806379ba5097146102c55780637b77cd6a146102cd57600080fd5b80634f429f36146102655780635db6da12146102785780635f3d6133146102aa57600080fd5b806316faecec1161018157806316faecec146101f157806333e1567f14610204578063392ee7121461024357600080fd5b80630e32cb86146101a85780631036bbe2146101bd578063163db71b146101de575b600080fd5b6101bb6101b63660046125a8565b6103fe565b005b6101c661271081565b60405161ffff90911681526020015b60405180910390f35b610130545b6040519081526020016101d5565b6101bb6101ff3660046125d9565b610412565b61022b7f000000000000000000000000000000000000000000000000000000000000000181565b6040516001600160a01b0390911681526020016101d5565b610256610251366004612624565b610788565b6040516101d5939291906126a3565b6101bb6102733660046126d1565b6107c8565b6101e36102863660046125d9565b61012e60209081526000938452604080852082529284528284209052825290205481565b6101bb6102b836600461270a565b610b0a565b6101bb610e19565b6101bb610e2d565b6101bb6102db3660046125a8565b610ebd565b6101e36102ee36600461277f565b610f44565b6033546001600160a01b031661022b565b61022b7f000000000000000000000000000000000000000000000000000000000000000181565b6101e36103393660046127db565b611066565b6101e361034c3660046125a8565b61012f6020526000908152604090205481565b61012d5461022b906001600160a01b031681565b6097546001600160a01b031661022b565b6101e360fb5481565b6101bb61039b366004612809565b61115b565b6065546001600160a01b031661022b565b6101bb6103bf3660046125a8565b6112e6565b61022b7f000000000000000000000000000000000000000000000000000000000000000181565b6101bb6103f9366004612835565b61136f565b6104066113c5565b61040f8161141f565b50565b61041a611515565b826001600160a01b0316627e3dd26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610457573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047b91906128bd565b6104b1576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6104ba8261156e565b7f00000000000000000000000000000000000000000000000000000000000000016001600160a01b0316836001600160a01b031614158015610593575061012d546040517f266e0a7f0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528481166024830152600092169063266e0a7f90604401602060405180830381865afa158015610564573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058891906128df565b6001600160a01b0316145b156105ca576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006105d5826115ae565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529091506000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610638573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065c91906128fc565b6001600160a01b038516600090815261012f602052604090205490915080821115610776576001600160a01b03808716600090815261012e602090815260408083209389168352929052908120828403918291908660018111156106c2576106c261263d565b60018111156106d3576106d361263d565b815260200190815260200160002060008282546106f09190612944565b90915550506001600160a01b038616600090815261012f60205260408120805483929061071e908490612944565b92505081905550856001600160a01b0316876001600160a01b03167fa46b2431e663cf7b50c9d5129aff85d2394ecfd447b7ccba83986510a9d945ea83888860405161076c93929190612957565b60405180910390a3505b505050610783600160c955565b505050565b610130818154811061079957600080fd5b60009182526020909120015460ff81169150610100810461ffff1690630100000090046001600160a01b031683565b6107e9604051806060016040528060288152602001612cb0602891396115d9565b600080805b61013054811015610894576000610130828154811061080f5761080f612984565b6000918252602090912001805490915060ff1660018111156108335761083361263d565b8660018111156108455761084561263d565b148015610865575080546001600160a01b03868116630100000090920416145b801561087957508054610100900461ffff16155b1561088b576001925081935050610894565b506001016107ee565b508015610afc5761013082815481106108af576108af612984565b9060005260206000200160000160039054906101000a90046001600160a01b03166001600160a01b03167f70e7a210881df49522a5bf05d477e00d59e52a41c96c1eedeaeb356b9e6c81cc610130848154811061090e5761090e612984565b9060005260206000200160000160019054906101000a900461ffff16610130858154811061093e5761093e612984565b60009182526020909120015460405161095b929160ff16906129b3565b60405180910390a26101308054610974906001906129d4565b8154811061098457610984612984565b9060005260206000200161013083815481106109a2576109a2612984565b60009182526020909120825491018054909160ff169082907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183818111156109ef576109ef61263d565b02179055508154815461ffff61010092839004169091027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ff82168117835592546001600160a01b0363010000009182900416027fffffffffffffffffff0000000000000000000000000000000000000000ffffff9093167fffffffffffffffffff00000000000000000000000000000000000000000000ff90911617919091179055610130805480610aa357610aa36129e7565b60008281526020902081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffff00000000000000000000000000000000000000000000001690550190555b610b046116a5565b50505050565b610b12611515565b610b33604051806060016040528060348152602001612cd8603491396115d9565b60005b81811015610df5576000838383818110610b5257610b52612984565b905060600201803603810190610b689190612a45565b9050610b77816040015161156e565b61013054600090815b81811015610ca55760006101308281548110610b9e57610b9e612984565b6000918252602090912001805490915060ff166001811115610bc257610bc261263d565b85516001811115610bd557610bd561263d565b148015610bfa575060408501518154630100000090046001600160a01b039081169116145b15610c9c5760408581015182546020880151885193516001600160a01b03909316937fa682db621f4ae1c92cd6c492151d32fe657fc6db6e87bd65eb8bda05311f6ef293610c5393610100900461ffff16929190612ae5565b60405180910390a26020850151815461ffff909116610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ff90911617905560019250610ca5565b50600101610b80565b5081610de75761013080546001818101835560009290925284517f2f605e086faac1d93117bbfbc18835d434e9405fadc1ca66faf4b864746daf349091018054869391929183917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016908381811115610d2057610d2061263d565b021790555060208281015182546040948501517fffffffffffffffffff00000000000000000000000000000000000000000000ff90911661010061ffff909316929092027fffffffffffffffffff0000000000000000000000000000000000000000ffffff169190911763010000006001600160a01b03928316021790925585830151908601518651935191909216927f8c96910d818618d8b1de4e1b5672a192443e87aa553f0ebe4c47f9d8c928b28292610dde929091906129b3565b60405180910390a25b836001019350505050610b36565b50610dfe6116a5565b61013054610e0b9061187d565b610e15600160c955565b5050565b610e216113c5565b610e2b60006118c7565b565b60655433906001600160a01b03168114610eb45760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61040f816118c7565b610ec56113c5565b610ece8161156e565b61012d546040516001600160a01b038084169216907fa87b964d321035d2165e484ff4b722dd6eae30606c0b98887d2ed1a34e594bfe90600090a361012d80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b61013054600090815b8181101561105b5760006101308281548110610f6b57610f6b612984565b906000526020600020019050866001811115610f8957610f8961263d565b815460ff166001811115610f9f57610f9f61263d565b148015610fbf575080546001600160a01b03878116630100000090920416145b15611052576001600160a01b03808916600090815261012e60209081526040808320938916835292905290812081896001811115610fff57610fff61263d565b60018111156110105761101061263d565b815260208101919091526040016000205482549091506127109061103d90610100900461ffff1683612b01565b6110479190612b18565b94505050505061105e565b50600101610f4d565b50505b949350505050565b61013054600090815b81811015611152576000610130828154811061108d5761108d612984565b60009182526020909120604080516060810190915291018054829060ff1660018111156110bc576110bc61263d565b60018111156110cd576110cd61263d565b81529054610100810461ffff166020830152630100000090046001600160a01b03908116604092830152908201519192508781169116148015611132575084600181111561111d5761111d61263d565b815160018111156111305761113061263d565b145b15611149576020015161ffff169250611155915050565b5060010161106f565b50505b92915050565b600054610100900460ff161580801561117b5750600054600160ff909116105b806111955750303b158015611195575060005460ff166001145b6112075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610eab565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561126557600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b61126e836118f8565b611276611986565b61127f82611a0b565b801561078357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6112ee6113c5565b606580546001600160a01b0383167fffffffffffffffffffffffff000000000000000000000000000000000000000090911681179091556113376033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b611377611515565b60005b818110156113ba576113b28484848481811061139857611398612984565b90506020020160208101906113ad91906125a8565b611ac0565b60010161137a565b50610783600160c955565b6033546001600160a01b03163314610e2b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610eab565b6001600160a01b03811661149b5760405162461bcd60e51b815260206004820152602560248201527f696e76616c696420616365737320636f6e74726f6c206d616e6167657220616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610eab565b609780546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f66fd58e82f7b31a2a5c30e0888f3093efe4e111b00cd2b0c31fe014601293aa091015b60405180910390a15050565b600260c954036115675760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610eab565b600260c955565b6001600160a01b03811661040f576040517f8579befe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008260018111156115c4576115c461263d565b036115cd575060005b919050565b600160c955565b6097546040517f18c5e8ab0000000000000000000000000000000000000000000000000000000081526000916001600160a01b0316906318c5e8ab906116259033908690600401612bc1565b602060405180830381865afa158015611642573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166691906128bd565b905080610e15573330836040517f4a3fa293000000000000000000000000000000000000000000000000000000008152600401610eab93929190612be3565b60006116b2600180612944565b905060008167ffffffffffffffff8111156116cf576116cf612a16565b6040519080825280602002602001820160405280156116f8578160200160208202803683370190505b506101305490915060005b818110156117e1576000610130828154811061172157611721612984565b60009182526020909120604080516060810190915291018054829060ff1660018111156117505761175061263d565b60018111156117615761176161263d565b81529054610100810461ffff1660208084019190915263010000009091046001600160a01b0316604090920191909152810151815191925090859060018111156117ad576117ad61263d565b815181106117bd576117bd612984565b602002602001018181516117d19190612c18565b61ffff1690525050600101611703565b5060005b83811015610b045761271061ffff1683828151811061180657611806612984565b602002602001015161ffff161415801561183e575082818151811061182d5761182d612984565b602002602001015161ffff16600014155b15611875576040517f0b8ad7f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001016117e5565b60fb5481111561040f5760fb546040517ff257f636000000000000000000000000000000000000000000000000000000008152600481019190915260248101829052604401610eab565b606580547fffffffffffffffffffffffff000000000000000000000000000000000000000016905561040f81612099565b600054610100900460ff166119755760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b61197d612103565b61040f81612188565b600054610100900460ff16611a035760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b610e2b612205565b60fb548111611a825760405162461bcd60e51b815260206004820152602260248201527f436f6d7074726f6c6c65723a20496e76616c6964206d61784c6f6f70734c696d60448201527f69740000000000000000000000000000000000000000000000000000000000006064820152608401610eab565b60fb80549082905560408051828152602081018490527fc2d09fef144f7c8a86f71ea459f8fc17f675768eb1ae369cbd77fb31d467aafa9101611509565b6000611acd600180612944565b905060008167ffffffffffffffff811115611aea57611aea612a16565b604051908082528060200260200182016040528015611b13578160200160208202803683370190505b5090506000805b83811015611bdb576001600160a01b03808716600090815261012e60209081526040808320938916835292905290812090826001811115611b5d57611b5d61263d565b6001811115611b6e57611b6e61263d565b6001811115611b7f57611b7f61263d565b815260200190815260200160002054838281518110611ba057611ba0612984565b602002602001018181525050828181518110611bbe57611bbe612984565b602002602001015182611bd19190612944565b9150600101611b1a565b5080600003611beb575050505050565b60008367ffffffffffffffff811115611c0657611c06612a16565b604051908082528060200260200182016040528015611c2f578160200160208202803683370190505b50905060005b61013054811015611e645760006101308281548110611c5657611c56612984565b60009182526020909120604080516060810190915291018054829060ff166001811115611c8557611c8561263d565b6001811115611c9657611c9661263d565b81529054610100810461ffff90811660208085019190915263010000009092046001600160a01b0316604090930192909252820151825192935060009261271092919091169088906001811115611cef57611cef61263d565b81518110611cff57611cff612984565b6020026020010151611d119190612b01565b611d1b9190612b18565b9050808483600001516001811115611d3557611d3561263d565b81518110611d4557611d45612984565b60200260200101818151611d599190612944565b9052508015611e5a576040820151611d7c906001600160a01b038a169083612282565b60408083015190517faac59a750000000000000000000000000000000000000000000000000000000081526001600160a01b038b811660048301528a811660248301529091169063aac59a7590604401600060405180830381600087803b158015611de657600080fd5b505af1158015611dfa573d6000803e3d6000fd5b50505050876001600160a01b031682604001516001600160a01b03167f09f71e7b22d78540ee9a42f09917a9d62f46735cb0dfa70d6bab27866d9cb5008460000151856020015185604051611e5193929190612c3a565b60405180910390a35b5050600101611c35565b5060008467ffffffffffffffff811115611e8057611e80612a16565b604051908082528060200260200182016040528015611ea9578160200160208202803683370190505b50905060005b8581101561208f57828181518110611ec957611ec9612984565b6020026020010151858281518110611ee357611ee3612984565b6020026020010151611ef591906129d4565b828281518110611f0757611f07612984565b602002602001018181525050818181518110611f2557611f25612984565b6020908102919091018101516001600160a01b03808b16600090815261012e84526040808220928c1682529190935282209091836001811115611f6a57611f6a61263d565b6001811115611f7b57611f7b61263d565b6001811115611f8c57611f8c61263d565b815260200190815260200160002081905550828181518110611fb057611fb0612984565b602002602001015161012f6000896001600160a01b03166001600160a01b0316815260200190815260200160002054611fe991906129d4565b6001600160a01b03808916600081815261012f602052604090209290925589167f7d881f3d6246a6a2b97b121b8ba093c17497912c68e8b2bca6108528e91df3ca83600181111561203c5761203c61263d565b88858151811061204e5761204e612984565b602002602001015186868151811061206857612068612984565b602002602001015160405161207f93929190612c5f565b60405180910390a3600101611eaf565b5050505050505050565b603380546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166121805760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b610e2b612302565b600054610100900460ff166104065760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b600054610100900460ff166115d25760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610783908490612388565b600054610100900460ff1661237f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610eab565b610e2b336118c7565b60006123dd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124709092919063ffffffff16565b90508051600014806123fe5750808060200190518101906123fe91906128bd565b6107835760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610eab565b606061105e848460008585600080866001600160a01b031685876040516124979190612c80565b60006040518083038185875af1925050503d80600081146124d4576040519150601f19603f3d011682016040523d82523d6000602084013e6124d9565b606091505b50915091506124ea878383876124f5565b979650505050505050565b6060831561256457825160000361255d576001600160a01b0385163b61255d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610eab565b508161105e565b61105e83838151156125795781518083602001fd5b8060405162461bcd60e51b8152600401610eab9190612c9c565b6001600160a01b038116811461040f57600080fd5b6000602082840312156125ba57600080fd5b81356125c581612593565b9392505050565b6002811061040f57600080fd5b6000806000606084860312156125ee57600080fd5b83356125f981612593565b9250602084013561260981612593565b91506040840135612619816125cc565b809150509250925092565b60006020828403121561263657600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6002811061040f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b606081016126b08561266c565b93815261ffff9290921660208301526001600160a01b031660409091015290565b600080604083850312156126e457600080fd5b82356126ef816125cc565b915060208301356126ff81612593565b809150509250929050565b6000806020838503121561271d57600080fd5b823567ffffffffffffffff8082111561273557600080fd5b818501915085601f83011261274957600080fd5b81358181111561275857600080fd5b86602060608302850101111561276d57600080fd5b60209290920196919550909350505050565b6000806000806080858703121561279557600080fd5b84356127a081612593565b935060208501356127b0816125cc565b925060408501356127c081612593565b915060608501356127d081612593565b939692955090935050565b600080604083850312156127ee57600080fd5b82356127f981612593565b915060208301356126ff816125cc565b6000806040838503121561281c57600080fd5b823561282781612593565b946020939093013593505050565b60008060006040848603121561284a57600080fd5b833561285581612593565b9250602084013567ffffffffffffffff8082111561287257600080fd5b818601915086601f83011261288657600080fd5b81358181111561289557600080fd5b8760208260051b85010111156128aa57600080fd5b6020830194508093505050509250925092565b6000602082840312156128cf57600080fd5b815180151581146125c557600080fd5b6000602082840312156128f157600080fd5b81516125c581612593565b60006020828403121561290e57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561115557611155612915565b838152606081016129678461266c565b8360208301526129768361266c565b826040830152949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b61ffff83168152604081016129c78361266c565b8260208301529392505050565b8181038181111561115557611155612915565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060608284031215612a5757600080fd5b6040516060810181811067ffffffffffffffff82111715612aa1577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040528235612aaf816125cc565b8152602083013561ffff81168114612ac657600080fd5b60208201526040830135612ad981612593565b60408201529392505050565b61ffff848116825283166020820152606081016129768361266c565b808202811582820484141761115557611155612915565b600082612b4e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60005b83811015612b6e578181015183820152602001612b56565b50506000910152565b60008151808452612b8f816020860160208601612b53565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6001600160a01b038316815260406020820152600061105e6040830184612b77565b60006001600160a01b03808616835280851660208401525060606040830152612c0f6060830184612b77565b95945050505050565b61ffff818116838216019080821115612c3357612c33612915565b5092915050565b60608101612c478561266c565b93815261ffff92909216602083015260409091015290565b60608101612c6c8561266c565b938152602081019290925260409091015290565b60008251612c92818460208701612b53565b9190910192915050565b6020815260006125c56020830184612b7756fe72656d6f7665446973747269627574696f6e436f6e66696728536368656d612c61646472657373296164644f72557064617465446973747269627574696f6e436f6e6669677328446973747269627574696f6e436f6e6669675b5d29a2646970667358221220b1db932da49f621b9742b1c134a47550b0625658dff025f09b897fba34f4d82c64736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _corePoolComptroller (address): 0x0000000000000000000000000000000000000001
Arg [1] : _wbnb (address): 0x0000000000000000000000000000000000000001
Arg [2] : _vbnb (address): 0x0000000000000000000000000000000000000001
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
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.