Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- GasStationUpgradeableV1
- Optimization enabled
- true
- Compiler version
- v0.8.17+commit.8df45f5f
- Optimization runs
- 1000
- EVM Version
- default
- Verified at
- 2025-10-28T07:02:05.748949Z
contracts/projects/gas/GasStationUpgradeableV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "asterizmprotocol/contracts/evm/AsterizmClientUpgradeable.sol";
contract GasStationUpgradeableV1 is AsterizmClientUpgradeable {
using SafeERC20 for IERC20;
using UintLib for uint;
using AddressLib for address;
event CoinsReceivedEvent(uint _amount, uint _transactionId, address _dstAddress);
event GasSendEvent(uint64 _dstChainId, uint _transactionId, bytes _payload);
event AddStableCoinEvent(address _address);
event RemoveStableCoinEvent(address _address);
event SetMinUsdAmountEvent(uint _amount);
event SetMaxUsdAmountEvent(uint _amount);
event SetMinUsdAmountPerChainEvent(uint _amount);
event SetMaxUsdAmountPerChainEvent(uint _amount);
struct StableCoin {
bool exists;
uint8 decimals;
}
mapping(address => StableCoin) public stableCoins;
uint public minUsdAmount;
uint public maxUsdAmount;
uint public minUsdAmountPerChain;
uint public maxUsdAmountPerChain;
/// Initializing function for upgradeable contracts (constructor)
/// @param _initializerLib IInitializerSender Initializer library address
function initialize(IInitializerSender _initializerLib) initializer public {
__AsterizmClientUpgradeable_init(_initializerLib, false, true);
}
/// Add stable coin
/// @param _tokenAddress address Token address
function addStableCoin(address _tokenAddress) external onlyOwner {
(bool success, bytes memory result) = _tokenAddress.call(abi.encodeWithSignature("decimals()"));
require(success, "GasStation: decimals request failed");
stableCoins[_tokenAddress].decimals = abi.decode(result, (uint8));
stableCoins[_tokenAddress].exists = true;
emit AddStableCoinEvent(_tokenAddress);
}
/// Remove stable coin
/// @param _tokenAddress address Token address
function removeStableCoin(address _tokenAddress) external onlyOwner {
delete stableCoins[_tokenAddress];
emit RemoveStableCoinEvent(_tokenAddress);
}
/// Set minimum amount in USD
/// @param _amount uint Amount
function setMinUsdAmount(uint _amount) external onlyOwner {
minUsdAmount = _amount;
emit SetMinUsdAmountEvent(_amount);
}
/// Set maximum amount in USD
/// @param _amount uint Amount
function setMaxUsdAmount(uint _amount) external onlyOwner {
maxUsdAmount = _amount;
emit SetMaxUsdAmountEvent(_amount);
}
/// Set minimum amount in USD per chain
/// @param _amount uint Amount
function setMinUsdAmountPerChain(uint _amount) external onlyOwner {
minUsdAmountPerChain = _amount;
emit SetMinUsdAmountPerChainEvent(_amount);
}
/// Set maximum amount in USD per chain
/// @param _amount uint Amount
function setMaxUsdAmountPerChain(uint _amount) external onlyOwner {
maxUsdAmountPerChain = _amount;
emit SetMaxUsdAmountPerChainEvent(_amount);
}
/// Send gas logic
/// @param _chainIds uint64[] Chains IDs
/// @param _amounts uint[] Amounts
/// @param _receivers uint[] Receivers
/// @param _token IERC20 Token
function sendGas(uint64[] memory _chainIds, uint[] memory _amounts, uint[] memory _receivers, IERC20 _token) external nonReentrant {
address tokenAddress = address(_token);
require(stableCoins[tokenAddress].exists, "GasStation: wrong token");
uint tokenDecimals = 10 ** stableCoins[tokenAddress].decimals;
uint sum;
for (uint i = 0; i < _amounts.length; i++) {
if (minUsdAmountPerChain > 0) {
uint amountInUsd = _amounts[i] / tokenDecimals;
require(amountInUsd >= minUsdAmountPerChain, "GasStation: minimum amount per chain validation error");
}
if (maxUsdAmountPerChain > 0) {
uint amountInUsd = _amounts[i] / tokenDecimals;
require(amountInUsd <= maxUsdAmountPerChain, "GasStation: maximum amount per chain validation error");
}
sum += _amounts[i];
}
require(sum > 0, "GasStation: wrong amounts");
{
uint sumInUsd = sum / tokenDecimals;
require(sumInUsd > 0, "GasStation: wrong amounts in USD");
if (minUsdAmount > 0) {
require(sumInUsd >= minUsdAmount, "GasStation: minimum amount validation error");
}
if (maxUsdAmount > 0) {
require(sumInUsd <= maxUsdAmount, "GasStation: maximum amount validation error");
}
}
_token.safeTransferFrom(msg.sender, owner(), sum);
for (uint i = 0; i < _amounts.length; i++) {
uint txId = _getTxId();
bytes memory payload = abi.encode(_receivers[i], _amounts[i], txId, tokenAddress.toUint(), stableCoins[tokenAddress].decimals);
_initAsterizmTransferEvent(_chainIds[i], payload);
emit GasSendEvent(_chainIds[i], txId, payload);
}
}
/// Receive payload
/// @param _dto ClAsterizmReceiveRequestDto Method DTO
function _asterizmReceive(ClAsterizmReceiveRequestDto memory _dto) internal override {
(uint dstAddressUint, uint amount, uint txId , uint tokenAddressUint, uint8 decimals, uint stableRate) = abi.decode(_dto.payload, (uint, uint, uint, uint, uint8, uint));
require(
_validTransferHash(
_dto.srcChainId, _dto.srcAddress, _dto.dstChainId, _dto.dstAddress, _dto.txId,
abi.encode(dstAddressUint, amount, txId, tokenAddressUint, decimals),
_dto.transferHash
),
"GasStation: transfer hash is invalid"
);
address dstAddress = dstAddressUint.toAddress();
uint amountToSend = amount * stableRate / (10 ** decimals);
if (dstAddress != address(this)) {
(bool success, ) = dstAddress.call{value: amountToSend}("");
require(success, "GasStation: transfer error");
}
emit CoinsReceivedEvent(amountToSend, _dto.txId, dstAddress);
}
/// Build packed payload (abi.encodePacked() result)
/// @param _payload bytes Default payload (abi.encode() result)
/// @return bytes Packed payload (abi.encodePacked() result)
function _buildPackedPayload(bytes memory _payload) internal pure override returns(bytes memory) {
(uint dstAddressUint, uint amount, uint txId , uint tokenAddressUint, uint8 decimals) = abi.decode(_payload, (uint, uint, uint, uint, uint8));
return abi.encodePacked(dstAddressUint, amount, txId, tokenAddressUint, decimals);
}
}
@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol
// 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 IERC1967Upgradeable {
/**
* @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);
}
@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol
// 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 IERC1822ProxiableUpgradeable {
/**
* @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);
}
@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/IERC1967Upgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.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 ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {
function __ERC1967Upgrade_init() internal onlyInitializing {
}
function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
}
// 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 StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlotUpgradeable.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) {
AddressUpgradeable.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 (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822ProxiableUpgradeable(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 StorageSlotUpgradeable.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");
StorageSlotUpgradeable.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 StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlotUpgradeable.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) {
AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), 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;
}
@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol
// 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 IBeaconUpgradeable {
/**
* @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);
}
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}
@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.0;
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";
/**
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
*
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*
* _Available since v4.1._
*/
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
function __UUPSUpgradeable_init() internal onlyInitializing {
}
function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
}
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
address private immutable __self = address(this);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
/**
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
* callable on the implementing contract but not through proxies.
*/
modifier notDelegated() {
require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
_;
}
/**
* @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
*
* 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. This is guaranteed by the `notDelegated` modifier.
*/
function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
return _IMPLEMENTATION_SLOT;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeTo(address newImplementation) public virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded in `data`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data, true);
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeTo} and {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal override onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) 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[50] private __gap;
}
@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// 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;
}
@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol
// 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 StorageSlotUpgradeable {
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
}
}
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// 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 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);
}
@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
@openzeppelin/contracts/utils/Address.sol
// 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 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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return 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);
}
}
}
asterizmprotocol/contracts/evm/AsterizmClientUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "./interfaces/IInitializerSender.sol";
import "./interfaces/IClientReceiverContract.sol";
import "./base/AsterizmEnv.sol";
import "./base/AsterizmWithdrawalUpgradeable.sol";
import "./libs/AddressLib.sol";
import "./libs/UintLib.sol";
import "./libs/AsterizmHashLib.sol";
abstract contract AsterizmClientUpgradeable is UUPSUpgradeable, IClientReceiverContract, AsterizmEnv, AsterizmWithdrawalUpgradeable {
using AddressLib for address;
using UintLib for uint;
using AsterizmHashLib for bytes;
/// Set initializer event
/// @param _initializerAddress address Initializer address
event SetInitializerEvent(address _initializerAddress);
/// Set external relay event
/// @param _externalRelayAddress address External relay address
event SetExternalRelayEvent(address _externalRelayAddress);
/// Set fee token event
/// @param _feeTokenAddress address Fee token address
event SetFeeTokenEvent(address _feeTokenAddress);
/// Set local chain id event
/// @param _localChainId uint64
event SetLocalChainIdEvent(uint64 _localChainId);
/// Initiate transfer event (for client server logic)
/// @param _dstChainId uint64 Destination chein ID
/// @param _dstAddress uint Destination address
/// @param _txId uint Transaction ID
/// @param _transferHash bytes32 Transfer hash
/// @param _payload bytes Payload
event InitiateTransferEvent(uint64 _dstChainId, uint _dstAddress, uint _txId, bytes32 _transferHash, bytes _payload);
/// Payload receive event (for client server logic)
/// @param _srcChainId uint64 Source chain ID
/// @param _srcAddress uint Source address
/// @param _txId uint Transfer ID
/// @param _transferHash bytes32 Transaction hash
event PayloadReceivedEvent(uint64 _srcChainId, uint _srcAddress, uint _txId, bytes32 _transferHash);
/// Add sender event
/// @param _sender address Sender address
event AddSenderEvent(address _sender);
/// Remove sender event
/// @param _sender address Sender address
event RemoveSenderEvent(address _sender);
/// Add trusted address event
/// @param _chainId uint64 Chain ID
/// @param _address uint Trusted address
event AddTrustedAddressEvent(uint64 _chainId, uint _address);
/// Remove trusted address event
/// @param _chainId uint64 Chain ID
/// @param _address uint Trusted address
event RemoveTrustedAddressEvent(uint64 _chainId, uint _address);
/// Set notify transfer sending result event
/// @param _flag bool Notify transfer sending result flag
event SetNotifyTransferSendingResultEvent(bool _flag);
/// Set disable hash validation flag event
/// @param _flag bool Use force order flag
event SetDisableHashValidationEvent(bool _flag);
/// Resend Asterizm transfer event
/// @param _transferHash bytes32 Transfer hash
/// @param _feeAmount uint Additional fee amount
event ResendAsterizmTransferEvent(bytes32 _transferHash, uint _feeAmount);
/// Transfer sending result notification event
/// @param _transferHash bytes32 Transfer hash
/// @param _statusCode uint8 Status code
event TransferSendingResultNotification(bytes32 indexed _transferHash, uint8 _statusCode);
struct AsterizmTransfer {
bool successReceive;
bool successExecute;
}
struct AsterizmChain {
bool exists;
uint trustedAddress;
uint8 chainType;
}
struct Sender {
bool exists;
}
IInitializerSender private initializerLib;
address private externalRelay;
mapping(uint64 => AsterizmChain) private trustedAddresses;
mapping(bytes32 => AsterizmTransfer) private inboundTransfers;
mapping(bytes32 => AsterizmTransfer) private outboundTransfers;
mapping(address => Sender) private senders;
bool private notifyTransferSendingResult;
bool private disableHashValidation;
uint private txId;
uint64 private localChainId;
IERC20 private feeToken;
/// Initializing function for upgradeable contracts (constructor)
/// @param _initializerLib IInitializerSender Initializer library address
/// @param _notifyTransferSendingResult bool Transfer sending result notification flag
/// @param _disableHashValidation bool Disable hash validation flag
function __AsterizmClientUpgradeable_init(IInitializerSender _initializerLib, bool _notifyTransferSendingResult, bool _disableHashValidation) initializer public {
__Ownable_init();
__ReentrancyGuard_init();
__UUPSUpgradeable_init();
_setInitializer(_initializerLib);
_setLocalChainId(initializerLib.getLocalChainId());
_setNotifyTransferSendingResult(_notifyTransferSendingResult);
_setDisableHashValidation(_disableHashValidation);
addSender(owner());
addTrustedAddress(localChainId, address(this).toUint());
}
/// Upgrade implementation address for UUPS logic
/// @param _newImplementation address New implementation address
function _authorizeUpgrade(address _newImplementation) internal onlyOwner override {}
/// Only initializer modifier
modifier onlyInitializer {
require(msg.sender == address(initializerLib), "AsterizmClient: only initializer");
_;
}
/// Only owner or initializer modifier
modifier onlyOwnerOrInitializer {
require(msg.sender == owner() || msg.sender == address(initializerLib), "AsterizmClient: only owner or initializer");
_;
}
/// Only sender modifier
modifier onlySender {
require(senders[msg.sender].exists, "AsterizmClient: only sender");
_;
}
/// Only sender or owner modifier
modifier onlySenderOrOwner {
require(msg.sender == owner() || senders[msg.sender].exists, "AsterizmClient: only sender or owner");
_;
}
/// Only trusted address modifier
/// You must add trusted addresses in production networks!
modifier onlyTrustedAddress(uint64 _chainId, uint _address) {
require(trustedAddresses[_chainId].trustedAddress == _address, "AsterizmClient: wrong source address");
_;
}
/// Only trusted trarnsfer modifier
/// Validate transfer hash on initializer
/// Use this modifier for validate transfer by hash
/// @param _transferHash bytes32 Transfer hash
modifier onlyTrustedTransfer(bytes32 _transferHash) {
require(initializerLib.validIncomeTransferHash(_transferHash), "AsterizmClient: transfer hash is invalid");
_;
}
/// Only received transfer modifier
/// @param _transferHash bytes32 Transfer hash
modifier onlyReceivedTransfer(bytes32 _transferHash) {
require(inboundTransfers[_transferHash].successReceive, "AsterizmClient: transfer not received");
_;
}
/// Only non-executed transfer modifier
/// @param _transferHash bytes32 Transfer hash
modifier onlyNonExecuted(bytes32 _transferHash) {
require(!inboundTransfers[_transferHash].successExecute, "AsterizmClient: transfer executed already");
_;
}
/// Only exists outbound transfer modifier
/// @param _transferHash bytes32 Transfer hash
modifier onlyExistsOutboundTransfer(bytes32 _transferHash) {
require(outboundTransfers[_transferHash].successReceive, "AsterizmClient: outbound transfer not exists");
_;
}
/// Only not executed outbound transfer modifier
/// @param _transferHash bytes32 Transfer hash
modifier onlyNotExecutedOutboundTransfer(bytes32 _transferHash) {
require(!outboundTransfers[_transferHash].successExecute, "AsterizmClient: outbound transfer executed already");
_;
}
/// Only executed outbound transfer modifier
/// @param _transferHash bytes32 Transfer hash
modifier onlyExecutedOutboundTransfer(bytes32 _transferHash) {
require(outboundTransfers[_transferHash].successExecute, "AsterizmClient: outbound transfer not executed");
_;
}
/// Only nvalid transfer hash modifier
/// @param _dto ClAsterizmReceiveRequestDto Transfer data
modifier onlyValidTransferHash(ClAsterizmReceiveRequestDto memory _dto) {
if (!disableHashValidation) {
require(
_validTransferHash(_dto.srcChainId, _dto.srcAddress, _dto.dstChainId, _dto.dstAddress, _dto.txId, _dto.payload, _dto.transferHash),
"AsterizmClient: transfer hash is invalid"
);
}
_;
}
/** Internal logic */
/// Set initizlizer library
/// _initializerLib IInitializerSender Initializer library
function _setInitializer(IInitializerSender _initializerLib) private {
initializerLib = _initializerLib;
emit SetInitializerEvent(address(_initializerLib));
}
/// Set local chain id library
/// _localChainId uint64
function _setLocalChainId(uint64 _localChainId) private {
localChainId = _localChainId;
emit SetLocalChainIdEvent(_localChainId);
}
/// Set notify transfer sending result
/// _flag bool Transfer sending result notification flag
function _setNotifyTransferSendingResult(bool _flag) private {
notifyTransferSendingResult = _flag;
emit SetNotifyTransferSendingResultEvent(_flag);
}
/// Set disable hash validation flag
/// _flag bool Disable hash validation flag
function _setDisableHashValidation(bool _flag) private {
disableHashValidation = _flag;
emit SetDisableHashValidationEvent(_flag);
}
/// Return chain type by id
/// @param _chainId uint64 Chain id
/// @return uint8 Chain type
function _getChainType(uint64 _chainId) internal view returns(uint8) {
return initializerLib.getChainType(_chainId);
}
/// Set external relay address (one-time initiation)
/// _externalRelay address External relay address
function setExternalRelay(address _externalRelay) public onlyOwner {
require(externalRelay == address(0), "AsterizmClient: relay changing not available");
externalRelay = _externalRelay;
emit SetExternalRelayEvent(_externalRelay);
}
/// Return external relay
/// @return address External relay address
function getExternalRelay() external view returns(address) {
return externalRelay;
}
/// Set external relay address (one-time initiation)
/// _feeToken IERC20 External relay address
function setFeeToken(IERC20 _feeToken) public onlyOwner {
feeToken = _feeToken;
emit SetFeeTokenEvent(address(_feeToken));
}
/// Return fee token
/// @return address Fee token address
function getFeeToken() external view returns(address) {
return address(feeToken);
}
/// Add sender
/// @param _sender address Sender address
function addSender(address _sender) public onlyOwner {
senders[_sender].exists = true;
emit AddSenderEvent(_sender);
}
/// Remove sender
/// @param _sender address Sender address
function removeSender(address _sender) public onlyOwner {
require(senders[_sender].exists, "AsterizmClient: sender not exists");
delete senders[_sender];
emit RemoveSenderEvent(_sender);
}
/// Add trusted address
/// @param _chainId uint64 Chain ID
/// @param _trustedAddress address Trusted address
function addTrustedAddress(uint64 _chainId, uint _trustedAddress) public onlyOwner {
trustedAddresses[_chainId].exists = true;
trustedAddresses[_chainId].trustedAddress = _trustedAddress;
trustedAddresses[_chainId].chainType = initializerLib.getChainType(_chainId);
emit AddTrustedAddressEvent(_chainId, _trustedAddress);
}
/// Add trusted addresses
/// @param _chainIds uint64[] Chain IDs
/// @param _trustedAddresses uint[] Trusted addresses
function addTrustedAddresses(uint64[] calldata _chainIds, uint[] calldata _trustedAddresses) external onlyOwner {
for (uint i = 0; i < _chainIds.length; i++) {
addTrustedAddress(_chainIds[i], _trustedAddresses[i]);
}
}
/// Remove trusted address
/// @param _chainId uint64 Chain ID
function removeTrustedAddress(uint64 _chainId) external onlyOwner {
require(trustedAddresses[_chainId].exists, "AsterizmClient: trusted address not found");
uint removingAddress = trustedAddresses[_chainId].trustedAddress;
delete trustedAddresses[_chainId];
emit RemoveTrustedAddressEvent(_chainId, removingAddress);
}
/// Build transfer hash
/// @param _srcChainId uint64 Chain ID
/// @param _srcAddress uint Address
/// @param _dstChainId uint64 Chain ID
/// @param _dstAddress uint Address
/// @param _txId uint Transaction ID
/// @param _payload bytes Payload
function _buildTransferHash(uint64 _srcChainId, uint _srcAddress, uint64 _dstChainId, uint _dstAddress, uint _txId, bytes memory _payload) internal view returns(bytes32) {
bytes memory encodeData = abi.encodePacked(_srcChainId, _srcAddress, _dstChainId, _dstAddress, _txId, _buildPackedPayload(_payload));
return _getChainType(_srcChainId) == _getChainType(_dstChainId) ? encodeData.buildSimpleHash() : encodeData.buildCrosschainHash();
}
/// Check is transfer hash valid
/// @param _srcChainId uint64 Chain ID
/// @param _srcAddress uint Address
/// @param _dstChainId uint64 Chain ID
/// @param _dstAddress uint Address
/// @param _txId uint Transaction ID
/// @param _payload bytes Packed payload
/// @param _transferHash bytes32 Transfer hash
function _validTransferHash(uint64 _srcChainId, uint _srcAddress, uint64 _dstChainId, uint _dstAddress, uint _txId, bytes memory _payload, bytes32 _transferHash) internal view returns(bool) {
return _buildTransferHash(_srcChainId, _srcAddress, _dstChainId, _dstAddress, _txId, _payload) == _transferHash;
}
/// Return txId
/// @return uint
function _getTxId() internal view returns(uint) {
return txId;
}
/// Return local chain id
/// @return uint64
function _getLocalChainId() internal view returns(uint64) {
return localChainId;
}
/// Return initializer address
/// @return address
function getInitializerAddress() external view returns(address) {
return address(initializerLib);
}
/// Return trusted src addresses
/// @param _chainId uint64 Chain id
/// @return AsterizmChain
function getTrustedAddresses(uint64 _chainId) external view returns(AsterizmChain memory) {
return trustedAddresses[_chainId];
}
/// Return disable hash validation flag
/// @return bool
function getDisableHashValidation() external view returns(bool) {
return disableHashValidation;
}
/// Return notify transfer sending result flag
/// @return bool
function getNotifyTransferSendingResult() external view returns(bool) {
return notifyTransferSendingResult;
}
/** Sending logic */
/// Initiate transfer event
/// Generate event for client server
/// @param _dstChainId uint64 Destination chain ID
/// @param _payload bytes Payload
function _initAsterizmTransferEvent(uint64 _dstChainId, bytes memory _payload) internal {
require(trustedAddresses[_dstChainId].exists, "AsterizmClient: trusted address not found");
uint id = txId++;
bytes32 transferHash = _buildTransferHash(_getLocalChainId(), address(this).toUint(), _dstChainId, trustedAddresses[_dstChainId].trustedAddress, id, _payload);
outboundTransfers[transferHash].successReceive = true;
emit InitiateTransferEvent(_dstChainId, trustedAddresses[_dstChainId].trustedAddress, id, transferHash, _payload);
}
/// External initiation transfer
/// This function needs for external initiating non-encoded payload transfer
/// @param _dstChainId uint64 Destination chain ID
/// @param _transferHash bytes32 Transfer hash
/// @param _txId uint Transaction ID
function initAsterizmTransfer(uint64 _dstChainId, uint _txId, bytes32 _transferHash) external payable onlySender nonReentrant {
require(trustedAddresses[_dstChainId].exists, "AsterizmClient: trusted address not found");
ClInitTransferRequestDto memory dto = _buildClInitTransferRequestDto(_dstChainId, trustedAddresses[_dstChainId].trustedAddress, _txId, _transferHash, msg.value);
_initAsterizmTransferPrivate(dto);
}
/// Private initiation transfer
/// This function needs for internal initiating non-encoded payload transfer
/// @param _dto ClInitTransferRequestDto Init transfer DTO
function _initAsterizmTransferPrivate(ClInitTransferRequestDto memory _dto) private
onlyExistsOutboundTransfer(_dto.transferHash)
onlyNotExecutedOutboundTransfer(_dto.transferHash)
{
require(address(this).balance >= _dto.feeAmount, "AsterizmClient: contract balance is not enough");
require(_dto.txId <= _getTxId(), "AsterizmClient: wrong txId param");
IzInitTransferRequestDto memory initDto = _buildIzInitTransferRequestDto(
_dto.dstChainId, _dto.dstAddress, _dto.txId, _dto.transferHash,
externalRelay, notifyTransferSendingResult, address(feeToken)
);
if (address(feeToken) != address(0)) {
uint feeAmountInToken = initializerLib.getFeeAmountInTokens(externalRelay, initDto);
if (feeAmountInToken > 0) {
require(feeToken.balanceOf(address(this)) >= feeAmountInToken, "AsterizmClient: fee token balance is not enough");
feeToken.approve(address(initializerLib), feeAmountInToken);
}
}
initializerLib.initTransfer{value: _dto.feeAmount} (initDto);
outboundTransfers[_dto.transferHash].successExecute = true;
}
/// Resend failed by fee amount transfer
/// @param _transferHash bytes32 Transfer hash
function resendAsterizmTransfer(bytes32 _transferHash) external payable
onlyOwner
onlyExistsOutboundTransfer(_transferHash)
onlyExecutedOutboundTransfer(_transferHash)
{
initializerLib.resendTransfer{value: msg.value}(_transferHash, externalRelay);
emit ResendAsterizmTransferEvent(_transferHash, msg.value);
}
/// Transfer sending result notification
/// @param _transferHash bytes32 Transfer hash
/// @param _statusCode uint8 Status code
function transferSendingResultNotification(bytes32 _transferHash, uint8 _statusCode) external onlyInitializer onlyExecutedOutboundTransfer(_transferHash) {
if (notifyTransferSendingResult) {
emit TransferSendingResultNotification(_transferHash, _statusCode);
}
}
/** Receiving logic */
/// Receive payload from initializer
/// @param _dto IzAsterizmReceiveRequestDto Method DTO
function asterizmIzReceive(IzAsterizmReceiveRequestDto calldata _dto) external onlyInitializer {
_asterizmReceiveExternal(_dto);
}
/// Receive external payload
/// @param _dto IzAsterizmReceiveRequestDto Method DTO
function _asterizmReceiveExternal(IzAsterizmReceiveRequestDto calldata _dto) private
onlyOwnerOrInitializer
onlyTrustedAddress(_dto.srcChainId, _dto.srcAddress)
onlyNonExecuted(_dto.transferHash)
{
inboundTransfers[_dto.transferHash].successReceive = true;
emit PayloadReceivedEvent(_dto.srcChainId, _dto.srcAddress, _dto.txId, _dto.transferHash);
}
/// Receive payload from client server
/// @param _srcChainId uint64 Source chain ID
/// @param _srcAddress uint Source address
/// @param _txId uint Transaction ID
/// @param _transferHash bytes32 Transfer hash
/// @param _payload bytes Payload
function asterizmClReceive(uint64 _srcChainId, uint _srcAddress, uint _txId, bytes32 _transferHash, bytes calldata _payload) external onlySender nonReentrant {
ClAsterizmReceiveRequestDto memory dto = _buildClAsterizmReceiveRequestDto(_srcChainId, _srcAddress, localChainId, address(this).toUint(), _txId, _transferHash, _payload);
_asterizmReceiveInternal(dto);
}
/// Receive non-encoded payload for internal usage
/// @param _dto ClAsterizmReceiveRequestDto Method DTO
function _asterizmReceiveInternal(ClAsterizmReceiveRequestDto memory _dto) private
onlyOwnerOrInitializer
onlyReceivedTransfer(_dto.transferHash)
onlyTrustedAddress(_dto.srcChainId, _dto.srcAddress)
onlyTrustedTransfer(_dto.transferHash)
onlyNonExecuted(_dto.transferHash)
onlyValidTransferHash(_dto)
{
_asterizmReceive(_dto);
inboundTransfers[_dto.transferHash].successExecute = true;
}
/// Receive payload
/// You must realize this function if you want to transfer payload
/// If disableHashValidation = true you must validate transferHash with _validTransferHash() method for more security!
/// @param _dto ClAsterizmReceiveRequestDto Method DTO
function _asterizmReceive(ClAsterizmReceiveRequestDto memory _dto) internal virtual {}
/// Build packed payload (abi.encodePacked() result)
/// @param _payload bytes Default payload (abi.encode() result)
/// @return bytes Packed payload (abi.encodePacked() result)
function _buildPackedPayload(bytes memory _payload) internal view virtual returns(bytes memory) {}
}
asterizmprotocol/contracts/evm/base/AsterizmEnv.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "../interfaces/IAsterizmEnv.sol";
abstract contract AsterizmEnv is IAsterizmEnv {
/// Build initializer receive payload request DTO
/// @param _srcChainId uint64 Source chain ID
/// @param _srcAddress uint Source address
/// @param _dstChainId uint64 Destination chain ID
/// @param _dstAddress uint Destination address
/// @return BaseTransferDirectionDto
function _buildBaseTransferDirectionDto(
uint64 _srcChainId, uint _srcAddress,
uint64 _dstChainId, uint _dstAddress
) internal pure returns(BaseTransferDirectionDto memory) {
BaseTransferDirectionDto memory dto;
dto.srcChainId = _srcChainId;
dto.srcAddress = _srcAddress;
dto.dstChainId = _dstChainId;
dto.dstAddress = _dstAddress;
return dto;
}
/// Build client initiation transfer request DTO
/// @param _dstChainId uint64 Destination chain ID
/// @param _dstAddress uint Destination address
/// @param _transferHash bytes32 Transfer hash
/// @param _feeAmount uint Fee amount
/// @param _txId uint Transaction ID
/// @return ClInitTransferRequestDto
function _buildClInitTransferRequestDto(uint64 _dstChainId, uint _dstAddress, uint _txId, bytes32 _transferHash, uint _feeAmount) internal pure returns(ClInitTransferRequestDto memory) {
ClInitTransferRequestDto memory dto;
dto.dstChainId = _dstChainId;
dto.dstAddress = _dstAddress;
dto.transferHash = _transferHash;
dto.feeAmount = _feeAmount;
dto.txId = _txId;
return dto;
}
/// Build iuntrnal client initiation transfer request DTO
/// @param _dstChainId uint64 Destination chain ID
/// @param _dstAddress uint Destination address
/// @param _feeAmount uint Fee amount
/// @param _payload bytes Payload
/// @return InternalClInitTransferRequestDto
function _buildInternalClInitTransferRequestDto(uint64 _dstChainId, uint _dstAddress, uint _feeAmount, bytes memory _payload) internal pure returns(InternalClInitTransferRequestDto memory) {
InternalClInitTransferRequestDto memory dto;
dto.dstChainId = _dstChainId;
dto.dstAddress = _dstAddress;
dto.feeAmount = _feeAmount;
dto.payload = _payload;
return dto;
}
/// Build translator send message request DTO
/// @param _srcAddress uint Source address
/// @param _dstChainId uint64 Destination chain ID
/// @param _dstAddress uint Destination address
/// @param _txId uint Transaction ID
/// @param _transferHash bytes32 Transfer hash
/// @param _transferResultNotifyFlag bool Transfer result notification flag
/// @return TrSendMessageRequestDto
function _buildTrSendMessageRequestDto(
uint _srcAddress, uint64 _dstChainId, uint _dstAddress,
uint _txId, bytes32 _transferHash, bool _transferResultNotifyFlag
) internal pure returns(TrSendMessageRequestDto memory) {
TrSendMessageRequestDto memory dto;
dto.srcAddress = _srcAddress;
dto.dstChainId = _dstChainId;
dto.dstAddress = _dstAddress;
dto.txId = _txId;
dto.transferHash = _transferHash;
dto.transferResultNotifyFlag = _transferResultNotifyFlag;
return dto;
}
/// Build translator transfer message request DTO
/// @param _gasLimit uint Gas limit
/// @param _payload bytes Payload
/// @return TrTransferMessageRequestDto
function _buildTrTransferMessageRequestDto(uint _gasLimit, bytes memory _payload) internal pure returns(TrTransferMessageRequestDto memory) {
TrTransferMessageRequestDto memory dto;
dto.gasLimit = _gasLimit;
dto.payload = _payload;
return dto;
}
/// Build initializer init transfer request DTO
/// @param _dstChainId uint64 Destination chain ID
/// @param _dstAddress uint Destination address
/// @param _txId uint Transaction ID
/// @param _transferHash bytes32 Transfer hash
/// @param _relay address External relay
/// @param _transferResultNotifyFlag bool Transfer result notification flag
/// @param _feeToken address Token address for paying relay fee (Chainlink for example)
/// @return IzIninTransferRequestDto
function _buildIzInitTransferRequestDto(
uint64 _dstChainId, uint _dstAddress, uint _txId, bytes32 _transferHash, address _relay,
bool _transferResultNotifyFlag, address _feeToken
) internal pure returns(IzInitTransferRequestDto memory) {
IzInitTransferRequestDto memory dto;
dto.dstChainId = _dstChainId;
dto.dstAddress = _dstAddress;
dto.txId = _txId;
dto.transferHash = _transferHash;
dto.relay = _relay;
dto.transferResultNotifyFlag = _transferResultNotifyFlag;
dto.feeToken = _feeToken;
return dto;
}
/// Build initializer asterizm receive request DTO
/// @param _srcChainId uint64 Source chain ID
/// @param _srcAddress uint Source address
/// @param _dstChainId uint64 Destination chain ID
/// @param _dstAddress uint Destination address
/// @param _txId uint Transaction ID
/// @param _transferHash bytes32 Transfer hash
/// @return IzAsterizmReceiveRequestDto
function _buildIzAsterizmReceiveRequestDto(
uint64 _srcChainId, uint _srcAddress, uint64 _dstChainId,
uint _dstAddress, uint _txId, bytes32 _transferHash
) internal pure returns(IzAsterizmReceiveRequestDto memory) {
IzAsterizmReceiveRequestDto memory dto;
dto.srcChainId = _srcChainId;
dto.srcAddress = _srcAddress;
dto.dstChainId = _dstChainId;
dto.dstAddress = _dstAddress;
dto.txId = _txId;
dto.transferHash = _transferHash;
return dto;
}
/// Build client asterizm receive request DTO
/// @param _srcChainId uint64 Source chain ID
/// @param _srcAddress uint Source address
/// @param _dstChainId uint64 Destination chain ID
/// @param _dstAddress uint Destination address
/// @param _txId uint Transaction ID
/// @param _transferHash bytes32 Transfer hash
/// @param _payload bytes Transfer payload
/// @return ClAsterizmReceiveRequestDto
function _buildClAsterizmReceiveRequestDto(
uint64 _srcChainId, uint _srcAddress, uint64 _dstChainId, uint _dstAddress,
uint _txId, bytes32 _transferHash, bytes memory _payload
) internal pure returns(ClAsterizmReceiveRequestDto memory) {
ClAsterizmReceiveRequestDto memory dto;
dto.srcChainId = _srcChainId;
dto.srcAddress = _srcAddress;
dto.dstChainId = _dstChainId;
dto.dstAddress = _dstAddress;
dto.txId = _txId;
dto.transferHash = _transferHash;
dto.payload = _payload;
return dto;
}
/// Build initializer receive payload request DTO
/// @param _baseTransferDirectioDto BaseTransferDirectionDto Base transfer direction DTO
/// @param _gasLimit uint Gas limit
/// @param _txId uint Transaction ID
/// @param _transferHash bytes32 Transfer hash
/// @return IzReceivePayloadRequestDto
function _buildIzReceivePayloadRequestDto(
BaseTransferDirectionDto memory _baseTransferDirectioDto,
uint _gasLimit, uint _txId, bytes32 _transferHash
) internal pure returns(IzReceivePayloadRequestDto memory) {
IzReceivePayloadRequestDto memory dto;
dto.srcChainId = _baseTransferDirectioDto.srcChainId;
dto.srcAddress = _baseTransferDirectioDto.srcAddress;
dto.dstChainId = _baseTransferDirectioDto.dstChainId;
dto.dstAddress = _baseTransferDirectioDto.dstAddress;
dto.gasLimit = _gasLimit;
dto.txId = _txId;
dto.transferHash = _transferHash;
return dto;
}
/// Build initializer retry payload request DTO
/// @param _srcChainId uint64 Source chain ID
/// @param _srcAddress uint Source address
/// @param _dstChainId uint64 Destination chain ID
/// @param _dstAddress uint Destination address
/// @param _nonce uint Nonce
/// @param _gasLimit uint Gas limit
/// @param _forceOrder bool Force order flag
/// @param _transferHash bytes32 Transfer hash
/// @param _payload bytes Payload
/// @return IzRetryPayloadRequestDto
function _buildIzRetryPayloadRequestDto(
uint64 _srcChainId, uint _srcAddress, uint64 _dstChainId, uint _dstAddress,
uint _nonce, uint _gasLimit, bool _forceOrder, bytes32 _transferHash, bytes calldata _payload
) internal pure returns(IzRetryPayloadRequestDto memory) {
IzRetryPayloadRequestDto memory dto;
dto.srcChainId = _srcChainId;
dto.srcAddress = _srcAddress;
dto.dstChainId = _dstChainId;
dto.dstAddress = _dstAddress;
dto.nonce = _nonce;
dto.gasLimit = _gasLimit;
dto.forceOrder = _forceOrder;
dto.transferHash = _transferHash;
dto.payload = _payload;
return dto;
}
}
asterizmprotocol/contracts/evm/base/AsterizmWithdrawalUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/// Asterizm withdrawal contract
abstract contract AsterizmWithdrawalUpgradeable is OwnableUpgradeable, ReentrancyGuardUpgradeable {
using SafeERC20 for IERC20;
/// Withdrawal coins event
/// @param _targetAddress address Target address
/// @param _amount uint Amount
event WithdrawCoinsEvent(address _targetAddress, uint _amount);
/// Withdrawal tokens event
/// @param _tokenAddress address Token address
/// @param _targetAddress address Target address
/// @param _amount uint Amount
event WithdrawTokensEvent(address _tokenAddress, address _targetAddress, uint _amount);
receive() external payable {}
fallback() external payable {}
/// Withdraw coins
/// @param _target address Target address
/// @param _amount uint Amount
function withdrawCoins(address _target, uint _amount) external onlyOwner nonReentrant {
require(address(this).balance >= _amount, "AsterizmWithdrawal: coins balance not enough");
(bool success, ) = _target.call{value: _amount}("");
require(success, "AsterizmWithdrawal: transfer error");
emit WithdrawCoinsEvent(_target, _amount);
}
/// Withdraw tokens
/// @param _token IERC20 Token address
/// @param _target address Target address
/// @param _amount uint Amount
function withdrawTokens(IERC20 _token, address _target, uint _amount) external onlyOwner nonReentrant {
require(_token.balanceOf(address(this)) >= _amount, "AsterizmWithdrawal: coins balance not enough");
_token.safeTransfer(_target, _amount);
emit WithdrawTokensEvent(address(_token), _target, _amount);
}
}
asterizmprotocol/contracts/evm/interfaces/IAsterizmEnv.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
interface IAsterizmEnv {
/// Base transfer direction DTO
/// @param srcChainId uint64 Source chain ID
/// @param srcAddress uint Source address
/// @param dstChainId uint64 Destination chain ID
/// @param dstAddress uint Destination address
struct BaseTransferDirectionDto {
uint64 srcChainId;
uint srcAddress;
uint64 dstChainId;
uint dstAddress;
}
/// Client initiation transfer request DTO
/// @param dstChainId uint64 Destination chain ID
/// @param dstAddress uint Destination address
/// @param feeAmount uint Fee amount
/// @param txId uint Transaction ID
/// @param transferHash bytes32 Transfer hash
/// @param payload bytes Payload
struct ClInitTransferRequestDto {
uint64 dstChainId;
uint dstAddress;
uint feeAmount;
uint txId;
bytes32 transferHash;
}
/// Internal client initiation transfer request DTO
/// @param dstChainId uint64 Destination chain ID
/// @param dstAddress uint Destination address
/// @param feeAmount uint Fee amount
/// @param txId uint Transaction ID
/// @param transferHash bytes32 Transfer hash
/// @param payload bytes Payload
struct InternalClInitTransferRequestDto {
uint64 dstChainId;
uint dstAddress;
uint feeAmount;
bytes payload;
}
/// Initializer asterizm receive request DTO
/// @param srcChainId uint64 Source chain ID
/// @param srcAddress uint Source address
/// @param dstChainId uint64 Destination chain ID
/// @param dstAddress uint Destination address
/// @param nonce uint Nonce
/// @param txId uint Transaction ID
/// @param transferHash bytes32 Transfer hash
struct IzAsterizmReceiveRequestDto {
uint64 srcChainId;
uint srcAddress;
uint64 dstChainId;
uint dstAddress;
uint txId;
bytes32 transferHash;
}
/// Client asterizm receive request DTO
/// @param srcChainId uint64 Source chain ID
/// @param srcAddress uint Source address
/// @param dstChainId uint64 Destination chain ID
/// @param dstAddress uint Destination address
/// @param txId uint Transaction ID
/// @param transferHash bytes32 Transfer hash
/// @param payload bytes Transfer payload
struct ClAsterizmReceiveRequestDto {
uint64 srcChainId;
uint srcAddress;
uint64 dstChainId;
uint dstAddress;
uint txId;
bytes32 transferHash;
bytes payload;
}
/// Translator send message request DTO
/// @param srcAddress uint Source address
/// @param dstChainId uint64 Destination chain ID
/// @param dstAddress uint Destination address
/// @param txId uint Transaction ID
/// @param transferHash bytes32 Transfer hash
/// @param transferResultNotifyFlag bool Transfer result notification flag
struct TrSendMessageRequestDto {
uint srcAddress;
uint64 dstChainId;
uint dstAddress;
uint txId;
bytes32 transferHash;
bool transferResultNotifyFlag;
}
/// Translator transfer message request DTO
/// @param gasLimit uint Gas limit
/// @param payload bytes Payload
struct TrTransferMessageRequestDto {
uint gasLimit;
bytes payload;
}
/// Initializator initiate transfer request DTO
/// @param dstChainId uint64 Destination chain ID
/// @param dstAddress uint Destination address
/// @param transferHash bytes32 Transfer hash
/// @param txId uint Transaction ID
/// @param relay address Relay address
/// @param transferResultNotifyFlag bool Transfer result notification flag
/// @param feeToken address Token address for paying relay fee (Chainlink for example)
struct IzInitTransferRequestDto {
uint64 dstChainId;
uint dstAddress;
bytes32 transferHash;
uint txId;
address relay;
bool transferResultNotifyFlag;
address feeToken;
}
/// Initializator receive payload request DTO
/// @param srcChainId uint64 Source chain ID
/// @param srcAddress uint Source address
/// @param dstChainId uint64 Destination chain ID
/// @param dstAddress uint Destination address
/// @param gasLimit uint Gas limit
/// @param txId uint Transaction ID
/// @param transferHash bytes32 Transfer hash
struct IzReceivePayloadRequestDto {
uint64 srcChainId;
uint srcAddress;
uint64 dstChainId;
uint dstAddress;
uint gasLimit;
uint txId;
bytes32 transferHash;
}
/// Initializator retry payload request DTO
/// @param srcChainId uint64 Source chain ID
/// @param srcAddress uint Source address
/// @param dstChainId uint64 Destination chain ID
/// @param dstAddress uint Destination address
/// @param nonce uint Nonce
/// @param gasLimit uint Gas limit
/// @param forceOrder bool Force order flag
/// @param isEncrypted bool User encryption flag
/// @param transferHash bytes32 Transfer hash
/// @param payload bytes Payload
struct IzRetryPayloadRequestDto {
uint64 srcChainId;
uint srcAddress;
uint64 dstChainId;
uint dstAddress;
uint nonce;
uint gasLimit;
bool forceOrder;
bool useEncryption;
bytes32 transferHash;
bytes payload;
}
}
asterizmprotocol/contracts/evm/interfaces/IClientReceiverContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./IAsterizmEnv.sol";
interface IClientReceiverContract is IAsterizmEnv {
/// Receive payload from initializer
/// @param _dto IzAsterizmReceiveRequestDto Method DTO
function asterizmIzReceive(IzAsterizmReceiveRequestDto calldata _dto) external;
/// Receive payload from client server
/// @param _srcChainId uint64 Source chain ID
/// @param _srcAddress uint Source address
/// @param _txId uint Transaction ID
/// @param _transferHash bytes32 Transfer hash
/// @param _payload bytes Payload
function asterizmClReceive(uint64 _srcChainId, uint _srcAddress, uint _txId, bytes32 _transferHash, bytes calldata _payload) external;
/// Transfer sending result notification
/// @param _transferHash bytes32 Transfer hash
/// @param _statusCode uint8 Status code
function transferSendingResultNotification(bytes32 _transferHash, uint8 _statusCode) external;
}
asterizmprotocol/contracts/evm/interfaces/IInitializerSender.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./IAsterizmEnv.sol";
/// Initializer sender interface
interface IInitializerSender is IAsterizmEnv {
/// Initiate asterizm transfer
/// @param _dto IzInitTransferRequestDto Method DTO
function initTransfer(IzInitTransferRequestDto calldata _dto) external payable;
/// Validate income transfer by hash
/// @param _transferHash bytes32
function validIncomeTransferHash(bytes32 _transferHash) external view returns(bool);
/// Return local chain id
/// @return uint64
function getLocalChainId() external view returns(uint64);
/// Return chain type by id
/// @param _chainId Chain id
/// @return uint8 Chain type
function getChainType(uint64 _chainId) external view returns(uint8);
/// Resend failed by fee amount transfer
/// @param _transferHash bytes32 Transfer hash
/// @param _relay address Relay address
function resendTransfer(bytes32 _transferHash, address _relay) external payable;
/// Return fee amount in tokens
/// @param _relayAddress Relay address
/// @param _dto IzInitTransferV2RequestDto Method DTO
/// @return uint Token fee amount
function getFeeAmountInTokens(address _relayAddress, IzInitTransferRequestDto calldata _dto) external view returns(uint);
}
asterizmprotocol/contracts/evm/libs/AddressLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
library AddressLib {
/// Convert address to uint (uint256) format
/// @param _address address
/// @return uint
function toUint(address _address) internal pure returns(uint) {
return uint(uint160(_address));
}
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
asterizmprotocol/contracts/evm/libs/AsterizmHashLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
library AsterizmHashLib {
/// Build asterizm simple hash (used for transfer within same network types)
/// @param _packed bytes
/// @return bytes32
function buildSimpleHash(bytes memory _packed) internal pure returns(bytes32) {
return sha256(_packed);
}
/// Build asterizm crosschain hash (used for transfer within different network types)
/// @param _packed bytes
/// @return bytes32
function buildCrosschainHash(bytes memory _packed) internal pure returns(bytes32) {
bytes memory staticChunk = new bytes(112);
for (uint i = 0; i < 112; i++) {
staticChunk[i] = bytes(_packed)[i];
}
bytes memory payloadChunk = new bytes(_packed.length - staticChunk.length);
for (uint i = staticChunk.length; i < _packed.length; i++) {
payloadChunk[i - staticChunk.length] = bytes(_packed)[i];
}
uint length = payloadChunk.length;
uint8 chunkLength = 127;
bytes32 hash = sha256(staticChunk);
for (uint i = 0; i <= length / chunkLength; i++) {
uint from = chunkLength * i;
uint to = from + chunkLength <= length ? from + chunkLength : length;
bytes memory chunk = new bytes(to - from);
for(uint j = from; j < to; j++){
chunk[j - from] = bytes(payloadChunk)[j];
}
hash = sha256(abi.encode(hash, sha256(chunk)));
}
return hash;
}
}
asterizmprotocol/contracts/evm/libs/UintLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
library UintLib {
/// Convert uint (uint256) to address format
/// @param _val uint
/// @return uint
function toAddress(uint _val) internal pure returns(address) {
return address(uint160(_val));
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["evm.bytecode","evm.deployedBytecode","devdoc","userdoc","metadata","abi"]}},"optimizer":{"runs":1000,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"event","name":"AddSenderEvent","inputs":[{"type":"address","name":"_sender","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"AddStableCoinEvent","inputs":[{"type":"address","name":"_address","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"AddTrustedAddressEvent","inputs":[{"type":"uint64","name":"_chainId","internalType":"uint64","indexed":false},{"type":"uint256","name":"_address","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"CoinsReceivedEvent","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"_transactionId","internalType":"uint256","indexed":false},{"type":"address","name":"_dstAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"GasSendEvent","inputs":[{"type":"uint64","name":"_dstChainId","internalType":"uint64","indexed":false},{"type":"uint256","name":"_transactionId","internalType":"uint256","indexed":false},{"type":"bytes","name":"_payload","internalType":"bytes","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"InitiateTransferEvent","inputs":[{"type":"uint64","name":"_dstChainId","internalType":"uint64","indexed":false},{"type":"uint256","name":"_dstAddress","internalType":"uint256","indexed":false},{"type":"uint256","name":"_txId","internalType":"uint256","indexed":false},{"type":"bytes32","name":"_transferHash","internalType":"bytes32","indexed":false},{"type":"bytes","name":"_payload","internalType":"bytes","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PayloadReceivedEvent","inputs":[{"type":"uint64","name":"_srcChainId","internalType":"uint64","indexed":false},{"type":"uint256","name":"_srcAddress","internalType":"uint256","indexed":false},{"type":"uint256","name":"_txId","internalType":"uint256","indexed":false},{"type":"bytes32","name":"_transferHash","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"RemoveSenderEvent","inputs":[{"type":"address","name":"_sender","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RemoveStableCoinEvent","inputs":[{"type":"address","name":"_address","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RemoveTrustedAddressEvent","inputs":[{"type":"uint64","name":"_chainId","internalType":"uint64","indexed":false},{"type":"uint256","name":"_address","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ResendAsterizmTransferEvent","inputs":[{"type":"bytes32","name":"_transferHash","internalType":"bytes32","indexed":false},{"type":"uint256","name":"_feeAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SetDisableHashValidationEvent","inputs":[{"type":"bool","name":"_flag","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"SetExternalRelayEvent","inputs":[{"type":"address","name":"_externalRelayAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"SetFeeTokenEvent","inputs":[{"type":"address","name":"_feeTokenAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"SetInitializerEvent","inputs":[{"type":"address","name":"_initializerAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"SetLocalChainIdEvent","inputs":[{"type":"uint64","name":"_localChainId","internalType":"uint64","indexed":false}],"anonymous":false},{"type":"event","name":"SetMaxUsdAmountEvent","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SetMaxUsdAmountPerChainEvent","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SetMinUsdAmountEvent","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SetMinUsdAmountPerChainEvent","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SetNotifyTransferSendingResultEvent","inputs":[{"type":"bool","name":"_flag","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"TransferSendingResultNotification","inputs":[{"type":"bytes32","name":"_transferHash","internalType":"bytes32","indexed":true},{"type":"uint8","name":"_statusCode","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"WithdrawCoinsEvent","inputs":[{"type":"address","name":"_targetAddress","internalType":"address","indexed":false},{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"WithdrawTokensEvent","inputs":[{"type":"address","name":"_tokenAddress","internalType":"address","indexed":false},{"type":"address","name":"_targetAddress","internalType":"address","indexed":false},{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"fallback","stateMutability":"payable"},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"__AsterizmClientUpgradeable_init","inputs":[{"type":"address","name":"_initializerLib","internalType":"contract IInitializerSender"},{"type":"bool","name":"_notifyTransferSendingResult","internalType":"bool"},{"type":"bool","name":"_disableHashValidation","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addSender","inputs":[{"type":"address","name":"_sender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addStableCoin","inputs":[{"type":"address","name":"_tokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addTrustedAddress","inputs":[{"type":"uint64","name":"_chainId","internalType":"uint64"},{"type":"uint256","name":"_trustedAddress","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addTrustedAddresses","inputs":[{"type":"uint64[]","name":"_chainIds","internalType":"uint64[]"},{"type":"uint256[]","name":"_trustedAddresses","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"asterizmClReceive","inputs":[{"type":"uint64","name":"_srcChainId","internalType":"uint64"},{"type":"uint256","name":"_srcAddress","internalType":"uint256"},{"type":"uint256","name":"_txId","internalType":"uint256"},{"type":"bytes32","name":"_transferHash","internalType":"bytes32"},{"type":"bytes","name":"_payload","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"asterizmIzReceive","inputs":[{"type":"tuple","name":"_dto","internalType":"struct IAsterizmEnv.IzAsterizmReceiveRequestDto","components":[{"type":"uint64","name":"srcChainId","internalType":"uint64"},{"type":"uint256","name":"srcAddress","internalType":"uint256"},{"type":"uint64","name":"dstChainId","internalType":"uint64"},{"type":"uint256","name":"dstAddress","internalType":"uint256"},{"type":"uint256","name":"txId","internalType":"uint256"},{"type":"bytes32","name":"transferHash","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"getDisableHashValidation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getExternalRelay","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getFeeToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getInitializerAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"getNotifyTransferSendingResult","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct AsterizmClientUpgradeable.AsterizmChain","components":[{"type":"bool","name":"exists","internalType":"bool"},{"type":"uint256","name":"trustedAddress","internalType":"uint256"},{"type":"uint8","name":"chainType","internalType":"uint8"}]}],"name":"getTrustedAddresses","inputs":[{"type":"uint64","name":"_chainId","internalType":"uint64"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"initAsterizmTransfer","inputs":[{"type":"uint64","name":"_dstChainId","internalType":"uint64"},{"type":"uint256","name":"_txId","internalType":"uint256"},{"type":"bytes32","name":"_transferHash","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_initializerLib","internalType":"contract IInitializerSender"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxUsdAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxUsdAmountPerChain","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minUsdAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minUsdAmountPerChain","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"proxiableUUID","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeSender","inputs":[{"type":"address","name":"_sender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeStableCoin","inputs":[{"type":"address","name":"_tokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeTrustedAddress","inputs":[{"type":"uint64","name":"_chainId","internalType":"uint64"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"resendAsterizmTransfer","inputs":[{"type":"bytes32","name":"_transferHash","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"sendGas","inputs":[{"type":"uint64[]","name":"_chainIds","internalType":"uint64[]"},{"type":"uint256[]","name":"_amounts","internalType":"uint256[]"},{"type":"uint256[]","name":"_receivers","internalType":"uint256[]"},{"type":"address","name":"_token","internalType":"contract IERC20"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setExternalRelay","inputs":[{"type":"address","name":"_externalRelay","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeToken","inputs":[{"type":"address","name":"_feeToken","internalType":"contract IERC20"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxUsdAmount","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxUsdAmountPerChain","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinUsdAmount","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinUsdAmountPerChain","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"exists","internalType":"bool"},{"type":"uint8","name":"decimals","internalType":"uint8"}],"name":"stableCoins","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferSendingResultNotification","inputs":[{"type":"bytes32","name":"_transferHash","internalType":"bytes32"},{"type":"uint8","name":"_statusCode","internalType":"uint8"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawCoins","inputs":[{"type":"address","name":"_target","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawTokens","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20"},{"type":"address","name":"_target","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x60a06040523060805234801561001457600080fd5b5060805161515b61004c6000396000818161113d015281816111c2015281816112b80152818161133d015261157f015261515b6000f3fe60806040526004361061028e5760003560e01c80638da5cb5b11610156578063c64db73d116100bf578063e26814d811610079578063e5a8553d11610061578063e5a8553d146107c6578063f2fde38b146107e6578063f825c0ba1461080657005b8063e26814d814610786578063e46f22c3146107a657005b8063ce8e4830116100a7578063ce8e483014610731578063df01efef14610748578063e0497f141461076857005b8063c64db73d146106e6578063ca709a251461070657005b8063b31e895911610110578063b60ad43f116100f8578063b60ad43f14610688578063b697f531146106a6578063c4d66de8146106c657005b8063b31e895914610648578063b3c1f5d81461066857005b80639c213e8c1161013e5780639c213e8c146105e8578063a973611714610608578063b2f876431461062857005b80638da5cb5b146105295780638febf6ae1461054757005b80634f2d648f116101f8578063643c481f116101b2578063715018a61161019a578063715018a6146104dd5780637f438e60146104f25780638ac626b71461050957005b8063643c481f146104af5780636fe5e416146104c657005b80635215e9b6116101e05780635215e9b61461044c57806352d1902d1461046c5780635e35359e1461048f57005b80634f2d648f146103d957806351bb5dff1461042c57005b80631c43cf761161024957806331b8cd421161023157806331b8cd42146103815780633659cfe6146103a65780634f1ef286146103c657005b80631c43cf761461034157806322c6645f1461036157005b8063079c060711610277578063079c0607146102d75780630de4f91d1461030e57806315cce2241461032157005b8062d51ce8146102975780630360cca3146102b757005b3661029557005b005b3480156102a357600080fd5b506102956102b2366004614655565b610819565b3480156102c357600080fd5b506102956102d2366004614774565b61085e565b3480156102e357600080fd5b5060fb546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b61029561031c366004614655565b610dc4565b34801561032d57600080fd5b5061029561033c36600461486b565b610f96565b34801561034d57600080fd5b5061029561035c366004614655565b611013565b34801561036d57600080fd5b5061029561037c36600461486b565b611051565b34801561038d57600080fd5b506101015460ff165b6040519015158152602001610305565b3480156103b257600080fd5b506102956103c136600461486b565b611133565b6102956103d4366004614888565b6112ae565b3480156103e557600080fd5b506104136103f436600461486b565b6101046020526000908152604090205460ff8082169161010090041682565b60408051921515835260ff909116602083015201610305565b34801561043857600080fd5b5061029561044736600461486b565b61141a565b34801561045857600080fd5b50610295610467366004614930565b611475565b34801561047857600080fd5b50610481611572565b604051908152602001610305565b34801561049b57600080fd5b506102956104aa36600461494d565b611637565b3480156104bb57600080fd5b506104816101075481565b3480156104d257600080fd5b506104816101065481565b3480156104e957600080fd5b50610295611782565b3480156104fe57600080fd5b506104816101085481565b34801561051557600080fd5b5061029561052436600461498e565b611796565b34801561053557600080fd5b506097546001600160a01b03166102f1565b34801561055357600080fd5b506105c1610562366004614930565b60408051606080820183526000808352602080840182905292840181905267ffffffffffffffff94909416845260fd82529282902082519384018352805460ff9081161515855260018201549285019290925260020154169082015290565b60408051825115158152602080840151908201529181015160ff1690820152606001610305565b3480156105f457600080fd5b50610295610603366004614a3d565b611874565b34801561061457600080fd5b50610295610623366004614655565b611a7c565b34801561063457600080fd5b5061029561064336600461486b565b611aba565b34801561065457600080fd5b50610295610663366004614ad4565b611ba3565b34801561067457600080fd5b5061029561068336600461486b565b611c17565b34801561069457600080fd5b5060fc546001600160a01b03166102f1565b3480156106b257600080fd5b506102956106c136600461486b565b611dcb565b3480156106d257600080fd5b506102956106e136600461486b565b611e28565b3480156106f257600080fd5b50610295610701366004614b40565b611f46565b34801561071257600080fd5b50610103546801000000000000000090046001600160a01b03166102f1565b34801561073d57600080fd5b506104816101055481565b34801561075457600080fd5b50610295610763366004614655565b611fa9565b34801561077457600080fd5b5061010154610100900460ff16610396565b34801561079257600080fd5b506102956107a1366004614b58565b611fe7565b3480156107b257600080fd5b506102956107c1366004614b93565b612172565b3480156107d257600080fd5b506102956107e1366004614bc3565b6122a2565b3480156107f257600080fd5b5061029561080136600461486b565b6123a7565b610295610814366004614be1565b612434565b610821612592565b6101078190556040518181527fb913cbf19542b9cf78a2f99f0ad5cfd9da57e41b4c1e3af6fc12d4fd2e5cf261906020015b60405180910390a150565b6108666125ec565b6001600160a01b03811660009081526101046020526040902054819060ff166108d65760405162461bcd60e51b815260206004820152601760248201527f47617353746174696f6e3a2077726f6e6720746f6b656e00000000000000000060448201526064015b60405180910390fd5b6001600160a01b0381166000908152610104602052604081205461090390610100900460ff16600a614d10565b90506000805b8651811015610aa55761010754156109bf5760008388838151811061093057610930614d1f565b60200260200101516109429190614d35565b9050610107548110156109bd5760405162461bcd60e51b815260206004820152603560248201527f47617353746174696f6e3a206d696e696d756d20616d6f756e7420706572206360448201527f6861696e2076616c69646174696f6e206572726f72000000000000000000000060648201526084016108cd565b505b6101085415610a6c576000838883815181106109dd576109dd614d1f565b60200260200101516109ef9190614d35565b905061010854811115610a6a5760405162461bcd60e51b815260206004820152603560248201527f47617353746174696f6e3a206d6178696d756d20616d6f756e7420706572206360448201527f6861696e2076616c69646174696f6e206572726f72000000000000000000000060648201526084016108cd565b505b868181518110610a7e57610a7e614d1f565b602002602001015182610a919190614d57565b915080610a9d81614d6a565b915050610909565b5060008111610af65760405162461bcd60e51b815260206004820152601960248201527f47617353746174696f6e3a2077726f6e6720616d6f756e74730000000000000060448201526064016108cd565b6000610b028383614d35565b905060008111610b545760405162461bcd60e51b815260206004820181905260248201527f47617353746174696f6e3a2077726f6e6720616d6f756e747320696e2055534460448201526064016108cd565b6101055415610bc45761010554811015610bc45760405162461bcd60e51b815260206004820152602b60248201527f47617353746174696f6e3a206d696e696d756d20616d6f756e742076616c696460448201526a30ba34b7b71032b93937b960a91b60648201526084016108cd565b6101065415610c345761010654811115610c345760405162461bcd60e51b815260206004820152602b60248201527f47617353746174696f6e3a206d6178696d756d20616d6f756e742076616c696460448201526a30ba34b7b71032b93937b960a91b60648201526084016108cd565b50610c5d33610c4b6097546001600160a01b031690565b6001600160a01b038716919084612645565b60005b8651811015610db0576000610c756101025490565b90506000878381518110610c8b57610c8b614d1f565b6020026020010151898481518110610ca557610ca5614d1f565b602002602001015183610cc7896001600160a01b03166001600160a01b031690565b6001600160a01b038a166000908152610104602090815260409182902054825191820196909652908101939093526060830191909152608082015261010090910460ff1660a082015260c0016040516020818303038152906040529050610d478a8481518110610d3957610d39614d1f565b6020026020010151826126f6565b7f4a92fe54cd8768745ad8155987fb7ce69623eeb1d6678b87e64af8a660eb71938a8481518110610d7a57610d7a614d1f565b60200260200101518383604051610d9393929190614dd3565b60405180910390a150508080610da890614d6a565b915050610c60565b50505050610dbe600160c955565b50505050565b610dcc612592565b600081815260ff6020819052604090912054829116610e425760405162461bcd60e51b815260206004820152602c60248201527f4173746572697a6d436c69656e743a206f7574626f756e64207472616e73666560448201526b72206e6f742065786973747360a01b60648201526084016108cd565b600082815260ff6020819052604090912054839161010090910416610ecf5760405162461bcd60e51b815260206004820152602e60248201527f4173746572697a6d436c69656e743a206f7574626f756e64207472616e73666560448201527f72206e6f7420657865637574656400000000000000000000000000000000000060648201526084016108cd565b60fb5460fc546040517fe9cbb067000000000000000000000000000000000000000000000000000000008152600481018690526001600160a01b03918216602482015291169063e9cbb0679034906044016000604051808303818588803b158015610f3957600080fd5b505af1158015610f4d573d6000803e3d6000fd5b5050604080518781523460208201527fe9ba565b5958863386bcde80b5f171e9fd6d0267c4d2a46a39f66dc65c4d2d0a9450019150610f899050565b60405180910390a1505050565b610f9e612592565b61010380547fffffffff0000000000000000000000000000000000000000ffffffffffffffff16680100000000000000006001600160a01b038416908102919091179091556040519081527fc9dadbb474dbec338c6fe6a6736e27890c11495d2c1a53f7bfa24d5821ddb97890602001610853565b61101b612592565b6101058190556040518181527fb1a29b183e1760bf303dbf3beb2a47909bdec4a1a72b2ef61532f4d78341ba9890602001610853565b611059612592565b60fc546001600160a01b0316156110d85760405162461bcd60e51b815260206004820152602c60248201527f4173746572697a6d436c69656e743a2072656c6179206368616e67696e67206e60448201527f6f7420617661696c61626c65000000000000000000000000000000000000000060648201526084016108cd565b60fc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f7c6aa5544253e3aaa223b75aaae24831fa5c284b8969b21f3ca0144139c8ca5690602001610853565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036111c05760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b60648201526084016108cd565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661121b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146112865760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b60648201526084016108cd565b61128f8161283f565b604080516000808252602082019092526112ab91839190612847565b50565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361133b5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b60648201526084016108cd565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166113967f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146114015760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b60648201526084016108cd565b61140a8261283f565b61141682826001612847565b5050565b611422612592565b6001600160a01b03811660008181526101046020908152604091829020805461ffff1916905590519182527fd199d994836e4b1269ba8943ae7f4dd79771d328945b9f416733721c0be6563c9101610853565b61147d612592565b67ffffffffffffffff8116600090815260fd602052604090205460ff166114f85760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a20747275737465642061646472657373206044820152681b9bdd08199bdd5b9960ba1b60648201526084016108cd565b67ffffffffffffffff8116600081815260fd60209081526040808320600181018054825460ff1990811684559590915560029091018054909416909355805193845290830182905290917ffd7a21993e13e582ed76662b6418e9b9511744865303fb62be6e4b1503d0b8b291015b60405180910390a15050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116125760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016108cd565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b61163f612592565b6116476125ec565b6040516370a0823160e01b815230600482015281906001600160a01b038516906370a0823190602401602060405180830381865afa15801561168d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b19190614e05565b10156117145760405162461bcd60e51b815260206004820152602c60248201527f4173746572697a6d5769746864726177616c3a20636f696e732062616c616e6360448201526b0ca40dcdee840cadcdeeaced60a31b60648201526084016108cd565b6117286001600160a01b03841683836129e7565b604080516001600160a01b038086168252841660208201529081018290527f6e435fff5985d38c21525a2f788844f79a12466c552622db8e1c061f24d8baeb9060600160405180910390a161177d600160c955565b505050565b61178a612592565b6117946000612a30565b565b336000908152610100602052604090205460ff166117f65760405162461bcd60e51b815260206004820152601b60248201527f4173746572697a6d436c69656e743a206f6e6c792073656e646572000000000060448201526064016108cd565b6117fe6125ec565b61010354600090611856908890889067ffffffffffffffff1630898989898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612a8f92505050565b905061186181612b7d565b5061186c600160c955565b505050505050565b600054610100900460ff16158080156118945750600054600160ff909116105b806118ae5750303b1580156118ae575060005460ff166001145b6119205760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016108cd565b6000805460ff191660011790558015611943576000805461ff0019166101001790555b61194b612f36565b611953612fa9565b61195b61301c565b61196484613087565b60fb54604080517f3c32cf5800000000000000000000000000000000000000000000000000000000815290516119f1926001600160a01b031691633c32cf589160048083019260209291908290030181865afa1580156119c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ec9190614e1e565b6130e2565b6119fa83613133565b611a0382613175565b611a186106c16097546001600160a01b031690565b61010354611a309067ffffffffffffffff16306122a2565b8015610dbe576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150505050565b611a84612592565b6101068190556040518181527fbd345b23a678a4568ef0b77327e59e9a9c79e794aef240b96c956f20240dece790602001610853565b611ac2612592565b6001600160a01b0381166000908152610100602052604090205460ff16611b515760405162461bcd60e51b815260206004820152602160248201527f4173746572697a6d436c69656e743a2073656e646572206e6f7420657869737460448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108cd565b6001600160a01b03811660008181526101006020908152604091829020805460ff1916905590519182527f72895b13a385cda50c1800dd6866b09f2c54e2c5b86d15bf89b917503e8319479101610853565b611bab612592565b60005b83811015611c1057611bfe858583818110611bcb57611bcb614d1f565b9050602002016020810190611be09190614930565b848484818110611bf257611bf2614d1f565b905060200201356122a2565b80611c0881614d6a565b915050611bae565b5050505050565b611c1f612592565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce56700000000000000000000000000000000000000000000000000000000179052905160009182916001600160a01b03851691611c9091614e3b565b6000604051808303816000865af19150503d8060008114611ccd576040519150601f19603f3d011682016040523d82523d6000602084013e611cd2565b606091505b509150915081611d4a5760405162461bcd60e51b815260206004820152602360248201527f47617353746174696f6e3a20646563696d616c7320726571756573742066616960448201527f6c6564000000000000000000000000000000000000000000000000000000000060648201526084016108cd565b80806020019051810190611d5e9190614e57565b6001600160a01b03841660008181526101046020908152604091829020805460ff1960ff96909616610100029590951661ffff1990951694909417600117909355519081527f317755affbd78cdc51c0253f376fb71782026458a72264a2824aad7e77b85cc19101610f89565b611dd3612592565b6001600160a01b03811660008181526101006020908152604091829020805460ff1916600117905590519182527fd3a61d499b2bee2f0a661779009398c7c42937b4d83f49e5d1e015a4840ca5ef9101610853565b600054610100900460ff1615808015611e485750600054600160ff909116105b80611e625750303b158015611e62575060005460ff166001145b611ed45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016108cd565b6000805460ff191660011790558015611ef7576000805461ff0019166101001790555b611f048260006001611874565b8015611416576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001611566565b60fb546001600160a01b03163314611fa05760405162461bcd60e51b815260206004820181905260248201527f4173746572697a6d436c69656e743a206f6e6c7920696e697469616c697a657260448201526064016108cd565b6112ab816131bf565b611fb1612592565b6101088190556040518181527f88d59d5f2eb5ea6588a09ae4dc6e1489594f46c6028dd9a8973a7e2e46b4926a90602001610853565b611fef612592565b611ff76125ec565b8047101561205c5760405162461bcd60e51b815260206004820152602c60248201527f4173746572697a6d5769746864726177616c3a20636f696e732062616c616e6360448201526b0ca40dcdee840cadcdeeaced60a31b60648201526084016108cd565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146120a9576040519150601f19603f3d011682016040523d82523d6000602084013e6120ae565b606091505b50509050806121255760405162461bcd60e51b815260206004820152602260248201527f4173746572697a6d5769746864726177616c3a207472616e736665722065727260448201527f6f7200000000000000000000000000000000000000000000000000000000000060648201526084016108cd565b604080516001600160a01b0385168152602081018490527fd85be72d292446f182b47f796d3fcd4d9101da1a36a9475935508a4957e114fc910160405180910390a150611416600160c955565b60fb546001600160a01b031633146121cc5760405162461bcd60e51b815260206004820181905260248201527f4173746572697a6d436c69656e743a206f6e6c7920696e697469616c697a657260448201526064016108cd565b600082815260ff60208190526040909120548391610100909104166122595760405162461bcd60e51b815260206004820152602e60248201527f4173746572697a6d436c69656e743a206f7574626f756e64207472616e73666560448201527f72206e6f7420657865637574656400000000000000000000000000000000000060648201526084016108cd565b6101015460ff161561177d5760405160ff8316815283907f1824ee9b71c3242be3bb5168f9aef62e3bf82c2786cbb9f79245ea63d40bd05b9060200160405180910390a2505050565b6122aa612592565b67ffffffffffffffff8216600081815260fd602052604090819020805460ff1916600190811782550183905560fb5490516327b465b560e11b815260048101929092526001600160a01b031690634f68cb6a90602401602060405180830381865afa15801561231d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123419190614e57565b67ffffffffffffffff8316600081815260fd6020908152604091829020600201805460ff191660ff959095169490941790935580519182529181018390527feed208449d4724fa50dbf05bd86a1ac2db549c6a4714c5c6e300d95a74c179049101611566565b6123af612592565b6001600160a01b03811661242b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016108cd565b6112ab81612a30565b336000908152610100602052604090205460ff166124945760405162461bcd60e51b815260206004820152601b60248201527f4173746572697a6d436c69656e743a206f6e6c792073656e646572000000000060448201526064016108cd565b61249c6125ec565b67ffffffffffffffff8316600090815260fd602052604090205460ff166125175760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a20747275737465642061646472657373206044820152681b9bdd08199bdd5b9960ba1b60648201526084016108cd565b67ffffffffffffffff8316600081815260fd6020908152604080832060010154815160a080820184528582528185018690528184018690526060808301879052608092830196909652835190810184529586529285015290830184905234908301528101839052612587816133cf565b5061177d600160c955565b6097546001600160a01b031633146117945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108cd565b600260c9540361263e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108cd565b600260c955565b6040516001600160a01b0380851660248301528316604482015260648101829052610dbe9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261393a565b67ffffffffffffffff8216600090815260fd602052604090205460ff166127715760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a20747275737465642061646472657373206044820152681b9bdd08199bdd5b9960ba1b60648201526084016108cd565b61010280546000918261278383614d6a565b91905055905060006127c96127a26101035467ffffffffffffffff1690565b3067ffffffffffffffff8716600090815260fd602052604090206001015487908688613a1f565b600081815260ff60209081526040808320805460ff1916600190811790915567ffffffffffffffff8916845260fd90925291829020015490519192507fb882b1194cfbd9d0f7311db6af7e524b683fd5f9ace05dc0c3932370ea46fb7d91611a6e918791869086908990614e74565b600160c955565b6112ab612592565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561287a5761177d83613a96565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156128d4575060408051601f3d908101601f191682019092526128d191810190614e05565b60015b6129465760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f74205555505300000000000000000000000000000000000060648201526084016108cd565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146129db5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c6555554944000000000000000000000000000000000000000000000060648201526084016108cd565b5061177d838383613b61565b6040516001600160a01b03831660248201526044810182905261177d9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612692565b609780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612ae66040518060e00160405280600067ffffffffffffffff16815260200160008152602001600067ffffffffffffffff168152602001600081526020016000815260200160008019168152602001606081525090565b612b3d6040518060e00160405280600067ffffffffffffffff16815260200160008152602001600067ffffffffffffffff168152602001600081526020016000815260200160008019168152602001606081525090565b67ffffffffffffffff98891681526020810197909752509390951660408501526060840191909152608083015260a082019290925260c081019190915290565b6097546001600160a01b0316331480612ba0575060fb546001600160a01b031633145b612bfe5760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a206f6e6c79206f776e6572206f7220696e60448201526834ba34b0b634bd32b960b91b60648201526084016108cd565b60a0810151600081815260fe602052604090205460ff16612c875760405162461bcd60e51b815260206004820152602560248201527f4173746572697a6d436c69656e743a207472616e73666572206e6f742072656360448201527f656976656400000000000000000000000000000000000000000000000000000060648201526084016108cd565b815160208084015167ffffffffffffffff8316600090815260fd9092526040909120600101548114612d075760405162461bcd60e51b8152602060048201526024808201527f4173746572697a6d436c69656e743a2077726f6e6720736f75726365206164646044820152637265737360e01b60648201526084016108cd565b60a084015160fb546040517fe5646fab000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b039091169063e5646fab90602401602060405180830381865afa158015612d6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d929190614eb4565b612def5760405162461bcd60e51b815260206004820152602860248201527f4173746572697a6d436c69656e743a207472616e736665722068617368206973604482015267081a5b9d985b1a5960c21b60648201526084016108cd565b60a0850151600081815260fe6020526040902054610100900460ff1615612e6a5760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a207472616e7366657220657865637574656044820152686420616c726561647960b81b60648201526084016108cd565b610101548690610100900460ff16612f0457612ea7816000015182602001518360400151846060015185608001518660c001518760a00151613b86565b612f045760405162461bcd60e51b815260206004820152602860248201527f4173746572697a6d436c69656e743a207472616e736665722068617368206973604482015267081a5b9d985b1a5960c21b60648201526084016108cd565b612f0d87613ba4565b50505060a090930151600090815260fe60205260409020805461ff001916610100179055505050565b600054610100900460ff16612fa15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108cd565b611794613de2565b600054610100900460ff166130145760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108cd565b611794613e56565b600054610100900460ff166117945760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108cd565b60fb805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f5c59b35744b3cdb8be062a730b21cf86bccb29870598a2c2983afbacea92f19290602001610853565b610103805467ffffffffffffffff191667ffffffffffffffff83169081179091556040519081527f1fa3863a9436758fa43274faeb83146c9f39308a904ac7aac6d3e1af5979039b90602001610853565b610101805460ff19168215159081179091556040519081527f1394f6e38da5dfefadfab6dbde079d41568de78947255bf25fb59d5ce70102bd90602001610853565b61010180548215156101000261ff00199091161790556040517f5e1ae1b9c820ba5776bcbdec281533441fbb6f7a9cf724b85699f3f5318d61419061085390831515815260200190565b6097546001600160a01b03163314806131e2575060fb546001600160a01b031633145b6132405760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a206f6e6c79206f776e6572206f7220696e60448201526834ba34b0b634bd32b960b91b60648201526084016108cd565b61324d6020820182614930565b67ffffffffffffffff8116600090815260fd6020908152604090912060010154908301359081146132cc5760405162461bcd60e51b8152602060048201526024808201527f4173746572697a6d436c69656e743a2077726f6e6720736f75726365206164646044820152637265737360e01b60648201526084016108cd565b60a0830135600081815260fe6020526040902054610100900460ff16156133475760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a207472616e7366657220657865637574656044820152686420616c726561647960b81b60648201526084016108cd565b60a0840135600090815260fe60209081526040909120805460ff191660011790557fff95c8c7c3e8067d7742d009490d82eea9496f5df16e46a120d41693763a41bc9061339690860186614930565b6040805167ffffffffffffffff9092168252602080880135908301526080808801359183019190915260a0870135606083015201611a6e565b6080810151600081815260ff6020819052604090912054166134485760405162461bcd60e51b815260206004820152602c60248201527f4173746572697a6d436c69656e743a206f7574626f756e64207472616e73666560448201526b72206e6f742065786973747360a01b60648201526084016108cd565b6080820151600081815260ff6020819052604090912054610100900416156134d85760405162461bcd60e51b815260206004820152603260248201527f4173746572697a6d436c69656e743a206f7574626f756e64207472616e73666560448201527f7220657865637574656420616c7265616479000000000000000000000000000060648201526084016108cd565b82604001514710156135525760405162461bcd60e51b815260206004820152602e60248201527f4173746572697a6d436c69656e743a20636f6e74726163742062616c616e636560448201527f206973206e6f7420656e6f75676800000000000000000000000000000000000060648201526084016108cd565b61010254836060015111156135a95760405162461bcd60e51b815260206004820181905260248201527f4173746572697a6d436c69656e743a2077726f6e67207478496420706172616d60448201526064016108cd565b825160208085015160608087015160808089015160fc5461010154610103546040805160e080820183526000808352828d01819052828401819052828b0181905282890181905260a080840182905260c0938401919091528351918201845267ffffffffffffffff909d1681529a8b019990995296890195909552948701919091526001600160a01b039081169186019190915260ff9092161515948401949094526801000000000000000090930490921691810182905290156138935760fb5460fc546040517f67d6bd120000000000000000000000000000000000000000000000000000000081526000926001600160a01b03908116926367d6bd12926136ba92909116908690600401614ed1565b602060405180830381865afa1580156136d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136fb9190614e05565b9050801561389157610103546040516370a0823160e01b815230600482015282916801000000000000000090046001600160a01b0316906370a0823190602401602060405180830381865afa158015613758573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377c9190614e05565b10156137f05760405162461bcd60e51b815260206004820152602f60248201527f4173746572697a6d436c69656e743a2066656520746f6b656e2062616c616e6360448201527f65206973206e6f7420656e6f756768000000000000000000000000000000000060648201526084016108cd565b6101035460fb546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201526024810184905268010000000000000000909204169063095ea7b3906044016020604051808303816000875af115801561386b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061388f9190614eb4565b505b505b60fb5460408086015190517f5fab82840000000000000000000000000000000000000000000000000000000081526001600160a01b0390921691635fab828491906138e2908590600401614f49565b6000604051808303818588803b1580156138fb57600080fd5b505af115801561390f573d6000803e3d6000fd5b505050608090950151600090815260ff60205260409020805461ff0019166101001790555050505050565b600061398f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613ec19092919063ffffffff16565b80519091501561177d57808060200190518101906139ad9190614eb4565b61177d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016108cd565b6000808787878787613a3088613eda565b604051602001613a4596959493929190614fb1565b6040516020818303038152906040529050613a5f86613f5e565b60ff16613a6b89613f5e565b60ff1614613a8157613a7c81613fdb565b613a8a565b613a8a81614394565b98975050505050505050565b6001600160a01b0381163b613b135760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016108cd565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b613b6a836143e6565b600082511180613b775750805b1561177d57610dbe8383614426565b600081613b97898989898989613a1f565b1498975050505050505050565b6000806000806000808660c00151806020019051810190613bc5919061501f565b955095509550955095509550613c408760000151886020015189604001518a606001518b608001518b8b8b8b8b604051602001613c2795949392919094855260208501939093526040840191909152606083015260ff16608082015260a00190565b6040516020818303038152906040528d60a00151613b86565b613cb15760405162461bcd60e51b8152602060048201526024808201527f47617353746174696f6e3a207472616e73666572206861736820697320696e7660448201527f616c69640000000000000000000000000000000000000000000000000000000060648201526084016108cd565b856000613cbf84600a614d10565b613cc98489615074565b613cd39190614d35565b90506001600160a01b0382163014613d8a576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613d32576040519150601f19603f3d011682016040523d82523d6000602084013e613d37565b606091505b5050905080613d885760405162461bcd60e51b815260206004820152601a60248201527f47617353746174696f6e3a207472616e73666572206572726f7200000000000060448201526064016108cd565b505b60808901516040805183815260208101929092526001600160a01b03841682820152517fa3be16725f18781679eee1b21b2c2a762a8fefd0e0ae84959d2af1693339ab319181900360600190a1505050505050505050565b600054610100900460ff16613e4d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108cd565b61179433612a30565b600054610100900460ff166128385760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108cd565b6060613ed0848460008561444b565b90505b9392505050565b6060600080600080600086806020019051810190613ef8919061508b565b604080516020810196909652858101949094526060850192909252608084015260f81b7fff000000000000000000000000000000000000000000000000000000000000001660a08301528051608181840301815260a19092019052979650505050505050565b60fb546040516327b465b560e11b815267ffffffffffffffff831660048201526000916001600160a01b031690634f68cb6a90602401602060405180830381865afa158015613fb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fd59190614e57565b92915050565b60408051607080825260a0820190925260009182919060208201818036833701905050905060005b60708110156140645783818151811061401e5761401e614d1f565b602001015160f81c60f81b82828151811061403b5761403b614d1f565b60200101906001600160f81b031916908160001a9053508061405c81614d6a565b915050614003565b5060008151845161407591906150d8565b67ffffffffffffffff81111561408d5761408d61466e565b6040519080825280601f01601f1916602001820160405280156140b7576020820181803683370190505b5082519091505b845181101561412b578481815181106140d9576140d9614d1f565b602001015160f81c60f81b828451836140f291906150d8565b8151811061410257614102614d1f565b60200101906001600160f81b031916908160001a9053508061412381614d6a565b9150506140be565b508051604051607f90600090600290614145908790614e3b565b602060405180830381855afa158015614162573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906141859190614e05565b905060005b61419760ff841685614d35565b81116143895760006141ac8260ff8616615074565b90506000856141be60ff871684614d57565b11156141ca57856141d7565b6141d760ff861683614d57565b905060006141e583836150d8565b67ffffffffffffffff8111156141fd576141fd61466e565b6040519080825280601f01601f191660200182016040528015614227576020820181803683370190505b509050825b828110156142b15788818151811061424657614246614d1f565b01602001517fff00000000000000000000000000000000000000000000000000000000000000168261427886846150d8565b8151811061428857614288614d1f565b60200101906001600160f81b031916908160001a905350806142a981614d6a565b91505061422c565b506002856002836040516142c59190614e3b565b602060405180830381855afa1580156142e2573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906143059190614e05565b60408051602081019390935282015260600160408051601f198184030181529082905261433191614e3b565b602060405180830381855afa15801561434e573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906143719190614e05565b9450505050808061438190614d6a565b91505061418a565b509695505050505050565b60006002826040516143a69190614e3b565b602060405180830381855afa1580156143c3573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190613fd59190614e05565b6143ef81613a96565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060613ed383836040518060600160405280602781526020016150ff6027913961453f565b6060824710156144c35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016108cd565b600080866001600160a01b031685876040516144df9190614e3b565b60006040518083038185875af1925050503d806000811461451c576040519150601f19603f3d011682016040523d82523d6000602084013e614521565b606091505b5091509150614532878383876145b7565b925050505b949350505050565b6060600080856001600160a01b03168560405161455c9190614e3b565b600060405180830381855af49150503d8060008114614597576040519150601f19603f3d011682016040523d82523d6000602084013e61459c565b606091505b50915091506145ad868383876145b7565b9695505050505050565b6060831561462657825160000361461f576001600160a01b0385163b61461f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108cd565b5081614537565b614537838381511561463b5781518083602001fd5b8060405162461bcd60e51b81526004016108cd91906150eb565b60006020828403121561466757600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156146ad576146ad61466e565b604052919050565b600067ffffffffffffffff8211156146cf576146cf61466e565b5060051b60200190565b67ffffffffffffffff811681146112ab57600080fd5b600082601f83011261470057600080fd5b81356020614715614710836146b5565b614684565b82815260059290921b8401810191818101908684111561473457600080fd5b8286015b848110156143895780358352918301918301614738565b6001600160a01b03811681146112ab57600080fd5b803561476f8161474f565b919050565b6000806000806080858703121561478a57600080fd5b843567ffffffffffffffff808211156147a257600080fd5b818701915087601f8301126147b657600080fd5b813560206147c6614710836146b5565b82815260059290921b8401810191818101908b8411156147e557600080fd5b948201945b8386101561480c5785356147fd816146d9565b825294820194908201906147ea565b9850508801359250508082111561482257600080fd5b61482e888389016146ef565b9450604087013591508082111561484457600080fd5b50614851878288016146ef565b92505061486060608601614764565b905092959194509250565b60006020828403121561487d57600080fd5b8135613ed38161474f565b6000806040838503121561489b57600080fd5b82356148a68161474f565b915060208381013567ffffffffffffffff808211156148c457600080fd5b818601915086601f8301126148d857600080fd5b8135818111156148ea576148ea61466e565b6148fc601f8201601f19168501614684565b9150808252878482850101111561491257600080fd5b80848401858401376000848284010152508093505050509250929050565b60006020828403121561494257600080fd5b8135613ed3816146d9565b60008060006060848603121561496257600080fd5b833561496d8161474f565b9250602084013561497d8161474f565b929592945050506040919091013590565b60008060008060008060a087890312156149a757600080fd5b86356149b2816146d9565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff808211156149e457600080fd5b818901915089601f8301126149f857600080fd5b813581811115614a0757600080fd5b8a6020828501011115614a1957600080fd5b6020830194508093505050509295509295509295565b80151581146112ab57600080fd5b600080600060608486031215614a5257600080fd5b8335614a5d8161474f565b92506020840135614a6d81614a2f565b91506040840135614a7d81614a2f565b809150509250925092565b60008083601f840112614a9a57600080fd5b50813567ffffffffffffffff811115614ab257600080fd5b6020830191508360208260051b8501011115614acd57600080fd5b9250929050565b60008060008060408587031215614aea57600080fd5b843567ffffffffffffffff80821115614b0257600080fd5b614b0e88838901614a88565b90965094506020870135915080821115614b2757600080fd5b50614b3487828801614a88565b95989497509550505050565b600060c08284031215614b5257600080fd5b50919050565b60008060408385031215614b6b57600080fd5b8235614b768161474f565b946020939093013593505050565b60ff811681146112ab57600080fd5b60008060408385031215614ba657600080fd5b823591506020830135614bb881614b84565b809150509250929050565b60008060408385031215614bd657600080fd5b8235614b76816146d9565b600080600060608486031215614bf657600080fd5b8335614c01816146d9565b95602085013595506040909401359392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115614c67578160001904821115614c4d57614c4d614c16565b80851615614c5a57918102915b93841c9390800290614c31565b509250929050565b600082614c7e57506001613fd5565b81614c8b57506000613fd5565b8160018114614ca15760028114614cab57614cc7565b6001915050613fd5565b60ff841115614cbc57614cbc614c16565b50506001821b613fd5565b5060208310610133831016604e8410600b8410161715614cea575081810a613fd5565b614cf48383614c2c565b8060001904821115614d0857614d08614c16565b029392505050565b6000613ed360ff841683614c6f565b634e487b7160e01b600052603260045260246000fd5b600082614d5257634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115613fd557613fd5614c16565b600060018201614d7c57614d7c614c16565b5060010190565b60005b83811015614d9e578181015183820152602001614d86565b50506000910152565b60008151808452614dbf816020860160208601614d83565b601f01601f19169290920160200192915050565b67ffffffffffffffff84168152826020820152606060408201526000614dfc6060830184614da7565b95945050505050565b600060208284031215614e1757600080fd5b5051919050565b600060208284031215614e3057600080fd5b8151613ed3816146d9565b60008251614e4d818460208701614d83565b9190910192915050565b600060208284031215614e6957600080fd5b8151613ed381614b84565b67ffffffffffffffff8616815284602082015283604082015282606082015260a060808201526000614ea960a0830184614da7565b979650505050505050565b600060208284031215614ec657600080fd5b8151613ed381614a2f565b6001600160a01b03831681526101008101613ed3602083018467ffffffffffffffff815116825260208101516020830152604081015160408301526060810151606083015260808101516001600160a01b03808216608085015260a0830151151560a08501528060c08401511660c085015250505050565b60e08101613fd5828467ffffffffffffffff815116825260208101516020830152604081015160408301526060810151606083015260808101516001600160a01b03808216608085015260a0830151151560a08501528060c08401511660c085015250505050565b60007fffffffffffffffff000000000000000000000000000000000000000000000000808960c01b168352876008840152808760c01b16602884015250846030830152836050830152825161500d816070850160208701614d83565b91909101607001979650505050505050565b60008060008060008060c0878903121561503857600080fd5b86519550602087015194506040870151935060608701519250608087015161505f81614b84565b8092505060a087015190509295509295509295565b8082028115828204841417613fd557613fd5614c16565b600080600080600060a086880312156150a357600080fd5b8551945060208601519350604086015192506060860151915060808601516150ca81614b84565b809150509295509295909350565b81810381811115613fd557613fd5614c16565b602081526000613ed36020830184614da756fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220dd3e020da70fad7ee4e48a49f6e985e0d3d02123d3f985867541f1f06335722d64736f6c63430008110033
Deployed ByteCode
0x60806040526004361061028e5760003560e01c80638da5cb5b11610156578063c64db73d116100bf578063e26814d811610079578063e5a8553d11610061578063e5a8553d146107c6578063f2fde38b146107e6578063f825c0ba1461080657005b8063e26814d814610786578063e46f22c3146107a657005b8063ce8e4830116100a7578063ce8e483014610731578063df01efef14610748578063e0497f141461076857005b8063c64db73d146106e6578063ca709a251461070657005b8063b31e895911610110578063b60ad43f116100f8578063b60ad43f14610688578063b697f531146106a6578063c4d66de8146106c657005b8063b31e895914610648578063b3c1f5d81461066857005b80639c213e8c1161013e5780639c213e8c146105e8578063a973611714610608578063b2f876431461062857005b80638da5cb5b146105295780638febf6ae1461054757005b80634f2d648f116101f8578063643c481f116101b2578063715018a61161019a578063715018a6146104dd5780637f438e60146104f25780638ac626b71461050957005b8063643c481f146104af5780636fe5e416146104c657005b80635215e9b6116101e05780635215e9b61461044c57806352d1902d1461046c5780635e35359e1461048f57005b80634f2d648f146103d957806351bb5dff1461042c57005b80631c43cf761161024957806331b8cd421161023157806331b8cd42146103815780633659cfe6146103a65780634f1ef286146103c657005b80631c43cf761461034157806322c6645f1461036157005b8063079c060711610277578063079c0607146102d75780630de4f91d1461030e57806315cce2241461032157005b8062d51ce8146102975780630360cca3146102b757005b3661029557005b005b3480156102a357600080fd5b506102956102b2366004614655565b610819565b3480156102c357600080fd5b506102956102d2366004614774565b61085e565b3480156102e357600080fd5b5060fb546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b61029561031c366004614655565b610dc4565b34801561032d57600080fd5b5061029561033c36600461486b565b610f96565b34801561034d57600080fd5b5061029561035c366004614655565b611013565b34801561036d57600080fd5b5061029561037c36600461486b565b611051565b34801561038d57600080fd5b506101015460ff165b6040519015158152602001610305565b3480156103b257600080fd5b506102956103c136600461486b565b611133565b6102956103d4366004614888565b6112ae565b3480156103e557600080fd5b506104136103f436600461486b565b6101046020526000908152604090205460ff8082169161010090041682565b60408051921515835260ff909116602083015201610305565b34801561043857600080fd5b5061029561044736600461486b565b61141a565b34801561045857600080fd5b50610295610467366004614930565b611475565b34801561047857600080fd5b50610481611572565b604051908152602001610305565b34801561049b57600080fd5b506102956104aa36600461494d565b611637565b3480156104bb57600080fd5b506104816101075481565b3480156104d257600080fd5b506104816101065481565b3480156104e957600080fd5b50610295611782565b3480156104fe57600080fd5b506104816101085481565b34801561051557600080fd5b5061029561052436600461498e565b611796565b34801561053557600080fd5b506097546001600160a01b03166102f1565b34801561055357600080fd5b506105c1610562366004614930565b60408051606080820183526000808352602080840182905292840181905267ffffffffffffffff94909416845260fd82529282902082519384018352805460ff9081161515855260018201549285019290925260020154169082015290565b60408051825115158152602080840151908201529181015160ff1690820152606001610305565b3480156105f457600080fd5b50610295610603366004614a3d565b611874565b34801561061457600080fd5b50610295610623366004614655565b611a7c565b34801561063457600080fd5b5061029561064336600461486b565b611aba565b34801561065457600080fd5b50610295610663366004614ad4565b611ba3565b34801561067457600080fd5b5061029561068336600461486b565b611c17565b34801561069457600080fd5b5060fc546001600160a01b03166102f1565b3480156106b257600080fd5b506102956106c136600461486b565b611dcb565b3480156106d257600080fd5b506102956106e136600461486b565b611e28565b3480156106f257600080fd5b50610295610701366004614b40565b611f46565b34801561071257600080fd5b50610103546801000000000000000090046001600160a01b03166102f1565b34801561073d57600080fd5b506104816101055481565b34801561075457600080fd5b50610295610763366004614655565b611fa9565b34801561077457600080fd5b5061010154610100900460ff16610396565b34801561079257600080fd5b506102956107a1366004614b58565b611fe7565b3480156107b257600080fd5b506102956107c1366004614b93565b612172565b3480156107d257600080fd5b506102956107e1366004614bc3565b6122a2565b3480156107f257600080fd5b5061029561080136600461486b565b6123a7565b610295610814366004614be1565b612434565b610821612592565b6101078190556040518181527fb913cbf19542b9cf78a2f99f0ad5cfd9da57e41b4c1e3af6fc12d4fd2e5cf261906020015b60405180910390a150565b6108666125ec565b6001600160a01b03811660009081526101046020526040902054819060ff166108d65760405162461bcd60e51b815260206004820152601760248201527f47617353746174696f6e3a2077726f6e6720746f6b656e00000000000000000060448201526064015b60405180910390fd5b6001600160a01b0381166000908152610104602052604081205461090390610100900460ff16600a614d10565b90506000805b8651811015610aa55761010754156109bf5760008388838151811061093057610930614d1f565b60200260200101516109429190614d35565b9050610107548110156109bd5760405162461bcd60e51b815260206004820152603560248201527f47617353746174696f6e3a206d696e696d756d20616d6f756e7420706572206360448201527f6861696e2076616c69646174696f6e206572726f72000000000000000000000060648201526084016108cd565b505b6101085415610a6c576000838883815181106109dd576109dd614d1f565b60200260200101516109ef9190614d35565b905061010854811115610a6a5760405162461bcd60e51b815260206004820152603560248201527f47617353746174696f6e3a206d6178696d756d20616d6f756e7420706572206360448201527f6861696e2076616c69646174696f6e206572726f72000000000000000000000060648201526084016108cd565b505b868181518110610a7e57610a7e614d1f565b602002602001015182610a919190614d57565b915080610a9d81614d6a565b915050610909565b5060008111610af65760405162461bcd60e51b815260206004820152601960248201527f47617353746174696f6e3a2077726f6e6720616d6f756e74730000000000000060448201526064016108cd565b6000610b028383614d35565b905060008111610b545760405162461bcd60e51b815260206004820181905260248201527f47617353746174696f6e3a2077726f6e6720616d6f756e747320696e2055534460448201526064016108cd565b6101055415610bc45761010554811015610bc45760405162461bcd60e51b815260206004820152602b60248201527f47617353746174696f6e3a206d696e696d756d20616d6f756e742076616c696460448201526a30ba34b7b71032b93937b960a91b60648201526084016108cd565b6101065415610c345761010654811115610c345760405162461bcd60e51b815260206004820152602b60248201527f47617353746174696f6e3a206d6178696d756d20616d6f756e742076616c696460448201526a30ba34b7b71032b93937b960a91b60648201526084016108cd565b50610c5d33610c4b6097546001600160a01b031690565b6001600160a01b038716919084612645565b60005b8651811015610db0576000610c756101025490565b90506000878381518110610c8b57610c8b614d1f565b6020026020010151898481518110610ca557610ca5614d1f565b602002602001015183610cc7896001600160a01b03166001600160a01b031690565b6001600160a01b038a166000908152610104602090815260409182902054825191820196909652908101939093526060830191909152608082015261010090910460ff1660a082015260c0016040516020818303038152906040529050610d478a8481518110610d3957610d39614d1f565b6020026020010151826126f6565b7f4a92fe54cd8768745ad8155987fb7ce69623eeb1d6678b87e64af8a660eb71938a8481518110610d7a57610d7a614d1f565b60200260200101518383604051610d9393929190614dd3565b60405180910390a150508080610da890614d6a565b915050610c60565b50505050610dbe600160c955565b50505050565b610dcc612592565b600081815260ff6020819052604090912054829116610e425760405162461bcd60e51b815260206004820152602c60248201527f4173746572697a6d436c69656e743a206f7574626f756e64207472616e73666560448201526b72206e6f742065786973747360a01b60648201526084016108cd565b600082815260ff6020819052604090912054839161010090910416610ecf5760405162461bcd60e51b815260206004820152602e60248201527f4173746572697a6d436c69656e743a206f7574626f756e64207472616e73666560448201527f72206e6f7420657865637574656400000000000000000000000000000000000060648201526084016108cd565b60fb5460fc546040517fe9cbb067000000000000000000000000000000000000000000000000000000008152600481018690526001600160a01b03918216602482015291169063e9cbb0679034906044016000604051808303818588803b158015610f3957600080fd5b505af1158015610f4d573d6000803e3d6000fd5b5050604080518781523460208201527fe9ba565b5958863386bcde80b5f171e9fd6d0267c4d2a46a39f66dc65c4d2d0a9450019150610f899050565b60405180910390a1505050565b610f9e612592565b61010380547fffffffff0000000000000000000000000000000000000000ffffffffffffffff16680100000000000000006001600160a01b038416908102919091179091556040519081527fc9dadbb474dbec338c6fe6a6736e27890c11495d2c1a53f7bfa24d5821ddb97890602001610853565b61101b612592565b6101058190556040518181527fb1a29b183e1760bf303dbf3beb2a47909bdec4a1a72b2ef61532f4d78341ba9890602001610853565b611059612592565b60fc546001600160a01b0316156110d85760405162461bcd60e51b815260206004820152602c60248201527f4173746572697a6d436c69656e743a2072656c6179206368616e67696e67206e60448201527f6f7420617661696c61626c65000000000000000000000000000000000000000060648201526084016108cd565b60fc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f7c6aa5544253e3aaa223b75aaae24831fa5c284b8969b21f3ca0144139c8ca5690602001610853565b6001600160a01b037f00000000000000000000000072ecc5da8a6357315d820d27193edb9af1aaf29f1630036111c05760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b60648201526084016108cd565b7f00000000000000000000000072ecc5da8a6357315d820d27193edb9af1aaf29f6001600160a01b031661121b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146112865760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b60648201526084016108cd565b61128f8161283f565b604080516000808252602082019092526112ab91839190612847565b50565b6001600160a01b037f00000000000000000000000072ecc5da8a6357315d820d27193edb9af1aaf29f16300361133b5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b60648201526084016108cd565b7f00000000000000000000000072ecc5da8a6357315d820d27193edb9af1aaf29f6001600160a01b03166113967f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146114015760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b60648201526084016108cd565b61140a8261283f565b61141682826001612847565b5050565b611422612592565b6001600160a01b03811660008181526101046020908152604091829020805461ffff1916905590519182527fd199d994836e4b1269ba8943ae7f4dd79771d328945b9f416733721c0be6563c9101610853565b61147d612592565b67ffffffffffffffff8116600090815260fd602052604090205460ff166114f85760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a20747275737465642061646472657373206044820152681b9bdd08199bdd5b9960ba1b60648201526084016108cd565b67ffffffffffffffff8116600081815260fd60209081526040808320600181018054825460ff1990811684559590915560029091018054909416909355805193845290830182905290917ffd7a21993e13e582ed76662b6418e9b9511744865303fb62be6e4b1503d0b8b291015b60405180910390a15050565b6000306001600160a01b037f00000000000000000000000072ecc5da8a6357315d820d27193edb9af1aaf29f16146116125760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016108cd565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b61163f612592565b6116476125ec565b6040516370a0823160e01b815230600482015281906001600160a01b038516906370a0823190602401602060405180830381865afa15801561168d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b19190614e05565b10156117145760405162461bcd60e51b815260206004820152602c60248201527f4173746572697a6d5769746864726177616c3a20636f696e732062616c616e6360448201526b0ca40dcdee840cadcdeeaced60a31b60648201526084016108cd565b6117286001600160a01b03841683836129e7565b604080516001600160a01b038086168252841660208201529081018290527f6e435fff5985d38c21525a2f788844f79a12466c552622db8e1c061f24d8baeb9060600160405180910390a161177d600160c955565b505050565b61178a612592565b6117946000612a30565b565b336000908152610100602052604090205460ff166117f65760405162461bcd60e51b815260206004820152601b60248201527f4173746572697a6d436c69656e743a206f6e6c792073656e646572000000000060448201526064016108cd565b6117fe6125ec565b61010354600090611856908890889067ffffffffffffffff1630898989898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612a8f92505050565b905061186181612b7d565b5061186c600160c955565b505050505050565b600054610100900460ff16158080156118945750600054600160ff909116105b806118ae5750303b1580156118ae575060005460ff166001145b6119205760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016108cd565b6000805460ff191660011790558015611943576000805461ff0019166101001790555b61194b612f36565b611953612fa9565b61195b61301c565b61196484613087565b60fb54604080517f3c32cf5800000000000000000000000000000000000000000000000000000000815290516119f1926001600160a01b031691633c32cf589160048083019260209291908290030181865afa1580156119c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ec9190614e1e565b6130e2565b6119fa83613133565b611a0382613175565b611a186106c16097546001600160a01b031690565b61010354611a309067ffffffffffffffff16306122a2565b8015610dbe576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150505050565b611a84612592565b6101068190556040518181527fbd345b23a678a4568ef0b77327e59e9a9c79e794aef240b96c956f20240dece790602001610853565b611ac2612592565b6001600160a01b0381166000908152610100602052604090205460ff16611b515760405162461bcd60e51b815260206004820152602160248201527f4173746572697a6d436c69656e743a2073656e646572206e6f7420657869737460448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108cd565b6001600160a01b03811660008181526101006020908152604091829020805460ff1916905590519182527f72895b13a385cda50c1800dd6866b09f2c54e2c5b86d15bf89b917503e8319479101610853565b611bab612592565b60005b83811015611c1057611bfe858583818110611bcb57611bcb614d1f565b9050602002016020810190611be09190614930565b848484818110611bf257611bf2614d1f565b905060200201356122a2565b80611c0881614d6a565b915050611bae565b5050505050565b611c1f612592565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce56700000000000000000000000000000000000000000000000000000000179052905160009182916001600160a01b03851691611c9091614e3b565b6000604051808303816000865af19150503d8060008114611ccd576040519150601f19603f3d011682016040523d82523d6000602084013e611cd2565b606091505b509150915081611d4a5760405162461bcd60e51b815260206004820152602360248201527f47617353746174696f6e3a20646563696d616c7320726571756573742066616960448201527f6c6564000000000000000000000000000000000000000000000000000000000060648201526084016108cd565b80806020019051810190611d5e9190614e57565b6001600160a01b03841660008181526101046020908152604091829020805460ff1960ff96909616610100029590951661ffff1990951694909417600117909355519081527f317755affbd78cdc51c0253f376fb71782026458a72264a2824aad7e77b85cc19101610f89565b611dd3612592565b6001600160a01b03811660008181526101006020908152604091829020805460ff1916600117905590519182527fd3a61d499b2bee2f0a661779009398c7c42937b4d83f49e5d1e015a4840ca5ef9101610853565b600054610100900460ff1615808015611e485750600054600160ff909116105b80611e625750303b158015611e62575060005460ff166001145b611ed45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016108cd565b6000805460ff191660011790558015611ef7576000805461ff0019166101001790555b611f048260006001611874565b8015611416576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001611566565b60fb546001600160a01b03163314611fa05760405162461bcd60e51b815260206004820181905260248201527f4173746572697a6d436c69656e743a206f6e6c7920696e697469616c697a657260448201526064016108cd565b6112ab816131bf565b611fb1612592565b6101088190556040518181527f88d59d5f2eb5ea6588a09ae4dc6e1489594f46c6028dd9a8973a7e2e46b4926a90602001610853565b611fef612592565b611ff76125ec565b8047101561205c5760405162461bcd60e51b815260206004820152602c60248201527f4173746572697a6d5769746864726177616c3a20636f696e732062616c616e6360448201526b0ca40dcdee840cadcdeeaced60a31b60648201526084016108cd565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146120a9576040519150601f19603f3d011682016040523d82523d6000602084013e6120ae565b606091505b50509050806121255760405162461bcd60e51b815260206004820152602260248201527f4173746572697a6d5769746864726177616c3a207472616e736665722065727260448201527f6f7200000000000000000000000000000000000000000000000000000000000060648201526084016108cd565b604080516001600160a01b0385168152602081018490527fd85be72d292446f182b47f796d3fcd4d9101da1a36a9475935508a4957e114fc910160405180910390a150611416600160c955565b60fb546001600160a01b031633146121cc5760405162461bcd60e51b815260206004820181905260248201527f4173746572697a6d436c69656e743a206f6e6c7920696e697469616c697a657260448201526064016108cd565b600082815260ff60208190526040909120548391610100909104166122595760405162461bcd60e51b815260206004820152602e60248201527f4173746572697a6d436c69656e743a206f7574626f756e64207472616e73666560448201527f72206e6f7420657865637574656400000000000000000000000000000000000060648201526084016108cd565b6101015460ff161561177d5760405160ff8316815283907f1824ee9b71c3242be3bb5168f9aef62e3bf82c2786cbb9f79245ea63d40bd05b9060200160405180910390a2505050565b6122aa612592565b67ffffffffffffffff8216600081815260fd602052604090819020805460ff1916600190811782550183905560fb5490516327b465b560e11b815260048101929092526001600160a01b031690634f68cb6a90602401602060405180830381865afa15801561231d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123419190614e57565b67ffffffffffffffff8316600081815260fd6020908152604091829020600201805460ff191660ff959095169490941790935580519182529181018390527feed208449d4724fa50dbf05bd86a1ac2db549c6a4714c5c6e300d95a74c179049101611566565b6123af612592565b6001600160a01b03811661242b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016108cd565b6112ab81612a30565b336000908152610100602052604090205460ff166124945760405162461bcd60e51b815260206004820152601b60248201527f4173746572697a6d436c69656e743a206f6e6c792073656e646572000000000060448201526064016108cd565b61249c6125ec565b67ffffffffffffffff8316600090815260fd602052604090205460ff166125175760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a20747275737465642061646472657373206044820152681b9bdd08199bdd5b9960ba1b60648201526084016108cd565b67ffffffffffffffff8316600081815260fd6020908152604080832060010154815160a080820184528582528185018690528184018690526060808301879052608092830196909652835190810184529586529285015290830184905234908301528101839052612587816133cf565b5061177d600160c955565b6097546001600160a01b031633146117945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108cd565b600260c9540361263e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108cd565b600260c955565b6040516001600160a01b0380851660248301528316604482015260648101829052610dbe9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261393a565b67ffffffffffffffff8216600090815260fd602052604090205460ff166127715760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a20747275737465642061646472657373206044820152681b9bdd08199bdd5b9960ba1b60648201526084016108cd565b61010280546000918261278383614d6a565b91905055905060006127c96127a26101035467ffffffffffffffff1690565b3067ffffffffffffffff8716600090815260fd602052604090206001015487908688613a1f565b600081815260ff60209081526040808320805460ff1916600190811790915567ffffffffffffffff8916845260fd90925291829020015490519192507fb882b1194cfbd9d0f7311db6af7e524b683fd5f9ace05dc0c3932370ea46fb7d91611a6e918791869086908990614e74565b600160c955565b6112ab612592565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561287a5761177d83613a96565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156128d4575060408051601f3d908101601f191682019092526128d191810190614e05565b60015b6129465760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f74205555505300000000000000000000000000000000000060648201526084016108cd565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146129db5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c6555554944000000000000000000000000000000000000000000000060648201526084016108cd565b5061177d838383613b61565b6040516001600160a01b03831660248201526044810182905261177d9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612692565b609780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612ae66040518060e00160405280600067ffffffffffffffff16815260200160008152602001600067ffffffffffffffff168152602001600081526020016000815260200160008019168152602001606081525090565b612b3d6040518060e00160405280600067ffffffffffffffff16815260200160008152602001600067ffffffffffffffff168152602001600081526020016000815260200160008019168152602001606081525090565b67ffffffffffffffff98891681526020810197909752509390951660408501526060840191909152608083015260a082019290925260c081019190915290565b6097546001600160a01b0316331480612ba0575060fb546001600160a01b031633145b612bfe5760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a206f6e6c79206f776e6572206f7220696e60448201526834ba34b0b634bd32b960b91b60648201526084016108cd565b60a0810151600081815260fe602052604090205460ff16612c875760405162461bcd60e51b815260206004820152602560248201527f4173746572697a6d436c69656e743a207472616e73666572206e6f742072656360448201527f656976656400000000000000000000000000000000000000000000000000000060648201526084016108cd565b815160208084015167ffffffffffffffff8316600090815260fd9092526040909120600101548114612d075760405162461bcd60e51b8152602060048201526024808201527f4173746572697a6d436c69656e743a2077726f6e6720736f75726365206164646044820152637265737360e01b60648201526084016108cd565b60a084015160fb546040517fe5646fab000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b039091169063e5646fab90602401602060405180830381865afa158015612d6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d929190614eb4565b612def5760405162461bcd60e51b815260206004820152602860248201527f4173746572697a6d436c69656e743a207472616e736665722068617368206973604482015267081a5b9d985b1a5960c21b60648201526084016108cd565b60a0850151600081815260fe6020526040902054610100900460ff1615612e6a5760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a207472616e7366657220657865637574656044820152686420616c726561647960b81b60648201526084016108cd565b610101548690610100900460ff16612f0457612ea7816000015182602001518360400151846060015185608001518660c001518760a00151613b86565b612f045760405162461bcd60e51b815260206004820152602860248201527f4173746572697a6d436c69656e743a207472616e736665722068617368206973604482015267081a5b9d985b1a5960c21b60648201526084016108cd565b612f0d87613ba4565b50505060a090930151600090815260fe60205260409020805461ff001916610100179055505050565b600054610100900460ff16612fa15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108cd565b611794613de2565b600054610100900460ff166130145760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108cd565b611794613e56565b600054610100900460ff166117945760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108cd565b60fb805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f5c59b35744b3cdb8be062a730b21cf86bccb29870598a2c2983afbacea92f19290602001610853565b610103805467ffffffffffffffff191667ffffffffffffffff83169081179091556040519081527f1fa3863a9436758fa43274faeb83146c9f39308a904ac7aac6d3e1af5979039b90602001610853565b610101805460ff19168215159081179091556040519081527f1394f6e38da5dfefadfab6dbde079d41568de78947255bf25fb59d5ce70102bd90602001610853565b61010180548215156101000261ff00199091161790556040517f5e1ae1b9c820ba5776bcbdec281533441fbb6f7a9cf724b85699f3f5318d61419061085390831515815260200190565b6097546001600160a01b03163314806131e2575060fb546001600160a01b031633145b6132405760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a206f6e6c79206f776e6572206f7220696e60448201526834ba34b0b634bd32b960b91b60648201526084016108cd565b61324d6020820182614930565b67ffffffffffffffff8116600090815260fd6020908152604090912060010154908301359081146132cc5760405162461bcd60e51b8152602060048201526024808201527f4173746572697a6d436c69656e743a2077726f6e6720736f75726365206164646044820152637265737360e01b60648201526084016108cd565b60a0830135600081815260fe6020526040902054610100900460ff16156133475760405162461bcd60e51b815260206004820152602960248201527f4173746572697a6d436c69656e743a207472616e7366657220657865637574656044820152686420616c726561647960b81b60648201526084016108cd565b60a0840135600090815260fe60209081526040909120805460ff191660011790557fff95c8c7c3e8067d7742d009490d82eea9496f5df16e46a120d41693763a41bc9061339690860186614930565b6040805167ffffffffffffffff9092168252602080880135908301526080808801359183019190915260a0870135606083015201611a6e565b6080810151600081815260ff6020819052604090912054166134485760405162461bcd60e51b815260206004820152602c60248201527f4173746572697a6d436c69656e743a206f7574626f756e64207472616e73666560448201526b72206e6f742065786973747360a01b60648201526084016108cd565b6080820151600081815260ff6020819052604090912054610100900416156134d85760405162461bcd60e51b815260206004820152603260248201527f4173746572697a6d436c69656e743a206f7574626f756e64207472616e73666560448201527f7220657865637574656420616c7265616479000000000000000000000000000060648201526084016108cd565b82604001514710156135525760405162461bcd60e51b815260206004820152602e60248201527f4173746572697a6d436c69656e743a20636f6e74726163742062616c616e636560448201527f206973206e6f7420656e6f75676800000000000000000000000000000000000060648201526084016108cd565b61010254836060015111156135a95760405162461bcd60e51b815260206004820181905260248201527f4173746572697a6d436c69656e743a2077726f6e67207478496420706172616d60448201526064016108cd565b825160208085015160608087015160808089015160fc5461010154610103546040805160e080820183526000808352828d01819052828401819052828b0181905282890181905260a080840182905260c0938401919091528351918201845267ffffffffffffffff909d1681529a8b019990995296890195909552948701919091526001600160a01b039081169186019190915260ff9092161515948401949094526801000000000000000090930490921691810182905290156138935760fb5460fc546040517f67d6bd120000000000000000000000000000000000000000000000000000000081526000926001600160a01b03908116926367d6bd12926136ba92909116908690600401614ed1565b602060405180830381865afa1580156136d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136fb9190614e05565b9050801561389157610103546040516370a0823160e01b815230600482015282916801000000000000000090046001600160a01b0316906370a0823190602401602060405180830381865afa158015613758573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377c9190614e05565b10156137f05760405162461bcd60e51b815260206004820152602f60248201527f4173746572697a6d436c69656e743a2066656520746f6b656e2062616c616e6360448201527f65206973206e6f7420656e6f756768000000000000000000000000000000000060648201526084016108cd565b6101035460fb546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201526024810184905268010000000000000000909204169063095ea7b3906044016020604051808303816000875af115801561386b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061388f9190614eb4565b505b505b60fb5460408086015190517f5fab82840000000000000000000000000000000000000000000000000000000081526001600160a01b0390921691635fab828491906138e2908590600401614f49565b6000604051808303818588803b1580156138fb57600080fd5b505af115801561390f573d6000803e3d6000fd5b505050608090950151600090815260ff60205260409020805461ff0019166101001790555050505050565b600061398f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613ec19092919063ffffffff16565b80519091501561177d57808060200190518101906139ad9190614eb4565b61177d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016108cd565b6000808787878787613a3088613eda565b604051602001613a4596959493929190614fb1565b6040516020818303038152906040529050613a5f86613f5e565b60ff16613a6b89613f5e565b60ff1614613a8157613a7c81613fdb565b613a8a565b613a8a81614394565b98975050505050505050565b6001600160a01b0381163b613b135760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016108cd565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b613b6a836143e6565b600082511180613b775750805b1561177d57610dbe8383614426565b600081613b97898989898989613a1f565b1498975050505050505050565b6000806000806000808660c00151806020019051810190613bc5919061501f565b955095509550955095509550613c408760000151886020015189604001518a606001518b608001518b8b8b8b8b604051602001613c2795949392919094855260208501939093526040840191909152606083015260ff16608082015260a00190565b6040516020818303038152906040528d60a00151613b86565b613cb15760405162461bcd60e51b8152602060048201526024808201527f47617353746174696f6e3a207472616e73666572206861736820697320696e7660448201527f616c69640000000000000000000000000000000000000000000000000000000060648201526084016108cd565b856000613cbf84600a614d10565b613cc98489615074565b613cd39190614d35565b90506001600160a01b0382163014613d8a576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613d32576040519150601f19603f3d011682016040523d82523d6000602084013e613d37565b606091505b5050905080613d885760405162461bcd60e51b815260206004820152601a60248201527f47617353746174696f6e3a207472616e73666572206572726f7200000000000060448201526064016108cd565b505b60808901516040805183815260208101929092526001600160a01b03841682820152517fa3be16725f18781679eee1b21b2c2a762a8fefd0e0ae84959d2af1693339ab319181900360600190a1505050505050505050565b600054610100900460ff16613e4d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108cd565b61179433612a30565b600054610100900460ff166128385760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016108cd565b6060613ed0848460008561444b565b90505b9392505050565b6060600080600080600086806020019051810190613ef8919061508b565b604080516020810196909652858101949094526060850192909252608084015260f81b7fff000000000000000000000000000000000000000000000000000000000000001660a08301528051608181840301815260a19092019052979650505050505050565b60fb546040516327b465b560e11b815267ffffffffffffffff831660048201526000916001600160a01b031690634f68cb6a90602401602060405180830381865afa158015613fb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fd59190614e57565b92915050565b60408051607080825260a0820190925260009182919060208201818036833701905050905060005b60708110156140645783818151811061401e5761401e614d1f565b602001015160f81c60f81b82828151811061403b5761403b614d1f565b60200101906001600160f81b031916908160001a9053508061405c81614d6a565b915050614003565b5060008151845161407591906150d8565b67ffffffffffffffff81111561408d5761408d61466e565b6040519080825280601f01601f1916602001820160405280156140b7576020820181803683370190505b5082519091505b845181101561412b578481815181106140d9576140d9614d1f565b602001015160f81c60f81b828451836140f291906150d8565b8151811061410257614102614d1f565b60200101906001600160f81b031916908160001a9053508061412381614d6a565b9150506140be565b508051604051607f90600090600290614145908790614e3b565b602060405180830381855afa158015614162573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906141859190614e05565b905060005b61419760ff841685614d35565b81116143895760006141ac8260ff8616615074565b90506000856141be60ff871684614d57565b11156141ca57856141d7565b6141d760ff861683614d57565b905060006141e583836150d8565b67ffffffffffffffff8111156141fd576141fd61466e565b6040519080825280601f01601f191660200182016040528015614227576020820181803683370190505b509050825b828110156142b15788818151811061424657614246614d1f565b01602001517fff00000000000000000000000000000000000000000000000000000000000000168261427886846150d8565b8151811061428857614288614d1f565b60200101906001600160f81b031916908160001a905350806142a981614d6a565b91505061422c565b506002856002836040516142c59190614e3b565b602060405180830381855afa1580156142e2573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906143059190614e05565b60408051602081019390935282015260600160408051601f198184030181529082905261433191614e3b565b602060405180830381855afa15801561434e573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906143719190614e05565b9450505050808061438190614d6a565b91505061418a565b509695505050505050565b60006002826040516143a69190614e3b565b602060405180830381855afa1580156143c3573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190613fd59190614e05565b6143ef81613a96565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060613ed383836040518060600160405280602781526020016150ff6027913961453f565b6060824710156144c35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016108cd565b600080866001600160a01b031685876040516144df9190614e3b565b60006040518083038185875af1925050503d806000811461451c576040519150601f19603f3d011682016040523d82523d6000602084013e614521565b606091505b5091509150614532878383876145b7565b925050505b949350505050565b6060600080856001600160a01b03168560405161455c9190614e3b565b600060405180830381855af49150503d8060008114614597576040519150601f19603f3d011682016040523d82523d6000602084013e61459c565b606091505b50915091506145ad868383876145b7565b9695505050505050565b6060831561462657825160000361461f576001600160a01b0385163b61461f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108cd565b5081614537565b614537838381511561463b5781518083602001fd5b8060405162461bcd60e51b81526004016108cd91906150eb565b60006020828403121561466757600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156146ad576146ad61466e565b604052919050565b600067ffffffffffffffff8211156146cf576146cf61466e565b5060051b60200190565b67ffffffffffffffff811681146112ab57600080fd5b600082601f83011261470057600080fd5b81356020614715614710836146b5565b614684565b82815260059290921b8401810191818101908684111561473457600080fd5b8286015b848110156143895780358352918301918301614738565b6001600160a01b03811681146112ab57600080fd5b803561476f8161474f565b919050565b6000806000806080858703121561478a57600080fd5b843567ffffffffffffffff808211156147a257600080fd5b818701915087601f8301126147b657600080fd5b813560206147c6614710836146b5565b82815260059290921b8401810191818101908b8411156147e557600080fd5b948201945b8386101561480c5785356147fd816146d9565b825294820194908201906147ea565b9850508801359250508082111561482257600080fd5b61482e888389016146ef565b9450604087013591508082111561484457600080fd5b50614851878288016146ef565b92505061486060608601614764565b905092959194509250565b60006020828403121561487d57600080fd5b8135613ed38161474f565b6000806040838503121561489b57600080fd5b82356148a68161474f565b915060208381013567ffffffffffffffff808211156148c457600080fd5b818601915086601f8301126148d857600080fd5b8135818111156148ea576148ea61466e565b6148fc601f8201601f19168501614684565b9150808252878482850101111561491257600080fd5b80848401858401376000848284010152508093505050509250929050565b60006020828403121561494257600080fd5b8135613ed3816146d9565b60008060006060848603121561496257600080fd5b833561496d8161474f565b9250602084013561497d8161474f565b929592945050506040919091013590565b60008060008060008060a087890312156149a757600080fd5b86356149b2816146d9565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff808211156149e457600080fd5b818901915089601f8301126149f857600080fd5b813581811115614a0757600080fd5b8a6020828501011115614a1957600080fd5b6020830194508093505050509295509295509295565b80151581146112ab57600080fd5b600080600060608486031215614a5257600080fd5b8335614a5d8161474f565b92506020840135614a6d81614a2f565b91506040840135614a7d81614a2f565b809150509250925092565b60008083601f840112614a9a57600080fd5b50813567ffffffffffffffff811115614ab257600080fd5b6020830191508360208260051b8501011115614acd57600080fd5b9250929050565b60008060008060408587031215614aea57600080fd5b843567ffffffffffffffff80821115614b0257600080fd5b614b0e88838901614a88565b90965094506020870135915080821115614b2757600080fd5b50614b3487828801614a88565b95989497509550505050565b600060c08284031215614b5257600080fd5b50919050565b60008060408385031215614b6b57600080fd5b8235614b768161474f565b946020939093013593505050565b60ff811681146112ab57600080fd5b60008060408385031215614ba657600080fd5b823591506020830135614bb881614b84565b809150509250929050565b60008060408385031215614bd657600080fd5b8235614b76816146d9565b600080600060608486031215614bf657600080fd5b8335614c01816146d9565b95602085013595506040909401359392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115614c67578160001904821115614c4d57614c4d614c16565b80851615614c5a57918102915b93841c9390800290614c31565b509250929050565b600082614c7e57506001613fd5565b81614c8b57506000613fd5565b8160018114614ca15760028114614cab57614cc7565b6001915050613fd5565b60ff841115614cbc57614cbc614c16565b50506001821b613fd5565b5060208310610133831016604e8410600b8410161715614cea575081810a613fd5565b614cf48383614c2c565b8060001904821115614d0857614d08614c16565b029392505050565b6000613ed360ff841683614c6f565b634e487b7160e01b600052603260045260246000fd5b600082614d5257634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115613fd557613fd5614c16565b600060018201614d7c57614d7c614c16565b5060010190565b60005b83811015614d9e578181015183820152602001614d86565b50506000910152565b60008151808452614dbf816020860160208601614d83565b601f01601f19169290920160200192915050565b67ffffffffffffffff84168152826020820152606060408201526000614dfc6060830184614da7565b95945050505050565b600060208284031215614e1757600080fd5b5051919050565b600060208284031215614e3057600080fd5b8151613ed3816146d9565b60008251614e4d818460208701614d83565b9190910192915050565b600060208284031215614e6957600080fd5b8151613ed381614b84565b67ffffffffffffffff8616815284602082015283604082015282606082015260a060808201526000614ea960a0830184614da7565b979650505050505050565b600060208284031215614ec657600080fd5b8151613ed381614a2f565b6001600160a01b03831681526101008101613ed3602083018467ffffffffffffffff815116825260208101516020830152604081015160408301526060810151606083015260808101516001600160a01b03808216608085015260a0830151151560a08501528060c08401511660c085015250505050565b60e08101613fd5828467ffffffffffffffff815116825260208101516020830152604081015160408301526060810151606083015260808101516001600160a01b03808216608085015260a0830151151560a08501528060c08401511660c085015250505050565b60007fffffffffffffffff000000000000000000000000000000000000000000000000808960c01b168352876008840152808760c01b16602884015250846030830152836050830152825161500d816070850160208701614d83565b91909101607001979650505050505050565b60008060008060008060c0878903121561503857600080fd5b86519550602087015194506040870151935060608701519250608087015161505f81614b84565b8092505060a087015190509295509295509295565b8082028115828204841417613fd557613fd5614c16565b600080600080600060a086880312156150a357600080fd5b8551945060208601519350604086015192506060860151915060808601516150ca81614b84565b809150509295509295909350565b81810381811115613fd557613fd5614c16565b602081526000613ed36020830184614da756fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220dd3e020da70fad7ee4e48a49f6e985e0d3d02123d3f985867541f1f06335722d64736f6c63430008110033