Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- XYCrossChainRelay
- Optimization enabled
- true
- Compiler version
- v0.8.2+commit.661d1103
- Optimization runs
- 200
- EVM Version
- istanbul
- Verified at
- 2024-03-21T05:58:03.724348Z
Constructor Arguments
000000000000000000000000000000000000000000000000000000000000290b000000000000000000000000cd982cad5051a6c19414736acd55e39b8c8dcc5c00000000000000000000000050a64d05bb8618d8d96a83cbbb12b3044ec3489a0000000000000000000000000132613b3a1061816f4661ad301612910e3cce0b0000000000000000000000000132613b3a1061816f4661ad301612910e3cce0b000000000000000000000000cd982cad5051a6c19414736acd55e39b8c8dcc5c000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000d3c21bcecceda1000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000001452656465656d61626c65204e756d20546f6b656e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e52656465656d61626c65204e554d000000000000000000000000000000000000
Arg [0] (&amp;amp;amp;amp;amp;amp;amp;amp;lt;b&amp;amp;amp;amp;amp;amp;amp;amp;gt;uint32&amp;amp;amp;amp;amp;amp;amp;amp;lt;/b&amp;amp;amp;amp;amp;amp;amp;amp;gt;) : 10507 Arg [1] (&amp;amp;amp;amp;amp;amp;amp;lt;b&amp;amp;amp;amp;amp;amp;amp;gt;address&amp;amp;amp;amp;amp;amp;amp;lt;/b&amp;amp;amp;amp;amp;amp;amp;gt;) : &amp;amp;amp;amp;amp;amp;amp;lt;a href=&amp;amp;amp;amp;amp;amp;amp;quot;{#{address_path(@conn, :show, @address)}}&amp;amp;amp;amp;amp;amp;amp;quot;&amp;amp;amp;amp;amp;amp;amp;gt;0xcd982cad5051a6c19414736acd55e39b8c8dcc5c&amp;amp;amp;amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;amp;amp;amp;gt; Arg [2] (&amp;amp;amp;amp;amp;amp;lt;b&amp;amp;amp;amp;amp;amp;gt;address&amp;amp;amp;amp;amp;amp;lt;/b&amp;amp;amp;amp;amp;amp;gt;) : &amp;amp;amp;amp;amp;amp;lt;a href=&amp;amp;amp;amp;amp;amp;quot;{#{address_path(@conn, :show, @address)}}&amp;amp;amp;amp;amp;amp;quot;&amp;amp;amp;amp;amp;amp;gt;0x50a64d05bb8618d8d96a83cbbb12b3044ec3489a&amp;amp;amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;amp;amp;gt; Arg [3] (&amp;amp;amp;amp;amp;lt;b&amp;amp;amp;amp;amp;gt;address&amp;amp;amp;amp;amp;lt;/b&amp;amp;amp;amp;amp;gt;) : &amp;amp;amp;amp;amp;lt;a href=&amp;amp;amp;amp;amp;quot;{#{address_path(@conn, :show, @address)}}&amp;amp;amp;amp;amp;quot;&amp;amp;amp;amp;amp;gt;0x0132613b3a1061816f4661ad301612910e3cce0b&amp;amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;amp;gt; Arg [4] (&amp;amp;amp;amp;lt;b&amp;amp;amp;amp;gt;address&amp;amp;amp;amp;lt;/b&amp;amp;amp;amp;gt;) : &amp;amp;amp;amp;lt;a href=&amp;amp;amp;amp;quot;{#{address_path(@conn, :show, @address)}}&amp;amp;amp;amp;quot;&amp;amp;amp;amp;gt;0x0132613b3a1061816f4661ad301612910e3cce0b&amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;gt; Arg [5] (&amp;amp;amp;lt;b&amp;amp;amp;gt;address&amp;amp;amp;lt;/b&amp;amp;amp;gt;) : &amp;amp;amp;lt;a href=&amp;amp;amp;quot;{#{address_path(@conn, :show, @address)}}&amp;amp;amp;quot;&amp;amp;amp;gt;0xcd982cad5051a6c19414736acd55e39b8c8dcc5c&amp;amp;amp;lt;/a&amp;amp;amp;gt; Arg [6] (&amp;amp;lt;b&amp;amp;gt;address&amp;amp;lt;/b&amp;amp;gt;) : &amp;amp;lt;a href=&amp;amp;quot;{#{address_path(@conn, :show, @address)}}&amp;amp;quot;&amp;amp;gt;0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&amp;amp;lt;/a&amp;amp;gt; Arg [7] (&amp;lt;b&amp;gt;bool&amp;lt;/b&amp;gt;) : true Arg [8] (&lt;b&gt;uint256&lt;/b&gt;) : 1000000000000000000000000 Arg [9] (<b>string</b>) : Redeemable Num Token Arg [10] (<b>string</b>) : Redeemable NUM
XYCrossChainRelay.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.2;
import "AccessControl.sol";
import "Pausable.sol";
import "SafeERC20.sol";
import "ERC20.sol";
import "ECDSA.sol";
import { Address } from "Address.sol";
import { Supervisor } from "Supervisor.sol";
import { IERC20MintBurnable } from "IERC20MintBurnable.sol";
/// @title XYCrossChainRelay relays token across different chains. It also inherits from ERC-20, which
/// serves as the redeemable tokens. Tokens are minted when liquidity is deposited and are burnt when
/// liquidity is withdrawn
contract XYCrossChainRelay is ERC20, AccessControl, Pausable {
using ECDSA for bytes32;
using SafeERC20 for IERC20MintBurnable;
using SafeERC20 for IERC20;
/* ========== CONSTANTS ========== */
address public constant ETHER_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
// Roles in this contract
// Owner: the admin of `ROLE_MANAGER`
bytes32 public constant ROLE_OWNER = keccak256("ROLE_OWNER");
// Manager: able to pause/unpause contract
bytes32 public constant ROLE_MANAGER = keccak256("ROLE_MANAGER");
// Staff: able to relay cross chain requests
bytes32 public constant ROLE_STAFF = keccak256("ROLE_STAFF");
/* ========== STATE VARIABLES ========== */
uint32 public immutable thisChainId;
// If `token` is Primitive Token, which means the token is not mint/burnable by us.
// We can only transfer `token`s.
bool public immutable isPrimitive;
// A contract that supervises each cross chain relay by providing signatures
Supervisor public immutable supervisor;
// Token to be bridged
address public immutable token;
// If this flag is true, token bridge will be able to mint redeemable token to receiver when there is no liquidity during completeCrossChainRequest.
// Otherwise, tx will fail when there is no liqiuidity.
bool public isAbleToMintIfNoLiquidity;
// Treasury where cross chain fees are sent to
address public treasury;
address public pendingTreasury;
// Max amount of `token` allowed in each cross chain request
uint256 public maxCrossChainAmount;
// Number of the cross chain requests
uint256 public numCrossChainRequests;
// Mapping of completed cross chain requests: source chain id => request id => request
mapping (uint32 => mapping (uint256 => bool)) public completedCrossChainRequest;
/* ========== CONSTRUCTOR ========== */
/// @param chainId The ID of this chain, passed in as param for easier configuration for testing
/// @param _treasury The Treasury address
/// @param _supervisor The Supervisor address
/// @param owner The owner address
/// @param manager The manager address
/// @param staff The staff address
/// @param _token The token address
/// @param _isPrimitive Is `_token` primitive token (which we don't have mint/burn privilege)
/// @param _maxCrossChainAmount Max cross chain amount
/// @param _redeemableTokenName The name of the Redeemable Token
/// @param _redeemableTokenSymbol The symbol of the Redeemable Token
constructor(
uint32 chainId,
address _treasury,
address _supervisor,
address owner,
address manager,
address staff,
address _token,
bool _isPrimitive,
uint256 _maxCrossChainAmount,
string memory _redeemableTokenName,
string memory _redeemableTokenSymbol
) ERC20(_redeemableTokenName, _redeemableTokenSymbol) {
require(Address.isContract(_supervisor), "ERR_SUPERVISOR_NOT_CONTRACT");
supervisor = Supervisor(_supervisor);
// Token can only be either native (ETHER_ADDRESS) or ERC-20 token
if (_token != ETHER_ADDRESS) {
require(Address.isContract(_token), "ERR_TOKEN_NOT_CONTRACT");
} else {
// If it's native token, it must be primitive since we cannot mint/burn it
require(_isPrimitive, "ERR_NATIVE_TOKEN_NOT_PRIMITIVE");
}
// Token can only be either native (ETHER_ADDRESS) or ERC-20 token
token = _token;
thisChainId = chainId;
isPrimitive = _isPrimitive;
treasury = _treasury;
maxCrossChainAmount = _maxCrossChainAmount;
_setRoleAdmin(ROLE_OWNER, ROLE_OWNER);
_setRoleAdmin(ROLE_MANAGER, ROLE_OWNER);
_setRoleAdmin(ROLE_STAFF, ROLE_MANAGER);
_setupRole(ROLE_OWNER, owner);
_setupRole(ROLE_MANAGER, manager);
_setupRole(ROLE_STAFF, staff);
}
/* ========== MODIFIERS ========== */
modifier onlyPrimitiveToken() {
require(isPrimitive, "ERR_NOT_PRIMITIVE_TOKEN");
_;
}
/* ========== INTERNAL FUNCTIONS ========== */
/// @notice Transfer ERC-20 token from user and check balance change
/// @param sender The address to transfer token from
/// @param amount Amount of the token to be transferred
function _safeTransferAssetFrom(address sender, uint256 amount) private {
uint256 bal = IERC20(token).balanceOf(address(this));
IERC20(token).safeTransferFrom(sender, address(this), amount);
bal = IERC20(token).balanceOf(address(this)) - bal;
require(bal == amount, "ERR_AMOUNT_NOT_ENOUGH");
}
/// @notice Unified transfer interface for native token and ERC20 token
/// @param _token Address of the token. Can be either `ETH_ADDRESS` for native token or ERC-20 token address
/// @param receiver The address to receive token
/// @param amount Amount of the token to be transferred
function _safeTransferTokenUnified(address _token, address receiver, uint256 amount) private {
if (_token == ETHER_ADDRESS) {
payable(receiver).transfer(amount);
} else {
IERC20(_token).safeTransfer(receiver, amount);
}
}
/// @notice Unified get balance interface for native token and ERC20 token
/// @param _token Address of the token. Can be either `ETH_ADDRESS` for native token or ERC-20 token address
function _getTokenBalanceUnified(address _token) view private returns (uint256) {
if (_token == ETHER_ADDRESS) {
return address(this).balance;
} else {
return IERC20(_token).balanceOf(address(this));
}
}
/* ========== RESTRICTED FUNCTIONS (TREASURY) ========== */
function proposeNewTreasury(address newTreasury) external {
require(msg.sender == treasury, "ERR_NOT_TREASURY");
pendingTreasury = newTreasury;
emit NewTreasuryProposed(newTreasury);
}
function acceptNewTreasury() external {
require(msg.sender == pendingTreasury, "ERR_NOT_PENDING_TREASURY");
pendingTreasury = address(0);
treasury = msg.sender;
emit NewTreasuryAccepted(msg.sender);
}
/* ========== RESTRICTED FUNCTIONS (OWNER) ========== */
/// @notice Rescue fund accidentally sent to this contract. Token can be rescued only if it's not `token`
/// @param tokens List of token address to rescue
function rescue(IERC20[] memory tokens) external onlyRole(ROLE_OWNER) {
for (uint256 i; i < tokens.length; i++) {
IERC20 _token = tokens[i];
require(token != address(_token), "ERR_CAN_NOT_RESCUE_BRIDGE_TOKEN");
uint256 _tokenBalance = _getTokenBalanceUnified(address(_token));
_safeTransferTokenUnified(address(_token), msg.sender, _tokenBalance);
}
}
/* ========== RESTRICTED FUNCTIONS (MANAGER) ========== */
/// @notice Pause the contract (could be executed only by manager)
function pause() external onlyRole(ROLE_MANAGER) {
_pause();
}
/// @notice Unpause the contract (could be executed only by manager)
function unpause() external onlyRole(ROLE_MANAGER) {
_unpause();
}
/// @notice Set max cross chain amount (could be executed only by manager)
/// @param newMaxCrossChainAmount New max cross chain amount
function setMaxCrossChainAmount(uint256 newMaxCrossChainAmount) external onlyRole(ROLE_MANAGER) {
maxCrossChainAmount = newMaxCrossChainAmount;
}
/// @notice Set isAbleToMintIfNoLiquidity flag
/// @param _set Switch on or off isAbleToMintIfNoLiquidity
function setIsAbleToMintIfNoLiquidity(bool _set) external onlyPrimitiveToken onlyRole(ROLE_MANAGER) {
isAbleToMintIfNoLiquidity = _set;
emit IsAbleToMintIfNoLiquiditySet(msg.sender, _set);
}
/* ========== RESTRICTED FUNCTIONS (STAFF) ========== */
/// @notice Complete a cross chain request
/// @param requestId ID of the cross chain request on the source chain
/// @param sourceChainId Chain Id of the source chain
/// @param receiver Receiver of the `token`
/// @param amount Amount of `token`
/// @param fee Fee amount (denominated in `token`)
/// @param signatures Signatures of validators
function completeCrossChainRequest(uint256 requestId, uint32 sourceChainId, address receiver, uint256 amount, uint256 fee, bytes[] memory signatures) external whenNotPaused onlyRole(ROLE_STAFF) {
require(!completedCrossChainRequest[sourceChainId][requestId], "ERR_CROSS_CHAIN_REQUEST_ALREADY_COMPLETE");
require(amount > fee, "ERR_FEE_GREATER_THAN_AMOUNT");
require(amount <= maxCrossChainAmount, "ERR_INVALID_CROSS_CHAIN_AMOUNT");
bytes32 sigId = keccak256(abi.encodePacked(supervisor.VALIDATE_XY_CROSS_CHAIN_IDENTIFIER(), address(this), sourceChainId, thisChainId, requestId, receiver, amount, fee));
bytes32 sigIdHash = sigId.toEthSignedMessageHash();
supervisor.checkSignatures(sigIdHash, signatures);
uint256 amountSubFee = amount - fee;
bool isRedeemableTokenMinted = false;
if (isPrimitive) {
if (checkBridgeLiquidityEnough(amount)) {
_safeTransferTokenUnified(token, receiver, amountSubFee);
_safeTransferTokenUnified(token, treasury, fee);
} else {
require(isAbleToMintIfNoLiquidity, "ERR_NO_MINT_WHEN_NO_LIQUIDITY");
isRedeemableTokenMinted = true;
// Mint redeemable token to receiver
_mint(receiver, amountSubFee);
_mint(treasury, fee);
}
} else {
IERC20MintBurnable(token).mint(receiver, amountSubFee);
IERC20MintBurnable(token).mint(treasury, fee);
}
completedCrossChainRequest[sourceChainId][requestId] = true;
emit CrossChainCompleted(requestId, sourceChainId, thisChainId, receiver, amount, fee, isRedeemableTokenMinted);
}
/* ========== VIEW FUNCTIONS ========== */
/// @notice check if token bridge liquidity is enough
/// @param amount Amount of `token`
function checkBridgeLiquidityEnough(uint256 amount) public view returns (bool) {
uint256 balance = _getTokenBalanceUnified(token);
return (amount <= balance);
}
/* ========== WRITE FUNCTIONS ========== */
/// @notice Request to bridge `token` cross chain
/// @param destChainId Chain Id of the destination chain
/// @param receiver Receiver of the `token` on destination chain
/// @param amount Amount of `token` to send cross chain
function requestCrossChain(uint32 destChainId, address receiver, uint256 amount) external payable whenNotPaused {
require(amount > 0 && amount <= maxCrossChainAmount, "ERR_INVALID_CROSS_CHAIN_AMOUNT");
uint256 id = numCrossChainRequests++;
// Transfer token from sender
if (token == ETHER_ADDRESS) {
require(msg.value == amount, "ERR_MSG_VALUE_AMOUNT_MISMATCHED");
} else {
require(msg.value == 0, "ERR_EXPECTED_ZERO_MSG_VALUE");
_safeTransferAssetFrom(msg.sender, amount);
if (!isPrimitive) {
IERC20MintBurnable(token).burn(amount);
}
}
emit CrossChainRequested(id, thisChainId, destChainId, msg.sender, receiver, amount);
}
function deposit(uint256 amount) payable external whenNotPaused onlyPrimitiveToken {
require(amount > 0, "ERR_ZERO_AMOUNT");
// Transfer token from depositor
if (token == ETHER_ADDRESS) {
require(msg.value == amount, "ERR_MSG_VALUE_AMOUNT_MISMATCHED");
} else {
require(msg.value == 0, "ERR_EXPECTED_ZERO_MSG_VALUE");
_safeTransferAssetFrom(msg.sender, amount);
}
// Mint 1:1 LP token to depositor
_mint(msg.sender, amount);
emit Deposited(msg.sender, amount);
}
function withdraw(uint256 amount) external whenNotPaused onlyPrimitiveToken {
require(amount > 0, "ERR_ZERO_AMOUNT");
// Burn withdrawer LP token
_burn(msg.sender, amount);
// Transfer 1:1 token to withdrawer.
_safeTransferTokenUnified(token, msg.sender, amount);
emit Withdrawn(msg.sender, amount);
}
/* ========== EVENTS ========== */
event NewTreasuryProposed(address newTreasury);
event NewTreasuryAccepted(address newTreasury);
event CrossChainRequested(uint256 indexed requestId, uint32 sourceChainId, uint32 indexed destChainId, address indexed sender, address receiver, uint256 amount);
event CrossChainCompleted(uint256 indexed requestId, uint32 indexed sourceChainId, uint32 destChainId, address indexed receiver, uint256 amount, uint256 fee, bool isRedeemableTokenMinted);
event Deposited(address indexed sender, uint256 amount);
event Withdrawn(address indexed sender, uint256 amount);
event IsAbleToMintIfNoLiquiditySet(address sender, bool isSet);
}
AccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "IAccessControl.sol";
import "Context.sol";
import "Strings.sol";
import "ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role, _msgSender());
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
function _grantRole(bytes32 role, address account) private {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
function _revokeRole(bytes32 role, address account) private {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
Address.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev 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) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @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 Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
ECDSA.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
ERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "IERC20.sol";
import "IERC20Metadata.sol";
import "Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
Strings.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
IAccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}
IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
IERC20Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
IERC20MintBurnable.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.2;
import "IERC20.sol";
interface IERC20MintBurnable is IERC20 {
function mint(address account, uint256 amount) external;
function burn(uint256 amount) external;
}
Pausable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
SafeERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "IERC20.sol";
import "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));
}
}
/**
* @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");
}
}
}
Supervisor.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.2;
import "ECDSA.sol";
/// @title Supervisor is the guardian of YPool. It requires multiple validators to valid
/// the requests from users and workers and sign on them if valid.
contract Supervisor {
using ECDSA for bytes32;
/* ========== STATE VARIABLES ========== */
bytes32 public constant SET_THRESHOLD_IDENTIFIER = 'SET_THRESHOLD';
bytes32 public constant SET_VALIDATOR_IDENTIFIER = 'SET_VALIDATOR';
bytes32 public constant VALIDATE_XY_CROSS_CHAIN_IDENTIFIER = 'VALIDATE_XY_XCHAIN_IDENTIFIER';
// the chain ID contract located at
uint32 immutable public chainId;
// number of validators
uint256 public validatorsNum;
// threshold to pass the signature validation
uint256 public threshold;
// current nonce for write functions
uint256 public nonce;
// check if the address is one of the validators
mapping (address => bool) public validators;
/// @dev Constuctor with chainId / validators / threshold
/// @param _chainId The chain ID located with
/// @param _validators Initial validator addresses
/// @param _threshold Initial threshold to pass the request validation
constructor(uint32 _chainId, address [] memory _validators, uint256 _threshold) {
chainId = _chainId;
for (uint256 i; i < _validators.length; i++) {
validators[_validators[i]] = true;
}
validatorsNum = _validators.length;
require(_threshold <= validatorsNum, "ERR_INVALID_THRESHOLD");
threshold = _threshold;
}
/* ========== VIEW FUNCTIONS ========== */
/// @notice Check if there are enough signed signatures to the signature hash
/// @param sigIdHash The signature hash to be signed
/// @param signatures Signed signatures by different validators
function checkSignatures(bytes32 sigIdHash, bytes[] memory signatures) public view {
require(signatures.length >= threshold, "ERR_NOT_ENOUGH_SIGNATURES");
address prevAddress = address(0);
for (uint i; i < threshold; i++) {
address recovered = sigIdHash.recover(signatures[i]);
require(validators[recovered], "ERR_NOT_VALIDATOR");
require(recovered > prevAddress, "ERR_WRONG_SIGNER_ORDER");
prevAddress = recovered;
}
}
/* ========== WRITE FUNCTIONS ========== */
/// @notice Change `threshold` by providing a correct nonce and enough signatures from validators
/// @param _threshold New `threshold`
/// @param _nonce The nonce to be processed
/// @param signatures Signed signatures by validators
function setThreshold(uint256 _threshold, uint256 _nonce, bytes[] memory signatures) external {
require(signatures.length >= threshold, "ERR_NOT_ENOUGH_SIGNATURES");
require(_nonce == nonce, "ERR_INVALID_NONCE");
require(_threshold > 0, "ERR_INVALID_THRESHOLD");
require(_threshold <= validatorsNum, "ERR_INVALID_THRESHOLD");
bytes32 sigId = keccak256(abi.encodePacked(SET_THRESHOLD_IDENTIFIER, address(this), chainId, _threshold, _nonce));
bytes32 sigIdHash = sigId.toEthSignedMessageHash();
checkSignatures(sigIdHash, signatures);
threshold = _threshold;
nonce++;
}
/// @notice Set / remove the validator address to be part of signatures committee
/// @param _validator The address to add or remove
/// @param flag `true` to add, `false` to remove
/// @param _nonce The nonce to be processed
/// @param signatures Signed signatures by validators
function setValidator(address _validator, bool flag, uint256 _nonce, bytes[] memory signatures) external {
require(_validator != address(0), "ERR_INVALID_VALIDATOR");
require(signatures.length >= threshold, "ERR_NOT_ENOUGH_SIGNATURES");
require(_nonce == nonce, "ERR_INVALID_NONCE");
require(flag != validators[_validator], "ERR_OPERATION_TO_VALIDATOR");
bytes32 sigId = keccak256(abi.encodePacked(SET_VALIDATOR_IDENTIFIER, address(this), chainId, _validator, flag, _nonce));
bytes32 sigIdHash = sigId.toEthSignedMessageHash();
checkSignatures(sigIdHash, signatures);
if (validators[_validator]) {
validatorsNum--;
validators[_validator] = false;
if (validatorsNum < threshold) threshold--;
} else {
validatorsNum++;
validators[_validator] = true;
}
nonce++;
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{"XYCrossChainRelay.sol":{}},"evmVersion":"istanbul"}
Contract ABI
[{"type":"constructor","inputs":[{"type":"uint32","name":"chainId","internalType":"uint32"},{"type":"address","name":"_treasury","internalType":"address"},{"type":"address","name":"_supervisor","internalType":"address"},{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"manager","internalType":"address"},{"type":"address","name":"staff","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"bool","name":"_isPrimitive","internalType":"bool"},{"type":"uint256","name":"_maxCrossChainAmount","internalType":"uint256"},{"type":"string","name":"_redeemableTokenName","internalType":"string"},{"type":"string","name":"_redeemableTokenSymbol","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ETHER_ADDRESS","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ROLE_MANAGER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ROLE_OWNER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ROLE_STAFF","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptNewTreasury","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"checkBridgeLiquidityEnough","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"completeCrossChainRequest","inputs":[{"type":"uint256","name":"requestId","internalType":"uint256"},{"type":"uint32","name":"sourceChainId","internalType":"uint32"},{"type":"address","name":"receiver","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"fee","internalType":"uint256"},{"type":"bytes[]","name":"signatures","internalType":"bytes[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"completedCrossChainRequest","inputs":[{"type":"uint32","name":"","internalType":"uint32"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"decreaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"subtractedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"deposit","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"increaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"addedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isAbleToMintIfNoLiquidity","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isPrimitive","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxCrossChainAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"numCrossChainRequests","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pendingTreasury","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"proposeNewTreasury","inputs":[{"type":"address","name":"newTreasury","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"requestCrossChain","inputs":[{"type":"uint32","name":"destChainId","internalType":"uint32"},{"type":"address","name":"receiver","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rescue","inputs":[{"type":"address[]","name":"tokens","internalType":"contract IERC20[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setIsAbleToMintIfNoLiquidity","inputs":[{"type":"bool","name":"_set","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxCrossChainAmount","inputs":[{"type":"uint256","name":"newMaxCrossChainAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract Supervisor"}],"name":"supervisor","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"thisChainId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"token","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"treasury","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","indexed":true},{"type":"address","name":"spender","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false},{"type":"event","name":"CrossChainCompleted","inputs":[{"type":"uint256","name":"requestId","indexed":true},{"type":"uint32","name":"sourceChainId","indexed":true},{"type":"uint32","name":"destChainId","indexed":false},{"type":"address","name":"receiver","indexed":true},{"type":"uint256","name":"amount","indexed":false},{"type":"uint256","name":"fee","indexed":false},{"type":"bool","name":"isRedeemableTokenMinted","indexed":false}],"anonymous":false},{"type":"event","name":"CrossChainRequested","inputs":[{"type":"uint256","name":"requestId","indexed":true},{"type":"uint32","name":"sourceChainId","indexed":false},{"type":"uint32","name":"destChainId","indexed":true},{"type":"address","name":"sender","indexed":true},{"type":"address","name":"receiver","indexed":false},{"type":"uint256","name":"amount","indexed":false}],"anonymous":false},{"type":"event","name":"Deposited","inputs":[{"type":"address","name":"sender","indexed":true},{"type":"uint256","name":"amount","indexed":false}],"anonymous":false},{"type":"event","name":"IsAbleToMintIfNoLiquiditySet","inputs":[{"type":"address","name":"sender","indexed":false},{"type":"bool","name":"isSet","indexed":false}],"anonymous":false},{"type":"event","name":"NewTreasuryAccepted","inputs":[{"type":"address","name":"newTreasury","indexed":false}],"anonymous":false},{"type":"event","name":"NewTreasuryProposed","inputs":[{"type":"address","name":"newTreasury","indexed":false}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","indexed":true},{"type":"bytes32","name":"previousAdminRole","indexed":true},{"type":"bytes32","name":"newAdminRole","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","indexed":true},{"type":"address","name":"account","indexed":true},{"type":"address","name":"sender","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","indexed":true},{"type":"address","name":"account","indexed":true},{"type":"address","name":"sender","indexed":true}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","indexed":true},{"type":"address","name":"to","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","indexed":false}],"anonymous":false},{"type":"event","name":"Withdrawn","inputs":[{"type":"address","name":"sender","indexed":true},{"type":"uint256","name":"amount","indexed":false}],"anonymous":false}]
Contract Creation Code
0x6101006040523480156200001257600080fd5b5060405162003a6b38038062003a6b83398101604081905262000035916200058f565b8151829082906200004e906003906020850190620003f8565b50805162000064906004906020840190620003f8565b50506006805460ff19169055506200008889620002ef602090811b62001c2917901c565b620000da5760405162461bcd60e51b815260206004820152601b60248201527f4552525f53555045525649534f525f4e4f545f434f4e5452414354000000000060448201526064015b60405180910390fd5b6001600160601b031960608a901b1660c0526001600160a01b03851673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146200017b576200012785620002ef60201b62001c291760201c565b620001755760405162461bcd60e51b815260206004820152601660248201527f4552525f544f4b454e5f4e4f545f434f4e5452414354000000000000000000006044820152606401620000d1565b620001ca565b83620001ca5760405162461bcd60e51b815260206004820152601e60248201527f4552525f4e41544956455f544f4b454e5f4e4f545f5052494d495449564500006044820152606401620000d1565b606085901b6001600160601b03191660e09081528b901b6001600160e01b03191660805283151560f81b60a0526006805462010000600160b01b031916620100006001600160a01b038d160217905560088390556200023960008051602062003a4b83398151915280620002f9565b6200026360008051602062003a0b83398151915260008051602062003a4b833981519152620002f9565b6200028d60008051602062003a2b83398151915260008051602062003a0b833981519152620002f9565b620002a860008051602062003a4b8339815191528962000344565b620002c360008051602062003a0b8339815191528862000344565b620002de60008051602062003a2b8339815191528762000344565b5050505050505050505050620006f2565b803b15155b919050565b600082815260056020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b62000350828262000354565b5050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16620003505760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620003b43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b82805462000406906200069f565b90600052602060002090601f0160209004810192826200042a576000855562000475565b82601f106200044557805160ff191683800117855562000475565b8280016001018555821562000475579182015b828111156200047557825182559160200191906001019062000458565b506200048392915062000487565b5090565b5b8082111562000483576000815560010162000488565b80516001600160a01b0381168114620002f457600080fd5b80518015158114620002f457600080fd5b600082601f830112620004d8578081fd5b81516001600160401b0380821115620004f557620004f5620006dc565b604051601f8301601f19908116603f01168101908282118183101715620005205762000520620006dc565b816040528381526020925086838588010111156200053c578485fd5b8491505b838210156200055f578582018301518183018401529082019062000540565b838211156200057057848385830101525b9695505050505050565b805163ffffffff81168114620002f457600080fd5b60008060008060008060008060008060006101608c8e031215620005b1578687fd5b620005bc8c6200057a565b9a50620005cc60208d016200049e565b9950620005dc60408d016200049e565b9850620005ec60608d016200049e565b9750620005fc60808d016200049e565b96506200060c60a08d016200049e565b95506200061c60c08d016200049e565b94506200062c60e08d01620004b6565b6101008d01516101208e015191955093506001600160401b0381111562000651578283fd5b6200065f8e828f01620004c7565b6101408e015190935090506001600160401b038111156200067e578182fd5b6200068c8e828f01620004c7565b9150509295989b509295989b9093969950565b600281046001821680620006b457607f821691505b60208210811415620006d657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b60805160e01c60a05160f81c60c05160601c60e05160601c613232620007d9600039600081816108b701528181610d8e01528181610dbd01528181610ea201528181610f2c015281816111ac0152818161142a015281816115300152818161175501528181611a1d01528181611b47015281816124c101528181612552015261259101526000818161055c01528181610b390152610cdc01526000818161049401528181610d570152818161112001528181611606015281816116d60152611b0e01526000818161082301528181610c0801528181610fef0152611bb701526132326000f3fe6080604052600436106102725760003560e01c80636c3f39171161014f578063b625bab5116100c1578063dd62ed3e1161007a578063dd62ed3e146107cb578063e3d29c5d14610811578063e715fd511461085a578063f5b944eb14610870578063f82ca69b14610892578063fc0c546a146108a557610272565b8063b625bab51461071b578063b6b55f251461073b578063b92f0ec71461074e578063cf1d21c01461076e578063d547741f14610796578063d905ec56146107b657610272565b806395d89b411161011357806395d89b411461067b5780639b85346814610690578063a217fddf146106b0578063a457c2d7146106c5578063a9059cbb146106e5578063ab092d161461070557610272565b80636c3f3917146105bc57806370a08231146105dc5780638456cb59146106125780638ad682af1461062757806391d148541461065b57610272565b80632f2ff15d116101e85780633ce8feb1116101ac5780633ce8feb1146104f65780633f4ba83a146105165780634c229dd61461052b57806356e4b68b1461054a5780635c975abb1461057e57806361d027b31461059657610272565b80632f2ff15d14610446578063313ce56714610466578063354d49e01461048257806336568abe146104b657806339509351146104d657610272565b80632295953f1161023a5780632295953f1461032f57806322bf2e241461036a57806323b872dd1461039e578063248a9ca3146103be5780632e1a7d4d146103ee5780632ed6b75d1461040e57610272565b806301ffc9a71461027757806306fdde03146102ac578063095ea7b3146102ce57806309fe780a146102ee57806318160ddd14610310575b600080fd5b34801561028357600080fd5b50610297610292366004612d2a565b6108d9565b60405190151581526020015b60405180910390f35b3480156102b857600080fd5b506102c1610912565b6040516102a39190612fdd565b3480156102da57600080fd5b506102976102e9366004612bd5565b6109a4565b3480156102fa57600080fd5b5061030e610309366004612d52565b6109ba565b005b34801561031c57600080fd5b506002545b6040519081526020016102a3565b34801561033b57600080fd5b5061029761034a366004612e9d565b600a60209081526000928352604080842090915290825290205460ff1681565b34801561037657600080fd5b506103217f358933fb1b4f9e62c7cd3651025ad8825acb20ebbb23b09160e3867d71501ddd81565b3480156103aa57600080fd5b506102976103b9366004612b95565b61104f565b3480156103ca57600080fd5b506103216103d9366004612cd6565b60009081526005602052604090206001015490565b3480156103fa57600080fd5b5061030e610409366004612cd6565b6110fb565b34801561041a57600080fd5b5060075461042e906001600160a01b031681565b6040516001600160a01b0390911681526020016102a3565b34801561045257600080fd5b5061030e610461366004612d06565b61120b565b34801561047257600080fd5b50604051601281526020016102a3565b34801561048e57600080fd5b506102977f000000000000000000000000000000000000000000000000000000000000000081565b3480156104c257600080fd5b5061030e6104d1366004612d06565b611236565b3480156104e257600080fd5b506102976104f1366004612bd5565b6112b4565b34801561050257600080fd5b5061030e610511366004612b41565b6112f0565b34801561052257600080fd5b5061030e611397565b34801561053757600080fd5b5060065461029790610100900460ff1681565b34801561055657600080fd5b5061042e7f000000000000000000000000000000000000000000000000000000000000000081565b34801561058a57600080fd5b5060065460ff16610297565b3480156105a257600080fd5b5060065461042e906201000090046001600160a01b031681565b3480156105c857600080fd5b5061030e6105d7366004612c00565b6113bb565b3480156105e857600080fd5b506103216105f7366004612b41565b6001600160a01b031660009081526020819052604090205490565b34801561061e57600080fd5b5061030e6114cd565b34801561063357600080fd5b506103217f9f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a8981565b34801561066757600080fd5b50610297610676366004612d06565b6114ee565b34801561068757600080fd5b506102c1611519565b34801561069c57600080fd5b506102976106ab366004612cd6565b611528565b3480156106bc57600080fd5b50610321600081565b3480156106d157600080fd5b506102976106e0366004612bd5565b61155e565b3480156106f157600080fd5b50610297610700366004612bd5565b6115f7565b34801561071157600080fd5b5061032160095481565b34801561072757600080fd5b5061030e610736366004612c9e565b611604565b61030e610749366004612cd6565b6116b1565b34801561075a57600080fd5b5061030e610769366004612cd6565b611880565b34801561077a57600080fd5b5061042e73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b3480156107a257600080fd5b5061030e6107b1366004612d06565b61189f565b3480156107c257600080fd5b5061030e6118c5565b3480156107d757600080fd5b506103216107e6366004612b5d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b34801561081d57600080fd5b506108457f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016102a3565b34801561086657600080fd5b5061032160085481565b34801561087c57600080fd5b506103216000805160206131dd83398151915281565b61030e6108a0366004612e80565b611983565b3480156108b157600080fd5b5061042e7f000000000000000000000000000000000000000000000000000000000000000081565b60006001600160e01b03198216637965db0b60e01b148061090a57506301ffc9a760e01b6001600160e01b03198316145b90505b919050565b60606003805461092190613137565b80601f016020809104026020016040519081016040528092919081815260200182805461094d90613137565b801561099a5780601f1061096f5761010080835404028352916020019161099a565b820191906000526020600020905b81548152906001019060200180831161097d57829003601f168201915b5050505050905090565b60006109b1338484611c2f565b50600192915050565b60065460ff16156109e65760405162461bcd60e51b81526004016109dd90612ff0565b60405180910390fd5b7f358933fb1b4f9e62c7cd3651025ad8825acb20ebbb23b09160e3867d71501ddd610a1281335b611d53565b63ffffffff86166000908152600a602090815260408083208a845290915290205460ff1615610a945760405162461bcd60e51b815260206004820152602860248201527f4552525f43524f53535f434841494e5f524551554553545f414c52454144595f604482015267434f4d504c45544560c01b60648201526084016109dd565b828411610ae35760405162461bcd60e51b815260206004820152601b60248201527f4552525f4645455f475245415445525f5448414e5f414d4f554e54000000000060448201526064016109dd565b600854841115610b355760405162461bcd60e51b815260206004820152601e60248201527f4552525f494e56414c49445f43524f53535f434841494e5f414d4f554e54000060448201526064016109dd565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166371aca57e6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b9057600080fd5b505afa158015610ba4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc89190612cee565b6040805160208101929092526bffffffffffffffffffffffff1930606090811b8216928401929092526001600160e01b031960e08b811b821660548601527f0000000000000000000000000000000000000000000000000000000000000000901b166058840152605c83018b90529088901b16607c8201526090810186905260b0810185905260d0016040516020818303038152906040528051906020012090506000610cc2826040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6040516305a0f88360e41b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635a0f883090610d139084908890600401612f75565b60006040518083038186803b158015610d2b57600080fd5b505afa158015610d3f573d6000803e3d6000fd5b5050505060008587610d5191906130dd565b905060007f000000000000000000000000000000000000000000000000000000000000000015610e7c57610d8488611528565b15610df757610db47f00000000000000000000000000000000000000000000000000000000000000008a84611db7565b600654610df2907f0000000000000000000000000000000000000000000000000000000000000000906201000090046001600160a01b031689611db7565b610e77565b600654610100900460ff16610e4e5760405162461bcd60e51b815260206004820152601d60248201527f4552525f4e4f5f4d494e545f5748454e5f4e4f5f4c495155494449545900000060448201526064016109dd565b506001610e5b8983611e2c565b600654610e77906201000090046001600160a01b031688611e2c565b610f8b565b6040516340c10f1960e01b81526001600160a01b038a81166004830152602482018490527f000000000000000000000000000000000000000000000000000000000000000016906340c10f1990604401600060405180830381600087803b158015610ee657600080fd5b505af1158015610efa573d6000803e3d6000fd5b50506006546040516340c10f1960e01b8152620100009091046001600160a01b039081166004830152602482018b90527f00000000000000000000000000000000000000000000000000000000000000001692506340c10f199150604401600060405180830381600087803b158015610f7257600080fd5b505af1158015610f86573d6000803e3d6000fd5b505050505b63ffffffff8a166000818152600a602090815260408083208f845290915290819020805460ff19166001179055516001600160a01b038b1691908d907fa88c7db0382b103fdacbb7ff57c3f6397a80d8d35196f9d12396b136e8db34389061103a907f0000000000000000000000000000000000000000000000000000000000000000908e908e90899063ffffffff949094168452602084019290925260408301521515606082015260800190565b60405180910390a45050505050505050505050565b600061105c848484611f0c565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156110e15760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084016109dd565b6110ee8533858403611c2f565b60019150505b9392505050565b60065460ff161561111e5760405162461bcd60e51b81526004016109dd90612ff0565b7f000000000000000000000000000000000000000000000000000000000000000061115b5760405162461bcd60e51b81526004016109dd9061301a565b6000811161119d5760405162461bcd60e51b815260206004820152600f60248201526e11549497d6915493d7d05353d55395608a1b60448201526064016109dd565b6111a733826120dc565b6111d27f00000000000000000000000000000000000000000000000000000000000000003383611db7565b60405181815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250565b6000828152600560205260409020600101546112278133610a0d565b611231838361222a565b505050565b6001600160a01b03811633146112a65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109dd565b6112b082826122b0565b5050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916109b19185906112eb9086906130a6565b611c2f565b6006546201000090046001600160a01b031633146113435760405162461bcd60e51b815260206004820152601060248201526f4552525f4e4f545f545245415355525960801b60448201526064016109dd565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f26d60a81b05648fd1776f3a3d0a99ee7b5bdeddfec657fed73081bbc096c54769060200160405180910390a150565b6000805160206131dd8339815191526113b08133610a0d565b6113b8612317565b50565b7f9f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a896113e68133610a0d565b60005b825181101561123157600083828151811061141457634e487b7160e01b600052603260045260246000fd5b60200260200101519050806001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614156114a05760405162461bcd60e51b815260206004820152601f60248201527f4552525f43414e5f4e4f545f5245534355455f4252494447455f544f4b454e0060448201526064016109dd565b60006114ab826123a5565b90506114b8823383611db7565b505080806114c590613172565b9150506113e9565b6000805160206131dd8339815191526114e68133610a0d565b6113b8612451565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606004805461092190613137565b6000806115547f00000000000000000000000000000000000000000000000000000000000000006123a5565b9092111592915050565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156115e05760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016109dd565b6115ed3385858403611c2f565b5060019392505050565b60006109b1338484611f0c565b7f00000000000000000000000000000000000000000000000000000000000000006116415760405162461bcd60e51b81526004016109dd9061301a565b6000805160206131dd83398151915261165a8133610a0d565b6006805461ff001916610100841515908102919091179091556040805133815260208101929092527f18194a42c0c6035e0035bb436e737bdfcea05129051f3d9032d1d703d8b9fb5c910160405180910390a15050565b60065460ff16156116d45760405162461bcd60e51b81526004016109dd90612ff0565b7f00000000000000000000000000000000000000000000000000000000000000006117115760405162461bcd60e51b81526004016109dd9061301a565b600081116117535760405162461bcd60e51b815260206004820152600f60248201526e11549497d6915493d7d05353d55395608a1b60448201526064016109dd565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156117ec578034146117e75760405162461bcd60e51b815260206004820152601f60248201527f4552525f4d53475f56414c55455f414d4f554e545f4d49534d4154434845440060448201526064016109dd565b611844565b341561183a5760405162461bcd60e51b815260206004820152601b60248201527f4552525f45585045435445445f5a45524f5f4d53475f56414c5545000000000060448201526064016109dd565b61184433826124a9565b61184e3382611e2c565b60405181815233907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c490602001611200565b6000805160206131dd8339815191526118998133610a0d565b50600855565b6000828152600560205260409020600101546118bb8133610a0d565b61123183836122b0565b6007546001600160a01b0316331461191f5760405162461bcd60e51b815260206004820152601860248201527f4552525f4e4f545f50454e44494e475f5452454153555259000000000000000060448201526064016109dd565b600780546001600160a01b03191690556006805462010000600160b01b03191633620100008102919091179091556040519081527fd5ee9935ce8728018aa87ced18549a1093516c8cb84e1737256f498fb13b77c9906020015b60405180910390a1565b60065460ff16156119a65760405162461bcd60e51b81526004016109dd90612ff0565b6000811180156119b857506008548111155b611a045760405162461bcd60e51b815260206004820152601e60248201527f4552525f494e56414c49445f43524f53535f434841494e5f414d4f554e54000060448201526064016109dd565b6009805460009182611a1583613172565b9091555090507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611ab457813414611aaf5760405162461bcd60e51b815260206004820152601f60248201527f4552525f4d53475f56414c55455f414d4f554e545f4d49534d4154434845440060448201526064016109dd565b611bac565b3415611b025760405162461bcd60e51b815260206004820152601b60248201527f4552525f45585045435445445f5a45524f5f4d53475f56414c5545000000000060448201526064016109dd565b611b0c33836124a9565b7f0000000000000000000000000000000000000000000000000000000000000000611bac57604051630852cd8d60e31b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342966c6890602401600060405180830381600087803b158015611b9357600080fd5b505af1158015611ba7573d6000803e3d6000fd5b505050505b6040805163ffffffff7f0000000000000000000000000000000000000000000000000000000000000000811682526001600160a01b0386166020830152918101849052339186169083907f4db40973278211e15d45fceeb7a6ae8497cbea1a2c713e4dbe12a743ab3bf2539060600160405180910390a450505050565b3b151590565b6001600160a01b038316611c915760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016109dd565b6001600160a01b038216611cf25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016109dd565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b611d5d82826114ee565b6112b057611d75816001600160a01b03166014612666565b611d80836020612666565b604051602001611d91929190612f00565b60408051601f198184030181529082905262461bcd60e51b82526109dd91600401612fdd565b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611e18576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611e12573d6000803e3d6000fd5b50611231565b6112316001600160a01b0384168383612848565b6001600160a01b038216611e825760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016109dd565b8060026000828254611e9491906130a6565b90915550506001600160a01b03821660009081526020819052604081208054839290611ec19084906130a6565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36112b0565b6001600160a01b038316611f705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016109dd565b6001600160a01b038216611fd25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016109dd565b6001600160a01b0383166000908152602081905260409020548181101561204a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016109dd565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906120819084906130a6565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516120cd91815260200190565b60405180910390a35b50505050565b6001600160a01b03821661213c5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016109dd565b6001600160a01b038216600090815260208190526040902054818110156121b05760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016109dd565b6001600160a01b03831660009081526020819052604081208383039055600280548492906121df9084906130dd565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3611231565b61223482826114ee565b6112b05760008281526005602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561226c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6122ba82826114ee565b156112b05760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60065460ff166123605760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109dd565b6006805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001611979565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156123d357504761090d565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a082319060240160206040518083038186803b15801561241257600080fd5b505afa158015612426573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244a9190612cee565b905061090d565b60065460ff16156124745760405162461bcd60e51b81526004016109dd90612ff0565b6006805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861238d3390565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b15801561250b57600080fd5b505afa15801561251f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125439190612cee565b905061257a6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168430856128ab565b6040516370a0823160e01b815230600482015281907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b1580156125db57600080fd5b505afa1580156125ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126139190612cee565b61261d91906130dd565b90508181146112315760405162461bcd60e51b815260206004820152601560248201527408aa4a4be829a9eaa9ca8be9c9ea8be8a9c9eaa8e9605b1b60448201526064016109dd565b606060006126758360026130be565b6126809060026130a6565b67ffffffffffffffff8111156126a657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156126d0576020820181803683370190505b509050600360fc1b816000815181106126f957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061273657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600061275a8460026130be565b6127659060016130a6565b90505b60018111156127f9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106127a757634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106127cb57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936127f281613120565b9050612768565b5083156110f45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109dd565b6040516001600160a01b03831660248201526044810182905261123190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526128e3565b6040516001600160a01b03808516602483015283166044820152606481018290526120d69085906323b872dd60e01b90608401612874565b6000612938826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166129b59092919063ffffffff16565b80519091501561123157808060200190518101906129569190612cba565b6112315760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109dd565b60606129c484846000856129cc565b949350505050565b606082471015612a2d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109dd565b843b612a7b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109dd565b600080866001600160a01b03168587604051612a979190612ee4565b60006040518083038185875af1925050503d8060008114612ad4576040519150601f19603f3d011682016040523d82523d6000602084013e612ad9565b606091505b5091509150612ae9828286612af4565b979650505050505050565b60608315612b035750816110f4565b825115612b135782518084602001fd5b8160405162461bcd60e51b81526004016109dd9190612fdd565b803563ffffffff8116811461090d57600080fd5b600060208284031215612b52578081fd5b81356110f4816131b9565b60008060408385031215612b6f578081fd5b8235612b7a816131b9565b91506020830135612b8a816131b9565b809150509250929050565b600080600060608486031215612ba9578081fd5b8335612bb4816131b9565b92506020840135612bc4816131b9565b929592945050506040919091013590565b60008060408385031215612be7578182fd5b8235612bf2816131b9565b946020939093013593505050565b60006020808385031215612c12578182fd5b823567ffffffffffffffff811115612c28578283fd5b8301601f81018513612c38578283fd5b8035612c4b612c4682613082565b613051565b8181528381019083850185840285018601891015612c67578687fd5b8694505b83851015612c92578035612c7e816131b9565b835260019490940193918501918501612c6b565b50979650505050505050565b600060208284031215612caf578081fd5b81356110f4816131ce565b600060208284031215612ccb578081fd5b81516110f4816131ce565b600060208284031215612ce7578081fd5b5035919050565b600060208284031215612cff578081fd5b5051919050565b60008060408385031215612d18578182fd5b823591506020830135612b8a816131b9565b600060208284031215612d3b578081fd5b81356001600160e01b0319811681146110f4578182fd5b60008060008060008060c08789031215612d6a578384fd5b86359550612d7a60208801612b2d565b9450612d8960408801356131b9565b60408701359350606087013592506080870135915067ffffffffffffffff60a08801351115612db6578081fd5b60a0870135870188601f820112612dcb578182fd5b612dd8612c468235613082565b81358152602080820191908301845b8435811015612e6e57813585018d603f820112612e02578687fd5b602081013567ffffffffffffffff811115612e1f57612e1f6131a3565b612e32601f8201601f1916602001613051565b8181528f6040838501011115612e46578889fd5b8160408401602083013760209181018201899052865294850194929092019150600101612de7565b50508093505050509295509295509295565b600080600060608486031215612e94578081fd5b612bb484612b2d565b60008060408385031215612eaf578182fd5b612bf283612b2d565b60008151808452612ed08160208601602086016130f4565b601f01601f19169290920160200192915050565b60008251612ef68184602087016130f4565b9190910192915050565b60007f416363657373436f6e74726f6c3a206163636f756e742000000000000000000082528351612f388160178501602088016130f4565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612f698160288401602088016130f4565b01602801949350505050565b600060408201848352602060408185015281855180845260608601915060608382028701019350828701855b82811015612fcf57605f19888703018452612fbd868351612eb8565b95509284019290840190600101612fa1565b509398975050505050505050565b6000602082526110f46020830184612eb8565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526017908201527f4552525f4e4f545f5052494d49544956455f544f4b454e000000000000000000604082015260600190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561307a5761307a6131a3565b604052919050565b600067ffffffffffffffff82111561309c5761309c6131a3565b5060209081020190565b600082198211156130b9576130b961318d565b500190565b60008160001904831182151516156130d8576130d861318d565b500290565b6000828210156130ef576130ef61318d565b500390565b60005b8381101561310f5781810151838201526020016130f7565b838111156120d65750506000910152565b60008161312f5761312f61318d565b506000190190565b60028104600182168061314b57607f821691505b6020821081141561316c57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156131865761318661318d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146113b857600080fd5b80151581146113b857600080fdfef206625bad3d9112d5609b8d356e6fbd514cd1f69980d4ce2b3e6e68e1789acea2646970667358221220a1711742daf802d5265c07abc4f2b87d22a64edb195d2032262c3da4a372595f64736f6c63430008020033f206625bad3d9112d5609b8d356e6fbd514cd1f69980d4ce2b3e6e68e1789ace358933fb1b4f9e62c7cd3651025ad8825acb20ebbb23b09160e3867d71501ddd9f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a89000000000000000000000000000000000000000000000000000000000000290b000000000000000000000000cd982cad5051a6c19414736acd55e39b8c8dcc5c00000000000000000000000050a64d05bb8618d8d96a83cbbb12b3044ec3489a0000000000000000000000000132613b3a1061816f4661ad301612910e3cce0b0000000000000000000000000132613b3a1061816f4661ad301612910e3cce0b000000000000000000000000cd982cad5051a6c19414736acd55e39b8c8dcc5c000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000d3c21bcecceda1000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000001452656465656d61626c65204e756d20546f6b656e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e52656465656d61626c65204e554d000000000000000000000000000000000000
Deployed ByteCode
0x6080604052600436106102725760003560e01c80636c3f39171161014f578063b625bab5116100c1578063dd62ed3e1161007a578063dd62ed3e146107cb578063e3d29c5d14610811578063e715fd511461085a578063f5b944eb14610870578063f82ca69b14610892578063fc0c546a146108a557610272565b8063b625bab51461071b578063b6b55f251461073b578063b92f0ec71461074e578063cf1d21c01461076e578063d547741f14610796578063d905ec56146107b657610272565b806395d89b411161011357806395d89b411461067b5780639b85346814610690578063a217fddf146106b0578063a457c2d7146106c5578063a9059cbb146106e5578063ab092d161461070557610272565b80636c3f3917146105bc57806370a08231146105dc5780638456cb59146106125780638ad682af1461062757806391d148541461065b57610272565b80632f2ff15d116101e85780633ce8feb1116101ac5780633ce8feb1146104f65780633f4ba83a146105165780634c229dd61461052b57806356e4b68b1461054a5780635c975abb1461057e57806361d027b31461059657610272565b80632f2ff15d14610446578063313ce56714610466578063354d49e01461048257806336568abe146104b657806339509351146104d657610272565b80632295953f1161023a5780632295953f1461032f57806322bf2e241461036a57806323b872dd1461039e578063248a9ca3146103be5780632e1a7d4d146103ee5780632ed6b75d1461040e57610272565b806301ffc9a71461027757806306fdde03146102ac578063095ea7b3146102ce57806309fe780a146102ee57806318160ddd14610310575b600080fd5b34801561028357600080fd5b50610297610292366004612d2a565b6108d9565b60405190151581526020015b60405180910390f35b3480156102b857600080fd5b506102c1610912565b6040516102a39190612fdd565b3480156102da57600080fd5b506102976102e9366004612bd5565b6109a4565b3480156102fa57600080fd5b5061030e610309366004612d52565b6109ba565b005b34801561031c57600080fd5b506002545b6040519081526020016102a3565b34801561033b57600080fd5b5061029761034a366004612e9d565b600a60209081526000928352604080842090915290825290205460ff1681565b34801561037657600080fd5b506103217f358933fb1b4f9e62c7cd3651025ad8825acb20ebbb23b09160e3867d71501ddd81565b3480156103aa57600080fd5b506102976103b9366004612b95565b61104f565b3480156103ca57600080fd5b506103216103d9366004612cd6565b60009081526005602052604090206001015490565b3480156103fa57600080fd5b5061030e610409366004612cd6565b6110fb565b34801561041a57600080fd5b5060075461042e906001600160a01b031681565b6040516001600160a01b0390911681526020016102a3565b34801561045257600080fd5b5061030e610461366004612d06565b61120b565b34801561047257600080fd5b50604051601281526020016102a3565b34801561048e57600080fd5b506102977f000000000000000000000000000000000000000000000000000000000000000181565b3480156104c257600080fd5b5061030e6104d1366004612d06565b611236565b3480156104e257600080fd5b506102976104f1366004612bd5565b6112b4565b34801561050257600080fd5b5061030e610511366004612b41565b6112f0565b34801561052257600080fd5b5061030e611397565b34801561053757600080fd5b5060065461029790610100900460ff1681565b34801561055657600080fd5b5061042e7f00000000000000000000000050a64d05bb8618d8d96a83cbbb12b3044ec3489a81565b34801561058a57600080fd5b5060065460ff16610297565b3480156105a257600080fd5b5060065461042e906201000090046001600160a01b031681565b3480156105c857600080fd5b5061030e6105d7366004612c00565b6113bb565b3480156105e857600080fd5b506103216105f7366004612b41565b6001600160a01b031660009081526020819052604090205490565b34801561061e57600080fd5b5061030e6114cd565b34801561063357600080fd5b506103217f9f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a8981565b34801561066757600080fd5b50610297610676366004612d06565b6114ee565b34801561068757600080fd5b506102c1611519565b34801561069c57600080fd5b506102976106ab366004612cd6565b611528565b3480156106bc57600080fd5b50610321600081565b3480156106d157600080fd5b506102976106e0366004612bd5565b61155e565b3480156106f157600080fd5b50610297610700366004612bd5565b6115f7565b34801561071157600080fd5b5061032160095481565b34801561072757600080fd5b5061030e610736366004612c9e565b611604565b61030e610749366004612cd6565b6116b1565b34801561075a57600080fd5b5061030e610769366004612cd6565b611880565b34801561077a57600080fd5b5061042e73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b3480156107a257600080fd5b5061030e6107b1366004612d06565b61189f565b3480156107c257600080fd5b5061030e6118c5565b3480156107d757600080fd5b506103216107e6366004612b5d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b34801561081d57600080fd5b506108457f000000000000000000000000000000000000000000000000000000000000290b81565b60405163ffffffff90911681526020016102a3565b34801561086657600080fd5b5061032160085481565b34801561087c57600080fd5b506103216000805160206131dd83398151915281565b61030e6108a0366004612e80565b611983565b3480156108b157600080fd5b5061042e7f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b60006001600160e01b03198216637965db0b60e01b148061090a57506301ffc9a760e01b6001600160e01b03198316145b90505b919050565b60606003805461092190613137565b80601f016020809104026020016040519081016040528092919081815260200182805461094d90613137565b801561099a5780601f1061096f5761010080835404028352916020019161099a565b820191906000526020600020905b81548152906001019060200180831161097d57829003601f168201915b5050505050905090565b60006109b1338484611c2f565b50600192915050565b60065460ff16156109e65760405162461bcd60e51b81526004016109dd90612ff0565b60405180910390fd5b7f358933fb1b4f9e62c7cd3651025ad8825acb20ebbb23b09160e3867d71501ddd610a1281335b611d53565b63ffffffff86166000908152600a602090815260408083208a845290915290205460ff1615610a945760405162461bcd60e51b815260206004820152602860248201527f4552525f43524f53535f434841494e5f524551554553545f414c52454144595f604482015267434f4d504c45544560c01b60648201526084016109dd565b828411610ae35760405162461bcd60e51b815260206004820152601b60248201527f4552525f4645455f475245415445525f5448414e5f414d4f554e54000000000060448201526064016109dd565b600854841115610b355760405162461bcd60e51b815260206004820152601e60248201527f4552525f494e56414c49445f43524f53535f434841494e5f414d4f554e54000060448201526064016109dd565b60007f00000000000000000000000050a64d05bb8618d8d96a83cbbb12b3044ec3489a6001600160a01b03166371aca57e6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b9057600080fd5b505afa158015610ba4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc89190612cee565b6040805160208101929092526bffffffffffffffffffffffff1930606090811b8216928401929092526001600160e01b031960e08b811b821660548601527f000000000000000000000000000000000000000000000000000000000000290b901b166058840152605c83018b90529088901b16607c8201526090810186905260b0810185905260d0016040516020818303038152906040528051906020012090506000610cc2826040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6040516305a0f88360e41b81529091506001600160a01b037f00000000000000000000000050a64d05bb8618d8d96a83cbbb12b3044ec3489a1690635a0f883090610d139084908890600401612f75565b60006040518083038186803b158015610d2b57600080fd5b505afa158015610d3f573d6000803e3d6000fd5b5050505060008587610d5191906130dd565b905060007f000000000000000000000000000000000000000000000000000000000000000115610e7c57610d8488611528565b15610df757610db47f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8a84611db7565b600654610df2907f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee906201000090046001600160a01b031689611db7565b610e77565b600654610100900460ff16610e4e5760405162461bcd60e51b815260206004820152601d60248201527f4552525f4e4f5f4d494e545f5748454e5f4e4f5f4c495155494449545900000060448201526064016109dd565b506001610e5b8983611e2c565b600654610e77906201000090046001600160a01b031688611e2c565b610f8b565b6040516340c10f1960e01b81526001600160a01b038a81166004830152602482018490527f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee16906340c10f1990604401600060405180830381600087803b158015610ee657600080fd5b505af1158015610efa573d6000803e3d6000fd5b50506006546040516340c10f1960e01b8152620100009091046001600160a01b039081166004830152602482018b90527f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1692506340c10f199150604401600060405180830381600087803b158015610f7257600080fd5b505af1158015610f86573d6000803e3d6000fd5b505050505b63ffffffff8a166000818152600a602090815260408083208f845290915290819020805460ff19166001179055516001600160a01b038b1691908d907fa88c7db0382b103fdacbb7ff57c3f6397a80d8d35196f9d12396b136e8db34389061103a907f000000000000000000000000000000000000000000000000000000000000290b908e908e90899063ffffffff949094168452602084019290925260408301521515606082015260800190565b60405180910390a45050505050505050505050565b600061105c848484611f0c565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156110e15760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084016109dd565b6110ee8533858403611c2f565b60019150505b9392505050565b60065460ff161561111e5760405162461bcd60e51b81526004016109dd90612ff0565b7f000000000000000000000000000000000000000000000000000000000000000161115b5760405162461bcd60e51b81526004016109dd9061301a565b6000811161119d5760405162461bcd60e51b815260206004820152600f60248201526e11549497d6915493d7d05353d55395608a1b60448201526064016109dd565b6111a733826120dc565b6111d27f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee3383611db7565b60405181815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250565b6000828152600560205260409020600101546112278133610a0d565b611231838361222a565b505050565b6001600160a01b03811633146112a65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109dd565b6112b082826122b0565b5050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916109b19185906112eb9086906130a6565b611c2f565b6006546201000090046001600160a01b031633146113435760405162461bcd60e51b815260206004820152601060248201526f4552525f4e4f545f545245415355525960801b60448201526064016109dd565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f26d60a81b05648fd1776f3a3d0a99ee7b5bdeddfec657fed73081bbc096c54769060200160405180910390a150565b6000805160206131dd8339815191526113b08133610a0d565b6113b8612317565b50565b7f9f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a896113e68133610a0d565b60005b825181101561123157600083828151811061141457634e487b7160e01b600052603260045260246000fd5b60200260200101519050806001600160a01b03167f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031614156114a05760405162461bcd60e51b815260206004820152601f60248201527f4552525f43414e5f4e4f545f5245534355455f4252494447455f544f4b454e0060448201526064016109dd565b60006114ab826123a5565b90506114b8823383611db7565b505080806114c590613172565b9150506113e9565b6000805160206131dd8339815191526114e68133610a0d565b6113b8612451565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606004805461092190613137565b6000806115547f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6123a5565b9092111592915050565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156115e05760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016109dd565b6115ed3385858403611c2f565b5060019392505050565b60006109b1338484611f0c565b7f00000000000000000000000000000000000000000000000000000000000000016116415760405162461bcd60e51b81526004016109dd9061301a565b6000805160206131dd83398151915261165a8133610a0d565b6006805461ff001916610100841515908102919091179091556040805133815260208101929092527f18194a42c0c6035e0035bb436e737bdfcea05129051f3d9032d1d703d8b9fb5c910160405180910390a15050565b60065460ff16156116d45760405162461bcd60e51b81526004016109dd90612ff0565b7f00000000000000000000000000000000000000000000000000000000000000016117115760405162461bcd60e51b81526004016109dd9061301a565b600081116117535760405162461bcd60e51b815260206004820152600f60248201526e11549497d6915493d7d05353d55395608a1b60448201526064016109dd565b7f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156117ec578034146117e75760405162461bcd60e51b815260206004820152601f60248201527f4552525f4d53475f56414c55455f414d4f554e545f4d49534d4154434845440060448201526064016109dd565b611844565b341561183a5760405162461bcd60e51b815260206004820152601b60248201527f4552525f45585045435445445f5a45524f5f4d53475f56414c5545000000000060448201526064016109dd565b61184433826124a9565b61184e3382611e2c565b60405181815233907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c490602001611200565b6000805160206131dd8339815191526118998133610a0d565b50600855565b6000828152600560205260409020600101546118bb8133610a0d565b61123183836122b0565b6007546001600160a01b0316331461191f5760405162461bcd60e51b815260206004820152601860248201527f4552525f4e4f545f50454e44494e475f5452454153555259000000000000000060448201526064016109dd565b600780546001600160a01b03191690556006805462010000600160b01b03191633620100008102919091179091556040519081527fd5ee9935ce8728018aa87ced18549a1093516c8cb84e1737256f498fb13b77c9906020015b60405180910390a1565b60065460ff16156119a65760405162461bcd60e51b81526004016109dd90612ff0565b6000811180156119b857506008548111155b611a045760405162461bcd60e51b815260206004820152601e60248201527f4552525f494e56414c49445f43524f53535f434841494e5f414d4f554e54000060448201526064016109dd565b6009805460009182611a1583613172565b9091555090507f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611ab457813414611aaf5760405162461bcd60e51b815260206004820152601f60248201527f4552525f4d53475f56414c55455f414d4f554e545f4d49534d4154434845440060448201526064016109dd565b611bac565b3415611b025760405162461bcd60e51b815260206004820152601b60248201527f4552525f45585045435445445f5a45524f5f4d53475f56414c5545000000000060448201526064016109dd565b611b0c33836124a9565b7f0000000000000000000000000000000000000000000000000000000000000001611bac57604051630852cd8d60e31b8152600481018390527f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316906342966c6890602401600060405180830381600087803b158015611b9357600080fd5b505af1158015611ba7573d6000803e3d6000fd5b505050505b6040805163ffffffff7f000000000000000000000000000000000000000000000000000000000000290b811682526001600160a01b0386166020830152918101849052339186169083907f4db40973278211e15d45fceeb7a6ae8497cbea1a2c713e4dbe12a743ab3bf2539060600160405180910390a450505050565b3b151590565b6001600160a01b038316611c915760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016109dd565b6001600160a01b038216611cf25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016109dd565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b611d5d82826114ee565b6112b057611d75816001600160a01b03166014612666565b611d80836020612666565b604051602001611d91929190612f00565b60408051601f198184030181529082905262461bcd60e51b82526109dd91600401612fdd565b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611e18576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611e12573d6000803e3d6000fd5b50611231565b6112316001600160a01b0384168383612848565b6001600160a01b038216611e825760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016109dd565b8060026000828254611e9491906130a6565b90915550506001600160a01b03821660009081526020819052604081208054839290611ec19084906130a6565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36112b0565b6001600160a01b038316611f705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016109dd565b6001600160a01b038216611fd25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016109dd565b6001600160a01b0383166000908152602081905260409020548181101561204a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016109dd565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906120819084906130a6565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516120cd91815260200190565b60405180910390a35b50505050565b6001600160a01b03821661213c5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016109dd565b6001600160a01b038216600090815260208190526040902054818110156121b05760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016109dd565b6001600160a01b03831660009081526020819052604081208383039055600280548492906121df9084906130dd565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3611231565b61223482826114ee565b6112b05760008281526005602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561226c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6122ba82826114ee565b156112b05760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60065460ff166123605760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109dd565b6006805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001611979565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156123d357504761090d565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a082319060240160206040518083038186803b15801561241257600080fd5b505afa158015612426573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244a9190612cee565b905061090d565b60065460ff16156124745760405162461bcd60e51b81526004016109dd90612ff0565b6006805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861238d3390565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316906370a082319060240160206040518083038186803b15801561250b57600080fd5b505afa15801561251f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125439190612cee565b905061257a6001600160a01b037f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee168430856128ab565b6040516370a0823160e01b815230600482015281907f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316906370a082319060240160206040518083038186803b1580156125db57600080fd5b505afa1580156125ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126139190612cee565b61261d91906130dd565b90508181146112315760405162461bcd60e51b815260206004820152601560248201527408aa4a4be829a9eaa9ca8be9c9ea8be8a9c9eaa8e9605b1b60448201526064016109dd565b606060006126758360026130be565b6126809060026130a6565b67ffffffffffffffff8111156126a657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156126d0576020820181803683370190505b509050600360fc1b816000815181106126f957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061273657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600061275a8460026130be565b6127659060016130a6565b90505b60018111156127f9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106127a757634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106127cb57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936127f281613120565b9050612768565b5083156110f45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109dd565b6040516001600160a01b03831660248201526044810182905261123190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526128e3565b6040516001600160a01b03808516602483015283166044820152606481018290526120d69085906323b872dd60e01b90608401612874565b6000612938826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166129b59092919063ffffffff16565b80519091501561123157808060200190518101906129569190612cba565b6112315760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109dd565b60606129c484846000856129cc565b949350505050565b606082471015612a2d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109dd565b843b612a7b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109dd565b600080866001600160a01b03168587604051612a979190612ee4565b60006040518083038185875af1925050503d8060008114612ad4576040519150601f19603f3d011682016040523d82523d6000602084013e612ad9565b606091505b5091509150612ae9828286612af4565b979650505050505050565b60608315612b035750816110f4565b825115612b135782518084602001fd5b8160405162461bcd60e51b81526004016109dd9190612fdd565b803563ffffffff8116811461090d57600080fd5b600060208284031215612b52578081fd5b81356110f4816131b9565b60008060408385031215612b6f578081fd5b8235612b7a816131b9565b91506020830135612b8a816131b9565b809150509250929050565b600080600060608486031215612ba9578081fd5b8335612bb4816131b9565b92506020840135612bc4816131b9565b929592945050506040919091013590565b60008060408385031215612be7578182fd5b8235612bf2816131b9565b946020939093013593505050565b60006020808385031215612c12578182fd5b823567ffffffffffffffff811115612c28578283fd5b8301601f81018513612c38578283fd5b8035612c4b612c4682613082565b613051565b8181528381019083850185840285018601891015612c67578687fd5b8694505b83851015612c92578035612c7e816131b9565b835260019490940193918501918501612c6b565b50979650505050505050565b600060208284031215612caf578081fd5b81356110f4816131ce565b600060208284031215612ccb578081fd5b81516110f4816131ce565b600060208284031215612ce7578081fd5b5035919050565b600060208284031215612cff578081fd5b5051919050565b60008060408385031215612d18578182fd5b823591506020830135612b8a816131b9565b600060208284031215612d3b578081fd5b81356001600160e01b0319811681146110f4578182fd5b60008060008060008060c08789031215612d6a578384fd5b86359550612d7a60208801612b2d565b9450612d8960408801356131b9565b60408701359350606087013592506080870135915067ffffffffffffffff60a08801351115612db6578081fd5b60a0870135870188601f820112612dcb578182fd5b612dd8612c468235613082565b81358152602080820191908301845b8435811015612e6e57813585018d603f820112612e02578687fd5b602081013567ffffffffffffffff811115612e1f57612e1f6131a3565b612e32601f8201601f1916602001613051565b8181528f6040838501011115612e46578889fd5b8160408401602083013760209181018201899052865294850194929092019150600101612de7565b50508093505050509295509295509295565b600080600060608486031215612e94578081fd5b612bb484612b2d565b60008060408385031215612eaf578182fd5b612bf283612b2d565b60008151808452612ed08160208601602086016130f4565b601f01601f19169290920160200192915050565b60008251612ef68184602087016130f4565b9190910192915050565b60007f416363657373436f6e74726f6c3a206163636f756e742000000000000000000082528351612f388160178501602088016130f4565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612f698160288401602088016130f4565b01602801949350505050565b600060408201848352602060408185015281855180845260608601915060608382028701019350828701855b82811015612fcf57605f19888703018452612fbd868351612eb8565b95509284019290840190600101612fa1565b509398975050505050505050565b6000602082526110f46020830184612eb8565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526017908201527f4552525f4e4f545f5052494d49544956455f544f4b454e000000000000000000604082015260600190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561307a5761307a6131a3565b604052919050565b600067ffffffffffffffff82111561309c5761309c6131a3565b5060209081020190565b600082198211156130b9576130b961318d565b500190565b60008160001904831182151516156130d8576130d861318d565b500290565b6000828210156130ef576130ef61318d565b500390565b60005b8381101561310f5781810151838201526020016130f7565b838111156120d65750506000910152565b60008161312f5761312f61318d565b506000190190565b60028104600182168061314b57607f821691505b6020821081141561316c57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156131865761318661318d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146113b857600080fd5b80151581146113b857600080fdfef206625bad3d9112d5609b8d356e6fbd514cd1f69980d4ce2b3e6e68e1789acea2646970667358221220a1711742daf802d5265c07abc4f2b87d22a64edb195d2032262c3da4a372595f64736f6c63430008020033