Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
CMTAT_PROXY
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "./modules/CMTAT_BASE.sol";
contract CMTAT_PROXY is CMTAT_BASE {
/**
@notice Contract version for the deployment with a proxy
@param forwarderIrrevocable address of the forwarder, required for the gasless support
*/
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
// Initialize the variable for the implementation
deployedWithProxy = true;
// Disable the possibility to initialize the implementation
_disableInitializers();
}
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822Proxiable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
*
* _Available since v4.8.3._
*/
interface IERC1967 {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)
pragma solidity ^0.8.0;
import "./IBeacon.sol";
import "../Proxy.sol";
import "../ERC1967/ERC1967Upgrade.sol";
/**
* @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.
*
* The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't
* conflict with the storage layout of the implementation behind the proxy.
*
* _Available since v3.4._
*/
contract BeaconProxy is Proxy, ERC1967Upgrade {
/**
* @dev Initializes the proxy with `beacon`.
*
* If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This
* will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity
* constructor.
*
* Requirements:
*
* - `beacon` must be a contract with the interface {IBeacon}.
*/
constructor(address beacon, bytes memory data) payable {
_upgradeBeaconToAndCall(beacon, data, false);
}
/**
* @dev Returns the current beacon address.
*/
function _beacon() internal view virtual returns (address) {
return _getBeacon();
}
/**
* @dev Returns the current implementation address of the associated beacon.
*/
function _implementation() internal view virtual override returns (address) {
return IBeacon(_getBeacon()).implementation();
}
/**
* @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.
*
* If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.
*
* Requirements:
*
* - `beacon` must be a contract.
* - The implementation returned by `beacon` must be a contract.
*/
function _setBeacon(address beacon, bytes memory data) internal virtual {
_upgradeBeaconToAndCall(beacon, data, false);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
import "../beacon/IBeacon.sol";
import "../../interfaces/IERC1967.sol";
import "../../interfaces/draft-IERC1822.sol";
import "../../utils/Address.sol";
import "../../utils/StorageSlot.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*
* _Available since v4.1._
*/
abstract contract ERC1967Upgrade is IERC1967 {
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Perform implementation upgrade
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Perform implementation upgrade with additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
_upgradeTo(newImplementation);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(newImplementation, data);
}
}
/**
* @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
// Upgrades from old implementations will perform a rollback test. This test requires the new
// implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
// this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
} catch {
revert("ERC1967Upgrade: new implementation is not UUPS");
}
_upgradeToAndCall(newImplementation, data, forceCall);
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
*/
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Returns the current beacon.
*/
function _getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
Address.isContract(IBeacon(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
}
/**
* @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
* not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)
pragma solidity ^0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev This is a virtual function that should be overridden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive() external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overridden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {}
}// 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 IERC20 {
/**
* @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) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* 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 (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
* _Available since v4.9 for `string`, `bytes`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
library Errors {
error NoZeroAddress();
error DateInPast(uint256 date);
error DateInFuture(uint256 date);
error InvalidAmount(uint256 amount);
error EmptyArray();
error OutOfBounds(uint256 index);
error TransferFailed();
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
enum Label {
Secured,
Green,
Social,
Sustainable,
Supernational,
Governmental,
Municipal,
Subordinated
}
interface IDebtGlobal {
struct DebtBase {
// Assume two decimals so 5.95% is 595
uint256 interestRate;
uint256 parValue;
string guarantor;
string bondHolder;
string maturityDate;
string interestScheduleFormat;
string interestPaymentDate;
string dayCountConvention;
string businessDayConvention;
string publicHolidaysCalendar;
string issuanceDate;
string couponFrequency;
}
struct DebtAdditionalInfo {
string issuerName;
string issuerInfo;
IERC20 currency;
uint8[] labels;
}
struct CreditEvents {
bool flagDefault;
bool flagRedeemed;
string rating;
}
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.0;
/*
@dev Contrary to the EIP-1404, this interface does not inherit from the ERC20 interface
*/
interface IEIP1404 {
/**
* @dev See ERC/EIP-1404
*
*/
function detectTransferRestriction(
address _from,
address _to,
uint256 _amount
) external view returns (uint8);
/**
* @dev See ERC/EIP-1404
*
*/
function messageForTransferRestriction(
uint8 _restrictionCode
) external view returns (string memory);
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.0;
import "./IEIP1404.sol";
interface IEIP1404Wrapper is IEIP1404 {
/*
@dev leave the code 4-9 free/unused for further additions in your ruleEngine implementation
*/
enum REJECTED_CODE_BASE {
TRANSFER_OK,
TRANSFER_REJECTED_PAUSED,
TRANSFER_REJECTED_FROM_FROZEN,
TRANSFER_REJECTED_TO_FROZEN
}
/**
* @dev Returns true if the transfer is valid, and false otherwise.
*/
function validateTransfer(
address _from,
address _to,
uint256 _amount
) external view returns (bool isValid);
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
// required OZ imports here
import "../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol";
import "./wrapper/mandatory/BaseModule.sol";
import "./wrapper/mandatory/BurnModule.sol";
import "./wrapper/mandatory/MintModule.sol";
import "./wrapper/mandatory/EnforcementModule.sol";
import "./wrapper/mandatory/ERC20BaseModule.sol";
import "./wrapper/mandatory/PauseModule.sol";
import "./wrapper/optional/ValidationModule.sol";
import "./wrapper/optional/DebtModule/DebtBaseModule.sol";
import "./wrapper/optional/DebtModule/CreditEventsModule.sol";
import "./wrapper/optional/DebtModule/DistributionModule.sol";
import "./security/AuthorizationModule.sol";
import "../interfaces/IEIP1404/IEIP1404Wrapper.sol";
abstract contract CMTAT_BASE is
Initializable,
ContextUpgradeable,
BaseModule,
PauseModule,
MintModule,
BurnModule,
EnforcementModule,
ValidationModule,
ERC20BaseModule,
DebtBaseModule,
CreditEventsModule,
DistributionModule
{
/**
@notice
initialize the proxy contract
The calls to this function will revert if the contract was deployed without a proxy
*/
function initialize(
address admin,
string memory nameIrrevocable,
string memory symbolIrrevocable,
string memory tokenId_,
string memory terms_,
IEIP1404Wrapper ruleEngine_,
string memory information_,
uint256 flag_,
address paymentRedemptionTokenFactory_,
bool restrictTransfer_
) public initializer {
__CMTAT_init(
admin,
nameIrrevocable,
symbolIrrevocable,
tokenId_,
terms_,
ruleEngine_,
information_,
flag_,
paymentRedemptionTokenFactory_,
restrictTransfer_
);
}
/**
@dev calls the different initialize functions from the different modules
*/
function __CMTAT_init(
address admin,
string memory nameIrrevocable,
string memory symbolIrrevocable,
string memory tokenId_,
string memory terms_,
IEIP1404Wrapper ruleEngine_,
string memory information_,
uint256 flag_,
address paymentRedemptionTokenFactory_,
bool restrictTransfer_
) internal onlyInitializing {
/* OpenZeppelin library */
// OZ init_unchained functions are called firstly due to inheritance
__Context_init_unchained();
__ERC20_init_unchained(nameIrrevocable, symbolIrrevocable);
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
__Pausable_init_unchained();
/* Internal Modules */
__Enforcement_init_unchained();
__Snapshot_init_unchained();
__Validation_init_unchained(ruleEngine_);
/* Wrapper */
// AuthorizationModule_init_unchained is called firstly due to inheritance
__AuthorizationModule_init_unchained(admin);
__BurnModule_init_unchained();
__MintModule_init_unchained();
// EnforcementModule_init_unchained is called before ValidationModule_init_unchained due to inheritance
__EnforcementModule_init_unchained();
__ERC20Module_init_unchained(0);
// PauseModule_init_unchained is called before ValidationModule_init_unchained due to inheritance
__PauseModule_init_unchained();
__ValidationModule_init_unchained(restrictTransfer_);
/* Other modules */
__DebtBaseModule_init_unchained();
__CreditEvents_init_unchained();
__DistributionModule_init_unchained(paymentRedemptionTokenFactory_);
__Base_init_unchained(tokenId_, terms_, information_, flag_);
/* own function */
__CMTAT_init_unchained();
}
function __CMTAT_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/**
@notice Returns the number of decimals used to get its user representation.
*/
function decimals()
public
view
virtual
override(ERC20Upgradeable, ERC20BaseModule)
returns (uint8)
{
return ERC20BaseModule.decimals();
}
function transferFrom(
address sender,
address recipient,
uint256 amount
)
public
virtual
override(ERC20Upgradeable, ERC20BaseModule)
returns (bool)
{
return ERC20BaseModule.transferFrom(sender, recipient, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal override(SnapshotModuleInternal, ERC20Upgradeable) {
if (!validateTransfer(from, to, amount)) {
revert TransferRejected();
}
// We call the SnapshotModule only if the transfer is valid
SnapshotModuleInternal._beforeTokenTransfer(from, to, amount);
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol";
import "../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../../openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol";
/**
* @dev Enforcement module.
*
* Allows the issuer to freeze transfers from a given address
*/
abstract contract EnforcementModuleInternal is
Initializable,
ContextUpgradeable
{
/**
* @notice Emitted when an address is frozen.
*/
event Freeze(
address indexed enforcer,
address indexed owner,
string indexed reasonIndexed,
string reason
);
/**
* @notice Emitted when an address is unfrozen.
*/
event Unfreeze(
address indexed enforcer,
address indexed owner,
string indexed reasonIndexed,
string reason
);
mapping(address => bool) private _frozen;
/**
* @dev Initializes the contract
*/
function __Enforcement_init() internal onlyInitializing {
__Context_init_unchained();
__Enforcement_init_unchained();
}
function __Enforcement_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/**
* @dev Returns true if the account is frozen, and false otherwise.
*/
function frozen(address account) public view virtual returns (bool) {
return _frozen[account];
}
/**
* @dev Freezes an address.
* @param account the account to freeze
* @param reason indicate why the account was frozen.
*
*/
function _freeze(
address account,
string memory reason
) internal virtual returns (bool) {
if (_frozen[account]) return false;
_frozen[account] = true;
emit Freeze(_msgSender(), account, reason, reason);
return true;
}
/**
* @dev Unfreezes an address.
* @param account the account to unfreeze
* @param reason indicate why the account was unfrozen.
*/
function _unfreeze(
address account,
string memory reason
) internal virtual returns (bool) {
if (!_frozen[account]) return false;
_frozen[account] = false;
emit Unfreeze(_msgSender(), account, reason, reason);
return true;
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol";
import "../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../../openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol";
import "../../../openzeppelin-contracts-upgradeable/contracts/utils/ArraysUpgradeable.sol";
error ScheduledSnapshotInThePast();
error TimeLessThanLastSnapshot();
error SnapshotAlreadyExists();
error SnapshotAlreadyDone();
error NoScheduledSnapshot();
error SnapshotNotFound();
error TimeGreaterThanNextSnapshot();
error TimeLessThanPreviousSnapshot();
error OnlyLastSnapshotCanBeUnscheduled();
abstract contract SnapshotModuleInternal is ERC20Upgradeable {
using ArraysUpgradeable for uint256[];
/**
@notice Emitted when the snapshot with the specified oldTime was scheduled or rescheduled at the specified newTime.
*/
event SnapshotSchedule(uint256 indexed oldTime, uint256 indexed newTime);
/**
@notice Emitted when the scheduled snapshot with the specified time was cancelled.
*/
event SnapshotUnschedule(uint256 indexed time);
/**
@dev See {OpenZeppelin - ERC20Snapshot}
Snapshotted values have arrays of ids (time) and the value corresponding to that id.
ids is expected to be sorted in ascending order, and to contain no repeated elements
because we use findUpperBound in the function _valueAt
*/
struct Snapshots {
uint256[] ids;
uint256[] values;
}
/**
@dev See {OpenZeppelin - ERC20Snapshot}
*/
mapping(address => Snapshots) private _accountBalanceSnapshots;
Snapshots private _totalSupplySnapshots;
/**
@dev time instead of a counter for OpenZeppelin
*/
uint256 private _currentSnapshotTime;
uint256 private _currentSnapshotIndex;
/**
@dev
list of scheduled snapshot (time)
This list is sorted in ascending order
*/
uint256[] private _scheduledSnapshots;
/**
* @dev Initializes the contract
*/
function __Snapshot_init(
string memory name_,
string memory symbol_
) internal onlyInitializing {
__Context_init_unchained();
__ERC20_init(name_, symbol_);
__Snapshot_init_unchained();
}
function __Snapshot_init_unchained() internal onlyInitializing {
_currentSnapshotTime = 0;
_currentSnapshotIndex = 0;
}
/**
@dev schedule a snapshot at the specified time
You can only add a snapshot after the last previous
*/
function _scheduleSnapshot(uint256 time) internal {
if (time <= block.timestamp) revert ScheduledSnapshotInThePast();
if (
_scheduledSnapshots.length > 0 &&
time <= _scheduledSnapshots[_scheduledSnapshots.length - 1]
) {
revert TimeLessThanLastSnapshot();
}
_scheduledSnapshots.push(time);
emit SnapshotSchedule(0, time);
}
// /**
// @dev schedule a snapshot at the specified time
// */
// function _scheduleSnapshotNotOptimized(uint256 time) internal {
// if (time <= block.timestamp) revert ScheduledSnapshotInThePast();
// (bool isFound, uint256 index) = _findScheduledSnapshotIndex(time);
// if (isFound) revert SnapshotAlreadyExists();
// // if no upper bound match found, we push the snapshot at the end of the list
// if (index == _scheduledSnapshots.length) {
// _scheduledSnapshots.push(time);
// } else {
// _scheduledSnapshots.push(
// _scheduledSnapshots[_scheduledSnapshots.length - 1]
// );
// for (uint256 i = _scheduledSnapshots.length - 2; i > index; ) {
// _scheduledSnapshots[i] = _scheduledSnapshots[i - 1];
// unchecked {
// --i;
// }
// }
// _scheduledSnapshots[index] = time;
// }
// emit SnapshotSchedule(0, time);
// }
// function _rescheduleSnapshot(uint256 oldTime, uint256 newTime) internal {
// if (oldTime <= block.timestamp) revert SnapshotAlreadyDone();
// if (newTime <= block.timestamp) revert ScheduledSnapshotInThePast();
// if (_scheduledSnapshots.length == 0) revert NoScheduledSnapshot();
//
// (bool foundOld, uint256 index) = _findScheduledSnapshotIndex(oldTime);
// if (!foundOld) revert SnapshotNotFound();
//
// if (
// index + 1 < _scheduledSnapshots.length &&
// newTime >= _scheduledSnapshots[index + 1]
// ) {
// revert TimeGreaterThanNextSnapshot();
// }
//
// if (index > 0 && newTime <= _scheduledSnapshots[index - 1]) {
// revert TimeLessThanPreviousSnapshot();
// }
//
// _scheduledSnapshots[index] = newTime;
//
// emit SnapshotSchedule(oldTime, newTime);
// }
/**
@dev unschedule the last scheduled snapshot
*/
function _unscheduleLastSnapshot(uint256 time) internal {
if (time <= block.timestamp) revert SnapshotAlreadyDone();
if (_scheduledSnapshots.length == 0) revert NoScheduledSnapshot();
if (time != _scheduledSnapshots[_scheduledSnapshots.length - 1])
revert OnlyLastSnapshotCanBeUnscheduled();
_scheduledSnapshots.pop();
emit SnapshotUnschedule(time);
}
// /**
// @dev unschedule (remove) a scheduled snapshot in three steps:
// - search the snapshot in the list
// - If found, move all next snapshots one position to the left
// - Reduce the array size by deleting the last snapshot
// */
// function _unscheduleSnapshotNotOptimized(uint256 time) internal {
// if (time <= block.timestamp) revert SnapshotAlreadyDone();
// (bool isFound, uint256 index) = _findScheduledSnapshotIndex(time);
// if (!isFound) revert SnapshotNotFound();
// for (uint256 i = index; i + 1 < _scheduledSnapshots.length; ) {
// _scheduledSnapshots[i] = _scheduledSnapshots[i + 1];
// unchecked {
// ++i;
// }
// }
// _scheduledSnapshots.pop();
// }
/**
@dev
Get the next scheduled snapshots
*/
function getNextSnapshots() public view returns (uint256[] memory) {
uint256[] memory nextScheduledSnapshot = new uint256[](0);
// no snapshot were planned
if (_scheduledSnapshots.length > 0) {
(
uint256 timeLowerBound,
uint256 indexLowerBound
) = _findScheduledMostRecentPastSnapshot();
// All snapshots are situated in the futur
if ((timeLowerBound == 0) && (_currentSnapshotTime == 0)) {
return _scheduledSnapshots;
} else {
// There are snapshots situated in the futur
if (indexLowerBound + 1 != _scheduledSnapshots.length) {
// All next snapshots are located after the snapshot specified by indexLowerBound
uint256 arraySize = _scheduledSnapshots.length -
indexLowerBound -
1;
nextScheduledSnapshot = new uint256[](arraySize);
for (uint256 i = 0; i < nextScheduledSnapshot.length; ++i) {
nextScheduledSnapshot[i] = _scheduledSnapshots[
indexLowerBound + 1 + i
];
}
}
}
}
return nextScheduledSnapshot;
}
/**
@dev
Get all snapshots
*/
function getAllSnapshots() public view returns (uint256[] memory) {
return _scheduledSnapshots;
}
/**
@notice Return the number of tokens owned by the given owner at the time when the snapshot with the given time was created.
@return value stored in the snapshot, or the actual balance if no snapshot
*/
function snapshotBalanceOf(
uint256 time,
address owner
) public view returns (uint256) {
(bool snapshotted, uint256 value) = _valueAt(
time,
_accountBalanceSnapshots[owner]
);
return snapshotted ? value : balanceOf(owner);
}
/**
@dev See {OpenZeppelin - ERC20Snapshot}
Retrieves the total supply at the specified time.
@return value stored in the snapshot, or the actual totalSupply if no snapshot
*/
function snapshotTotalSupply(uint256 time) public view returns (uint256) {
(bool snapshotted, uint256 value) = _valueAt(
time,
_totalSupplySnapshots
);
return snapshotted ? value : totalSupply();
}
/**
@dev Update balance and/or total supply snapshots before the values are modified. This is implemented
in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
_setCurrentSnapshot();
if (from != address(0)) {
// for both burn and transfer
_updateAccountSnapshot(from);
if (to != address(0)) {
// transfer
_updateAccountSnapshot(to);
} else {
// burn
_updateTotalSupplySnapshot();
}
} else {
// mint
_updateAccountSnapshot(to);
_updateTotalSupplySnapshot();
}
}
/**
@dev See {OpenZeppelin - ERC20Snapshot}
@param time where we want a snapshot
@param snapshots the struct where are stored the snapshots
@return snapshotExist true if a snapshot is found, false otherwise
value 0 if no snapshot, balance value if a snapshot exists
*/
function _valueAt(
uint256 time,
Snapshots storage snapshots
) private view returns (bool snapshotExist, uint256 value) {
// When a valid snapshot is queried, there are three possibilities:
// a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never
// created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds
// to this id is the current one.
// b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the
// requested id, and its value is the one to return.
// c) More snapshots were created after the requested one, and the queried value was later modified. There will be
// no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is
// larger than the requested one.
//
// In summary, we need to find an element in an array, returning the index of the smallest value that is larger if
// it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does
// exactly this.
uint256 index = snapshots.ids.findUpperBound(time);
if (index == snapshots.ids.length) {
return (false, 0);
} else {
return (true, snapshots.values[index]);
}
}
/**
@dev See {OpenZeppelin - ERC20Snapshot}
*/
function _updateAccountSnapshot(address account) private {
_updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));
}
/**
@dev See {OpenZeppelin - ERC20Snapshot}
*/
function _updateTotalSupplySnapshot() private {
_updateSnapshot(_totalSupplySnapshots, totalSupply());
}
/**
@dev
Inside a struct Snapshots:
- Update the array ids to the current Snapshot time if this one is greater than the snapshot times stored in ids.
- Update the value to the corresponding value.
*/
function _updateSnapshot(
Snapshots storage snapshots,
uint256 currentValue
) private {
uint256 current = _currentSnapshotTime;
if (_lastSnapshot(snapshots.ids) < current) {
snapshots.ids.push(current);
snapshots.values.push(currentValue);
}
}
/**
@dev
Set the currentSnapshotTime by retrieving the most recent snapshot
if a snapshot exists, clear all past scheduled snapshot
*/
function _setCurrentSnapshot() internal {
(
uint256 scheduleSnapshotTime,
uint256 scheduleSnapshotIndex
) = _findScheduledMostRecentPastSnapshot();
if (scheduleSnapshotTime > 0) {
_currentSnapshotTime = scheduleSnapshotTime;
_currentSnapshotIndex = scheduleSnapshotIndex;
}
}
/**
@return the last snapshot time inside a snapshot ids array
*/
function _lastSnapshot(
uint256[] storage ids
) private view returns (uint256) {
if (ids.length == 0) {
return 0;
} else {
return ids[ids.length - 1];
}
}
/**
@dev Find the snapshot index at the specified time
@return (true, index) if the snapshot exists, (false, 0) otherwise
*/
function _findScheduledSnapshotIndex(
uint256 time
) private view returns (bool, uint256) {
uint256 indexFound = _scheduledSnapshots.findUpperBound(time);
// Exact match
if (
indexFound != _scheduledSnapshots.length &&
_scheduledSnapshots[indexFound] == time
) {
return (true, indexFound);
}
// Upper bound match
else if (indexFound != _scheduledSnapshots.length) {
return (false, indexFound);
}
// no match
else {
return (false, _scheduledSnapshots.length);
}
}
/**
@dev find the most recent past snapshot
The complexity of this function is O(N) because we go through the whole list
*/
function _findScheduledMostRecentPastSnapshot()
private
view
returns (uint256 time, uint256 index)
{
uint256 currentArraySize = _scheduledSnapshots.length;
// no snapshot or the current snapshot already points on the last snapshot
if (
currentArraySize == 0 ||
((_currentSnapshotIndex + 1 == currentArraySize) && (time != 0))
) {
return (0, currentArraySize);
}
uint256 mostRecent = 0;
index = currentArraySize;
for (uint256 i = _currentSnapshotIndex; i < currentArraySize; ++i) {
if (_scheduledSnapshots[i] <= block.timestamp) {
mostRecent = _scheduledSnapshots[i];
index = i;
} else {
// All snapshot are planned in the futur
break;
}
}
return (mostRecent, index);
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol";
import "../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../interfaces/IEIP1404/IEIP1404Wrapper.sol";
/**
* @dev Validation module.
*
* Useful for to restrict and validate transfers
*/
abstract contract ValidationModuleInternal is
Initializable,
ContextUpgradeable
{
/**
* @dev Emitted when a rule engine is set.
*/
event RuleEngine(IEIP1404Wrapper indexed newRuleEngine);
IEIP1404Wrapper public ruleEngine;
/**
* @dev Initializes the contract with rule engine.
*/
function __Validation_init(
IEIP1404Wrapper ruleEngine_
) internal onlyInitializing {
__Context_init_unchained();
__Validation_init_unchained(ruleEngine_);
}
function __Validation_init_unchained(
IEIP1404Wrapper ruleEngine_
) internal onlyInitializing {
if (address(ruleEngine_) != address(0)) {
ruleEngine = ruleEngine_;
emit RuleEngine(ruleEngine);
}
}
/**
@dev before making a call to this function, you have to check if a ruleEngine is set.
*/
function _validateTransfer(
address from,
address to,
uint256 amount
) internal view returns (bool) {
return ruleEngine.validateTransfer(from, to, amount);
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
// required OZ imports here
import "../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol";
import "./wrapper/mandatory/BaseModule.sol";
import "./wrapper/mandatory/BurnModule.sol";
import "./wrapper/mandatory/MintModule.sol";
import "./wrapper/mandatory/EnforcementModule.sol";
import "./wrapper/mandatory/ERC20BaseModule.sol";
import "./wrapper/mandatory/PauseModule.sol";
import "./wrapper/optional/ValidationModule.sol";
import "./security/AuthorizationModule.sol";
import "../interfaces/IEIP1404/IEIP1404Wrapper.sol";
abstract contract PAYMENT_REDEMPTION_TOKEN_BASE is
Initializable,
ContextUpgradeable,
BaseModule,
PauseModule,
MintModule,
BurnModule,
EnforcementModule,
ValidationModule,
ERC20BaseModule
{
/**
@notice
initialize the proxy contract
The calls to this function will revert if the contract was deployed without a proxy
*/
function initialize(
address admin,
string memory nameIrrevocable,
string memory symbolIrrevocable,
string memory tokenId_,
string memory terms_,
IEIP1404Wrapper ruleEngine_,
string memory information_,
uint256 flag_,
bool restrictTransfer_
) public initializer {
__CMTAT_init(
admin,
nameIrrevocable,
symbolIrrevocable,
tokenId_,
terms_,
ruleEngine_,
information_,
flag_,
restrictTransfer_
);
}
/**
@dev calls the different initialize functions from the different modules
*/
function __CMTAT_init(
address admin,
string memory nameIrrevocable,
string memory symbolIrrevocable,
string memory tokenId_,
string memory terms_,
IEIP1404Wrapper ruleEngine_,
string memory information_,
uint256 flag_,
bool restrictTransfer_
) internal onlyInitializing {
/* OpenZeppelin library */
// OZ init_unchained functions are called firstly due to inheritance
__Context_init_unchained();
__ERC20_init_unchained(nameIrrevocable, symbolIrrevocable);
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
__Pausable_init_unchained();
/* Internal Modules */
__Enforcement_init_unchained();
__Validation_init_unchained(ruleEngine_);
/* Wrapper */
// AuthorizationModule_init_unchained is called firstly due to inheritance
__AuthorizationModule_init_unchained(admin);
__BurnModule_init_unchained();
__MintModule_init_unchained();
// EnforcementModule_init_unchained is called before ValidationModule_init_unchained due to inheritance
__EnforcementModule_init_unchained();
__ERC20Module_init_unchained(0);
// PauseModule_init_unchained is called before ValidationModule_init_unchained due to inheritance
__PauseModule_init_unchained();
__ValidationModule_init_unchained(restrictTransfer_);
/* Other modules */
__Base_init_unchained(tokenId_, terms_, information_, flag_);
/* own function */
__CMTAT_init_unchained();
}
function __CMTAT_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/**
@notice Returns the number of decimals used to get its user representation.
*/
function decimals()
public
view
virtual
override(ERC20Upgradeable, ERC20BaseModule)
returns (uint8)
{
return ERC20BaseModule.decimals();
}
function transferFrom(
address sender,
address recipient,
uint256 amount
)
public
virtual
override(ERC20Upgradeable, ERC20BaseModule)
returns (bool)
{
return ERC20BaseModule.transferFrom(sender, recipient, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal view override(ERC20Upgradeable) {
if(!validateTransfer(from, to, amount)) {
revert TransferRejected();
}
}
uint256[50] private __gap;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
import "../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol";
import "../PAYMENT_REDEMPTION_TOKEN_PROXY.sol";
import "../modules/CMTAT_BASE.sol";
import "../common/errors.sol";
import "../../openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol";
struct RoleMap {
address account;
bytes32 role;
}
error InvalidRole();
contract PAYMENT_REDEMPTION_TOKEN_FACTORY_BASE is Initializable, ContextUpgradeable {
address public paymentRedemptionTokenBeacon;
function initialize(address paymentRedemptionTokenBeacon_) public{
__PAYMENT_REDEMPTION_TOKEN_FACTORY_init(paymentRedemptionTokenBeacon_);
}
function __PAYMENT_REDEMPTION_TOKEN_FACTORY_init(address paymentRedemptionTokenBeacon_) internal initializer {
__Context_init_unchained();
__PAYMENT_REDEMPTION_TOKEN_FACTORY_init_unchained(paymentRedemptionTokenBeacon_);
}
function __PAYMENT_REDEMPTION_TOKEN_FACTORY_init_unchained(address paymentRedemptionTokenBeacon_) internal initializer {
if(paymentRedemptionTokenBeacon_ == address(0)) {
revert Errors.NoZeroAddress();
}
paymentRedemptionTokenBeacon = paymentRedemptionTokenBeacon_;
}
function createPaymentRedemptionToken(uint256 paymentIndex, RoleMap[] memory roles) public returns(address){
CMTAT_BASE cmtat = CMTAT_BASE(_msgSender());
bytes memory initializationData = abi.encodeWithSelector(
PAYMENT_REDEMPTION_TOKEN_PROXY(address(this)).initialize.selector,
address(this),
string.concat(cmtat.name(), " ", "payment", " ", StringsUpgradeable.toString(paymentIndex)),
string.concat(cmtat.symbol(), "P", StringsUpgradeable.toString(paymentIndex)),
cmtat.tokenId(),
cmtat.terms(),
cmtat.ruleEngine(),
cmtat.information(),
cmtat.flag(),
cmtat.restrictTransfer()
);
PAYMENT_REDEMPTION_TOKEN_PROXY paymentRedemptionToken = PAYMENT_REDEMPTION_TOKEN_PROXY(address(new BeaconProxy(paymentRedemptionTokenBeacon, initializationData)));
for(uint256 i = 0; i < roles.length; i++){
if(!cmtat.hasRole(roles[i].role, roles[i].account)) {
revert InvalidRole();
}
paymentRedemptionToken.grantRole(roles[i].role, roles[i].account);
}
paymentRedemptionToken.grantRole(keccak256("MINTER_ROLE"), address(cmtat));
paymentRedemptionToken.grantRole(keccak256("BURNER_ROLE"), address(cmtat));
paymentRedemptionToken.grantRole(keccak256("PAUSER_ROLE"), address(cmtat));
paymentRedemptionToken.pause();
paymentRedemptionToken.renounceRole(keccak256("DEFAULT_ADMIN_ROLE"), address(this));
return address(paymentRedemptionToken);
}
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../common/errors.sol";
import "../../../openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol";
import "../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
abstract contract AuthorizationModule is AccessControlUpgradeable {
// BurnModule
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
// EnforcementModule
bytes32 public constant ENFORCER_ROLE = keccak256("ENFORCER_ROLE");
// MintModule
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
// PauseModule
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
// SnapshotModule
bytes32 public constant SNAPSHOOTER_ROLE = keccak256("SNAPSHOOTER_ROLE");
// DebtModule
bytes32 public constant DEBT_ROLE = keccak256("DEBT_ROLE");
// DistributionModule
bytes32 public constant PAYMENT_UPDATE_ROLE =
keccak256("PAYMENT_UPDATE_ROLE");
// CreditEvents
bytes32 public constant DEBT_CREDIT_EVENT_ROLE =
keccak256("DEBT_CREDIT_EVENT_ROLE");
// IssuanceProgram.sol
bytes32 public constant ISSUER_ROLE = keccak256("ISSUER_ROLE");
function __AuthorizationModule_init(
address admin
) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
__AccessControl_init_unchained();
/* own function */
__AuthorizationModule_init_unchained(admin);
}
/**
* @dev Grants the different roles to the
* account that deploys the contract.
*
*/
function __AuthorizationModule_init_unchained(
address admin
) internal onlyInitializing {
if (admin == address(0)) {
revert Errors.NoZeroAddress();
}
_grantRole(DEFAULT_ADMIN_ROLE, admin);
}
/*
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(
bytes32 role,
address account
) public view virtual override returns (bool) {
// The Default Admin has all roles
if (AccessControlUpgradeable.hasRole(DEFAULT_ADMIN_ROLE, account)) {
return true;
}
return AccessControlUpgradeable.hasRole(role, account);
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
// required OZ imports here
import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../security/AuthorizationModule.sol";
abstract contract BaseModule is AuthorizationModule {
// to initialize inside the implementation constructor when deployed with a Proxy
bool internal deployedWithProxy;
/* Events */
event Term(string indexed newTermIndexed, string newTerm);
event TokenId(string indexed newTokenIdIndexed, string newTokenId);
event Information(
string indexed newInformationIndexed,
string newInformation
);
event Flag(uint256 indexed newFlag);
/* Variables */
string public tokenId;
string public terms;
string public information;
uint256 public flag;
/* Initializers */
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __Base_init(
string memory tokenId_,
string memory terms_,
string memory information_,
uint256 flag_,
address admin
) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
/* CMTAT modules */
// Security
__AuthorizationModule_init_unchained(admin);
// own function
__Base_init_unchained(tokenId_, terms_, information_, flag_);
}
function __Base_init_unchained(
string memory tokenId_,
string memory terms_,
string memory information_,
uint256 flag_
) internal onlyInitializing {
tokenId = tokenId_;
terms = terms_;
information = information_;
flag = flag_;
}
// /* Methods */
// /*
// @notice the tokenId will be changed even if the new value is the same as the current one
// */
// function setTokenId(
// string memory tokenId_
// ) public onlyRole(DEFAULT_ADMIN_ROLE) {
// tokenId = tokenId_;
// emit TokenId(tokenId_, tokenId_);
// }
//
/*
@notice The terms will be changed even if the new value is the same as the current one
*/
function setTerms(string memory terms_) public onlyRole(MINTER_ROLE) {
terms = terms_;
emit Term(terms_, terms_);
}
//
// /*
// @notice The information will be changed even if the new value is the same as the current one
// */
// function setInformation(
// string memory information_
// ) public onlyRole(DEFAULT_ADMIN_ROLE) {
// information = information_;
// emit Information(information_, information_);
// }
//
// function setFlag(uint256 flag_) public onlyRole(DEFAULT_ADMIN_ROLE) {
// flag = flag_;
// emit Flag(flag_);
// }
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../../openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol";
import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../security/AuthorizationModule.sol";
abstract contract BurnModule is ERC20Upgradeable, AuthorizationModule {
event Burn(address indexed owner, uint256 amount, string reason);
function __BurnModule_init(
string memory name_,
string memory symbol_,
address admin
) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
__ERC20_init_unchained(name_, symbol_);
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
/* CMTAT modules */
// Security
__AuthorizationModule_init_unchained(admin);
// own function
__BurnModule_init_unchained();
}
function __BurnModule_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/**
* @dev Destroys `amount` tokens from `account`
*
* See {ERC20-_burn}
*/
function forceBurn(
address account,
uint256 amount,
string memory reason
) public onlyRole(BURNER_ROLE) {
_burn(account, amount);
emit Burn(account, amount, reason);
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../../openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol";
import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../security/AuthorizationModule.sol";
import "../../internal/EnforcementModuleInternal.sol";
/**
* @dev Enforcement module.
*
* Allows the issuer to freeze transfers from a given address
*/
abstract contract EnforcementModule is
EnforcementModuleInternal,
AuthorizationModule
{
string internal constant TEXT_TRANSFER_REJECTED_FROM_FROZEN =
"FROM is frozen";
string internal constant TEXT_TRANSFER_REJECTED_TO_FROZEN = "TO is frozen";
function __EnforcementModule_init(address admin) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
/* CMTAT modules */
// Internal
__Enforcement_init_unchained();
// Security
__AuthorizationModule_init_unchained(admin);
// own function
__EnforcementModule_init_unchained();
}
function __EnforcementModule_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/**
* @notice Freezes an address.
* @param account the account to freeze
* @param reason indicate why the account was frozen.
*/
function freeze(
address account,
string memory reason
) public onlyRole(ENFORCER_ROLE) returns (bool) {
return _freeze(account, reason);
}
/**
* @notice Unfreezes an address.
* @param account the account to unfreeze
* @param reason indicate why the account was unfrozen.
*
*
*/
function unfreeze(
address account,
string memory reason
) public onlyRole(ENFORCER_ROLE) returns (bool) {
return _unfreeze(account, reason);
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
// required OZ imports here
import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../../../openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol";
abstract contract ERC20BaseModule is ERC20Upgradeable {
/* Events */
event Spend(address indexed owner, address indexed spender, uint256 amount);
/* Variables */
uint8 private _decimals;
/* Initializers */
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __ERC20Module_init(
string memory name_,
string memory symbol_,
uint8 decimals_
) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
__ERC20_init(name_, symbol_);
/* own function */
__ERC20Module_init_unchained(decimals_);
}
function __ERC20Module_init_unchained(
uint8 decimals_
) internal onlyInitializing {
_decimals = decimals_;
}
/* Methods */
/**
* @notice Returns the number of decimals used to get its user representation.
* @dev
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
bool result = super.transferFrom(sender, recipient, amount);
// The result will be normally always true because OpenZeppelin uses require to check all the conditions.
if (result) {
emit Spend(sender, _msgSender(), amount);
}
return result;
}
// Commented out seems not necessary and breaks ERC20 interface
// /**
// * @dev See {IERC20-approve}.
// *
// * Requirements:
// *
// * - `spender` cannot be the zero address.
// */
// function approve(
// address spender,
// uint256 amount,
// uint256 currentAllowance
// ) public virtual returns (bool) {
// require(
// allowance(_msgSender(), spender) == currentAllowance,
// "CMTAT: current allowance is not right"
// );
// super.approve(spender, amount);
// return true;
// }
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../../openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol";
import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../security/AuthorizationModule.sol";
abstract contract MintModule is ERC20Upgradeable, AuthorizationModule {
event Mint(address indexed beneficiary, uint256 amount);
function __MintModule_init(
string memory name_,
string memory symbol_,
address admin
) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
__ERC20_init_unchained(name_, symbol_);
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
/* CMTAT modules */
// Security
__AuthorizationModule_init_unchained(admin);
// own function
__MintModule_init_unchained();
}
function __MintModule_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/**
* @dev Creates `amount` new tokens for `to`.
*
* See {ERC20-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
_mint(to, amount);
emit Mint(to, amount);
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../../openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol";
import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../security/AuthorizationModule.sol";
/**
* @dev ERC20 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/
abstract contract PauseModule is PausableUpgradeable, AuthorizationModule {
string internal constant TEXT_TRANSFER_REJECTED_PAUSED =
"All transfers paused";
function __PauseModule_init(address admin) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
__Pausable_init_unchained();
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
/* CMTAT modules */
// Security
__AuthorizationModule_init_unchained(admin);
// own function
__PauseModule_init_unchained();
}
function __PauseModule_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() public onlyRole(PAUSER_ROLE) {
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() public onlyRole(PAUSER_ROLE) {
_unpause();
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../../../openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol";
import "../../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../../../interfaces/IDebtGlobal.sol";
import "../../../security/AuthorizationModule.sol";
abstract contract CreditEventsModule is
IDebtGlobal,
Initializable,
ContextUpgradeable,
AuthorizationModule
{
CreditEvents public creditEvents;
/* Events */
event FlagDefault(bool indexed newFlagDefault);
event FlagRedeemed(bool indexed newFlagRedeemed);
event Rating(string indexed newRatingIndexed, string newRating);
function __CreditEvents_init(address admin) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
/* CMTAT modules */
// Security
__AuthorizationModule_init_unchained(admin);
// own function
__CreditEvents_init_unchained();
}
function __CreditEvents_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/*
@notice Set all attributes of creditEvents
The values of all attributes will be changed even if the new values are the same as the current ones
*/
function setCreditEvents(
bool flagDefault_,
bool flagRedeemed_,
string memory rating_
) public onlyRole(DEBT_CREDIT_EVENT_ROLE) {
creditEvents = (CreditEvents(flagDefault_, flagRedeemed_, rating_));
emit FlagDefault(flagDefault_);
emit FlagRedeemed(flagRedeemed_);
emit Rating(rating_, rating_);
}
function setFlagDefault(
bool flagDefault_
) public onlyRole(DEBT_CREDIT_EVENT_ROLE) {
creditEvents.flagDefault = flagDefault_;
emit FlagDefault(flagDefault_);
}
function setFlagRedeemed(
bool flagRedeemed_
) public onlyRole(DEBT_CREDIT_EVENT_ROLE) {
creditEvents.flagRedeemed = flagRedeemed_;
emit FlagRedeemed(flagRedeemed_);
}
function setRating(
string memory rating_
) public onlyRole(DEBT_CREDIT_EVENT_ROLE) {
creditEvents.rating = rating_;
emit Rating(rating_, rating_);
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../../../openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol";
import "../../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../../../interfaces/IDebtGlobal.sol";
import "../../../security/AuthorizationModule.sol";
import "../../../../common/errors.sol";
error DuplicateLabel(uint256 label);
abstract contract DebtBaseModule is
IDebtGlobal,
Initializable,
ContextUpgradeable,
AuthorizationModule
{
DebtBase public debt;
DebtAdditionalInfo public debtAdditionalInfo;
/* Events */
event InterestRate(uint256 newInterestRate);
event ParValue(uint256 newParValue);
event Guarantor(string indexed newGuarantorIndexed, string newGuarantor);
event BondHolder(string indexed newBondHolderIndexed, string newBondHolder);
event MaturityDate(
string indexed newMaturityDateIndexed,
string newMaturityDate
);
event InterestScheduleFormat(
string indexed newInterestScheduleFormatIndexed,
string newInterestScheduleFormat
);
event InterestPaymentDate(
string indexed newInterestPaymentDateIndexed,
string newInterestPaymentDate
);
event DayCountConvention(
string indexed newDayCountConventionIndexed,
string newDayCountConvention
);
event BusinessDayConvention(
string indexed newBusinessDayConventionIndexed,
string newBusinessDayConvention
);
event PublicHolidaysCalendar(
string indexed newPublicHolidaysCalendarIndexed,
string newPublicHolidaysCalendar
);
event IssuanceDate(
string indexed newIssuanceDateIndexed,
string newIssuanceDate
);
event CouponFrequency(
string indexed newCouponFrequencyIndexed,
string newCouponFrequency
);
event IssuerName(string indexed issuerName_);
event IssuerInfo(string indexed issuerInfo_);
event Currency(address indexed currency_);
event Labels(uint8[] labels_);
function __DebtBaseModule_init(address admin) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
/* CMTAT modules */
// Security
__AuthorizationModule_init_unchained(admin);
// own function
__DebtBaseModule_init_unchained();
}
function __DebtBaseModule_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/*
@notice Set all attributes of debt
The values of all attributes will be changed even if the new values are the same as the current ones
*/
function setDebt(DebtBase memory debt_) public onlyRole(DEBT_ROLE) {
// setGuarantor
debt = (
DebtBase(
debt_.interestRate,
debt_.parValue,
debt_.guarantor,
debt_.bondHolder,
debt_.maturityDate,
debt_.interestScheduleFormat,
debt_.interestPaymentDate,
debt_.dayCountConvention,
debt_.businessDayConvention,
debt_.publicHolidaysCalendar,
debt_.issuanceDate,
debt_.couponFrequency
)
);
emit InterestRate(debt_.interestRate);
emit ParValue(debt_.parValue);
emit Guarantor(debt_.guarantor, debt_.guarantor);
emit BondHolder(debt_.bondHolder, debt_.bondHolder);
emit MaturityDate(debt_.maturityDate, debt_.maturityDate);
emit InterestScheduleFormat(
debt_.interestScheduleFormat,
debt_.interestScheduleFormat
);
emit InterestPaymentDate(
debt_.interestPaymentDate,
debt_.interestPaymentDate
);
emit DayCountConvention(
debt_.dayCountConvention,
debt_.dayCountConvention
);
emit BusinessDayConvention(
debt_.businessDayConvention,
debt_.businessDayConvention
);
emit PublicHolidaysCalendar(
debt_.publicHolidaysCalendar,
debt_.publicHolidaysCalendar
);
emit IssuanceDate(debt_.issuanceDate, debt_.issuanceDate);
emit CouponFrequency(debt_.couponFrequency, debt_.couponFrequency);
}
function setDebtAdditionalInfo(
string memory issuerName_,
string memory issuerInfo_,
IERC20 currency_,
uint8[] memory labels_
) public onlyRole(DEBT_ROLE) {
if(address(currency_) == address(0)) revert Errors.NoZeroAddress();
debtAdditionalInfo = (
DebtAdditionalInfo(
issuerName_,
issuerInfo_,
currency_,
labels_
)
);
emit IssuerName(issuerName_);
emit IssuerInfo(issuerInfo_);
emit Currency(address(currency_));
emit Labels(labels_);
}
function getLabels() public view returns (uint8[] memory) {
return debtAdditionalInfo.labels;
}
/*
@notice The call will be reverted if the new value of interestRate is the same as the current one
*/
function setInterestRate(uint256 interestRate_) public onlyRole(DEBT_ROLE) {
debt.interestRate = interestRate_;
emit InterestRate(interestRate_);
}
/*
@notice The call will be reverted if the new value of parValue is the same as the current one
*/
function setParValue(uint256 parValue_) public onlyRole(DEBT_ROLE) {
debt.parValue = parValue_;
emit ParValue(parValue_);
}
/*
@notice The Guarantor will be changed even if the new value is the same as the current one
*/
function setGuarantor(string memory guarantor_) public onlyRole(DEBT_ROLE) {
debt.guarantor = guarantor_;
emit Guarantor(guarantor_, guarantor_);
}
/*
@notice The bonHolder will be changed even if the new value is the same as the current one
*/
function setBondHolder(
string memory bondHolder_
) public onlyRole(DEBT_ROLE) {
debt.bondHolder = bondHolder_;
emit BondHolder(bondHolder_, bondHolder_);
}
/*
@notice The maturityDate will be changed even if the new value is the same as the current one
*/
function setMaturityDate(
string memory maturityDate_
) public onlyRole(DEBT_ROLE) {
debt.maturityDate = maturityDate_;
emit MaturityDate(maturityDate_, maturityDate_);
}
/*
@notice The interestScheduleFormat will be changed even if the new value is the same as the current one
*/
function setInterestScheduleFormat(
string memory interestScheduleFormat_
) public onlyRole(DEBT_ROLE) {
debt.interestScheduleFormat = interestScheduleFormat_;
emit InterestScheduleFormat(
interestScheduleFormat_,
interestScheduleFormat_
);
}
/*
@notice The interestPaymentDate will be changed even if the new value is the same as the current one
*/
function setInterestPaymentDate(
string memory interestPaymentDate_
) public onlyRole(DEBT_ROLE) {
debt.interestPaymentDate = interestPaymentDate_;
emit InterestPaymentDate(interestPaymentDate_, interestPaymentDate_);
}
/*
@notice The dayCountConvention will be changed even if the new value is the same as the current one
*/
function setDayCountConvention(
string memory dayCountConvention_
) public onlyRole(DEBT_ROLE) {
debt.dayCountConvention = dayCountConvention_;
emit DayCountConvention(dayCountConvention_, dayCountConvention_);
}
/*
@notice The businessDayConvention will be changed even if the new value is the same as the current one
*/
function setBusinessDayConvention(
string memory businessDayConvention_
) public onlyRole(DEBT_ROLE) {
debt.businessDayConvention = businessDayConvention_;
emit BusinessDayConvention(
businessDayConvention_,
businessDayConvention_
);
}
/*
@notice The publicHolidayCalendar will be changed even if the new value is the same as the current one
*/
function setPublicHolidaysCalendar(
string memory publicHolidaysCalendar_
) public onlyRole(DEBT_ROLE) {
debt.publicHolidaysCalendar = publicHolidaysCalendar_;
emit PublicHolidaysCalendar(
publicHolidaysCalendar_,
publicHolidaysCalendar_
);
}
/*
@notice The issuanceDate will be changed even if the new value is the same as the current one
*/
function setIssuanceDate(
string memory issuanceDate_
) public onlyRole(DEBT_ROLE) {
debt.issuanceDate = issuanceDate_;
emit IssuanceDate(issuanceDate_, issuanceDate_);
}
/*
@notice The couponFrequency will be changed even if the new value is the same as the current one
*/
function setCouponFrequency(
string memory couponFrequency_
) public onlyRole(DEBT_ROLE) {
debt.couponFrequency = couponFrequency_;
emit CouponFrequency(couponFrequency_, couponFrequency_);
}
uint256[50] private __gap;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
import "../../../../common/errors.sol";
import "../../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../../security/AuthorizationModule.sol";
import "../../../internal/SnapshotModuleInternal.sol";
import "../../../internal/ValidationModuleInternal.sol";
import "../../../../../openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol";
import "../../../PAYMENT_REDEMPTION_TOKEN_BASE.sol";
import "../../../../../openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../../../PAYMENT_REDEMPTION_TOKEN_FACTORY_BASE.sol";
import "./DebtBaseModule.sol";
error DistributionDateNotAfterLast(
uint256 distributionDate,
uint256 lastDistributionDate
);
error PaymentNotCompleted(uint256 index);
error OutOfOrder();
error AlreadyMinted();
error ImmutablePayment();
error AlreadyRepaid();
struct Payment {
uint256 amount; // per unit in currency
uint256 distributionDateInSeconds;
PAYMENT_REDEMPTION_TOKEN_BASE paymentRedemptionToken;
bool allTokensMinted;
bool mut;
}
contract DistributionModule is
Initializable,
ContextUpgradeable,
SnapshotModuleInternal,
AuthorizationModule,
ValidationModule,
DebtBaseModule
{
Payment[] public payments;
uint256 public pendingPaymentIndex;
PAYMENT_REDEMPTION_TOKEN_FACTORY_BASE public paymentRedemptionTokenFactory;
event PushPayment(
uint256 indexed amount,
uint256 indexed distributionDate,
address indexed paymentRedemptionToken
);
event UpdatePaymentAmount(uint256 indexed amount, address indexed signer);
event PopPayment(uint256 indexed index);
event Repay(uint256 indexed index, uint256 indexed amount);
event RevertRepayment(uint256 indexed index, uint256 indexed amount);
event MintPaymentRedemptionToken(
address indexed paymentRedemptionToken,
uint256 indexed amount,
address indexed to
);
event ClaimPayment(
uint256 indexed index,
address indexed holder,
uint256 indexed units
);
function __DistributionModule_init(
address admin,
string memory name_,
string memory symbol_,
IEIP1404Wrapper ruleEngine_,
address paymentRedemptionTokenFactory_,
bool restrictTransfer_
) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
__AccessControl_init_unchained();
__Pausable_init_unchained();
// SnapshotModuelInternal inherits from ERC20
__ERC20_init_unchained(name_, symbol_);
// Wrapper
__PauseModule_init_unchained();
__EnforcementModule_init_unchained();
/* CMTAT modules */
// Internal
__Validation_init_unchained(ruleEngine_);
__Snapshot_init_unchained();
// Security
__AuthorizationModule_init_unchained(admin);
__ValidationModule_init_unchained(restrictTransfer_);
__DebtBaseModule_init_unchained();
// own function
__DistributionModule_init_unchained(paymentRedemptionTokenFactory_);
}
function __DistributionModule_init_unchained(
address paymentRedemptionTokenFactory_
) public onlyInitializing {
paymentRedemptionTokenFactory = PAYMENT_REDEMPTION_TOKEN_FACTORY_BASE(
paymentRedemptionTokenFactory_
);
}
function pushPayment(
uint256 amount,
uint256 distributionDate,
RoleMap[] memory roles,
bool mut
) public onlyRole(DEFAULT_ADMIN_ROLE) returns (address) {
if (address(debtAdditionalInfo.currency) == address(0)) {
revert Errors.NoZeroAddress();
}
if (distributionDate <= block.timestamp) {
revert Errors.DateInPast(distributionDate);
}
if (
payments.length != 0 &&
payments[payments.length - 1].distributionDateInSeconds >=
distributionDate
) {
revert DistributionDateNotAfterLast(
distributionDate,
payments[payments.length - 1].distributionDateInSeconds
);
}
PAYMENT_REDEMPTION_TOKEN_BASE newPaymentRedemptionToken = PAYMENT_REDEMPTION_TOKEN_BASE(
paymentRedemptionTokenFactory.createPaymentRedemptionToken(
payments.length,
roles
)
);
payments.push(
Payment(
amount,
distributionDate,
newPaymentRedemptionToken,
false,
mut
)
);
emit PushPayment(
amount,
distributionDate,
address(newPaymentRedemptionToken)
);
return address(newPaymentRedemptionToken);
}
function updatePaymentAmount(
uint256 index,
uint256 amount
) public onlyRole(PAYMENT_UPDATE_ROLE) {
if (index >= payments.length) {
revert Errors.OutOfBounds(index);
}
if (index < pendingPaymentIndex) {
revert AlreadyRepaid();
}
if (!payments[index].mut) {
revert ImmutablePayment();
}
payments[index].amount = amount;
emit UpdatePaymentAmount(amount, _msgSender());
}
function mintPaymentRedemptionToken(
uint256 paymentIndex,
address holder
) public {
if (paymentIndex >= pendingPaymentIndex) {
revert PaymentNotCompleted(paymentIndex);
}
if (payments[paymentIndex].allTokensMinted) {
revert AlreadyMinted();
}
if (getAllSnapshots()[paymentIndex] > block.timestamp) {
revert Errors.DateInFuture(getAllSnapshots()[paymentIndex]);
}
uint256 snapshotBalance = snapshotBalanceOf(
getAllSnapshots()[paymentIndex],
holder
);
if (snapshotBalance == 0) {
revert InsufficientBalance(snapshotBalance);
}
/**
* @dev
* This checks that the holder hasn't received any tokens yet
* and works as the token is paused as long as we're in minting phase
**/
if (
payments[paymentIndex].paymentRedemptionToken.balanceOf(holder) != 0
) {
revert AlreadyMinted();
}
payments[paymentIndex].paymentRedemptionToken.unpause();
payments[paymentIndex].paymentRedemptionToken.mint(
holder,
snapshotBalance
);
/**
* @dev
* as long as the total supply is less than the snapshot total supply, the token stays paused
**/
if (
payments[paymentIndex].paymentRedemptionToken.totalSupply() <
snapshotTotalSupply(getAllSnapshots()[paymentIndex])
) {
payments[paymentIndex].paymentRedemptionToken.pause();
} else {
payments[paymentIndex].allTokensMinted = true;
}
emit MintPaymentRedemptionToken(
address(payments[paymentIndex].paymentRedemptionToken),
snapshotBalanceOf(getAllSnapshots()[paymentIndex], holder),
holder
);
}
// We always validateTransfer on repayments
function repay(uint256 paymentIndex) public {
if (
address(ruleEngine) != address(0) &&
address(ruleEngine) != 0x4619Ae227c558a5CBBFa824254634bf44517b99A &&
!_validateTransfer(
_msgSender(),
address(0),
payments[paymentIndex].amount * totalSupply()
)
) {
revert TransferRejected();
}
if (paymentIndex >= payments.length) {
revert Errors.OutOfBounds(paymentIndex);
}
if (paymentIndex != pendingPaymentIndex) {
revert OutOfOrder();
}
if (
!debtAdditionalInfo.currency.transferFrom(
_msgSender(),
address(this),
payments[paymentIndex].amount * totalSupply()
)
) {
revert Errors.TransferFailed();
}
if (
payments[paymentIndex].distributionDateInSeconds > block.timestamp
) {
_scheduleSnapshot(payments[paymentIndex].distributionDateInSeconds);
} else {
_scheduleSnapshot(block.timestamp + 1);
}
pendingPaymentIndex++;
emit Repay(paymentIndex, payments[paymentIndex].amount * totalSupply());
}
function revertRepayment(
uint256 paymentIndex
) public onlyRole(ISSUER_ROLE) {
if (paymentIndex >= payments.length) {
revert Errors.OutOfBounds(paymentIndex);
}
if (paymentIndex != pendingPaymentIndex - 1) {
revert OutOfOrder();
}
if (
payments[paymentIndex].distributionDateInSeconds <= block.timestamp
) {
revert Errors.DateInPast(
payments[paymentIndex].distributionDateInSeconds
);
}
if (
address(ruleEngine) != address(0) &&
address(ruleEngine) != 0x4619Ae227c558a5CBBFa824254634bf44517b99A &&
!_validateTransfer(
address(0),
_msgSender(),
payments[paymentIndex].amount * this.totalSupply()
)
) {
revert TransferRejected();
}
if (
!debtAdditionalInfo.currency.transfer(
_msgSender(),
payments[paymentIndex].amount * totalSupply()
)
) revert Errors.TransferFailed();
_unscheduleLastSnapshot(
payments[paymentIndex].distributionDateInSeconds
);
pendingPaymentIndex--;
emit RevertRepayment(
paymentIndex,
payments[paymentIndex].amount * totalSupply()
);
}
function claimPayment(uint256 index) public {
if (index >= payments.length) {
revert Errors.OutOfBounds(index);
}
if (index >= pendingPaymentIndex) {
revert PaymentNotCompleted(index);
}
uint256 paymentRedemptionTokenBalance = payments[index]
.paymentRedemptionToken
.balanceOf(_msgSender());
if (paymentRedemptionTokenBalance == 0) {
revert InsufficientBalance(
payments[index].paymentRedemptionToken.balanceOf(_msgSender())
);
}
if (
address(ruleEngine) != address(0) &&
address(ruleEngine) != 0x4619Ae227c558a5CBBFa824254634bf44517b99A &&
!_validateTransfer(
address(0),
_msgSender(),
payments[index].amount * paymentRedemptionTokenBalance
)
) {
revert TransferRejected();
}
uint256 paymentAmount = payments[index].amount *
paymentRedemptionTokenBalance;
payments[index].paymentRedemptionToken.forceBurn(
_msgSender(),
paymentRedemptionTokenBalance,
""
);
if (
!debtAdditionalInfo.currency.transfer(_msgSender(), paymentAmount)
) {
revert Errors.TransferFailed();
}
emit ClaimPayment(index, _msgSender(), paymentRedemptionTokenBalance);
}
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../security/AuthorizationModule.sol";
import "../../internal/ValidationModuleInternal.sol";
import "../mandatory/PauseModule.sol";
import "../mandatory/EnforcementModule.sol";
error TransferRejected();
/**
* @dev Validation module.
*
* Useful for to restrict and validate transfers
*/
abstract contract ValidationModule is
ValidationModuleInternal,
PauseModule,
EnforcementModule
{
bool public restrictTransfer;
function __ValidationModule_init(
IEIP1404Wrapper ruleEngine_,
bool restrictTransfer_,
address admin
) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
__AccessControl_init_unchained();
__Pausable_init_unchained();
/* CMTAT modules */
// Internal
__Validation_init_unchained(ruleEngine_);
// Security
__AuthorizationModule_init_unchained(admin);
// Wrapper
__PauseModule_init_unchained();
__EnforcementModule_init_unchained();
// own function
__ValidationModule_init_unchained(restrictTransfer_);
}
function __ValidationModule_init_unchained(
bool restrictTransfer_
) internal onlyInitializing {
restrictTransfer = restrictTransfer_;
}
/*
@notice set a RuleEngine
@param ruleEngine_
*/
function setRuleEngine(
IEIP1404Wrapper ruleEngine_
) external onlyRole(DEFAULT_ADMIN_ROLE) {
ruleEngine = ruleEngine_;
emit RuleEngine(ruleEngine_);
}
function validateTransfer(
address from,
address to,
uint256 amount
) public view returns (bool) {
if (paused() || frozen(from) || frozen(to)) {
return false;
}
if (address(ruleEngine) != address(0) && restrictTransfer) {
// @dev this allows our issuance program to mint tokens to itself
if (from == address(0) && hasRole(MINTER_ROLE, to)) {
return true;
}
// @dev minter role is allowed to send tokens to anyone (issuance program checks whitelist)
if (hasRole(MINTER_ROLE, from)) {
return true;
}
return _validateTransfer(from, to, amount);
}
return true;
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "./modules/PAYMENT_REDEMPTION_TOKEN_BASE.sol";
contract PAYMENT_REDEMPTION_TOKEN_PROXY is PAYMENT_REDEMPTION_TOKEN_BASE {
/**
@notice Contract version for the deployment with a proxy */
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
// Disable the possibility to initialize the implementation
_disableInitializers();
}
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(account),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
error ContractAlreadyInitialized();
error ContractNotInitializing();
error ContractInitializing();
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* 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;
if(
!((isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1))
) {
revert ContractAlreadyInitialized();
}
_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) {
if(_initializing || _initialized < version) {
revert ContractAlreadyInitialized();
}
_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() {
if(!_initializing) {
revert ContractNotInitializing();
}
_;
}
/**
* @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 {
if(_initializing) {
revert ContractInitializing();
}
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.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";
error ZeroAddressTransferNotAllowed(address from, address to);
error InsufficientBalance(uint256 balance);
error AllowanceBelowZeroNotAllowed();
error ZeroAddressMintNotAllowed();
error ZeroAddressBurnNotAllowed();
error ZeroAddressApproveNotAllowed(address owner, address spender);
error InsufficientAllowance(uint256 amount, uint256 allowance);
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
__ERC20_init_unchained(name_, symbol_);
}
function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
if(currentAllowance < subtractedValue) {
revert AllowanceBelowZeroNotAllowed();
}
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
if(from == address(0) || to == address(0)) {
revert ZeroAddressTransferNotAllowed(from, to);
}
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
if(fromBalance < amount) {
revert InsufficientBalance(fromBalance);
}
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
if (account == address(0)) {
revert ZeroAddressMintNotAllowed();
}
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
if(account == address(0)) {
revert ZeroAddressBurnNotAllowed();
}
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
if (accountBalance < amount) {
revert InsufficientBalance(accountBalance);
}
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
if(owner == address(0) || spender == address(0)) {
revert ZeroAddressApproveNotAllowed(owner, spender);
}
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < amount) {
revert InsufficientAllowance(amount, currentAllowance);
}
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @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[45] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on exceptions.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data
) internal returns (bytes memory) {
return
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 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 (last updated v4.8.0) (utils/Arrays.sol)
pragma solidity ^0.8.0;
import "./StorageSlotUpgradeable.sol";
import "./math/MathUpgradeable.sol";
/**
* @dev Collection of functions related to array types.
*/
library ArraysUpgradeable {
using StorageSlotUpgradeable for bytes32;
/**
* @dev Searches a sorted `array` and returns the first index that contains
* a value greater or equal to `element`. If no such index exists (i.e. all
* values in the array are strictly less than `element`), the array length is
* returned. Time complexity O(log n).
*
* `array` is expected to be sorted in ascending order, and to contain no
* repeated elements.
*/
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
if (array.length == 0) {
return 0;
}
uint256 low = 0;
uint256 high = array.length;
while (low < high) {
uint256 mid = MathUpgradeable.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds down (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
low = mid + 1;
}
}
// At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
if (low > 0 && unsafeAccess(array, low - 1).value == element) {
return low - 1;
} else {
return low;
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlotUpgradeable.AddressSlot storage) {
bytes32 slot;
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getAddressSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlotUpgradeable.Bytes32Slot storage) {
bytes32 slot;
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getBytes32Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlotUpgradeable.Uint256Slot storage) {
bytes32 slot;
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getUint256Slot();
}
}// 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 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
*/
library StorageSlotUpgradeable {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}{
"optimizer": {
"enabled": true,
"runs": 1,
"details": {
"yul": true
}
},
"viaIR": false,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AllowanceBelowZeroNotAllowed","type":"error"},{"inputs":[],"name":"AlreadyMinted","type":"error"},{"inputs":[],"name":"AlreadyRepaid","type":"error"},{"inputs":[],"name":"ContractAlreadyInitialized","type":"error"},{"inputs":[],"name":"ContractInitializing","type":"error"},{"inputs":[],"name":"ContractNotInitializing","type":"error"},{"inputs":[{"internalType":"uint256","name":"date","type":"uint256"}],"name":"DateInFuture","type":"error"},{"inputs":[{"internalType":"uint256","name":"date","type":"uint256"}],"name":"DateInPast","type":"error"},{"inputs":[{"internalType":"uint256","name":"distributionDate","type":"uint256"},{"internalType":"uint256","name":"lastDistributionDate","type":"uint256"}],"name":"DistributionDateNotAfterLast","type":"error"},{"inputs":[],"name":"ImmutablePayment","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"allowance","type":"uint256"}],"name":"InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"NoScheduledSnapshot","type":"error"},{"inputs":[],"name":"NoZeroAddress","type":"error"},{"inputs":[],"name":"OnlyLastSnapshotCanBeUnscheduled","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"OutOfBounds","type":"error"},{"inputs":[],"name":"OutOfOrder","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"PaymentNotCompleted","type":"error"},{"inputs":[],"name":"ScheduledSnapshotInThePast","type":"error"},{"inputs":[],"name":"SnapshotAlreadyDone","type":"error"},{"inputs":[],"name":"TimeLessThanLastSnapshot","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"TransferRejected","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"ZeroAddressApproveNotAllowed","type":"error"},{"inputs":[],"name":"ZeroAddressBurnNotAllowed","type":"error"},{"inputs":[],"name":"ZeroAddressMintNotAllowed","type":"error"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"ZeroAddressTransferNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newBondHolderIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newBondHolder","type":"string"}],"name":"BondHolder","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newBusinessDayConventionIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newBusinessDayConvention","type":"string"}],"name":"BusinessDayConvention","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":true,"internalType":"uint256","name":"units","type":"uint256"}],"name":"ClaimPayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newCouponFrequencyIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newCouponFrequency","type":"string"}],"name":"CouponFrequency","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"currency_","type":"address"}],"name":"Currency","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newDayCountConventionIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newDayCountConvention","type":"string"}],"name":"DayCountConvention","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"newFlag","type":"uint256"}],"name":"Flag","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"newFlagDefault","type":"bool"}],"name":"FlagDefault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"newFlagRedeemed","type":"bool"}],"name":"FlagRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"enforcer","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"string","name":"reasonIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"Freeze","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newGuarantorIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newGuarantor","type":"string"}],"name":"Guarantor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newInformationIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newInformation","type":"string"}],"name":"Information","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newInterestPaymentDateIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newInterestPaymentDate","type":"string"}],"name":"InterestPaymentDate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newInterestRate","type":"uint256"}],"name":"InterestRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newInterestScheduleFormatIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newInterestScheduleFormat","type":"string"}],"name":"InterestScheduleFormat","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newIssuanceDateIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newIssuanceDate","type":"string"}],"name":"IssuanceDate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"issuerInfo_","type":"string"}],"name":"IssuerInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"issuerName_","type":"string"}],"name":"IssuerName","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8[]","name":"labels_","type":"uint8[]"}],"name":"Labels","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newMaturityDateIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newMaturityDate","type":"string"}],"name":"MaturityDate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"paymentRedemptionToken","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"MintPaymentRedemptionToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newParValue","type":"uint256"}],"name":"ParValue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"}],"name":"PopPayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newPublicHolidaysCalendarIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newPublicHolidaysCalendar","type":"string"}],"name":"PublicHolidaysCalendar","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"distributionDate","type":"uint256"},{"indexed":true,"internalType":"address","name":"paymentRedemptionToken","type":"address"}],"name":"PushPayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newRatingIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newRating","type":"string"}],"name":"Rating","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Repay","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RevertRepayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IEIP1404Wrapper","name":"newRuleEngine","type":"address"}],"name":"RuleEngine","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"oldTime","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"newTime","type":"uint256"}],"name":"SnapshotSchedule","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"time","type":"uint256"}],"name":"SnapshotUnschedule","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Spend","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newTermIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newTerm","type":"string"}],"name":"Term","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newTokenIdIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"newTokenId","type":"string"}],"name":"TokenId","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"enforcer","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"string","name":"reasonIndexed","type":"string"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"Unfreeze","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"signer","type":"address"}],"name":"UpdatePaymentAmount","type":"event"},{"inputs":[],"name":"BURNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEBT_CREDIT_EVENT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEBT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ENFORCER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ISSUER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAYMENT_UPDATE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SNAPSHOOTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"paymentRedemptionTokenFactory_","type":"address"}],"name":"__DistributionModule_init_unchained","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"claimPayment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"creditEvents","outputs":[{"internalType":"bool","name":"flagDefault","type":"bool"},{"internalType":"bool","name":"flagRedeemed","type":"bool"},{"internalType":"string","name":"rating","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"debt","outputs":[{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"parValue","type":"uint256"},{"internalType":"string","name":"guarantor","type":"string"},{"internalType":"string","name":"bondHolder","type":"string"},{"internalType":"string","name":"maturityDate","type":"string"},{"internalType":"string","name":"interestScheduleFormat","type":"string"},{"internalType":"string","name":"interestPaymentDate","type":"string"},{"internalType":"string","name":"dayCountConvention","type":"string"},{"internalType":"string","name":"businessDayConvention","type":"string"},{"internalType":"string","name":"publicHolidaysCalendar","type":"string"},{"internalType":"string","name":"issuanceDate","type":"string"},{"internalType":"string","name":"couponFrequency","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"debtAdditionalInfo","outputs":[{"internalType":"string","name":"issuerName","type":"string"},{"internalType":"string","name":"issuerInfo","type":"string"},{"internalType":"contract IERC20","name":"currency","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flag","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"reason","type":"string"}],"name":"forceBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"string","name":"reason","type":"string"}],"name":"freeze","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"frozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllSnapshots","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLabels","outputs":[{"internalType":"uint8[]","name":"","type":"uint8[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextSnapshots","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"information","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"string","name":"nameIrrevocable","type":"string"},{"internalType":"string","name":"symbolIrrevocable","type":"string"},{"internalType":"string","name":"tokenId_","type":"string"},{"internalType":"string","name":"terms_","type":"string"},{"internalType":"contract IEIP1404Wrapper","name":"ruleEngine_","type":"address"},{"internalType":"string","name":"information_","type":"string"},{"internalType":"uint256","name":"flag_","type":"uint256"},{"internalType":"address","name":"paymentRedemptionTokenFactory_","type":"address"},{"internalType":"bool","name":"restrictTransfer_","type":"bool"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"paymentIndex","type":"uint256"},{"internalType":"address","name":"holder","type":"address"}],"name":"mintPaymentRedemptionToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentRedemptionTokenFactory","outputs":[{"internalType":"contract PAYMENT_REDEMPTION_TOKEN_FACTORY_BASE","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"payments","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"distributionDateInSeconds","type":"uint256"},{"internalType":"contract PAYMENT_REDEMPTION_TOKEN_BASE","name":"paymentRedemptionToken","type":"address"},{"internalType":"bool","name":"allTokensMinted","type":"bool"},{"internalType":"bool","name":"mut","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingPaymentIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"distributionDate","type":"uint256"},{"components":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"role","type":"bytes32"}],"internalType":"struct RoleMap[]","name":"roles","type":"tuple[]"},{"internalType":"bool","name":"mut","type":"bool"}],"name":"pushPayment","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"paymentIndex","type":"uint256"}],"name":"repay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"restrictTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"paymentIndex","type":"uint256"}],"name":"revertRepayment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ruleEngine","outputs":[{"internalType":"contract IEIP1404Wrapper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"bondHolder_","type":"string"}],"name":"setBondHolder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"businessDayConvention_","type":"string"}],"name":"setBusinessDayConvention","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"couponFrequency_","type":"string"}],"name":"setCouponFrequency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"flagDefault_","type":"bool"},{"internalType":"bool","name":"flagRedeemed_","type":"bool"},{"internalType":"string","name":"rating_","type":"string"}],"name":"setCreditEvents","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"dayCountConvention_","type":"string"}],"name":"setDayCountConvention","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"parValue","type":"uint256"},{"internalType":"string","name":"guarantor","type":"string"},{"internalType":"string","name":"bondHolder","type":"string"},{"internalType":"string","name":"maturityDate","type":"string"},{"internalType":"string","name":"interestScheduleFormat","type":"string"},{"internalType":"string","name":"interestPaymentDate","type":"string"},{"internalType":"string","name":"dayCountConvention","type":"string"},{"internalType":"string","name":"businessDayConvention","type":"string"},{"internalType":"string","name":"publicHolidaysCalendar","type":"string"},{"internalType":"string","name":"issuanceDate","type":"string"},{"internalType":"string","name":"couponFrequency","type":"string"}],"internalType":"struct IDebtGlobal.DebtBase","name":"debt_","type":"tuple"}],"name":"setDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"issuerName_","type":"string"},{"internalType":"string","name":"issuerInfo_","type":"string"},{"internalType":"contract IERC20","name":"currency_","type":"address"},{"internalType":"uint8[]","name":"labels_","type":"uint8[]"}],"name":"setDebtAdditionalInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"flagDefault_","type":"bool"}],"name":"setFlagDefault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"flagRedeemed_","type":"bool"}],"name":"setFlagRedeemed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"guarantor_","type":"string"}],"name":"setGuarantor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"interestPaymentDate_","type":"string"}],"name":"setInterestPaymentDate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"interestRate_","type":"uint256"}],"name":"setInterestRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"interestScheduleFormat_","type":"string"}],"name":"setInterestScheduleFormat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"issuanceDate_","type":"string"}],"name":"setIssuanceDate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"maturityDate_","type":"string"}],"name":"setMaturityDate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"parValue_","type":"uint256"}],"name":"setParValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"publicHolidaysCalendar_","type":"string"}],"name":"setPublicHolidaysCalendar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"rating_","type":"string"}],"name":"setRating","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IEIP1404Wrapper","name":"ruleEngine_","type":"address"}],"name":"setRuleEngine","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"terms_","type":"string"}],"name":"setTerms","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"snapshotBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"time","type":"uint256"}],"name":"snapshotTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"terms","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenId","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"string","name":"reason","type":"string"}],"name":"unfreeze","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"updatePaymentAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"validateTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b506101cb805460ff191660011790556200002a62000030565b620000af565b600054610100900460ff16156200005a57604051632e8a5e6160e11b815260040160405180910390fd5b60005460ff9081161015620000ad576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615edc80620000bf6000396000f3fe608060405234801561001057600080fd5b506004361061039b5760003560e01c806301ffc9a7146103a057806306fdde03146103c8578063095ea7b3146103dd5780630bf131ca146103f05780630dca59c11461040557806317d70f7c1461042557806318160ddd1461042d5780631d8a19181461043f5780631e6bff431461045257806323b872dd14610469578063244b59e31461047c578063246b72ec1461048f578063248a9ca3146104b657806325d19933146104c95780632787fac0146104dc578063282c51f3146104ef57806329be2baa146105045780632d141c64146105245780632e479e4f146105375780632f2ff15d1461054a578063313ce5671461055d57806336568abe14610577578063371fd8e61461058a578063395093511461059d5780633f4ba83a146105b05780633f4f9067146105b857806340c10f19146105cb57806343581cff146105de5780634abd18ab146105f15780634b73d1f51461060657806350101d84146106195780635474dce9146106305780635a1726f0146106435780635c975abb146106565780635ee7a942146106615780635f84f302146106745780635fb39a2414610687578063634daf761461069a57806363783444146106ad5780636439fd75146106c05780636b1dd54d146106d557806370a08231146106e85780637352f249146106fb57806375bf8fe71461070e578063763952f91461072157806378f86afc1461072b5780637e361c491461073e57806382aefa24146107515780638456cb591461076657806387d817891461076e578063890eba68146107b95780638e925e0b146107c357806391d14854146107d757806395d89b41146107ea578063a217fddf146107f2578063a457c2d7146107fa578063a4a0a3011461080d578063a810c35814610820578063a9059cbb14610833578063b958544614610846578063be370b4f1461085b578063c0a5102b14610870578063c63fdcc714610883578063c6946a1214610896578063c6f5fa9e146108a9578063c9c47032146108bc578063cc7c36fe146108d1578063cdd89992146108e6578063ceb5b638146108f9578063d051665014610907578063d50256251461091a578063d539139314610922578063d547741f14610937578063d82c927a1461094a578063dd62ed3e1461095d578063e63ab1e914610970578063e8e386c014610985578063f47b774014610998578063f7bf52ca146109a0578063fb78ed40146109b3578063fcf196b4146109bb575b600080fd5b6103b36103ae366004614cbd565b6109ce565b60405190151581526020015b60405180910390f35b6103d0610a05565b6040516103bf9190614d37565b6103b36103eb366004614d6a565b610a97565b6104036103fe366004614e96565b610aad565b005b61040d610b18565b6040516103bf9c9b9a99989796959493929190614eee565b6103d06110b4565b6035545b6040519081526020016103bf565b61040361044d366004614ff2565b611143565b61045a611222565b6040516103bf93929190615111565b6103b361047736600461514f565b611352565b61040361048a366004615190565b611369565b6104317f809a0fc49fc0600540f1d39e23454e1f6f215bc7505fa22b17c154616570ddef81565b6104316104c43660046151c4565b6113ce565b6104036104d7366004615190565b6113e4565b6104036104ea366004615190565b61143d565b610431600080516020615b8783398151915281565b610517610512366004615200565b611496565b6040516103bf91906152e8565b610403610532366004615190565b61174b565b610403610545366004615190565b6117a4565b6104036105583660046152fc565b6117fd565b61056561181e565b60405160ff90911681526020016103bf565b6104036105853660046152fc565b611832565b6104036105983660046151c4565b6118b0565b6103b36105ab366004614d6a565b611b52565b610403611b7e565b6103b36105c636600461532c565b611ba1565b6104036105d9366004614d6a565b611bcd565b6104036105ec36600461537b565b611c37565b6105f9611c7c565b6040516103bf9190615398565b610403610614366004615190565b611cf5565b610621611d4e565b6040516103bf939291906153df565b61040361063e36600461537b565b611df4565b610403610651366004615402565b611e41565b60d05460ff166103b3565b61043161066f3660046151c4565b612002565b6104036106823660046151c4565b612023565b610403610695366004615190565b612067565b6104316106a83660046152fc565b6120c0565b6104036106bb366004615190565b612109565b610431600080516020615dc783398151915281565b6104036106e3366004615500565b612162565b6104316106f63660046156cf565b6125c8565b610403610709366004615190565b6125e3565b6103b361071c36600461532c565b61263c565b6104316103a75481565b610403610739366004615190565b612660565b61040361074c3660046156cf565b6126cb565b610431600080516020615ce783398151915281565b610403612716565b61078161077c3660046151c4565b612736565b6040805195865260208601949094526001600160a01b039092169284019290925290151560608301521515608082015260a0016103bf565b6104316101cf5481565b6103a854610517906001600160a01b031681565b6103b36107e53660046152fc565b612789565b6103d06127ac565b610431600081565b6103b3610808366004614d6a565b6127bb565b61040361081b3660046156cf565b612804565b61040361082e3660046156ec565b612848565b6103b3610841366004614d6a565b612952565b610431600080516020615bc783398151915281565b610863612960565b6040516103bf919061570e565b61040361087e3660046151c4565b6129b7565b6104036108913660046151c4565b612cd7565b6103b36108a436600461514f565b613081565b6104036108b7366004615190565b61314a565b610431600080516020615c6783398151915281565b610431600080516020615d8783398151915281565b6104036108f43660046151c4565b6131a3565b6102ca546103b39060ff1681565b6103b36109153660046156cf565b6131df565b6103d06131fe565b610431600080516020615d4783398151915281565b6104036109453660046152fc565b61320c565b610403610958366004615190565b613228565b61043161096b366004615746565b613281565b610431600080516020615d2783398151915281565b610403610993366004615774565b6132ac565b6103d061337e565b6104036109ae3660046152fc565b61338c565b610863613882565b609d54610517906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b14806109ff57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060368054610a14906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610a40906157bf565b8015610a8d5780601f10610a6257610100808354040283529160200191610a8d565b820191906000526020600020905b815481529060010190602001808311610a7057829003601f168201915b5050505050905090565b6000610aa4338484613a08565b50600192915050565b600080516020615b87833981519152610ac581613aa8565b610acf8484613ab2565b836001600160a01b03167f47e772fda56eb54ab211642ce5421882c49fc2b7033455982af14588ae4207ff8484604051610b0a9291906157f9565b60405180910390a250505050565b610330805461033154610332805492939192610b33906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610b5f906157bf565b8015610bac5780601f10610b8157610100808354040283529160200191610bac565b820191906000526020600020905b815481529060010190602001808311610b8f57829003601f168201915b505050505090806003018054610bc1906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610bed906157bf565b8015610c3a5780601f10610c0f57610100808354040283529160200191610c3a565b820191906000526020600020905b815481529060010190602001808311610c1d57829003601f168201915b505050505090806004018054610c4f906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610c7b906157bf565b8015610cc85780601f10610c9d57610100808354040283529160200191610cc8565b820191906000526020600020905b815481529060010190602001808311610cab57829003601f168201915b505050505090806005018054610cdd906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610d09906157bf565b8015610d565780601f10610d2b57610100808354040283529160200191610d56565b820191906000526020600020905b815481529060010190602001808311610d3957829003601f168201915b505050505090806006018054610d6b906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610d97906157bf565b8015610de45780601f10610db957610100808354040283529160200191610de4565b820191906000526020600020905b815481529060010190602001808311610dc757829003601f168201915b505050505090806007018054610df9906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610e25906157bf565b8015610e725780601f10610e4757610100808354040283529160200191610e72565b820191906000526020600020905b815481529060010190602001808311610e5557829003601f168201915b505050505090806008018054610e87906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb3906157bf565b8015610f005780601f10610ed557610100808354040283529160200191610f00565b820191906000526020600020905b815481529060010190602001808311610ee357829003601f168201915b505050505090806009018054610f15906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610f41906157bf565b8015610f8e5780601f10610f6357610100808354040283529160200191610f8e565b820191906000526020600020905b815481529060010190602001808311610f7157829003601f168201915b50505050509080600a018054610fa3906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610fcf906157bf565b801561101c5780601f10610ff15761010080835404028352916020019161101c565b820191906000526020600020905b815481529060010190602001808311610fff57829003601f168201915b50505050509080600b018054611031906157bf565b80601f016020809104026020016040519081016040528092919081815260200182805461105d906157bf565b80156110aa5780601f1061107f576101008083540402835291602001916110aa565b820191906000526020600020905b81548152906001019060200180831161108d57829003601f168201915b505050505090508c565b6101cc80546110c2906157bf565b80601f01602080910402602001604051908101604052809291908181526020018280546110ee906157bf565b801561113b5780601f106111105761010080835404028352916020019161113b565b820191906000526020600020905b81548152906001019060200180831161111e57829003601f168201915b505050505081565b600054610100900460ff16158080156111635750600054600160ff909116105b8061117d5750303b15801561117d575060005460ff166001145b61119a57604051631ee1e30360e21b815260040160405180910390fd5b6000805460ff1916600117905580156111bd576000805461ff0019166101001790555b6111cf8b8b8b8b8b8b8b8b8b8b613b6f565b8015611215576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b61033c80548190611232906157bf565b80601f016020809104026020016040519081016040528092919081815260200182805461125e906157bf565b80156112ab5780601f10611280576101008083540402835291602001916112ab565b820191906000526020600020905b81548152906001019060200180831161128e57829003601f168201915b5050505050908060010180546112c0906157bf565b80601f01602080910402602001604051908101604052809291908181526020018280546112ec906157bf565b80156113395780601f1061130e57610100808354040283529160200191611339565b820191906000526020600020905b81548152906001019060200180831161131c57829003601f168201915b505050600290930154919250506001600160a01b031683565b600061135f848484613c4f565b90505b9392505050565b600080516020615d8783398151915261138181613aa8565b61033b61138e8382615860565b508160405161139d919061591f565b6040518091039020600080516020615d07833981519152836040516113c29190614d37565b60405180910390a25050565b6000908152610167602052604090206001015490565b600080516020615d878339815191526113fc81613aa8565b6103396114098382615860565b5081604051611418919061591f565b6040518091039020600080516020615c27833981519152836040516113c29190614d37565b600080516020615d8783398151915261145581613aa8565b6103346114628382615860565b5081604051611471919061591f565b6040518091039020600080516020615de7833981519152836040516113c29190614d37565b6000806114a281613aa8565b61033e546001600160a01b03166114cc5760405163ddbadd5f60e01b815260040160405180910390fd5b4285116114f457604051630ce2127760e11b8152600481018690526024015b60405180910390fd5b6103a6541580159061153a57506103a6805486919061151590600190615951565b8154811061152557611525615964565b90600052602060002090600302016001015410155b15611599576103a6805486919061155390600190615951565b8154811061156357611563615964565b906000526020600020906003020160010154604051635937053b60e01b81526004016114eb929190918252602082015260400190565b6103a8546103a654604051632c52ca9160e11b81526000926001600160a01b0316916358a59522916115d09190899060040161597a565b6020604051808303816000875af11580156115ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161391906159db565b6040805160a081018252898152602081018981526001600160a01b038085168385018181526000606086018181528c1515608088019081526103a68054600181018255908452975160039098027fd8fdca16b06f802239e41c975465a088655e2ebe2b6b628995a459fe6daae44781019890985595517fd8fdca16b06f802239e41c975465a088655e2ebe2b6b628995a459fe6daae44888015591517fd8fdca16b06f802239e41c975465a088655e2ebe2b6b628995a459fe6daae4499096018054925195511515600160a81b0260ff60a81b19961515600160a01b026001600160a81b0319909416979095169690961791909117939093169190911790925591519293509188918a917f9a8d9fbc0ef868515df1ae007416537b13167767b854cb9bd402536f857134c09190a49695505050505050565b600080516020615d8783398151915261176381613aa8565b6103336117708382615860565b508160405161177f919061591f565b6040518091039020600080516020615be7833981519152836040516113c29190614d37565b600080516020615d878339815191526117bc81613aa8565b6103376117c98382615860565b50816040516117d8919061591f565b6040518091039020600080516020615e07833981519152836040516113c29190614d37565b611806826113ce565b61180f81613aa8565b6118198383613cad565b505050565b600061182d6102fd5460ff1690565b905090565b6001600160a01b03811633146118a25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016114eb565b6118ac8282613d34565b5050565b609d546001600160a01b0316158015906118e95750609d546001600160a01b0316734619ae227c558a5cbbfa824254634bf44517b99a14155b801561193657506119343360006118ff60355490565b6103a6858154811061191357611913615964565b90600052602060002090600302016000015461192f91906159f8565b613d9c565b155b1561195457604051632723972f60e11b815260040160405180910390fd5b6103a654811061197a57604051635f7644f960e01b8152600481018290526024016114eb565b6103a754811461199d57604051637c37df9b60e01b815260040160405180910390fd5b61033e546001600160a01b03166323b872dd33306119ba60355490565b6103a686815481106119ce576119ce615964565b9060005260206000209060030201600001546119ea91906159f8565b6040518463ffffffff1660e01b8152600401611a0893929190615a0f565b6020604051808303816000875af1158015611a27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4b9190615a33565b611a68576040516312171d8360e31b815260040160405180910390fd5b426103a68281548110611a7d57611a7d615964565b9060005260206000209060030201600101541115611ac857611ac36103a68281548110611aac57611aac615964565b906000526020600020906003020160010154613e12565b611adb565b611adb611ad6426001615a50565b613e12565b6103a78054906000611aec83615a63565b90915550506035546103a68281548110611b0857611b08615964565b906000526020600020906003020160000154611b2491906159f8565b60405182907f552544cb36551120f07c66c5cd4b2987725a0c72198587f2ce796099bb66c58c90600090a350565b600033611b74818585611b658383613281565b611b6f9190615a50565b613a08565b5060019392505050565b600080516020615d27833981519152611b9681613aa8565b611b9e613eed565b50565b6000600080516020615dc7833981519152611bbb81613aa8565b611bc58484613f39565b949350505050565b600080516020615d47833981519152611be581613aa8565b611bef8383613ff7565b826001600160a01b03167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688583604051611c2a91815260200190565b60405180910390a2505050565b600080516020615bc7833981519152611c4f81613aa8565b610372805460ff1916831515908117909155604051600080516020615cc783398151915290600090a25050565b606061033c600301805480602002602001604051908101604052809291908181526020018280548015610a8d57602002820191906000526020600020906000905b825461010083900a900460ff16815260206001928301818104948501949093039092029101808411611cbd5790505050505050905090565b600080516020615bc7833981519152611d0d81613aa8565b610373611d1a8382615860565b5081604051611d29919061591f565b6040518091039020600080516020615e47833981519152836040516113c29190614d37565b6103728054610373805460ff8084169461010090940416929190611d71906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054611d9d906157bf565b8015611dea5780601f10611dbf57610100808354040283529160200191611dea565b820191906000526020600020905b815481529060010190602001808311611dcd57829003601f168201915b5050505050905083565b600080516020615bc7833981519152611e0c81613aa8565b610372805461ff00191661010084151590810291909117909155604051600080516020615ca783398151915290600090a25050565b600080516020615d87833981519152611e5981613aa8565b6001600160a01b038316611e805760405163ddbadd5f60e01b815260040160405180910390fd5b60408051608081018252868152602081018690526001600160a01b038516918101919091526060810183905261033c80611eba8882615860565b5060208201516001820190611ecf9082615860565b5060408201516002820180546001600160a01b0319166001600160a01b0390921691909117905560608201518051611f11916003840191602090910190614c02565b5050604051611f229150869061591f565b604051908190038120907f408bab75412e31a1b6968730138526f58be00a6e236f0045d4034efe19b87a8090600090a283604051611f60919061591f565b604051908190038120907f54531db8f5319db0a47c88db916f15b44ac7ead82248d79156e05cf4710c98ed90600090a26040516001600160a01b038416907f167ce916c7c1d877abd9fa4ca8967828605c02dd77563f455a803452aaf250d190600090a27f710bcb47aaee8c11f2e5883127aeed64bd6962930980900342715880792d45b482604051611ff39190615398565b60405180910390a15050505050565b6000806000612012846066614083565b915091508161136257603554611bc5565b600080516020615d8783398151915261203b81613aa8565b610330829055604051828152600080516020615da7833981519152906020015b60405180910390a15050565b600080516020615d8783398151915261207f81613aa8565b61033261208c8382615860565b508160405161209b919061591f565b6040518091039020600080516020615c07833981519152836040516113c29190614d37565b6001600160a01b0381166000908152606560205260408120819081906120e7908690614083565b91509150816120fe576120f9846125c8565b612100565b805b95945050505050565b600080516020615d8783398151915261212181613aa8565b61033661212e8382615860565b508160405161213d919061591f565b6040518091039020600080516020615e67833981519152836040516113c29190614d37565b600080516020615d8783398151915261217a81613aa8565b6040805161018081018252835180825260208086015190830181905285840151938301849052606080870151908401526080808701519084015260a0808701519084015260c0808701519084015260e080870151908401526101008087015190840152610120808701519084015261014080870151908401526101608087015190840152610330918255610331559091610332906122189082615860565b506060820151600382019061222d9082615860565b50608082015160048201906122429082615860565b5060a082015160058201906122579082615860565b5060c0820151600682019061226c9082615860565b5060e082015160078201906122819082615860565b5061010082015160088201906122979082615860565b5061012082015160098201906122ad9082615860565b50610140820151600a8201906122c39082615860565b50610160820151600b8201906122d99082615860565b50508251604051908152600080516020615da7833981519152915060200160405180910390a1600080516020615ba7833981519152826020015160405161232291815260200190565b60405180910390a1816040015160405161233c919061591f565b6040518091039020600080516020615c0783398151915283604001516040516123659190614d37565b60405180910390a2816060015160405161237f919061591f565b6040518091039020600080516020615be783398151915283606001516040516123a89190614d37565b60405180910390a281608001516040516123c2919061591f565b6040518091039020600080516020615de783398151915283608001516040516123eb9190614d37565b60405180910390a28160a00151604051612405919061591f565b6040518091039020600080516020615e878339815191528360a0015160405161242e9190614d37565b60405180910390a28160c00151604051612448919061591f565b6040518091039020600080516020615e678339815191528360c001516040516124719190614d37565b60405180910390a28160e0015160405161248b919061591f565b6040518091039020600080516020615e078339815191528360e001516040516124b49190614d37565b60405180910390a28161010001516040516124cf919061591f565b6040518091039020600080516020615c878339815191528361010001516040516124f99190614d37565b60405180910390a2816101200151604051612514919061591f565b6040518091039020600080516020615c2783398151915283610120015160405161253e9190614d37565b60405180910390a2816101400151604051612559919061591f565b6040518091039020600080516020615e278339815191528361014001516040516125839190614d37565b60405180910390a281610160015160405161259e919061591f565b6040518091039020600080516020615d078339815191528361016001516040516113c29190614d37565b6001600160a01b031660009081526033602052604090205490565b600080516020615d878339815191526125fb81613aa8565b61033a6126088382615860565b5081604051612617919061591f565b6040518091039020600080516020615e27833981519152836040516113c29190614d37565b6000600080516020615dc783398151915261265681613aa8565b611bc584846140d8565b600080516020615d4783398151915261267881613aa8565b6101cd6126858382615860565b5081604051612694919061591f565b60405180910390207f8763f25a8d9538205dfcd4dc235a0f6bf9f0a6a01327e13524aaf39f954fa50f836040516113c29190614d37565b600054610100900460ff166126f3576040516366b9f31560e01b815260040160405180910390fd5b6103a880546001600160a01b0319166001600160a01b0392909216919091179055565b600080516020615d2783398151915261272e81613aa8565b611b9e614181565b6103a6818154811061274757600080fd5b60009182526020909120600390910201805460018201546002909201549092506001600160a01b0381169060ff600160a01b8204811691600160a81b90041685565b600061279581836141be565b156127a2575060016109ff565b61136283836141be565b606060378054610a14906157bf565b600033816127c98286613281565b9050838110156127ec5760405163f340c31f60e01b815260040160405180910390fd5b6127f98286868403613a08565b506001949350505050565b600061280f81613aa8565b609d80546001600160a01b0319166001600160a01b038416908117909155604051600080516020615c4783398151915290600090a25050565b600080516020615c6783398151915261286081613aa8565b6103a654831061288657604051635f7644f960e01b8152600481018490526024016114eb565b6103a7548310156128aa5760405163a8f6261f60e01b815260040160405180910390fd5b6103a683815481106128be576128be615964565b906000526020600020906003020160020160159054906101000a900460ff166128fa5760405163168caa0560e21b815260040160405180910390fd5b816103a6848154811061290f5761290f615964565b60009182526020822060039091020191909155604051339184917f5f0046b676206db3967aac08290592d345332bbe1a215858108f7d5a9dd441149190a3505050565b600033611b748185856141ea565b6060606a805480602002602001604051908101604052809291908181526020018280548015610a8d57602002820191906000526020600020905b81548152602001906001019080831161299a575050505050905090565b600080516020615ce78339815191526129cf81613aa8565b6103a65482106129f557604051635f7644f960e01b8152600481018390526024016114eb565b60016103a754612a059190615951565b8214612a2457604051637c37df9b60e01b815260040160405180910390fd5b426103a68381548110612a3957612a39615964565b90600052602060002090600302016001015411612a92576103a68281548110612a6457612a64615964565b906000526020600020906003020160010154604051630ce2127760e11b81526004016114eb91815260200190565b609d546001600160a01b031615801590612acb5750609d546001600160a01b0316734619ae227c558a5cbbfa824254634bf44517b99a14155b8015612b505750612b4e600033306001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b3a9190615a7c565b6103a6868154811061191357611913615964565b155b15612b6e57604051632723972f60e11b815260040160405180910390fd5b61033e546001600160a01b031663a9059cbb336035546103a68681548110612b9857612b98615964565b906000526020600020906003020160000154612bb491906159f8565b6040518363ffffffff1660e01b8152600401612bd1929190615a95565b6020604051808303816000875af1158015612bf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c149190615a33565b612c31576040516312171d8360e31b815260040160405180910390fd5b612c5f6103a68381548110612c4857612c48615964565b9060005260206000209060030201600101546142ce565b6103a78054906000612c7083615aae565b90915550506035546103a68381548110612c8c57612c8c615964565b906000526020600020906003020160000154612ca891906159f8565b60405183907f8532a1d9e02e03ee51eb93fce8c77f5b2ad216f488a3cd902d775a49170a3b6d90600090a35050565b6103a6548110612cfd57604051635f7644f960e01b8152600481018290526024016114eb565b6103a7548110612d2357604051636571a8db60e11b8152600481018290526024016114eb565b60006103a68281548110612d3957612d39615964565b60009182526020909120600390910201600201546001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401612d7891906152e8565b602060405180830381865afa158015612d95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612db99190615a7c565b905080600003612e73576103a68281548110612dd757612dd7615964565b60009182526020909120600390910201600201546001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401612e1691906152e8565b602060405180830381865afa158015612e33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e579190615a7c565b604051639266535160e01b81526004016114eb91815260200190565b609d546001600160a01b031615801590612eac5750609d546001600160a01b0316734619ae227c558a5cbbfa824254634bf44517b99a14155b8015612ed05750612ece600033836103a6868154811061191357611913615964565b155b15612eee57604051632723972f60e11b815260040160405180910390fd5b6000816103a68481548110612f0557612f05615964565b906000526020600020906003020160000154612f2191906159f8565b90506103a68381548110612f3757612f37615964565b60009182526020822060026003909202010154604080516305f898e560e11b815233600482015260248101869052606060448201526064810184905290516001600160a01b0390921692630bf131ca9260848084019382900301818387803b158015612fa257600080fd5b505af1158015612fb6573d6000803e3d6000fd5b505061033e5460405163a9059cbb60e01b81526001600160a01b03909116925063a9059cbb9150612fed9033908590600401615a95565b6020604051808303816000875af115801561300c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130309190615a33565b61304d576040516312171d8360e31b815260040160405180910390fd5b6040518290339085907f55188540052a206e959fa07e62a5f0542065989dcf08853e21b5668c778e460590600090a4505050565b600061308f60d05460ff1690565b8061309e575061309e846131df565b806130ad57506130ad836131df565b156130ba57506000611362565b609d546001600160a01b0316158015906130d757506102ca5460ff165b15611b74576001600160a01b0384161580156131065750613106600080516020615d4783398151915284612789565b1561311357506001611362565b61312b600080516020615d4783398151915285612789565b1561313857506001611362565b613143848484613d9c565b9050611362565b600080516020615d8783398151915261316281613aa8565b61033561316f8382615860565b508160405161317e919061591f565b6040518091039020600080516020615e87833981519152836040516113c29190614d37565b600080516020615d878339815191526131bb81613aa8565b610331829055604051828152600080516020615ba78339815191529060200161205b565b6001600160a01b03166000908152610102602052604090205460ff1690565b6101cd80546110c2906157bf565b613215826113ce565b61321e81613aa8565b6118198383613d34565b600080516020615d8783398151915261324081613aa8565b61033861324d8382615860565b508160405161325c919061591f565b6040518091039020600080516020615c87833981519152836040516113c29190614d37565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b600080516020615bc78339815191526132c481613aa8565b6040805160608101825285151580825285151560208301819052928201859052610372805461010090940261ff001990921661ffff1990941693909317178255906103736133128582615860565b50506040518515159150600080516020615cc783398151915290600090a260405183151590600080516020615ca783398151915290600090a281604051613359919061591f565b6040518091039020600080516020615e4783398151915283604051610b0a9190614d37565b6101ce80546110c2906157bf565b6103a75482106133b257604051636571a8db60e11b8152600481018390526024016114eb565b6103a682815481106133c6576133c6615964565b906000526020600020906003020160020160149054906101000a900460ff161561340357604051631bbdf5c560e31b815260040160405180910390fd5b4261340c612960565b838151811061341d5761341d615964565b6020026020010151111561346857613433612960565b828151811061344457613444615964565b60200260200101516040516371d8115f60e01b81526004016114eb91815260200190565b6000613494613475612960565b848151811061348657613486615964565b6020026020010151836120c0565b9050806000036134ba57604051639266535160e01b8152600481018290526024016114eb565b6103a683815481106134ce576134ce615964565b60009182526020909120600260039092020101546040516370a0823160e01b81526001600160a01b03909116906370a082319061350f9085906004016152e8565b602060405180830381865afa15801561352c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135509190615a7c565b1561356e57604051631bbdf5c560e31b815260040160405180910390fd5b6103a6838154811061358257613582615964565b6000918252602082206002600390920201015460408051631fa5d41d60e11b815290516001600160a01b0390921692633f4ba83a9260048084019382900301818387803b1580156135d257600080fd5b505af11580156135e6573d6000803e3d6000fd5b505050506103a683815481106135fe576135fe615964565b60009182526020909120600260039092020101546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906136419085908590600401615a95565b600060405180830381600087803b15801561365b57600080fd5b505af115801561366f573d6000803e3d6000fd5b5050505061369c61367e612960565b848151811061368f5761368f615964565b6020026020010151612002565b6103a684815481106136b0576136b0615964565b600091825260209182902060026003909202010154604080516318160ddd60e01b815290516001600160a01b03909216926318160ddd926004808401938290030181865afa158015613706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061372a9190615a7c565b10156137b1576103a6838154811061374457613744615964565b6000918252602082206002600390920201015460408051638456cb5960e01b815290516001600160a01b0390921692638456cb599260048084019382900301818387803b15801561379457600080fd5b505af11580156137a8573d6000803e3d6000fd5b505050506137f0565b60016103a684815481106137c7576137c7615964565b906000526020600020906003020160020160146101000a81548160ff0219169083151502179055505b816001600160a01b0316613824613805612960565b858151811061381657613816615964565b6020026020010151846120c0565b6103a6858154811061383857613838615964565b600091825260208220600260039092020101546040516001600160a01b03909116917f567dd2c238fb7e60fa2fd1b73be2685968f4c1f8b063eb819b6e944f62a626ed91a4505050565b604080516000815260208101909152606a546060919015613a03576000806138a86143b2565b915091508160001480156138bc5750606854155b1561391a57606a80548060200260200160405190810160405280929190818152602001828054801561390d57602002820191906000526020600020905b8154815260200190600101908083116138f9575b5050505050935050505090565b606a54613928826001615a50565b14613a0057606a54600090600190613941908490615951565b61394b9190615951565b9050806001600160401b0381111561396557613965614d96565b60405190808252806020026020018201604052801561398e578160200160208202803683370190505b50935060005b84518110156139fd57606a816139ab856001615a50565b6139b59190615a50565b815481106139c5576139c5615964565b90600052602060002001548582815181106139e2576139e2615964565b60209081029190910101526139f681615a63565b9050613994565b50505b50505b919050565b6001600160a01b0383161580613a2557506001600160a01b038216155b15613a4757828260405163f1ff34ab60e01b81526004016114eb929190615ac5565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b611b9e813361446b565b6001600160a01b038216613ad857604051620bbd2160e81b815260040160405180910390fd5b613ae4826000836144c4565b6001600160a01b03821660009081526033602052604090205481811015613b2157604051639266535160e01b8152600481018290526024016114eb565b6001600160a01b0383166000818152603360209081526040808320868603905560358054879003905551858152919291600080516020615d67833981519152910160405180910390a3505050565b600054610100900460ff16613b97576040516366b9f31560e01b815260040160405180910390fd5b613b9f6144f7565b613ba98989614521565b613bb16144f7565b613bb96144f7565b613bc1614562565b613bc96144f7565b613bd1614596565b613bda856145ca565b613be38a614639565b613beb6144f7565b613bf36144f7565b613bfb6144f7565b613c056000614693565b613c0d6144f7565b613c16816146d2565b613c1e6144f7565b613c266144f7565b613c2f826126cb565b613c3b8787868661470e565b613c436144f7565b50505050505050505050565b600080613c5d858585614769565b9050801561135f5760405183815233906001600160a01b038716907f7c2b9369bf4a6bd9745889c658ad00a4d57e280c4c80fa1c74db2a9e52c136359060200160405180910390a3949350505050565b613cb78282612789565b6118ac576000828152610167602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613cf03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b613d3e8282612789565b156118ac576000828152610167602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b609d5460405163634a350960e11b81526000916001600160a01b03169063c6946a1290613dd190879087908790600401615a0f565b602060405180830381865afa158015613dee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135f9190615a33565b428111613e325760405163ee0df60960e01b815260040160405180910390fd5b606a5415801590613e6d5750606a8054613e4e90600190615951565b81548110613e5e57613e5e615964565b90600052602060002001548111155b15613e8b57604051630ae4b6a760e01b815260040160405180910390fd5b606a805460018101825560009182527f116fea137db6e131133e7f2bab296045d8f41cc5607279db17b218cab0929a51018290556040518291907fe2ad3b1abe53383dbe6359f02f11ae76d91cfab321b37083b16e1d96a81d4183908290a350565b613ef5614782565b60d0805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051613f2f91906152e8565b60405180910390a1565b6001600160a01b0382166000908152610102602052604081205460ff1615613f63575060006109ff565b6001600160a01b0383166000908152610102602052604090819020805460ff1916600117905551613f9590839061591f565b6040518091039020836001600160a01b0316613fae3390565b6001600160a01b03167fe80aede59db0b770aef5e4bd04670759d38e64959d07a4343257a0a4f6b6d1ed85604051613fe69190614d37565b60405180910390a450600192915050565b6001600160a01b03821661401e576040516306c31bdf60e41b815260040160405180910390fd5b61402a600083836144c4565b806035600082825461403c9190615a50565b90915550506001600160a01b038216600081815260336020908152604080832080548601905551848152600080516020615d67833981519152910160405180910390a35050565b6000808061409184866147cb565b845490915081036140a95760008092509250506140d1565b60018460010182815481106140c0576140c0615964565b906000526020600020015492509250505b9250929050565b6001600160a01b0382166000908152610102602052604081205460ff16614101575060006109ff565b6001600160a01b0383166000908152610102602052604090819020805460ff191690555161413090839061591f565b6040518091039020836001600160a01b03166141493390565b6001600160a01b03167f7a52fdbc4f3e9f93670cd35b5b9c2d974791d25c5c04984336a80be3f7f42c3285604051613fe69190614d37565b61418961486c565b60d0805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613f223390565b6000918252610167602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6001600160a01b038316158061420757506001600160a01b038216155b1561422957828260405163ba2c33ab60e01b81526004016114eb929190615ac5565b6142348383836144c4565b6001600160a01b0383166000908152603360205260409020548181101561427157604051639266535160e01b8152600481018290526024016114eb565b6001600160a01b038085166000818152603360205260408082208686039055928616808252908390208054860190559151600080516020615d67833981519152906142bf9086815260200190565b60405180910390a35b50505050565b4281116142ee5760405163684a87bf60e11b815260040160405180910390fd5b606a54600003614311576040516334bda1d560e11b815260040160405180910390fd5b606a805461432190600190615951565b8154811061433157614331615964565b9060005260206000200154811461435b5760405163ab27ba1f60e01b815260040160405180910390fd5b606a80548061436c5761436c615adf565b60019003818190600052602060002001600090559055807f06e2498f5548e5491bfe985562cc494131eae56b5b6543b59129c8886f129f6560405160405180910390a250565b606a5460009081908015806143de57508060695460016143d29190615a50565b1480156143de57508215155b156143ed576000939092509050565b6000819250600060695490505b828110156144635742606a828154811061441657614416615964565b90600052602060002001541161444e57606a818154811061443957614439615964565b90600052602060002001549150809350614453565b614463565b61445c81615a63565b90506143fa565b509391925050565b6144758282612789565b6118ac57614482816148b2565b61448d8360206148c4565b60405160200161449e929190615af5565b60408051601f198184030181529082905262461bcd60e51b82526114eb91600401614d37565b6144cf838383613081565b6144ec57604051632723972f60e11b815260040160405180910390fd5b611819838383614a5f565b600054610100900460ff1661451f576040516366b9f31560e01b815260040160405180910390fd5b565b600054610100900460ff16614549576040516366b9f31560e01b815260040160405180910390fd5b60366145558382615860565b5060376118198282615860565b600054610100900460ff1661458a576040516366b9f31560e01b815260040160405180910390fd5b60d0805460ff19169055565b600054610100900460ff166145be576040516366b9f31560e01b815260040160405180910390fd5b60006068819055606955565b600054610100900460ff166145f2576040516366b9f31560e01b815260040160405180910390fd5b6001600160a01b03811615611b9e57609d80546001600160a01b0319166001600160a01b038316908117909155604051600080516020615c4783398151915290600090a250565b600054610100900460ff16614661576040516366b9f31560e01b815260040160405180910390fd5b6001600160a01b0381166146885760405163ddbadd5f60e01b815260040160405180910390fd5b611b9e600082613cad565b600054610100900460ff166146bb576040516366b9f31560e01b815260040160405180910390fd5b6102fd805460ff191660ff92909216919091179055565b600054610100900460ff166146fa576040516366b9f31560e01b815260040160405180910390fd5b6102ca805460ff1916911515919091179055565b600054610100900460ff16614736576040516366b9f31560e01b815260040160405180910390fd5b6101cc6147438582615860565b506101cd6147518482615860565b506101ce61475f8382615860565b506101cf55505050565b600033614777858285614aa8565b6127f98585856141ea565b60d05460ff1661451f5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016114eb565b815460009081036147de575060006109ff565b82546000905b808210156148285760006147f88383614af7565b9050846148058783614b12565b54111561481457809150614822565b61481f816001615a50565b92505b506147e4565b60008211801561484b57508361484886614843600186615951565b614b12565b54145b156148645761485b600183615951565b925050506109ff565b5090506109ff565b60d05460ff161561451f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016114eb565b60606109ff6001600160a01b03831660145b606060006148d38360026159f8565b6148de906002615a50565b6001600160401b038111156148f5576148f5614d96565b6040519080825280601f01601f19166020018201604052801561491f576020820181803683370190505b509050600360fc1b8160008151811061493a5761493a615964565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061496957614969615964565b60200101906001600160f81b031916908160001a905350600061498d8460026159f8565b614998906001615a50565b90505b6001811115614a10576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106149cc576149cc615964565b1a60f81b8282815181106149e2576149e2615964565b60200101906001600160f81b031916908160001a90535060049490941c93614a0981615aae565b905061499b565b5083156113625760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016114eb565b614a67614b23565b6001600160a01b03831615614a9f57614a7f83614b44565b6001600160a01b03821615614a975761181982614b44565b611819614b6e565b614a9782614b44565b6000614ab48484613281565b905060001981146142c85781811015614aea5760405163054365bb60e31b815260048101839052602481018290526044016114eb565b6142c88484848403613a08565b6000614b066002848418615b64565b61136290848416615a50565b600082815260208120820180611bc5565b600080614b2e6143b2565b909250905081156118ac57606891909155606955565b6001600160a01b0381166000908152606560205260409020611b9e90614b69836125c8565b614b7c565b61451f6066614b6960355490565b60685480614b8984614bbd565b1015611819578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b80546000908103614bd057506000919050565b81548290614be090600190615951565b81548110614bf057614bf0615964565b90600052602060002001549050919050565b82805482825590600052602060002090601f01602090048101928215614c985791602002820160005b83821115614c6957835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302614c2b565b8015614c965782816101000a81549060ff0219169055600101602081600001049283019260010302614c69565b505b50614ca4929150614ca8565b5090565b5b80821115614ca45760008155600101614ca9565b600060208284031215614ccf57600080fd5b81356001600160e01b03198116811461136257600080fd5b60005b83811015614d02578181015183820152602001614cea565b50506000910152565b60008151808452614d23816020860160208601614ce7565b601f01601f19169290920160200192915050565b6020815260006113626020830184614d0b565b6001600160a01b0381168114611b9e57600080fd5b8035613a0381614d4a565b60008060408385031215614d7d57600080fd5b8235614d8881614d4a565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715614dce57614dce614d96565b60405290565b60405161018081016001600160401b0381118282101715614dce57614dce614d96565b604051601f8201601f191681016001600160401b0381118282101715614e1f57614e1f614d96565b604052919050565b600082601f830112614e3857600080fd5b81356001600160401b03811115614e5157614e51614d96565b614e64601f8201601f1916602001614df7565b818152846020838601011115614e7957600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215614eab57600080fd5b8335614eb681614d4a565b92506020840135915060408401356001600160401b03811115614ed857600080fd5b614ee486828701614e27565b9150509250925092565b60006101808e83528d6020840152806040840152614f0e8184018e614d0b565b90508281036060840152614f22818d614d0b565b90508281036080840152614f36818c614d0b565b905082810360a0840152614f4a818b614d0b565b905082810360c0840152614f5e818a614d0b565b905082810360e0840152614f728189614d0b565b9050828103610100840152614f878188614d0b565b9050828103610120840152614f9c8187614d0b565b9050828103610140840152614fb18186614d0b565b9050828103610160840152614fc68185614d0b565b9f9e505050505050505050505050505050565b8015158114611b9e57600080fd5b8035613a0381614fd9565b6000806000806000806000806000806101408b8d03121561501257600080fd5b61501b8b614d5f565b995060208b01356001600160401b038082111561503757600080fd5b6150438e838f01614e27565b9a5060408d013591508082111561505957600080fd5b6150658e838f01614e27565b995060608d013591508082111561507b57600080fd5b6150878e838f01614e27565b985060808d013591508082111561509d57600080fd5b6150a98e838f01614e27565b97506150b760a08e01614d5f565b965060c08d01359150808211156150cd57600080fd5b506150da8d828e01614e27565b94505060e08b013592506150f16101008c01614d5f565b91506151006101208c01614fe7565b90509295989b9194979a5092959850565b6060815260006151246060830186614d0b565b82810360208401526151368186614d0b565b91505060018060a01b0383166040830152949350505050565b60008060006060848603121561516457600080fd5b833561516f81614d4a565b9250602084013561517f81614d4a565b929592945050506040919091013590565b6000602082840312156151a257600080fd5b81356001600160401b038111156151b857600080fd5b611bc584828501614e27565b6000602082840312156151d657600080fd5b5035919050565b60006001600160401b038211156151f6576151f6614d96565b5060051b60200190565b6000806000806080858703121561521657600080fd5b8435935060208086013593506040808701356001600160401b0381111561523c57600080fd5b8701601f8101891361524d57600080fd5b803561526061525b826151dd565b614df7565b81815260069190911b8201840190848101908b83111561527f57600080fd5b928501925b828410156152c85784848d03121561529c5760008081fd5b6152a4614dac565b84356152af81614d4a565b8152848701358782015282529284019290850190615284565b8097505050505050506152dd60608601614fe7565b905092959194509250565b6001600160a01b0391909116815260200190565b6000806040838503121561530f57600080fd5b82359150602083013561532181614d4a565b809150509250929050565b6000806040838503121561533f57600080fd5b823561534a81614d4a565b915060208301356001600160401b0381111561536557600080fd5b61537185828601614e27565b9150509250929050565b60006020828403121561538d57600080fd5b813561136281614fd9565b6020808252825182820181905260009190848201906040850190845b818110156153d357835160ff16835292840192918401916001016153b4565b50909695505050505050565b831515815282151560208201526060604082015260006121006060830184614d0b565b6000806000806080858703121561541857600080fd5b84356001600160401b038082111561542f57600080fd5b61543b88838901614e27565b955060209150818701358181111561545257600080fd5b61545e89828a01614e27565b955050604087013561546f81614d4a565b935060608701358181111561548357600080fd5b87019050601f8101881361549657600080fd5b80356154a461525b826151dd565b81815260059190911b8201830190838101908a8311156154c357600080fd5b928401925b828410156154f157833560ff811681146154e25760008081fd5b825292840192908401906154c8565b979a9699509497505050505050565b60006020828403121561551257600080fd5b81356001600160401b038082111561552957600080fd5b90830190610180828603121561553e57600080fd5b615546614dd4565b823581526020830135602082015260408301358281111561556657600080fd5b61557287828601614e27565b60408301525060608301358281111561558a57600080fd5b61559687828601614e27565b6060830152506080830135828111156155ae57600080fd5b6155ba87828601614e27565b60808301525060a0830135828111156155d257600080fd5b6155de87828601614e27565b60a08301525060c0830135828111156155f657600080fd5b61560287828601614e27565b60c08301525060e08301358281111561561a57600080fd5b61562687828601614e27565b60e083015250610100808401358381111561564057600080fd5b61564c88828701614e27565b828401525050610120808401358381111561566657600080fd5b61567288828701614e27565b828401525050610140808401358381111561568c57600080fd5b61569888828701614e27565b82840152505061016080840135838111156156b257600080fd5b6156be88828701614e27565b918301919091525095945050505050565b6000602082840312156156e157600080fd5b813561136281614d4a565b600080604083850312156156ff57600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156153d35783518352928401929184019160010161572a565b6000806040838503121561575957600080fd5b823561576481614d4a565b9150602083013561532181614d4a565b60008060006060848603121561578957600080fd5b833561579481614fd9565b925060208401356157a481614fd9565b915060408401356001600160401b03811115614ed857600080fd5b600181811c908216806157d357607f821691505b6020821081036157f357634e487b7160e01b600052602260045260246000fd5b50919050565b82815260406020820152600061135f6040830184614d0b565b601f82111561181957600081815260208120601f850160051c810160208610156158395750805b601f850160051c820191505b8181101561585857828155600101615845565b505050505050565b81516001600160401b0381111561587957615879614d96565b61588d8161588784546157bf565b84615812565b602080601f8311600181146158c257600084156158aa5750858301515b600019600386901b1c1916600185901b178555615858565b600085815260208120601f198616915b828110156158f1578886015182559484019460019091019084016158d2565b508582101561590f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251615931818460208701614ce7565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156109ff576109ff61593b565b634e487b7160e01b600052603260045260246000fd5b6000604080830185845260208281860152818651808452606087019150828801935060005b818110156159cd57845180516001600160a01b0316845284015184840152938301939185019160010161599f565b509098975050505050505050565b6000602082840312156159ed57600080fd5b815161136281614d4a565b80820281158282048414176109ff576109ff61593b565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215615a4557600080fd5b815161136281614fd9565b808201808211156109ff576109ff61593b565b600060018201615a7557615a7561593b565b5060010190565b600060208284031215615a8e57600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b600081615abd57615abd61593b565b506000190190565b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052603160045260246000fd5b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615b27816017850160208801614ce7565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615b58816028840160208801614ce7565b01602801949350505050565b600082615b8157634e487b7160e01b600052601260045260246000fd5b50049056fe3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848738d1b1065e9baa0c7947c9ccc0e22b1d470d8f6221bbff350d3b41f24646a7eaa2de0737115053bf7d3d68e733306557628aef4b4aefa746cbf344fc726724721c1b5695d200e071a117d8e2600f4b8739689c44c773aac9f1104f4ea1ee5344daffcef1eeed35b202f86368def1684635c4568c1677447020127842e94cd5f2893cd7e7309055797bcc658887ad0a1de46b88ccca8260206bda3095071f5d637213fe93a5aae50df0ef53f98b81c048e51b3ab2969309a103a647e44b619188304288da0064fd090d95b67bca5d7ef84faa6c92418f0ac355038733624738820188bddbb8ff3f7bfcdb154a4c599bce9dab8f620db24dd27442326212d9fd3355218ef44c05df7b0087337f3d1e1923194a5f2f312d4faaa7d4c6083d2e65acfff80918b8a23ec550b0676cc4642c3a0d5f033cfa3ff8998dc8448a0cb7dbe114e74f6ea3bd819998f78687bfcb11b140da08e9b7d222fa9c1f1ba1f2aa1225c388aa54cd4074eb90383e6f01e9316ba4669faee4086cf48d639968fed569565d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efc6f3350ab30f55ce45863160fc345c1663d4633fe7cacfd3b9bbb6420a9147f8ddc6c807bd9e0d70db5e03f6296a4ebddff5eadec9da2f4dab0da5e4bbdaaa5f973ef39d76cc2c6090feab1c030bec6ab5db557f64df047a4c4f9b5953cf1df35792973abb7bb17fbf2dbe25beb5a013c89e174158629682a6bbd8e361a5cc734c6f61ef9cdfaa4e5c7780501c91c2d853bba8371b411d54972d6d76cc899a9d96a0bb02e7873bcbc9585de903b588438db3002fcded6d6e52295ef21a32b9686070a6a09f06d4f10acb86427e58c98989b9d767a24cee548f108b583af5a898d7a17e24227144fff67a7c30410d77a60b8bbe03fa820a096d5ec2ffb2205edc5430bb1fd10855ad38fe3c3bccfcab1a3f6f2797085cadc229e92e36c07d42cba264697066735822122036e23655da8b7519cb3321b435e723aa5148c66fa90a0ac7762b9b2a3bf4b46964736f6c63430008110033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061039b5760003560e01c806301ffc9a7146103a057806306fdde03146103c8578063095ea7b3146103dd5780630bf131ca146103f05780630dca59c11461040557806317d70f7c1461042557806318160ddd1461042d5780631d8a19181461043f5780631e6bff431461045257806323b872dd14610469578063244b59e31461047c578063246b72ec1461048f578063248a9ca3146104b657806325d19933146104c95780632787fac0146104dc578063282c51f3146104ef57806329be2baa146105045780632d141c64146105245780632e479e4f146105375780632f2ff15d1461054a578063313ce5671461055d57806336568abe14610577578063371fd8e61461058a578063395093511461059d5780633f4ba83a146105b05780633f4f9067146105b857806340c10f19146105cb57806343581cff146105de5780634abd18ab146105f15780634b73d1f51461060657806350101d84146106195780635474dce9146106305780635a1726f0146106435780635c975abb146106565780635ee7a942146106615780635f84f302146106745780635fb39a2414610687578063634daf761461069a57806363783444146106ad5780636439fd75146106c05780636b1dd54d146106d557806370a08231146106e85780637352f249146106fb57806375bf8fe71461070e578063763952f91461072157806378f86afc1461072b5780637e361c491461073e57806382aefa24146107515780638456cb591461076657806387d817891461076e578063890eba68146107b95780638e925e0b146107c357806391d14854146107d757806395d89b41146107ea578063a217fddf146107f2578063a457c2d7146107fa578063a4a0a3011461080d578063a810c35814610820578063a9059cbb14610833578063b958544614610846578063be370b4f1461085b578063c0a5102b14610870578063c63fdcc714610883578063c6946a1214610896578063c6f5fa9e146108a9578063c9c47032146108bc578063cc7c36fe146108d1578063cdd89992146108e6578063ceb5b638146108f9578063d051665014610907578063d50256251461091a578063d539139314610922578063d547741f14610937578063d82c927a1461094a578063dd62ed3e1461095d578063e63ab1e914610970578063e8e386c014610985578063f47b774014610998578063f7bf52ca146109a0578063fb78ed40146109b3578063fcf196b4146109bb575b600080fd5b6103b36103ae366004614cbd565b6109ce565b60405190151581526020015b60405180910390f35b6103d0610a05565b6040516103bf9190614d37565b6103b36103eb366004614d6a565b610a97565b6104036103fe366004614e96565b610aad565b005b61040d610b18565b6040516103bf9c9b9a99989796959493929190614eee565b6103d06110b4565b6035545b6040519081526020016103bf565b61040361044d366004614ff2565b611143565b61045a611222565b6040516103bf93929190615111565b6103b361047736600461514f565b611352565b61040361048a366004615190565b611369565b6104317f809a0fc49fc0600540f1d39e23454e1f6f215bc7505fa22b17c154616570ddef81565b6104316104c43660046151c4565b6113ce565b6104036104d7366004615190565b6113e4565b6104036104ea366004615190565b61143d565b610431600080516020615b8783398151915281565b610517610512366004615200565b611496565b6040516103bf91906152e8565b610403610532366004615190565b61174b565b610403610545366004615190565b6117a4565b6104036105583660046152fc565b6117fd565b61056561181e565b60405160ff90911681526020016103bf565b6104036105853660046152fc565b611832565b6104036105983660046151c4565b6118b0565b6103b36105ab366004614d6a565b611b52565b610403611b7e565b6103b36105c636600461532c565b611ba1565b6104036105d9366004614d6a565b611bcd565b6104036105ec36600461537b565b611c37565b6105f9611c7c565b6040516103bf9190615398565b610403610614366004615190565b611cf5565b610621611d4e565b6040516103bf939291906153df565b61040361063e36600461537b565b611df4565b610403610651366004615402565b611e41565b60d05460ff166103b3565b61043161066f3660046151c4565b612002565b6104036106823660046151c4565b612023565b610403610695366004615190565b612067565b6104316106a83660046152fc565b6120c0565b6104036106bb366004615190565b612109565b610431600080516020615dc783398151915281565b6104036106e3366004615500565b612162565b6104316106f63660046156cf565b6125c8565b610403610709366004615190565b6125e3565b6103b361071c36600461532c565b61263c565b6104316103a75481565b610403610739366004615190565b612660565b61040361074c3660046156cf565b6126cb565b610431600080516020615ce783398151915281565b610403612716565b61078161077c3660046151c4565b612736565b6040805195865260208601949094526001600160a01b039092169284019290925290151560608301521515608082015260a0016103bf565b6104316101cf5481565b6103a854610517906001600160a01b031681565b6103b36107e53660046152fc565b612789565b6103d06127ac565b610431600081565b6103b3610808366004614d6a565b6127bb565b61040361081b3660046156cf565b612804565b61040361082e3660046156ec565b612848565b6103b3610841366004614d6a565b612952565b610431600080516020615bc783398151915281565b610863612960565b6040516103bf919061570e565b61040361087e3660046151c4565b6129b7565b6104036108913660046151c4565b612cd7565b6103b36108a436600461514f565b613081565b6104036108b7366004615190565b61314a565b610431600080516020615c6783398151915281565b610431600080516020615d8783398151915281565b6104036108f43660046151c4565b6131a3565b6102ca546103b39060ff1681565b6103b36109153660046156cf565b6131df565b6103d06131fe565b610431600080516020615d4783398151915281565b6104036109453660046152fc565b61320c565b610403610958366004615190565b613228565b61043161096b366004615746565b613281565b610431600080516020615d2783398151915281565b610403610993366004615774565b6132ac565b6103d061337e565b6104036109ae3660046152fc565b61338c565b610863613882565b609d54610517906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b14806109ff57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060368054610a14906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610a40906157bf565b8015610a8d5780601f10610a6257610100808354040283529160200191610a8d565b820191906000526020600020905b815481529060010190602001808311610a7057829003601f168201915b5050505050905090565b6000610aa4338484613a08565b50600192915050565b600080516020615b87833981519152610ac581613aa8565b610acf8484613ab2565b836001600160a01b03167f47e772fda56eb54ab211642ce5421882c49fc2b7033455982af14588ae4207ff8484604051610b0a9291906157f9565b60405180910390a250505050565b610330805461033154610332805492939192610b33906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610b5f906157bf565b8015610bac5780601f10610b8157610100808354040283529160200191610bac565b820191906000526020600020905b815481529060010190602001808311610b8f57829003601f168201915b505050505090806003018054610bc1906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610bed906157bf565b8015610c3a5780601f10610c0f57610100808354040283529160200191610c3a565b820191906000526020600020905b815481529060010190602001808311610c1d57829003601f168201915b505050505090806004018054610c4f906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610c7b906157bf565b8015610cc85780601f10610c9d57610100808354040283529160200191610cc8565b820191906000526020600020905b815481529060010190602001808311610cab57829003601f168201915b505050505090806005018054610cdd906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610d09906157bf565b8015610d565780601f10610d2b57610100808354040283529160200191610d56565b820191906000526020600020905b815481529060010190602001808311610d3957829003601f168201915b505050505090806006018054610d6b906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610d97906157bf565b8015610de45780601f10610db957610100808354040283529160200191610de4565b820191906000526020600020905b815481529060010190602001808311610dc757829003601f168201915b505050505090806007018054610df9906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610e25906157bf565b8015610e725780601f10610e4757610100808354040283529160200191610e72565b820191906000526020600020905b815481529060010190602001808311610e5557829003601f168201915b505050505090806008018054610e87906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb3906157bf565b8015610f005780601f10610ed557610100808354040283529160200191610f00565b820191906000526020600020905b815481529060010190602001808311610ee357829003601f168201915b505050505090806009018054610f15906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610f41906157bf565b8015610f8e5780601f10610f6357610100808354040283529160200191610f8e565b820191906000526020600020905b815481529060010190602001808311610f7157829003601f168201915b50505050509080600a018054610fa3906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054610fcf906157bf565b801561101c5780601f10610ff15761010080835404028352916020019161101c565b820191906000526020600020905b815481529060010190602001808311610fff57829003601f168201915b50505050509080600b018054611031906157bf565b80601f016020809104026020016040519081016040528092919081815260200182805461105d906157bf565b80156110aa5780601f1061107f576101008083540402835291602001916110aa565b820191906000526020600020905b81548152906001019060200180831161108d57829003601f168201915b505050505090508c565b6101cc80546110c2906157bf565b80601f01602080910402602001604051908101604052809291908181526020018280546110ee906157bf565b801561113b5780601f106111105761010080835404028352916020019161113b565b820191906000526020600020905b81548152906001019060200180831161111e57829003601f168201915b505050505081565b600054610100900460ff16158080156111635750600054600160ff909116105b8061117d5750303b15801561117d575060005460ff166001145b61119a57604051631ee1e30360e21b815260040160405180910390fd5b6000805460ff1916600117905580156111bd576000805461ff0019166101001790555b6111cf8b8b8b8b8b8b8b8b8b8b613b6f565b8015611215576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b61033c80548190611232906157bf565b80601f016020809104026020016040519081016040528092919081815260200182805461125e906157bf565b80156112ab5780601f10611280576101008083540402835291602001916112ab565b820191906000526020600020905b81548152906001019060200180831161128e57829003601f168201915b5050505050908060010180546112c0906157bf565b80601f01602080910402602001604051908101604052809291908181526020018280546112ec906157bf565b80156113395780601f1061130e57610100808354040283529160200191611339565b820191906000526020600020905b81548152906001019060200180831161131c57829003601f168201915b505050600290930154919250506001600160a01b031683565b600061135f848484613c4f565b90505b9392505050565b600080516020615d8783398151915261138181613aa8565b61033b61138e8382615860565b508160405161139d919061591f565b6040518091039020600080516020615d07833981519152836040516113c29190614d37565b60405180910390a25050565b6000908152610167602052604090206001015490565b600080516020615d878339815191526113fc81613aa8565b6103396114098382615860565b5081604051611418919061591f565b6040518091039020600080516020615c27833981519152836040516113c29190614d37565b600080516020615d8783398151915261145581613aa8565b6103346114628382615860565b5081604051611471919061591f565b6040518091039020600080516020615de7833981519152836040516113c29190614d37565b6000806114a281613aa8565b61033e546001600160a01b03166114cc5760405163ddbadd5f60e01b815260040160405180910390fd5b4285116114f457604051630ce2127760e11b8152600481018690526024015b60405180910390fd5b6103a6541580159061153a57506103a6805486919061151590600190615951565b8154811061152557611525615964565b90600052602060002090600302016001015410155b15611599576103a6805486919061155390600190615951565b8154811061156357611563615964565b906000526020600020906003020160010154604051635937053b60e01b81526004016114eb929190918252602082015260400190565b6103a8546103a654604051632c52ca9160e11b81526000926001600160a01b0316916358a59522916115d09190899060040161597a565b6020604051808303816000875af11580156115ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161391906159db565b6040805160a081018252898152602081018981526001600160a01b038085168385018181526000606086018181528c1515608088019081526103a68054600181018255908452975160039098027fd8fdca16b06f802239e41c975465a088655e2ebe2b6b628995a459fe6daae44781019890985595517fd8fdca16b06f802239e41c975465a088655e2ebe2b6b628995a459fe6daae44888015591517fd8fdca16b06f802239e41c975465a088655e2ebe2b6b628995a459fe6daae4499096018054925195511515600160a81b0260ff60a81b19961515600160a01b026001600160a81b0319909416979095169690961791909117939093169190911790925591519293509188918a917f9a8d9fbc0ef868515df1ae007416537b13167767b854cb9bd402536f857134c09190a49695505050505050565b600080516020615d8783398151915261176381613aa8565b6103336117708382615860565b508160405161177f919061591f565b6040518091039020600080516020615be7833981519152836040516113c29190614d37565b600080516020615d878339815191526117bc81613aa8565b6103376117c98382615860565b50816040516117d8919061591f565b6040518091039020600080516020615e07833981519152836040516113c29190614d37565b611806826113ce565b61180f81613aa8565b6118198383613cad565b505050565b600061182d6102fd5460ff1690565b905090565b6001600160a01b03811633146118a25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016114eb565b6118ac8282613d34565b5050565b609d546001600160a01b0316158015906118e95750609d546001600160a01b0316734619ae227c558a5cbbfa824254634bf44517b99a14155b801561193657506119343360006118ff60355490565b6103a6858154811061191357611913615964565b90600052602060002090600302016000015461192f91906159f8565b613d9c565b155b1561195457604051632723972f60e11b815260040160405180910390fd5b6103a654811061197a57604051635f7644f960e01b8152600481018290526024016114eb565b6103a754811461199d57604051637c37df9b60e01b815260040160405180910390fd5b61033e546001600160a01b03166323b872dd33306119ba60355490565b6103a686815481106119ce576119ce615964565b9060005260206000209060030201600001546119ea91906159f8565b6040518463ffffffff1660e01b8152600401611a0893929190615a0f565b6020604051808303816000875af1158015611a27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4b9190615a33565b611a68576040516312171d8360e31b815260040160405180910390fd5b426103a68281548110611a7d57611a7d615964565b9060005260206000209060030201600101541115611ac857611ac36103a68281548110611aac57611aac615964565b906000526020600020906003020160010154613e12565b611adb565b611adb611ad6426001615a50565b613e12565b6103a78054906000611aec83615a63565b90915550506035546103a68281548110611b0857611b08615964565b906000526020600020906003020160000154611b2491906159f8565b60405182907f552544cb36551120f07c66c5cd4b2987725a0c72198587f2ce796099bb66c58c90600090a350565b600033611b74818585611b658383613281565b611b6f9190615a50565b613a08565b5060019392505050565b600080516020615d27833981519152611b9681613aa8565b611b9e613eed565b50565b6000600080516020615dc7833981519152611bbb81613aa8565b611bc58484613f39565b949350505050565b600080516020615d47833981519152611be581613aa8565b611bef8383613ff7565b826001600160a01b03167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688583604051611c2a91815260200190565b60405180910390a2505050565b600080516020615bc7833981519152611c4f81613aa8565b610372805460ff1916831515908117909155604051600080516020615cc783398151915290600090a25050565b606061033c600301805480602002602001604051908101604052809291908181526020018280548015610a8d57602002820191906000526020600020906000905b825461010083900a900460ff16815260206001928301818104948501949093039092029101808411611cbd5790505050505050905090565b600080516020615bc7833981519152611d0d81613aa8565b610373611d1a8382615860565b5081604051611d29919061591f565b6040518091039020600080516020615e47833981519152836040516113c29190614d37565b6103728054610373805460ff8084169461010090940416929190611d71906157bf565b80601f0160208091040260200160405190810160405280929190818152602001828054611d9d906157bf565b8015611dea5780601f10611dbf57610100808354040283529160200191611dea565b820191906000526020600020905b815481529060010190602001808311611dcd57829003601f168201915b5050505050905083565b600080516020615bc7833981519152611e0c81613aa8565b610372805461ff00191661010084151590810291909117909155604051600080516020615ca783398151915290600090a25050565b600080516020615d87833981519152611e5981613aa8565b6001600160a01b038316611e805760405163ddbadd5f60e01b815260040160405180910390fd5b60408051608081018252868152602081018690526001600160a01b038516918101919091526060810183905261033c80611eba8882615860565b5060208201516001820190611ecf9082615860565b5060408201516002820180546001600160a01b0319166001600160a01b0390921691909117905560608201518051611f11916003840191602090910190614c02565b5050604051611f229150869061591f565b604051908190038120907f408bab75412e31a1b6968730138526f58be00a6e236f0045d4034efe19b87a8090600090a283604051611f60919061591f565b604051908190038120907f54531db8f5319db0a47c88db916f15b44ac7ead82248d79156e05cf4710c98ed90600090a26040516001600160a01b038416907f167ce916c7c1d877abd9fa4ca8967828605c02dd77563f455a803452aaf250d190600090a27f710bcb47aaee8c11f2e5883127aeed64bd6962930980900342715880792d45b482604051611ff39190615398565b60405180910390a15050505050565b6000806000612012846066614083565b915091508161136257603554611bc5565b600080516020615d8783398151915261203b81613aa8565b610330829055604051828152600080516020615da7833981519152906020015b60405180910390a15050565b600080516020615d8783398151915261207f81613aa8565b61033261208c8382615860565b508160405161209b919061591f565b6040518091039020600080516020615c07833981519152836040516113c29190614d37565b6001600160a01b0381166000908152606560205260408120819081906120e7908690614083565b91509150816120fe576120f9846125c8565b612100565b805b95945050505050565b600080516020615d8783398151915261212181613aa8565b61033661212e8382615860565b508160405161213d919061591f565b6040518091039020600080516020615e67833981519152836040516113c29190614d37565b600080516020615d8783398151915261217a81613aa8565b6040805161018081018252835180825260208086015190830181905285840151938301849052606080870151908401526080808701519084015260a0808701519084015260c0808701519084015260e080870151908401526101008087015190840152610120808701519084015261014080870151908401526101608087015190840152610330918255610331559091610332906122189082615860565b506060820151600382019061222d9082615860565b50608082015160048201906122429082615860565b5060a082015160058201906122579082615860565b5060c0820151600682019061226c9082615860565b5060e082015160078201906122819082615860565b5061010082015160088201906122979082615860565b5061012082015160098201906122ad9082615860565b50610140820151600a8201906122c39082615860565b50610160820151600b8201906122d99082615860565b50508251604051908152600080516020615da7833981519152915060200160405180910390a1600080516020615ba7833981519152826020015160405161232291815260200190565b60405180910390a1816040015160405161233c919061591f565b6040518091039020600080516020615c0783398151915283604001516040516123659190614d37565b60405180910390a2816060015160405161237f919061591f565b6040518091039020600080516020615be783398151915283606001516040516123a89190614d37565b60405180910390a281608001516040516123c2919061591f565b6040518091039020600080516020615de783398151915283608001516040516123eb9190614d37565b60405180910390a28160a00151604051612405919061591f565b6040518091039020600080516020615e878339815191528360a0015160405161242e9190614d37565b60405180910390a28160c00151604051612448919061591f565b6040518091039020600080516020615e678339815191528360c001516040516124719190614d37565b60405180910390a28160e0015160405161248b919061591f565b6040518091039020600080516020615e078339815191528360e001516040516124b49190614d37565b60405180910390a28161010001516040516124cf919061591f565b6040518091039020600080516020615c878339815191528361010001516040516124f99190614d37565b60405180910390a2816101200151604051612514919061591f565b6040518091039020600080516020615c2783398151915283610120015160405161253e9190614d37565b60405180910390a2816101400151604051612559919061591f565b6040518091039020600080516020615e278339815191528361014001516040516125839190614d37565b60405180910390a281610160015160405161259e919061591f565b6040518091039020600080516020615d078339815191528361016001516040516113c29190614d37565b6001600160a01b031660009081526033602052604090205490565b600080516020615d878339815191526125fb81613aa8565b61033a6126088382615860565b5081604051612617919061591f565b6040518091039020600080516020615e27833981519152836040516113c29190614d37565b6000600080516020615dc783398151915261265681613aa8565b611bc584846140d8565b600080516020615d4783398151915261267881613aa8565b6101cd6126858382615860565b5081604051612694919061591f565b60405180910390207f8763f25a8d9538205dfcd4dc235a0f6bf9f0a6a01327e13524aaf39f954fa50f836040516113c29190614d37565b600054610100900460ff166126f3576040516366b9f31560e01b815260040160405180910390fd5b6103a880546001600160a01b0319166001600160a01b0392909216919091179055565b600080516020615d2783398151915261272e81613aa8565b611b9e614181565b6103a6818154811061274757600080fd5b60009182526020909120600390910201805460018201546002909201549092506001600160a01b0381169060ff600160a01b8204811691600160a81b90041685565b600061279581836141be565b156127a2575060016109ff565b61136283836141be565b606060378054610a14906157bf565b600033816127c98286613281565b9050838110156127ec5760405163f340c31f60e01b815260040160405180910390fd5b6127f98286868403613a08565b506001949350505050565b600061280f81613aa8565b609d80546001600160a01b0319166001600160a01b038416908117909155604051600080516020615c4783398151915290600090a25050565b600080516020615c6783398151915261286081613aa8565b6103a654831061288657604051635f7644f960e01b8152600481018490526024016114eb565b6103a7548310156128aa5760405163a8f6261f60e01b815260040160405180910390fd5b6103a683815481106128be576128be615964565b906000526020600020906003020160020160159054906101000a900460ff166128fa5760405163168caa0560e21b815260040160405180910390fd5b816103a6848154811061290f5761290f615964565b60009182526020822060039091020191909155604051339184917f5f0046b676206db3967aac08290592d345332bbe1a215858108f7d5a9dd441149190a3505050565b600033611b748185856141ea565b6060606a805480602002602001604051908101604052809291908181526020018280548015610a8d57602002820191906000526020600020905b81548152602001906001019080831161299a575050505050905090565b600080516020615ce78339815191526129cf81613aa8565b6103a65482106129f557604051635f7644f960e01b8152600481018390526024016114eb565b60016103a754612a059190615951565b8214612a2457604051637c37df9b60e01b815260040160405180910390fd5b426103a68381548110612a3957612a39615964565b90600052602060002090600302016001015411612a92576103a68281548110612a6457612a64615964565b906000526020600020906003020160010154604051630ce2127760e11b81526004016114eb91815260200190565b609d546001600160a01b031615801590612acb5750609d546001600160a01b0316734619ae227c558a5cbbfa824254634bf44517b99a14155b8015612b505750612b4e600033306001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b3a9190615a7c565b6103a6868154811061191357611913615964565b155b15612b6e57604051632723972f60e11b815260040160405180910390fd5b61033e546001600160a01b031663a9059cbb336035546103a68681548110612b9857612b98615964565b906000526020600020906003020160000154612bb491906159f8565b6040518363ffffffff1660e01b8152600401612bd1929190615a95565b6020604051808303816000875af1158015612bf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c149190615a33565b612c31576040516312171d8360e31b815260040160405180910390fd5b612c5f6103a68381548110612c4857612c48615964565b9060005260206000209060030201600101546142ce565b6103a78054906000612c7083615aae565b90915550506035546103a68381548110612c8c57612c8c615964565b906000526020600020906003020160000154612ca891906159f8565b60405183907f8532a1d9e02e03ee51eb93fce8c77f5b2ad216f488a3cd902d775a49170a3b6d90600090a35050565b6103a6548110612cfd57604051635f7644f960e01b8152600481018290526024016114eb565b6103a7548110612d2357604051636571a8db60e11b8152600481018290526024016114eb565b60006103a68281548110612d3957612d39615964565b60009182526020909120600390910201600201546001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401612d7891906152e8565b602060405180830381865afa158015612d95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612db99190615a7c565b905080600003612e73576103a68281548110612dd757612dd7615964565b60009182526020909120600390910201600201546001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401612e1691906152e8565b602060405180830381865afa158015612e33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e579190615a7c565b604051639266535160e01b81526004016114eb91815260200190565b609d546001600160a01b031615801590612eac5750609d546001600160a01b0316734619ae227c558a5cbbfa824254634bf44517b99a14155b8015612ed05750612ece600033836103a6868154811061191357611913615964565b155b15612eee57604051632723972f60e11b815260040160405180910390fd5b6000816103a68481548110612f0557612f05615964565b906000526020600020906003020160000154612f2191906159f8565b90506103a68381548110612f3757612f37615964565b60009182526020822060026003909202010154604080516305f898e560e11b815233600482015260248101869052606060448201526064810184905290516001600160a01b0390921692630bf131ca9260848084019382900301818387803b158015612fa257600080fd5b505af1158015612fb6573d6000803e3d6000fd5b505061033e5460405163a9059cbb60e01b81526001600160a01b03909116925063a9059cbb9150612fed9033908590600401615a95565b6020604051808303816000875af115801561300c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130309190615a33565b61304d576040516312171d8360e31b815260040160405180910390fd5b6040518290339085907f55188540052a206e959fa07e62a5f0542065989dcf08853e21b5668c778e460590600090a4505050565b600061308f60d05460ff1690565b8061309e575061309e846131df565b806130ad57506130ad836131df565b156130ba57506000611362565b609d546001600160a01b0316158015906130d757506102ca5460ff165b15611b74576001600160a01b0384161580156131065750613106600080516020615d4783398151915284612789565b1561311357506001611362565b61312b600080516020615d4783398151915285612789565b1561313857506001611362565b613143848484613d9c565b9050611362565b600080516020615d8783398151915261316281613aa8565b61033561316f8382615860565b508160405161317e919061591f565b6040518091039020600080516020615e87833981519152836040516113c29190614d37565b600080516020615d878339815191526131bb81613aa8565b610331829055604051828152600080516020615ba78339815191529060200161205b565b6001600160a01b03166000908152610102602052604090205460ff1690565b6101cd80546110c2906157bf565b613215826113ce565b61321e81613aa8565b6118198383613d34565b600080516020615d8783398151915261324081613aa8565b61033861324d8382615860565b508160405161325c919061591f565b6040518091039020600080516020615c87833981519152836040516113c29190614d37565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b600080516020615bc78339815191526132c481613aa8565b6040805160608101825285151580825285151560208301819052928201859052610372805461010090940261ff001990921661ffff1990941693909317178255906103736133128582615860565b50506040518515159150600080516020615cc783398151915290600090a260405183151590600080516020615ca783398151915290600090a281604051613359919061591f565b6040518091039020600080516020615e4783398151915283604051610b0a9190614d37565b6101ce80546110c2906157bf565b6103a75482106133b257604051636571a8db60e11b8152600481018390526024016114eb565b6103a682815481106133c6576133c6615964565b906000526020600020906003020160020160149054906101000a900460ff161561340357604051631bbdf5c560e31b815260040160405180910390fd5b4261340c612960565b838151811061341d5761341d615964565b6020026020010151111561346857613433612960565b828151811061344457613444615964565b60200260200101516040516371d8115f60e01b81526004016114eb91815260200190565b6000613494613475612960565b848151811061348657613486615964565b6020026020010151836120c0565b9050806000036134ba57604051639266535160e01b8152600481018290526024016114eb565b6103a683815481106134ce576134ce615964565b60009182526020909120600260039092020101546040516370a0823160e01b81526001600160a01b03909116906370a082319061350f9085906004016152e8565b602060405180830381865afa15801561352c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135509190615a7c565b1561356e57604051631bbdf5c560e31b815260040160405180910390fd5b6103a6838154811061358257613582615964565b6000918252602082206002600390920201015460408051631fa5d41d60e11b815290516001600160a01b0390921692633f4ba83a9260048084019382900301818387803b1580156135d257600080fd5b505af11580156135e6573d6000803e3d6000fd5b505050506103a683815481106135fe576135fe615964565b60009182526020909120600260039092020101546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906136419085908590600401615a95565b600060405180830381600087803b15801561365b57600080fd5b505af115801561366f573d6000803e3d6000fd5b5050505061369c61367e612960565b848151811061368f5761368f615964565b6020026020010151612002565b6103a684815481106136b0576136b0615964565b600091825260209182902060026003909202010154604080516318160ddd60e01b815290516001600160a01b03909216926318160ddd926004808401938290030181865afa158015613706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061372a9190615a7c565b10156137b1576103a6838154811061374457613744615964565b6000918252602082206002600390920201015460408051638456cb5960e01b815290516001600160a01b0390921692638456cb599260048084019382900301818387803b15801561379457600080fd5b505af11580156137a8573d6000803e3d6000fd5b505050506137f0565b60016103a684815481106137c7576137c7615964565b906000526020600020906003020160020160146101000a81548160ff0219169083151502179055505b816001600160a01b0316613824613805612960565b858151811061381657613816615964565b6020026020010151846120c0565b6103a6858154811061383857613838615964565b600091825260208220600260039092020101546040516001600160a01b03909116917f567dd2c238fb7e60fa2fd1b73be2685968f4c1f8b063eb819b6e944f62a626ed91a4505050565b604080516000815260208101909152606a546060919015613a03576000806138a86143b2565b915091508160001480156138bc5750606854155b1561391a57606a80548060200260200160405190810160405280929190818152602001828054801561390d57602002820191906000526020600020905b8154815260200190600101908083116138f9575b5050505050935050505090565b606a54613928826001615a50565b14613a0057606a54600090600190613941908490615951565b61394b9190615951565b9050806001600160401b0381111561396557613965614d96565b60405190808252806020026020018201604052801561398e578160200160208202803683370190505b50935060005b84518110156139fd57606a816139ab856001615a50565b6139b59190615a50565b815481106139c5576139c5615964565b90600052602060002001548582815181106139e2576139e2615964565b60209081029190910101526139f681615a63565b9050613994565b50505b50505b919050565b6001600160a01b0383161580613a2557506001600160a01b038216155b15613a4757828260405163f1ff34ab60e01b81526004016114eb929190615ac5565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b611b9e813361446b565b6001600160a01b038216613ad857604051620bbd2160e81b815260040160405180910390fd5b613ae4826000836144c4565b6001600160a01b03821660009081526033602052604090205481811015613b2157604051639266535160e01b8152600481018290526024016114eb565b6001600160a01b0383166000818152603360209081526040808320868603905560358054879003905551858152919291600080516020615d67833981519152910160405180910390a3505050565b600054610100900460ff16613b97576040516366b9f31560e01b815260040160405180910390fd5b613b9f6144f7565b613ba98989614521565b613bb16144f7565b613bb96144f7565b613bc1614562565b613bc96144f7565b613bd1614596565b613bda856145ca565b613be38a614639565b613beb6144f7565b613bf36144f7565b613bfb6144f7565b613c056000614693565b613c0d6144f7565b613c16816146d2565b613c1e6144f7565b613c266144f7565b613c2f826126cb565b613c3b8787868661470e565b613c436144f7565b50505050505050505050565b600080613c5d858585614769565b9050801561135f5760405183815233906001600160a01b038716907f7c2b9369bf4a6bd9745889c658ad00a4d57e280c4c80fa1c74db2a9e52c136359060200160405180910390a3949350505050565b613cb78282612789565b6118ac576000828152610167602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613cf03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b613d3e8282612789565b156118ac576000828152610167602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b609d5460405163634a350960e11b81526000916001600160a01b03169063c6946a1290613dd190879087908790600401615a0f565b602060405180830381865afa158015613dee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135f9190615a33565b428111613e325760405163ee0df60960e01b815260040160405180910390fd5b606a5415801590613e6d5750606a8054613e4e90600190615951565b81548110613e5e57613e5e615964565b90600052602060002001548111155b15613e8b57604051630ae4b6a760e01b815260040160405180910390fd5b606a805460018101825560009182527f116fea137db6e131133e7f2bab296045d8f41cc5607279db17b218cab0929a51018290556040518291907fe2ad3b1abe53383dbe6359f02f11ae76d91cfab321b37083b16e1d96a81d4183908290a350565b613ef5614782565b60d0805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051613f2f91906152e8565b60405180910390a1565b6001600160a01b0382166000908152610102602052604081205460ff1615613f63575060006109ff565b6001600160a01b0383166000908152610102602052604090819020805460ff1916600117905551613f9590839061591f565b6040518091039020836001600160a01b0316613fae3390565b6001600160a01b03167fe80aede59db0b770aef5e4bd04670759d38e64959d07a4343257a0a4f6b6d1ed85604051613fe69190614d37565b60405180910390a450600192915050565b6001600160a01b03821661401e576040516306c31bdf60e41b815260040160405180910390fd5b61402a600083836144c4565b806035600082825461403c9190615a50565b90915550506001600160a01b038216600081815260336020908152604080832080548601905551848152600080516020615d67833981519152910160405180910390a35050565b6000808061409184866147cb565b845490915081036140a95760008092509250506140d1565b60018460010182815481106140c0576140c0615964565b906000526020600020015492509250505b9250929050565b6001600160a01b0382166000908152610102602052604081205460ff16614101575060006109ff565b6001600160a01b0383166000908152610102602052604090819020805460ff191690555161413090839061591f565b6040518091039020836001600160a01b03166141493390565b6001600160a01b03167f7a52fdbc4f3e9f93670cd35b5b9c2d974791d25c5c04984336a80be3f7f42c3285604051613fe69190614d37565b61418961486c565b60d0805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613f223390565b6000918252610167602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6001600160a01b038316158061420757506001600160a01b038216155b1561422957828260405163ba2c33ab60e01b81526004016114eb929190615ac5565b6142348383836144c4565b6001600160a01b0383166000908152603360205260409020548181101561427157604051639266535160e01b8152600481018290526024016114eb565b6001600160a01b038085166000818152603360205260408082208686039055928616808252908390208054860190559151600080516020615d67833981519152906142bf9086815260200190565b60405180910390a35b50505050565b4281116142ee5760405163684a87bf60e11b815260040160405180910390fd5b606a54600003614311576040516334bda1d560e11b815260040160405180910390fd5b606a805461432190600190615951565b8154811061433157614331615964565b9060005260206000200154811461435b5760405163ab27ba1f60e01b815260040160405180910390fd5b606a80548061436c5761436c615adf565b60019003818190600052602060002001600090559055807f06e2498f5548e5491bfe985562cc494131eae56b5b6543b59129c8886f129f6560405160405180910390a250565b606a5460009081908015806143de57508060695460016143d29190615a50565b1480156143de57508215155b156143ed576000939092509050565b6000819250600060695490505b828110156144635742606a828154811061441657614416615964565b90600052602060002001541161444e57606a818154811061443957614439615964565b90600052602060002001549150809350614453565b614463565b61445c81615a63565b90506143fa565b509391925050565b6144758282612789565b6118ac57614482816148b2565b61448d8360206148c4565b60405160200161449e929190615af5565b60408051601f198184030181529082905262461bcd60e51b82526114eb91600401614d37565b6144cf838383613081565b6144ec57604051632723972f60e11b815260040160405180910390fd5b611819838383614a5f565b600054610100900460ff1661451f576040516366b9f31560e01b815260040160405180910390fd5b565b600054610100900460ff16614549576040516366b9f31560e01b815260040160405180910390fd5b60366145558382615860565b5060376118198282615860565b600054610100900460ff1661458a576040516366b9f31560e01b815260040160405180910390fd5b60d0805460ff19169055565b600054610100900460ff166145be576040516366b9f31560e01b815260040160405180910390fd5b60006068819055606955565b600054610100900460ff166145f2576040516366b9f31560e01b815260040160405180910390fd5b6001600160a01b03811615611b9e57609d80546001600160a01b0319166001600160a01b038316908117909155604051600080516020615c4783398151915290600090a250565b600054610100900460ff16614661576040516366b9f31560e01b815260040160405180910390fd5b6001600160a01b0381166146885760405163ddbadd5f60e01b815260040160405180910390fd5b611b9e600082613cad565b600054610100900460ff166146bb576040516366b9f31560e01b815260040160405180910390fd5b6102fd805460ff191660ff92909216919091179055565b600054610100900460ff166146fa576040516366b9f31560e01b815260040160405180910390fd5b6102ca805460ff1916911515919091179055565b600054610100900460ff16614736576040516366b9f31560e01b815260040160405180910390fd5b6101cc6147438582615860565b506101cd6147518482615860565b506101ce61475f8382615860565b506101cf55505050565b600033614777858285614aa8565b6127f98585856141ea565b60d05460ff1661451f5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016114eb565b815460009081036147de575060006109ff565b82546000905b808210156148285760006147f88383614af7565b9050846148058783614b12565b54111561481457809150614822565b61481f816001615a50565b92505b506147e4565b60008211801561484b57508361484886614843600186615951565b614b12565b54145b156148645761485b600183615951565b925050506109ff565b5090506109ff565b60d05460ff161561451f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016114eb565b60606109ff6001600160a01b03831660145b606060006148d38360026159f8565b6148de906002615a50565b6001600160401b038111156148f5576148f5614d96565b6040519080825280601f01601f19166020018201604052801561491f576020820181803683370190505b509050600360fc1b8160008151811061493a5761493a615964565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061496957614969615964565b60200101906001600160f81b031916908160001a905350600061498d8460026159f8565b614998906001615a50565b90505b6001811115614a10576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106149cc576149cc615964565b1a60f81b8282815181106149e2576149e2615964565b60200101906001600160f81b031916908160001a90535060049490941c93614a0981615aae565b905061499b565b5083156113625760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016114eb565b614a67614b23565b6001600160a01b03831615614a9f57614a7f83614b44565b6001600160a01b03821615614a975761181982614b44565b611819614b6e565b614a9782614b44565b6000614ab48484613281565b905060001981146142c85781811015614aea5760405163054365bb60e31b815260048101839052602481018290526044016114eb565b6142c88484848403613a08565b6000614b066002848418615b64565b61136290848416615a50565b600082815260208120820180611bc5565b600080614b2e6143b2565b909250905081156118ac57606891909155606955565b6001600160a01b0381166000908152606560205260409020611b9e90614b69836125c8565b614b7c565b61451f6066614b6960355490565b60685480614b8984614bbd565b1015611819578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b80546000908103614bd057506000919050565b81548290614be090600190615951565b81548110614bf057614bf0615964565b90600052602060002001549050919050565b82805482825590600052602060002090601f01602090048101928215614c985791602002820160005b83821115614c6957835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302614c2b565b8015614c965782816101000a81549060ff0219169055600101602081600001049283019260010302614c69565b505b50614ca4929150614ca8565b5090565b5b80821115614ca45760008155600101614ca9565b600060208284031215614ccf57600080fd5b81356001600160e01b03198116811461136257600080fd5b60005b83811015614d02578181015183820152602001614cea565b50506000910152565b60008151808452614d23816020860160208601614ce7565b601f01601f19169290920160200192915050565b6020815260006113626020830184614d0b565b6001600160a01b0381168114611b9e57600080fd5b8035613a0381614d4a565b60008060408385031215614d7d57600080fd5b8235614d8881614d4a565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715614dce57614dce614d96565b60405290565b60405161018081016001600160401b0381118282101715614dce57614dce614d96565b604051601f8201601f191681016001600160401b0381118282101715614e1f57614e1f614d96565b604052919050565b600082601f830112614e3857600080fd5b81356001600160401b03811115614e5157614e51614d96565b614e64601f8201601f1916602001614df7565b818152846020838601011115614e7957600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215614eab57600080fd5b8335614eb681614d4a565b92506020840135915060408401356001600160401b03811115614ed857600080fd5b614ee486828701614e27565b9150509250925092565b60006101808e83528d6020840152806040840152614f0e8184018e614d0b565b90508281036060840152614f22818d614d0b565b90508281036080840152614f36818c614d0b565b905082810360a0840152614f4a818b614d0b565b905082810360c0840152614f5e818a614d0b565b905082810360e0840152614f728189614d0b565b9050828103610100840152614f878188614d0b565b9050828103610120840152614f9c8187614d0b565b9050828103610140840152614fb18186614d0b565b9050828103610160840152614fc68185614d0b565b9f9e505050505050505050505050505050565b8015158114611b9e57600080fd5b8035613a0381614fd9565b6000806000806000806000806000806101408b8d03121561501257600080fd5b61501b8b614d5f565b995060208b01356001600160401b038082111561503757600080fd5b6150438e838f01614e27565b9a5060408d013591508082111561505957600080fd5b6150658e838f01614e27565b995060608d013591508082111561507b57600080fd5b6150878e838f01614e27565b985060808d013591508082111561509d57600080fd5b6150a98e838f01614e27565b97506150b760a08e01614d5f565b965060c08d01359150808211156150cd57600080fd5b506150da8d828e01614e27565b94505060e08b013592506150f16101008c01614d5f565b91506151006101208c01614fe7565b90509295989b9194979a5092959850565b6060815260006151246060830186614d0b565b82810360208401526151368186614d0b565b91505060018060a01b0383166040830152949350505050565b60008060006060848603121561516457600080fd5b833561516f81614d4a565b9250602084013561517f81614d4a565b929592945050506040919091013590565b6000602082840312156151a257600080fd5b81356001600160401b038111156151b857600080fd5b611bc584828501614e27565b6000602082840312156151d657600080fd5b5035919050565b60006001600160401b038211156151f6576151f6614d96565b5060051b60200190565b6000806000806080858703121561521657600080fd5b8435935060208086013593506040808701356001600160401b0381111561523c57600080fd5b8701601f8101891361524d57600080fd5b803561526061525b826151dd565b614df7565b81815260069190911b8201840190848101908b83111561527f57600080fd5b928501925b828410156152c85784848d03121561529c5760008081fd5b6152a4614dac565b84356152af81614d4a565b8152848701358782015282529284019290850190615284565b8097505050505050506152dd60608601614fe7565b905092959194509250565b6001600160a01b0391909116815260200190565b6000806040838503121561530f57600080fd5b82359150602083013561532181614d4a565b809150509250929050565b6000806040838503121561533f57600080fd5b823561534a81614d4a565b915060208301356001600160401b0381111561536557600080fd5b61537185828601614e27565b9150509250929050565b60006020828403121561538d57600080fd5b813561136281614fd9565b6020808252825182820181905260009190848201906040850190845b818110156153d357835160ff16835292840192918401916001016153b4565b50909695505050505050565b831515815282151560208201526060604082015260006121006060830184614d0b565b6000806000806080858703121561541857600080fd5b84356001600160401b038082111561542f57600080fd5b61543b88838901614e27565b955060209150818701358181111561545257600080fd5b61545e89828a01614e27565b955050604087013561546f81614d4a565b935060608701358181111561548357600080fd5b87019050601f8101881361549657600080fd5b80356154a461525b826151dd565b81815260059190911b8201830190838101908a8311156154c357600080fd5b928401925b828410156154f157833560ff811681146154e25760008081fd5b825292840192908401906154c8565b979a9699509497505050505050565b60006020828403121561551257600080fd5b81356001600160401b038082111561552957600080fd5b90830190610180828603121561553e57600080fd5b615546614dd4565b823581526020830135602082015260408301358281111561556657600080fd5b61557287828601614e27565b60408301525060608301358281111561558a57600080fd5b61559687828601614e27565b6060830152506080830135828111156155ae57600080fd5b6155ba87828601614e27565b60808301525060a0830135828111156155d257600080fd5b6155de87828601614e27565b60a08301525060c0830135828111156155f657600080fd5b61560287828601614e27565b60c08301525060e08301358281111561561a57600080fd5b61562687828601614e27565b60e083015250610100808401358381111561564057600080fd5b61564c88828701614e27565b828401525050610120808401358381111561566657600080fd5b61567288828701614e27565b828401525050610140808401358381111561568c57600080fd5b61569888828701614e27565b82840152505061016080840135838111156156b257600080fd5b6156be88828701614e27565b918301919091525095945050505050565b6000602082840312156156e157600080fd5b813561136281614d4a565b600080604083850312156156ff57600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156153d35783518352928401929184019160010161572a565b6000806040838503121561575957600080fd5b823561576481614d4a565b9150602083013561532181614d4a565b60008060006060848603121561578957600080fd5b833561579481614fd9565b925060208401356157a481614fd9565b915060408401356001600160401b03811115614ed857600080fd5b600181811c908216806157d357607f821691505b6020821081036157f357634e487b7160e01b600052602260045260246000fd5b50919050565b82815260406020820152600061135f6040830184614d0b565b601f82111561181957600081815260208120601f850160051c810160208610156158395750805b601f850160051c820191505b8181101561585857828155600101615845565b505050505050565b81516001600160401b0381111561587957615879614d96565b61588d8161588784546157bf565b84615812565b602080601f8311600181146158c257600084156158aa5750858301515b600019600386901b1c1916600185901b178555615858565b600085815260208120601f198616915b828110156158f1578886015182559484019460019091019084016158d2565b508582101561590f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251615931818460208701614ce7565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156109ff576109ff61593b565b634e487b7160e01b600052603260045260246000fd5b6000604080830185845260208281860152818651808452606087019150828801935060005b818110156159cd57845180516001600160a01b0316845284015184840152938301939185019160010161599f565b509098975050505050505050565b6000602082840312156159ed57600080fd5b815161136281614d4a565b80820281158282048414176109ff576109ff61593b565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215615a4557600080fd5b815161136281614fd9565b808201808211156109ff576109ff61593b565b600060018201615a7557615a7561593b565b5060010190565b600060208284031215615a8e57600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b600081615abd57615abd61593b565b506000190190565b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052603160045260246000fd5b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615b27816017850160208801614ce7565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615b58816028840160208801614ce7565b01602801949350505050565b600082615b8157634e487b7160e01b600052601260045260246000fd5b50049056fe3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848738d1b1065e9baa0c7947c9ccc0e22b1d470d8f6221bbff350d3b41f24646a7eaa2de0737115053bf7d3d68e733306557628aef4b4aefa746cbf344fc726724721c1b5695d200e071a117d8e2600f4b8739689c44c773aac9f1104f4ea1ee5344daffcef1eeed35b202f86368def1684635c4568c1677447020127842e94cd5f2893cd7e7309055797bcc658887ad0a1de46b88ccca8260206bda3095071f5d637213fe93a5aae50df0ef53f98b81c048e51b3ab2969309a103a647e44b619188304288da0064fd090d95b67bca5d7ef84faa6c92418f0ac355038733624738820188bddbb8ff3f7bfcdb154a4c599bce9dab8f620db24dd27442326212d9fd3355218ef44c05df7b0087337f3d1e1923194a5f2f312d4faaa7d4c6083d2e65acfff80918b8a23ec550b0676cc4642c3a0d5f033cfa3ff8998dc8448a0cb7dbe114e74f6ea3bd819998f78687bfcb11b140da08e9b7d222fa9c1f1ba1f2aa1225c388aa54cd4074eb90383e6f01e9316ba4669faee4086cf48d639968fed569565d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efc6f3350ab30f55ce45863160fc345c1663d4633fe7cacfd3b9bbb6420a9147f8ddc6c807bd9e0d70db5e03f6296a4ebddff5eadec9da2f4dab0da5e4bbdaaa5f973ef39d76cc2c6090feab1c030bec6ab5db557f64df047a4c4f9b5953cf1df35792973abb7bb17fbf2dbe25beb5a013c89e174158629682a6bbd8e361a5cc734c6f61ef9cdfaa4e5c7780501c91c2d853bba8371b411d54972d6d76cc899a9d96a0bb02e7873bcbc9585de903b588438db3002fcded6d6e52295ef21a32b9686070a6a09f06d4f10acb86427e58c98989b9d767a24cee548f108b583af5a898d7a17e24227144fff67a7c30410d77a60b8bbe03fa820a096d5ec2ffb2205edc5430bb1fd10855ad38fe3c3bccfcab1a3f6f2797085cadc229e92e36c07d42cba264697066735822122036e23655da8b7519cb3321b435e723aa5148c66fa90a0ac7762b9b2a3bf4b46964736f6c63430008110033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.