More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 8,099 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Set Winner | 11542704 | 119 days ago | IN | 0 ETH | 0.00000037 | ||||
Set Winner | 11542702 | 119 days ago | IN | 0 ETH | 0.00000117 | ||||
Set Winner | 11542699 | 119 days ago | IN | 0 ETH | 0.00000116 | ||||
Set Winner | 11542696 | 119 days ago | IN | 0 ETH | 0.00000117 | ||||
Spin | 11542313 | 119 days ago | IN | 0 ETH | 0.00000014 | ||||
Spin | 11542224 | 119 days ago | IN | 0 ETH | 0.00000014 | ||||
Spin | 11541934 | 119 days ago | IN | 0 ETH | 0.00000014 | ||||
Spin | 11541922 | 119 days ago | IN | 0 ETH | 0.00000015 | ||||
Set Winner | 11540905 | 119 days ago | IN | 0 ETH | 0.0000004 | ||||
Set Winner | 11540902 | 119 days ago | IN | 0 ETH | 0.00000127 | ||||
Set Winner | 11540899 | 119 days ago | IN | 0 ETH | 0.00000126 | ||||
Set Winner | 11540896 | 119 days ago | IN | 0 ETH | 0.00000126 | ||||
Set Winner | 11539104 | 119 days ago | IN | 0 ETH | 0.00000037 | ||||
Set Winner | 11539102 | 119 days ago | IN | 0 ETH | 0.00000117 | ||||
Set Winner | 11539098 | 119 days ago | IN | 0 ETH | 0.00000117 | ||||
Set Winner | 11539096 | 119 days ago | IN | 0 ETH | 0.00000117 | ||||
Set Winner | 11537305 | 119 days ago | IN | 0 ETH | 0.00000039 | ||||
Set Winner | 11537302 | 119 days ago | IN | 0 ETH | 0.00000122 | ||||
Set Winner | 11537299 | 119 days ago | IN | 0 ETH | 0.00000122 | ||||
Set Winner | 11537296 | 119 days ago | IN | 0 ETH | 0.00000122 | ||||
Set Winner | 11535505 | 119 days ago | IN | 0 ETH | 0.00000038 | ||||
Set Winner | 11535502 | 119 days ago | IN | 0 ETH | 0.00000119 | ||||
Set Winner | 11535499 | 119 days ago | IN | 0 ETH | 0.00000119 | ||||
Set Winner | 11535496 | 119 days ago | IN | 0 ETH | 0.0000012 | ||||
Spin | 11535323 | 119 days ago | IN | 0 ETH | 0.00000014 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
11114751 | 129 days ago | 0.012327 ETH | ||||
11114751 | 129 days ago | 0.002465 ETH | ||||
11114751 | 129 days ago | 0.002465 ETH | ||||
11114751 | 129 days ago | 0.002773 ETH | ||||
11114751 | 129 days ago | 0.001849 ETH | ||||
11114751 | 129 days ago | 0.006472 ETH | ||||
11114751 | 129 days ago | 0.002773 ETH | ||||
11114751 | 129 days ago | 0.014793 ETH | ||||
11114751 | 129 days ago | 0.002465 ETH | ||||
11114751 | 129 days ago | 0.003698 ETH | ||||
11114751 | 129 days ago | 0.036983 ETH | ||||
11114751 | 129 days ago | 0.022189 ETH | ||||
11114751 | 129 days ago | 0.003698 ETH | ||||
11114751 | 129 days ago | 0.003698 ETH | ||||
11114748 | 129 days ago | 0.083212 ETH | ||||
11114748 | 129 days ago | 0.008875 ETH | ||||
11114748 | 129 days ago | 0.001849 ETH | ||||
11114748 | 129 days ago | 0.003698 ETH | ||||
11114748 | 129 days ago | 0.002773 ETH | ||||
11114748 | 129 days ago | 0.003698 ETH | ||||
11114748 | 129 days ago | 0.003698 ETH | ||||
11114748 | 129 days ago | 0.003698 ETH | ||||
11114748 | 129 days ago | 0.001849 ETH | ||||
11114748 | 129 days ago | 0.002465 ETH | ||||
11114748 | 129 days ago | 0.030819 ETH |
Loading...
Loading
Contract Name:
GangsterArena
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
No with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import '@openzeppelin/contracts/access/AccessControl.sol'; import '@openzeppelin/contracts/utils/ReentrancyGuard.sol'; import './Gangster.sol'; import './GOLD.sol'; import './IGangsterArena.sol'; import './libs/SafeTransferLib.sol'; import './libs/SignerLib.sol'; import './interfaces/IBlast.sol'; // import 'hardhat/console.sol'; contract GangsterArena is AccessControl, ReentrancyGuard, IGangsterArena { IBlast public constant BLAST = IBlast(0x4300000000000000000000000000000000000002); using SafeTransferLib for address payable; using SignerLib for address; // IUniswapV2Router02 public uniswapV2Router; // Uniswap router Gangster public immutable nft; // NFT token GOLD public immutable greedToken; // greedToken token address private signer; // Signer address bytes32 public constant WORKER_ROLE = keccak256('WORKER_ROLE'); // Worker role - process game transaction bytes32 public constant ADMIN_ROLE = keccak256('ADMIN_ROLE'); // Admin role - setting contract struct StartPack { uint256 numberOfGangster; uint256 MAX_PER_WALLET; } /* **************** * Game config **************** */ mapping(uint256 => StartPack) packs; // packId => pack config mapping(address => mapping(uint256 => uint256)) boughtPacks; // address => packId => number bought uint256 public constant tokenId = 1; // NFT tokenId uint256 public MAX_PER_BATCH = 500; // Max NFT minting perbatch uint256 public tokenSwapLimit = 30000 ether; //limit token for LP, swap to ether when over uint256 public burnRate = 10_00; uint256 public auctionRate = 30_00; uint256 public prizeRate = 60_00; uint256 public ethRate = 0; uint256 public devRate = 0; uint256 public vtd = 60; // valid timestamp different //**************** // Game Contract Balance //**************** uint256 public ethPrize; // eth prize uint256 public tokenPrize; // token prize uint256 public tokenForLP; // token hold before swap to eth //**************** // Game Address //**************** address public devAddr_; address public immutable pointsOperator_; address public gasFeeOperator_; address public auctionTreasury_; address public spinPoolAddr_; //**************** // Game Data //**************** bool public gameClosed; // Flag toggle when game close bool public lockNFT; // flag when nft is locked mapping(uint256 => uint256) public lastB; // type -> timestamp mapping(address => uint256) public gangsterBought; // address -> number of gangster bought mapping(uint256 => bool) usedNonces; // Nonces of transaction mapping(address => uint256) public gangster; // address -> number of staked gangster - NFT when user deposit constructor( address _defaultAdmin, address _adminAddress, address _workerAddress, address _signerAddress, address _gangsterAddress, address payable _fiatAddress, address _pointsOperator, address _blastPointAddr ) { nft = Gangster(_gangsterAddress); greedToken = GOLD(_fiatAddress); signer = _signerAddress; pointsOperator_ = _pointsOperator; _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin); _grantRole(ADMIN_ROLE, _adminAddress); _grantRole(WORKER_ROLE, _workerAddress); if (_blastPointAddr != address(0)) { IBlastPoints(_blastPointAddr).configurePointsOperator(_pointsOperator); BLAST.configureClaimableGas(); BLAST.configureClaimableYield(); } } receive() external payable { ethPrize += msg.value; emit Received(msg.sender, msg.value); } fallback() external payable { ethPrize += msg.value; emit Received(msg.sender, msg.value); } /** * @notice ERC1155 receiver */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4) { return bytes4(keccak256('onERC1155Received(address,address,uint256,uint256,bytes)')); } //*************************** // Public //*************************** function addReward(uint256 _dev, uint256 _reputationPrize_, uint256 _rankPrize_) public payable { uint256 totalValue = _dev + _reputationPrize_ + _rankPrize_; require(msg.value >= totalValue, 'Need to send more ether'); ethPrize += _rankPrize_ + _reputationPrize_; if (_dev > 0) { address payable receiver = payable(devAddr_); (bool sent, ) = receiver.call{value: _dev}(''); require(sent, 'Failed to send Ether'); } uint256 extraValue = msg.value - totalValue; if (extraValue > 0) { address payable receiver = payable(msg.sender); (bool sent, ) = receiver.call{value: extraValue}(''); require(sent, 'Failed to send Ether'); } emit AddReward(msg.sender, totalValue); } function addTokenReward(uint256 _value) public { greedToken.transferFrom(msg.sender, address(this), _value); tokenPrize += _value; } /** * @notice Buy Asset * typeA: type of Asset, 0 is Gangster, 1 is goon, 2 is safehouse, 3 - pistol, 4 - shield, 5 - augment roll * amount: amount of asset * value: value user have to pay in token * lastB: lastB time block time * sTime: signature time * nonce: application transaction nonce * sig: signatire from application */ function buyAsset( uint256 _typeA, uint256 _amount, uint256 _value, uint256 _lastB, uint256 _sTime, address _refAddr, uint256 _refValue, uint256 _nonce, bytes memory _sig ) public { require(greedToken.allowance(msg.sender, address(this)) >= _value, 'Error'); require(!gameClosed, 'Game is closed'); require(lastB[_typeA] == _lastB, 'Invalid last buy time'); require(block.timestamp < _sTime + vtd, 'Invalid timestamp'); require(!usedNonces[_nonce], 'Nonce is used'); bytes32 message = SignerLib.prefixed( keccak256(abi.encodePacked(msg.sender, _typeA, _amount, _value, _lastB, _sTime, _refAddr, _refValue, _nonce)) ); require(signer.verifyAddressSigner(message, _sig), 'INVALID_SIGN'); usedNonces[_nonce] = true; lastB[_typeA] = block.timestamp; greedToken.transferFrom(msg.sender, address(this), _value); { uint256 lpValue = (_value * ethRate) / 100_00; tokenForLP += lpValue; } uint256 burnValue = (_value * burnRate) / 100_00; uint256 auctionValue = (_value * auctionRate) / 100_00; uint256 prizeValue = (_value * prizeRate) / 100_00; uint256 devValue = (_value * devRate) / 100_00; tokenPrize += prizeValue; if (burnValue > 0) greedToken.burn(burnValue); if (auctionValue > 0) greedToken.transfer(auctionTreasury_, auctionValue); if (devValue > 0) greedToken.transfer(devAddr_, devValue); if (_refValue > 0) greedToken.transfer(_refAddr, _refValue); if (_typeA == 0 && _amount > 0) { mintNFT(msg.sender, _amount); emit BuyGangster(msg.sender, tokenId, _amount, _nonce); } if (_typeA == 1) emit BuyGoon(msg.sender, _amount, _nonce); if (_typeA == 2) emit BuySafeHouse(msg.sender, _amount, _nonce); if (_typeA == 3) emit BuyPistol(msg.sender, _amount, _nonce); if (_typeA == 4) emit BuyShield(msg.sender, _amount, _nonce); if (_typeA == 5) emit BuyAugmentRoll(msg.sender, _nonce); } function buyStartPack( uint256 packId, uint256 ethPrice, uint256 _sTime, uint256 _nonce, bytes memory _sig ) public payable { require(!usedNonces[_nonce], 'Nonce is used'); require(packs[packId].MAX_PER_WALLET > 0, 'Invalid Id'); require(msg.value >= ethPrice, 'Need to send more ether'); require(block.timestamp < _sTime + vtd, 'Invalid timestamp'); require(packs[packId].MAX_PER_WALLET > boughtPacks[msg.sender][packId], 'Over wallet limit'); bytes32 message = SignerLib.prefixed(keccak256(abi.encodePacked(msg.sender, ethPrice, _sTime, _nonce))); require(signer.verifyAddressSigner(message, _sig), 'INVALID_SIGN'); usedNonces[_nonce] = true; StartPack memory pack = packs[packId]; boughtPacks[msg.sender][packId] += 1; address payable receiver = payable(devAddr_); (bool sent, ) = receiver.call{value: msg.value}(''); require(sent, 'Failed to send Ether'); mintNFT(msg.sender, pack.numberOfGangster); emit BuyStartPack(msg.sender, packId, pack.numberOfGangster, _nonce); } /** * @notice Buy spin * type: type of spint, default is 1 * amount: number of spin * value: value user have to pay in token * _lastP: last time user spin in block time * sTime: signature time * nonce: application transaction nonce * sig: signatire from application */ function spin( uint256 _spinType, uint256 _amount, uint256 _value, uint256 _sTime, uint256 _nonce, bytes memory _sig ) public { require(greedToken.allowance(msg.sender, address(this)) >= _value, 'Error'); require(!gameClosed, 'Game is closed'); require(block.timestamp < _sTime + vtd, 'Invalid timestamp'); require(!usedNonces[_nonce], 'Nonce is used'); bytes32 message = SignerLib.prefixed( keccak256(abi.encodePacked(msg.sender, _spinType, _amount, _value, _sTime, _nonce)) ); require(signer.verifyAddressSigner(message, _sig), 'Invalid signature'); usedNonces[_nonce] = true; greedToken.transferFrom(msg.sender, spinPoolAddr_, _value); emit DailySpin(msg.sender, _spinType, _amount, _value, _nonce); } /** * @notice depositNFT */ function depositNFT(address _to, uint256 _amount) public { require(!gameClosed, 'Game is closed'); nft.safeTransferFrom(msg.sender, address(this), tokenId, _amount, ''); gangster[_to] += _amount; emit Deposit(msg.sender, _to, tokenId, _amount); } /** * @notice withdrawNFT */ function withdrawNFT(address _to, uint256 _amount) public { require(!lockNFT, 'NFT is locked'); require(gangster[msg.sender] >= _amount, 'Insufficient balance'); gangster[msg.sender] -= _amount; nft.safeTransferFrom(address(this), _to, tokenId, _amount, ''); emit Withdraw(msg.sender, tokenId, _amount); } /** * *************************** * Claim Gas * *************************** */ function claimGas(bool _maxOnly) public onlyRole(ADMIN_ROLE) { require(gasFeeOperator_ != address(0), 'gasFee is not set'); if (_maxOnly) { BLAST.claimMaxGas(address(this), gasFeeOperator_); } else { BLAST.claimAllGas(address(this), gasFeeOperator_); } } function claimAllYield() public onlyRole(ADMIN_ROLE) { BLAST.claimAllYield(address(this), gasFeeOperator_); } function finalWarResult(address[] memory _addr, uint256[] memory _lGang) public onlyRole(WORKER_ROLE) { require(!gameClosed, 'Game is closed'); require(_addr.length == _lGang.length, 'Input array is not match'); for (uint256 i = 0; i < _addr.length; i++) { require(gangster[_addr[i]] >= _lGang[i], 'Invalid amount to burn'); } uint256 total = sumOf(_lGang); for (uint256 i = 0; i < _addr.length; i++) { gangster[_addr[i]] -= _lGang[i]; } nft.burn(address(this), tokenId, total); emit WarResult(_addr, _lGang); } function setLockNFT(bool _lock) public onlyRole(WORKER_ROLE) { lockNFT = _lock; } /** * @notice update winners and payout */ function setWinner( address[] memory _to, uint256[] memory _ethReward, uint256[] memory _tokenReward ) public onlyRole(WORKER_ROLE) { // require(gameClosed, 'Game is not closed'); require(_to.length == _ethReward.length && _ethReward.length == _tokenReward.length, 'Invalid input array length'); for (uint256 i = 0; i < _to.length; i++) { require(address(this).balance >= _ethReward[i], 'Over eth balance'); require(greedToken.balanceOf(address(this)) >= _tokenReward[i], 'Over token balance'); if (_ethReward[i] > 0) { address payable receiver = payable(_to[i]); (bool sent, ) = receiver.call{value: _ethReward[i]}(''); require(sent, 'Failed to send Ether'); } if (_tokenReward[i] > 0) greedToken.transfer(_to[i], _tokenReward[i]); } } /** * @notice set game close status */ function setGameClosed(bool _value) public onlyRole(WORKER_ROLE) { gameClosed = _value; } /** *************************** *Customization for the contract (ADMIN_ROLE) *************************** */ /** * @notice set Base Price Gangster */ function setGameConfig( uint256 _vtd, uint256 _tokenSwapLimit, uint256 _burnRate, uint256 _auctionRate, uint256 _prizeRate, uint256 _devRate ) public onlyRole(ADMIN_ROLE) { vtd = _vtd; tokenSwapLimit = _tokenSwapLimit; burnRate = _burnRate; auctionRate = _auctionRate; prizeRate = _prizeRate; devRate = _devRate; ethRate = 100_00 - _burnRate - _devRate - _prizeRate - _auctionRate; } function setGameAddress( address _devAddr, address _gasFeeOperator, address _auctionTreasury, address _spinPool, address _signer ) public onlyRole(ADMIN_ROLE) { devAddr_ = _devAddr; gasFeeOperator_ = _gasFeeOperator; auctionTreasury_ = _auctionTreasury; spinPoolAddr_ = _spinPool; signer = _signer; } function setPack(uint256 packId, uint256 numberOfGangster, uint256 MAX_PER_WALLET) public onlyRole(ADMIN_ROLE) { packs[packId] = StartPack(numberOfGangster, MAX_PER_WALLET); } /** *************************** DEFAULT_ADMIN_ROLE Function *************************** */ function emegencyWithdraw() public onlyRole(DEFAULT_ADMIN_ROLE) { require(gameClosed, 'Game is not closed'); require(address(this).balance > 0, 'Nothing to withdraw'); address payable receiver = payable(msg.sender); (bool sent, ) = receiver.call{value: address(this).balance}(''); require(sent, 'Failed to send Ether'); } /** *************************** Internal Function *************************** */ /** * @notice common logic for buy nft in-game */ function mintNFT(address sender, uint256 amount) private { require(amount != 0, 'Invalid amount'); require(amount <= MAX_PER_BATCH, 'Max per batch reached'); nft.mint(address(this), tokenId, amount, ''); gangster[sender] += amount; } /** * @notice sum of array */ function sumOf(uint256[] memory arr) internal pure returns (uint256 result) { for (uint256 i = 0; i < arr.length; i++) { result += arr[i]; } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * 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}: * * ```solidity * 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. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @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 virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { _checkProxy(); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC1967-compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol"; import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; import {Initializable} from "../../proxy/utils/Initializable.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}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * 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. */ abstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors { /// @custom:storage-location erc7201:openzeppelin.storage.ERC20 struct ERC20Storage { mapping(address account => uint256) _balances; mapping(address account => mapping(address spender => uint256)) _allowances; uint256 _totalSupply; string _name; string _symbol; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00; function _getERC20Storage() private pure returns (ERC20Storage storage $) { assembly { $.slot := ERC20StorageLocation } } /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { ERC20Storage storage $ = _getERC20Storage(); $._name = name_; $._symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { ERC20Storage storage $ = _getERC20Storage(); return $._name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { ERC20Storage storage $ = _getERC20Storage(); 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 default value returned by this function, unless * it's 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 returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { ERC20Storage storage $ = _getERC20Storage(); if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows $._totalSupply += value; } else { uint256 fromBalance = $._balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. $._balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. $._totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. $._balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` 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. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { ERC20Storage storage $ = _getERC20Storage(); if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } $._allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.20; import {ERC20Upgradeable} from "../ERC20Upgradeable.sol"; import {ContextUpgradeable} from "../../../utils/ContextUpgradeable.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable { function __ERC20Burnable_init() internal onlyInitializing { } function __ERC20Burnable_init_unchained() internal onlyInitializing { } /** * @dev Destroys a `value` amount of tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 value) public virtual { _burn(_msgSender(), value); } /** * @dev Destroys a `value` amount of tokens from `account`, deducting from * the caller's allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `value`. */ function burnFrom(address account, uint256 value) public virtual { _spendAllowance(account, _msgSender(), value); _burn(account, value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.20; import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; import {ERC20Upgradeable} from "../ERC20Upgradeable.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {EIP712Upgradeable} from "../../../utils/cryptography/EIP712Upgradeable.sol"; import {NoncesUpgradeable} from "../../../utils/NoncesUpgradeable.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ abstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20Permit, EIP712Upgradeable, NoncesUpgradeable { bytes32 private constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev Permit deadline has expired. */ error ERC2612ExpiredSignature(uint256 deadline); /** * @dev Mismatched signature. */ error ERC2612InvalidSigner(address signer, address owner); /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ function __ERC20Permit_init(string memory name) internal onlyInitializing { __EIP712_init_unchained(name, "1"); } function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {} /** * @inheritdoc IERC20Permit */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { if (block.timestamp > deadline) { revert ERC2612ExpiredSignature(deadline); } bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); if (signer != owner) { revert ERC2612InvalidSigner(signer, owner); } _approve(owner, spender, value); } /** * @inheritdoc IERC20Permit */ function nonces(address owner) public view virtual override(IERC20Permit, NoncesUpgradeable) returns (uint256) { return super.nonces(owner); } /** * @inheritdoc IERC20Permit */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view virtual returns (bytes32) { return _domainSeparatorV4(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.20; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import {IERC5267} from "@openzeppelin/contracts/interfaces/IERC5267.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. */ abstract contract EIP712Upgradeable is Initializable, IERC5267 { bytes32 private constant TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /// @custom:storage-location erc7201:openzeppelin.storage.EIP712 struct EIP712Storage { /// @custom:oz-renamed-from _HASHED_NAME bytes32 _hashedName; /// @custom:oz-renamed-from _HASHED_VERSION bytes32 _hashedVersion; string _name; string _version; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.EIP712")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant EIP712StorageLocation = 0xa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100; function _getEIP712Storage() private pure returns (EIP712Storage storage $) { assembly { $.slot := EIP712StorageLocation } } /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal onlyInitializing { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing { EIP712Storage storage $ = _getEIP712Storage(); $._name = name; $._version = version; // Reset prior values in storage if upgrading $._hashedName = 0; $._hashedVersion = 0; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(); } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {IERC-5267}. */ function eip712Domain() public view virtual returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { EIP712Storage storage $ = _getEIP712Storage(); // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized // and the EIP712 domain is not reliable, as it will be missing name and version. require($._hashedName == 0 && $._hashedVersion == 0, "EIP712: Uninitialized"); return ( hex"0f", // 01111 _EIP712Name(), _EIP712Version(), block.chainid, address(this), bytes32(0), new uint256[](0) ); } /** * @dev The name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712Name() internal view virtual returns (string memory) { EIP712Storage storage $ = _getEIP712Storage(); return $._name; } /** * @dev The version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712Version() internal view virtual returns (string memory) { EIP712Storage storage $ = _getEIP712Storage(); return $._version; } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead. */ function _EIP712NameHash() internal view returns (bytes32) { EIP712Storage storage $ = _getEIP712Storage(); string memory name = _EIP712Name(); if (bytes(name).length > 0) { return keccak256(bytes(name)); } else { // If the name is empty, the contract may have been upgraded without initializing the new storage. // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design. bytes32 hashedName = $._hashedName; if (hashedName != 0) { return hashedName; } else { return keccak256(""); } } } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead. */ function _EIP712VersionHash() internal view returns (bytes32) { EIP712Storage storage $ = _getEIP712Storage(); string memory version = _EIP712Version(); if (bytes(version).length > 0) { return keccak256(bytes(version)); } else { // If the version is empty, the contract may have been upgraded without initializing the new storage. // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design. bytes32 hashedVersion = $._hashedVersion; if (hashedVersion != 0) { return hashedVersion; } else { return keccak256(""); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides tracking nonces for addresses. Nonces will only increment. */ abstract contract NoncesUpgradeable is Initializable { /** * @dev The nonce used for an `account` is not the expected current nonce. */ error InvalidAccountNonce(address account, uint256 currentNonce); /// @custom:storage-location erc7201:openzeppelin.storage.Nonces struct NoncesStorage { mapping(address account => uint256) _nonces; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Nonces")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant NoncesStorageLocation = 0x5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb00; function _getNoncesStorage() private pure returns (NoncesStorage storage $) { assembly { $.slot := NoncesStorageLocation } } function __Nonces_init() internal onlyInitializing { } function __Nonces_init_unchained() internal onlyInitializing { } /** * @dev Returns the next unused nonce for an address. */ function nonces(address owner) public view virtual returns (uint256) { NoncesStorage storage $ = _getNoncesStorage(); return $._nonces[owner]; } /** * @dev Consumes a nonce. * * Returns the current value and increments nonce. */ function _useNonce(address owner) internal virtual returns (uint256) { NoncesStorage storage $ = _getNoncesStorage(); // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be // decremented or reset. This guarantees that the nonce never overflows. unchecked { // It is important to do x++ and not ++x here. return $._nonces[owner]++; } } /** * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`. */ function _useCheckedNonce(address owner, uint256 nonce) internal virtual { uint256 current = _useNonce(owner); if (nonce != current) { revert InvalidAccountNonce(owner, current); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // On the first call to nonReentrant, _status will be NOT_ENTERED if ($._status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail $._status = ENTERED; } function _nonReentrantAfter() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) $._status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/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: * * ```solidity * 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}: * * ```solidity * 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. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @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 virtual returns (bool) { return _roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { if (!hasRole(role, account)) { _roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { if (hasRole(role, account)) { _roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @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. */ 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 `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.20; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "../beacon/IBeacon.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.20; import {IERC1155} from "./IERC1155.sol"; import {IERC1155Receiver} from "./IERC1155Receiver.sol"; import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol"; import {Context} from "../../utils/Context.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; import {Arrays} from "../../utils/Arrays.sol"; import {IERC1155Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 */ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors { using Arrays for uint256[]; using Arrays for address[]; mapping(uint256 id => mapping(address account => uint256)) private _balances; mapping(address account => mapping(address operator => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256 /* id */) public view virtual returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. */ function balanceOf(address account, uint256 id) public view virtual returns (uint256) { return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] memory accounts, uint256[] memory ids ) public view virtual returns (uint256[] memory) { if (accounts.length != ids.length) { revert ERC1155InvalidArrayLength(ids.length, accounts.length); } uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i)); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeTransferFrom(from, to, id, value, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeBatchTransferFrom(from, to, ids, values, data); } /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from` * (or `to`) is the zero address. * * Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise. * * Requirements: * * - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} * or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. * - `ids` and `values` must have the same length. * * NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead. */ function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual { if (ids.length != values.length) { revert ERC1155InvalidArrayLength(ids.length, values.length); } address operator = _msgSender(); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids.unsafeMemoryAccess(i); uint256 value = values.unsafeMemoryAccess(i); if (from != address(0)) { uint256 fromBalance = _balances[id][from]; if (fromBalance < value) { revert ERC1155InsufficientBalance(from, fromBalance, value, id); } unchecked { // Overflow not possible: value <= fromBalance _balances[id][from] = fromBalance - value; } } if (to != address(0)) { _balances[id][to] += value; } } if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); emit TransferSingle(operator, from, to, id, value); } else { emit TransferBatch(operator, from, to, ids, values); } } /** * @dev Version of {_update} that performs the token acceptance check by calling * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it * contains code (eg. is a smart contract at the moment of execution). * * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any * update to the contract state after this function would break the check-effect-interaction pattern. Consider * overriding {_update} instead. */ function _updateWithAcceptanceCheck( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal virtual { _update(from, to, ids, values); if (to != address(0)) { address operator = _msgSender(); if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); _doSafeTransferAcceptanceCheck(operator, from, to, id, value, data); } else { _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data); } } } /** * @dev Transfers a `value` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. * - `ids` and `values` must have the same length. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, to, ids, values, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the values in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint(address to, uint256 id, uint256 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `values` must have the same length. * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev Destroys a `value` amount of tokens of type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. */ function _burn(address from, uint256 id, uint256 value) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. * - `ids` and `values` must have the same length. */ function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the zero address. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { if (operator == address(0)) { revert ERC1155InvalidOperator(address(0)); } _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address * if it contains code at the moment of execution. */ function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 value, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address * if it contains code at the moment of execution. */ function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Creates an array in memory with only one value for each of the elements provided. */ function _asSingletonArrays( uint256 element1, uint256 element2 ) private pure returns (uint256[] memory array1, uint256[] memory array2) { /// @solidity memory-safe-assembly assembly { // Load the free memory pointer array1 := mload(0x40) // Set array length to 1 mstore(array1, 1) // Store the single element at the next word after the length (where content starts) mstore(add(array1, 0x20), element1) // Repeat for next array locating it right after the first array array2 := add(array1, 0x40) mstore(array2, 1) mstore(add(array2, 0x20), element2) // Update the free memory pointer by pointing after the second array mstore(0x40, add(array2, 0x40)) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Burnable.sol) pragma solidity ^0.8.20; import {ERC1155} from "../ERC1155.sol"; /** * @dev Extension of {ERC1155} that allows token holders to destroy both their * own tokens and those that they have been approved to use. */ abstract contract ERC1155Burnable is ERC1155 { function burn(address account, uint256 id, uint256 value) public virtual { if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) { revert ERC1155MissingApprovalForAll(_msgSender(), account); } _burn(account, id, value); } function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual { if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) { revert ERC1155MissingApprovalForAll(_msgSender(), account); } _burnBatch(account, ids, values); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Supply.sol) pragma solidity ^0.8.20; import {ERC1155} from "../ERC1155.sol"; /** * @dev Extension of ERC1155 that adds tracking of total supply per id. * * Useful for scenarios where Fungible and Non-fungible tokens have to be * clearly identified. Note: While a totalSupply of 1 might mean the * corresponding is an NFT, there is no guarantees that no other token with the * same id are not going to be minted. * * NOTE: This contract implies a global limit of 2**256 - 1 to the number of tokens * that can be minted. * * CAUTION: This extension should not be added in an upgrade to an already deployed contract. */ abstract contract ERC1155Supply is ERC1155 { mapping(uint256 id => uint256) private _totalSupply; uint256 private _totalSupplyAll; /** * @dev Total value of tokens in with a given id. */ function totalSupply(uint256 id) public view virtual returns (uint256) { return _totalSupply[id]; } /** * @dev Total value of tokens. */ function totalSupply() public view virtual returns (uint256) { return _totalSupplyAll; } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 id) public view virtual returns (bool) { return totalSupply(id) > 0; } /** * @dev See {ERC1155-_update}. */ function _update( address from, address to, uint256[] memory ids, uint256[] memory values ) internal virtual override { super._update(from, to, ids, values); if (from == address(0)) { uint256 totalMintValue = 0; for (uint256 i = 0; i < ids.length; ++i) { uint256 value = values[i]; // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply[ids[i]] += value; totalMintValue += value; } // Overflow check required: The rest of the code assumes that totalSupplyAll never overflows _totalSupplyAll += totalMintValue; } if (to == address(0)) { uint256 totalBurnValue = 0; for (uint256 i = 0; i < ids.length; ++i) { uint256 value = values[i]; unchecked { // Overflow not possible: values[i] <= balanceOf(from, ids[i]) <= totalSupply(ids[i]) _totalSupply[ids[i]] -= value; // Overflow not possible: sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll totalBurnValue += value; } } unchecked { // Overflow not possible: totalBurnValue = sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll _totalSupplyAll -= totalBurnValue; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.20; import {IERC1155} from "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the value of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. * * Requirements: * * - `ids` and `values` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.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}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * 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. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * 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 returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual 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 default value returned by this function, unless * it's 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 returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` 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. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; import {Math} from "./math/Math.sol"; /** * @dev Collection of functions related to array types. */ library Arrays { using StorageSlot for bytes32; /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * * `array` is expected to be sorted in ascending order, and to contain no * repeated elements. */ function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { uint256 low = 0; uint256 high = array.length; if (high == 0) { return 0; } while (low < high) { uint256 mid = Math.average(low, high); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds towards zero (it does integer division with truncation). if (unsafeAccess(array, mid).value > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && unsafeAccess(array, low - 1).value == element) { return low - 1; } else { return low; } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getAddressSlot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getBytes32Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getUint256Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @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 } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile 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 {MessageHashUtils-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] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { 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. /// @solidity memory-safe-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 { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile 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 {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); 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] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // 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, s); } // 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, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @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, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./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); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; 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_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; interface IERC2981Royalties { function royaltyInfo( uint256 _tokenId, uint256 _value ) external view returns (address _receiver, uint256 _royaltyAmount); } /// @dev This is a contract used to add ERC2981 support to ERC721 and 1155 abstract contract ERC2981Base is ERC165, IERC2981Royalties { struct RoyaltyInfo { address recipient; uint24 amount; } /// @inheritdoc ERC165 function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC2981Royalties).interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol'; import '@openzeppelin/contracts/access/AccessControl.sol'; import '@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol'; import '@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol'; import './ERC2981Base.sol'; import './libs/SafeMath.sol'; import './libs/SignedSafeMath.sol'; import './interfaces/IBlast.sol'; // import 'hardhat/console.sol'; contract Gangster is ERC1155, AccessControl, ERC1155Burnable, ERC1155Supply, ERC2981Base { using SafeMath for uint256; using SignedSafeMath for int256; IBlast public constant BLAST = IBlast(0x4300000000000000000000000000000000000002); bytes32 public constant URI_SETTER_ROLE = keccak256('URI_SETTER_ROLE'); bytes32 public constant MINTER_ROLE = keccak256('MINTER_ROLE'); RoyaltyInfo private _royalties; address private gasFeeOperator_; string public name = 'Gangster'; string public symbol = 'Gangster'; constructor(address defaultAdmin, address minter) ERC1155('') { _grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin); _grantRole(URI_SETTER_ROLE, defaultAdmin); _grantRole(MINTER_ROLE, defaultAdmin); _grantRole(MINTER_ROLE, minter); // BLAST.configureClaimableGas(); } /** * Claim gas */ function claimGas(bool _maxOnly) public onlyRole(DEFAULT_ADMIN_ROLE) { require(gasFeeOperator_ != address(0), 'gasFee is not set'); if (_maxOnly) { BLAST.claimMaxGas(address(this), gasFeeOperator_); } else { BLAST.claimAllGas(address(this), gasFeeOperator_); } } function setURI(string memory newuri) public onlyRole(URI_SETTER_ROLE) { _setURI(newuri); } /** * set GasFeeOperator */ function setGasFeeOperator(address _gasFeeOperator) public onlyRole(DEFAULT_ADMIN_ROLE) { gasFeeOperator_ = _gasFeeOperator; } /** * @notice Pre-sale buy gangster */ function mint(address account, uint256 id, uint256 amount, bytes memory data) public onlyRole(MINTER_ROLE) { _mint(account, id, amount, data); } /** * @dev See {IERC1155-setApprovalForAll}. */ function approvalForWithdraw(address operator, bool approved) public onlyRole(DEFAULT_ADMIN_ROLE) { _setApprovalForAll(address(this), operator, approved); } // The following functions are overrides required by Solidity. function _update( address from, address to, uint256[] memory ids, uint256[] memory values ) internal override(ERC1155, ERC1155Supply) { super._update(from, to, ids, values); } // Value is in basis points so 10000 = 100% , 100 = 1% etc function setRoyalties(address recipient, uint256 value) external onlyRole(DEFAULT_ADMIN_ROLE) { require(value <= 10000, 'ERC2981Royalties: Too high'); _royalties = RoyaltyInfo(recipient, uint24(value)); } function royaltyInfo( uint256, uint256 value ) external view override returns (address receiver, uint256 royaltyAmount) { RoyaltyInfo memory royalties = _royalties; receiver = royalties.recipient; royaltyAmount = (value * royalties.amount) / 10000; } function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC1155, AccessControl, ERC2981Base) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; // import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; // import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; // import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol'; // import '@openzeppelin/contracts/access/AccessControl.sol'; // import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol'; // import '@openzeppelin/contracts/utils/ReentrancyGuard.sol'; import '@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol'; import '@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol'; import '@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol'; // import '@openzeppelin/contracts/access/Ownable.sol'; import './libs/SafeMath.sol'; import './libs/SafeTransferLib.sol'; import './interfaces/IUniswapV2Factory.sol'; import './interfaces/IUniswapV2Pair.sol'; import './interfaces/IBlast.sol'; // import 'hardhat/console.sol'; contract GOLD is Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, AccessControlUpgradeable, ERC20PermitUpgradeable, UUPSUpgradeable, ReentrancyGuardUpgradeable { using SafeMath for uint256; using SafeTransferLib for address payable; IBlast public constant BLAST = IBlast(0x4300000000000000000000000000000000000002); address private gasFeeOperator_; bytes32 public constant ADMIN_ROLE = keccak256('ADMIN_ROLE'); bytes32 public constant WORKER_ROLE = keccak256('WORKER_ROLE'); bytes32 public constant MINTER_ROLE = keccak256('MINTER_ROLE'); bytes32 public constant UPGRADER_ROLE = keccak256('UPGRADER_ROLE'); address public uniswapV2Pair; uint256 public totalFees; // 5_00 = 5% /******************/ mapping(address => bool) private _isExcludedFromFees; event ExcludeFromFees(address indexed account, bool isExcluded); event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize(address defaultAdmin, address minter, address upgrader) public initializer { __ERC20_init('GOLD', 'GOLD'); __ERC20Burnable_init(); __AccessControl_init(); __ERC20Permit_init('GOLD'); __UUPSUpgradeable_init(); _grantRole(ADMIN_ROLE, defaultAdmin); _grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin); _grantRole(MINTER_ROLE, minter); _grantRole(UPGRADER_ROLE, upgrader); excludeFromFees(address(0), true); excludeFromFees(address(this), true); // BLAST.configureClaimableGas(); // Init configuration totalFees = 0; // 0% } receive() external payable {} /** *************************** * UPGRADER_ROLE *************************** */ function _authorizeUpgrade(address newImplementation) internal override onlyRole(UPGRADER_ROLE) {} /** *************************** * Public *************************** */ /** * Claim gas */ function claimGas(bool _maxOnly) public onlyRole(ADMIN_ROLE) { require(gasFeeOperator_ != address(0), 'gasFee is not set'); if (_maxOnly) { BLAST.claimMaxGas(address(this), gasFeeOperator_); } else { BLAST.claimAllGas(address(this), gasFeeOperator_); } } /** *************************** * DEFAULT_ADMIN_ROLE *************************** */ function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) { _mint(to, amount); } /** *************************** * Customization for the contract (ADMIN_ROLE) *************************** */ /** * set GasFeeOperator */ function setGasFeeOperator(address _gasFeeOperator) public onlyRole(ADMIN_ROLE) { gasFeeOperator_ = _gasFeeOperator; } function updateUniswapAddresses(address _uniswapV2Pair) public onlyRole(ADMIN_ROLE) { uniswapV2Pair = _uniswapV2Pair; } function updateFees(uint256 _totalFee) external onlyRole(ADMIN_ROLE) { require(_totalFee <= 10000, 'Fees must be <= 10000.'); totalFees = _totalFee; } function excludeFromFees(address account, bool excluded) public onlyRole(ADMIN_ROLE) { _isExcludedFromFees[account] = excluded; emit ExcludeFromFees(account, excluded); } function isExcludedFromFees(address account) public view returns (bool) { return _isExcludedFromFees[account]; } function withdrawTokenFee(uint256 amount) external onlyRole(WORKER_ROLE) { uint256 balance = IERC20(address(this)).balanceOf(address(this)); require(balance >= amount, 'Insufficient balance.'); IERC20(address(this)).transfer(msg.sender, balance); payable(msg.sender).transfer(address(this).balance); } function withdrawStuckToken() external onlyRole(DEFAULT_ADMIN_ROLE) { uint256 balance = IERC20(address(this)).balanceOf(address(this)); IERC20(address(this)).transfer(msg.sender, balance); payable(msg.sender).transfer(address(this).balance); } function withdrawStuckEth(address toAddr) external onlyRole(DEFAULT_ADMIN_ROLE) { address payable receiver = payable(toAddr); (bool sent, ) = receiver.call{value: address(this).balance}(''); require(sent, 'Failed to send Ether'); } /** *************************** Private *************************** */ function _update(address from, address to, uint256 amount) internal override { if (amount == 0) return; bool isBuy = from == uniswapV2Pair; bool isSell = to == uniswapV2Pair; // only take fees on buys/sells, do not take on wallet transfers bool takeFee = totalFees > 0 && !_isExcludedFromFees[from] && !_isExcludedFromFees[to] && (isSell || isBuy); if (takeFee) { uint256 fees = amount.mul(totalFees).div(10000); amount -= fees; if (fees > 0) { super._update(from, address(this), fees); } } super._update(from, to, amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; interface IGangsterArena { /** *************************** Event *************************** */ event Received(address, uint); event AddReward(address, uint); event BuyGangster(address indexed to, uint256 tokenId, uint256 amount, uint256 nonce); event BuyGoon(address indexed to, uint256 amount, uint256 nonce); event BuySafeHouse(address indexed to, uint256 amount, uint256 nonce); event BuyPistol(address indexed to, uint256 amount, uint256 nonce); event BuyShield(address indexed to, uint256 amount, uint256 nonce); event BuyAugmentRoll(address indexed to, uint256 nonce); event DailySpin(address indexed to, uint256 spinType, uint256 amount, uint256 value, uint256 nonce); event Deposit(address indexed from, address indexed to, uint256 tokenId, uint256 amount); event Withdraw(address indexed to, uint256 tokenId, uint256 amount); event Burn(address[] to, uint256[] tokenId, uint256[] amount); event BurnGoon(address[] to, uint256[] amount); event Retire(address to, uint256 reward, uint256 nonce); event WarResult(address[] addr, uint256[] _lGang); event JoinCrew(address to, uint256 _nonce); event BuyStartPack(address indexed addr, uint256 indexed packId, uint256 numberOfGangster, uint256 nonce); /** *************************** Function *************************** */ /** * public send reward from ourside to contract (ex: from LP) * */ function addReward(uint256 devValue, uint256 rankPrize, uint256 reputationPrize) external payable; /** * Buy Gangster as NFT */ // function buyGangster( // uint256 amount, // uint256 value, // uint256 time, // uint256 nGangster, // uint256 nonce, // uint256 bType, // bytes memory sig // ) external; /** * Buy game asset (Goon/Safehouse) */ // function buyAsset( // uint256 _typeA, // uint256 _amount, // uint256 _value, // uint256 _lastB, // uint256 _sTime, // address _ref, // uint256 _refPercent, // uint256 _nonce, // bytes memory _sig // ) external; /** * Deposit NFT to game */ function depositNFT(address to, uint256 amount) external; /** * Withdraw NFT from game */ function withdrawNFT(address to, uint256 amount) external; /** * War result pay out */ function finalWarResult(address[] memory addr, uint256[] memory _lGang) external; /** * Winner pay out */ function setWinner(address[] memory to, uint256[] memory _ethReward, uint256[] memory _tokenReward) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; enum YieldMode { AUTOMATIC, VOID, CLAIMABLE } enum GasMode { VOID, CLAIMABLE } interface IBlast { // configure function configureContract(address contractAddress, YieldMode _yield, GasMode gasMode, address governor) external; function configure(YieldMode _yield, GasMode gasMode, address governor) external; // base configuration options function configureClaimableYield() external; function configureClaimableYieldOnBehalf(address contractAddress) external; function configureAutomaticYield() external; function configureAutomaticYieldOnBehalf(address contractAddress) external; function configureVoidYield() external; function configureVoidYieldOnBehalf(address contractAddress) external; function configureClaimableGas() external; function configureClaimableGasOnBehalf(address contractAddress) external; function configureVoidGas() external; function configureVoidGasOnBehalf(address contractAddress) external; function configureGovernor(address _governor) external; function configureGovernorOnBehalf(address _newGovernor, address contractAddress) external; // claim yield function claimYield(address contractAddress, address recipientOfYield, uint256 amount) external returns (uint256); function claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256); // claim gas function claimAllGas(address contractAddress, address recipientOfGas) external returns (uint256); function claimGasAtMinClaimRate( address contractAddress, address recipientOfGas, uint256 minClaimRateBips ) external returns (uint256); function claimMaxGas(address contractAddress, address recipientOfGas) external returns (uint256); function claimGas( address contractAddress, address recipientOfGas, uint256 gasToClaim, uint256 gasSecondsToConsume ) external returns (uint256); // read functions function readClaimableYield(address contractAddress) external view returns (uint256); function readYieldConfiguration(address contractAddress) external view returns (uint8); function readGasParams( address contractAddress ) external view returns (uint256 etherSeconds, uint256 etherBalance, uint256 lastUpdated, GasMode); } interface IBlastPoints { function configurePointsOperator(address operator) external; function configurePointsOperatorOnBehalf(address contractAddress, address operator) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint256); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint256) external view returns (address pair); function allPairsLength() external view returns (uint256); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint256); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol'; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. /// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller. library SafeTransferLib { /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; /// @solidity memory-safe-assembly assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } require(success, 'ETH_TRANSFER_FAILED'); } /*////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom(ERC20 token, address from, address to, uint256 amount) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "from" argument. mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 100, 0, 32) ) } require(success, 'TRANSFER_FROM_FAILED'); } function safeTransfer(ERC20 token, address to, uint256 amount) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, 'TRANSFER_FAILED'); } function safeApprove(ERC20 token, address to, uint256 amount) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, 'APPROVE_FAILED'); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SignedSafeMath { int256 private constant _INT256_MIN = -2 ** 255; /** * @dev Returns the multiplication of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } require(!(a == -1 && b == _INT256_MIN), 'SignedSafeMath: multiplication overflow'); int256 c = a * b; require(c / a == b, 'SignedSafeMath: multiplication overflow'); return c; } /** * @dev Returns the integer division of two signed integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, 'SignedSafeMath: division by zero'); require(!(b == -1 && a == _INT256_MIN), 'SignedSafeMath: division overflow'); int256 c = a / b; return c; } /** * @dev Returns the subtraction of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a), 'SignedSafeMath: subtraction overflow'); return c; } /** * @dev Returns the addition of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a), 'SignedSafeMath: addition overflow'); return c; } function toUInt256(int256 a) internal pure returns (uint256) { require(a >= 0, 'Integer < 0'); return uint256(a); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SignerLib { /** *************************** Internal Function *************************** */ /** * @notice Verify signature */ function verifyAddressSigner(address signer, bytes32 message, bytes memory sig) internal pure returns (bool) { return signer == recoverSignerFromSignature(message, sig); } //function to get the public address of the signer function recoverSignerFromSignature(bytes32 message, bytes memory sig) internal pure returns (address) { require(sig.length == 65); uint8 v; bytes32 r; bytes32 s; assembly { // first 32 bytes, after the length prefix r := mload(add(sig, 32)) // second 32 bytes s := mload(add(sig, 64)) // final byte (first byte of the next 32 bytes) v := byte(0, mload(add(sig, 96))) } return ecrecover(message, v, r, s); } // Builds a prefixed hash to mimic the behavior of eth_sign. function prefixed(bytes32 _hashedMessage) internal pure returns (bytes32) { bytes memory prefix = '\x19Ethereum Signed Message:\n32'; bytes32 prefixedHashMessage = keccak256(abi.encodePacked(prefix, _hashedMessage)); return prefixedHashMessage; } }
{ "evmVersion": "paris", "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_defaultAdmin","type":"address"},{"internalType":"address","name":"_adminAddress","type":"address"},{"internalType":"address","name":"_workerAddress","type":"address"},{"internalType":"address","name":"_signerAddress","type":"address"},{"internalType":"address","name":"_gangsterAddress","type":"address"},{"internalType":"address payable","name":"_fiatAddress","type":"address"},{"internalType":"address","name":"_pointsOperator","type":"address"},{"internalType":"address","name":"_blastPointAddr","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"AddReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"to","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"tokenId","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amount","type":"uint256[]"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"to","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amount","type":"uint256[]"}],"name":"BurnGoon","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"BuyAugmentRoll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"BuyGangster","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"BuyGoon","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"BuyPistol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"BuySafeHouse","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"BuyShield","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"},{"indexed":true,"internalType":"uint256","name":"packId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"numberOfGangster","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"BuyStartPack","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"spinType","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"DailySpin","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_nonce","type":"uint256"}],"name":"JoinCrew","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"Received","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"Retire","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"addr","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"_lGang","type":"uint256[]"}],"name":"WarResult","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BLAST","outputs":[{"internalType":"contract IBlast","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PER_BATCH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WORKER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_dev","type":"uint256"},{"internalType":"uint256","name":"_reputationPrize_","type":"uint256"},{"internalType":"uint256","name":"_rankPrize_","type":"uint256"}],"name":"addReward","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"addTokenReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"auctionRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionTreasury_","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burnRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_typeA","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lastB","type":"uint256"},{"internalType":"uint256","name":"_sTime","type":"uint256"},{"internalType":"address","name":"_refAddr","type":"address"},{"internalType":"uint256","name":"_refValue","type":"uint256"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"bytes","name":"_sig","type":"bytes"}],"name":"buyAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"packId","type":"uint256"},{"internalType":"uint256","name":"ethPrice","type":"uint256"},{"internalType":"uint256","name":"_sTime","type":"uint256"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"bytes","name":"_sig","type":"bytes"}],"name":"buyStartPack","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claimAllYield","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_maxOnly","type":"bool"}],"name":"claimGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devAddr_","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"devRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emegencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ethPrize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addr","type":"address[]"},{"internalType":"uint256[]","name":"_lGang","type":"uint256[]"}],"name":"finalWarResult","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gameClosed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gangster","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gangsterBought","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gasFeeOperator_","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"greedToken","outputs":[{"internalType":"contract GOLD","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastB","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nft","outputs":[{"internalType":"contract Gangster","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pointsOperator_","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prizeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_devAddr","type":"address"},{"internalType":"address","name":"_gasFeeOperator","type":"address"},{"internalType":"address","name":"_auctionTreasury","type":"address"},{"internalType":"address","name":"_spinPool","type":"address"},{"internalType":"address","name":"_signer","type":"address"}],"name":"setGameAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_value","type":"bool"}],"name":"setGameClosed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_vtd","type":"uint256"},{"internalType":"uint256","name":"_tokenSwapLimit","type":"uint256"},{"internalType":"uint256","name":"_burnRate","type":"uint256"},{"internalType":"uint256","name":"_auctionRate","type":"uint256"},{"internalType":"uint256","name":"_prizeRate","type":"uint256"},{"internalType":"uint256","name":"_devRate","type":"uint256"}],"name":"setGameConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_lock","type":"bool"}],"name":"setLockNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"packId","type":"uint256"},{"internalType":"uint256","name":"numberOfGangster","type":"uint256"},{"internalType":"uint256","name":"MAX_PER_WALLET","type":"uint256"}],"name":"setPack","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_to","type":"address[]"},{"internalType":"uint256[]","name":"_ethReward","type":"uint256[]"},{"internalType":"uint256[]","name":"_tokenReward","type":"uint256[]"}],"name":"setWinner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_spinType","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_sTime","type":"uint256"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"bytes","name":"_sig","type":"bytes"}],"name":"spin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spinPoolAddr_","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenForLP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenPrize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenSwapLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vtd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60e06040526101f460055569065a4da25d3016c000006006556103e8600755610bb86008556117706009556000600a556000600b55603c600c553480156200004657600080fd5b50604051620065bf380380620065bf83398181016040528101906200006c91906200058f565b600180819055508373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508273ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff168152505084600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff1681525050620001656000801b896200036b60201b60201c565b50620001987fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775886200036b60201b60201c565b50620001cb7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc7876200036b60201b60201c565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146200035d578073ffffffffffffffffffffffffffffffffffffffff166336b91f2b836040518263ffffffff1660e01b81526004016200023c919062000669565b600060405180830381600087803b1580156200025757600080fd5b505af11580156200026c573d6000803e3d6000fd5b5050505073430000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff16634e606c476040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620002cd57600080fd5b505af1158015620002e2573d6000803e3d6000fd5b5050505073430000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff1663f098767a6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156200034357600080fd5b505af115801562000358573d6000803e3d6000fd5b505050505b505050505050505062000686565b60006200037f83836200046e60201b60201c565b6200046357600160008085815260200190815260200160002060000160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550620003ff620004d860201b60201c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001905062000468565b600090505b92915050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600033905090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200051282620004e5565b9050919050565b620005248162000505565b81146200053057600080fd5b50565b600081519050620005448162000519565b92915050565b60006200055782620004e5565b9050919050565b62000569816200054a565b81146200057557600080fd5b50565b60008151905062000589816200055e565b92915050565b600080600080600080600080610100898b031215620005b357620005b2620004e0565b5b6000620005c38b828c0162000533565b9850506020620005d68b828c0162000533565b9750506040620005e98b828c0162000533565b9650506060620005fc8b828c0162000533565b95505060806200060f8b828c0162000533565b94505060a0620006228b828c0162000578565b93505060c0620006358b828c0162000533565b92505060e0620006488b828c0162000533565b9150509295985092959890939650565b620006638162000505565b82525050565b600060208201905062000680600083018462000658565b92915050565b60805160a05160c051615ea06200071f6000396000612a93015260008181610d70015281816110b50152818161122d015281816112c20152818161138d01528181611458015281816117720152818161237f015281816125880152818161269b0152818161296d01526132e2015260008181611c8201528181611ef10152818161211401528181612cde0152613a320152615ea06000f3fe6080604052600436106103035760003560e01c80638d9d548211610190578063bed99850116100dc578063d547741f11610095578063f23a6e611161006f578063f23a6e6114610bc6578063f72fc7cb14610c03578063fcd2117d14610c2e578063fdbefb5914610c595761035c565b8063d547741f14610b44578063e0f06e6f14610b6d578063ede6ec5d14610b895761035c565b8063bed9985014610a42578063bee2660914610a6d578063c020b08c14610a98578063c0be0c0b14610ac3578063c957497514610aee578063d2d93f9014610b195761035c565b80639f87295011610149578063ad6190e111610123578063ad6190e11461099a578063ad85e3bd146109c3578063b943cbbb146109ee578063bc90c27314610a175761035c565b80639f8729501461091b5780639fc0db5614610946578063a217fddf1461096f5761035c565b80638d9d54821461081d57806390824c5b1461084857806391d148541461087357806397d75776146108b057806398795ee6146108db5780639b5b9b18146108f25761035c565b8063470e3ec91161024f57806362af5693116102085780636e3e40d9116101e25780636e3e40d91461077557806373a58223146107a057806375b238fc146107c95780638af02ab1146107f45761035c565b806362af5693146106f6578063634252dc1461071f5780636d99ef461461074a5761035c565b8063470e3ec9146105e657806347ccca02146106235780634c57207d1461064e5780634cb8e7601461067757806360174693146106a25780636088e93a146106cd5761035c565b80632841a143116102bc578063368b28bd11610296578063368b28bd1461055f578063409a33ce1461058857806341a21bcf1461059f57806346816290146105ca5761035c565b80632841a143146104e45780632f2ff15d1461050d57806336568abe146105365761035c565b8063010d49eb146103b057806301ffc9a7146103d9578063032db8921461041657806317d70f7c1461043f578063248a9ca31461046a5780632614160e146104a75761035c565b3661035c5734600d600082825461031a9190613e68565b925050819055507f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258743334604051610352929190613eec565b60405180910390a1005b34600d600082825461036e9190613e68565b925050819055507f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f8852587433346040516103a6929190613eec565b60405180910390a1005b3480156103bc57600080fd5b506103d760048036038101906103d29190613f55565b610c84565b005b3480156103e557600080fd5b5061040060048036038101906103fb9190614000565b610cf3565b60405161040d9190614048565b60405180910390f35b34801561042257600080fd5b5061043d600480360381019061043891906141d5565b610d6d565b005b34801561044b57600080fd5b50610454611734565b60405161046191906142bb565b60405180910390f35b34801561047657600080fd5b50610491600480360381019061048c919061430c565b611739565b60405161049e9190614348565b60405180910390f35b3480156104b357600080fd5b506104ce60048036038101906104c99190614363565b611758565b6040516104db91906142bb565b60405180910390f35b3480156104f057600080fd5b5061050b60048036038101906105069190614390565b611770565b005b34801561051957600080fd5b50610534600480360381019061052f91906143bd565b61182d565b005b34801561054257600080fd5b5061055d600480360381019061055891906143bd565b61184f565b005b34801561056b57600080fd5b5061058660048036038101906105819190614429565b6118ca565b005b34801561059457600080fd5b5061059d611912565b005b3480156105ab57600080fd5b506105b46119f4565b6040516105c191906142bb565b60405180910390f35b6105e460048036038101906105df9190613f55565b6119fa565b005b3480156105f257600080fd5b5061060d60048036038101906106089190614390565b611c68565b60405161061a91906142bb565b60405180910390f35b34801561062f57600080fd5b50610638611c80565b60405161064591906144b5565b60405180910390f35b34801561065a57600080fd5b506106756004803603810190610670919061465b565b611ca4565b005b34801561068357600080fd5b5061068c611fbe565b60405161069991906146d3565b60405180910390f35b3480156106ae57600080fd5b506106b7611fe4565b6040516106c491906142bb565b60405180910390f35b3480156106d957600080fd5b506106f460048036038101906106ef91906146ee565b611fea565b005b34801561070257600080fd5b5061071d60048036038101906107189190614429565b6121f9565b005b34801561072b57600080fd5b50610734612241565b6040516107419190614348565b60405180910390f35b34801561075657600080fd5b5061075f612265565b60405161076c9190614048565b60405180910390f35b34801561078157600080fd5b5061078a612278565b60405161079791906142bb565b60405180910390f35b3480156107ac57600080fd5b506107c760048036038101906107c2919061472e565b61227e565b005b3480156107d557600080fd5b506107de612674565b6040516107eb9190614348565b60405180910390f35b34801561080057600080fd5b5061081b600480360381019061081691906147d5565b612698565b005b34801561082957600080fd5b50610832612a8b565b60405161083f91906142bb565b60405180910390f35b34801561085457600080fd5b5061085d612a91565b60405161086a91906146d3565b60405180910390f35b34801561087f57600080fd5b5061089a600480360381019061089591906143bd565b612ab5565b6040516108a79190614048565b60405180910390f35b3480156108bc57600080fd5b506108c5612b1f565b6040516108d2919061489f565b60405180910390f35b3480156108e757600080fd5b506108f0612b37565b005b3480156108fe57600080fd5b50610919600480360381019061091491906146ee565b612c8c565b005b34801561092757600080fd5b50610930612e30565b60405161093d91906146d3565b60405180910390f35b34801561095257600080fd5b5061096d600480360381019061096891906148ba565b612e56565b005b34801561097b57600080fd5b50610984612fcd565b6040516109919190614348565b60405180910390f35b3480156109a657600080fd5b506109c160048036038101906109bc9190614935565b612fd4565b005b3480156109cf57600080fd5b506109d8613066565b6040516109e591906146d3565b60405180910390f35b3480156109fa57600080fd5b50610a156004803603810190610a109190614429565b61308c565b005b348015610a2357600080fd5b50610a2c6132c1565b604051610a3991906142bb565b60405180910390f35b348015610a4e57600080fd5b50610a576132c7565b604051610a6491906142bb565b60405180910390f35b348015610a7957600080fd5b50610a826132cd565b604051610a8f9190614048565b60405180910390f35b348015610aa457600080fd5b50610aad6132e0565b604051610aba91906149f5565b60405180910390f35b348015610acf57600080fd5b50610ad8613304565b604051610ae591906142bb565b60405180910390f35b348015610afa57600080fd5b50610b0361330a565b604051610b1091906142bb565b60405180910390f35b348015610b2557600080fd5b50610b2e613310565b604051610b3b91906142bb565b60405180910390f35b348015610b5057600080fd5b50610b6b6004803603810190610b6691906143bd565b613316565b005b610b876004803603810190610b829190614a10565b613338565b005b348015610b9557600080fd5b50610bb06004803603810190610bab9190614363565b6137fc565b604051610bbd91906142bb565b60405180910390f35b348015610bd257600080fd5b50610bed6004803603810190610be89190614b02565b613814565b604051610bfa9190614bab565b60405180910390f35b348015610c0f57600080fd5b50610c18613843565b604051610c2591906142bb565b60405180910390f35b348015610c3a57600080fd5b50610c43613849565b604051610c5091906146d3565b60405180910390f35b348015610c6557600080fd5b50610c6e61386f565b604051610c7b91906142bb565b60405180910390f35b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610cae81613875565b60405180604001604052808481526020018381525060036000868152602001908152602001600020600082015181600001556020820151816001015590505050505050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610d665750610d6582613889565b5b9050919050565b867f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b8152600401610dc9929190614bc6565b602060405180830381865afa158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a9190614c04565b1015610e4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4290614c8e565b60405180910390fd5b601360149054906101000a900460ff1615610e9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9290614cfa565b60405180910390fd5b85601460008b81526020019081526020016000205414610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790614d66565b60405180910390fd5b600c5485610efe9190613e68565b4210610f3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3690614dd2565b60405180910390fd5b6016600083815260200190815260200160002060009054906101000a900460ff1615610fa0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9790614e3e565b60405180910390fd5b6000610fe1338b8b8b8b8b8b8b8b604051602001610fc699989796959493929190614ec7565b604051602081830303815290604052805190602001206138f3565b90506110308183600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166139659092919063ffffffff16565b61106f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106690614fb6565b60405180910390fd5b60016016600085815260200190815260200160002060006101000a81548160ff02191690831515021790555042601460008c8152602001908152602001600020819055507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166323b872dd33308b6040518463ffffffff1660e01b815260040161111093929190614fd6565b6020604051808303816000875af115801561112f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111539190615022565b506000612710600a548a611167919061504f565b61117191906150c0565b905080600f60008282546111859190613e68565b925050819055505060006127106007548a6111a0919061504f565b6111aa91906150c0565b905060006127106008548b6111bf919061504f565b6111c991906150c0565b905060006127106009548c6111de919061504f565b6111e891906150c0565b90506000612710600b548d6111fd919061504f565b61120791906150c0565b905081600e600082825461121b9190613e68565b9250508190555060008411156112b7577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166342966c68856040518263ffffffff1660e01b815260040161128491906142bb565b600060405180830381600087803b15801561129e57600080fd5b505af11580156112b2573d6000803e3d6000fd5b505050505b6000831115611382577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518363ffffffff1660e01b815260040161133d929190613eec565b6020604051808303816000875af115801561135c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113809190615022565b505b600081111561144d577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401611408929190613eec565b6020604051808303816000875af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b9190615022565b505b60008811156114f6577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8a8a6040518363ffffffff1660e01b81526004016114b1929190613eec565b6020604051808303816000875af11580156114d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f49190615022565b505b60008e148015611506575060008d115b1561156957611515338e6139a8565b3373ffffffffffffffffffffffffffffffffffffffff167fcf1d432606e0ee6a23fc32ce701ac36c9897204278c35ac9d65112344b20991760018f8a604051611560939291906150f1565b60405180910390a25b60018e036115c2573373ffffffffffffffffffffffffffffffffffffffff167f759647c6e0ef64ba58a247443390ca1ca127a0e56c0ca73b8e7adb81cdea686f8e896040516115b9929190615128565b60405180910390a25b60028e0361161b573373ffffffffffffffffffffffffffffffffffffffff167f064c6c90fdf69cdb269f2989d2db58656f9f0975deb0a85bc6c3e85ce03849368e89604051611612929190615128565b60405180910390a25b60038e03611674573373ffffffffffffffffffffffffffffffffffffffff167f9841530569e3c231047b6033deea4a0cdaa8030ad02d8995de67995def9af0388e8960405161166b929190615128565b60405180910390a25b60048e036116cd573373ffffffffffffffffffffffffffffffffffffffff167fc41f685bb934317e998f0d450848c2a5c23e6e7d12b456808ffd9ddbc094e9ed8e896040516116c4929190615128565b60405180910390a25b60058e03611724573373ffffffffffffffffffffffffffffffffffffffff167f649d8b4aced808b7b0b9b1f4c3aa7f60b9205e6bf1b7d563e5b7e790844c96398860405161171b91906142bb565b60405180910390a25b5050505050505050505050505050565b600181565b6000806000838152602001908152602001600020600101549050919050565b60156020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016117cd93929190614fd6565b6020604051808303816000875af11580156117ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118109190615022565b5080600e60008282546118239190613e68565b9250508190555050565b61183682611739565b61183f81613875565b6118498383613b1a565b50505050565b611857613c0b565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146118bb576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118c58282613c13565b505050565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc76118f481613875565b81601360146101000a81548160ff0219169083151502179055505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561193c81613875565b73430000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff1663860043b630601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b81526004016119ad929190614bc6565b6020604051808303816000875af11580156119cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f09190614c04565b5050565b600c5481565b6000818385611a099190613e68565b611a139190613e68565b905080341015611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f9061519d565b60405180910390fd5b8282611a649190613e68565b600d6000828254611a759190613e68565b925050819055506000841115611b5b576000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff1686604051611ad2906151ee565b60006040518083038185875af1925050503d8060008114611b0f576040519150601f19603f3d011682016040523d82523d6000602084013e611b14565b606091505b5050905080611b58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4f9061524f565b60405180910390fd5b50505b60008134611b69919061526f565b90506000811115611c2857600033905060008173ffffffffffffffffffffffffffffffffffffffff1683604051611b9f906151ee565b60006040518083038185875af1925050503d8060008114611bdc576040519150601f19603f3d011682016040523d82523d6000602084013e611be1565b606091505b5050905080611c25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1c9061524f565b60405180910390fd5b50505b7f9f15a78649bd76613c4a49ca8a67ae948862a0eee791ca3d0380853f9afa624f3383604051611c59929190613eec565b60405180910390a15050505050565b60146020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc7611cce81613875565b601360149054906101000a900460ff1615611d1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1590614cfa565b60405180910390fd5b8151835114611d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d59906152ef565b60405180910390fd5b60005b8351811015611e3757828181518110611d8157611d8061530f565b5b602002602001015160176000868481518110611da057611d9f61530f565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611e24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1b9061538a565b60405180910390fd5b8080611e2f906153aa565b915050611d65565b506000611e4383613d05565b905060005b8451811015611eee57838181518110611e6457611e6361530f565b5b602002602001015160176000878481518110611e8357611e8261530f565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611ed4919061526f565b925050819055508080611ee6906153aa565b915050611e48565b507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f5298aca306001846040518463ffffffff1660e01b8152600401611f4d939291906153f2565b600060405180830381600087803b158015611f6757600080fd5b505af1158015611f7b573d6000803e3d6000fd5b505050507f5ba5896aa4cc7b0ad558b01a8632c8d8a65dd5dee5394b2c2b78c3ddc5f326538484604051611fb09291906155a5565b60405180910390a150505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600f5481565b601360159054906101000a900460ff161561203a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203190615628565b60405180910390fd5b80601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156120bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b390615694565b60405180910390fd5b80601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461210b919061526f565b925050819055507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f242432a30846001856040518563ffffffff1660e01b815260040161217294939291906156e8565b600060405180830381600087803b15801561218c57600080fd5b505af11580156121a0573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5686001836040516121ed929190615128565b60405180910390a25050565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc761222381613875565b81601360156101000a81548160ff0219169083151502179055505050565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc781565b601360149054906101000a900460ff1681565b600d5481565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc76122a881613875565b825184511480156122ba575081518351145b6122f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122f09061578c565b60405180910390fd5b60005b845181101561266d578381815181106123185761231761530f565b5b6020026020010151471015612362576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612359906157f8565b60405180910390fd5b8281815181106123755761237461530f565b5b60200260200101517f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016123d691906146d3565b602060405180830381865afa1580156123f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124179190614c04565b1015612458576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161244f90615864565b60405180910390fd5b600084828151811061246d5761246c61530f565b5b602002602001015111156125635760008582815181106124905761248f61530f565b5b6020026020010151905060008173ffffffffffffffffffffffffffffffffffffffff168684815181106124c6576124c561530f565b5b60200260200101516040516124da906151ee565b60006040518083038185875af1925050503d8060008114612517576040519150601f19603f3d011682016040523d82523d6000602084013e61251c565b606091505b5050905080612560576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125579061524f565b60405180910390fd5b50505b60008382815181106125785761257761530f565b5b6020026020010151111561265a577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8683815181106125d5576125d461530f565b5b60200260200101518584815181106125f0576125ef61530f565b5b60200260200101516040518363ffffffff1660e01b8152600401612615929190613eec565b6020604051808303816000875af1158015612634573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126589190615022565b505b8080612665906153aa565b9150506122fc565b5050505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b81526004016126f4929190614bc6565b602060405180830381865afa158015612711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127359190614c04565b1015612776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276d90614c8e565b60405180910390fd5b601360149054906101000a900460ff16156127c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127bd90614cfa565b60405180910390fd5b600c54836127d49190613e68565b4210612815576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161280c90614dd2565b60405180910390fd5b6016600083815260200190815260200160002060009054906101000a900460ff1615612876576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161286d90614e3e565b60405180910390fd5b60006128b133888888888860405160200161289696959493929190615884565b604051602081830303815290604052805190602001206138f3565b90506129008183600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166139659092919063ffffffff16565b61293f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161293690615940565b60405180910390fd5b60016016600085815260200190815260200160002060006101000a81548160ff0219169083151502179055507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166323b872dd33601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16886040518463ffffffff1660e01b81526004016129ea93929190614fd6565b6020604051808303816000875af1158015612a09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2d9190615022565b503373ffffffffffffffffffffffffffffffffffffffff167f13f135658b67258df1952b1efe89331bc59bde07499073b16d5f4908012dce5b88888887604051612a7a9493929190615960565b60405180910390a250505050505050565b60085481565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b73430000000000000000000000000000000000000281565b6000801b612b4481613875565b601360149054906101000a900460ff16612b93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8a906159f1565b60405180910390fd5b60004711612bd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bcd90615a5d565b60405180910390fd5b600033905060008173ffffffffffffffffffffffffffffffffffffffff1647604051612c01906151ee565b60006040518083038185875af1925050503d8060008114612c3e576040519150601f19603f3d011682016040523d82523d6000602084013e612c43565b606091505b5050905080612c87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c7e9061524f565b60405180910390fd5b505050565b601360149054906101000a900460ff1615612cdc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cd390614cfa565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f242432a33306001856040518563ffffffff1660e01b8152600401612d3c94939291906156e8565b600060405180830381600087803b158015612d5657600080fd5b505af1158015612d6a573d6000803e3d6000fd5b5050505080601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612dbd9190613e68565b925050819055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7600184604051612e24929190615128565b60405180910390a35050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775612e8081613875565b85601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050565b6000801b81565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775612ffe81613875565b86600c819055508560068190555084600781905550836008819055508260098190555081600b8190555083838387612710613039919061526f565b613043919061526f565b61304d919061526f565b613057919061526f565b600a8190555050505050505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756130b681613875565b600073ffffffffffffffffffffffffffffffffffffffff16601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603613147576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161313e90615ac9565b60405180910390fd5b81156132075773430000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff1663662aa11d30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b81526004016131be929190614bc6565b6020604051808303816000875af11580156131dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132019190614c04565b506132bd565b73430000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff1663954fa5ee30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401613278929190614bc6565b6020604051808303816000875af1158015613297573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132bb9190614c04565b505b5050565b60095481565b60075481565b601360159054906101000a900460ff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b600e5481565b600b5481565b600a5481565b61331f82611739565b61332881613875565b6133328383613c13565b50505050565b6016600083815260200190815260200160002060009054906101000a900460ff1615613399576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161339090614e3e565b60405180910390fd5b60006003600087815260200190815260200160002060010154116133f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133e990615b35565b60405180910390fd5b83341015613435576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161342c9061519d565b60405180910390fd5b600c54836134439190613e68565b4210613484576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161347b90614dd2565b60405180910390fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008681526020019081526020016000205460036000878152602001908152602001600020600101541161352c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161352390615ba1565b60405180910390fd5b6000613563338686866040516020016135489493929190615bc1565b604051602081830303815290604052805190602001206138f3565b90506135b28183600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166139659092919063ffffffff16565b6135f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135e890614fb6565b60405180910390fd5b60016016600085815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600360008881526020019081526020016000206040518060400160405290816000820154815260200160018201548152505090506001600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600089815260200190815260200160002060008282546136b49190613e68565b925050819055506000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff1634604051613708906151ee565b60006040518083038185875af1925050503d8060008114613745576040519150601f19603f3d011682016040523d82523d6000602084013e61374a565b606091505b505090508061378e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137859061524f565b60405180910390fd5b61379c3384600001516139a8565b883373ffffffffffffffffffffffffffffffffffffffff167fc431cb1467676373fb31be5becad518ac7951f91428603a40500207d4fe014098560000151896040516137e9929190615128565b60405180910390a3505050505050505050565b60176020528060005260406000206000915090505481565b60007ff23a6e612e1ff4830e658fe43f4e3cb4a5f8170bd5d9e69fb5d7a7fa9e4fdf9790509695505050505050565b60055481565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b61388681613881613c0b565b613d57565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6000806040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250905060008184604051602001613943929190615c96565b6040516020818303038152906040528051906020012090508092505050919050565b60006139718383613da8565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161490509392505050565b600081036139eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016139e290615d0a565b60405180910390fd5b600554811115613a30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a2790615d76565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663731133e9306001846040518463ffffffff1660e01b8152600401613a8e93929190615d96565b600060405180830381600087803b158015613aa857600080fd5b505af1158015613abc573d6000803e3d6000fd5b5050505080601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613b0f9190613e68565b925050819055505050565b6000613b268383612ab5565b613c0057600160008085815260200190815260200160002060000160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550613b9d613c0b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019050613c05565b600090505b92915050565b600033905090565b6000613c1f8383612ab5565b15613cfa57600080600085815260200190815260200160002060000160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550613c97613c0b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a460019050613cff565b600090505b92915050565b600080600090505b8251811015613d5157828181518110613d2957613d2861530f565b5b602002602001015182613d3c9190613e68565b91508080613d49906153aa565b915050613d0d565b50919050565b613d618282612ab5565b613da45780826040517fe2517d3f000000000000000000000000000000000000000000000000000000008152600401613d9b929190615de0565b60405180910390fd5b5050565b60006041825114613db857600080fd5b60008060006020850151915060408501519050606085015160001a925060018684848460405160008152602001604052604051613df89493929190615e25565b6020604051602081039080840390855afa158015613e1a573d6000803e3d6000fd5b50505060206040510351935050505092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613e7382613e2f565b9150613e7e83613e2f565b9250828201905080821115613e9657613e95613e39565b5b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613ec782613e9c565b9050919050565b613ed781613ebc565b82525050565b613ee681613e2f565b82525050565b6000604082019050613f016000830185613ece565b613f0e6020830184613edd565b9392505050565b6000604051905090565b600080fd5b600080fd5b613f3281613e2f565b8114613f3d57600080fd5b50565b600081359050613f4f81613f29565b92915050565b600080600060608486031215613f6e57613f6d613f1f565b5b6000613f7c86828701613f40565b9350506020613f8d86828701613f40565b9250506040613f9e86828701613f40565b9150509250925092565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613fdd81613fa8565b8114613fe857600080fd5b50565b600081359050613ffa81613fd4565b92915050565b60006020828403121561401657614015613f1f565b5b600061402484828501613feb565b91505092915050565b60008115159050919050565b6140428161402d565b82525050565b600060208201905061405d6000830184614039565b92915050565b61406c81613ebc565b811461407757600080fd5b50565b60008135905061408981614063565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6140e282614099565b810181811067ffffffffffffffff82111715614101576141006140aa565b5b80604052505050565b6000614114613f15565b905061412082826140d9565b919050565b600067ffffffffffffffff8211156141405761413f6140aa565b5b61414982614099565b9050602081019050919050565b82818337600083830152505050565b600061417861417384614125565b61410a565b90508281526020810184848401111561419457614193614094565b5b61419f848285614156565b509392505050565b600082601f8301126141bc576141bb61408f565b5b81356141cc848260208601614165565b91505092915050565b60008060008060008060008060006101208a8c0312156141f8576141f7613f1f565b5b60006142068c828d01613f40565b99505060206142178c828d01613f40565b98505060406142288c828d01613f40565b97505060606142398c828d01613f40565b965050608061424a8c828d01613f40565b95505060a061425b8c828d0161407a565b94505060c061426c8c828d01613f40565b93505060e061427d8c828d01613f40565b9250506101008a013567ffffffffffffffff81111561429f5761429e613f24565b5b6142ab8c828d016141a7565b9150509295985092959850929598565b60006020820190506142d06000830184613edd565b92915050565b6000819050919050565b6142e9816142d6565b81146142f457600080fd5b50565b600081359050614306816142e0565b92915050565b60006020828403121561432257614321613f1f565b5b6000614330848285016142f7565b91505092915050565b614342816142d6565b82525050565b600060208201905061435d6000830184614339565b92915050565b60006020828403121561437957614378613f1f565b5b60006143878482850161407a565b91505092915050565b6000602082840312156143a6576143a5613f1f565b5b60006143b484828501613f40565b91505092915050565b600080604083850312156143d4576143d3613f1f565b5b60006143e2858286016142f7565b92505060206143f38582860161407a565b9150509250929050565b6144068161402d565b811461441157600080fd5b50565b600081359050614423816143fd565b92915050565b60006020828403121561443f5761443e613f1f565b5b600061444d84828501614414565b91505092915050565b6000819050919050565b600061447b61447661447184613e9c565b614456565b613e9c565b9050919050565b600061448d82614460565b9050919050565b600061449f82614482565b9050919050565b6144af81614494565b82525050565b60006020820190506144ca60008301846144a6565b92915050565b600067ffffffffffffffff8211156144eb576144ea6140aa565b5b602082029050602081019050919050565b600080fd5b600061451461450f846144d0565b61410a565b90508083825260208201905060208402830185811115614537576145366144fc565b5b835b81811015614560578061454c888261407a565b845260208401935050602081019050614539565b5050509392505050565b600082601f83011261457f5761457e61408f565b5b813561458f848260208601614501565b91505092915050565b600067ffffffffffffffff8211156145b3576145b26140aa565b5b602082029050602081019050919050565b60006145d76145d284614598565b61410a565b905080838252602082019050602084028301858111156145fa576145f96144fc565b5b835b81811015614623578061460f8882613f40565b8452602084019350506020810190506145fc565b5050509392505050565b600082601f8301126146425761464161408f565b5b81356146528482602086016145c4565b91505092915050565b6000806040838503121561467257614671613f1f565b5b600083013567ffffffffffffffff8111156146905761468f613f24565b5b61469c8582860161456a565b925050602083013567ffffffffffffffff8111156146bd576146bc613f24565b5b6146c98582860161462d565b9150509250929050565b60006020820190506146e86000830184613ece565b92915050565b6000806040838503121561470557614704613f1f565b5b60006147138582860161407a565b925050602061472485828601613f40565b9150509250929050565b60008060006060848603121561474757614746613f1f565b5b600084013567ffffffffffffffff81111561476557614764613f24565b5b6147718682870161456a565b935050602084013567ffffffffffffffff81111561479257614791613f24565b5b61479e8682870161462d565b925050604084013567ffffffffffffffff8111156147bf576147be613f24565b5b6147cb8682870161462d565b9150509250925092565b60008060008060008060c087890312156147f2576147f1613f1f565b5b600061480089828a01613f40565b965050602061481189828a01613f40565b955050604061482289828a01613f40565b945050606061483389828a01613f40565b935050608061484489828a01613f40565b92505060a087013567ffffffffffffffff81111561486557614864613f24565b5b61487189828a016141a7565b9150509295509295509295565b600061488982614482565b9050919050565b6148998161487e565b82525050565b60006020820190506148b46000830184614890565b92915050565b600080600080600060a086880312156148d6576148d5613f1f565b5b60006148e48882890161407a565b95505060206148f58882890161407a565b94505060406149068882890161407a565b93505060606149178882890161407a565b92505060806149288882890161407a565b9150509295509295909350565b60008060008060008060c0878903121561495257614951613f1f565b5b600061496089828a01613f40565b965050602061497189828a01613f40565b955050604061498289828a01613f40565b945050606061499389828a01613f40565b93505060806149a489828a01613f40565b92505060a06149b589828a01613f40565b9150509295509295509295565b60006149cd82614460565b9050919050565b60006149df826149c2565b9050919050565b6149ef816149d4565b82525050565b6000602082019050614a0a60008301846149e6565b92915050565b600080600080600060a08688031215614a2c57614a2b613f1f565b5b6000614a3a88828901613f40565b9550506020614a4b88828901613f40565b9450506040614a5c88828901613f40565b9350506060614a6d88828901613f40565b925050608086013567ffffffffffffffff811115614a8e57614a8d613f24565b5b614a9a888289016141a7565b9150509295509295909350565b600080fd5b60008083601f840112614ac257614ac161408f565b5b8235905067ffffffffffffffff811115614adf57614ade614aa7565b5b602083019150836001820283011115614afb57614afa6144fc565b5b9250929050565b60008060008060008060a08789031215614b1f57614b1e613f1f565b5b6000614b2d89828a0161407a565b9650506020614b3e89828a0161407a565b9550506040614b4f89828a01613f40565b9450506060614b6089828a01613f40565b935050608087013567ffffffffffffffff811115614b8157614b80613f24565b5b614b8d89828a01614aac565b92509250509295509295509295565b614ba581613fa8565b82525050565b6000602082019050614bc06000830184614b9c565b92915050565b6000604082019050614bdb6000830185613ece565b614be86020830184613ece565b9392505050565b600081519050614bfe81613f29565b92915050565b600060208284031215614c1a57614c19613f1f565b5b6000614c2884828501614bef565b91505092915050565b600082825260208201905092915050565b7f4572726f72000000000000000000000000000000000000000000000000000000600082015250565b6000614c78600583614c31565b9150614c8382614c42565b602082019050919050565b60006020820190508181036000830152614ca781614c6b565b9050919050565b7f47616d6520697320636c6f736564000000000000000000000000000000000000600082015250565b6000614ce4600e83614c31565b9150614cef82614cae565b602082019050919050565b60006020820190508181036000830152614d1381614cd7565b9050919050565b7f496e76616c6964206c617374206275792074696d650000000000000000000000600082015250565b6000614d50601583614c31565b9150614d5b82614d1a565b602082019050919050565b60006020820190508181036000830152614d7f81614d43565b9050919050565b7f496e76616c69642074696d657374616d70000000000000000000000000000000600082015250565b6000614dbc601183614c31565b9150614dc782614d86565b602082019050919050565b60006020820190508181036000830152614deb81614daf565b9050919050565b7f4e6f6e6365206973207573656400000000000000000000000000000000000000600082015250565b6000614e28600d83614c31565b9150614e3382614df2565b602082019050919050565b60006020820190508181036000830152614e5781614e1b565b9050919050565b60008160601b9050919050565b6000614e7682614e5e565b9050919050565b6000614e8882614e6b565b9050919050565b614ea0614e9b82613ebc565b614e7d565b82525050565b6000819050919050565b614ec1614ebc82613e2f565b614ea6565b82525050565b6000614ed3828c614e8f565b601482019150614ee3828b614eb0565b602082019150614ef3828a614eb0565b602082019150614f038289614eb0565b602082019150614f138288614eb0565b602082019150614f238287614eb0565b602082019150614f338286614e8f565b601482019150614f438285614eb0565b602082019150614f538284614eb0565b6020820191508190509a9950505050505050505050565b7f494e56414c49445f5349474e0000000000000000000000000000000000000000600082015250565b6000614fa0600c83614c31565b9150614fab82614f6a565b602082019050919050565b60006020820190508181036000830152614fcf81614f93565b9050919050565b6000606082019050614feb6000830186613ece565b614ff86020830185613ece565b6150056040830184613edd565b949350505050565b60008151905061501c816143fd565b92915050565b60006020828403121561503857615037613f1f565b5b60006150468482850161500d565b91505092915050565b600061505a82613e2f565b915061506583613e2f565b925082820261507381613e2f565b9150828204841483151761508a57615089613e39565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006150cb82613e2f565b91506150d683613e2f565b9250826150e6576150e5615091565b5b828204905092915050565b60006060820190506151066000830186613edd565b6151136020830185613edd565b6151206040830184613edd565b949350505050565b600060408201905061513d6000830185613edd565b61514a6020830184613edd565b9392505050565b7f4e65656420746f2073656e64206d6f7265206574686572000000000000000000600082015250565b6000615187601783614c31565b915061519282615151565b602082019050919050565b600060208201905081810360008301526151b68161517a565b9050919050565b600081905092915050565b50565b60006151d86000836151bd565b91506151e3826151c8565b600082019050919050565b60006151f9826151cb565b9150819050919050565b7f4661696c656420746f2073656e64204574686572000000000000000000000000600082015250565b6000615239601483614c31565b915061524482615203565b602082019050919050565b600060208201905081810360008301526152688161522c565b9050919050565b600061527a82613e2f565b915061528583613e2f565b925082820390508181111561529d5761529c613e39565b5b92915050565b7f496e707574206172726179206973206e6f74206d617463680000000000000000600082015250565b60006152d9601883614c31565b91506152e4826152a3565b602082019050919050565b60006020820190508181036000830152615308816152cc565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f496e76616c696420616d6f756e7420746f206275726e00000000000000000000600082015250565b6000615374601683614c31565b915061537f8261533e565b602082019050919050565b600060208201905081810360008301526153a381615367565b9050919050565b60006153b582613e2f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036153e7576153e6613e39565b5b600182019050919050565b60006060820190506154076000830186613ece565b6154146020830185613edd565b6154216040830184613edd565b949350505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61545e81613ebc565b82525050565b60006154708383615455565b60208301905092915050565b6000602082019050919050565b600061549482615429565b61549e8185615434565b93506154a983615445565b8060005b838110156154da5781516154c18882615464565b97506154cc8361547c565b9250506001810190506154ad565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61551c81613e2f565b82525050565b600061552e8383615513565b60208301905092915050565b6000602082019050919050565b6000615552826154e7565b61555c81856154f2565b935061556783615503565b8060005b8381101561559857815161557f8882615522565b975061558a8361553a565b92505060018101905061556b565b5085935050505092915050565b600060408201905081810360008301526155bf8185615489565b905081810360208301526155d38184615547565b90509392505050565b7f4e4654206973206c6f636b656400000000000000000000000000000000000000600082015250565b6000615612600d83614c31565b915061561d826155dc565b602082019050919050565b6000602082019050818103600083015261564181615605565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b600061567e601483614c31565b915061568982615648565b602082019050919050565b600060208201905081810360008301526156ad81615671565b9050919050565b600082825260208201905092915050565b60006156d26000836156b4565b91506156dd826151c8565b600082019050919050565b600060a0820190506156fd6000830187613ece565b61570a6020830186613ece565b6157176040830185613edd565b6157246060830184613edd565b8181036080830152615735816156c5565b905095945050505050565b7f496e76616c696420696e707574206172726179206c656e677468000000000000600082015250565b6000615776601a83614c31565b915061578182615740565b602082019050919050565b600060208201905081810360008301526157a581615769565b9050919050565b7f4f766572206574682062616c616e636500000000000000000000000000000000600082015250565b60006157e2601083614c31565b91506157ed826157ac565b602082019050919050565b60006020820190508181036000830152615811816157d5565b9050919050565b7f4f76657220746f6b656e2062616c616e63650000000000000000000000000000600082015250565b600061584e601283614c31565b915061585982615818565b602082019050919050565b6000602082019050818103600083015261587d81615841565b9050919050565b60006158908289614e8f565b6014820191506158a08288614eb0565b6020820191506158b08287614eb0565b6020820191506158c08286614eb0565b6020820191506158d08285614eb0565b6020820191506158e08284614eb0565b602082019150819050979650505050505050565b7f496e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b600061592a601183614c31565b9150615935826158f4565b602082019050919050565b600060208201905081810360008301526159598161591d565b9050919050565b60006080820190506159756000830187613edd565b6159826020830186613edd565b61598f6040830185613edd565b61599c6060830184613edd565b95945050505050565b7f47616d65206973206e6f7420636c6f7365640000000000000000000000000000600082015250565b60006159db601283614c31565b91506159e6826159a5565b602082019050919050565b60006020820190508181036000830152615a0a816159ce565b9050919050565b7f4e6f7468696e6720746f20776974686472617700000000000000000000000000600082015250565b6000615a47601383614c31565b9150615a5282615a11565b602082019050919050565b60006020820190508181036000830152615a7681615a3a565b9050919050565b7f676173466565206973206e6f7420736574000000000000000000000000000000600082015250565b6000615ab3601183614c31565b9150615abe82615a7d565b602082019050919050565b60006020820190508181036000830152615ae281615aa6565b9050919050565b7f496e76616c696420496400000000000000000000000000000000000000000000600082015250565b6000615b1f600a83614c31565b9150615b2a82615ae9565b602082019050919050565b60006020820190508181036000830152615b4e81615b12565b9050919050565b7f4f7665722077616c6c6574206c696d6974000000000000000000000000000000600082015250565b6000615b8b601183614c31565b9150615b9682615b55565b602082019050919050565b60006020820190508181036000830152615bba81615b7e565b9050919050565b6000615bcd8287614e8f565b601482019150615bdd8286614eb0565b602082019150615bed8285614eb0565b602082019150615bfd8284614eb0565b60208201915081905095945050505050565b600081519050919050565b60005b83811015615c38578082015181840152602081019050615c1d565b60008484015250505050565b6000615c4f82615c0f565b615c5981856151bd565b9350615c69818560208601615c1a565b80840191505092915050565b6000819050919050565b615c90615c8b826142d6565b615c75565b82525050565b6000615ca28285615c44565b9150615cae8284615c7f565b6020820191508190509392505050565b7f496e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b6000615cf4600e83614c31565b9150615cff82615cbe565b602082019050919050565b60006020820190508181036000830152615d2381615ce7565b9050919050565b7f4d61782070657220626174636820726561636865640000000000000000000000600082015250565b6000615d60601583614c31565b9150615d6b82615d2a565b602082019050919050565b60006020820190508181036000830152615d8f81615d53565b9050919050565b6000608082019050615dab6000830186613ece565b615db86020830185613edd565b615dc56040830184613edd565b8181036060830152615dd6816156c5565b9050949350505050565b6000604082019050615df56000830185613ece565b615e026020830184614339565b9392505050565b600060ff82169050919050565b615e1f81615e09565b82525050565b6000608082019050615e3a6000830187614339565b615e476020830186615e16565b615e546040830185614339565b615e616060830184614339565b9594505050505056fea26469706673582212202091cb58f0c06bdd4da657c85753dc6076d69b57c462b868d288344d7a43c7ae64736f6c63430008140033000000000000000000000000d26a6cfa13736463a24d5891a1846fe1db4528a8000000000000000000000000d26a6cfa13736463a24d5891a1846fe1db4528a8000000000000000000000000dc678248e99a5a7aee93342af067ea8bded520ec00000000000000000000000063a37fbd924c6d5e2c2a7fdfddbd079a0837c675000000000000000000000000bed075eb198a74c08f61e01476cbc5553796ea03000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed000000000000000000000000327f51b01b1cae97bce6e6a8bf878c3106e4286b0000000000000000000000002536fe9ab3f511540f2f9e2ec2a805005c3dd800
Deployed Bytecode
0x6080604052600436106103035760003560e01c80638d9d548211610190578063bed99850116100dc578063d547741f11610095578063f23a6e611161006f578063f23a6e6114610bc6578063f72fc7cb14610c03578063fcd2117d14610c2e578063fdbefb5914610c595761035c565b8063d547741f14610b44578063e0f06e6f14610b6d578063ede6ec5d14610b895761035c565b8063bed9985014610a42578063bee2660914610a6d578063c020b08c14610a98578063c0be0c0b14610ac3578063c957497514610aee578063d2d93f9014610b195761035c565b80639f87295011610149578063ad6190e111610123578063ad6190e11461099a578063ad85e3bd146109c3578063b943cbbb146109ee578063bc90c27314610a175761035c565b80639f8729501461091b5780639fc0db5614610946578063a217fddf1461096f5761035c565b80638d9d54821461081d57806390824c5b1461084857806391d148541461087357806397d75776146108b057806398795ee6146108db5780639b5b9b18146108f25761035c565b8063470e3ec91161024f57806362af5693116102085780636e3e40d9116101e25780636e3e40d91461077557806373a58223146107a057806375b238fc146107c95780638af02ab1146107f45761035c565b806362af5693146106f6578063634252dc1461071f5780636d99ef461461074a5761035c565b8063470e3ec9146105e657806347ccca02146106235780634c57207d1461064e5780634cb8e7601461067757806360174693146106a25780636088e93a146106cd5761035c565b80632841a143116102bc578063368b28bd11610296578063368b28bd1461055f578063409a33ce1461058857806341a21bcf1461059f57806346816290146105ca5761035c565b80632841a143146104e45780632f2ff15d1461050d57806336568abe146105365761035c565b8063010d49eb146103b057806301ffc9a7146103d9578063032db8921461041657806317d70f7c1461043f578063248a9ca31461046a5780632614160e146104a75761035c565b3661035c5734600d600082825461031a9190613e68565b925050819055507f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258743334604051610352929190613eec565b60405180910390a1005b34600d600082825461036e9190613e68565b925050819055507f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f8852587433346040516103a6929190613eec565b60405180910390a1005b3480156103bc57600080fd5b506103d760048036038101906103d29190613f55565b610c84565b005b3480156103e557600080fd5b5061040060048036038101906103fb9190614000565b610cf3565b60405161040d9190614048565b60405180910390f35b34801561042257600080fd5b5061043d600480360381019061043891906141d5565b610d6d565b005b34801561044b57600080fd5b50610454611734565b60405161046191906142bb565b60405180910390f35b34801561047657600080fd5b50610491600480360381019061048c919061430c565b611739565b60405161049e9190614348565b60405180910390f35b3480156104b357600080fd5b506104ce60048036038101906104c99190614363565b611758565b6040516104db91906142bb565b60405180910390f35b3480156104f057600080fd5b5061050b60048036038101906105069190614390565b611770565b005b34801561051957600080fd5b50610534600480360381019061052f91906143bd565b61182d565b005b34801561054257600080fd5b5061055d600480360381019061055891906143bd565b61184f565b005b34801561056b57600080fd5b5061058660048036038101906105819190614429565b6118ca565b005b34801561059457600080fd5b5061059d611912565b005b3480156105ab57600080fd5b506105b46119f4565b6040516105c191906142bb565b60405180910390f35b6105e460048036038101906105df9190613f55565b6119fa565b005b3480156105f257600080fd5b5061060d60048036038101906106089190614390565b611c68565b60405161061a91906142bb565b60405180910390f35b34801561062f57600080fd5b50610638611c80565b60405161064591906144b5565b60405180910390f35b34801561065a57600080fd5b506106756004803603810190610670919061465b565b611ca4565b005b34801561068357600080fd5b5061068c611fbe565b60405161069991906146d3565b60405180910390f35b3480156106ae57600080fd5b506106b7611fe4565b6040516106c491906142bb565b60405180910390f35b3480156106d957600080fd5b506106f460048036038101906106ef91906146ee565b611fea565b005b34801561070257600080fd5b5061071d60048036038101906107189190614429565b6121f9565b005b34801561072b57600080fd5b50610734612241565b6040516107419190614348565b60405180910390f35b34801561075657600080fd5b5061075f612265565b60405161076c9190614048565b60405180910390f35b34801561078157600080fd5b5061078a612278565b60405161079791906142bb565b60405180910390f35b3480156107ac57600080fd5b506107c760048036038101906107c2919061472e565b61227e565b005b3480156107d557600080fd5b506107de612674565b6040516107eb9190614348565b60405180910390f35b34801561080057600080fd5b5061081b600480360381019061081691906147d5565b612698565b005b34801561082957600080fd5b50610832612a8b565b60405161083f91906142bb565b60405180910390f35b34801561085457600080fd5b5061085d612a91565b60405161086a91906146d3565b60405180910390f35b34801561087f57600080fd5b5061089a600480360381019061089591906143bd565b612ab5565b6040516108a79190614048565b60405180910390f35b3480156108bc57600080fd5b506108c5612b1f565b6040516108d2919061489f565b60405180910390f35b3480156108e757600080fd5b506108f0612b37565b005b3480156108fe57600080fd5b50610919600480360381019061091491906146ee565b612c8c565b005b34801561092757600080fd5b50610930612e30565b60405161093d91906146d3565b60405180910390f35b34801561095257600080fd5b5061096d600480360381019061096891906148ba565b612e56565b005b34801561097b57600080fd5b50610984612fcd565b6040516109919190614348565b60405180910390f35b3480156109a657600080fd5b506109c160048036038101906109bc9190614935565b612fd4565b005b3480156109cf57600080fd5b506109d8613066565b6040516109e591906146d3565b60405180910390f35b3480156109fa57600080fd5b50610a156004803603810190610a109190614429565b61308c565b005b348015610a2357600080fd5b50610a2c6132c1565b604051610a3991906142bb565b60405180910390f35b348015610a4e57600080fd5b50610a576132c7565b604051610a6491906142bb565b60405180910390f35b348015610a7957600080fd5b50610a826132cd565b604051610a8f9190614048565b60405180910390f35b348015610aa457600080fd5b50610aad6132e0565b604051610aba91906149f5565b60405180910390f35b348015610acf57600080fd5b50610ad8613304565b604051610ae591906142bb565b60405180910390f35b348015610afa57600080fd5b50610b0361330a565b604051610b1091906142bb565b60405180910390f35b348015610b2557600080fd5b50610b2e613310565b604051610b3b91906142bb565b60405180910390f35b348015610b5057600080fd5b50610b6b6004803603810190610b6691906143bd565b613316565b005b610b876004803603810190610b829190614a10565b613338565b005b348015610b9557600080fd5b50610bb06004803603810190610bab9190614363565b6137fc565b604051610bbd91906142bb565b60405180910390f35b348015610bd257600080fd5b50610bed6004803603810190610be89190614b02565b613814565b604051610bfa9190614bab565b60405180910390f35b348015610c0f57600080fd5b50610c18613843565b604051610c2591906142bb565b60405180910390f35b348015610c3a57600080fd5b50610c43613849565b604051610c5091906146d3565b60405180910390f35b348015610c6557600080fd5b50610c6e61386f565b604051610c7b91906142bb565b60405180910390f35b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610cae81613875565b60405180604001604052808481526020018381525060036000868152602001908152602001600020600082015181600001556020820151816001015590505050505050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610d665750610d6582613889565b5b9050919050565b867f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b8152600401610dc9929190614bc6565b602060405180830381865afa158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a9190614c04565b1015610e4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4290614c8e565b60405180910390fd5b601360149054906101000a900460ff1615610e9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9290614cfa565b60405180910390fd5b85601460008b81526020019081526020016000205414610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790614d66565b60405180910390fd5b600c5485610efe9190613e68565b4210610f3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3690614dd2565b60405180910390fd5b6016600083815260200190815260200160002060009054906101000a900460ff1615610fa0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9790614e3e565b60405180910390fd5b6000610fe1338b8b8b8b8b8b8b8b604051602001610fc699989796959493929190614ec7565b604051602081830303815290604052805190602001206138f3565b90506110308183600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166139659092919063ffffffff16565b61106f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106690614fb6565b60405180910390fd5b60016016600085815260200190815260200160002060006101000a81548160ff02191690831515021790555042601460008c8152602001908152602001600020819055507f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff166323b872dd33308b6040518463ffffffff1660e01b815260040161111093929190614fd6565b6020604051808303816000875af115801561112f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111539190615022565b506000612710600a548a611167919061504f565b61117191906150c0565b905080600f60008282546111859190613e68565b925050819055505060006127106007548a6111a0919061504f565b6111aa91906150c0565b905060006127106008548b6111bf919061504f565b6111c991906150c0565b905060006127106009548c6111de919061504f565b6111e891906150c0565b90506000612710600b548d6111fd919061504f565b61120791906150c0565b905081600e600082825461121b9190613e68565b9250508190555060008411156112b7577f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff166342966c68856040518263ffffffff1660e01b815260040161128491906142bb565b600060405180830381600087803b15801561129e57600080fd5b505af11580156112b2573d6000803e3d6000fd5b505050505b6000831115611382577f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518363ffffffff1660e01b815260040161133d929190613eec565b6020604051808303816000875af115801561135c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113809190615022565b505b600081111561144d577f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401611408929190613eec565b6020604051808303816000875af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b9190615022565b505b60008811156114f6577f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8a8a6040518363ffffffff1660e01b81526004016114b1929190613eec565b6020604051808303816000875af11580156114d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f49190615022565b505b60008e148015611506575060008d115b1561156957611515338e6139a8565b3373ffffffffffffffffffffffffffffffffffffffff167fcf1d432606e0ee6a23fc32ce701ac36c9897204278c35ac9d65112344b20991760018f8a604051611560939291906150f1565b60405180910390a25b60018e036115c2573373ffffffffffffffffffffffffffffffffffffffff167f759647c6e0ef64ba58a247443390ca1ca127a0e56c0ca73b8e7adb81cdea686f8e896040516115b9929190615128565b60405180910390a25b60028e0361161b573373ffffffffffffffffffffffffffffffffffffffff167f064c6c90fdf69cdb269f2989d2db58656f9f0975deb0a85bc6c3e85ce03849368e89604051611612929190615128565b60405180910390a25b60038e03611674573373ffffffffffffffffffffffffffffffffffffffff167f9841530569e3c231047b6033deea4a0cdaa8030ad02d8995de67995def9af0388e8960405161166b929190615128565b60405180910390a25b60048e036116cd573373ffffffffffffffffffffffffffffffffffffffff167fc41f685bb934317e998f0d450848c2a5c23e6e7d12b456808ffd9ddbc094e9ed8e896040516116c4929190615128565b60405180910390a25b60058e03611724573373ffffffffffffffffffffffffffffffffffffffff167f649d8b4aced808b7b0b9b1f4c3aa7f60b9205e6bf1b7d563e5b7e790844c96398860405161171b91906142bb565b60405180910390a25b5050505050505050505050505050565b600181565b6000806000838152602001908152602001600020600101549050919050565b60156020528060005260406000206000915090505481565b7f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016117cd93929190614fd6565b6020604051808303816000875af11580156117ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118109190615022565b5080600e60008282546118239190613e68565b9250508190555050565b61183682611739565b61183f81613875565b6118498383613b1a565b50505050565b611857613c0b565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146118bb576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118c58282613c13565b505050565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc76118f481613875565b81601360146101000a81548160ff0219169083151502179055505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561193c81613875565b73430000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff1663860043b630601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b81526004016119ad929190614bc6565b6020604051808303816000875af11580156119cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f09190614c04565b5050565b600c5481565b6000818385611a099190613e68565b611a139190613e68565b905080341015611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f9061519d565b60405180910390fd5b8282611a649190613e68565b600d6000828254611a759190613e68565b925050819055506000841115611b5b576000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff1686604051611ad2906151ee565b60006040518083038185875af1925050503d8060008114611b0f576040519150601f19603f3d011682016040523d82523d6000602084013e611b14565b606091505b5050905080611b58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4f9061524f565b60405180910390fd5b50505b60008134611b69919061526f565b90506000811115611c2857600033905060008173ffffffffffffffffffffffffffffffffffffffff1683604051611b9f906151ee565b60006040518083038185875af1925050503d8060008114611bdc576040519150601f19603f3d011682016040523d82523d6000602084013e611be1565b606091505b5050905080611c25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1c9061524f565b60405180910390fd5b50505b7f9f15a78649bd76613c4a49ca8a67ae948862a0eee791ca3d0380853f9afa624f3383604051611c59929190613eec565b60405180910390a15050505050565b60146020528060005260406000206000915090505481565b7f000000000000000000000000bed075eb198a74c08f61e01476cbc5553796ea0381565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc7611cce81613875565b601360149054906101000a900460ff1615611d1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1590614cfa565b60405180910390fd5b8151835114611d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d59906152ef565b60405180910390fd5b60005b8351811015611e3757828181518110611d8157611d8061530f565b5b602002602001015160176000868481518110611da057611d9f61530f565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611e24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1b9061538a565b60405180910390fd5b8080611e2f906153aa565b915050611d65565b506000611e4383613d05565b905060005b8451811015611eee57838181518110611e6457611e6361530f565b5b602002602001015160176000878481518110611e8357611e8261530f565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611ed4919061526f565b925050819055508080611ee6906153aa565b915050611e48565b507f000000000000000000000000bed075eb198a74c08f61e01476cbc5553796ea0373ffffffffffffffffffffffffffffffffffffffff1663f5298aca306001846040518463ffffffff1660e01b8152600401611f4d939291906153f2565b600060405180830381600087803b158015611f6757600080fd5b505af1158015611f7b573d6000803e3d6000fd5b505050507f5ba5896aa4cc7b0ad558b01a8632c8d8a65dd5dee5394b2c2b78c3ddc5f326538484604051611fb09291906155a5565b60405180910390a150505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600f5481565b601360159054906101000a900460ff161561203a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203190615628565b60405180910390fd5b80601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156120bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b390615694565b60405180910390fd5b80601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461210b919061526f565b925050819055507f000000000000000000000000bed075eb198a74c08f61e01476cbc5553796ea0373ffffffffffffffffffffffffffffffffffffffff1663f242432a30846001856040518563ffffffff1660e01b815260040161217294939291906156e8565b600060405180830381600087803b15801561218c57600080fd5b505af11580156121a0573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5686001836040516121ed929190615128565b60405180910390a25050565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc761222381613875565b81601360156101000a81548160ff0219169083151502179055505050565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc781565b601360149054906101000a900460ff1681565b600d5481565b7ff1b411d6abb365480ac902cc153c45e9ded5847a2265ce6d01945d253edb6bc76122a881613875565b825184511480156122ba575081518351145b6122f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122f09061578c565b60405180910390fd5b60005b845181101561266d578381815181106123185761231761530f565b5b6020026020010151471015612362576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612359906157f8565b60405180910390fd5b8281815181106123755761237461530f565b5b60200260200101517f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016123d691906146d3565b602060405180830381865afa1580156123f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124179190614c04565b1015612458576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161244f90615864565b60405180910390fd5b600084828151811061246d5761246c61530f565b5b602002602001015111156125635760008582815181106124905761248f61530f565b5b6020026020010151905060008173ffffffffffffffffffffffffffffffffffffffff168684815181106124c6576124c561530f565b5b60200260200101516040516124da906151ee565b60006040518083038185875af1925050503d8060008114612517576040519150601f19603f3d011682016040523d82523d6000602084013e61251c565b606091505b5050905080612560576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125579061524f565b60405180910390fd5b50505b60008382815181106125785761257761530f565b5b6020026020010151111561265a577f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8683815181106125d5576125d461530f565b5b60200260200101518584815181106125f0576125ef61530f565b5b60200260200101516040518363ffffffff1660e01b8152600401612615929190613eec565b6020604051808303816000875af1158015612634573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126589190615022565b505b8080612665906153aa565b9150506122fc565b5050505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b837f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b81526004016126f4929190614bc6565b602060405180830381865afa158015612711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127359190614c04565b1015612776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276d90614c8e565b60405180910390fd5b601360149054906101000a900460ff16156127c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127bd90614cfa565b60405180910390fd5b600c54836127d49190613e68565b4210612815576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161280c90614dd2565b60405180910390fd5b6016600083815260200190815260200160002060009054906101000a900460ff1615612876576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161286d90614e3e565b60405180910390fd5b60006128b133888888888860405160200161289696959493929190615884565b604051602081830303815290604052805190602001206138f3565b90506129008183600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166139659092919063ffffffff16565b61293f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161293690615940565b60405180910390fd5b60016016600085815260200190815260200160002060006101000a81548160ff0219169083151502179055507f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed73ffffffffffffffffffffffffffffffffffffffff166323b872dd33601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16886040518463ffffffff1660e01b81526004016129ea93929190614fd6565b6020604051808303816000875af1158015612a09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2d9190615022565b503373ffffffffffffffffffffffffffffffffffffffff167f13f135658b67258df1952b1efe89331bc59bde07499073b16d5f4908012dce5b88888887604051612a7a9493929190615960565b60405180910390a250505050505050565b60085481565b7f000000000000000000000000327f51b01b1cae97bce6e6a8bf878c3106e4286b81565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b73430000000000000000000000000000000000000281565b6000801b612b4481613875565b601360149054906101000a900460ff16612b93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8a906159f1565b60405180910390fd5b60004711612bd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bcd90615a5d565b60405180910390fd5b600033905060008173ffffffffffffffffffffffffffffffffffffffff1647604051612c01906151ee565b60006040518083038185875af1925050503d8060008114612c3e576040519150601f19603f3d011682016040523d82523d6000602084013e612c43565b606091505b5050905080612c87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c7e9061524f565b60405180910390fd5b505050565b601360149054906101000a900460ff1615612cdc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cd390614cfa565b60405180910390fd5b7f000000000000000000000000bed075eb198a74c08f61e01476cbc5553796ea0373ffffffffffffffffffffffffffffffffffffffff1663f242432a33306001856040518563ffffffff1660e01b8152600401612d3c94939291906156e8565b600060405180830381600087803b158015612d5657600080fd5b505af1158015612d6a573d6000803e3d6000fd5b5050505080601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612dbd9190613e68565b925050819055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7600184604051612e24929190615128565b60405180910390a35050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775612e8081613875565b85601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050565b6000801b81565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775612ffe81613875565b86600c819055508560068190555084600781905550836008819055508260098190555081600b8190555083838387612710613039919061526f565b613043919061526f565b61304d919061526f565b613057919061526f565b600a8190555050505050505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756130b681613875565b600073ffffffffffffffffffffffffffffffffffffffff16601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603613147576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161313e90615ac9565b60405180910390fd5b81156132075773430000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff1663662aa11d30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b81526004016131be929190614bc6565b6020604051808303816000875af11580156131dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132019190614c04565b506132bd565b73430000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff1663954fa5ee30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401613278929190614bc6565b6020604051808303816000875af1158015613297573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132bb9190614c04565b505b5050565b60095481565b60075481565b601360159054906101000a900460ff1681565b7f000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed81565b600e5481565b600b5481565b600a5481565b61331f82611739565b61332881613875565b6133328383613c13565b50505050565b6016600083815260200190815260200160002060009054906101000a900460ff1615613399576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161339090614e3e565b60405180910390fd5b60006003600087815260200190815260200160002060010154116133f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133e990615b35565b60405180910390fd5b83341015613435576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161342c9061519d565b60405180910390fd5b600c54836134439190613e68565b4210613484576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161347b90614dd2565b60405180910390fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008681526020019081526020016000205460036000878152602001908152602001600020600101541161352c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161352390615ba1565b60405180910390fd5b6000613563338686866040516020016135489493929190615bc1565b604051602081830303815290604052805190602001206138f3565b90506135b28183600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166139659092919063ffffffff16565b6135f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135e890614fb6565b60405180910390fd5b60016016600085815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600360008881526020019081526020016000206040518060400160405290816000820154815260200160018201548152505090506001600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600089815260200190815260200160002060008282546136b49190613e68565b925050819055506000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff1634604051613708906151ee565b60006040518083038185875af1925050503d8060008114613745576040519150601f19603f3d011682016040523d82523d6000602084013e61374a565b606091505b505090508061378e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137859061524f565b60405180910390fd5b61379c3384600001516139a8565b883373ffffffffffffffffffffffffffffffffffffffff167fc431cb1467676373fb31be5becad518ac7951f91428603a40500207d4fe014098560000151896040516137e9929190615128565b60405180910390a3505050505050505050565b60176020528060005260406000206000915090505481565b60007ff23a6e612e1ff4830e658fe43f4e3cb4a5f8170bd5d9e69fb5d7a7fa9e4fdf9790509695505050505050565b60055481565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b61388681613881613c0b565b613d57565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6000806040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250905060008184604051602001613943929190615c96565b6040516020818303038152906040528051906020012090508092505050919050565b60006139718383613da8565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161490509392505050565b600081036139eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016139e290615d0a565b60405180910390fd5b600554811115613a30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a2790615d76565b60405180910390fd5b7f000000000000000000000000bed075eb198a74c08f61e01476cbc5553796ea0373ffffffffffffffffffffffffffffffffffffffff1663731133e9306001846040518463ffffffff1660e01b8152600401613a8e93929190615d96565b600060405180830381600087803b158015613aa857600080fd5b505af1158015613abc573d6000803e3d6000fd5b5050505080601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613b0f9190613e68565b925050819055505050565b6000613b268383612ab5565b613c0057600160008085815260200190815260200160002060000160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550613b9d613c0b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019050613c05565b600090505b92915050565b600033905090565b6000613c1f8383612ab5565b15613cfa57600080600085815260200190815260200160002060000160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550613c97613c0b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a460019050613cff565b600090505b92915050565b600080600090505b8251811015613d5157828181518110613d2957613d2861530f565b5b602002602001015182613d3c9190613e68565b91508080613d49906153aa565b915050613d0d565b50919050565b613d618282612ab5565b613da45780826040517fe2517d3f000000000000000000000000000000000000000000000000000000008152600401613d9b929190615de0565b60405180910390fd5b5050565b60006041825114613db857600080fd5b60008060006020850151915060408501519050606085015160001a925060018684848460405160008152602001604052604051613df89493929190615e25565b6020604051602081039080840390855afa158015613e1a573d6000803e3d6000fd5b50505060206040510351935050505092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613e7382613e2f565b9150613e7e83613e2f565b9250828201905080821115613e9657613e95613e39565b5b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613ec782613e9c565b9050919050565b613ed781613ebc565b82525050565b613ee681613e2f565b82525050565b6000604082019050613f016000830185613ece565b613f0e6020830184613edd565b9392505050565b6000604051905090565b600080fd5b600080fd5b613f3281613e2f565b8114613f3d57600080fd5b50565b600081359050613f4f81613f29565b92915050565b600080600060608486031215613f6e57613f6d613f1f565b5b6000613f7c86828701613f40565b9350506020613f8d86828701613f40565b9250506040613f9e86828701613f40565b9150509250925092565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613fdd81613fa8565b8114613fe857600080fd5b50565b600081359050613ffa81613fd4565b92915050565b60006020828403121561401657614015613f1f565b5b600061402484828501613feb565b91505092915050565b60008115159050919050565b6140428161402d565b82525050565b600060208201905061405d6000830184614039565b92915050565b61406c81613ebc565b811461407757600080fd5b50565b60008135905061408981614063565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6140e282614099565b810181811067ffffffffffffffff82111715614101576141006140aa565b5b80604052505050565b6000614114613f15565b905061412082826140d9565b919050565b600067ffffffffffffffff8211156141405761413f6140aa565b5b61414982614099565b9050602081019050919050565b82818337600083830152505050565b600061417861417384614125565b61410a565b90508281526020810184848401111561419457614193614094565b5b61419f848285614156565b509392505050565b600082601f8301126141bc576141bb61408f565b5b81356141cc848260208601614165565b91505092915050565b60008060008060008060008060006101208a8c0312156141f8576141f7613f1f565b5b60006142068c828d01613f40565b99505060206142178c828d01613f40565b98505060406142288c828d01613f40565b97505060606142398c828d01613f40565b965050608061424a8c828d01613f40565b95505060a061425b8c828d0161407a565b94505060c061426c8c828d01613f40565b93505060e061427d8c828d01613f40565b9250506101008a013567ffffffffffffffff81111561429f5761429e613f24565b5b6142ab8c828d016141a7565b9150509295985092959850929598565b60006020820190506142d06000830184613edd565b92915050565b6000819050919050565b6142e9816142d6565b81146142f457600080fd5b50565b600081359050614306816142e0565b92915050565b60006020828403121561432257614321613f1f565b5b6000614330848285016142f7565b91505092915050565b614342816142d6565b82525050565b600060208201905061435d6000830184614339565b92915050565b60006020828403121561437957614378613f1f565b5b60006143878482850161407a565b91505092915050565b6000602082840312156143a6576143a5613f1f565b5b60006143b484828501613f40565b91505092915050565b600080604083850312156143d4576143d3613f1f565b5b60006143e2858286016142f7565b92505060206143f38582860161407a565b9150509250929050565b6144068161402d565b811461441157600080fd5b50565b600081359050614423816143fd565b92915050565b60006020828403121561443f5761443e613f1f565b5b600061444d84828501614414565b91505092915050565b6000819050919050565b600061447b61447661447184613e9c565b614456565b613e9c565b9050919050565b600061448d82614460565b9050919050565b600061449f82614482565b9050919050565b6144af81614494565b82525050565b60006020820190506144ca60008301846144a6565b92915050565b600067ffffffffffffffff8211156144eb576144ea6140aa565b5b602082029050602081019050919050565b600080fd5b600061451461450f846144d0565b61410a565b90508083825260208201905060208402830185811115614537576145366144fc565b5b835b81811015614560578061454c888261407a565b845260208401935050602081019050614539565b5050509392505050565b600082601f83011261457f5761457e61408f565b5b813561458f848260208601614501565b91505092915050565b600067ffffffffffffffff8211156145b3576145b26140aa565b5b602082029050602081019050919050565b60006145d76145d284614598565b61410a565b905080838252602082019050602084028301858111156145fa576145f96144fc565b5b835b81811015614623578061460f8882613f40565b8452602084019350506020810190506145fc565b5050509392505050565b600082601f8301126146425761464161408f565b5b81356146528482602086016145c4565b91505092915050565b6000806040838503121561467257614671613f1f565b5b600083013567ffffffffffffffff8111156146905761468f613f24565b5b61469c8582860161456a565b925050602083013567ffffffffffffffff8111156146bd576146bc613f24565b5b6146c98582860161462d565b9150509250929050565b60006020820190506146e86000830184613ece565b92915050565b6000806040838503121561470557614704613f1f565b5b60006147138582860161407a565b925050602061472485828601613f40565b9150509250929050565b60008060006060848603121561474757614746613f1f565b5b600084013567ffffffffffffffff81111561476557614764613f24565b5b6147718682870161456a565b935050602084013567ffffffffffffffff81111561479257614791613f24565b5b61479e8682870161462d565b925050604084013567ffffffffffffffff8111156147bf576147be613f24565b5b6147cb8682870161462d565b9150509250925092565b60008060008060008060c087890312156147f2576147f1613f1f565b5b600061480089828a01613f40565b965050602061481189828a01613f40565b955050604061482289828a01613f40565b945050606061483389828a01613f40565b935050608061484489828a01613f40565b92505060a087013567ffffffffffffffff81111561486557614864613f24565b5b61487189828a016141a7565b9150509295509295509295565b600061488982614482565b9050919050565b6148998161487e565b82525050565b60006020820190506148b46000830184614890565b92915050565b600080600080600060a086880312156148d6576148d5613f1f565b5b60006148e48882890161407a565b95505060206148f58882890161407a565b94505060406149068882890161407a565b93505060606149178882890161407a565b92505060806149288882890161407a565b9150509295509295909350565b60008060008060008060c0878903121561495257614951613f1f565b5b600061496089828a01613f40565b965050602061497189828a01613f40565b955050604061498289828a01613f40565b945050606061499389828a01613f40565b93505060806149a489828a01613f40565b92505060a06149b589828a01613f40565b9150509295509295509295565b60006149cd82614460565b9050919050565b60006149df826149c2565b9050919050565b6149ef816149d4565b82525050565b6000602082019050614a0a60008301846149e6565b92915050565b600080600080600060a08688031215614a2c57614a2b613f1f565b5b6000614a3a88828901613f40565b9550506020614a4b88828901613f40565b9450506040614a5c88828901613f40565b9350506060614a6d88828901613f40565b925050608086013567ffffffffffffffff811115614a8e57614a8d613f24565b5b614a9a888289016141a7565b9150509295509295909350565b600080fd5b60008083601f840112614ac257614ac161408f565b5b8235905067ffffffffffffffff811115614adf57614ade614aa7565b5b602083019150836001820283011115614afb57614afa6144fc565b5b9250929050565b60008060008060008060a08789031215614b1f57614b1e613f1f565b5b6000614b2d89828a0161407a565b9650506020614b3e89828a0161407a565b9550506040614b4f89828a01613f40565b9450506060614b6089828a01613f40565b935050608087013567ffffffffffffffff811115614b8157614b80613f24565b5b614b8d89828a01614aac565b92509250509295509295509295565b614ba581613fa8565b82525050565b6000602082019050614bc06000830184614b9c565b92915050565b6000604082019050614bdb6000830185613ece565b614be86020830184613ece565b9392505050565b600081519050614bfe81613f29565b92915050565b600060208284031215614c1a57614c19613f1f565b5b6000614c2884828501614bef565b91505092915050565b600082825260208201905092915050565b7f4572726f72000000000000000000000000000000000000000000000000000000600082015250565b6000614c78600583614c31565b9150614c8382614c42565b602082019050919050565b60006020820190508181036000830152614ca781614c6b565b9050919050565b7f47616d6520697320636c6f736564000000000000000000000000000000000000600082015250565b6000614ce4600e83614c31565b9150614cef82614cae565b602082019050919050565b60006020820190508181036000830152614d1381614cd7565b9050919050565b7f496e76616c6964206c617374206275792074696d650000000000000000000000600082015250565b6000614d50601583614c31565b9150614d5b82614d1a565b602082019050919050565b60006020820190508181036000830152614d7f81614d43565b9050919050565b7f496e76616c69642074696d657374616d70000000000000000000000000000000600082015250565b6000614dbc601183614c31565b9150614dc782614d86565b602082019050919050565b60006020820190508181036000830152614deb81614daf565b9050919050565b7f4e6f6e6365206973207573656400000000000000000000000000000000000000600082015250565b6000614e28600d83614c31565b9150614e3382614df2565b602082019050919050565b60006020820190508181036000830152614e5781614e1b565b9050919050565b60008160601b9050919050565b6000614e7682614e5e565b9050919050565b6000614e8882614e6b565b9050919050565b614ea0614e9b82613ebc565b614e7d565b82525050565b6000819050919050565b614ec1614ebc82613e2f565b614ea6565b82525050565b6000614ed3828c614e8f565b601482019150614ee3828b614eb0565b602082019150614ef3828a614eb0565b602082019150614f038289614eb0565b602082019150614f138288614eb0565b602082019150614f238287614eb0565b602082019150614f338286614e8f565b601482019150614f438285614eb0565b602082019150614f538284614eb0565b6020820191508190509a9950505050505050505050565b7f494e56414c49445f5349474e0000000000000000000000000000000000000000600082015250565b6000614fa0600c83614c31565b9150614fab82614f6a565b602082019050919050565b60006020820190508181036000830152614fcf81614f93565b9050919050565b6000606082019050614feb6000830186613ece565b614ff86020830185613ece565b6150056040830184613edd565b949350505050565b60008151905061501c816143fd565b92915050565b60006020828403121561503857615037613f1f565b5b60006150468482850161500d565b91505092915050565b600061505a82613e2f565b915061506583613e2f565b925082820261507381613e2f565b9150828204841483151761508a57615089613e39565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006150cb82613e2f565b91506150d683613e2f565b9250826150e6576150e5615091565b5b828204905092915050565b60006060820190506151066000830186613edd565b6151136020830185613edd565b6151206040830184613edd565b949350505050565b600060408201905061513d6000830185613edd565b61514a6020830184613edd565b9392505050565b7f4e65656420746f2073656e64206d6f7265206574686572000000000000000000600082015250565b6000615187601783614c31565b915061519282615151565b602082019050919050565b600060208201905081810360008301526151b68161517a565b9050919050565b600081905092915050565b50565b60006151d86000836151bd565b91506151e3826151c8565b600082019050919050565b60006151f9826151cb565b9150819050919050565b7f4661696c656420746f2073656e64204574686572000000000000000000000000600082015250565b6000615239601483614c31565b915061524482615203565b602082019050919050565b600060208201905081810360008301526152688161522c565b9050919050565b600061527a82613e2f565b915061528583613e2f565b925082820390508181111561529d5761529c613e39565b5b92915050565b7f496e707574206172726179206973206e6f74206d617463680000000000000000600082015250565b60006152d9601883614c31565b91506152e4826152a3565b602082019050919050565b60006020820190508181036000830152615308816152cc565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f496e76616c696420616d6f756e7420746f206275726e00000000000000000000600082015250565b6000615374601683614c31565b915061537f8261533e565b602082019050919050565b600060208201905081810360008301526153a381615367565b9050919050565b60006153b582613e2f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036153e7576153e6613e39565b5b600182019050919050565b60006060820190506154076000830186613ece565b6154146020830185613edd565b6154216040830184613edd565b949350505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61545e81613ebc565b82525050565b60006154708383615455565b60208301905092915050565b6000602082019050919050565b600061549482615429565b61549e8185615434565b93506154a983615445565b8060005b838110156154da5781516154c18882615464565b97506154cc8361547c565b9250506001810190506154ad565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61551c81613e2f565b82525050565b600061552e8383615513565b60208301905092915050565b6000602082019050919050565b6000615552826154e7565b61555c81856154f2565b935061556783615503565b8060005b8381101561559857815161557f8882615522565b975061558a8361553a565b92505060018101905061556b565b5085935050505092915050565b600060408201905081810360008301526155bf8185615489565b905081810360208301526155d38184615547565b90509392505050565b7f4e4654206973206c6f636b656400000000000000000000000000000000000000600082015250565b6000615612600d83614c31565b915061561d826155dc565b602082019050919050565b6000602082019050818103600083015261564181615605565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b600061567e601483614c31565b915061568982615648565b602082019050919050565b600060208201905081810360008301526156ad81615671565b9050919050565b600082825260208201905092915050565b60006156d26000836156b4565b91506156dd826151c8565b600082019050919050565b600060a0820190506156fd6000830187613ece565b61570a6020830186613ece565b6157176040830185613edd565b6157246060830184613edd565b8181036080830152615735816156c5565b905095945050505050565b7f496e76616c696420696e707574206172726179206c656e677468000000000000600082015250565b6000615776601a83614c31565b915061578182615740565b602082019050919050565b600060208201905081810360008301526157a581615769565b9050919050565b7f4f766572206574682062616c616e636500000000000000000000000000000000600082015250565b60006157e2601083614c31565b91506157ed826157ac565b602082019050919050565b60006020820190508181036000830152615811816157d5565b9050919050565b7f4f76657220746f6b656e2062616c616e63650000000000000000000000000000600082015250565b600061584e601283614c31565b915061585982615818565b602082019050919050565b6000602082019050818103600083015261587d81615841565b9050919050565b60006158908289614e8f565b6014820191506158a08288614eb0565b6020820191506158b08287614eb0565b6020820191506158c08286614eb0565b6020820191506158d08285614eb0565b6020820191506158e08284614eb0565b602082019150819050979650505050505050565b7f496e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b600061592a601183614c31565b9150615935826158f4565b602082019050919050565b600060208201905081810360008301526159598161591d565b9050919050565b60006080820190506159756000830187613edd565b6159826020830186613edd565b61598f6040830185613edd565b61599c6060830184613edd565b95945050505050565b7f47616d65206973206e6f7420636c6f7365640000000000000000000000000000600082015250565b60006159db601283614c31565b91506159e6826159a5565b602082019050919050565b60006020820190508181036000830152615a0a816159ce565b9050919050565b7f4e6f7468696e6720746f20776974686472617700000000000000000000000000600082015250565b6000615a47601383614c31565b9150615a5282615a11565b602082019050919050565b60006020820190508181036000830152615a7681615a3a565b9050919050565b7f676173466565206973206e6f7420736574000000000000000000000000000000600082015250565b6000615ab3601183614c31565b9150615abe82615a7d565b602082019050919050565b60006020820190508181036000830152615ae281615aa6565b9050919050565b7f496e76616c696420496400000000000000000000000000000000000000000000600082015250565b6000615b1f600a83614c31565b9150615b2a82615ae9565b602082019050919050565b60006020820190508181036000830152615b4e81615b12565b9050919050565b7f4f7665722077616c6c6574206c696d6974000000000000000000000000000000600082015250565b6000615b8b601183614c31565b9150615b9682615b55565b602082019050919050565b60006020820190508181036000830152615bba81615b7e565b9050919050565b6000615bcd8287614e8f565b601482019150615bdd8286614eb0565b602082019150615bed8285614eb0565b602082019150615bfd8284614eb0565b60208201915081905095945050505050565b600081519050919050565b60005b83811015615c38578082015181840152602081019050615c1d565b60008484015250505050565b6000615c4f82615c0f565b615c5981856151bd565b9350615c69818560208601615c1a565b80840191505092915050565b6000819050919050565b615c90615c8b826142d6565b615c75565b82525050565b6000615ca28285615c44565b9150615cae8284615c7f565b6020820191508190509392505050565b7f496e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b6000615cf4600e83614c31565b9150615cff82615cbe565b602082019050919050565b60006020820190508181036000830152615d2381615ce7565b9050919050565b7f4d61782070657220626174636820726561636865640000000000000000000000600082015250565b6000615d60601583614c31565b9150615d6b82615d2a565b602082019050919050565b60006020820190508181036000830152615d8f81615d53565b9050919050565b6000608082019050615dab6000830186613ece565b615db86020830185613edd565b615dc56040830184613edd565b8181036060830152615dd6816156c5565b9050949350505050565b6000604082019050615df56000830185613ece565b615e026020830184614339565b9392505050565b600060ff82169050919050565b615e1f81615e09565b82525050565b6000608082019050615e3a6000830187614339565b615e476020830186615e16565b615e546040830185614339565b615e616060830184614339565b9594505050505056fea26469706673582212202091cb58f0c06bdd4da657c85753dc6076d69b57c462b868d288344d7a43c7ae64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d26a6cfa13736463a24d5891a1846fe1db4528a8000000000000000000000000d26a6cfa13736463a24d5891a1846fe1db4528a8000000000000000000000000dc678248e99a5a7aee93342af067ea8bded520ec00000000000000000000000063a37fbd924c6d5e2c2a7fdfddbd079a0837c675000000000000000000000000bed075eb198a74c08f61e01476cbc5553796ea03000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed000000000000000000000000327f51b01b1cae97bce6e6a8bf878c3106e4286b0000000000000000000000002536fe9ab3f511540f2f9e2ec2a805005c3dd800
-----Decoded View---------------
Arg [0] : _defaultAdmin (address): 0xD26A6Cfa13736463a24D5891A1846fE1DB4528a8
Arg [1] : _adminAddress (address): 0xD26A6Cfa13736463a24D5891A1846fE1DB4528a8
Arg [2] : _workerAddress (address): 0xDc678248e99a5a7AeE93342aF067Ea8BdED520ec
Arg [3] : _signerAddress (address): 0x63A37FBD924C6D5e2c2a7FdfddBd079a0837c675
Arg [4] : _gangsterAddress (address): 0xBED075eB198A74C08f61e01476CbC5553796ea03
Arg [5] : _fiatAddress (address): 0xFf76CA0B2006183ABeB22ccb56740083a68767Ed
Arg [6] : _pointsOperator (address): 0x327f51b01B1caE97bCe6e6a8bf878C3106E4286b
Arg [7] : _blastPointAddr (address): 0x2536FE9ab3F511540F2f9e2eC2A805005C3Dd800
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000d26a6cfa13736463a24d5891a1846fe1db4528a8
Arg [1] : 000000000000000000000000d26a6cfa13736463a24d5891a1846fe1db4528a8
Arg [2] : 000000000000000000000000dc678248e99a5a7aee93342af067ea8bded520ec
Arg [3] : 00000000000000000000000063a37fbd924c6d5e2c2a7fdfddbd079a0837c675
Arg [4] : 000000000000000000000000bed075eb198a74c08f61e01476cbc5553796ea03
Arg [5] : 000000000000000000000000ff76ca0b2006183abeb22ccb56740083a68767ed
Arg [6] : 000000000000000000000000327f51b01b1cae97bce6e6a8bf878c3106e4286b
Arg [7] : 0000000000000000000000002536fe9ab3f511540f2f9e2ec2a805005c3dd800
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
BLAST | 100.00% | $1,902.82 | 0.001159 | $2.21 |
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.